:root {
  color-scheme: light;
  --ink: #123f3b;
  --muted: #67837f;
  --line: #cfe5df;
  --mint: #eef9f4;
  --teal: #078e91;
  --teal-dark: #05787a;
  --green: #63ce31;
  --white: #ffffff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(99, 206, 49, .12), transparent 32rem),
    radial-gradient(circle at 92% 8%, rgba(7, 142, 145, .13), transparent 34rem),
    #f7fcfa;
}

button, input, select { font: inherit; }

.page-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: .79rem;
  font-weight: 850;
  letter-spacing: .16em;
}

h1, h2 { margin: 0; letter-spacing: -.035em; }
h1 { font-size: clamp(2.3rem, 7vw, 4.8rem); line-height: .98; }
h2 { font-size: clamp(1.45rem, 3vw, 2.15rem); }

.intro {
  max-width: 720px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.55;
}

.language-field,
.callsign-fields label,
.access-form {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.language-field { min-width: 150px; }

select,
.callsign-fields input,
.access-form input {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--white);
  font-weight: 750;
}

input:focus,
select:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(7, 142, 145, .12);
}

.settings-card, .qso-control-card, .voice-card, .result-card,
.conversation-card, .test-list {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 22px 60px rgba(19, 74, 67, .08);
}

.qso-control-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
  padding: 24px 28px;
}

.qso-control-card p:not(.eyebrow) {
  max-width: 650px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.qso-buttons {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.settings-card {
  display: grid;
  grid-template-columns: minmax(340px, .95fr) minmax(420px, 1.05fr);
  align-items: start;
  gap: 28px;
  margin-bottom: 22px;
  padding: 24px 28px;
}

.callsign-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.callsign-fields input {
  width: 100%;
  text-transform: uppercase;
}

.access-form {
  align-content: start;
}

.terms-input {
  width: 100%;
  margin-bottom: 6px;
  text-transform: none;
  letter-spacing: normal;
}

.access-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.access-controls input { width: 100%; }

.access-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: normal;
  text-transform: none;
}

.connect {
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  color: var(--white);
  background: var(--teal);
  font-weight: 850;
  cursor: pointer;
}

.connect:disabled { cursor: wait; opacity: .65; }

.voice-card {
  padding: 24px;
  text-align: center;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 24px;
  margin-bottom: 20px;
  color: var(--muted);
  font-weight: 700;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #9ab0ac;
  box-shadow: 0 0 0 6px rgba(154, 176, 172, .14);
}
.status-dot.ready { background: var(--green); box-shadow: 0 0 0 6px rgba(99, 206, 49, .15); }
.status-dot.recording { background: #ef5147; box-shadow: 0 0 0 6px rgba(239, 81, 71, .15); }
.status-dot.working { background: #f2aa27; box-shadow: 0 0 0 6px rgba(242, 170, 39, .16); }
.status-dot.error { background: #d43d38; box-shadow: 0 0 0 6px rgba(212, 61, 56, .15); }

.ptt {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "icon main" "icon sub";
  column-gap: 16px;
  align-items: center;
  width: min(540px, 100%);
  min-height: 102px;
  margin: 0 auto;
  padding: 20px 28px;
  border: 0;
  border-radius: 24px;
  color: white;
  background: linear-gradient(135deg, #079b9f, #047f82);
  box-shadow: 0 16px 34px rgba(7, 142, 145, .24);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.ptt:hover { transform: translateY(-2px); box-shadow: 0 20px 40px rgba(7, 142, 145, .3); }
.ptt:active, .ptt.recording {
  transform: translateY(2px) scale(.992);
  background: linear-gradient(135deg, #e94f45, #c93934);
  box-shadow: 0 10px 24px rgba(201, 57, 52, .28);
}
.ptt:disabled { cursor: not-allowed; opacity: .45; transform: none; box-shadow: none; }
.ptt-icon { grid-area: icon; font-size: 2.1rem; }
.ptt-main { grid-area: main; text-align: left; font-size: 1.2rem; font-weight: 850; }
.ptt-sub { grid-area: sub; text-align: left; opacity: .82; font-size: .9rem; }

.hint { margin: 18px 0 0; color: var(--muted); }

.result-card { margin-top: 22px; padding: 30px; }
.result-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.secondary {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal-dark);
  background: var(--white);
  font-weight: 800;
  cursor: pointer;
}
.secondary:disabled { cursor: default; opacity: .45; }

blockquote {
  margin: 26px 0;
  padding: 24px;
  border-left: 5px solid var(--green);
  border-radius: 0 20px 20px 0;
  color: var(--ink);
  background: var(--mint);
  font-size: clamp(1.25rem, 3vw, 1.85rem);
  font-weight: 720;
  line-height: 1.42;
}

.raw-result {
  margin: -10px 0 24px;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  background: #fbfefd;
}

.raw-result span {
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.raw-result p { margin: 5px 0 0; line-height: 1.5; }

.conversation-card { margin-top: 22px; padding: 30px; }

.conversation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.live-badge {
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--white);
  font-size: .8rem;
  font-weight: 850;
}

.live-badge.live {
  color: #287d18;
  border-color: #bce3ae;
  background: #f1fbec;
}

.conversation-log {
  display: grid;
  gap: 12px;
  max-height: 560px;
  overflow-y: auto;
  padding: 4px;
}

.conversation-message {
  max-width: 82%;
  padding: 14px 17px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--white);
}

.conversation-message.user {
  justify-self: end;
  border-color: #b7e2dc;
  background: #eaf8f5;
}

.conversation-message.partner {
  justify-self: start;
  border-color: #c9e9b9;
  background: #f2faed;
}

.conversation-message.trainer {
  justify-self: stretch;
  max-width: 100%;
  border-style: dashed;
  background: #fbfefd;
}

.conversation-message span {
  color: var(--teal);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.conversation-message p {
  margin: 5px 0 0;
  white-space: pre-wrap;
  line-height: 1.5;
}

.evaluation {
  margin: 22px 0 0;
  padding: 20px;
  overflow-x: auto;
  border: 1px solid #c9e9b9;
  border-radius: 18px;
  color: var(--ink);
  background: #f2faed;
  font: inherit;
  line-height: 1.55;
  white-space: pre-wrap;
}

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0; }
.metrics div { padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; }
.metrics dt { color: var(--muted); font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.metrics dd { margin: 4px 0 0; font-weight: 850; }

.test-list { margin-top: 22px; padding: 26px 30px; }
.test-list ol { margin: 14px 0 0; padding-left: 1.35rem; color: var(--muted); line-height: 1.8; }
.test-list li::marker { color: var(--teal); font-weight: 900; }

@media (max-width: 800px) {
  .page-shell { width: min(100% - 20px, 1040px); padding-top: 28px; }
  .hero { align-items: stretch; flex-direction: column; gap: 20px; }
  .language-field { width: 100%; }
  .settings-card, .qso-control-card, .voice-card, .result-card,
  .conversation-card, .test-list { border-radius: 22px; }
  .settings-card { grid-template-columns: 1fr; gap: 20px; padding: 20px; }
  .qso-control-card { align-items: stretch; flex-direction: column; padding: 20px; }
  .qso-buttons { flex-direction: column; }
  .access-controls { grid-template-columns: 1fr; }
  .voice-card, .result-card { padding: 20px; }
  .result-heading { align-items: flex-start; flex-direction: column; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .ptt { padding: 18px; }
  .conversation-message { max-width: 94%; }
}

@media (max-width: 520px) {
  .callsign-fields, .metrics { grid-template-columns: 1fr; }
}
