:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #191c20;
  --panel-2: #20242a;
  --line: #313741;
  --text: #f4f5f7;
  --muted: #aab2bd;
  --green: #45c486;
  --yellow: #f4bd4f;
  --red: #ee6b6e;
  --blue: #70a7ff;
  --accent: #f1d270;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 280px),
    var(--bg);
  color: var(--text);
}

button,
select,
input {
  font: inherit;
}

button,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #252a31;
  color: var(--text);
}

button {
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:hover:not(:disabled) {
  border-color: #5d6877;
  background: #2d343d;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 56px);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--muted);
}

.topbar p {
  max-width: 760px;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.5;
}

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

.button-icon {
  width: 18px;
  text-align: center;
  color: var(--accent);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.status-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  min-height: 76px;
  padding: 14px;
}

.status-tile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.status-tile strong {
  font-size: 16px;
  font-weight: 650;
}

.status-tile[data-state="ready"] {
  border-color: color-mix(in srgb, var(--green), var(--line) 50%);
}

.status-tile[data-state="active"] {
  border-color: color-mix(in srgb, var(--blue), var(--line) 30%);
  background: #1b2430;
}

.status-tile[data-state="warn"] {
  border-color: color-mix(in srgb, var(--yellow), var(--line) 35%);
}

.status-tile[data-state="error"] {
  border-color: color-mix(in srgb, var(--red), var(--line) 35%);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
}

.conversation {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.transcript-panel,
.response-panel,
.settings,
.metrics,
.events,
.bench-results {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.transcript-panel,
.response-panel {
  min-height: 280px;
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.badge {
  min-width: 82px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.badge.active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--green), var(--line) 40%);
}

.mic-level {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) 42px;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.mic-level-meter {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #11151a;
}

.mic-level-meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--blue);
  transition: width 80ms linear;
}

.mic-level output {
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.partial {
  min-height: 86px;
  color: var(--muted);
  line-height: 1.55;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.final,
.output {
  margin-top: 14px;
  font-size: clamp(18px, 2vw, 25px);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.output {
  min-height: 190px;
  color: #f8f1dc;
}

.side {
  display: grid;
  gap: 14px;
  align-content: start;
}

.settings,
.metrics,
.events,
.bench-results {
  padding: 16px;
}

.settings {
  display: grid;
  gap: 12px;
}

.settings label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

.settings input[type="range"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.runtime-status {
  display: grid;
  gap: 3px;
  min-height: 44px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.runtime-status span {
  color: var(--text);
  font-weight: 650;
}

.runtime-status small {
  color: var(--muted);
  line-height: 1.35;
}

.runtime-status[data-state="ready"] span {
  color: var(--green);
}

.runtime-status[data-state="warn"] span {
  color: var(--yellow);
}

.runtime-status[data-state="error"] span {
  color: var(--red);
}

.build-status {
  min-height: 24px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.range-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.range-label span {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.settings .check {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--text);
}

.metrics dl {
  margin: 0;
  display: grid;
  gap: 10px;
}

.metrics dl div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
}

.metrics dt {
  color: var(--muted);
}

.metrics dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.mic-validation {
  display: grid;
  gap: 5px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 12px;
  overflow-wrap: anywhere;
}

.mic-validation span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.mic-validation strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
}

.mic-validation small {
  color: var(--muted);
  line-height: 1.35;
}

.mic-validation[data-state="active"] {
  border-color: color-mix(in srgb, var(--blue), var(--line) 35%);
}

.mic-validation[data-state="active"] strong {
  color: var(--blue);
}

.mic-validation[data-state="ready"] {
  border-color: color-mix(in srgb, var(--green), var(--line) 45%);
}

.mic-validation[data-state="ready"] strong {
  color: var(--green);
}

.mic-validation[data-state="warn"] {
  border-color: color-mix(in srgb, var(--yellow), var(--line) 40%);
}

.mic-validation[data-state="warn"] strong {
  color: var(--yellow);
}

.mic-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #11151a;
}

.mic-progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--green);
  transition: width 160ms ease;
}

#suiteButton,
#benchmarkButton,
#ttsBenchmarkButton,
#loopbackButton,
#bargeInButton,
#gpuBenchmarkButton,
#evidenceCaptureButton,
#micBenchmarkButton,
#micSeriesButton {
  width: 100%;
  margin-top: 14px;
}

#benchmarkButton,
#ttsBenchmarkButton,
#loopbackButton,
#bargeInButton,
#gpuBenchmarkButton,
#evidenceCaptureButton,
#micBenchmarkButton,
#micSeriesButton {
  margin-top: 8px;
}

.events {
  margin-top: 14px;
}

.events .panel-head button,
.mini-actions button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.bench-results {
  margin-top: 14px;
}

.mini-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.benchmark-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.summary-item {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 10px;
}

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

.summary-item span {
  margin-bottom: 6px;
}

.summary-item strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1500px;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0;
  white-space: nowrap;
}

td {
  color: #dce3ec;
}

td:nth-child(13),
td:nth-child(14) {
  max-width: 260px;
  overflow-wrap: anywhere;
}

#eventLog {
  height: 170px;
  margin: 0;
  padding-left: 22px;
  overflow: auto;
  color: var(--muted);
  line-height: 1.45;
}

#eventLog li {
  padding: 3px 0;
}

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

  .topbar,
  .workspace {
    grid-template-columns: 1fr;
    display: grid;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button {
    flex: 1 1 150px;
  }

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

  .benchmark-summary {
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  }
}

@media (max-width: 560px) {
  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .actions button {
    width: 100%;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .benchmark-summary {
    grid-template-columns: 1fr;
  }

  .transcript-panel,
  .response-panel {
    min-height: 230px;
  }
}
