/* Blocks — black and white, no theme. One typeface (IBM Plex Mono);
 * hierarchy from size and weight; white is "yours / active", grey is
 * "information / not available". */
:root {
  --bg: #000;
  --fg: #f2f2f2;
  --dim: #8a8a8a;
  --faint: #4a4a4a;
  --line: #2e2e2e;
  --panel: #0c0c0c;
  --font: 'IBM Plex Mono', ui-monospace, 'Courier New', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--fg); font: 400 16px/1.45 var(--font); }
button { font: inherit; color: inherit; }
p { margin: 0; }
.muted { color: var(--dim); }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
kbd { display: inline-block; min-width: 20px; padding: 0 5px; text-align: center; font: 600 12px/18px "Segoe UI Symbol", Arial, sans-serif;
  color: var(--bg); background: var(--fg); border-radius: 2px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; cursor: pointer;
  border: 2px solid var(--fg); background: var(--fg); color: var(--bg); font-weight: 600; font-size: 18px; }
.btn:hover:not(:disabled) { background: #fff; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn kbd { background: var(--bg); color: var(--fg); }
.btn.ghost { background: transparent; color: var(--fg); font-weight: 400; font-size: 15px; padding: 7px 12px; }
.btn.ghost:hover:not(:disabled) { background: #1a1a1a; }
.btn:disabled { cursor: not-allowed; border-color: var(--faint); background: transparent; color: var(--faint); }
.btn.ghost.on { background: var(--fg); color: var(--bg); }
.btn.wide { width: 100%; }
.linkbtn { padding: 0; border: 0; background: none; color: var(--dim); cursor: pointer; text-decoration: underline; font-size: 14px; }
.linkbtn:hover { color: var(--fg); }

/* ---------- play ---------- */
#playScreen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; overflow: hidden; }
.topline { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 24px; width: min(100%, 640px); }
#roundLbl { color: var(--dim); font-size: 14px; }
#modeLbl { color: var(--dim); font-size: 14px; text-align: right; }
#score { font: 600 44px/1 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -1px; }
#score.met { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }
.pulse { animation: pulse .3s ease-out; }
@keyframes pulse { 40% { transform: scale(1.08); } }
.stage { display: flex; align-items: flex-start; gap: 16px; }
.side { width: 120px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.panel { padding: 6px 8px 8px; border: 1px solid var(--line); background: var(--panel); }
.plabel { font-size: 13px; color: var(--dim); text-align: center; margin-bottom: 2px; }
.panel canvas { display: block; }
#piecesLeft { display: flex; flex-direction: column; align-items: center; color: var(--dim); font-size: 13px; line-height: 1.2; }
#piecesLeft b { font: 600 40px/1 var(--font); color: var(--fg); }
#piecesLeft.low b { text-decoration: underline; text-underline-offset: 5px; }
.well { border: 2px solid var(--fg); }
#boardWrap { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; background: #000; }
#board { display: block; }
#playHint { font-size: 14px; color: var(--dim); text-align: center; max-width: 640px; line-height: 1.5; }
#playHint .keys kbd { margin: 0 2px 0 8px; }
#playHint .keys kbd + kbd { margin-left: 0; }
#touchHint { font-size: 13px; color: var(--dim); text-align: center; max-width: 300px; }

/* floating score text */
#floats { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.float { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; z-index: 3;
  font: 600 20px var(--font); color: #fff; text-shadow: 0 0 4px #000, 2px 2px 0 #000, -2px -2px 0 #000;
  animation: floatUp 1.3s ease-out forwards; }
.float.small { font-size: 14px; font-weight: 400; }
.float.total { font-size: 28px; }
.float.combo { font-size: 18px; }
.float.huge { font-size: 38px; animation: floatHuge 1.4s ease-out forwards; }
@keyframes floatUp { 0% { opacity: 0; margin-top: 8px; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -50px; } }
@keyframes floatHuge { 0% { opacity: 0; transform: translateX(-50%) scale(.5); } 20% { opacity: 1; transform: translateX(-50%) scale(1.2); }
  40% { transform: translateX(-50%) scale(1); } 100% { opacity: 0; transform: translateX(-50%); margin-top: -60px; } }
.shake { animation: shake .25s; }
.shake-big { animation: shake .45s; }
@keyframes shake { 20% { transform: translate(-3px, 2px); } 40% { transform: translate(3px, -2px); } 60% { transform: translate(-2px, 1px); } 80% { transform: translate(2px, -1px); } }

#overlay { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; padding: 20px; background: rgba(0,0,0,.88); }
.ov-title { font-size: 22px; }
.ov-score { font: 600 48px/1.1 var(--font); }
.ov-score.miss { color: var(--dim); text-decoration: line-through; text-decoration-thickness: 3px; }
#overlay .btn { margin-top: 14px; }

/* ---------- menu screens ---------- */
#menuScreen { max-width: 1180px; margin: 0 auto; padding: 36px 32px 60px; }
.title { font: 600 64px/1 var(--font); letter-spacing: -3px; margin: 0 0 14px; }
.start { max-width: 620px; margin: 8vh auto 0; display: flex; flex-direction: column; gap: 14px; }
.start .lede { font-size: 18px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.mode { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--line); background: var(--panel); }
.mode h2 { font-size: 20px; margin: 0; }
.mode p { color: var(--dim); font-size: 14px; flex: 1; }
.start .route { margin-left: 0; }
.unlocks { border-top: 1px solid var(--line); padding-top: 12px; }
.unlocks b { font-weight: 600; }

.runhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 28px; padding-bottom: 16px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.runhead h1 { font: 600 30px/1 var(--font); margin: 0; letter-spacing: -1px; }
.coins { font-size: 18px; }
.coins b { font: 600 30px/1 var(--font); }
.route { display: flex; gap: 3px; margin-left: auto; }
.stop { width: 46px; display: flex; flex-direction: column; align-items: center; padding: 3px 0; border: 1px solid var(--line); font-size: 12px; color: var(--dim); }
.stop b { font-size: 14px; font-weight: 600; }
.stop.hz { border-style: dashed; border-color: var(--dim); }
.stop.done { color: var(--fg); }
.stop.fail { color: var(--fg); text-decoration: line-through; }
.stop.next { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.cols { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 32px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.card { padding: 16px 18px; border: 1px solid var(--line); background: var(--panel); }
.card h2 { font-size: 18px; margin: 0 0 12px; display: flex; align-items: baseline; gap: 10px; }
.card h2 .muted { font-size: 13px; font-weight: 400; }
.next .target { font-size: 15px; color: var(--dim); }
.next .target b { font: 600 44px/1 var(--font); color: var(--fg); letter-spacing: -1px; }
.next .row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.next canvas { display: block; border: 1px solid var(--line); }
.next .hz { margin-top: 10px; padding: 8px 10px; border: 1px dashed var(--dim); font-size: 14px; }
.next .btn { margin-top: 16px; }

.picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.pick { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); background: var(--panel); }
.pick canvas { display: block; align-self: center; margin: 4px 0; }
.pick h3 { font-size: 16px; margin: 0; }
.pick p { font-size: 14px; color: var(--dim); flex: 1; }
.pick .btn { justify-content: center; }
.skip { margin-top: 12px; }

.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 0; }
.item .info { flex: 1; min-width: 0; }
.item .name { font-weight: 600; }
.item .lv { color: var(--dim); font-weight: 400; margin-left: 6px; font-size: 13px; }
.item .desc { font-size: 14px; color: var(--dim); }
.item.sold .name { color: var(--faint); font-weight: 400; }
.svc { display: flex; flex-wrap: wrap; gap: 8px; }
.prompt { min-height: 1.4em; margin: 10px 0 6px; font-size: 14px; }
.deck { display: flex; flex-wrap: wrap; gap: 6px; }
.dpiece { padding: 2px; border: 1px solid var(--line); background: #000; cursor: default; }
.dpiece canvas { display: block; }
.deck.picking .dpiece:not(:disabled) { cursor: pointer; border-color: var(--fg); }
.deck.picking .dpiece:not(:disabled):hover { background: #1a1a1a; }
.dpiece:disabled { opacity: .3; }
.legend { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 13px; color: var(--dim); margin-top: 12px; }
.legend b { color: var(--fg); text-align: center; min-width: 22px; background: var(--fg); color: var(--bg); padding: 0 4px; }

#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 20; pointer-events: none; }
.toast { background: var(--fg); color: var(--bg); padding: 7px 16px; font-weight: 600; animation: drop .2s ease-out; transition: opacity .4s; }
.toast.out { opacity: 0; }
@keyframes drop { from { transform: translateY(-6px); opacity: 0; } }

/* ---------- phases ---------- */
body.phase-menu .play-only, body.phase-play .menu-only { display: none !important; }
.touch-only { display: none; }
@media (hover: none) and (pointer: coarse) { .touch-only { display: block; } .no-touch { display: none !important; } }

@media (max-width: 860px) {
  #menuScreen { padding: 22px 16px 50px; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .route { margin-left: 0; }
  .picks, .modes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .side { width: 70px; }
  .stage { gap: 8px; }
  #score { font-size: 32px; }
  #piecesLeft b { font-size: 28px; }
  .title { font-size: 48px; }
}
