/* Practice Studio — shared styles (lane 1). Dark only. */
:root {
  --bg: #14110f; --panel: #1d1916; --panel2: #231e1a; --line: #2e2723; --text: #efe6dc; --dim: #9a8d80;
  --acc: #ff9d3c; --ok: #3ddc84; --blue: #5aa9ff; --red: #ff5a5a;
  --acc-bg: #3a2a1c; --ok-bg: #16261b; --bar: #100e0c;
  --mm: 4.6875px;                       /* CSS px per real mm — overwritten by calibration.js */
  --btn-h: calc(var(--mm) * 9);         /* ≥ 9 mm touch targets */
  --fold-gap: calc(var(--mm) * 8);      /* ±4 mm keep-out around each fold */
  --top-h: max(calc(var(--mm) * 11), 48px);
  --r: 10px;
  --font: system-ui, -apple-system, "Avenir Next", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.35 var(--font);
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
body { display: flex; flex-direction: column; overflow: hidden; user-select: none; -webkit-user-select: none; }
a { color: var(--acc); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.15; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 19px; font-weight: 750; }
h3 { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
p { margin: 0 0 .6em; }
button, input, select { font: inherit; color: inherit; }

/* ---------- top bar: columns aligned so nothing interactive sits on a fold ---------- */
.topbar { flex: none; height: var(--top-h); background: var(--bar); border-bottom: 1px solid var(--line);
  display: grid; align-items: center;
  grid-template-columns: calc(33.333% - var(--fold-gap) / 2 - 176px) 176px var(--fold-gap) calc(33.333% - var(--fold-gap)) var(--fold-gap) calc(33.333% - var(--fold-gap) / 2); }
.brand { color: var(--acc); font-weight: 800; font-size: 14px; text-decoration: none; padding-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tabs { display: flex; justify-content: space-around; align-items: center; height: 100%; min-width: 0; }
.tab { display: inline-flex; align-items: center; justify-content: center; min-height: min(var(--btn-h), calc(var(--top-h) - 6px));
  padding: 0 8px; border-radius: 999px; color: var(--dim); text-decoration: none; font-weight: 550; font-size: 14.5px; white-space: nowrap; }
.tab.on { background: var(--acc-bg); color: var(--acc); font-weight: 750; }
.pillcell { display: flex; justify-content: flex-end; padding-right: 10px; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: min(var(--btn-h), calc(var(--top-h) - 8px)); padding: 0 16px;
  border-radius: 999px; background: var(--panel); color: var(--dim); text-decoration: none; font-weight: 650; font-size: 14px; white-space: nowrap; }
.pill .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex: none; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--acc-bg); color: var(--acc); }

/* ---------- main view ---------- */
.view { flex: 1; min-height: 0; overflow: auto; position: relative; }

/* 3 columns between the folds: col | gap | col | gap | col */
.fold-grid { display: grid; height: 100%;
  grid-template-columns: calc(33.333% - var(--fold-gap) / 2) var(--fold-gap) calc(33.333% - var(--fold-gap)) var(--fold-gap) calc(33.333% - var(--fold-gap) / 2); }
.fold-grid > .col { min-width: 0; min-height: 0; padding: 12px; display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.fold-grid > .col:first-child { padding-left: 14px; }
.fold-grid > .col:last-child { padding-right: 14px; }
.fold-grid > .gap { min-width: 0; }
.fold-safe { margin-left: calc(var(--fold-gap) / 2); margin-right: calc(var(--fold-gap) / 2); }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.panel.hi { border-color: var(--acc); background: #2a1f15; }
.panel.soon { max-width: 560px; margin: 60px auto; text-align: center; padding: 28px; }
.panel.err h2 { color: var(--red); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--btn-h); padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-weight: 650; font-size: 15px;
  text-decoration: none; cursor: pointer; white-space: nowrap; touch-action: manipulation; }
.btn:active { transform: translateY(1px); filter: brightness(1.15); }
.btn.on, .btn.primary { background: var(--acc-bg); color: var(--acc); border-color: var(--acc); }
.btn.go { background: var(--acc-bg); color: var(--ok); border: 2px solid var(--ok); }
.btn.ok { color: var(--ok); border-color: var(--ok); }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .4; pointer-events: none; }

/* segmented control */
.seg { display: inline-flex; background: var(--bar); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; max-width: 100%; }
.seg > button { min-height: calc(var(--btn-h) - 8px); padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--dim);
  font-weight: 600; cursor: pointer; flex: 1; white-space: nowrap; touch-action: manipulation; }
.seg > button.on { background: var(--acc-bg); color: var(--acc); font-weight: 750; }
.seg.full { display: flex; width: 100%; }

/* ---------- chord boxes (shared look for now/next chord) ---------- */
.chord-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px 6px; text-align: center; }
.chord-box .name { font-weight: 750; font-size: 17px; }
.chord-box .sub { font-size: 11px; color: var(--dim); }
.chord-box.hi { background: #2a1f15; border-color: var(--acc); }
.chord-box.hi .name { color: var(--acc); font-size: 21px; }
.chord-box svg { display: block; margin: 4px auto 0; }

/* ---------- utility ---------- */
.dim { color: var(--dim); } .acc { color: var(--acc); } .okc { color: var(--ok); } .redc { color: var(--red); } .bluec { color: var(--blue); }
.tiny { font-size: 11px; } .small { font-size: 13px; } .big { font-size: 34px; font-weight: 800; }
.mono { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; align-items: center; } .col-flex { display: flex; flex-direction: column; gap: 8px; }
.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .between { justify-content: space-between; } .center { justify-content: center; text-align: center; }
.hidden { display: none !important; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--acc-bg); color: var(--acc); font-size: 11px; font-weight: 700; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.label { font-size: 11px; color: var(--dim); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
input[type=number], input[type=text], select { min-height: var(--btn-h); background: var(--bar); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; }
.bar-meter { height: 8px; background: var(--bar); border-radius: 4px; overflow: hidden; }
.bar-meter > i { display: block; height: 100%; background: var(--ok); }

/* ---------- modal: lives in the middle third, clear of both folds ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(8, 6, 5, .78); z-index: 50; display: flex; align-items: center; }
.modal { margin-left: calc(33.333% + var(--fold-gap) / 2); width: calc(33.333% - var(--fold-gap)); max-height: calc(100% - 24px); overflow: auto;
  background: var(--panel); border: 1px solid var(--acc); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.modal.wide { margin-left: 14px; width: calc(100% - 28px); }

/* ---------- fold guides ---------- */
.folds { position: fixed; inset: var(--top-h) 0 0 0; pointer-events: none; z-index: 40; display: none; }
.folds.on { display: block; }
.folds i { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed rgba(255, 255, 255, .16); }
.folds i:nth-child(1) { left: 33.333%; } .folds i:nth-child(2) { left: 66.666%; }
.folds i::after { content: 'fold'; position: absolute; bottom: 4px; left: 4px; font-size: 10px; color: rgba(255, 255, 255, .28); }

/* ---------- calibrate screen ---------- */
.cal { height: 100%; display: flex; flex-direction: column; align-items: stretch; }
.cal-stage { flex: 1; min-height: 0; display: grid; align-items: start;
  grid-template-columns: calc(33.333% - var(--fold-gap) / 2) var(--fold-gap) calc(33.333% - var(--fold-gap)) var(--fold-gap) calc(33.333% - var(--fold-gap) / 2); }
.cal-col { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; min-width: 0; }
.cal-l { grid-column: 1; } .cal-r { grid-column: 5; align-items: flex-end; text-align: right; }
.cal-l h1 { font-size: 22px; margin: 0; line-height: 1.15; } .cal-l p { margin: 0; font-size: 13px; }
.cal-nudges { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.cal-nudges .btn { padding: 0 6px; }
.cal-mid { grid-column: 3; height: 100%; display: flex; align-items: center; justify-content: center; overflow: visible; }
.cal-r .go { width: 100%; }
.card { position: relative; flex: none; pointer-events: none; border: 2.5px dashed var(--acc); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.card .chip { position: absolute; background: var(--acc-bg); border-radius: 6px; }
.card .dims { color: var(--acc); font-weight: 750; font-size: 16px; }
.card .what { color: var(--dim); font-size: 12px; margin-top: 4px; }
.ruler { flex: none; width: 100%; background: #1a1613; overflow: hidden; }
.ruler canvas { display: block; }
.cal-foot { flex: none; display: grid; align-items: center; padding: 8px 0 10px;
  grid-template-columns: calc(33.333% - var(--fold-gap) / 2) var(--fold-gap) calc(33.333% - var(--fold-gap)) var(--fold-gap) calc(33.333% - var(--fold-gap) / 2); }
.cal-foot .c1 { padding-left: 14px; display: flex; gap: 8px; }
.cal-foot .c5 { padding: 0 14px 0 4px; }
.cal-info { color: var(--dim); font-size: 12.5px; }

/* touch test pad */
.touchpad { position: fixed; inset: 0; z-index: 60; background: #0b0908; touch-action: none; }
.touchpad .tp-stats { position: absolute; left: 14px; top: 12px; width: calc(33.333% - var(--fold-gap) / 2 - 28px); display: flex; flex-direction: column; gap: 8px; z-index: 2; }
.touchpad .tp-hint { position: absolute; left: 33.333%; right: 0; top: 40%; text-align: center; color: var(--dim); font-size: 18px; pointer-events: none; }
.touchpad .blob { position: absolute; border: 2px solid var(--ok); border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.touchpad .blob.palm { border-color: var(--red); background: rgba(255, 90, 90, .15); }
.touchpad .blob b { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); white-space: nowrap; font-size: 12px; margin-top: 4px; }

/* ---------- home ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.steps li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: start; padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.steps li .n { width: 24px; height: 24px; border-radius: 50%; background: var(--bar); color: var(--dim); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.steps li .t { font-weight: 650; font-size: 14px; } .steps li .d { color: var(--dim); font-size: 12px; }
.steps li .s { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.steps li.on { border-color: var(--acc); background: #2a1f15; } .steps li.on .n { background: var(--acc); color: #1b140e; }
.steps li.done { opacity: .6; } .steps li.done .n { background: var(--ok); color: #08200f; }
.timer { font-size: 54px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.timer.over { color: var(--ok); }
.week { display: flex; align-items: flex-end; gap: 6px; height: 70px; }
.week > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; }
.week > div > i { width: 100%; background: var(--acc); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.week > div.today > i { background: var(--ok); }
.week > div > span { font-size: 10px; color: var(--dim); }
.posture svg { width: 100%; height: auto; max-height: 150px; }
.posture ul { margin: 0; padding-left: 18px; } .posture li { margin: 3px 0; font-size: 14px; }

/* ---- tuner ---- */
.tuner { display: grid; grid-template-columns: calc(33.333% - var(--fold-gap) / 2) var(--fold-gap) calc(33.333% - var(--fold-gap)) var(--fold-gap) calc(33.333% - var(--fold-gap) / 2); height: 100%; padding: 10px 0; box-sizing: border-box; }
.tuner .tleft { grid-column: 1; padding-left: 14px; } .tuner .tmid { grid-column: 3; } .tuner .tright { grid-column: 5; padding: 0 14px 0 4px; }
.tuner .tcol { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.tuner .lbl { color: var(--dim); font-size: 12px; letter-spacing: .08em; font-weight: 700; margin-top: 6px; }
.tuner .seg { display: flex; gap: 8px; } .tuner .seg .btn { flex: 1; padding: 0 8px; }
.tuner .strings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tuner .str { flex-direction: column; gap: 0; padding: 0 4px; min-width: 0; line-height: 1.1; font-size: 20px; font-weight: 800; min-height: calc(var(--btn-h) * 1.5); }
.tuner .str .tiny { font-size: 11px; font-weight: 500; }
.tuner .str.locked { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.tuner .row { display: flex; gap: 10px; align-items: center; } .tuner .a4 { flex: 1; text-align: center; font-size: 18px; }
.tuner .tmid { position: relative; }
.tuner #t-canvas { width: 100%; height: 56%; display: block; }
.tuner .readout { text-align: center; }
.tuner .note { font-size: 84px; font-weight: 900; line-height: 1; letter-spacing: -.02em; }
.tuner .cents { font-size: 22px; font-weight: 700; margin-top: 8px; min-height: 28px; }
.tuner .hz { font-size: 13px; margin-top: 6px; }
.tuner .big { font-size: 20px; min-height: calc(var(--btn-h) * 1.4); }
.tuner .howto { padding-left: 18px; margin: 0; font-size: 14px; line-height: 1.45; }

/* ---- full-screen (edge-to-edge) instrument mode ---- */
.pillcell .focusbtn { margin-right: 8px; padding: 0 12px; font-size: 18px; }
body.focus #topbar { display: none; }
body.focus #view { visibility: hidden; }
body.focus [data-focus-target] { position: fixed !important; inset: 0 !important; width: auto !important; height: auto !important; z-index: 40; visibility: visible; background: var(--bg); }
body.focus [data-focus-target] * { visibility: visible; }
.focusbar { position: fixed; top: 6px; right: 8px; z-index: 45; display: flex; gap: 8px; }
.focusbar .btn { min-height: calc(var(--mm) * 8); padding: 0 12px; opacity: .85; }

.brand .short { display: none; }
@media (max-width: 900px) { .brand .long { display: none; } .brand .short { display: inline; } }
