:root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #dfecff;
  background: #0a142b;
  --bg: #0a142b;
  --surface: #14233c;
  --text: #dfecff;
  --muted: #aabfd9;
  --focus: #91c5ff;
  --strike: #f0d39d;
  --line: #72869f;
  --border: #354964;
  --note-selected-text: #0a142b;
  --note-playing-text: #172c45;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100svh;
  background: radial-gradient(ellipse at 30% 90%, #3711bf1c, transparent 65%), var(--bg);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
body.light {
  --bg: #f7f9fc;
  --surface: #fff;
  --text: #172c45;
  --muted: #536980;
  --focus: #285f9f;
  --strike: #e8c475;
  --line: #8c9db1;
  --border: #c3cedc;
  --note-selected-text: #fff;
  background: var(--bg);
  color: var(--text);
  color-scheme: light;
}
button,
input {
  font: inherit;
}
button {
  background: transparent;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 9px;
  min-height: 40px;
  padding: 8px 13px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover {
  border-color: var(--focus);
  background: color-mix(in srgb, var(--focus) 9%, transparent);
}
button:focus-visible,
input:focus-visible,
[role='button']:focus-visible {
  outline: 3px solid var(--strike);
  outline-offset: 3px;
}
button[aria-pressed='true'],
.primary {
  background: var(--focus);
  color: var(--bg);
  border-color: var(--focus);
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
#player {
  min-height: var(--app-height, 100dvh);
  height: var(--app-height, 100dvh);
  width: 100%;
  max-width: none;
  margin: auto;
  padding: 24px 30px 20px;
  display: grid;
  grid-template-rows: 64px minmax(180px, 1fr) 54px 28px 58px;
  gap: 12px;
}
header,
footer,
.chord-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
header img {
  object-fit: contain;
  flex-shrink: 0;
  margin-right: 22px;
}
.exercise {
  display: flex;
  align-items: center;
  gap: 12px;
}
.exercise strong {
  font-size: 28px;
}
.exercise button {
  font-size: 21px;
  border-color: transparent;
}
#tuning {
  font-size: 13px;
  color: var(--muted);
}
.spacer {
  flex: 1;
}
.neck-wrap {
  display: flex;
  align-items: center;
  min-height: 0;
}
#neck {
  width: 100%;
  height: 100%;
  max-height: none;
  touch-action: manipulation;
  overflow: visible;
}
#neck text {
  font-family: inherit;
  fill: var(--muted);
  font-size: 15px;
  text-anchor: middle;
  dominant-baseline: central;
}
.fret {
  stroke: var(--border);
  stroke-width: 2;
}
.string {
  stroke: var(--line);
}
.string-under {
  stroke: var(--bg);
  stroke-width: 1;
  stroke-dasharray: 2 2;
}
.nut {
  stroke: var(--text);
  stroke-width: 5;
}
.shape {
  fill: var(--focus);
  fill-opacity: 0.065;
  stroke: var(--focus);
  stroke-width: 2;
  stroke-linejoin: round;
}
.shape.neighbor {
  fill-opacity: 0.025;
  stroke-opacity: 0.3;
  cursor: pointer;
  stroke-dasharray: 6 4;
}
.shape.neighbor:hover {
  stroke-opacity: 0.8;
}
.note {
  cursor: pointer;
}
.note circle {
  fill: var(--surface);
  stroke: var(--muted);
  stroke-width: 1.3;
}
#neck .note text {
  font-size: 15px;
  font-weight: 600;
  fill: var(--text);
  pointer-events: none;
}
.note.root circle {
  stroke: var(--focus);
  stroke-width: 2.5;
}
.note.root .root-ring {
  fill: none;
  stroke-width: 1;
}
.note.chord circle {
  fill: var(--focus);
}
#neck .note.chord text {
  fill: var(--note-selected-text);
}
.note.playing circle {
  fill: var(--strike);
  stroke: var(--strike);
}
#neck .note.playing text {
  fill: var(--note-playing-text);
}
.barre {
  stroke: var(--strike);
  stroke-width: 11;
  stroke-linecap: round;
  opacity: 0.65;
  pointer-events: none;
}
.string.playing {
  stroke: var(--strike);
}
.chord-row {
  justify-content: center;
}
#chords {
  display: flex;
  gap: 7px;
}
#chords button {
  min-width: 54px;
}
#grip,
#relative {
  font-size: 12px;
  color: var(--muted);
}
#status {
  font-size: 13px;
  text-align: center;
  color: var(--muted);
  margin: 0;
  align-self: center;
}
.modes {
  display: flex;
  gap: 3px;
}
footer {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
#panel {
  position: fixed;
  z-index: 10;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 18px 60px #0005;
  max-width: calc(100vw - 20px);
}
#panel[hidden] {
  display: none;
}
#panel h2 {
  font-size: 15px;
  margin: 0 0 12px;
}
#panel p {
  font-size: 13px;
  line-height: 1.45;
  margin: 8px 0;
  color: var(--muted);
}
.panel-close {
  float: right;
  min-height: 30px;
  padding: 3px 9px;
  margin: -7px -7px 3px 8px;
}
.scale-grid {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 20px;
  width: 690px;
  max-width: 100%;
}
.roots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.scales {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}
.scales button {
  white-space: normal;
  font-size: 13px;
  padding: 7px;
  line-height: 1.15;
}
.tunings,
.choices,
.directions {
  display: flex;
  gap: 5px;
  margin-top: 10px;
}
.tunings button {
  font-size: 12px;
  padding: 6px;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
}
.settings-grid p {
  margin: 0 !important;
}
.settings-grid .choices {
  margin-top: 4px;
}
.settings-grid button {
  font-size: 12px;
  padding: 6px 10px;
}
.bpm {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bpm input {
  width: 75px;
  min-height: 40px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  text-align: center;
  border-radius: 8px;
}
#share-url {
  width: 100%;
  min-width: 260px;
  margin-top: 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px;
}
.patterns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 480px;
}
.credits {
  max-width: 580px;
}
.credits a {
  color: var(--focus);
}
@media (max-height: 500px) and (min-width: 650px) {
  #player {
    padding: 6px 16px 7px;
    grid-template-rows: 42px minmax(135px, 1fr) 39px 18px 47px;
    gap: 4px;
  }
  header {
    gap: 7px;
  }
  header img {
    width: 103px;
    height: 32px;
    margin-right: 10px;
  }
  .exercise {
    gap: 5px;
  }
  .exercise strong {
    font-size: 22px;
  }
  .exercise button {
    font-size: 17px;
    padding: 6px;
  }
  button {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 13px;
  }
  #tuning {
    display: none;
  }
  .chord-row {
    gap: 8px;
  }
  #chords {
    gap: 4px;
  }
  #chords button {
    min-width: 43px;
    padding: 6px 9px;
  }
  #relative,
  #grip {
    padding: 5px;
    font-size: 11px;
  }
  footer {
    gap: 6px;
    padding-top: 7px;
  }
  #status {
    font-size: 11px;
  }
  #panel {
    padding: 12px;
  }
  .scale-grid {
    width: 690px;
    grid-template-columns: 195px 1fr;
    gap: 14px;
  }
  .scales button {
    min-height: 36px;
  }
  .settings-grid {
    gap: 8px 14px;
  }
  #panel h2 {
    margin-bottom: 8px;
  }
  #panel p {
    font-size: 12px;
  }
  .choices {
    margin-top: 6px;
  }
}
@media (max-width: 649px) {
  #player {
    height: auto;
    min-height: 100svh;
    padding: 12px;
    grid-template-rows: auto 270px auto auto auto;
    gap: 12px;
  }
  header {
    flex-wrap: wrap;
    gap: 6px;
  }
  header img {
    width: 100px;
    margin-right: 0;
  }
  .exercise strong {
    font-size: 22px;
  }
  .exercise button {
    font-size: 16px;
  }
  #tuning {
    display: none;
  }
  header .spacer {
    display: none;
  }
  .chord-row,
  footer {
    flex-wrap: wrap;
  }
  #chords {
    flex-wrap: wrap;
    justify-content: center;
  }
  .scale-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    width: 94vw;
  }
  .roots {
    grid-template-columns: repeat(6, 1fr);
  }
  .tunings {
    margin-top: 5px;
  }
  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }
  #panel {
    position: absolute;
  }
  .scales button {
    min-height: 43px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Safari's visible toolbars can leave substantially less than 390 CSS pixels. */
@media (min-width: 650px) {
  #player {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(7px, env(safe-area-inset-bottom));
  }
  body.short-landscape #player {
    padding-top: 3px;
    grid-template-rows: 34px minmax(65px, 1fr) 32px 16px 38px;
    gap: 2px;
  }
  body.short-landscape button {
    min-height: 30px;
    padding: 4px 7px;
    font-size: 12px;
  }
  body.short-landscape header img {
    width: 85px;
    height: 27px;
    margin-right: 3px;
  }
  body.short-landscape .exercise button {
    font-size: 15px;
  }
  body.short-landscape .exercise strong {
    font-size: 20px;
  }
  body.short-landscape footer {
    padding-top: 3px;
    gap: 4px;
  }
  body.short-landscape #chords button {
    min-width: 37px;
    padding: 4px 6px;
  }
  body.short-landscape #status {
    font-size: 10px;
    line-height: 1.1;
  }
  body.short-landscape #grip,
  body.short-landscape #relative {
    font-size: 10px;
  }
  body.short-landscape #panel {
    padding: 8px;
  }
  body.short-landscape #panel h2 {
    margin-bottom: 5px;
    font-size: 13px;
  }
  body.short-landscape #panel p {
    font-size: 11px;
    line-height: 1.25;
    margin: 5px 0;
  }
  body.short-landscape .scales button {
    min-height: 32px;
    font-size: 11px;
  }
  body.short-landscape .scale-grid {
    width: 690px;
    grid-template-columns: 185px 1fr;
    gap: 10px;
  }
  body.short-landscape .settings-grid {
    gap: 5px 12px;
  }
  body.short-landscape .choices,
  body.short-landscape .tunings {
    margin-top: 4px;
  }
  body.short-landscape .bpm input {
    min-height: 30px;
  }
  #panel.tight {
    padding: 6px;
  }
  #panel.tight p {
    font-size: 10px;
    line-height: 1.15;
    margin: 3px 0;
  }
  #panel.tight h2 {
    font-size: 12px;
    margin-bottom: 3px;
  }
  #panel.tight button {
    min-height: 28px;
    padding: 3px 6px;
  }
}
/* Approved Quiet rail: floating transparent Glass, shared 15px values. */
#player {grid-template-rows:64px minmax(180px,1fr) 54px 20px 78px}
footer {display:grid;grid-template-columns:1fr 1.08fr 1fr 1.3fr 1fr 94px 32px;width:min(100%,720px);justify-self:center;gap:2px;padding:9px;border:1px solid #ffffff20;border-radius:50px;background:linear-gradient(135deg,#ffffff12,#14233c60 55%,#ffffff08);backdrop-filter:blur(20px);box-shadow:0 10px 30px #0003;align-self:center}
footer .key {display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:4px;height:52px;min-width:0;padding:5px 2px;border:0;border-radius:10px;line-height:1.1}
footer .group {font-size:10px;letter-spacing:.04em;color:var(--muted)}
footer .value {font-size:15px;font-weight:600;line-height:17px}
.cycle-dots {display:flex;gap:4px;height:4px}
.cycle-dots i {width:3px;height:3px;border-radius:50%;background:var(--muted);opacity:.28}
.cycle-dots .on {opacity:1;background:var(--text)}
footer .gear {width:36px;padding:7px;border:0}
.gear svg {width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.35}
.transport {position:relative;width:94px;height:52px;flex:none;background:#ffffff09;border:1px solid #ffffff28;box-shadow:inset 0 2px 8px #0003;border-radius:13px;padding:0;font-size:15px;font-weight:600;overflow:hidden}
.transport[aria-pressed='true'] {background:#ffffff14;border-color:#ffffff65;color:#fff}
.transport[aria-busy='true'] {color:var(--muted)}
.transport canvas {position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
#transport-label {position:relative;z-index:1;text-shadow:0 1px 5px #0a142b}
.light footer {background:#fff;border-color:var(--border);backdrop-filter:none;box-shadow:none}
.light .transport[aria-pressed='true'] {background:#285f9f;color:#fff;border-color:#285f9f}
.light #transport-label {text-shadow:none}
.light footer .key {transition:none}
#status:empty {visibility:hidden}
.shape {fill:transparent;fill-opacity:1;stroke:var(--shape-color);stroke-width:1.8;stroke-linejoin:round;cursor:pointer;pointer-events:all}
.shape.selected {fill:#91c5ff16;stroke:#fff;stroke-width:3}
.light .shape.selected {stroke:var(--focus)}
.shape.neighbor {fill:transparent;stroke-opacity:.3;stroke-dasharray:5 4}
.shape:focus-visible {outline:none;stroke:var(--strike);stroke-opacity:1;stroke-width:4}
.string,.string-under,.fret,.nut {pointer-events:none}
.settings-grid {align-items:center}
.settings-grid small {font-size:11px;color:var(--muted)}
#panel {background:color-mix(in srgb,var(--surface) 94%,transparent);backdrop-filter:blur(20px)}
@media (max-height:500px) and (min-width:650px) {
 #player {grid-template-rows:42px minmax(110px,1fr) 36px 18px 70px;gap:3px}
 footer {padding:6px 8px;gap:2px}
 footer .key {min-width:0;padding:5px 2px}
}
@media (min-width:650px) {
 body.short-landscape #player {grid-template-rows:32px minmax(65px,1fr) 30px 14px 64px;gap:1px}
 body.short-landscape footer {padding:4px 7px;gap:2px}
 body.short-landscape footer .key {height:48px;min-width:0;padding:3px 2px}
 body.short-landscape footer .value,body.short-landscape .transport {font-size:15px;line-height:17px}
 body.short-landscape .transport {height:48px;width:94px}
 body.short-landscape footer .group {font-size:9px}
 body.short-landscape .settings-grid {grid-template-columns:1fr 1fr}
 body.short-landscape .settings-grid .choices {margin-top:0}
 body.short-landscape .bpm input {width:65px}
}
@media (max-width:649px) {
 #player {grid-template-rows:auto 270px auto auto auto}
 footer {width:100%;grid-template-columns:repeat(3,minmax(0,1fr));justify-content:center;gap:4px;border-radius:28px}
 footer .key {min-width:0;padding:5px 2px}
 footer .transport {grid-column:2;justify-self:center}
 footer .gear {grid-column:3;justify-self:center}
}

/* Keep content inside the iPhone safe area; the background spans the whole window. */
#player {
  padding-left: calc(env(safe-area-inset-left, 0px) + 16px);
  padding-right: calc(env(safe-area-inset-right, 0px) + 16px);
  padding-top: max(24px, env(safe-area-inset-top, 0px));
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}
@media (max-height:500px) and (min-width:650px) {
  #player {
    padding-left: calc(env(safe-area-inset-left, 0px) + 8px);
    padding-right: calc(env(safe-area-inset-right, 0px) + 8px);
    padding-top: max(6px, env(safe-area-inset-top, 0px));
    padding-bottom: max(7px, env(safe-area-inset-bottom, 0px));
  }
  body.short-landscape #player {padding-top:max(3px,env(safe-area-inset-top,0px))}
}
@media (max-width:649px) {
  #player {
    padding-left: calc(env(safe-area-inset-left, 0px) + 12px);
    padding-right: calc(env(safe-area-inset-right, 0px) + 12px);
    padding-top: max(12px, env(safe-area-inset-top, 0px));
  }
}
