:root {
  color-scheme: light;
  font-family: "Aptos", "Inter", "SF Pro Display", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef1f0;
  color: #17211f;
  --ink: #17211f;
  --muted: #61716d;
  --line: #d7dfdc;
  --panel: #ffffff;
  --panel-soft: #f7f9f8;
  --brand: #0c746b;
  --brand-strong: #084f4a;
  --charcoal: #16211f;
  --copper: #b9874b;
  --blue: #315f9f;
  --red: #b42318;
  --yellow: #b7791f;
  --green: #166534;
  --shadow: 0 18px 44px rgba(21, 31, 29, 0.09);
  --shadow-strong: 0 24px 70px rgba(16, 26, 24, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

.app-shell {
  min-height: 100vh;
  padding: 30px;
  background:
    linear-gradient(180deg, rgba(250, 252, 251, 0.94), rgba(235, 240, 238, 0.98)),
    repeating-linear-gradient(90deg, rgba(12, 116, 107, 0.035) 0 1px, transparent 1px 72px),
    #eef1f0;
}

.workspace {
  max-width: 1280px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.brand-block {
  max-width: 760px;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--copper);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  color: #101a18;
  font-size: 38px;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  color: #13201d;
  font-size: 18px;
  line-height: 1.25;
}

h3 {
  margin: 22px 0 8px;
  font-size: 14px;
}

.top-copy,
.panel-header p,
.microcopy {
  color: var(--muted);
}

.top-copy {
  margin-bottom: 0;
  font-size: 15px;
  line-height: 1.55;
}

.language-switch {
  display: inline-flex;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  padding: 3px;
  box-shadow: 0 8px 24px rgba(21, 31, 29, 0.08);
}

.lang-button {
  min-width: 48px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #526677;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.lang-button.active {
  background: var(--charcoal);
  color: #fff;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  background: rgba(255, 255, 255, 0.88);
  color: #314b46;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(21, 31, 29, 0.08);
}

.signal-banner {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: 20px;
  align-items: center;
  min-height: 154px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 22px;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(135deg, rgba(22, 33, 31, 0.98), rgba(19, 54, 50, 0.94) 52%, rgba(115, 87, 51, 0.82)),
    #16211f;
  box-shadow: var(--shadow-strong);
}

.signal-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 42px);
  opacity: 0.7;
}

.signal-copy,
.signal-board {
  position: relative;
  z-index: 1;
}

.signal-copy span {
  display: block;
  margin-bottom: 8px;
  color: #e7c58e;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.signal-copy strong {
  display: block;
  max-width: 570px;
  color: #f8fbfa;
  font-size: 24px;
  line-height: 1.22;
  font-weight: 820;
}

.signal-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 124px;
  gap: 16px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
}

.wave-track {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 74px;
}

.wave-track i {
  display: block;
  min-height: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f9d89c, #7ad2c6);
  opacity: 0.9;
}

.wave-track i:nth-child(1) { height: 20px; }
.wave-track i:nth-child(2) { height: 42px; }
.wave-track i:nth-child(3) { height: 58px; }
.wave-track i:nth-child(4) { height: 34px; }
.wave-track i:nth-child(5) { height: 68px; }
.wave-track i:nth-child(6) { height: 50px; }
.wave-track i:nth-child(7) { height: 26px; }
.wave-track i:nth-child(8) { height: 62px; }
.wave-track i:nth-child(9) { height: 46px; }
.wave-track i:nth-child(10) { height: 72px; }
.wave-track i:nth-child(11) { height: 38px; }
.wave-track i:nth-child(12) { height: 22px; }

.signal-score {
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  padding-left: 16px;
}

.signal-score span {
  display: block;
  color: rgba(248, 251, 250, 0.72);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.signal-score strong {
  display: block;
  margin-top: 6px;
  color: #fff;
  font-size: 33px;
  line-height: 1;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.work-column,
.side-stack {
  display: grid;
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-header p {
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.45;
}

.compact {
  margin-bottom: 12px;
}

.field-label {
  display: block;
  margin: 14px 0 8px;
  color: #253647;
  font-size: 13px;
  font-weight: 800;
}

textarea,
.auth-form input,
.verify-form input {
  width: 100%;
  border: 1px solid #c9d5de;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

textarea:focus,
.auth-form input:focus,
.verify-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

textarea {
  min-height: 190px;
  resize: vertical;
  padding: 14px;
  font: 15px/1.58 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.audio-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 1fr);
  gap: 16px;
  align-items: stretch;
}

.audio-card {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid #dbe4ea;
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(247, 249, 248, 0.96), rgba(255, 255, 255, 0.96));
}

.audio-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.audio-card-header strong {
  color: #17211f;
  font-size: 14px;
}

.audio-card-header span {
  border: 1px solid #d7dfdc;
  border-radius: 999px;
  padding: 4px 8px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.recorder-card.recording {
  border-color: rgba(180, 35, 24, 0.28);
  background: linear-gradient(180deg, rgba(255, 247, 245, 0.96), rgba(255, 255, 255, 0.96));
}

.recorder-actions {
  display: grid;
  grid-template-columns: 1.25fr 0.8fr 0.8fr;
  gap: 8px;
}

.recording-playback {
  width: 100%;
  min-height: 38px;
}

.recording-playback.hidden {
  display: none;
}

input[type="file"] {
  width: 100%;
  border: 1px dashed #9fb1bf;
  border-radius: 8px;
  padding: 15px;
  background: var(--panel-soft);
}

.primary-button,
.secondary-button {
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  margin-top: 18px;
  border: 0;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--brand), #09554f);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 14px 28px rgba(15, 118, 110, 0.22);
}

.primary-button:hover,
.secondary-button.accent:hover {
  background: linear-gradient(135deg, var(--brand-strong), #073f3b);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.secondary-button {
  width: 100%;
  border: 1px solid #cbd6df;
  padding: 11px 14px;
  background: #eef3f6;
  color: #4b6072;
  font-size: 14px;
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.secondary-button.accent {
  border-color: var(--brand);
  background: linear-gradient(135deg, var(--brand), #09554f);
  color: #fff;
}

.auth-form input,
.verify-form input {
  padding: 11px 12px;
  font: 15px/1.4 Inter, ui-sans-serif, system-ui, sans-serif;
}

.auth-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.account-summary {
  display: grid;
  gap: 10px;
}

.account-summary div,
.metrics div,
.breakdown div,
.plan-card {
  border: 1px solid #dbe4ea;
  border-radius: 8px;
  background: var(--panel-soft);
}

.account-summary div {
  padding: 12px;
}

.account-summary span,
.plan-card span,
.plan-card small,
.metrics span,
.breakdown span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.account-summary strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 17px;
}

.hidden {
  display: none;
}

.microcopy {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.result-header {
  align-items: center;
}

.score-dial {
  display: grid;
  place-items: center;
  width: 94px;
  height: 94px;
  flex: 0 0 94px;
  border: 1px solid #c7e5e1;
  border-radius: 50%;
  background:
    linear-gradient(#f2fbfa, #edf8f6) padding-box,
    conic-gradient(from 45deg, #0c746b, #e2bd80, #0c746b) border-box;
  color: var(--brand);
}

.score-dial span {
  font-size: 29px;
  font-weight: 900;
  line-height: 1;
}

.score-dial small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.metrics div {
  padding: 12px;
}

.metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

.breakdown {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.breakdown div {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  font-size: 14px;
}

.breakdown strong {
  margin-left: auto;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.recognized {
  min-height: 96px;
  border: 1px solid #e2e9ee;
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
  color: #263746;
  line-height: 1.6;
}

.plan-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.plan-card {
  padding: 12px;
}

.plan-card.selected {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f0faf8, #ffffff);
}

.plan-card strong {
  display: block;
  margin: 5px 0;
  font-size: 20px;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-empty {
  color: var(--muted);
  font-size: 14px;
}

.history-item {
  width: 100%;
  border: 1px solid #dbe4ea;
  border-radius: 8px;
  padding: 10px;
  background: var(--panel-soft);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.history-item:hover {
  border-color: var(--brand);
  background: #f0faf8;
}

.history-item strong,
.history-item span,
.history-item small {
  display: block;
}

.history-item strong {
  font-size: 15px;
}

.history-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item small {
  margin-top: 6px;
  color: #789;
  font-size: 12px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.tokens {
  min-height: 160px;
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 14px;
  line-height: 2.4;
  background: #fbfcfd;
}

.token {
  display: inline-block;
  margin: 3px;
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 14px;
  line-height: 1.3;
}

.correct {
  background: #dcfce7;
  color: var(--green);
}

.missing,
.wrong {
  background: #fee2e2;
  color: #991b1b;
  font-weight: 800;
}

.extra {
  background: #dbeafe;
  color: var(--blue);
  font-weight: 800;
}

.uncertain {
  background: #fef3c7;
  color: #92400e;
  font-weight: 800;
}

@media (max-width: 1020px) {
  .main-grid,
  .audio-options,
  .signal-banner {
    grid-template-columns: 1fr;
  }

  .side-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px;
  }

  .topbar,
  .panel-header,
  .result-header {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 28px;
  }

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

  .signal-banner {
    padding: 18px;
  }

  .signal-board {
    grid-template-columns: 1fr;
  }

  .signal-score {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    padding: 12px 0 0;
  }

  .side-stack,
  .auth-actions,
  .recorder-actions,
  .plan-row,
  .metrics,
  .breakdown {
    grid-template-columns: 1fr;
  }

  .score-dial {
    width: 76px;
    height: 76px;
  }
}
