/* The Practice Room. One dark stage, brass accent, condensed numerals you can read from the throne. */
:root {
  --bg: #15171b; --panel: #1b1e24; --raised: #2a2e36; --line: #30353e;
  --fg: #f1f2f4; --muted: #9aa2ad; --brass: #e0b04a; --brass-ink: #15171b;
  --green: #4fbf7a; --amber: #f0a84a; --red: #e06c6c;
  --display: "Barlow Condensed", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
  --bar: 56px; --foot: 44px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
/* The login and player panels set display, which would beat the browser's hidden rule. */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 15px; line-height: 1.4;
  display: grid; grid-template-rows: var(--bar) 1fr var(--foot); overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
a { color: var(--brass); }
h1, h2, h3 { margin: 0; font-family: var(--display); line-height: 1; }
small, .muted { color: var(--muted); }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }

/* top bar */
.bar { display: flex; gap: 10px; align-items: center; padding: 0 max(14px, env(safe-area-inset-left, 0px)) 0 max(14px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { font-size: 13px; font-weight: 500; padding: 7px 12px; border-radius: 999px; background: var(--raised); color: #c7ccd3; white-space: nowrap; }
.chip.on { background: var(--brass); color: var(--brass-ink); font-weight: 600; }
.search { margin-left: auto; min-width: 0; width: 180px; background: var(--raised); border: 0; border-radius: 10px; padding: 8px 12px; color: var(--fg); font: inherit; }
.icon { width: 40px; height: 40px; border-radius: 10px; background: var(--raised); font-size: 18px; display: grid; place-items: center; }
.back { width: 40px; height: 40px; border-radius: 10px; background: var(--raised); font-size: 26px; line-height: 1; }

/* split */
.split { display: grid; grid-template-columns: minmax(280px, 34%) 1fr; min-height: 0; }
.list { overflow-y: auto; border-right: 1px solid var(--line); padding: 8px; display: grid; gap: 4px; align-content: start; }
.row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 10px 10px; border-radius: 10px; }
.row:hover { background: #20242b; }
.row.sel { background: var(--raised); box-shadow: inset 0 0 0 1px var(--brass); }
.row b { font-weight: 600; display: block; }
.row small { display: block; font-size: 12px; }
.row .st { font-size: 11px; color: var(--muted); white-space: nowrap; }
.row .st.learning { color: var(--brass); } .row .st.done { color: var(--green); }
.pip { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--brass-ink); background: #3a3f48; }
.pip.l1, .pip.l2 { background: var(--green); } .pip.l3 { background: var(--amber); } .pip.l4, .pip.l5 { background: var(--red); } .pip.l0 { color: var(--muted); }
.week { font-size: 11px; color: var(--brass); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.empty { padding: 30px 16px; color: var(--muted); text-align: center; }

/* detail */
.detail { overflow-y: auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 24px 16px; display: grid; gap: 12px; align-content: start; }
.d-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.d-head h1 { font-size: 40px; font-weight: 700; text-wrap: balance; }
.d-head .sub { color: var(--muted); margin-top: 4px; }
.seg { display: inline-flex; background: var(--raised); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { padding: 7px 11px; border-radius: 8px; font-size: 13px; color: #c7ccd3; }
.seg button.on { background: var(--brass); color: var(--brass-ink); font-weight: 600; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.tempo { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.dial { width: 128px; height: 128px; border-radius: 50%; display: grid; place-items: center; text-align: center; background: conic-gradient(var(--brass) calc(var(--pct, 0) * 1%), var(--raised) 0); position: relative; }
.dial::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--panel); }
.dial > * { position: relative; }
.dial .big { font-size: 46px; font-weight: 700; line-height: 1; }
.dial small { font-size: 11px; }
.dial.on { box-shadow: 0 0 0 3px #2a2416, 0 0 24px rgba(224,176,74,.25); }
.tinfo { display: grid; gap: 10px; min-width: 0; }
.nums { display: flex; gap: 18px; flex-wrap: wrap; }
.nums b { font-family: var(--display); font-size: 24px; font-weight: 700; display: block; line-height: 1; }
.nums small { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.ctl { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn { background: var(--raised); border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 14px; min-width: 48px; text-align: center; }
.btn.primary, .primary { background: var(--brass); color: var(--brass-ink); }
.btn.big { padding: 12px 20px; font-size: 16px; }
.btn.quiet { background: transparent; color: var(--muted); font-weight: 500; }
.beats { display: flex; gap: 6px; }
.beats i { width: 10px; height: 10px; border-radius: 50%; background: var(--raised); display: inline-block; }
.beats i.on { background: var(--brass); }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.link { display: inline-flex; align-items: center; gap: 6px; background: var(--raised); border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--fg); text-decoration: none; }
.link.yt::before { content: "\25B6"; font-size: 10px; color: var(--brass); }
.link.off { opacity: .45; }
.why { color: #d5d9de; }
.log { display: grid; gap: 10px; }
.log-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field { display: inline-flex; align-items: center; gap: 4px; background: var(--raised); border-radius: 10px; padding: 4px; }
.field b { font-family: var(--display); font-size: 22px; min-width: 56px; text-align: center; }
.field button { width: 36px; height: 36px; border-radius: 8px; font-size: 18px; }
.field small { padding-right: 8px; }
.feel { display: flex; gap: 6px; flex-wrap: wrap; }
.feel button { padding: 9px 12px; border-radius: 10px; background: var(--raised); font-size: 14px; font-weight: 500; }
.feel button.on { background: var(--brass); color: var(--brass-ink); font-weight: 600; }
.hist { display: grid; gap: 4px; }
.hist div { display: grid; grid-template-columns: 1fr auto; gap: 10px; font-size: 13px; padding: 6px 0; border-top: 1px solid var(--line); }
.hist small { font-size: 12px; }
.welcome { display: grid; gap: 12px; align-content: start; }
.welcome h1 { font-size: 34px; }
.welcome .hero { background: linear-gradient(135deg, #2a2416, #1b1e24); border: 1px solid #3a3320; border-radius: 14px; padding: 16px; display: grid; gap: 8px; }
.welcome .hero h2 { font-size: 30px; }

/* footer */
.foot { display: flex; gap: 16px; align-items: center; padding: 0 max(14px, env(safe-area-inset-left, 0px)); border-top: 1px solid var(--line); background: var(--panel); font-size: 13px; color: var(--muted); overflow: hidden; white-space: nowrap; }
.foot b { color: var(--fg); }
.dots { display: inline-flex; gap: 4px; align-items: center; }
.dots i { width: 10px; height: 10px; border-radius: 3px; background: var(--raised); display: inline-block; }
.dots i.on { background: var(--green); }
.foot .sotw { margin-left: auto; color: var(--brass); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* login */
.login { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; padding: 20px; z-index: 20; }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: grid; gap: 12px; }
.login-card h1 { font-size: 30px; }
.login-mark { font-size: 40px; }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input { background: var(--raised); border: 0; border-radius: 10px; padding: 12px; color: var(--fg); font: inherit; font-size: 16px; }
.login-card .primary { padding: 12px; border-radius: 10px; font-weight: 600; font-size: 16px; }
.login-error { color: var(--red); min-height: 1.2em; margin: 0; font-size: 14px; }
.ver { margin: 0; font-size: 11px; color: var(--muted); text-align: right; }

/* video */
.player { position: fixed; right: 16px; bottom: calc(var(--foot) + 12px + env(safe-area-inset-bottom, 0px)); width: min(520px, calc(100vw - 32px)); background: #0b0d10; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; z-index: 15; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.player-bar { display: flex; gap: 10px; align-items: center; padding: 8px 10px 8px 14px; font-size: 13px; }
.player-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.player-frame { aspect-ratio: 16 / 9; background: #000; }
.player-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--foot) + 16px + env(safe-area-inset-bottom, 0px)); background: var(--brass); color: var(--brass-ink); font-weight: 600; padding: 10px 16px; border-radius: 999px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 30; }
.toast.show { opacity: 1; }

/* portrait and phones: list, then detail */
@media (max-width: 820px) {
  .split { grid-template-columns: 1fr; }
  .list { border-right: 0; }
  body:not(.detail-open) .detail, body.detail-open .list { display: none; }
  body.detail-open .back { display: grid; }
  body.detail-open .chips, body.detail-open .search { display: none; }
  .d-head h1 { font-size: 32px; }
  .player { right: 8px; left: 8px; width: auto; }
}
@media (max-width: 480px) { .brand { font-size: 18px; } .search { width: 120px; } .tempo { grid-template-columns: 1fr; justify-items: center; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
