:root {
  color-scheme: dark;
  --bg: #07121c;
  --panel: rgba(8, 20, 31, .93);
  --line: rgba(156, 210, 255, .18);
  --text: #eaf6ff;
  --muted: #91a7b7;
  --accent: #65d8ff;
  --accent2: #b991ff;
  --danger: #ff6d8e;
  --good: #78f2c1;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body, #app { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); touch-action: none; user-select: none; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
#gameCanvas { display: block; width: 100%; height: 100%; background: #0b1b25; touch-action: none; }
.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); background: radial-gradient(circle at 50% 40%, rgba(24, 67, 88, .42), rgba(3, 9, 14, .82)); backdrop-filter: blur(8px); z-index: 10; }
.overlay.hidden { display: none; }
.panel { width: min(980px, 92vw); max-height: 92vh; overflow: auto; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(180deg, rgba(13, 31, 45, .97), rgba(7, 18, 28, .97)); box-shadow: 0 24px 80px rgba(0,0,0,.42); padding: 28px; }
.panel.compact { width: min(520px, 88vw); text-align: center; }
.brand-row, .result-head, .ai-title-row { display: flex; gap: 18px; align-items: center; justify-content: space-between; }
h1 { margin: 4px 0 8px; font-size: clamp(26px, 3.2vw, 46px); letter-spacing: -.03em; }
.result-head h1 { font-size: clamp(56px, 9vw, 96px); line-height: .9; margin: 10px 0; }
.result-head h1 small { font-size: .24em; color: var(--muted); }
.eyebrow { color: var(--accent); font-size: 12px; letter-spacing: .16em; font-weight: 700; }
.muted { color: var(--muted); margin: 0; line-height: 1.65; }
.primary, .secondary, .difficulty { border-radius: 14px; transition: transform .12s ease, border-color .12s ease, background .12s ease; }
.primary:active, .secondary:active, .difficulty:active { transform: scale(.98); }
.primary { padding: 15px 22px; background: linear-gradient(135deg, #36c9ff, #8b7bff); color: #04121b; font-weight: 800; box-shadow: 0 8px 28px rgba(68, 196, 255, .22); }
.secondary { padding: 12px 17px; background: rgba(255,255,255,.055); border: 1px solid var(--line); color: #dcecf5; }
.secondary.small { padding: 9px 12px; font-size: 13px; }
.difficulty-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 24px 0; }
.difficulty { text-align: left; padding: 15px 16px; background: rgba(255,255,255,.035); border: 1px solid var(--line); }
.difficulty strong, .difficulty span { display: block; }
.difficulty span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.difficulty.active { border-color: rgba(101, 216, 255, .8); background: rgba(69, 179, 223, .12); box-shadow: inset 0 0 0 1px rgba(101, 216, 255, .18); }
.start-actions { display: flex; gap: 12px; }
.control-note { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.result-actions { display: flex; gap: 10px; }
.grade { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; color: var(--good); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 22px 0; }
.stats-grid > div { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.stats-grid span, .stats-grid strong { display: block; }
.stats-grid span { color: var(--muted); font-size: 12px; }
.stats-grid strong { margin-top: 4px; font-size: 20px; }
.ai-box { padding: 16px; border-radius: 16px; border: 1px solid rgba(185,145,255,.24); background: rgba(130,91,194,.06); }
.ai-box p { margin-top: 10px; white-space: pre-wrap; }
.history-summary { margin: 14px 0 18px; color: var(--muted); }
.history-list { display: grid; gap: 8px; }
.history-row { display: grid; grid-template-columns: 1.35fr .8fr .65fr .75fr .75fr; gap: 10px; align-items: center; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); font-size: 13px; }
.history-row strong { font-size: 18px; color: var(--accent); }
.gate { z-index: 50; }
@media (max-height: 500px) {
  .panel { padding: 18px; width: min(1040px, 94vw); }
  h1 { font-size: 28px; }
  .difficulty-grid { margin: 14px 0; }
  .difficulty { padding: 10px 12px; }
  .control-note { margin-top: 12px; padding-top: 10px; }
  .result-head h1 { font-size: 56px; }
  .stats-grid { margin: 12px 0; }
  .stats-grid > div { padding: 9px 11px; }
}
@media (max-width: 820px) {
  .difficulty-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
.header-actions{display:flex;align-items:center;gap:10px}.admin-link{display:inline-flex;align-items:center;justify-content:center;text-decoration:none}.admin-link.hidden{display:none!important}
