:root { --ink: #fff; --muted: rgba(255,255,255,.72); --glass: rgba(10, 22, 50, .62); --line: rgba(255,255,255,.18); --red: #d8432f; --gold: #f2c94c; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0e1d3f; color: var(--ink); font: 16px/1.4 -apple-system, system-ui, sans-serif; overscroll-behavior: none; }
/* the 3D scene fills the whole screen, the controls float over it */
.stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
main { position: relative; z-index: 1; max-width: 520px; height: 100%; margin: 0 auto; pointer-events: none;
  padding: calc(env(safe-area-inset-top) + 12px) 14px calc(env(safe-area-inset-bottom) + 14px); display: flex; flex-direction: column; }
main > * { pointer-events: auto; }
header { display: flex; justify-content: center; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.3rem; letter-spacing: -.01em; padding: 6px 14px; border-radius: 99px; background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.brand em { font-style: normal; color: var(--gold); }
.hint { margin: auto 0 10px; text-align: center; color: var(--muted); font-size: .9rem; text-shadow: 0 1px 6px rgba(0,0,0,.6); min-height: 1.4em; pointer-events: none; }
.card { background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 18px; padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.player { display: flex; gap: 10px; align-items: center; }
.playbtn { flex: none; width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--red); color: #fff; display: grid; place-items: center; padding: 0; box-shadow: 0 0 0 3px rgba(242,201,76,.35); }
.playbtn.on { background: #fff; color: #0e1d3f; }
.playbtn svg { display: block; }
.pcontrols { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.patterns { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.patterns::-webkit-scrollbar { display: none; }
.patterns button, .seg button, .step { flex: none; border: 1px solid var(--line); background: rgba(255,255,255,.08); color: #fff; border-radius: 99px; padding: 6px 11px; font: inherit; font-size: .84rem; }
.patterns button.on, .seg button.on { background: #fff; color: #0e1d3f; border-color: #fff; }
.prow2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.prow { display: flex; align-items: center; gap: 6px; }
.step { width: 30px; height: 30px; padding: 0; font-size: 1rem; line-height: 1; }
.bpm { min-width: 58px; text-align: center; font-size: .78rem; color: var(--muted); }
.bpm b { color: #fff; font-size: .95rem; }
.seg { display: flex; gap: 5px; }
.seg button { min-width: 36px; padding: 5px 8px; font: italic 600 .9rem Georgia, 'Times New Roman', serif; }
.globals { display: flex; flex-direction: column; gap: 4px; padding-top: 7px; border-top: 1px solid var(--line); }
.globals label { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 10px; font-size: .88rem; color: var(--muted); }
.globals input { width: 100%; accent-color: var(--gold); }
/* first tap: browsers keep sound (and iOS motion access) off until the page is touched */
.tapsound { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; text-align: center; cursor: pointer; background: rgba(6, 12, 30, .45); }
.tapsound > div { background: var(--red); color: #fff; border-radius: 22px; padding: 22px 28px 18px; box-shadow: 0 18px 40px -16px rgba(0,0,0,.6); animation: tapsound 1.6s ease-in-out infinite alternate; }
.tapsound p { margin: 8px 0 0; font-weight: 600; }
@keyframes tapsound { to { transform: scale(1.05); } }
.portrait-only { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .portrait-only { display: grid; place-items: center; position: fixed; inset: 0; z-index: 40; background: #0e1d3f; color: #fff; }
}
