:root {
  color: #1e2428;
  background: #eef1f3;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
  --surface: #ffffff;
  --line: #d8dee2;
  --muted: #66737c;
  --sft: #176b87;
  --sft-soft: #e6f3f7;
  --distill: #9a4d22;
  --distill-soft: #fff0e7;
  --focus: #166d56;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  min-width: 320px;
  overflow: hidden;
}

button,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100dvh;
  background: var(--surface);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  background: #1d343c;
  font-size: 20px;
  font-weight: 750;
}

h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
}

.service-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.service-status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b98c28;
}

.service-status.ready span {
  background: #16805f;
}

.service-status.error span {
  background: #b83a36;
}

.quiet-button,
.mode-switch button,
.primary-button,
.stop-button {
  min-height: 38px;
  border-radius: 6px;
  font-weight: 650;
}

.quiet-button {
  padding: 0 13px;
  border: 1px solid var(--line);
  color: #344047;
  background: var(--surface);
}

.quiet-button:hover {
  background: #f5f7f8;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(520px, calc(100% - 32px));
  margin: 12px auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf1f3;
}

.mode-switch button {
  border: 0;
  color: #536068;
  background: transparent;
}

.mode-switch button[aria-selected="true"] {
  color: #172126;
  background: #fff;
  box-shadow: 0 1px 2px rgb(33 48 56 / 16%);
}

.workspace {
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: #f7f9fa;
}

.empty-state {
  display: grid;
  height: 100%;
  place-content: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: #2d383e;
  font-size: 18px;
}

.empty-state p {
  margin: 7px 0 0;
  font-size: 15px;
}

.single-feed,
.model-feed {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.single-feed {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.compare-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  height: 100%;
}

.model-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.model-pane + .model-pane {
  border-left: 1px solid var(--line);
}

.pane-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.pane-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.pane-heading small {
  color: var(--muted);
  font-size: 12px;
}

.pane-heading.sft h2 {
  color: var(--sft);
}

.pane-heading.distilled h2 {
  color: var(--distill);
}

.model-feed {
  padding: 18px 18px 48px;
}

.message {
  width: fit-content;
  max-width: min(720px, 88%);
  margin-bottom: 16px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-size: 16px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.markdown {
  white-space: normal;
}

.message.markdown p,
.message.markdown ul,
.message.markdown ol,
.message.markdown pre {
  margin: 0 0 9px;
}

.message.markdown > :last-child {
  margin-bottom: 0;
}

.message.markdown ul,
.message.markdown ol {
  padding-left: 24px;
}

.message.markdown code {
  padding: 1px 4px;
  border-radius: 4px;
  background: rgb(30 36 40 / 9%);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.message.markdown pre {
  overflow-x: auto;
  padding: 10px;
  border-radius: 6px;
  background: rgb(30 36 40 / 9%);
  white-space: pre-wrap;
}

.message.markdown pre code {
  padding: 0;
  background: transparent;
}

.message.user {
  margin-left: auto;
  border-color: #cbd5da;
  background: #e9eef1;
}

.message.assistant.sft {
  border-color: #b9dce6;
  background: var(--sft-soft);
}

.message.assistant.distilled {
  border-color: #efd0bc;
  background: var(--distill-soft);
}

.message.pending::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 16px;
  margin-left: 4px;
  vertical-align: -2px;
  background: currentColor;
  animation: blink 900ms steps(1) infinite;
}

.message.error {
  border-color: #e1b5b3;
  color: #8c2e2a;
  background: #fff0ef;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 max(14px, env(safe-area-inset-bottom));
  background: #fff;
}

.composer textarea {
  width: 100%;
  min-height: 46px;
  max-height: 150px;
  resize: none;
  padding: 11px 13px;
  border: 1px solid #bfc9ce;
  border-radius: 7px;
  outline: none;
  color: #1e272c;
  background: #fff;
  font-size: 16px;
  line-height: 1.45;
}

.composer textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgb(22 109 86 / 14%);
}

.primary-button,
.stop-button {
  min-width: 76px;
  padding: 0 18px;
  border: 1px solid transparent;
  color: #fff;
}

.primary-button {
  background: #176c56;
}

.primary-button:hover {
  background: #115944;
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #879a94;
}

.stop-button {
  border-color: #a53d37;
  color: #8f302c;
  background: #fff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 64px;
    padding: 10px 12px;
  }

  .brand-mark {
    display: none;
  }

  .quiet-button {
    padding: 0 10px;
  }

  .mode-switch {
    width: calc(100% - 24px);
    margin: 9px auto;
  }

  .compare-grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }

  .model-pane + .model-pane {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .pane-heading {
    min-height: 38px;
    padding: 0 12px;
  }

  .model-feed {
    padding: 12px 12px 24px;
  }

  .single-feed {
    padding: 16px 12px 32px;
  }

  .message {
    max-width: 94%;
    font-size: 15px;
  }

  .composer {
    width: calc(100% - 24px);
    padding-top: 10px;
  }

  .primary-button,
  .stop-button {
    min-width: 64px;
    padding: 0 12px;
  }
}
