:root {
  --ink: #161514;
  --paper: #fbf7f0;
  --cream: #f1e6d2;
  --gold: #d4a84f;
  --gold-bright: #e5bd67;
  --moss: #476357;
  --clay: #b66543;
  --text: #fffaf0;
  --muted: rgba(255, 250, 240, 0.7);
  --line: rgba(255, 255, 255, 0.14);
  --panel: rgba(255, 250, 240, 0.09);
  --panel-strong: rgba(22, 21, 20, 0.62);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  background:
    linear-gradient(112deg, rgba(22, 21, 20, 0.95) 0%, rgba(22, 21, 20, 0.82) 48%, rgba(22, 21, 20, 0.62) 100%),
    url("../../assets/lab/midi-chord-trainer-bg.jpg") center 54% / cover fixed no-repeat;
  color: var(--text);
  margin: 0;
  min-height: 100vh;
}

body::before {
  background:
    radial-gradient(circle at 78% 16%, rgba(212, 168, 79, 0.2), transparent 34%),
    linear-gradient(180deg, transparent 62%, rgba(22, 21, 20, 0.35));
  content: "";
  inset: 0;
  pointer-events: none;
  position: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
select {
  font: inherit;
}

.jml-app-header {
  align-items: center;
  background: rgba(22, 21, 20, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  justify-content: space-between;
  min-height: 76px;
  padding: 16px clamp(18px, 4vw, 56px);
  position: relative;
  z-index: 2;
}

.jml-brand {
  align-items: center;
  display: flex;
  gap: 12px;
  font-weight: 900;
}

.jml-brand-mark {
  align-items: center;
  background: var(--gold);
  border-radius: 50%;
  color: var(--ink);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.82rem;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.jml-lab-link {
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.9rem;
  font-weight: 900;
  padding: 10px 16px;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.jml-lab-link:hover,
.jml-lab-link:focus-visible {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
  outline: 0;
}

.app-shell {
  margin: 0 auto;
  max-width: 1240px;
  padding: clamp(28px, 4.5vw, 56px) clamp(18px, 4vw, 56px) 64px;
  position: relative;
  z-index: 1;
}

.hero {
  align-items: end;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 24px;
}

.hero-copy {
  display: grid;
  gap: 10px;
  max-width: 940px;
}

.eyebrow {
  color: #9ab8aa;
  font-size: 0.78rem;
  font-weight: 1000;
  letter-spacing: 0.16em;
  margin: 0;
  text-transform: uppercase;
}

h1 {
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.15rem, 6.2vw, 6rem);
  letter-spacing: 0;
  line-height: 0.9;
  margin: 0;
  max-width: 920px;
}

.hero-copy > p:last-child {
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.65;
  margin: 2px 0 0;
  max-width: 760px;
}

.status-pill {
  background: rgba(255, 250, 240, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: rgba(255, 250, 240, 0.78);
  font-size: 0.82rem;
  font-weight: 900;
  min-width: 172px;
  padding: 10px 15px;
  text-align: center;
  white-space: nowrap;
}

.status-pill.ready {
  background: var(--moss);
  border-color: #789286;
  color: white;
}

.status-pill.error {
  background: rgba(182, 101, 67, 0.82);
  border-color: rgba(255, 250, 240, 0.28);
  color: white;
}

.trainer-panel,
.target-panel,
.controls,
.details,
.attempt-log {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trainer-panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.3);
  padding: clamp(16px, 2.4vw, 26px);
}

.main-layout {
  align-items: stretch;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 310px);
}

.practice-column {
  display: grid;
  gap: 14px;
}

.target-panel {
  align-content: center;
  background: var(--panel-strong);
  display: grid;
  gap: 18px;
  min-height: 250px;
  min-width: 0;
  overflow: hidden;
  padding: clamp(18px, 3vw, 28px);
}

.target-meta,
.log-header {
  color: rgba(255, 250, 240, 0.66);
  display: flex;
  font-size: 0.76rem;
  font-weight: 900;
  gap: 12px;
  justify-content: space-between;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chord-symbol {
  color: var(--gold);
  display: grid;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(5rem, 11vw, 9rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.88;
  min-height: 126px;
  min-width: 0;
  overflow-wrap: anywhere;
  place-items: center;
  text-align: center;
  text-shadow: 0 0 32px rgba(212, 168, 79, 0.16);
}

.chord-symbol.is-medium {
  font-size: clamp(4.1rem, 8.5vw, 7.2rem);
}

.chord-symbol.is-long {
  font-size: clamp(3.1rem, 6.5vw, 5.6rem);
}

.chord-symbol.is-extra-long {
  font-size: clamp(2.35rem, 5.2vw, 4.3rem);
  line-height: 1;
}

.result-indicator,
.feedback {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.controls,
.details,
.attempt-log {
  background: rgba(22, 21, 20, 0.5);
}

.controls {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(150px, 0.8fr) minmax(190px, 1.1fr) minmax(130px, 0.7fr) auto auto;
  padding: 14px;
}

.field {
  color: rgba(255, 250, 240, 0.68);
  display: grid;
  font-size: 0.74rem;
  font-weight: 900;
  gap: 7px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select,
.button {
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
}

select {
  appearance: auto;
  background: rgba(22, 21, 20, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  padding: 0 11px;
  width: 100%;
}

select:focus-visible,
.button:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

.button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-weight: 900;
  min-width: 106px;
  padding: 0 16px;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 100ms ease;
}

.button:active {
  transform: scale(0.97);
}

.button--light {
  background: rgba(255, 250, 240, 0.1);
  color: var(--text);
}

.button--light:hover {
  background: rgba(255, 250, 240, 0.18);
}

.button--primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
}

.button--primary:hover {
  background: var(--gold-bright);
  border-color: var(--gold-bright);
}

.details {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(100px, 140px));
  padding: 12px;
}

.metric {
  align-content: center;
  background: rgba(255, 250, 240, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  min-height: 66px;
  padding: 10px 12px;
}

.metric span {
  color: rgba(255, 250, 240, 0.58);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  color: var(--text);
  font-size: 1.22rem;
}

.attempt-log {
  align-self: stretch;
  display: grid;
  gap: 12px;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100%;
  padding: 15px;
}

.log-list {
  align-content: start;
  display: grid;
  gap: 8px;
  max-height: 550px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: rgba(212, 168, 79, 0.6) rgba(255, 250, 240, 0.08);
}

.log-empty,
.log-row {
  align-items: center;
  background: rgba(255, 250, 240, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  display: grid;
  min-height: 44px;
  padding: 10px 11px;
}

.log-empty {
  color: rgba(255, 250, 240, 0.56);
}

.log-row {
  gap: 6px 9px;
  grid-template-columns: minmax(50px, auto) minmax(0, 1fr) auto;
  min-width: 0;
}

.log-row strong,
.log-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-row strong {
  color: var(--text);
  font-size: 1rem;
}

.log-row span {
  color: rgba(255, 250, 240, 0.56);
  font-size: 0.8rem;
}

.log-row b {
  align-self: start;
  border-radius: 999px;
  font-size: 0.72rem;
  justify-self: end;
  padding: 5px 8px;
  white-space: nowrap;
}

.log-row.ok b {
  background: rgba(71, 99, 87, 0.82);
  color: white;
}

.log-row.miss b {
  background: rgba(182, 101, 67, 0.78);
  color: white;
}

.log-reason {
  color: rgba(255, 250, 240, 0.78);
  font-size: 0.78rem;
  grid-column: 1 / -1;
  line-height: 1.35;
}

@media (max-width: 1240px) {
  .controls {
    grid-template-columns: minmax(190px, 1fr) minmax(145px, 0.8fr);
  }

  .controls .button {
    width: 100%;
  }
}

@media (max-width: 1020px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  .log-list {
    max-height: 300px;
  }
}

@media (max-width: 760px) {
  body {
    background-attachment: scroll;
  }

  .jml-app-header {
    min-height: 68px;
    padding-block: 12px;
  }

  .jml-brand {
    gap: 9px;
  }

  .jml-brand-mark {
    height: 34px;
    width: 34px;
  }

  .jml-brand > span:last-child {
    font-size: 0.9rem;
  }

  .jml-lab-link {
    font-size: 0.78rem;
    padding: 8px 11px;
  }

  .app-shell {
    padding-top: 28px;
  }

  .hero {
    align-items: stretch;
    gap: 18px;
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(2.9rem, 13vw, 4.6rem);
  }

  .status-pill {
    justify-self: start;
    min-width: 0;
  }

  .trainer-panel {
    padding: 12px;
  }

  .controls,
  .details {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

  .target-panel {
    min-height: 230px;
  }

  .attempt-log {
    min-height: 260px;
  }
}

@media (max-width: 430px) {
  .jml-brand > span:last-child {
    display: none;
  }

  .app-shell {
    padding-inline: 12px;
  }

  .target-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .chord-symbol {
    font-size: clamp(4rem, 23vw, 6rem);
  }
}
