:root {
  color-scheme: dark;
  font-family: 'DM Sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #edf0f5;
  background: #10131b;
  font-synthesis: none;
  --muted: #777e8d;
  --line: #272c38;
  --panel: #171b25;
  --soft-panel: #1c212d;
  --mint: #8be7c0;
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at 50% 38%, #1c2230 0, #141821 41%, #10131b 76%);
}
button { color: inherit; font: inherit; }
.shell { max-width: 1080px; margin: 0 auto; padding: 0 38px; }
.topbar { height: 78px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; color: #f2f4f8; text-decoration: none; font-size: 17px; font-weight: 800; letter-spacing: .16em; }
.brand-mark { width: 19px; height: 18px; display: grid; grid-template-columns: repeat(2, 8px); grid-template-rows: repeat(2, 8px); gap: 2px; transform: skewY(-7deg); }
.brand-mark i { background: var(--mint); border-radius: 1px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { opacity: .72; }
.topbar-note, .footer, .board-heading, .queue-count, .over-kicker { font-family: 'DM Mono', ui-monospace, monospace; font-size: 10px; letter-spacing: .14em; color: #838b9a; }
.live-dot { display: inline-block; width: 6px; height: 6px; background: var(--mint); border-radius: 50%; margin: 0 7px 1px 0; box-shadow: 0 0 9px #8be7c088; }
.note-divider { padding: 0 9px; color: #434957; }
.restart-button { border: 1px solid #343a49; background: #1b202b; border-radius: 6px; padding: 9px 12px; font-size: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.restart-button:hover { border-color: #6e7788; background: #232a37; }
.restart-button span { color: var(--mint); font-size: 16px; padding-left: 6px; vertical-align: -1px; }
.game-layout { display: grid; grid-template-columns: 190px 300px 190px; gap: 28px; justify-content: center; align-items: start; padding: 34px 0 27px; }
.side-column { display: flex; flex-direction: column; gap: 15px; padding-top: 23px; }
.panel { background: rgba(23,27,37,.9); border: 1px solid #282e3b; border-radius: 8px; overflow: hidden; }
.panel-heading { height: 43px; padding: 0 13px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #282e3b; }
.panel-heading h2 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .025em; }
.keycap, kbd { font-family: 'DM Mono', ui-monospace, monospace; font-size: 9px; color: #a1a8b5; background: #252b38; border: 1px solid #343b4b; border-radius: 3px; padding: 3px 5px; box-shadow: 0 1px 0 #0f1218; }
.preview-frame { margin: 12px; height: 78px; border-radius: 5px; background: #11151e; display: grid; place-items: center; }
.hold-frame { height: 82px; }
.stats-panel { padding: 9px 13px; }
.stat-row { display: flex; justify-content: space-between; align-items: baseline; min-height: 34px; border-bottom: 1px solid #262b36; color: #8c94a2; font-size: 11px; }
.stat-row:last-child { border: 0; }
.stat-row strong { color: #f2f3f6; font-family: 'DM Mono', ui-monospace, monospace; font-size: 13px; font-weight: 500; }
.stat-row:first-child strong { color: var(--mint); font-size: 15px; }
.tip-card { border: 1px solid #2b423c; background: linear-gradient(135deg,#1b2c29,#17211f); border-radius: 7px; display: flex; gap: 9px; align-items: flex-start; padding: 11px; color: #9fbab1; font-size: 10px; line-height: 1.55; }
.tip-card p { margin: 0; }
.tip-card strong { color: #c4f2df; font-weight: 600; }
.tip-icon { color: var(--mint); font-size: 14px; line-height: 1; }
.board-heading { height: 23px; display: flex; justify-content: space-between; align-items: flex-start; }
.board-size { color: #606878; letter-spacing: .08em; }
.board-wrap { position: relative; overflow: hidden; border: 1px solid #37404f; border-radius: 5px; box-shadow: 0 20px 45px #05070b77, 0 0 0 5px #171c26; }
#board { display: block; width: 300px; height: 600px; }
.notice { pointer-events: none; position: absolute; top: 37%; left: 0; right: 0; text-align: center; color: #fff2ad; font-size: 18px; font-weight: 800; letter-spacing: .08em; text-shadow: 0 2px 15px #ffd55499; opacity: 0; transform: translateY(5px) scale(.94); transition: opacity .12s, transform .12s; }
.notice.visible { opacity: 1; transform: translateY(0) scale(1); }
.game-over { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; background: rgba(8,10,15,.78); backdrop-filter: blur(3px); }
.game-over.visible { display: flex; }
.game-over-card { text-align: center; padding: 22px; }
.over-kicker { color: var(--mint); font-size: 9px; }
.game-over h2 { font-size: 25px; margin: 9px 0; }
.game-over p { color: #9ba2ae; font-size: 12px; margin: 0 0 23px; }
.game-over p strong { display: block; margin-top: 7px; color: #fff; font-family: 'DM Mono', monospace; font-size: 22px; font-weight: 500; }
.restart-hint { color: #87909e; font-size: 10px; }
.restart-hint kbd { margin: 0 3px; }
.next-panel .panel-heading { height: 43px; }
.queue-count { font-size: 8px; color: #697182; }
.next-list { padding: 7px 12px 12px; }
.next-slot { height: 58px; display: grid; place-items: center; border-bottom: 1px solid #262b36; }
.next-slot:last-child { border: 0; }
.next-slot.featured { height: 68px; }
.controls-panel { padding-bottom: 8px; }
.control-list { display: grid; gap: 0; padding: 7px 12px 0; margin: 0; }
.control-list div { display: flex; justify-content: space-between; align-items: center; min-height: 27px; }
.control-list dt { display: flex; align-items: center; gap: 3px; }
.control-list dd { margin: 0; color: #9199a7; font-size: 10px; }
.control-list kbd { padding: 3px 4px; min-width: 18px; text-align: center; }
.footer { display: flex; justify-content: space-between; align-items: center; min-height: 45px; border-top: 1px solid var(--line); font-size: 9px; letter-spacing: .12em; color: #5e6674; }
.footer b { color: var(--mint); font-size: 13px; padding-left: 5px; }
.mobile-controls { display: none; }

@media (max-width: 780px) {
  .shell { padding: 0 18px; }
  .game-layout { grid-template-columns: minmax(0, 300px) 150px; gap: 22px; }
  .left-column { grid-column: 2; grid-row: 1; padding-top: 23px; }
  .board-column { grid-column: 1; grid-row: 1; }
  .right-column { grid-column: 2; grid-row: 1; padding-top: 210px; }
  .tip-card { display: none; }
  .controls-panel { display: none; }
}
@media (max-width: 560px) {
  .shell { padding: 0 12px; }
  .topbar { height: 62px; }
  .topbar-note { display: none; }
  .game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 11px; padding-top: 22px; align-items: start; }
  .board-column { grid-column: 1; grid-row: 1; min-width: 0; }
  #board { width: 100%; height: auto; aspect-ratio: 1 / 2; }
  .board-wrap { box-shadow: 0 10px 25px #05070b66, 0 0 0 3px #171c26; }
  .left-column { grid-column: 2; grid-row: 1; padding-top: 23px; gap: 10px; }
  .right-column { display: none; }
  .panel-heading { padding: 0 9px; height: 37px; }
  .panel-heading h2 { font-size: 11px; }
  .preview-frame { margin: 7px; height: 61px; }
  .hold-frame { height: 64px; }
  .stats-panel { padding: 5px 8px; }
  .stat-row { min-height: 31px; font-size: 10px; }
  .stat-row strong { font-size: 11px; }
  .stat-row:first-child strong { font-size: 11px; }
  .mobile-controls { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding-top: 13px; touch-action: none; }
  .mobile-controls button { min-height: 42px; border-radius: 6px; border: 1px solid #353d4d; background: #202633; color: #e9edf4; font-size: 18px; font-weight: 600; touch-action: none; user-select: none; }
  .mobile-controls button:active { background: #2e3947; border-color: #637282; }
  .mobile-controls #hold { grid-column: span 2; font-family: 'DM Mono', monospace; font-size: 10px; }
  .mobile-controls #hard-drop { grid-column: span 3; color: #121a19; background: var(--mint); border-color: var(--mint); font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .1em; }
  .footer { margin-top: 9px; font-size: 8px; }
}
