:root {
  color-scheme: dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e8e9ed;
  background: #101217;
  font-synthesis: none;
  --muted: #858995;
  --line: #292c36;
  --accent: #b68afa;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 50% 44%, #1b19272e, transparent 65%); }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .35; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid #b68afa; outline-offset: 5px; }
button { transition: background .15s, transform .15s; }
button:active:not(:disabled) { transform: translateY(1px); }
.app-shell { max-width: 1120px; padding: 0 44px; margin: auto; }
.header { height: 106px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 24px; }
.brand { font-size: 25px; font-weight: 850; letter-spacing: 3px; text-decoration: none; color: #f2f1f6; display: flex; align-items: center; }
.brand-dot { color: var(--accent); }
.brand-icon { width: 27px; height: 28px; display: grid; grid-template: repeat(3, 8px) / repeat(3, 8px); gap: 2px; margin-right: 13px; transform: rotate(-90deg); }
.brand-icon i { background: var(--accent); border-radius: 1px; }
.brand-icon i:first-child { grid-column: 2; }
.brand-icon i:nth-child(2) { grid-column: 1; grid-row: 2; }
.brand-icon i:nth-child(3) { grid-column: 2; grid-row: 2; }
.brand-icon i:nth-child(4) { grid-column: 3; grid-row: 2; }
.header-note { color: var(--muted); font-size: 12px; letter-spacing: .3px; }
.quiet-button { border: 1px solid var(--line); border-radius: 7px; color: #c7c9d3; background: #191b22; padding: 9px 12px; display: flex; align-items: center; gap: 9px; font-size: 12px; }
.quiet-button:hover:not(:disabled) { background: #252834; }
kbd { display: inline-flex; min-width: 23px; min-height: 23px; padding: 3px 6px; align-items: center; justify-content: center; background: #20232c; border: 1px solid #333640; border-bottom-width: 2px; border-radius: 4px; font-family: inherit; font-size: 10px; line-height: 1.1; color: #b6b8c3; }
.quiet-button kbd { font-size: 9px; min-width: 19px; min-height: 19px; padding: 2px 4px; }
main { max-width: 696px; margin: 35px auto 0; }
.game-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 21px; gap: 15px; }
.eyebrow { font-size: 9px; font-weight: 650; letter-spacing: 2px; }
.game-heading .eyebrow { color: #c6c3cf; display: flex; align-items: center; gap: 8px; }
.live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px #b68afa50; }
#game-status { font-size: 10px; color: var(--muted); }
.game-layout { display: grid; grid-template-columns: 166px minmax(0, 320px) 166px; gap: 22px; align-items: start; }
.panel { background: #181a21; border: 1px solid var(--line); border-radius: 9px; padding: 18px 14px; }
h2 { margin: 0; font-size: 9px; font-weight: 600; letter-spacing: 1.6px; color: #90939f; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 3px; }
.panel-heading kbd { min-width: 19px; min-height: 19px; font-size: 9px; padding: 2px 4px; }
canvas { display: block; }
#hold, #next { width: 100%; height: auto; }
.panel-hint { font-size: 10px; color: #767b89; display: block; }
.hold-panel .panel-hint { text-align: center; }
.stats-panel { margin-top: 18px; padding: 22px 18px; }
.stat { margin-bottom: 24px; }
.stat output { font-variant-numeric: tabular-nums; font-size: 23px; font-weight: 500; letter-spacing: -.5px; display: block; margin-top: 9px; }
.score-stat output { color: var(--accent); font-size: 30px; font-weight: 650; overflow-wrap: anywhere; }
.stat-pair { display: flex; justify-content: space-between; gap: 15px; margin-top: 28px; }
.stat-pair .stat { margin-bottom: 20px; }
.stat-pair output { font-size: 25px; }
.level-progress { background: #2b2d37; height: 3px; border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.level-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.session-time { display: flex; justify-content: space-between; padding: 20px 4px; font-size: 9px; letter-spacing: 1px; color: #717582; }
.session-time output { font-variant-numeric: tabular-nums; color: #a6a8b4; letter-spacing: .5px; }
.board-frame { position: relative; border: 1px solid #3a3a4a; border-top: 2px solid #8f72b9; border-radius: 5px; background: #111319; padding: 8px; box-shadow: 0 12px 50px #0004, 0 0 32px #b68afa06; overflow: hidden; }
#board { width: 100%; aspect-ratio: 1 / 2; background: #101217; height: auto; }
.board-caption { display: flex; justify-content: space-between; color: #686d7b; font-size: 8px; letter-spacing: 1.2px; padding: 14px 1px; }
.board-caption > span:first-child { display: flex; align-items: center; gap: 6px; }
.board-caption i { display: inline-block; width: 4px; height: 4px; background: #76cda1; border-radius: 50%; }
.tiny-label { font-size: 10px; color: #626774; }
.next-panel { padding-bottom: 3px; }
.tip { margin-top: 27px; text-align: center; }
.tip-icon { font-size: 26px; color: #89759f; }
.tip p { color: #747987; font-size: 11px; line-height: 1.8; }
.overlay { position: absolute; inset: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #101217ec; backdrop-filter: blur(5px); z-index: 2; text-align: center; padding: 22px 12px; }
.overlay[hidden] { display: none; }
.overlay-mark { color: var(--accent); font-size: 37px; margin-bottom: 27px; }
.overlay .eyebrow { font-size: 8px; color: #8e859f; letter-spacing: 1.9px; }
.overlay h1 { font-size: 53px; line-height: 1.05; font-weight: 700; letter-spacing: -2.5px; margin: 21px 0 17px; }
.overlay h1 span { color: var(--accent); }
.overlay p { color: #9293a0; font-size: 12px; line-height: 1.9; margin: 0 0 24px; }
.level-select { font-size: 10px; color: #8b8e9c; display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.level-select[hidden] { display: none; }
select { background: #21232d; color: #d5d2dd; border: 1px solid #3b3b4b; border-radius: 4px; padding: 4px 8px; font-size: 11px; }
.play-button { display: flex; justify-content: space-between; align-items: center; gap: 40px; color: #1e152a; background: var(--accent); border: none; border-radius: 6px; padding: 13px 19px; font-size: 12px; font-weight: 700; min-width: 176px; }
.play-button:hover { background: #c5a2ff; }
.play-button span { font-size: 18px; }
.overlay-hint { color: #696b79; font-size: 10px; margin-top: 15px; }
.clear-message { position: absolute; top: 40%; left: 8px; right: 8px; text-align: center; pointer-events: none; color: #fff; text-shadow: 0 2px 15px #000; font-size: 19px; font-weight: 750; opacity: 0; z-index: 1; background: #14121fca; padding: 12px 5px; }
.clear-message.show { animation: clear-message 1.6s both; }
@keyframes clear-message { 0% { opacity: 0; transform: translateY(10px); } 15%, 70% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-10px); } }
.controls { border-top: 1px solid var(--line); margin-top: 14px; padding: 23px 0; display: flex; justify-content: space-between; gap: 12px; }
.controls > div { display: flex; flex-direction: column; align-items: center; gap: 9px; color: #7c808e; font-size: 10px; }
.controls > div > span:first-child { display: flex; gap: 4px; }
.controls kbd { height: 25px; font-size: 10px; }
footer { display: flex; justify-content: space-between; border-top: 1px solid #242730; margin-top: 14px; padding: 24px 0; color: #636876; font-size: 10px; }
footer span:first-child { letter-spacing: 1.6px; font-size: 8px; }
.touch-controls { display: none; }
@media (min-width: 760px) and (max-height: 880px) {
  .header { height: 76px; }
  main { margin-top: 24px; max-width: 634px; }
  .game-layout { grid-template-columns: 150px minmax(0, 290px) 150px; }
  .overlay h1 { font-size: 46px; }
  .overlay-mark { margin-bottom: 18px; }
  .controls { padding: 17px 0; margin-top: 6px; }
  footer { padding: 18px 0; margin-top: 4px; }
}
@media (max-width: 759px) {
  .app-shell { padding: 0 20px; }
  .header { height: 76px; }
  .header-note { display: none; }
  main { margin-top: 24px; }
  .game-layout { grid-template-columns: minmax(70px, 1fr) minmax(0, 300px) minmax(70px, 1fr); gap: 12px; }
  .panel { padding: 13px 9px; }
  .stats-panel { padding: 17px 10px; }
  .stat-pair { flex-direction: column; gap: 0; margin-top: 20px; }
  .stat { margin-bottom: 20px; }
  .score-stat output { font-size: 23px; }
  .panel-hint, .tip, .session-time, #game-status { display: none; }
  .panel-heading { padding: 0; }
  .board-frame { padding: 5px; }
  .board-caption { font-size: 7px; letter-spacing: .5px; }
  .overlay { inset: 5px; }
  .overlay h1 { font-size: clamp(30px, 7vw, 48px); }
  .overlay-mark { font-size: 27px; margin-bottom: 17px; }
  .overlay .eyebrow { font-size: 7px; letter-spacing: 1px; }
  .overlay p { font-size: 11px; margin-bottom: 14px; }
  .play-button { min-width: 140px; padding: 11px 14px; gap: 12px; }
  .controls { flex-wrap: wrap; justify-content: center; gap: 20px; }
}
@media (pointer: coarse), (max-width: 600px) {
  .touch-controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px auto; max-width: 400px; }
  .touch-controls button { touch-action: none; user-select: none; min-height: 44px; border: 1px solid #3a3c4a; background: #20222c; color: #d5c9e9; border-radius: 6px; font-size: 16px; }
  .touch-controls button:last-child { grid-column: span 2; }
  .touch-controls button:active { background: #393047; }
}
@media (max-width: 440px) {
  .app-shell { padding: 0 12px; }
  .game-layout { grid-template-columns: 60px minmax(0, 1fr) 52px; gap: 7px; }
  .panel { padding: 10px 5px; border-radius: 5px; }
  .panel-heading kbd, .tiny-label, .board-caption > span:last-child { display: none; }
  h2 { font-size: 7px; letter-spacing: .8px; }
  .stat output, .stat-pair output, .score-stat output { font-size: 17px; }
  .stat-pair { margin-top: 12px; }
  .stat, .stat-pair .stat { margin-bottom: 16px; }
  .level-progress { margin-bottom: 2px; }
  .overlay { padding: 10px 6px; }
  .overlay-mark { margin-bottom: 10px; font-size: 20px; }
  .overlay h1 { margin: 15px 0 10px; }
  .overlay p { font-size: 10px; }
  .level-select { font-size: 9px; margin-bottom: 12px; gap: 8px; }
  .overlay-hint { font-size: 9px; margin-top: 10px; }
  .play-button { min-width: 125px; font-size: 11px; }
  .controls { gap: 17px; }
  footer { gap: 20px; font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .clear-message.show { opacity: 1; }
}
