/* The look is a classical guitar seen from the front: a spruce top, the dark
   soundhole in the middle, and the loop drawn around it like the rosette.
   Night mode is the same guitar in ebony. Colours live here and nowhere else. */
:root {
  --ground: #EFE2C2; --ink: #1D1510; --soft: #6A5942; --rule: #CBB78B;
  --hole: #16100C; --hole-ink: #F5EBD4; --hole-soft: #A8977A; --hole-in: #7FD0A0; --hole-out: #FF8A7A;
  --rec: #D42A1C; --pulse: #C98A1B;
  --l1: #2F6B4A; --l2: #2D4C9A; --l3: #8A3A72; --l4: #9A6508;
  --wood: #3A2219; --fretwire: #B9B2A2; --nylon: #EFE6D2; --bone: #F3ECDA; --fb-root: #F2B844; --fb-box: rgba(255, 255, 255, .13); --fb-live: #FFFFFF;
  --scrim: rgba(22, 16, 12, .62);
  --display: "Big Shoulders Display", "Arial Narrow", "Helvetica Neue", sans-serif;
  --body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #18120E; --ink: #F2E7D0; --soft: #B09F82; --rule: #43342A;
    --hole: #090604;
    --rec: #FF5A48; --pulse: #E6B450;
    --l1: #74C795; --l2: #8FA8F5; --l3: #DD8FC6; --l4: #E6B450;
    --scrim: rgba(0, 0, 0, .72);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 16px/1.45 var(--body);
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
h1, h2, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .32; }
:focus-visible { outline: 3px solid var(--pulse); outline-offset: 2px; }

.app {
  max-width: 1120px; margin: 0 auto; padding: 18px clamp(16px, 4vw, 40px) 40px;
  display: grid; gap: 26px 56px;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  grid-template-rows: auto auto auto auto 1fr;
  grid-template-areas: "top top" "stage setup" "stage scale" "stage timing" "stage keys";
}
.top { grid-area: top; display: flex; align-items: baseline; justify-content: space-between; border-bottom: 2px solid var(--ink); padding-bottom: 8px; }
.setup { grid-area: setup; }
.stage { grid-area: stage; align-self: start; }
.scale { grid-area: scale; }
.timing { grid-area: timing; }
.keys { grid-area: keys; }

h1 { font: 900 30px/1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.test-tag { margin: 0 auto 0 16px; padding: 3px 8px; background: var(--rec); color: var(--ground); font: 600 12px/1.3 var(--body); text-transform: uppercase; letter-spacing: .08em; }
.link { background: none; border: 0; padding: 6px 0; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.lab { display: block; font: 600 12px/1 var(--body); text-transform: uppercase; letter-spacing: .12em; color: var(--soft); margin-bottom: 8px; }
.hint { font-size: 14px; color: var(--soft); max-width: 60ch; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sheet .row { flex-wrap: nowrap; align-items: flex-start; gap: 12px; }
.hint .link { padding: 0; font-weight: 600; }

/* Controls are stamped keys: square corners, ink outline, filled when on. */
.key {
  min-width: 48px; height: 48px; padding: 0 6px; border: 2px solid var(--ink); border-radius: 4px; background: none;
  font: 800 22px/1 var(--display); text-transform: uppercase; letter-spacing: .04em;
}
.key.wide { padding: 0 18px; }
.key[aria-pressed="true"] { background: var(--ink); color: var(--ground); }

.setup { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: flex-end; }
.bpm {
  width: 2.1em; height: 48px; padding: 0; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; background: none;
  font: 900 48px/1 var(--display); text-align: center; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield;
}
.bpm::-webkit-outer-spin-button, .bpm::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bpm:disabled { opacity: .45; }
.lock { flex-basis: 100%; }

/* The loop */
.stage { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.disc { position: relative; width: 100%; max-width: 520px; aspect-ratio: 1; container-type: inline-size; }
.disc canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hole {
  position: absolute; left: 50%; top: 50%; width: 40cqw; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 1.6cqw; color: var(--hole-ink); text-align: center; pointer-events: none;
}
.note { font: 900 21cqw/.86 var(--display); letter-spacing: -.01em; }
.note sup { font-size: .5em; vertical-align: top; position: relative; top: .08em; margin-left: .04em; }
.tune { position: relative; width: 26cqw; height: 2px; background: var(--hole-soft); }
.tune::before { content: ""; position: absolute; left: 50%; top: -1cqw; bottom: -1cqw; width: 2px; margin-left: -1px; background: var(--hole-soft); }
.tune i { position: absolute; left: 50%; top: 50%; width: 2.4cqw; height: 2.4cqw; margin: -1.2cqw 0 0 -1.2cqw; border-radius: 50%; background: var(--hole-ink); }
.verdict { font: 600 clamp(11px, 3.1cqw, 16px)/1.2 var(--body); text-transform: uppercase; letter-spacing: .1em; color: var(--hole-soft); }
.hole[data-fit="none"] .note, .hole[data-fit="none"] .tune i { color: var(--hole-soft); opacity: .55; }
.hole[data-fit="in"] .verdict { color: var(--hole-in); }
.hole[data-fit="out"] .verdict { color: var(--hole-out); }
.hole[data-fit="count"] .note { color: var(--hole-out); }
.hole[data-fit="count"] .tune { visibility: hidden; }

.transport { display: flex; align-items: center; justify-content: center; gap: 22px; }
.transport .key { width: 104px; }
.rec { width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--ink); background: none; padding: 0; display: grid; place-items: center; }
.rec span { width: 54px; height: 54px; border-radius: 50%; background: var(--rec); transition: border-radius .12s, width .12s, height .12s; }
.rec[aria-pressed="true"] span { width: 34px; height: 34px; border-radius: 5px; }
.status { min-height: 2.9em; text-align: center; max-width: 34ch; text-wrap: balance; }

.layers { display: flex; flex-direction: column; gap: 8px; }
.layer { display: flex; align-items: center; gap: 10px; }
.layer .num { width: 44px; height: 44px; border-radius: 4px; background: var(--c); color: var(--ground); display: grid; place-items: center; font: 800 22px/1 var(--display); }
.layer .key { height: 44px; font-size: 18px; }

/* Scale and fretboard */
.pick select {
  height: 48px; padding: 0 34px 0 12px; border: 2px solid var(--ink); border-radius: 4px; background: none;
  font: 800 22px/1 var(--display); text-transform: uppercase; letter-spacing: .04em;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 19px) 21px, calc(100% - 13px) 21px; background-size: 6px 6px; background-repeat: no-repeat;
}
.fb { margin: 14px 0 10px; }
.fb svg { display: block; width: 100%; height: auto; }
.fb-wood { fill: var(--wood); } .fb-box { fill: var(--fb-box); } .fb-nut { fill: var(--bone); }
.fb-fret { stroke: var(--fretwire); stroke-width: 2; } .fb-string { stroke: var(--nylon); }
.fb-dot { fill: var(--nylon); } .fb-dot.far { opacity: .38; } .fb-dot.root { fill: var(--fb-root); }
.fb-open { fill: var(--ground); stroke: var(--soft); stroke-width: 2; } .fb-open.root { stroke: var(--ink); stroke-width: 3.5; }
.fb-num { fill: var(--soft); font: 600 15px var(--body); text-anchor: middle; }
.fb-live { fill: none; stroke: var(--fb-live); stroke-width: 4; }
.fb-live.open { stroke: var(--ink); }

/* Timing */
.sum { font-size: 18px; text-wrap: pretty; max-width: 40ch; }
#strip { display: block; width: 100%; max-width: 520px; height: auto; margin: 12px 0 8px; }
.st-band { fill: var(--rule); opacity: .55; } .st-axis { stroke: var(--ink); stroke-width: 2; } .st-line { stroke: var(--rule); stroke-width: 1; }
.st-dot { fill: var(--ink); } .st-text { fill: var(--soft); font: 600 12px var(--body); }

/* Sheets */
/* A sheet fades and rises in when its scrim gets .show, and leaves the same way. */
.scrim { position: fixed; inset: 0; z-index: 10; background: var(--scrim); display: grid; place-items: center; padding: 16px; overflow-y: auto; opacity: 0; transition: opacity .22s ease; }
.scrim.show { opacity: 1; }
.sheet {
  width: 100%; max-width: 380px; background: var(--ground); border: 2px solid var(--ink); border-radius: 6px; padding: 28px 24px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  transform: translateY(22px) scale(.97); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.scrim.show .sheet { transform: none; }

/* Install steps: three icons in a row, read left to right */
.app-icon { border-radius: 16px; }
.steps { list-style: none; margin: 4px 0; padding: 0; width: 100%; display: flex; align-items: flex-start; justify-content: center; }
.steps li { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; line-height: 1.25; }
.steps li + li { position: relative; }
.steps li + li::before { content: ""; position: absolute; left: -7px; top: 13px; width: 9px; height: 9px; border-top: 2px solid var(--soft); border-right: 2px solid var(--soft); transform: rotate(45deg); }
.steps svg { width: 36px; height: 36px; }
.steps img { border-radius: 8px; }
#install [data-for] { display: none; }
#install[data-kind="ios"] [data-for~="ios"], #install[data-kind="mac"] [data-for~="mac"], #install[data-kind="prompt"] [data-for~="prompt"] { display: revert; }
#install[data-kind="ios"] .steps, #install[data-kind="mac"] .steps { display: flex; }
.sheet.left { align-items: stretch; text-align: left; }
.sheet .lab { margin: 6px 0 0; }
.sheet h2 { font: 900 40px/1 var(--display); text-transform: uppercase; letter-spacing: .01em; }
.cans { width: 64px; height: 64px; }
.go { width: 100%; height: 54px; margin-top: 6px; border: 0; border-radius: 4px; background: var(--ink); color: var(--ground); font: 800 22px/1 var(--display); text-transform: uppercase; letter-spacing: .05em; }
.error { color: var(--rec); font-weight: 600; }
input[type=range] { width: 100%; accent-color: var(--ink); }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "top" "setup" "stage" "scale" "timing"; gap: 24px; }
  .keys { display: none; }
  .setup { gap: 14px 20px; }
}
@media (max-width: 420px) {
  .key { min-width: 44px; height: 44px; }
  .bpm { height: 44px; font-size: 44px; }
  .transport { gap: 14px; }
  .transport .key { width: 92px; }
}
@media (hover: none) { .keys { display: none; } }
/* On a phone, sheets come up from the bottom edge like a native one. */
@media (max-width: 560px) {
  .scrim { place-items: end center; padding: 0; }
  .sheet { max-width: none; max-height: 100%; overflow-y: auto; border-width: 2px 0 0; border-radius: 14px 14px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateY(100%); }
}
@media (prefers-reduced-motion: reduce) { .rec span, .scrim, .sheet { transition: none; } }
