/* Shared styles for every page under /games. */

  :root {
    --bg: #120e0c;
    --bg-2: #1b1512;
    --ink: #f3ece2;
    --ink-dim: rgba(243, 236, 226, .74);
    --ink-faint: rgba(243, 236, 226, .46);
    --line: rgba(255, 240, 220, .14);
    --glass: rgba(255, 240, 220, .05);
    --gold: #ffcf8a;
    --good: #8fd6a4;
    --bad: #ff8f7a;
    --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
    --font-ui: "Geist", "Helvetica Neue", Arial, sans-serif;
    --font-data: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; height: 100%; }
  body {
    background: radial-gradient(120% 80% at 50% 0%, #2a1d15 0%, var(--bg) 60%) fixed, var(--bg);
    color: var(--ink);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
  }
  .wrap {
    max-width: 520px; margin: 0 auto; min-height: 100%;
    padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: 20px;
  }
  header { display: flex; justify-content: space-between; align-items: center; }
  header a { color: var(--ink-faint); text-decoration: none; font-size: 13px; }
  header a:hover { color: var(--ink); }
  .brand { font-family: var(--font-display); font-size: 30px; letter-spacing: .2px; }
  .brand i { color: var(--gold); }
  .mono { font-family: var(--font-data); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
  h1, h2 { font-family: var(--font-display); font-weight: 400; margin: 0; line-height: 1.05; }
  h1 { font-size: clamp(40px, 11vw, 56px); }
  h2 { font-size: 32px; }
  p { margin: 0; color: var(--ink-dim); line-height: 1.5; }
  .panel { background: var(--glass); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
  .stack { display: flex; flex-direction: column; gap: 14px; }
  .row { display: flex; gap: 10px; }
  .row > * { flex: 1; min-width: 0; }
  label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-dim); }
  input, select {
    font: inherit; font-size: 16px; color: var(--ink); background: var(--bg-2);
    border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 100%;
  }
  input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
  button {
    font: inherit; font-weight: 500; font-size: 16px; cursor: pointer;
    border-radius: 14px; padding: 15px 16px; border: 1px solid var(--line);
    background: var(--glass); color: var(--ink); touch-action: manipulation;
    transition: transform .08s ease, background .15s ease;
  }
  button:active { transform: scale(.97); }
  button:disabled { opacity: .4; cursor: not-allowed; }
  .primary { background: var(--gold); color: #1a120c; border-color: transparent; font-weight: 600; }
  .good { background: rgba(143, 214, 164, .16); border-color: rgba(143, 214, 164, .5); color: var(--good); }
  .bad  { background: rgba(255, 143, 122, .14); border-color: rgba(255, 143, 122, .5); color: var(--bad); }
  .ghost { background: transparent; color: var(--ink-faint); border-color: transparent; padding: 8px; font-size: 14px; }
  .big { padding: 20px 12px; font-size: 18px; }

  .scores { display: flex; gap: 10px; }
  .score { flex: 1; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); }
  .score.on { border-color: var(--gold); }
  .score .n { font-family: var(--font-display); font-size: 34px; line-height: 1; margin-top: 4px; }
  .score .name { font-size: 14px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .bar { display: flex; justify-content: space-between; align-items: center; }
  .timer { font-family: var(--font-data); font-size: 30px; font-variant-numeric: tabular-nums; }
  .timer.low { color: var(--bad); }
  .progress { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
  .progress > div { height: 100%; background: var(--gold); transition: width .25s linear; }

  .card {
    border-radius: 22px; padding: 26px 20px 22px; text-align: center;
    background: linear-gradient(180deg, #2b211b, #1c1613); border: 1px solid var(--line);
    box-shadow: 0 20px 50px rgba(0,0,0,.35);
  }
  .card .word { font-family: var(--font-display); font-size: clamp(38px, 11vw, 54px); line-height: 1.05; color: var(--gold); word-break: break-word; }
  .card .rule { height: 1px; background: var(--line); margin: 18px 0 14px; }
  .card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
  .card li { font-size: 20px; color: var(--ink); }
  .card.flash-good { animation: fg .35s ease; }
  .card.flash-bad { animation: fb .35s ease; }
  @keyframes fg { 0% { box-shadow: 0 0 0 3px var(--good); } 100% { box-shadow: 0 20px 50px rgba(0,0,0,.35); } }
  @keyframes fb { 0% { box-shadow: 0 0 0 3px var(--bad); transform: translateX(-4px); } 50% { transform: translateX(4px); } 100% { transform: none; } }
  .actions { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 10px; }

  .log { display: flex; flex-direction: column; gap: 8px; }
  .log details { border-radius: 12px; border: 1px solid var(--line); }
  .log details[open] { background: var(--glass); }
  .log summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
  .log summary::-webkit-details-marker { display: none; }
  .log .w { font-size: 16px; display: flex; align-items: center; gap: 8px; }
  .log .caret { color: var(--ink-faint); display: inline-block; transition: transform .15s ease; }
  .log details[open] .caret { transform: rotate(90deg); }
  .banned { list-style: none; margin: 0; padding: 0 12px 12px 30px; display: flex; flex-wrap: wrap; gap: 6px; }
  .banned li { font-size: 14px; color: var(--ink-dim); padding: 4px 10px; border-radius: 999px; border: 1px dashed var(--line); }
  .chip { font-family: var(--font-data); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink-faint); }
  .chip.correct { color: var(--good); border-color: rgba(143,214,164,.5); }
  .chip.taboo { color: var(--bad); border-color: rgba(255,143,122,.5); }
  .center { text-align: center; }
  .hint { font-size: 13px; color: var(--ink-faint); }
  kbd { font-family: var(--font-data); font-size: 11px; border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
  .rules { margin: 0; padding-left: 18px; color: var(--ink-dim); line-height: 1.6; font-size: 15px; }
  @media (hover: none) { .kbd-hint { display: none; } }
  .gold { color: var(--gold); }
  .editions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .edition { position: relative; flex-direction: column; gap: 2px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; }
  .edition.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
  .edition input { position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
  .edition .ename { font-family: var(--font-display); font-size: 24px; color: var(--ink); }
  .edition.on .ename { color: var(--gold); }
  .edition .ecount { font-family: var(--font-data); font-size: 12px; color: var(--ink-faint); }
  .cats { display: flex; flex-direction: column; gap: 8px; }
  .chips { display: flex; flex-wrap: wrap; gap: 8px; }
  .cat { padding: 9px 12px; font-size: 14px; border-radius: 999px; background: transparent; color: var(--ink-dim); }
  .cat span { font-family: var(--font-data); font-size: 11px; color: var(--ink-faint); margin-left: 4px; }
  .cat.on { background: rgba(255, 207, 138, .14); border-color: var(--gold); color: var(--gold); }
  .cat.on span { color: var(--gold); opacity: .7; }
  .warn { color: var(--bad); }
  .key b { color: var(--ink-dim); font-weight: 500; }
  .sub { font-size: 15px; color: var(--ink-dim); }
  .brand-btn { all: unset; cursor: pointer; font-family: var(--font-display); font-size: 30px; letter-spacing: .2px; }
  .brand-btn i { color: var(--gold); }
  .menu-btn { padding: 9px 14px; font-size: 14px; border-radius: 999px; }
  .icon { padding: 10px 13px; font-size: 14px; border-radius: 12px; flex: none; }
  .team-row { display: flex; gap: 10px; align-items: flex-end; }
  .team-row label { flex: 1; }
  .add { align-self: flex-start; color: var(--gold); }
  button.armed { background: rgba(255, 143, 122, .2); border-color: var(--bad); color: var(--bad); }
  .danger { color: var(--bad); }
  .pts { font-family: var(--font-data); font-size: 15px; }
  .card { position: relative; }
  .card.hidden > :not(.paused-note) { filter: blur(14px); }
  .paused-note { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-data); text-transform: uppercase; letter-spacing: .12em; color: var(--ink); }
  .words { list-style: none; margin: 0; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
  .words li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
  .words .also { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
  body.locked { overflow: hidden; }
  .sheet { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
  .sheet[hidden] { display: none; }
  .sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); animation: fade .15s ease; }
  .sheet-panel {
    position: relative; width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
    background: var(--bg-2); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0;
    padding: 20px 16px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px;
    animation: rise .2s ease;
  }
  .sheet-head { display: flex; justify-content: space-between; align-items: center; }
  .menu { display: flex; flex-direction: column; gap: 8px; }
  .menu button { text-align: left; }
  .menu .sep { height: 1px; background: var(--line); margin: 6px 0; }
  .menu .out { color: var(--ink-faint); text-decoration: none; font-size: 14px; padding: 10px 4px; }
  .back { align-self: flex-start; padding: 4px 0; }
  @keyframes fade { from { opacity: 0; } }
  @keyframes rise { from { transform: translateY(40px); opacity: 0; } }
  @media (min-width: 600px) { .sheet { align-items: center; } .sheet-panel { border-radius: 22px; border-bottom: 1px solid var(--line); } }

  /* ---- footer ---- */
  .foot { margin-top: auto; padding-top: 28px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
  .games-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
  .games-links a, .games-links .here {
    font-size: 14px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line);
    color: var(--ink-dim); text-decoration: none;
  }
  .games-links a:hover { color: var(--ink); border-color: var(--ink-faint); }
  .games-links .here { color: var(--gold); border-color: var(--gold); }
  .foot-meta { font-size: 13px; color: var(--ink-faint); }
  .foot-meta a { color: var(--ink-faint); text-decoration: none; }
  .foot-meta a:hover { color: var(--ink); }

  /* ---- hub ---- */
  .game-list { display: flex; flex-direction: column; gap: 12px; }
  .game-card {
    display: flex; gap: 16px; align-items: center; padding: 18px; border-radius: 18px;
    border: 1px solid var(--line); background: var(--glass); color: var(--ink); text-decoration: none;
    transition: border-color .15s ease, transform .08s ease;
  }
  .game-card:hover { border-color: var(--gold); }
  .game-card:active { transform: scale(.99); }
  .game-card img { width: 64px; height: 64px; border-radius: 16px; flex: none; }
  .game-card h2 { font-size: 30px; }
  .game-card p { font-size: 15px; margin-top: 4px; }
  .game-card .meta { font-family: var(--font-data); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); margin-top: 8px; }

  /* ---- fishbowl ---- */
  textarea {
    font: inherit; font-size: 16px; color: var(--ink); background: var(--bg-2);
    border: 1px solid var(--line); border-radius: 12px; padding: 12px; width: 100%; min-height: 96px; resize: vertical;
  }
  textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
  .round-name { font-family: var(--font-display); font-size: 26px; color: var(--gold); }
  .card .cat-tag { font-family: var(--font-data); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 12px; }
  .card.solo { padding: 44px 20px; }
  .actions.two { grid-template-columns: 1fr 1.4fr; }

  /* ---- tilt (full screen, phone on forehead) ---- */
  body.tilt-on { overflow: hidden; }
  .tilt {
    position: fixed; inset: 0; z-index: 15; background: var(--bg); color: var(--ink);
    display: flex; flex-direction: column; padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
    user-select: none; -webkit-user-select: none; touch-action: none;
  }
  .tilt[hidden] { display: none; }
  .tilt-top { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-family: var(--font-data); font-size: 15px; color: var(--ink-dim); }
  .tilt-top .timer { font-size: 22px; color: var(--ink); }
  .tilt-top button { padding: 8px 12px; font-size: 13px; border-radius: 999px; }
  .tilt-main { flex: 1; display: grid; place-items: center; text-align: center; padding: 8px; }
  .tilt-word { font-family: var(--font-display); font-size: clamp(44px, 14vmin, 120px); line-height: 1; color: var(--gold); word-break: break-word; }
  .tilt-sub { font-size: 16px; color: var(--ink-dim); margin-top: 14px; }
  .tilt-count { font-family: var(--font-display); font-size: clamp(90px, 30vmin, 200px); line-height: 1; }
  .tilt-hint { position: relative; z-index: 2; text-align: center; font-size: 13px; color: var(--ink-faint); pointer-events: none; }
  .tilt-zone { position: absolute; top: 0; bottom: 0; width: 50%; border: 0; border-radius: 0; background: transparent; z-index: 1; padding: 0; }
  .tilt-zone:active { transform: none; background: rgba(255, 240, 220, .04); }
  .tilt-zone.left { left: 0; }
  .tilt-zone.right { right: 0; }
  .tilt-flash { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; font-family: var(--font-display); font-size: clamp(56px, 16vmin, 130px); pointer-events: none; animation: tflash .55s ease forwards; }
  .tilt-flash.good { background: #1f5134; color: #c9f2d6; }
  .tilt-flash.pass { background: #5a3a17; color: #ffe2b8; }
  @keyframes tflash { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
  .tilt-paused { position: absolute; inset: 0; z-index: 4; background: rgba(18, 14, 12, .94); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; }
  .tilt-paused button { min-width: 220px; }
  .sheet { z-index: 20; }
  .row-plain { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); }
  .row-plain .w { font-size: 16px; }
