/* Draw screen — WW2-themed design (from Documentation/draw-screen.html).
   The background photo is served by Flask from /static/img/. The same relative
   URL works locally (http://localhost:8000/static/img/background2.png) and on
   the server (https://dice.hala.dk/static/img/background2.png). */
:root {
  --bg-photo: url('/static/img/background2.png');

  --overlay: rgba(18, 24, 12, 0.58);
  --gold: #e8c060;
  --gold-dim: rgba(232, 192, 96, 0.18);
  --gold-border: rgba(232, 192, 96, 0.45);
  --cream: #f5f2ec;
  --cream-border: #e0dcd4;
  --panel-bg: #f5f2ec;
  --text-dark: #2c2c28;
  --text-mid: #7a7870;
  --text-muted: #b0ada8;
  --card-bg: #ffffff;
  --green-btn: #2c3820;
  --remove-bg: #fef6f6;
  --remove-border: #f0c8c8;
  --remove-text: #a33030;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: #1a1a18;
  font-family: 'Inter', sans-serif;
}

/* Full-screen (phone shell removed — fills the viewport). */
.screen {
  width: 100%;
  min-height: 100vh;
  background: var(--cream);
  overflow-x: hidden;
}

.hidden { display: none !important; }
button:disabled { opacity: 0.4; cursor: default; }

/* ---- Hero / background scene ---- */
.hero {
  position: relative;
  width: 100%;
  height: 290px;
  background-image: var(--bg-photo);
  background-size: cover;
  background-position: center 55%;
  background-color: #4a5a3a; /* fallback if photo not loaded */
  overflow: hidden;
}

.hero-short { height: 180px; }
.hero-overlay { position: absolute; inset: 0; background: var(--overlay); }
.hero-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.45) 100%);
}

.hero-content {
  position: relative; z-index: 2; height: 100%;
  display: flex; flex-direction: column; padding: 0 16px 0;
  max-width: 560px; margin: 0 auto; width: 100%;
}
.hero-content-center { justify-content: center; }

/* Shared Bebas heading used in hero areas across screens. */
.screen-heading {
  font-family: 'Bebas Neue', sans-serif; font-size: 30px; letter-spacing: 0.06em;
  color: #f0ead8; margin-top: 8px;
}

/* Shared stepper (player count, dice counts). */
.players-stepper { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 16px; }
.ps-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin-right: 4px; }
.stepper { display: flex; align-items: center; gap: 10px; }
.ps-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--cream-border);
  background: var(--card-bg); color: var(--text-dark); font-size: 20px; line-height: 1;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ps-count { font-family: 'Bebas Neue', sans-serif; font-size: 24px; color: var(--text-dark); min-width: 24px; text-align: center; }

/* ---- Header ---- */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 16px; padding-bottom: 8px;
}
.app-name { font-family: 'Bebas Neue', sans-serif; font-size: 24px; letter-spacing: 0.12em; color: #f0ead8; }
.app-name em { color: var(--gold); font-style: normal; }
.round-pill {
  background: var(--gold-dim); border: 1px solid var(--gold-border); color: var(--gold);
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 4px 12px; border-radius: 20px;
}
.timer-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; margin-bottom: 10px;
}
.timer-item { display: flex; align-items: center; gap: 6px; }
.timer-item i { font-size: 13px; }
/* Total elapsed (left) — primary: brighter + bolder for visibility. */
.timer-total { color: #fbf8f0; font-weight: 700; letter-spacing: 0.02em; }
.timer-total i { color: var(--gold); }
/* Active-die timer (right) — secondary. */
.timer-active { color: rgba(240, 234, 216, 0.6); font-weight: 500; }

/* ---- Alert banner ---- */
.alert-banner {
  background: rgba(232, 192, 96, 0.14); border: 1px solid var(--gold-border);
  border-radius: 10px; padding: 8px 12px; display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--gold); font-weight: 500; letter-spacing: 0.02em; margin-bottom: 12px;
}
.alert-banner i { font-size: 15px; flex-shrink: 0; }

/* ---- Last draw hero (rendered die) ---- */
.draw-hero {
  flex: 1; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px; padding: 14px 16px; text-align: center;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: 10px; margin-bottom: 0;
}
.die-stage { display: flex; justify-content: center; }
/* Outer shell (darker shade of die colour) + inner face are coloured inline. */
.die {
  width: 124px; height: 124px; border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  animation: die-in 200ms ease-out;          /* fresh node per draw replays this */
}
.die.placeholder { animation: none; opacity: 0.32; }    /* before the first draw */
.die-face {
  width: 108px; height: 108px; border-radius: 18px;
  border: 3px solid; position: relative;
}
.die-rule { position: absolute; left: 10px; right: 10px; line-height: 0; }
.die-rule-top { top: 18px; }
.die-rule-bottom { bottom: 18px; }
.die-word {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-family: 'Oswald', sans-serif; font-weight: 500; font-size: 22px;
  letter-spacing: 0.08em; text-transform: uppercase;
  text-align: center; white-space: nowrap; width: 100%;
}
@keyframes die-in { from { transform: scale(0); } to { transform: scale(1); } }
.draw-hero-sub { font-size: 11px; color: rgba(240, 234, 216, 0.45); letter-spacing: 0.08em; text-transform: uppercase; }

/* ---- Error toast (App.showError) — fixed, dismissible, on every page ---- */
.app-error {
  position: fixed; left: 50%; bottom: 24px;
  transform: translateX(-50%) translateY(140%);
  max-width: min(420px, 92vw); z-index: 1000;
  background: #7a1f1f; color: #f7e9e3; border: 1px solid #b04a40;
  padding: 12px 16px; border-radius: 12px;
  font-family: 'Inter', sans-serif; font-size: 14px; line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); cursor: pointer;
  opacity: 0; transition: transform 0.25s ease, opacity 0.25s ease;
}
.app-error.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---- Slide-up panel ---- */
.panel {
  background: var(--panel-bg); border-radius: 24px 24px 0 0; padding: 14px 14px 24px;
  margin-top: -12px; position: relative; z-index: 3; max-width: 560px; margin-left: auto; margin-right: auto;
}
.panel-handle { width: 36px; height: 4px; background: #d4d0c8; border-radius: 2px; margin: 0 auto 14px; }

/* ---- Counts ---- */
.counts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.count-card {
  background: var(--card-bg); border: 1px solid var(--cream-border); border-radius: 12px;
  padding: 10px 12px; display: flex; align-items: center; gap: 10px;
}
.count-swatch { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(0,0,0,0.3); }
.count-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 2px; }
.count-val { font-size: 16px; font-weight: 600; color: var(--text-dark); }
.count-val span { font-size: 11px; font-weight: 400; color: var(--text-muted); }

/* ---- Draw button ---- */
.draw-btn {
  width: 100%; background: var(--green-btn); color: var(--gold); border: none; border-radius: 14px;
  font-family: 'Bebas Neue', sans-serif; font-size: 28px; letter-spacing: 0.22em; padding: 15px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 10px; transition: transform 0.08s, background 0.1s; -webkit-tap-highlight-color: transparent;
}
.draw-btn:active { transform: scale(0.98); background: #1e2a14; }
.draw-btn i { font-size: 22px; }

/* ---- Snap buttons ---- */
.snap-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.snap-btn {
  background: var(--card-bg); border: 1px solid var(--cream-border); border-radius: 10px;
  color: var(--text-mid); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 10px 4px; cursor: pointer; text-align: center; transition: border-color 0.1s, color 0.1s; -webkit-tap-highlight-color: transparent;
}
.snap-btn:active { border-color: #b0a890; color: var(--text-dark); }

/* ---- Action buttons ---- */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.action-btn {
  background: var(--card-bg); border: 1px solid var(--cream-border); border-radius: 10px;
  color: var(--text-mid); font-size: 12px; font-weight: 500; padding: 11px 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px; transition: border-color 0.1s; -webkit-tap-highlight-color: transparent;
}
.action-btn i { font-size: 15px; }
.action-btn.danger { color: var(--remove-text); border-color: var(--remove-border); background: var(--remove-bg); }
.action-btn.danger:active { border-color: #d04848; }

/* ---- Pass the bag ---- */
.pass-btn {
  width: 100%; background: var(--card-bg); border: 1px solid var(--cream-border); border-radius: 10px;
  color: var(--text-mid); font-size: 12px; font-weight: 500; padding: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px;
  transition: border-color 0.1s; -webkit-tap-highlight-color: transparent;
}
.pass-btn i { font-size: 15px; }
.pass-btn:active { border-color: #b0a890; }

/* ---- Draw log ---- */
.log-section { border-top: 1px solid var(--cream-border); padding-top: 10px; }
.log-header { font-size: 10px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--text-muted); margin-bottom: 8px; }
.log-list { max-height: 200px; overflow-y: auto; }
.log-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #ece8e0; }
.log-rnd { font-size: 10px; color: #c8c4bc; min-width: 22px; text-transform: uppercase; letter-spacing: 0.05em; }
.log-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(0,0,0,0.55); }
.log-name { font-size: 12px; color: var(--text-mid); flex: 1; text-transform: capitalize; }
.log-time { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ---- End game button ---- */
.end-game-row { display: flex; justify-content: flex-end; margin-top: 14px; }
.end-btn {
  background: #fff8f0; border: 1px solid #e8c090; border-radius: 8px; color: #9a6020;
  font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 6px 12px; cursor: pointer; display: flex; align-items: center; gap: 5px;
  transition: background 0.1s; -webkit-tap-highlight-color: transparent;
}
.end-btn:active { background: #fde8c8; }
.end-btn i { font-size: 13px; }

/* ---- Modal picker (remove / put back) ---- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-card { background: var(--panel-bg); border-radius: 16px; padding: 18px; width: 100%; max-width: 380px; }
.modal-card h3 { font-family: 'Bebas Neue', sans-serif; letter-spacing: 0.06em; color: var(--text-dark); font-size: 22px; margin-bottom: 12px; }
.modal-options { display: grid; gap: 8px; margin-bottom: 12px; }
.modal-opt {
  display: flex; align-items: center; gap: 10px; padding: 12px;
  border: 1px solid var(--cream-border); border-radius: 10px; background: var(--card-bg);
  color: var(--text-dark); font-size: 14px; cursor: pointer; text-align: left; text-transform: capitalize;
}
.modal-opt .dot { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; background: var(--swatch, #888); }
.modal-cancel { width: 100%; background: transparent; border: 1px solid var(--cream-border); border-radius: 10px; padding: 10px; color: var(--text-mid); cursor: pointer; }
