@font-face { font-family: "Space Grotesk"; src: url("../fonts/SpaceGrotesk-Bold.ttf"); font-weight: 700; font-display: block; }
:root { --ink: #1c1650; --cream: #fff4d6; --kick: #ff4a26; --snare: #ffc400; --hat: #12c4ee; --clap: #ff4d9d; --block: #35cf5b; --shaker: #9a5cff; --hud: 92px; }
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; background: var(--kick); color: var(--ink); font: 700 16px/1.2 "Space Grotesk", system-ui, sans-serif; overflow: hidden; }
/* svh, not dvh: the stage must not change size when the browser bar slides */
#app { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100svh; overflow: hidden; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
canvas { display: block; }

.btn { font: inherit; color: var(--ink); background: var(--cream); border: 4px solid var(--ink); border-radius: 12px; padding: 0 16px; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 5px 0 var(--ink); cursor: pointer; white-space: nowrap; font-size: 17px; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
.btn.big { min-height: 64px; font-size: 26px; padding: 0 30px; background: var(--snare); }
.btn.dark { background: var(--ink); color: var(--cream); box-shadow: none; min-height: 44px; }
.btn kbd { font: inherit; font-size: .62em; border: 2px solid currentColor; border-radius: 6px; padding: 2px 6px; line-height: 1.1; }
body.touch kbd { display: none; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* home: six lanes fill the window, the name and the buttons sit on them */
#homecv { position: absolute; inset: 0; width: 100%; height: 100%; }
#logo { position: relative; pointer-events: none; text-transform: uppercase; color: var(--cream); line-height: .86; letter-spacing: -.02em; padding: max(18px, env(safe-area-inset-top)) 16px 0; font-size: min(21vw, 15svh); display: flex; flex-direction: column;
  -webkit-text-stroke: .16em var(--ink); paint-order: stroke fill; text-shadow: 0 .09em 0 var(--ink); }
.home-btns { position: relative; margin-top: auto; padding: 0 12px max(18px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; align-items: center; pointer-events: none; }
.home-btns .btn { pointer-events: auto; }
.home-btns .big { min-width: min(320px, 80vw); min-height: 76px; font-size: 34px; }
body.og #logo, body.og .home-btns { display: none; }
@media (min-aspect-ratio: 1/1) { #logo { flex-direction: row; gap: .26em; justify-content: center; font-size: min(11.5vw, 24svh); padding-top: 3svh; } }

/* bars on top of screens */
.bar { flex: none; background: var(--cream); border-bottom: 4px solid var(--ink); display: flex; align-items: center; gap: 12px; padding: max(8px, env(safe-area-inset-top)) 12px 8px; min-height: 64px; }
.bar h2 { font-size: 26px; }
.why { margin-left: auto; text-align: right; font-size: 15px; min-width: 0; }

/* levels: one full-width band per lane count */
#bands { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.band { padding: 14px 12px 20px; border-bottom: 4px solid var(--ink); }
.band h3 { display: flex; align-items: center; gap: 10px; font-size: 24px; margin-bottom: 12px; color: var(--ink); }
.band h3 img { width: 54px; height: 54px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.tile { font: inherit; color: var(--ink); background: var(--cream); border: 4px solid var(--ink); border-radius: 12px; box-shadow: 0 5px 0 var(--ink); min-height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; padding: 6px 4px; }
.tile b { font-size: 30px; line-height: 1; }
.tile small { font-size: 12px; text-align: center; line-height: 1.1; }
.tile .st { font-size: 15px; letter-spacing: 2px; }
.tile.locked { background: transparent; box-shadow: none; border-style: dashed; }
.tile.locked .st { visibility: hidden; }
.tile:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }

/* sound check */
#cal { background: var(--kick); }
#cal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 16px max(16px, env(safe-area-inset-bottom)); text-align: center; color: var(--ink); }
#cal-lead { font-size: 19px; }
#cal-bt { font-size: 15px; background: var(--cream); border: 3px solid var(--ink); border-radius: 10px; padding: 6px 10px; }
#cal-pad { flex: 1; min-height: 110px; width: 100%; background: #b3260a; border: 4px solid var(--ink); border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font: inherit; font-size: 22px; color: var(--cream); cursor: pointer; overflow: hidden; }
#cal-pad img { height: min(60%, 220px); min-height: 60px; aspect-ratio: 1; object-fit: contain; pointer-events: none; transition: transform .12s; }
#cal-pad.beat img { transform: scale(1.14); transition: none; }
#cal-pad.tap { background: #8c1d07; }
#cal-dots { display: flex; gap: 8px; height: 18px; }
#cal-dots i { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--ink); }
#cal-dots i.on { background: var(--cream); }
#cal-msg { min-height: 44px; font-size: 18px; display: flex; align-items: center; }

/* play: a bar of fixed height, then the stage. Nothing in the bar can change the stage's size. */
#play { background: var(--ink); }
#hud { flex: none; height: calc(var(--hud) + env(safe-area-inset-top)); padding: calc(6px + env(safe-area-inset-top)) 10px 0; background: var(--cream); border-bottom: 4px solid var(--ink); display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: 44px 1fr; column-gap: 10px; align-items: center; overflow: hidden; }
#hud .btn { min-height: 40px; font-size: 15px; padding: 0 12px; }
#lv { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 17px; line-height: 1.05; }
#lv b { font-size: 28px; }
#pips { display: flex; gap: 6px; }
#pips i { width: 26px; height: 26px; border-radius: 50%; border: 4px solid var(--ink); transition: transform .2s; }
#pips i.on { background: var(--block); transform: scale(1.15); }
#status { grid-column: 1 / -1; text-align: center; font-size: 17px; line-height: 1.1; align-self: center; }
#stage { position: relative; flex: 1; min-height: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#gate { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; text-align: center; color: var(--cream); font-size: 18px; }
#gate .btn.big { white-space: normal; font-size: 22px; }
#result { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); background: var(--cream); border-top: 4px solid var(--ink); border-bottom: 4px solid var(--ink); padding: 14px 10px 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; animation: drop .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes drop { from { transform: translateY(-50%) scaleY(0); } }
.res-title { font-size: clamp(30px, 9vw, 54px); text-transform: uppercase; line-height: 1; }
#res-stars { font-size: clamp(40px, 12vw, 64px); line-height: 1; letter-spacing: 6px; color: var(--kick); -webkit-text-stroke: 3px var(--ink); }
#res-stars .off { color: transparent; }
#res-line { font-size: 17px; min-height: 22px; }
#result .btn.big { min-height: 56px; font-size: 22px; padding: 0 20px; }

/* panels: a full-width cream band */
.panel { position: absolute; inset: 0; background: rgba(28, 22, 80, .72); display: flex; align-items: center; z-index: 5; }
.sheet { width: 100%; max-height: 100%; overflow-y: auto; background: var(--cream); border-top: 4px solid var(--ink); border-bottom: 4px solid var(--ink); padding: 18px 16px 22px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.sheet h2 { font-size: 30px; text-transform: uppercase; }
#credits-body { font-size: 15px; line-height: 1.35; max-width: 720px; }
#credits-body b { display: block; margin-top: 10px; font-size: 18px; }
#delay-line { font-size: 20px; }
#tweaks-body { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.tw { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.tw .btn { min-height: 40px; font-size: 15px; }
.tw .btn.on { background: var(--block); }

@media (max-height: 460px) { /* phones on their side */
  :root { --hud: 72px; }
  #hud { grid-template-rows: 36px 1fr; } #hud .btn { min-height: 32px; } #lv b { font-size: 22px; } #status { font-size: 15px; }
  #pips i { width: 22px; height: 22px; }
  .home-btns { flex-direction: row; justify-content: center; align-items: flex-end; flex-wrap: wrap; gap: 10px; } .home-btns .big { min-height: 56px; min-width: 180px; font-size: 26px; }
  #logo { font-size: min(10vw, 22svh); }
  #result { padding: 8px 10px 12px; gap: 4px; } .res-title { font-size: 28px; } #res-stars { font-size: 34px; } #result .btn.big { min-height: 48px; } #result .btn { min-height: 44px; }
  .bar { min-height: 52px; padding-top: 4px; padding-bottom: 4px; } .bar h2 { font-size: 20px; } .bar .btn { min-height: 36px; }
  #cal-body { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto 1fr auto; gap: 4px 12px; padding: 6px 12px max(6px, env(safe-area-inset-bottom)); align-items: center; justify-items: center; }
  #cal-body > * { grid-column: 1; min-width: 0; } #cal-lead, #cal-bt { font-size: 14px; } #cal-bt { padding: 3px 8px; }
  #cal-pad { grid-column: 2; grid-row: 1 / -1; min-height: 0; height: 100%; align-self: stretch; } #cal-msg { min-height: 0; font-size: 14px; } #cal-body .btn.big { min-height: 46px; font-size: 20px; }
  .sheet { padding: 10px 12px 14px; gap: 8px; } .sheet h2 { font-size: 22px; }
}
@media (max-width: 380px) { #lv { font-size: 14px; } #lv b { font-size: 24px; } #pips i { width: 22px; height: 22px; } #status { font-size: 15px; } .btn { font-size: 15px; padding: 0 12px; } }
@media (min-width: 900px) and (min-height: 600px) { /* desktop: the bar is read from further away */
  :root { --hud: 116px; }
  #hud { grid-template-rows: 52px 1fr; padding: 8px 16px 0; } #lv { font-size: 24px; } #lv b { font-size: 40px; } #status { font-size: 30px; } #pips i { width: 34px; height: 34px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); } .tile { min-height: 110px; } .tile small { font-size: 14px; }
  #cal-lead { font-size: 26px; } #cal-bt { font-size: 18px; } #cal-msg { font-size: 22px; }
}
