:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #637083;
  --line: #d9dfeb;
  --accent: #167f6b;
  --accent-dark: #0f6556;
  --user: #e8f3ff;
  --assistant: #f1f5e9;
  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(--bg);
  color: var(--ink);
}

button,
select,
textarea,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  width: min(1040px, 100%);
  min-height: calc(100vh - 48px);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 18px 55px rgba(28, 39, 60, 0.12);
}

.topbar,
.controls,
.composer {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2.1rem);
  letter-spacing: 0;
}

.status {
  max-width: 42ch;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: right;
}

.controls {
  display: grid;
  grid-template-columns: minmax(190px, 1.15fr) minmax(190px, 1fr) 1fr 1fr auto;
  gap: 14px;
  align-items: end;
  background: #fbfcff;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

select {
  height: 42px;
  padding: 0 12px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.conversation {
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 360px;
}

.message {
  width: min(72ch, 86%);
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.45;
}

.message strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.8rem;
  color: var(--muted);
}

.message.user {
  align-self: flex-end;
  background: var(--user);
}

.message.assistant {
  align-self: flex-start;
  background: var(--assistant);
}

.composer {
  display: grid;
  grid-template-columns: 48px auto 1fr auto;
  gap: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.icon-button {
  width: 48px;
  padding: 0;
  display: grid;
  place-items: center;
  background: #253348;
}

.icon-button svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mode-button {
  background: #253348;
  white-space: nowrap;
}

.mode-button.is-active {
  background: #b83b5e;
}

.mode-button.is-listening {
  box-shadow: 0 0 0 3px rgba(184, 59, 94, 0.18);
}

textarea {
  min-height: 48px;
  max-height: 170px;
  resize: vertical;
  padding: 12px 13px;
  line-height: 1.35;
}

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

  .workspace {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .topbar,
  .controls,
  .composer {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status {
    text-align: left;
  }

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

  .icon-button {
    width: 100%;
  }

  .message {
    width: 100%;
  }
}
