  @import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap");

  :root {
    --bg: #0c0e15; --panel: #141826; --text: #eef2f9; --muted: #8b93a7;
    --accent: #22a8f5; --good: #46e6a0; --warn: #ffd23f; --bad: #ff5d6c; --line: #232838;
  }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body { margin: 0; height: 100%; }
  body {
    background: radial-gradient(1200px 700px at 50% -10%, #161b2c 0%, var(--bg) 60%);
    color: var(--text); font-family: "Inter", system-ui, sans-serif;
    min-height: 100%; display: flex; flex-direction: column; align-items: center;
    padding: 1rem; overflow-x: hidden;
  }
  a { color: var(--accent); text-decoration: none; font-weight: 600; }
  .back-link { align-self: flex-start; font-size: 0.95rem; opacity: 0.85; position: relative; z-index: 30; }
  .wrap { width: 100%; max-width: 560px; margin: 0 auto; flex: 1; display: flex; flex-direction: column; }

  header.top { text-align: center; margin: 0.6rem 0 0.4rem; }
  header.top h1 { font-size: 1.9rem; font-weight: 900; margin: 0; letter-spacing: -0.02em; }
  header.top p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.85rem; }

  .hud { display: flex; gap: 0.5rem; margin: 0.9rem 0 0.2rem; }
  .stat { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0.5rem 0.5rem; text-align: center; }
  .stat .label { font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
  .stat .value { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 1px; }

  /* Big reaction panel — the whole thing is the tap target */
  .panel {
    position: relative; flex: 1; min-height: 320px; margin-top: 0.7rem; border-radius: 18px;
    border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 1.2rem; cursor: pointer; user-select: none; touch-action: manipulation;
    transition: background 0.06s linear, color 0.06s linear, border-color 0.15s ease;
    background: var(--panel); overflow: hidden;
  }
  /* particle canvas sits behind the panel text; only painted while Visual FX is on */
  .panel-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
  .panel .big, .panel .sub, .panel .rating { position: relative; z-index: 1; }
  .panel.idle   { background: var(--panel); }
  .panel.wait   { background: #3b1822; border-color: #5a2233; color: #ffc2cc; }
  .panel.go     { background: #12b073; border-color: #0d9460; color: #04140c; }
  .panel.toosoon{ background: #5a2f12; border-color: #7a4420; color: #ffd9b3; }
  .panel.result { background: var(--panel); }
  .panel .big { font-size: 2.8rem; font-weight: 900; letter-spacing: -0.02em; line-height: 1.05; }
  .panel .big.ms { font-size: 3.6rem; font-variant-numeric: tabular-nums; }
  .panel .big.ms small { font-size: 1.3rem; font-weight: 800; opacity: 0.7; }
  .panel .sub { margin-top: 0.5rem; font-size: 0.95rem; font-weight: 600; opacity: 0.92; max-width: 30ch; }
  .panel .rating { margin-top: 0.4rem; font-size: 0.9rem; font-weight: 800; letter-spacing: 0.02em; }

  .times { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; margin: 0.8rem 0 0.2rem; min-height: 1.6rem; }
  .chip { font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0.22rem 0.55rem; }
  .chip.cur { color: var(--text); border-color: var(--accent); }
  .chip.pen { color: var(--bad); border-color: #5a2233; background: #2a141a; }

  .footer-controls { display: flex; gap: 0.6rem; align-items: center; justify-content: center; margin: 0.7rem 0 0.3rem; }
  .mute { cursor: pointer; background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 0.35rem 0.6rem; font-size: 1rem; }
  .hint { color: var(--muted); font-size: 0.78rem; text-align: center; margin-top: 0.1rem; }

  /* overlay card */
  .overlay { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(8,10,16,0.82); backdrop-filter: blur(3px); z-index: 20; padding: 1rem; }
  .overlay.show { display: flex; }
  .card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 1.6rem 1.4rem; max-width: 440px; width: 100%; text-align: center; box-shadow: 0 24px 60px -20px rgba(0,0,0,0.7); }
  .card h2 { margin: 0 0 0.3rem; font-size: 1.9rem; font-weight: 900; }
  .card p { color: var(--muted); margin: 0.35rem 0; line-height: 1.5; font-size: 0.92rem; }
  .card .big { font-size: 3rem; font-weight: 900; margin: 0.4rem 0 0.1rem; font-variant-numeric: tabular-nums; }
  .card .big small { font-size: 1.1rem; color: var(--muted); font-weight: 700; }
  .rules { text-align: left; font-size: 0.86rem; color: var(--muted); line-height: 1.55; margin: 0.6rem 0 1rem; }
  .rules li { margin: 0.25rem 0; }
  .summary { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; margin: 0.7rem 0 0.2rem; }
  .btn { cursor: pointer; background: var(--accent); color: #04121f; border: none; border-radius: 10px; padding: 0.8rem 1.6rem; font-family: inherit; font-size: 1.05rem; font-weight: 800; transition: filter 0.15s ease, transform 0.08s ease; }
  .btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
  .btn:active { transform: scale(0.97); }

  /* tasteful entrance + result motion (auto-disabled by reduce-motion) */
  .overlay.show .card { animation: cardRise 0.34s cubic-bezier(0.2,0.8,0.2,1) both; }
  @keyframes cardRise { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
  .card .big { animation: rPop 0.42s cubic-bezier(0.2,1.25,0.4,1) 0.08s backwards; }
  @keyframes rPop { 0% { opacity: 0; transform: scale(0.72); } 60% { transform: scale(1.05); } 100% { opacity: 1; transform: scale(1); } }
  /* Accessibility: honor prefers-reduced-motion — neutralize animations,
   transitions, and motion effects (pulse, shake, drop, blink, glows). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
