:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#app { width: 100%; height: 100%; position: relative; }
.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; display: flex; flex-direction: column; }
.screen.hidden { display: none; }
.focusable { transition: all 0.15s ease; border: 2px solid transparent; cursor: pointer; outline: none; }
.focusable:focus { border-color: var(--focus-ring); box-shadow: 0 0 20px var(--focus-glow); }
.hidden { display: none !important; }

/* ---------- header ---------- */
.hdr { padding: 22px 24px 16px; }
.hdr-row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--bg-tertiary); }
.hdr-title { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; }
.hdr-title.sm { font-size: 24px; font-weight: 700; flex: 1; }
.hdr-sub { color: var(--text-secondary); font-size: 16px; margin-top: 6px; }

.back-btn {
  flex: 0 0 auto; width: 52px; height: 52px; border-radius: 12px;
  background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 30px; line-height: 1; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- home menu ---------- */
.menu { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 8px 24px 24px; justify-content: center; }
.menu-btn {
  display: flex; align-items: center; gap: 18px;
  min-height: 96px; padding: 0 24px;
  background: var(--bg-secondary); border-radius: var(--radius-md);
  text-align: left; color: var(--text-primary); width: 100%;
}
.menu-ico { font-size: 38px; flex: 0 0 auto; }
.menu-txt { display: flex; flex-direction: column; gap: 4px; }
.menu-txt b { font-size: 22px; font-weight: 700; }
.menu-txt small { font-size: 15px; color: var(--text-secondary); }

/* ---------- grid ---------- */
.grid-wrap {
  flex: 1; overflow-y: auto; padding: 14px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px;
  align-content: start;
}
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 104px; padding: 8px 4px 6px;
  background: var(--bg-secondary); border-radius: var(--radius-md);
  color: var(--text-primary);
}
.tile-letter { font-size: 26px; font-weight: 800; line-height: 1; }
.tile-hand { width: 56px; height: 64px; margin-top: 2px; }
.tile-hand svg { width: 100%; height: 100%; display: block; }

/* ---------- detail ---------- */
.detail { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 16px 22px 20px; }
.detail-letter { font-size: 60px; font-weight: 900; line-height: 1; letter-spacing: 1px; }
.hand-stage { width: 240px; height: 270px; flex: 0 0 auto; }
.hand-stage svg { width: 100%; height: 100%; display: block; }
.detail-desc {
  color: var(--text-secondary); font-size: 18px; line-height: 1.45;
  text-align: center; max-width: 520px; min-height: 56px; margin-top: 4px;
}
.row { display: flex; gap: 12px; margin-top: auto; padding-top: 14px; width: 100%; }
.btn {
  flex: 1; min-height: 64px; border-radius: var(--radius-md);
  background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.btn.wide { width: 100%; flex: none; margin-top: 22px; }
.btn.primary { background: var(--accent); color: #04222b; }

/* ---------- quiz ---------- */
.quiz { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 12px 22px 20px; }
.score { font-size: 15px; color: var(--text-secondary); text-align: right; line-height: 1.3; }
.score b { color: var(--accent-secondary); }
.quiz-stage { width: 200px; height: 220px; flex: 0 0 auto; }
.quiz-stage svg { width: 100%; height: 100%; display: block; }
.quiz-prompt { font-size: 20px; font-weight: 700; margin: 4px 0 14px; text-align: center; }
.quiz-prompt.ok { color: var(--accent-secondary); }
.quiz-prompt.no { color: var(--danger); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.opt {
  min-height: 76px; border-radius: var(--radius-md);
  background: var(--bg-secondary); color: var(--text-primary);
  font-size: 30px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.opt.correct { background: var(--accent-secondary); color: #043b22; }
.opt.wrong { background: var(--danger); color: #2b0510; }
.opt.dim { opacity: 0.4; }
