:root {
  color-scheme: light;
  --ink: #18201d;
  --muted: #65706b;
  --paper: #f4f2eb;
  --surface: #fffefa;
  --line: #d8d8cf;
  --accent: #216a54;
  --accent-dark: #164b3c;
  --danger: #9b3e38;
  --shadow: 0 18px 45px rgba(31, 48, 41, 0.1);
  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% 8%, rgba(82, 143, 118, 0.16), transparent 31rem),
    var(--paper);
}

button, textarea { font: inherit; }

.shell {
  width: min(980px, calc(100% - 32px));
  margin: 38px auto;
  border: 1px solid rgba(25, 67, 54, 0.14);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding: 34px 38px 25px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.35rem); letter-spacing: -0.045em; }
h1 span { color: var(--accent); font-weight: 520; }
.intro { max-width: 620px; margin: 13px 0 0; color: var(--muted); line-height: 1.55; }

.service {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.86rem;
}

.dot { width: 9px; height: 9px; border-radius: 50%; background: #aaada7; }
.dot-ready { background: #2f8b66; box-shadow: 0 0 0 4px rgba(47, 139, 102, 0.12); }
.dot-error { background: #b95149; box-shadow: 0 0 0 4px rgba(185, 81, 73, 0.12); }

.notice {
  margin: 0 38px 24px;
  padding: 14px 16px;
  border-left: 3px solid #b58a43;
  background: #faf5e8;
  color: #5d513d;
  line-height: 1.5;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 38px 26px;
  border-bottom: 1px solid var(--line);
}

button {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: white;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

button:hover:not(:disabled) { transform: translateY(-1px); border-color: #9ca8a2; }
button:focus-visible, textarea:focus-visible { outline: 3px solid rgba(33, 106, 84, 0.2); outline-offset: 2px; }
button:disabled { opacity: 0.46; cursor: not-allowed; }
.primary { color: white; border-color: var(--accent); background: var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
.danger { color: var(--danger); border-color: rgba(155, 62, 56, 0.35); }

.voice-panel {
  margin: 0 38px 24px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid rgba(33, 106, 84, 0.24);
  border-radius: 14px;
  background: #edf6f1;
}
.voice-panel[hidden] { display: none; }
.voice-panel h2 { margin: 2px 0 6px; font-size: 1.2rem; }
.voice-panel p { margin: 0; color: var(--muted); }
.voice-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#voice-status, #voice-time { color: var(--muted); font-size: 0.82rem; }

.session-state { margin-left: auto; display: grid; gap: 2px; text-align: right; }
.session-state span { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; }
.session-state strong { font-size: 0.95rem; }

.conversation { background: #fbfbf7; }
.messages {
  min-height: 390px;
  max-height: 58vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 30px 38px;
}

.message {
  width: min(76%, 650px);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  line-height: 1.55;
}
.message strong { display: block; margin-bottom: 4px; color: var(--muted); font-size: 0.78rem; }
.message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.user-message { align-self: flex-end; border-color: rgba(33, 106, 84, 0.22); background: #edf6f1; }
.mentor-message { align-self: flex-start; }
.system-message { width: 100%; color: var(--muted); background: transparent; border-style: dashed; }

.composer { padding: 22px 38px 28px; border-top: 1px solid var(--line); background: white; }
.composer label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 0.86rem; font-weight: 650; }
.compose-row { display: grid; grid-template-columns: 1fr auto auto; align-items: end; gap: 12px; }
textarea {
  width: 100%;
  resize: vertical;
  min-height: 84px;
  max-height: 220px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  line-height: 1.45;
}
.compose-row button { min-height: 48px; }
.stream-note { margin: 9px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.4; }

.telemetry {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 38px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #f3f3ed;
  font-size: 0.82rem;
}

@media (max-width: 720px) {
  .shell { width: 100%; margin: 0; min-height: 100vh; border: 0; border-radius: 0; }
  .hero { flex-direction: column; padding: 26px 20px 20px; }
  .service { align-self: flex-start; }
  .notice { margin: 0 20px 20px; }
  .controls { padding: 0 20px 22px; }
  .voice-panel { margin: 0 20px 20px; align-items: flex-start; flex-direction: column; }
  .session-state { width: 100%; margin: 6px 0 0; text-align: left; }
  .messages { padding: 24px 20px; min-height: 48vh; }
  .message { width: 88%; }
  .composer { padding: 18px 20px 24px; }
  .compose-row { grid-template-columns: 1fr; }
  .telemetry { padding: 12px 20px; flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
