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

/* ── Theme: dark (default) ─────────────────────────────────────────────────── */
:root {
  --x-color:    #ff4f4f;
  --o-color:    #3ecfff;
  --bg:         #0d0f1a;
  --bg2:        #0a0c14;
  --surface:    #151824;
  --surface2:   #1c2030;
  --surface3:   #222840;
  --border:     rgba(255,255,255,0.07);
  --border2:    rgba(255,255,255,0.14);
  --text:       #e8eaf0;
  --text2:      #8890b0;
  --muted:      #4a5070;
  --grid-color: rgba(255,255,255,0.025);
}

/* ── Theme: synthwave ──────────────────────────────────────────────────────── */
[data-theme="synthwave"] {
  --x-color:  #ff2d78;
  --o-color:  #00e5ff;
  --bg:       #12042a;
  --bg2:      #0a0218;
  --surface:  #1a0840;
  --surface2: #21104e;
  --surface3: #28185c;
  --border:   rgba(255,100,255,0.12);
  --border2:  rgba(255,100,255,0.24);
  --text:     #f0e0ff;
  --text2:    #a070c0;
  --muted:    #603080;
  --grid-color: rgba(200,100,255,0.04);
}

/* ── Theme: mono ───────────────────────────────────────────────────────────── */
[data-theme="mono"] {
  --x-color:  #ffffff;
  --o-color:  #aaaaaa;
  --bg:       #0a0a0a;
  --bg2:      #060606;
  --surface:  #141414;
  --surface2: #1e1e1e;
  --surface3: #282828;
  --border:   rgba(255,255,255,0.08);
  --border2:  rgba(255,255,255,0.18);
  --text:     #eeeeee;
  --text2:    #888888;
  --muted:    #444444;
  --grid-color: rgba(255,255,255,0.02);
}

/* ── Theme: paper (light) ──────────────────────────────────────────────────── */
[data-theme="paper"] {
  --x-color:  #c0392b;
  --o-color:  #1a5276;
  --bg:       #f5f0e8;
  --bg2:      #ece6d8;
  --surface:  #faf7f0;
  --surface2: #ede9df;
  --surface3: #e0dbd0;
  --border:   rgba(0,0,0,0.08);
  --border2:  rgba(0,0,0,0.16);
  --text:     #2a2a2a;
  --text2:    #666050;
  --muted:    #a09880;
  --grid-color: rgba(0,0,0,0.03);
}

/* ── Body & background ─────────────────────────────────────────────────────── */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  font-family: 'Rajdhani', sans-serif;
  color: var(--text);
  gap: 20px;
  padding: 20px 16px;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 44px 44px;
  animation: grid-drift 24s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes grid-drift {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(44px, 44px); }
}

body > * { position: relative; z-index: 1; }

/* ── Overlay ───────────────────────────────────────────────────────────────── */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 100;
}
#overlay.visible { opacity: 1; pointer-events: all; }

/* ── Particles ─────────────────────────────────────────────────────────────── */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 10;
}
.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: fly 0.9s ease-out forwards;
}
@keyframes fly {
  0%   { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx),var(--ty)) scale(0.2); }
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 2px; }

/* ── Simultaneous cover screen ─────────────────────────────────────────────── */
#sim-cover {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

#sim-cover.visible {
  opacity: 1;
  pointer-events: all;
}

.sim-cover-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 32px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  max-width: 320px;
  width: 90%;
  text-align: center;
}

.sim-cover-icon {
  font-size: 4rem;
  line-height: 1;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
}

.sim-cover-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
}

.sim-cover-hint {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.72rem;
  color: var(--text2);
  line-height: 1.7;
}

.sim-cover-btn {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 28px;
  border-radius: 10px;
  border: 1px solid var(--o-color);
  background: color-mix(in srgb, var(--o-color) 12%, transparent);
  color: var(--o-color);
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
}

.sim-cover-btn:hover {
  background: color-mix(in srgb, var(--o-color) 22%, transparent);
}

/* ── Mobile layout ─────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  body { gap: 14px; padding: 14px 10px; }

  .logo { font-size: 1.55rem; }
  .rule-badge { display: none; }
  .nav-btn { width: 30px; height: 30px; }

  .score-card { padding: 8px 10px; gap: 8px; }
  .score-symbol { font-size: 1.3rem; }
  .score-value  { font-size: 1.4rem; }
  .score-label  { font-size: 0.58rem; }

  .status { font-size: 1rem; }

  .btn-row { gap: 6px; }
  button.action-btn { padding: 8px 14px; font-size: 0.78rem; }

  .rule-text { font-size: 0.6rem; }

  .panel { width: 100%; border-left: none; border-top: 1px solid var(--border); }
}

@media (max-height: 640px) {
  body { gap: 10px; padding: 10px 16px; }
  .rule-text { display: none; }
}
