@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("./assets/roboto.woff2") format("woff2");
}

@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("./assets/roboto-music.woff2") format("woff2");
  unicode-range: U+0394, U+266D-266F;
}

:root {
  color-scheme: dark;
  --bg: #191919;
  --panel: #232323;
  --panel-dark: #1b1b1b;
  --border: #393939;
  --text: #f7f1eb;
  --muted: #c0bdb9;
  --subtle: #aaa7a4;
  --amber: #f5bc79;
  --amber-bright: #ffd096;
  --danger: #ffaaa9;
  --font: "Roboto", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 280px; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea, code { font: inherit; }
button { color: inherit; }
button:not(:disabled), select, input[type="range"] { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--amber-bright);
  outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  inline-size: 1.1rem;
  block-size: 1.1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.amber { color: var(--amber); }
.shell { width: min(74rem, calc(100% - 5rem)); margin-inline: auto; }

.site-header { background: #1d1d1d; border-bottom: 1px solid #343434; }
.header-inner { min-height: 65px; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.brand { font-size: 1.24rem; font-weight: 740; letter-spacing: -.035em; }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .5rem;
  min-height: 2.75rem;
  padding: .45rem .85rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: .875rem;
  font-weight: 650;
  line-height: 1.2;
  transition: background-color 150ms, border-color 150ms, color 150ms, box-shadow 150ms;
}
.guide-button { min-height: 2.5rem; padding-inline: .7rem; color: var(--muted); }
.guide-button:hover { color: var(--text); background: #2d2d2d; }
.guide-button .icon { width: 1rem; height: 1rem; }

.hero { padding: clamp(1.8rem, 4.2vw, 3.7rem) 0 clamp(1.7rem, 3.3vw, 3rem); }
.hero h1 {
  font: 680 clamp(2.6rem, 5.7vw, 5.2rem)/1.04 var(--font);
  letter-spacing: -.052em;
}
.hero-accent { display: inline-block; color: var(--amber); }
.hero p { margin-top: .83rem; color: var(--muted); font-size: clamp(1rem, 1.45vw, 1.13rem); }

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.73fr) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}
.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: 0 10px 34px #00000026;
}
.progression-panel, .next-panel { padding: 1.4rem; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.panel h2, .dialog-heading h2 {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.23rem;
  font-weight: 730;
  letter-spacing: -.035em;
  line-height: 1.25;
}
.panel h2 .icon { width: 1.23rem; height: 1.23rem; }
.text-button { color: var(--amber); min-height: 2.25rem; padding-inline: .48rem; margin-right: -.48rem; }
.text-button:not(:disabled):hover { background: #f5bc7916; color: var(--amber-bright); }

.chord-editor { margin-top: .78rem; }
.chord-editor label { display: block; margin-bottom: .42rem; color: #dfdcd8; font-size: .875rem; font-weight: 650; }
.chord-editor textarea {
  display: block;
  width: 100%;
  height: 3.15rem;
  min-height: 3.15rem;
  max-height: 9rem;
  padding: .67rem .81rem;
  resize: vertical;
  border: 1px solid #4c4c4c;
  border-radius: 8px;
  background: var(--panel-dark);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
}
.chord-editor textarea::placeholder { color: #969390; }
.chord-editor textarea[aria-invalid="true"] { border-color: #df8387; }
.field-help { color: var(--subtle); font-size: .8125rem; line-height: 1.45; }
.chord-editor .field-help, .input-error { margin-top: .42rem; }
.input-error { color: var(--danger); font-size: .875rem; overflow-wrap: anywhere; }

.key-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .85rem;
  min-height: 3.35rem;
  margin-top: .94rem;
  padding: .38rem .55rem .38rem .38rem;
  border: 1px solid #3b3b3b;
  border-radius: 10px;
  background: #1d1d1d;
}
.key-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; }
.key-controls button {
  min-height: 2.2rem;
  padding: .3rem .72rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
}
.key-controls button:hover { color: var(--text); }
.key-controls button[aria-pressed="true"] { background: #353535; border-color: #494949; color: var(--text); }
.key-readout { display: flex; align-items: center; gap: .52rem; padding-inline: .34rem .22rem; }
.key-icon { display: grid; place-items: center; width: 1.95rem; height: 1.95rem; flex: 0 0 auto; color: var(--amber); border-radius: 7px; background: #c386481c; }
.key-icon .icon { width: .98rem; height: .98rem; }
.key-copy { display: grid; gap: .04rem; line-height: 1.2; }
.key-copy strong { font-size: .87rem; font-weight: 690; }
.key-copy > span { color: var(--subtle); font-size: .75rem; }
.key-select-wrap { position: relative; min-width: min(9.6rem, 100%); }
.key-select-wrap select {
  appearance: none;
  width: 100%;
  min-height: 2.2rem;
  padding: .25rem 2rem .25rem .6rem;
  border: 1px solid #4c4c4c;
  border-radius: 7px;
  color: var(--text);
  background: #2b2b2b;
  font-size: .875rem;
}
.key-select-wrap .icon { position: absolute; top: 50%; right: .55rem; transform: translateY(-50%); width: .97rem; color: var(--muted); }

.sequence-heading { display: flex; align-items: baseline; justify-content: space-between; margin: .95rem 0 .48rem; gap: .5rem; }
.sequence-heading h3 { font-size: .875rem; font-weight: 700; letter-spacing: -.01em; }
.sequence-heading > span { color: var(--subtle); font-size: .8125rem; }
.chord-rail {
  display: flex;
  gap: .55rem;
  min-height: 4.9rem;
  overflow-x: auto;
  padding: 3px 3px 7px;
  margin: -3px -3px -7px;
  align-items: stretch;
  scrollbar-color: #5b5b5b transparent;
  scrollbar-width: thin;
}
.chord-card {
  position: relative;
  flex: 1 0 5.4rem;
  min-width: max-content;
  max-width: 8.25rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border: 1px solid #474747;
  border-radius: 9px;
  background: linear-gradient(155deg,#2e2e2e,#282828);
}
.chord-card:not(.chord-invalid):has(button:hover), .chord-suggested:hover { border-color: #7c6b64; background: #343130; }
.chord-card-tools { display: flex; align-items: center; justify-content: space-between; gap: .15rem; padding: .17rem .23rem 0; }
.chord-control {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}
.chord-control .icon { width: 1rem; height: 1rem; }
.chord-control:not(:disabled):hover { background: #ffffff14; color: var(--text); }
.chord-control:disabled { opacity: .4; }
.chord-move:not(:disabled) { cursor: grab; touch-action: none; }
.chord-remove:not(:disabled):hover { color: var(--danger); background: #6d4044; }
.chord-control:focus-visible, .chord-audition:focus-visible { outline-offset: -2px; }
.chord-audition, .chord-card.chord-suggested {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: .2rem;
  padding: .4rem .65rem .58rem;
  text-align: left;
}
.chord-audition { flex: 1 0 auto; min-height: 3.4rem; border: 0; border-radius: inherit; background: transparent; }
.chord-card .chord-symbol { line-height: 1.15; font-size: clamp(1.16rem, 2.05vw, 1.53rem); font-weight: 720; letter-spacing: -.05em; white-space: nowrap; }
.chord-card .chord-detail { line-height: 1.25; font-size: .75rem; color: var(--muted); white-space: nowrap; }
.chord-card.chord-suggested {
  justify-content: flex-end;
  background: #c78a5115;
  border-style: dashed;
  border-color: #bd8b59;
  color: var(--amber-bright);
}
.chord-suggested .chord-detail { color: #e0ad79; }
.chord-suggested .icon { position: absolute; right: .42rem; top: .38rem; width: .82rem; height: .82rem; }
.chord-card.chord-invalid { background: #552b35; border-color: #ab606b; max-width: 100%; min-width: 5.4rem; }
.chord-invalid .chord-control { color: #f0a7ae; }
.chord-invalid .chord-symbol { color: var(--danger); max-width: 10rem; overflow: hidden; text-overflow: ellipsis; }
.chord-invalid .chord-detail { color: #f0a7ae; }
.chord-card.is-playing {
  color: #1d160f;
  background: var(--amber-bright) !important;
  border-color: var(--amber-bright) !important;
  border-style: solid;
  box-shadow: 0 0 16px #ffc58144;
}
.chord-card.is-playing .chord-detail { color: #4a3020; }
.chord-card.is-playing .chord-control { color: #4a3020; }
.chord-rail.is-dragging, .chord-rail.is-dragging .chord-move:not(:disabled) { cursor: grabbing; user-select: none; }
.chord-card.drag-origin { border: 1px dashed var(--amber); background: #3a332d; }
.chord-card[data-drop-edge]::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset-block: 3px;
  width: 3px;
  border-radius: 2px;
  background: var(--amber-bright);
  pointer-events: none;
}
.chord-card[data-drop-edge="before"]::after { left: -.38rem; }
.chord-card[data-drop-edge="after"]::after { right: -.38rem; }
.chord-drag-preview {
  position: fixed;
  z-index: 5;
  top: 0;
  left: 0;
  max-width: min(13rem, calc(100vw - 1rem));
  padding: .32rem .62rem;
  overflow: hidden;
  border-radius: 7px;
  background: var(--amber-bright);
  color: #211811;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 7px 20px #0008;
  pointer-events: none;
}
.sequence-help { margin-top: .45rem; }
.empty-rail { display: flex; align-items: center; min-height: 4.9rem; padding: .6rem; color: var(--muted); font-size: .875rem; }

.transport { display: flex; flex-wrap: wrap; gap: .52rem; min-height: 3.37rem; margin-top: .98rem; padding-top: .66rem; border-top: 1px solid #3b3b3b; }
.play-button { background: #f6d2a7; border-color: #f6d2a7; color: #271b14; }
.play-button:not(:disabled):hover { background: #ffe1be; border-color: #ffe1be; }
.play-button:disabled { opacity: .58; }
.outline-button { background: #2b2b2b; border-color: #454545; color: #dfdcd8; }
.outline-button:not(:disabled):hover { border-color: #6c6c6c; background: #353535; color: var(--text); }
.outline-button:disabled { color: #a4a19e; border-color: #3b3b3b; background: #232323; }

.next-heading { min-height: 2.25rem; }
.suggestion {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 9.7rem;
  margin-top: .9rem;
  background: #262626;
  border: 1px solid #534943;
  border-radius: 12px;
}
.suggestion:has(.suggestion-button:not(:disabled):hover) { border-color: #8f6b56; }
.suggestion:has(.is-playing) { border-color: var(--amber-bright); box-shadow: 0 0 18px #ffc5812b; }
.suggestion-button {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: .6rem;
  border: 0;
  padding: .55rem 3.1rem .72rem;
  border-radius: inherit;
  background: transparent;
  color: var(--amber);
}
.suggestion-symbol {
  max-width: 100%;
  font: 570 clamp(2.2rem, var(--symbol-size, 6.8vw), 5.55rem)/1 var(--font);
  letter-spacing: -.05em;
  overflow-wrap: anywhere;
}
.suggestion-button:disabled .suggestion-symbol { color: #a38c80; }
.suggestion-tag {
  padding: .19rem .54rem;
  border: 1px solid #ac794a65;
  border-radius: 999px;
  color: #ffd39e;
  background: #a36d4626;
  font: 650 .75rem/1.35 var(--font);
  white-space: nowrap;
}
.icon-button { min-width: 2.45rem; min-height: 2.45rem; padding: .45rem; border-color: #555555; color: var(--muted); background: #303030; }
.icon-button:not(:disabled):hover, .icon-button.is-playing { border-color: #be8d61; color: var(--amber-bright); background: #553b32; }
.icon-button:disabled { opacity: .42; }
.solo-button { position: absolute; right: .58rem; top: .58rem; }
.suggestion-description { min-height: 2.85rem; margin: .9rem 0 .82rem; color: #d6d2ce; font-size: .925rem; line-height: 1.5; }
.suggestion-actions { display: grid; gap: .52rem; }
.add-button { color: #23170f; border-color: var(--amber); background: var(--amber); }
.add-button:not(:disabled):hover { background: var(--amber-bright); border-color: var(--amber-bright); }
.add-button:disabled { opacity: .55; }
.alternatives-button .disclosure { width: .88rem; height: .88rem; }
.alternatives-button[aria-expanded="true"] .disclosure { transform: rotate(180deg); }
.alternatives { margin-top: .95rem; border-top: 1px solid var(--border); padding-top: .73rem; }
.alternatives .field-help { margin-bottom: .6rem; }
.alternative-list {
  list-style: none;
  display: grid;
  gap: .35rem;
  padding: 3px 5px 3px 3px;
  margin: -3px -5px -3px -3px;
  max-height: 21rem;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #5c5c5c transparent;
  overscroll-behavior: contain;
}
.alternative-option { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .4rem; padding: .28rem; background: var(--panel-dark); border: 1px solid #3e3e3e; border-radius: 9px; }
.alternative-option.is-selected { border-color: #bc8b60; background: #3d302c; }
.alternative-option.slider-pick { border-color: #795f52; }
.alternative-main { display: grid; grid-template-columns: minmax(3rem, auto) 1fr; align-items: center; text-align: left; gap: .6rem; width: 100%; align-self: stretch; border: 0; border-radius: 5px; background: transparent; padding: .32rem; }
.alternative-main:hover { background: #ffffff0b; }
.alternative-symbol { color: var(--text); font-size: 1rem; font-weight: 730; letter-spacing: -.025em; white-space: nowrap; }
.is-selected .alternative-symbol { color: var(--amber-bright); }
.alternative-copy { color: var(--muted); font-size: .8125rem; line-height: 1.3; }
.option-marker { display: block; width: fit-content; margin-top: .18rem; color: #efbe92; font-size: .75rem; font-weight: 650; }
.alternative-option .icon-button { border-color: transparent; background: transparent; }

.tension-panel { margin: 1.12rem 0 2.3rem; padding: 1.07rem 1.4rem .99rem; }
.tension-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.tension-header p { margin-top: .3rem; color: var(--muted); font-size: .875rem; }
.tension-style {
  flex: 0 0 auto;
  max-width: 45%;
  margin-top: .05rem;
  padding: .3rem .63rem;
  border-radius: 7px;
  border: 1px solid #694d3d;
  background: #bd7e4220;
  color: #ffd29f;
  font-size: .79rem;
  font-weight: 690;
  line-height: 1.25;
}
.tension-slider {
  appearance: none;
  display: block;
  width: 100%;
  height: 1.65rem;
  margin: .43rem 0 .12rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  accent-color: var(--amber);
}
.tension-slider::-webkit-slider-runnable-track { height: 6px; border-radius: 9px; background: linear-gradient(90deg,#e6b579 0%,#c98976 52%,#a16383 100%); }
.tension-slider::-moz-range-track { height: 6px; border-radius: 9px; background: linear-gradient(90deg,#e6b579 0%,#c98976 52%,#a16383 100%); }
.tension-slider::-webkit-slider-thumb {
  appearance: none;
  width: 1.12rem;
  height: 1.12rem;
  margin-top: calc(3px - .56rem);
  border: 2px solid #2a2126;
  border-radius: 50%;
  background: #ffdfbb;
  box-shadow: 0 0 0 1px #f4bf8e, 0 2px 5px #0009;
}
.tension-slider::-moz-range-thumb {
  width: .95rem;
  height: .95rem;
  border: 2px solid #2a2126;
  border-radius: 50%;
  background: #ffdfbb;
  box-shadow: 0 0 0 1px #f4bf8e, 0 2px 5px #0009;
}
.tension-labels { display: flex; justify-content: space-between; gap: .6rem; font-size: .875rem; font-weight: 640; }
.tension-labels span:first-child { color: #edc499; }
.tension-labels span:last-child { color: #e0a5bd; text-align: right; }

.guide-dialog {
  width: min(34rem, calc(100% - 1.5rem));
  max-height: calc(100% - 2rem);
  padding: 1.35rem;
  border: 1px solid #4a4a4a;
  border-radius: 15px;
  background: #252525;
  color: var(--text);
  box-shadow: 0 20px 90px #0009;
}
.guide-dialog::backdrop { background: #101010bf; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.guide-dialog p { margin-top: .85rem; color: var(--muted); font-size: .94rem; }
.guide-dialog strong { color: var(--text); }
.guide-list { display: grid; gap: .45rem; margin: .9rem 0; }
.guide-list div { display: grid; grid-template-columns: minmax(0, 44%) minmax(0, 1fr); align-items: baseline; gap: .4rem; }
.guide-list dt { font-size: .875rem; font-weight: 680; }
.guide-list dd { margin: 0; color: var(--muted); font-size: .875rem; }
.guide-dialog code { display: inline-block; padding: .08em .28em; border-radius: 4px; background: var(--panel-dark); color: #ffd2a0; font-size: .9em; }

@media (min-width: 801px) {
  .next-panel { display: flex; flex-direction: column; min-height: 100%; }
  .suggestion-actions { margin-top: auto; }
}

@media (max-width: 1000px) {
  .shell { width: calc(100% - 3rem); }
  .progression-panel, .next-panel { padding: 1.16rem; }
  .tension-panel { padding-inline: 1.16rem; }
  .chord-card { flex-basis: 4.7rem; }
  .chord-audition, .chord-card.chord-suggested { padding-inline: .48rem; }
}

@media (max-width: 800px) {
  .workbench { grid-template-columns: 1fr; gap: .85rem; }
  .next-panel { display: block; }
  .tension-panel { margin-top: .85rem; }
  .suggestion { min-height: 8.5rem; }
  .suggestion-symbol { font-size: clamp(2.5rem, var(--symbol-size-mobile, 13vw), 4.9rem); }
  .suggestion-description { min-height: 0; }
  .suggestion-actions { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .shell { width: calc(100% - 1.65rem); }
  .header-inner { min-height: 57px; }
  .brand { font-size: 1.15rem; }
  .guide-button { padding-inline: .37rem; gap: .33rem; }
  .hero { padding: 1.7rem 0 1.55rem; }
  .hero h1 { font-size: clamp(2.25rem, 10.5vw, 3.3rem); }
  .hero p { margin-top: .63rem; }
  .progression-panel, .next-panel { padding: .93rem; }
  .tension-panel { padding-inline: .93rem; }
  .key-strip { gap: .35rem; flex-wrap: wrap; }
  .key-controls button { padding-inline: .5rem; }
  .key-readout { gap: .37rem; padding-inline: .15rem; }
  .key-icon { display: none; }
  .key-select-wrap { min-width: 6.8rem; }
  .chord-rail { gap: .37rem; }
  .chord-card { flex-basis: 3.65rem; max-width: 5.7rem; }
  .chord-card-tools { gap: 0; padding-inline: .08rem; }
  .chord-audition, .chord-card.chord-suggested { padding-inline: .38rem; }
  .chord-card.chord-suggested { min-width: min-content; }
  .chord-card .chord-symbol { font-size: 1.2rem; }
  .chord-suggested .icon { top: .33rem; right: .25rem; width: .67rem; height: .67rem; }
  .suggestion-actions .button { padding-inline: .4rem; gap: .32rem; }
  .alternatives-button .disclosure { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .tension-slider { appearance: auto; }
  .chord-card.is-playing, .alternative-option.is-selected { outline: 2px solid Highlight; }
}
