/* ============================================================
   Party Games - web port of the Flutter app by Vitgrub Studios
   Plain, conventional dark theme. No emoji icons, no soft pills.
   ============================================================ */

:root {
  --bg: #1c1f24;
  --surface: #24272d;
  --surface-2: #2c3036;
  --line: #3a3f47;
  --line-strong: #4a5058;
  --text: #e7e9ec;
  --muted: #9aa1ab;
  --muted2: #6b727c;
  --accent: #3b82f6;
  --accent-hover: #2f6fd6;
  --correct: #2e7d32;
  --correct-accent: #66bb6a;
  --skip: #b26a00;
  --skip-accent: #e0a142;
  --warning: #e05447;
  --radius: 6px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* ---------- Material Symbols icon font ---------- */
.ms {
  font-family: 'Material Symbols Rounded';
  font-weight: normal; font-style: normal; line-height: 1;
  letter-spacing: normal; text-transform: none; white-space: nowrap;
  word-wrap: normal; direction: ltr; display: inline-flex; vertical-align: middle;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'liga';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}

/* ---------- Styled scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #5b636e; }
::-webkit-scrollbar-corner { background: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  overscroll-behavior: none;
}

#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- Layout primitives ---------- */
.screen {
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding: 18px; flex: 1; display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.center { display: flex; align-items: center; justify-content: center; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.hidden { display: none !important; }

/* ---------- Icon-badge avatars (category / game icons) ---------- */
.mono {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius);
  color: #fff; flex-shrink: 0;
}
.mono .ms { font-size: 22px; }
.mono-sm { width: 32px; height: 32px; }
.mono-sm .ms { font-size: 18px; }

/* ---------- Header ---------- */
.app-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.app-header h1 { font-size: 20px; font-weight: 600; margin: 0; }
.app-header p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); cursor: pointer; flex-shrink: 0;
  transition: background .12s;
}
.icon-btn:hover { background: var(--surface-2); }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 11px 16px; font-family: inherit; font-size: 14px; font-weight: 600;
  color: #fff; cursor: pointer; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .12s;
}
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-faint { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-faint:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }

.pressable { cursor: pointer; }

/* ---------- Title (main menu) ---------- */
.title-block { padding: 18px 2px 20px; }
.title-emoji { display: none; }
.title-grad { font-size: 22px; font-weight: 700; margin: 0 0 2px; }
.title-sub { font-size: 13px; color: var(--muted); }

/* ---------- Game list rows ---------- */
.game-card {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 12px; margin-bottom: 8px; color: var(--text);
  transition: background .12s;
}
.game-card:hover { background: var(--surface-2); }
.game-card .badge { display: none; }
.game-card .ttl { font-size: 15px; font-weight: 600; }
.game-card .sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.game-card .arrow { font-size: 18px; color: var(--muted2); }

.credits-link { margin: 16px 0 6px; font-size: 13px; color: var(--muted); cursor: pointer; text-align: center; }
.credits-link:hover { color: var(--text); text-decoration: underline; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.panel-title { font-size: 12px; font-weight: 600; letter-spacing: .3px; color: var(--muted); margin-bottom: 8px; }

/* ---------- Chips ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: var(--radius); padding: 6px 12px; font-family: inherit; font-size: 13px; cursor: pointer;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Instruction bar ---------- */
.inst-bar { display: flex; align-items: center; justify-content: space-evenly; gap: 8px; }
.inst { text-align: center; }
.inst .l { font-size: 13px; font-weight: 600; }
.inst .sm { font-size: 11px; color: var(--muted); margin-top: 2px; }
.divider-v { width: 1px; height: 30px; background: var(--line); }

/* ---------- Select field + category picker ---------- */
.select-field {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 10px 12px;
}
.select-field:hover { background: var(--surface-2); }
.select-field .chev { color: var(--muted2); display: flex; }
.picker-list { max-height: 60vh; overflow-y: auto; margin: 0 -6px; }
.picker-row { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-radius: var(--radius); color: var(--text); }
.picker-row:hover { background: var(--surface-2); }
.picker-row.sel { background: var(--surface-2); }
.picker-row > .ms { color: var(--accent); }

/* ---------- Toggle switch ---------- */
.toggle-row { display: flex; align-items: center; gap: 12px; }
.switch { width: 42px; height: 24px; border-radius: 12px; flex-shrink: 0; background: var(--line-strong); position: relative; transition: background .15s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch.on { background: var(--accent); }
.switch.on .knob { transform: translateX(18px); }

/* ---------- Stepper ---------- */
.stepper { display: flex; align-items: center; justify-content: center; gap: 20px; }
.step-btn {
  width: 44px; height: 44px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.step-btn:hover { background: var(--surface-2); }
.step-val { font-size: 34px; font-weight: 700; min-width: 64px; text-align: center; }
.step-box {
  width: 64px; height: 64px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700;
}

/* ---------- Inputs ---------- */
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%; box-sizing: border-box; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px; color: var(--text);
  font-family: inherit; font-size: 14px; resize: vertical;
}
.input:focus { outline: none; border-color: var(--accent); }
textarea.input { line-height: 1.5; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.modal-backdrop.center { align-items: center; }
.sheet {
  width: 100%; max-width: 720px; max-height: 88vh; background: var(--surface);
  border-top: 1px solid var(--line); border-radius: 10px 10px 0 0; padding: 14px 18px 24px; overflow-y: auto;
}
.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 0 auto 14px; }
.dialog {
  width: calc(100% - 36px); max-width: 420px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 20px; max-height: 88vh; overflow-y: auto;
}
.dialog h3 { margin: 0 0 12px; font-size: 17px; font-weight: 600; }

.rule-h { font-size: 15px; font-weight: 600; margin: 16px 0 8px; }
.rule-li { display: flex; gap: 10px; margin-bottom: 7px; align-items: flex-start; }
.rule-li .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); margin-top: 7px; flex-shrink: 0; }
.rule-li span { font-size: 14px; color: var(--text); line-height: 1.45; }
.variation { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 8px; }
.variation .vt { font-size: 14px; font-weight: 600; }
.variation .vd { font-size: 13px; color: var(--muted); margin-top: 3px; }

.checkbox { width: 22px; height: 22px; border-radius: var(--radius); border: 1px solid var(--line-strong); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.checkbox.on { background: var(--accent); border-color: var(--accent); }

/* ---------- Heads Up / Charades game ---------- */
.hu-game {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  color: #fff; user-select: none; z-index: 10; transition: background .15s;
}
.hu-word { font-size: clamp(34px, 9vw, 70px); font-weight: 700; padding: 0 28px; }
.hu-feedback { font-size: clamp(44px, 11vw, 84px); font-weight: 800; letter-spacing: 2px; }

.hu-timerbar { position: absolute; top: 0; left: 0; right: 0; height: 6px; background: rgba(255,255,255,.25); }
.hu-timerbar > div { height: 100%; background: #fff; transition: width 1s linear, background .3s; }
.hu-pill {
  position: absolute; top: 14px; background: rgba(0,0,0,.35); border-radius: var(--radius);
  padding: 6px 12px; font-weight: 700; font-size: 18px; color: #fff; z-index: 3;
}
.hu-score { left: 14px; }
.hu-timer { right: 14px; }
.hu-exit {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 3;
  background: rgba(0,0,0,.35); border: none; color: #fff; border-radius: var(--radius);
  padding: 6px 14px; font-family: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
}
.hu-hints { position: absolute; bottom: 26px; left: 0; right: 0; display: flex; justify-content: space-evenly; gap: 12px; padding: 0 16px; z-index: 2; pointer-events: none; }
.hu-hint { background: rgba(0,0,0,.3); border-radius: var(--radius); padding: 9px 16px; text-align: center; }
.hu-hint .a { font-size: 12px; color: rgba(255,255,255,.75); }
.hu-hint .l { font-size: 14px; font-weight: 700; }

.cd-num { font-size: clamp(90px, 28vw, 140px); font-weight: 800; line-height: 1; }

/* ---------- Results ---------- */
.res-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.res-dot.ok { background: var(--correct-accent); }
.res-dot.no { background: var(--skip-accent); }

/* ---------- Imposter ---------- */
.reveal-card {
  margin: 0 auto; max-width: 440px; width: calc(100% - 36px);
  border: 1px solid rgba(255,255,255,.25); border-radius: 10px; padding: 32px 24px; text-align: center;
  background: rgba(0,0,0,.18);
}
.big-ic { color: rgba(255,255,255,.7); display: flex; justify-content: center; }
.role-badge { display: inline-block; padding: 6px 16px; border-radius: var(--radius); font-weight: 700; font-size: 13px; letter-spacing: .5px; }
.secret-word { font-size: clamp(28px, 7vw, 42px); font-weight: 800; margin: 20px 0; word-break: break-word; color: #fff; }
.dots { display: flex; justify-content: center; gap: 7px; margin-top: 8px; }
.dot-pip { width: 9px; height: 9px; border-radius: 5px; background: rgba(255,255,255,.25); transition: all .2s; }
.dot-pip.cur { width: 22px; background: #fff; }
.dot-pip.done { background: var(--correct-accent); }

/* ---------- Spin the Wheel ---------- */
.wheel-wrap { position: relative; width: min(90vw, 420px); height: min(90vw, 420px); margin: 8px auto; }
.wheel {
  width: 100%; height: 100%; border-radius: 50%; border: 4px solid var(--line-strong);
  transition: transform 4.2s cubic-bezier(.17,.67,.2,1); position: relative; overflow: hidden;
}
/* Labels run radially along each spoke (aligned with the wheel). */
.wheel-label { position: absolute; left: 50%; top: 50%; width: 50%; height: 0; transform-origin: left center; pointer-events: none; }
.wheel-label .txt {
  position: absolute; left: 60%; top: 0; width: 130px;
  font-size: 14px; font-weight: 700; line-height: 1.1; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.7); text-align: center; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.wheel-pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 0; height: 0; z-index: 3;
  border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 26px solid var(--text);
}
.wheel-hub {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 54px; height: 54px; border-radius: 50%; z-index: 2;
  background: var(--bg); border: 3px solid var(--line-strong);
}
.wheel-result { margin-top: 20px; min-height: 32px; text-align: center; font-size: clamp(20px, 5vw, 30px); font-weight: 700; color: var(--muted); padding: 0 16px; word-break: break-word; }
.wheel-result.show { color: var(--text); }

/* ---------- Wavelength ---------- */
.wl-ends { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; gap: 12px; }
.wl-ends span:last-child { text-align: right; }
.wl-bar {
  position: relative; height: 46px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line); overflow: hidden;
}
.wl-band { position: absolute; top: 0; bottom: 0; }
.wl-band.b2 { background: rgba(30,132,73,.25); }
.wl-band.b3 { background: rgba(30,132,73,.5); }
.wl-band.b4 { background: rgba(30,132,73,.9); }
.wl-point {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  font-size: 13px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); pointer-events: none;
}
.wl-marker { position: absolute; top: -4px; bottom: -4px; width: 3px; background: #fff; transform: translateX(-50%); box-shadow: 0 0 0 1px rgba(0,0,0,.4); z-index: 2; }
.wl-range { width: 100%; margin-top: 14px; accent-color: var(--accent); }
.wl-team { display: inline-block; padding: 4px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; font-size: 13px; }

/* ---------- Word preview ---------- */
.word-cloud { display: flex; flex-wrap: wrap; gap: 6px; max-height: 62vh; overflow-y: auto; padding: 2px; }
.word-chip { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 5px 10px; font-size: 13px; }

/* ---------- Custom lists ---------- */
.list-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; margin-bottom: 8px;
}
.list-card .icon-btn { width: 34px; height: 34px; }

.word-item { display: flex; align-items: center; gap: 12px; padding: 10px; cursor: pointer; border-radius: var(--radius); }
.word-item:hover { background: var(--surface-2); }
.word-item .wt { font-size: 17px; }
.word-item.done .wt { color: var(--muted2); text-decoration: line-through; }
.link-btn { background: none; border: none; color: var(--muted); font-family: inherit; font-size: 13px; cursor: pointer; padding: 6px; text-decoration: underline; }

/* ---------- Misc text helpers ---------- */
.muted { color: var(--muted); }
.muted2 { color: var(--muted2); }
.tcenter { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; } .mb24 { margin-bottom: 24px; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #000; border: 1px solid var(--line); color: #fff; padding: 10px 18px; border-radius: var(--radius);
  font-size: 14px; z-index: 100; max-width: 90%; text-align: center;
}
