:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #62675f;
  --line: #d9ded8;
  --paper: #fbfbf7;
  --panel: #ffffff;
  --teal: #087568;
  --teal-dark: #064e46;
  --coral: #c84a31;
  --gold: #d19a20;
  --shadow: 0 18px 45px rgba(32, 33, 36, 0.11);
  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;
  background: var(--paper);
  color: var(--ink);
}
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}
.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}
h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1;
  letter-spacing: 0;
}
p { margin: 7px 0 0; color: var(--muted); }
.status {
  min-width: 132px;
  max-width: 44vw;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  text-align: center;
  font-size: 14px;
  color: var(--teal-dark);
  background: #eef8f3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 24px;
  padding: clamp(18px, 4vw, 44px);
  min-height: 0;
}
.conversation {
  min-height: 420px;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.message {
  width: min(780px, 92%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--panel);
  box-shadow: 0 5px 18px rgba(32, 33, 36, 0.05);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.message.user {
  align-self: flex-end;
  border-color: rgba(8, 117, 104, 0.3);
}
.message.assistant {
  align-self: flex-start;
}
.message.error {
  border-color: rgba(200, 74, 49, 0.42);
  color: #8f2f1f;
}
.controls {
  align-self: start;
  position: sticky;
  top: 112px;
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.mic {
  width: 132px;
  aspect-ratio: 1;
  justify-self: center;
  border: 0;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 16px 34px rgba(8, 117, 104, 0.32);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 150ms ease, background 150ms ease;
}
.mic:hover { transform: translateY(-1px); background: var(--teal-dark); }
.mic.recording { background: var(--coral); box-shadow: 0 16px 34px rgba(200, 74, 49, 0.32); }
.mic-icon {
  width: 38px;
  height: 56px;
  border: 5px solid #fff;
  border-radius: 24px;
  position: relative;
}
.mic-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -21px;
  width: 40px;
  height: 26px;
  border: 5px solid #fff;
  border-top: 0;
  border-radius: 0 0 24px 24px;
  transform: translateX(-50%);
}
.meter {
  height: 8px;
  background: #edf1ec;
  border-radius: 999px;
  overflow: hidden;
}
.meter span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--gold);
  transition: width 120ms ease;
}
.text-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  font: inherit;
}
.text-form button {
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font: inherit;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
}
audio { width: 100%; }
@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .status { max-width: 100%; }
  .workspace { grid-template-columns: 1fr; }
  .conversation { max-height: none; min-height: 48vh; }
  .controls { position: static; }
}
