:root {
  --ink: #1b211e;
  --muted: #6d746e;
  --paper: #f2f0e8;
  --card: #fbfaf5;
  --line: #d9d8cd;
  --lime: #d6ff4f;
  --lime-deep: #b9e73c;
  --orange: #ff6d39;
  --pink: #ffb2c7;
  --aqua: #b9eee4;
  --dark: #1b211e;
  --shadow: 0 14px 0 rgba(27, 33, 30, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 0%, rgba(214, 255, 79, 0.42), transparent 24rem),
    linear-gradient(115deg, transparent 0 64%, rgba(255, 178, 199, 0.24) 64% 67%, transparent 67%),
    var(--paper);
  font-family: "Gowun Dodum", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 52px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font: 700 24px/1 "Space Grotesk", sans-serif;
  letter-spacing: -0.05em;
}

.brand em {
  color: var(--orange);
  font: 500 11px/1 "DM Mono", monospace;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 20px;
}

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(251, 250, 245, 0.8);
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a9ada9;
}

.connection-state.connected .status-dot {
  background: #4e9426;
  box-shadow: 0 0 0 4px rgba(78, 148, 38, 0.15);
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  padding-bottom: 46px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--orange);
  font: 500 11px/1.25 "DM Mono", monospace;
  letter-spacing: 0.09em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 16px;
  font: 700 clamp(42px, 7vw, 78px)/0.98 "Space Grotesk", sans-serif;
  letter-spacing: -0.07em;
}

h1 span {
  position: relative;
  z-index: 0;
}

h1 span::after {
  position: absolute;
  z-index: -1;
  right: -4px;
  bottom: 4px;
  left: -5px;
  height: 20%;
  content: "";
  background: var(--lime);
  transform: rotate(-1.5deg);
}

.hero-copy {
  max-width: 610px;
  margin-bottom: 0;
  color: #4d554f;
  font-size: 16px;
  line-height: 1.8;
}

.hero-note {
  display: flex;
  min-width: 205px;
  gap: 10px;
  padding: 16px;
  border: 2px solid var(--ink);
  background: var(--pink);
  box-shadow: 5px 5px 0 var(--ink);
  transform: rotate(2deg);
}

.hero-note p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.note-number {
  font: 500 12px "DM Mono", monospace;
}

.stage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.85fr);
  gap: 18px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(251, 250, 245, 0.9);
  box-shadow: 0 8px 20px rgba(40, 49, 42, 0.055);
}

.monitor-card,
.controls-card,
.arrangement-card {
  padding: 24px;
}

.arrangement-card {
  grid-column: 1 / -1;
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

h2 {
  margin-bottom: 0;
  font: 600 25px/1 "Space Grotesk", "Gowun Dodum", sans-serif;
  letter-spacing: -0.05em;
}

.pill {
  padding: 7px 9px;
  border-radius: 999px;
  background: #e7e8e1;
  color: var(--muted);
  font: 500 10px/1 "DM Mono", monospace;
}

.pill.live {
  background: var(--lime);
  color: var(--ink);
}

.scope-wrap {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  border: 1px solid #3d463e;
  border-radius: 11px;
  background:
    linear-gradient(rgba(214, 255, 79, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(214, 255, 79, 0.1) 1px, transparent 1px),
    #202824;
  background-size: 28px 28px;
}

#scope {
  display: block;
  width: 100%;
  height: 190px;
}

.scope-overlay {
  position: absolute;
  top: 14px;
  right: 15px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: rgba(245, 255, 232, 0.66);
  font: 500 10px "DM Mono", monospace;
}

.scope-overlay strong {
  color: var(--lime);
  font-size: 13px;
}

.detected-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.5fr 0.65fr;
  gap: 1px;
  overflow: hidden;
  margin-top: 16px;
  border-radius: 10px;
  background: var(--line);
}

.detected-value {
  min-height: 84px;
  padding: 14px;
  background: var(--card);
}

.detected-value span,
.detected-value small {
  display: block;
  color: var(--muted);
  font: 500 10px/1.25 "DM Mono", monospace;
  letter-spacing: 0.04em;
}

.detected-value strong {
  display: block;
  margin: 7px 0 4px;
  font: 600 28px/1 "Space Grotesk", sans-serif;
  letter-spacing: -0.06em;
}

.chord-readout strong {
  color: var(--orange);
}

.field-label {
  display: flex;
  justify-content: space-between;
  margin: 17px 0 7px;
  color: #454d46;
  font-size: 12px;
}

.controls-card .field-label:first-of-type {
  margin-top: 0;
}

.select-control,
.number-control {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid #c9cbc2;
  border-radius: 8px;
  outline: none;
  background: #fffef9;
  color: var(--ink);
  font-size: 13px;
}

.select-control:focus,
.number-control:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(214, 255, 79, 0.56);
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 0.85fr;
  gap: 10px;
}

.range-control {
  width: 100%;
  margin: 3px 0 0;
  accent-color: var(--orange);
}

.track-toggles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 18px;
}

.mixer-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.mixer-heading .field-label {
  margin: 0;
  color: var(--ink);
  font: 500 10px/1.25 "DM Mono", monospace;
  letter-spacing: 0.06em;
}

.mixer-heading small {
  color: var(--muted);
  font: 10px/1 "Gowun Dodum", sans-serif;
}

.track-mixer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.mixer-strip {
  display: grid;
  grid-template-columns: 13px 38px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 4px;
  min-height: 35px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8f7f0;
  color: var(--muted);
}

.mixer-strip > input[type="checkbox"] {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: var(--orange);
}

.mixer-strip span,
.mixer-strip output {
  font: 500 8px/1 "DM Mono", monospace;
  letter-spacing: 0.02em;
}

.mixer-strip output {
  color: var(--ink);
  text-align: right;
}

.mixer-strip > input[type="range"] {
  width: 100%;
  min-width: 0;
  margin: 0;
  accent-color: var(--orange);
}

.studio-output {
  margin-top: 12px;
  padding: 9px 10px 10px;
  border: 1px solid #cbd2c5;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(185, 238, 228, 0.36), rgba(255, 254, 249, 0.78));
}

.studio-output .mixer-heading {
  margin-top: 0;
}

.studio-output .field-label {
  margin-top: 9px;
}

.studio-output p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.fx-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font: 500 9px/1 "DM Mono", monospace;
}

.fx-toggle input {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: var(--orange);
}

.track-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f4f3ec;
  color: var(--muted);
  font: 500 9px "DM Mono", monospace;
}

.track-toggle input {
  width: 12px;
  height: 12px;
  accent-color: var(--orange);
}

.hint {
  max-width: 270px;
  color: var(--muted);
  text-align: right;
  font-size: 12px;
  line-height: 1.45;
}

.progression {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.chord-chip {
  position: relative;
  min-height: 106px;
  border: 1px solid #d0d2c8;
  border-radius: 12px;
  background: #fffef9;
  color: var(--ink);
  font: 600 clamp(25px, 3vw, 39px)/1 "Space Grotesk", sans-serif;
  letter-spacing: -0.07em;
  transition: transform 140ms ease, background 140ms ease, border 140ms ease;
}

.chord-chip::before {
  position: absolute;
  top: 10px;
  left: 10px;
  color: var(--muted);
  content: attr(data-bar);
  font: 500 9px "DM Mono", monospace;
  letter-spacing: 0.08em;
}

.chord-chip:hover:not(.empty),
.chord-chip.selected {
  border-color: var(--ink);
  background: var(--lime);
  transform: translateY(-2px);
}

.chord-chip.playing {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 109, 57, 0.24);
}

.chord-chip.empty {
  color: #b3b7ae;
  background: repeating-linear-gradient(135deg, #f8f7f0 0 8px, #f1f0e8 8px 16px);
}

.manual-correction {
  margin-top: 19px;
  padding-top: 3px;
}

.correction-row {
  display: flex;
  gap: 8px;
}

.small-select {
  max-width: 100px;
}

.quality-select {
  max-width: 150px;
}

.transport {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
  padding: 18px 20px;
  background: var(--dark);
  color: #f9faef;
}

.transport .eyebrow {
  margin-bottom: 5px;
  color: var(--lime);
}

.session-status {
  max-width: 540px;
  margin-bottom: 0;
  color: rgba(249, 250, 239, 0.75);
  font-size: 13px;
  line-height: 1.5;
}

.transport-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.primary-button,
.secondary-button,
.stop-button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.stop-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled,
.stop-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary-button {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--ink);
  font-weight: 700;
}

.button-icon {
  margin-right: 4px;
  font-size: 10px;
}

.secondary-button {
  border-color: #c7cabf;
  background: #f8f8ed;
  color: var(--ink);
}

.full-button {
  width: 100%;
}

.transport .secondary-button {
  border-color: rgba(255, 255, 255, 0.26);
  background: transparent;
  color: #f9faef;
}

.stop-button {
  border-color: #ff7a4d;
  background: transparent;
  color: #ff9d7e;
}

.midi-button {
  color: var(--lime) !important;
}

.how-it-works {
  margin-top: 45px;
}

.how-it-works ol {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #535a54;
  font-size: 13px;
  line-height: 1.65;
}

.how-it-works li {
  padding-top: 12px;
  border-top: 1px solid #afb3aa;
}

.how-it-works li span {
  display: block;
  margin-bottom: 8px;
  color: var(--orange);
  font: 500 12px "DM Mono", monospace;
}

@media (max-width: 820px) {
  .topbar {
    padding-bottom: 34px;
  }

  .hero {
    display: block;
  }

  .hero-note {
    width: fit-content;
    margin-top: 28px;
  }

  .stage-grid {
    grid-template-columns: 1fr;
  }

  .arrangement-card {
    grid-column: auto;
  }

  .transport {
    align-items: flex-start;
    flex-direction: column;
  }

  .transport-actions {
    justify-content: flex-start;
  }

  .how-it-works ol {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 14px;
  }

  .connection-state {
    max-width: 160px;
    font-size: 11px;
  }

  h1 {
    font-size: 43px;
  }

  .monitor-card,
  .controls-card,
  .arrangement-card {
    padding: 17px;
  }

  .detected-grid {
    grid-template-columns: 1fr 1.25fr;
  }

  .detected-grid > :last-child {
    display: none;
  }

  .progression {
    grid-template-columns: repeat(2, 1fr);
  }

  .chord-chip {
    min-height: 82px;
  }

  .correction-row {
    flex-wrap: wrap;
  }

  .small-select,
  .quality-select {
    flex: 1;
    max-width: none;
  }

  .how-it-works ol {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
