:root {
  color-scheme: dark;
  --app-bg: #05070d;
  --panel-bg: rgba(10, 15, 28, 0.86);
  --soft-line: rgba(0, 245, 255, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 0, 180, 0.18), transparent 34rem),
    radial-gradient(circle at 80% 10%, rgba(0, 245, 255, 0.14), transparent 28rem),
    linear-gradient(135deg, #02030a 0%, var(--app-bg) 45%, #090414 100%);
  color: #edfaff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  display: grid;
  gap: 1rem;
}

.cyber-card,
.cyber-terminal {
  background: var(--panel-bg);
  border-color: var(--soft-line);
}

/* subtle crt feel on the title card only: fine low-contrast lines, no animation.
   ::after is the neon-border's dark fill, so the lines are layered on top of that fill. */
.hero.cyber-neon-border::after {
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(0, 0, 0, 0.22) 3px 4px),
    var(--color-bg-secondary, #0d1117);
}

.hero h1 {
  margin: 0.2rem 0 0.6rem;
  font-size: clamp(2.2rem, 8vw, 5.8rem);
  line-height: 0.92;
  letter-spacing: -0.08em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ff31d6, #b871ff 45%, #00f5ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow,
.hero-copy,
.flavor-note,
.summary {
  margin: 0;
  color: #adc3cc;
}

.hero-copy {
  max-width: 64ch;
  font-size: 1.04rem;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.cyber-field {
  display: grid;
  gap: 0.45rem;
}

.cyber-field span {
  color: #8df8ff;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select.cyber-input {
  width: 100%;
  background-color: rgba(2, 5, 12, 0.92);
}

.note-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.note-list-label {
  color: #8df8ff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.note-chip {
  min-width: 3.2rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(0, 245, 255, 0.28);
  border-radius: 0.35rem;
  background: linear-gradient(180deg, rgba(0, 245, 255, 0.14), rgba(255, 0, 180, 0.08));
  box-shadow: 0 0 22px rgba(0, 245, 255, 0.12);
  color: #f5fdff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.1rem;
  font-weight: 800;
  text-align: center;
}

.note-chip.is-root {
  border-color: rgba(255, 221, 87, 0.9);
  box-shadow: 0 0 28px rgba(255, 221, 87, 0.32);
  color: #ffe76b;
}

.flavor-note {
  padding-top: 0.3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 1rem, 1100px);
    padding-top: 0.5rem;
  }

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

  .hero h1 {
    letter-spacing: -0.05em;
    font-size: clamp(1.9rem, 10vw, 3rem);
  }
}

/* grid children may shrink below their content width (otherwise wide content stretches the page) */
.app-shell > *,
.output-sections > *,
.chord-card-grid > * {
  min-width: 0;
}



.keyboard-host {
  width: 100%;
  margin: 0.4rem 0 1rem;
  overflow-x: auto;
  padding: 0.75rem 0 0.55rem;
}

.keyboard {
  position: relative;
  width: 100%;
  height: 9rem;
  margin-inline: 0.2rem;
  border: 1px solid rgba(0, 245, 255, 0.18);
  border-radius: 0.55rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.28);
}

.piano-key {
  position: absolute;
  top: 0.6rem;
  display: flex;
  align-items: end;
  justify-content: center;
  padding: 0.45rem 0.2rem;
  border-radius: 0 0 0.35rem 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.piano-key.is-white {
  z-index: 1;
  width: var(--white-key-width);
  height: 7.8rem;
  background: linear-gradient(180deg, #f8fbff, #aebbc6);
  color: #071018;
}

.piano-key.is-black {
  z-index: 3;
  width: var(--black-key-width);
  height: 5.1rem;
  background: linear-gradient(180deg, #151923, #020307);
  color: #dffcff;
  border-color: rgba(0, 245, 255, 0.24);
}

.piano-key.is-active {
  transform: translateY(-0.12rem);
}

.piano-key.is-role-scale {
  border-color: rgba(0, 245, 255, 0.95);
  box-shadow: 0 0 22px rgba(0, 245, 255, 0.36), inset 0 0 18px rgba(0, 245, 255, 0.18);
}

.piano-key.is-role-root {
  border-color: rgba(255, 221, 87, 0.95);
  box-shadow: 0 0 26px rgba(255, 221, 87, 0.46), inset 0 0 18px rgba(255, 221, 87, 0.2);
}

.piano-key.is-role-root span::after {
  content: " root";
  color: #ffe76b;
}

.piano-key.is-role-safe {
  border-color: rgba(61, 255, 139, 0.95);
  box-shadow: 0 0 22px rgba(61, 255, 139, 0.34), inset 0 0 18px rgba(61, 255, 139, 0.16);
}

.piano-key.is-role-bass {
  border-color: rgba(0, 151, 255, 0.95);
  box-shadow: 0 0 22px rgba(0, 151, 255, 0.34), inset 0 0 18px rgba(0, 151, 255, 0.16);
}

.piano-key.is-role-tension {
  border-color: rgba(255, 49, 214, 0.96);
  box-shadow: 0 0 24px rgba(255, 49, 214, 0.4), inset 0 0 18px rgba(255, 49, 214, 0.18);
}

.piano-key.is-role-chord {
  border-color: rgba(184, 113, 255, 0.95);
  box-shadow: 0 0 22px rgba(184, 113, 255, 0.34), inset 0 0 18px rgba(184, 113, 255, 0.16);
}

.piano-key.is-role-lead {
  border-color: rgba(255, 119, 64, 0.95);
  box-shadow: 0 0 22px rgba(255, 119, 64, 0.34), inset 0 0 18px rgba(255, 119, 64, 0.16);
}

.keyboard-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: -0.2rem 0 1rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.38rem 0.58rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(2, 5, 12, 0.62);
  color: #c9d7df;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.legend-item i {
  width: 0.78rem;
  height: 0.78rem;
  border-radius: 999px;
  box-shadow: 0 0 18px currentColor;
}

.legend-root {
  color: #ffe76b;
}

.legend-scale {
  color: #8df8ff;
}

.legend-safe {
  color: #3dff8b;
}

.legend-bass {
  color: #35a8ff;
}

.legend-tension {
  color: #ff31d6;
}

.legend-chord {
  color: #b871ff;
}

.legend-lead {
  color: #ff7740;
}

.legend-root i,
.legend-scale i,
.legend-safe i,
.legend-bass i,
.legend-tension i,
.legend-chord i,
.legend-lead i {
  background: currentColor;
}

.output-sections {
  display: grid;
  gap: 1rem;
}

.chord-intro {
  margin-bottom: 1rem;
}

.chord-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.chord-card {
  padding: 1rem;
  border: 1px solid rgba(184, 113, 255, 0.28);
  border-radius: 0.7rem;
  background:
    linear-gradient(180deg, rgba(184, 113, 255, 0.12), rgba(0, 245, 255, 0.04)),
    rgba(2, 5, 12, 0.72);
  box-shadow: 0 0 30px rgba(184, 113, 255, 0.08);
}

.chord-card.is-spicy {
  border-color: rgba(255, 49, 214, 0.46);
  box-shadow: 0 0 34px rgba(255, 49, 214, 0.12);
}

.chord-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.65rem;
}

.chord-name {
  color: #f7edff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.chord-status {
  padding: 0.28rem 0.48rem;
  border: 1px solid rgba(61, 255, 139, 0.32);
  border-radius: 999px;
  color: #3dff8b;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: right;
  text-transform: uppercase;
}

.chord-status.is-spicy {
  border-color: rgba(255, 49, 214, 0.42);
  color: #ff31d6;
}

.chord-use {
  min-height: 3.2rem;
  margin: 0 0 0.85rem;
  color: #bdccd5;
  font-size: 0.9rem;
  line-height: 1.45;
}

.chord-note-list {
  margin-bottom: 0.4rem;
}

.chord-keyboard-host {
  margin-bottom: 0;
}

.pad-voicing {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(0, 245, 255, 0.22);
}

.pad-voicing-title {
  margin: 0 0 0.3rem;
  color: #00f5ff;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pad-voicing-hands {
  margin: 0 0 0.5rem;
  color: #bdccd5;
  font-size: 0.85rem;
  white-space: pre-wrap;
}

/* perf: cybercore animates a 15px-blurred gradient behind every neon card forever.
   keep the glow, drop the animation so it is painted once instead of every frame. */
.cyber-neon-border::before {
  animation: none;
}

/* phones: keep last so it overrides the component rules above */
@media (max-width: 560px) {
  .cyber-card {
    --card-padding: 0.85rem;
    --card-cut: 12px;
  }

  .cyber-card__header {
    flex-wrap: wrap;
    row-gap: 0.4rem;
  }

  .note-list {
    gap: 0.4rem;
  }

  .note-chip {
    min-width: 2.4rem;
    padding: 0.45rem 0.5rem;
    font-size: 0.95rem;
  }

  .keyboard {
    height: 7.4rem;
    margin-inline: 0;
  }

  .piano-key {
    padding: 0.3rem 0;
    font-size: 0.6rem;
  }

  .piano-key.is-white {
    height: 6.6rem;
  }

  .piano-key.is-black {
    height: 4.2rem;
  }

  .piano-key.is-role-root span::after {
    content: none;
  }

  /* black keys are ~14px wide on phones: labels would overlap, colour still shows the role */
  .piano-key.is-black span {
    display: none;
  }

  .legend-item {
    padding: 0.3rem 0.5rem;
    font-size: 0.68rem;
  }

  .chord-card {
    padding: 0.8rem;
  }

  .chord-card-grid {
    grid-template-columns: 1fr;
  }

  .chord-card-header {
    flex-wrap: wrap;
  }

  .chord-status {
    text-align: left;
  }

  .chord-use {
    min-height: 0;
  }
}
