:root { color-scheme: dark; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #e8eeeb; background: #111719; font-synthesis: none; --muted: #82938d; --accent: #9be9c9; --border: #293432; }
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 45% 38%, #1c2925 0, #111719 65%); min-height: 100vh; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
button:disabled { cursor: default; opacity: .4; }
.app { max-width: 1160px; margin: 0 auto; padding: 0 42px; }
.header { height: 94px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 23px; font-weight: 800; letter-spacing: 3px; text-decoration: none; color: #f0f5f1; }
.edition { font-size: 10px; color: var(--accent); letter-spacing: 1px; border: 1px solid #42594f; border-radius: 4px; padding: 4px 5px; margin-left: -4px; }
.brand-mark { display: grid; grid-template-columns: repeat(3, 7px); grid-template-rows: repeat(2, 7px); gap: 2px; margin-right: 2px; }
.brand-mark i { background: var(--accent); border-radius: 1px; }
.brand-mark i:first-child { grid-column: 2; }
.brand-mark i:nth-child(2) { grid-column: 1; }
.header-note { color: var(--muted); font-size: 12px; display: flex; gap: 9px; align-items: center; }
.status-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.quiet-button { border: 1px solid #37453f; border-radius: 7px; color: #d5dfd9; background: #1a2321; padding: 9px 12px; display: flex; gap: 10px; align-items: center; font-size: 12px; }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 23px; height: 22px; padding: 0 5px; border: 1px solid #35413b; border-bottom-width: 2px; border-radius: 4px; color: #b5c4bc; font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
main { max-width: 816px; margin: 0 auto; }
.intro { display: flex; justify-content: space-between; align-items: flex-end; padding: 37px 0 28px; }
.eyebrow { font-size: 9px; letter-spacing: 2px; font-weight: 700; color: var(--accent); margin: 0 0 9px; }
h1 { font-size: 35px; font-weight: 550; letter-spacing: -1.3px; margin: 0; line-height: 1.1; }
h1 > span { color: var(--accent); }
.intro > p { font-size: 12px; line-height: 1.7; color: var(--muted); text-align: right; margin: 0; }
.game-layout { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(240px, 320px) minmax(140px, 1fr); gap: 24px; align-items: start; }
.left-rail, .right-rail { padding-top: 25px; }
.panel { background: #18211f; border: 1px solid var(--border); border-radius: 9px; padding: 18px; margin-bottom: 15px; }
h2 { font-size: 10px; letter-spacing: 1.5px; font-weight: 600; color: #9caca3; margin: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; height: 20px; }
.hold-panel canvas { width: 100%; height: 80px; display: block; }
.small-note { font-size: 10px; color: var(--muted); margin: 0; }
.hold-panel .small-note { text-align: center; }
.score { font: 500 32px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: -1px; margin: 16px 0 23px; overflow-wrap: anywhere; }
.best-row { border-top: 1px solid var(--border); padding-top: 14px; display: flex; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 8px; letter-spacing: .6px; }
.best-row > span:last-child { color: var(--accent); font-family: ui-monospace, monospace; font-size: 10px; letter-spacing: 0; }
.stat { display: flex; justify-content: space-between; align-items: center; }
.stat p { font: 23px ui-monospace, SFMono-Regular, Consolas, monospace; margin: 0; }
.level-track { height: 3px; background: #2c3933; margin: 17px 0 9px; border-radius: 3px; overflow: hidden; }
.level-track > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.lines-stat { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 18px; }
.session { color: #788e82; font-size: 8px; letter-spacing: 1px; display: flex; align-items: center; gap: 7px; justify-content: center; padding: 6px 0; }
.board-top, .board-bottom { display: flex; justify-content: space-between; gap: 10px; font: 9px ui-monospace, SFMono-Regular, Consolas, monospace; color: #8a9e92; letter-spacing: 1px; }
.board-top { height: 25px; align-items: flex-start; }
.board-top > span:first-child { color: var(--accent); }
.board-wrap { position: relative; border: 1px solid #465a4e; border-radius: 5px; overflow: hidden; background: #0e1514; box-shadow: 0 15px 70px #0003, 0 0 0 5px #1e2c2440; }
#board { display: block; width: 100%; height: auto; aspect-ratio: 1 / 2; }
.board-bottom { padding-top: 13px; letter-spacing: 0; line-height: 1.5; min-height: 38px; }
#feedback { font: 10px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #9cb8a6; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: #0e1713db; backdrop-filter: blur(4px); }
.overlay[hidden] { display: none; }
.overlay-content { text-align: center; padding: 22px; width: 100%; }
.overlay-content .eyebrow { font-size: 9px; }
.overlay-content h2 { margin: 22px 0 17px; color: #edf3ed; font-size: 42px; letter-spacing: -1.5px; line-height: 1.05; font-weight: 550; }
.overlay-content p { color: #95a99a; font-size: 13px; line-height: 1.8; margin: 0 0 28px; }
.primary-button { width: 100%; max-width: 210px; border: 0; border-radius: 6px; background: var(--accent); color: #173227; padding: 14px 18px; font-size: 13px; font-weight: 650; display: inline-flex; justify-content: space-between; align-items: center; transition: background .15s, transform .15s; }
.primary-button:hover { background: #b3f5db; transform: translateY(-1px); }
.primary-button > span { font-size: 19px; }
.overlay-hint { display: block; color: #7c9585; font-size: 10px; margin-top: 17px; }
.queue-count { color: #6f8477; font: 10px ui-monospace, monospace; }
#next { display: block; width: 100%; height: 290px; }
.controls { padding: 9px 3px 0; }
.controls h2 { font-size: 9px; color: #8ba193; margin-bottom: 17px; }
dl { margin: 0; }
dl > div { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 5px; }
dt { font-size: 11px; color: #8b9d91; }
dd { display: flex; gap: 4px; margin: 0; }
footer { border-top: 1px solid var(--border); padding: 22px 0 25px; margin-top: 38px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #63776a; font-size: 10px; }
footer > span:first-child { letter-spacing: 1.8px; font-size: 8px; }
.footer-dot { margin: 0 9px; }
.touch-controls { display: none; }
@media (min-width: 760px) and (max-height: 900px) {
  .header { height: 72px; }
  .intro { padding: 24px 0 22px; }
  .game-layout { grid-template-columns: minmax(140px, 1fr) minmax(220px, min(320px, calc((100vh - 250px) / 2))) minmax(140px, 1fr); }
  main { max-width: 750px; }
  #next { height: 230px; }
  .controls { padding-top: 0; }
  dl > div { margin-bottom: 7px; }
  footer { margin-top: 23px; }
}
@media (max-width: 759px) {
  .app { padding: 0 22px; }
  .header { height: 64px; }
  .header-note { display: none; }
  .intro { padding: 18px 0; }
  .game-layout { gap: 14px; grid-template-columns: 112px minmax(180px, 320px); justify-content: center; }
  .left-rail { grid-column: 1; grid-row: 1; }
  .board-section { grid-column: 2; grid-row: 1 / 3; }
  .right-rail { grid-column: 1; grid-row: 2; padding-top: 0; }
  .panel { padding: 10px; margin-bottom: 10px; }
  .score { font-size: 23px; margin: 8px 0 10px; }
  .best-row { flex-direction: column; gap: 5px; padding-top: 9px; }
  .hold-panel canvas { height: 42px; }
  .hold-panel .small-note, .session, .controls, .queue-count { display: none; }
  .stat p { font-size: 20px; }
  .small-note { font-size: 9px; }
  .level-track { margin: 12px 0 7px; }
  .lines-stat { margin-top: 10px; padding-top: 10px; }
  #next { height: 140px; }
  .overlay-content { padding: 16px; }
  .overlay-content h2 { font-size: 34px; }
  footer { font-size: 9px; margin-top: 25px; }
  footer > span:last-child { text-align: right; }
  .touch-controls { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin: 16px auto 0; max-width: 446px; }
  .touch-controls button { min-height: 46px; border: 1px solid #374c3f; background: #1d2a23; color: var(--accent); border-radius: 6px; font-size: 19px; touch-action: none; user-select: none; }
  .touch-controls button:first-child { font-size: 10px; }
  .touch-controls .drop-button { grid-column: 1 / -1; background: #9be9c9; color: #173227; font-size: 12px; letter-spacing: 2px; font-weight: 700; }
  .touch-controls button:active { filter: brightness(1.3); }
}
@media (max-width: 400px) {
  .app { padding: 0 13px; }
  .game-layout { grid-template-columns: 95px minmax(160px, 1fr); gap: 10px; }
  .panel { padding: 10px; }
  h1 { font-size: 30px; }
  .intro > p { font-size: 10px; }
  .overlay-content h2 { font-size: 30px; }
  .overlay-content p { font-size: 11px; margin-bottom: 20px; }
  #next { height: 130px; }
}
@media (pointer: coarse) and (min-width: 760px) {
  .touch-controls { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }
  .touch-controls button { padding: 15px; border: 1px solid var(--border); border-radius: 5px; background: #24392d; color: var(--accent); touch-action: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
