:root {
  --bg: #f6f4ef;
  --panel: #ece8df;
  --card: #ffffff;
  --ink: #17140f;
  --ink-2: #4b463d;
  --ink-3: #807a6e;
  --line: rgba(23, 20, 15, 0.1);
  --accent: #ffb81f;
  --accent-soft: rgba(255, 184, 31, 0.3);
  --danger: #e5484d;
  --ok: #2b8a57;
  --shadow: 0 1px 2px rgba(23, 20, 15, 0.05), 0 12px 32px -12px rgba(23, 20, 15, 0.18);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12110f;
    --panel: #1c1a17;
    --card: #24211d;
    --ink: #f4f1ea;
    --ink-2: #c9c3b7;
    --ink-3: #938c7f;
    --line: rgba(244, 241, 234, 0.12);
    --accent-soft: rgba(255, 184, 31, 0.22);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- top bar ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}

.brand svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.top-link {
  font-size: 14px;
  color: var(--ink-2);
  text-decoration: none;
}

.top-link:hover {
  color: var(--ink);
}

/* ---------- hero ---------- */

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

.hero {
  text-align: center;
  padding: 44px 0 36px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  padding: 4px 4px 4px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
}

.pill-tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel);
}

h1 {
  margin: 0 auto;
  max-width: 16ch;
  font-size: clamp(32px, 6vw, 56px);
  line-height: 1.06;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lede {
  margin: 16px auto 0;
  max-width: 46ch;
  font-size: clamp(16px, 2vw, 18px);
  line-height: 1.5;
  color: var(--ink-2);
}

/* ---------- tabs ---------- */

.tabs {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 5px;
  border-radius: 999px;
  background: var(--panel);
}

.tab-indicator {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition:
    transform 0.32s cubic-bezier(0.3, 1.2, 0.4, 1),
    width 0.32s cubic-bezier(0.3, 1.2, 0.4, 1);
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  height: 44px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  transition: color 0.2s;
}

.tab svg {
  flex: none;
  width: 19px;
  height: 19px;
}

.tab:hover,
.tab[aria-selected="true"] {
  color: var(--ink);
}

.tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 860px) {
  .tab-label {
    display: none;
  }
}

/* ---------- panel ---------- */

.panel {
  margin-top: 12px;
  padding: 8px;
  border-radius: 32px;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--accent-soft), transparent 60%),
    var(--panel);
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 28px;
  border-radius: 26px;
  background: var(--card);
  box-shadow: var(--shadow);
}

/* ---------- avatar ---------- */

.avatar {
  --mic: 0;
  position: relative;
  width: 260px;
  height: 200px;
  display: grid;
  place-items: center;
}

/* Drawn and animated by mascot.js, in whole-pixel steps. One sprite unit is one
   CSS pixel, so the cells meet without seams. */
.mascot {
  position: relative;
  width: 260px;
  height: 200px;
  overflow: visible;
  filter: drop-shadow(3px 4px 0 rgba(0, 0, 0, 0.2));
}

.ring {
  position: absolute;
  top: 45px;
  left: 50px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--accent-soft);
  opacity: 0;
  transform: scale(calc(1.02 + var(--mic) * 0.14));
  transition:
    opacity 0.3s,
    transform 0.09s linear;
}

.avatar[data-mode="listening"] .ring {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .tab-indicator {
    transition: none;
  }
}

/* ---------- identity + actions ---------- */

.who {
  margin-top: 10px;
  text-align: center;
}

.role {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 19px;
  font-weight: 550;
}

.chip {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
}

.status {
  min-height: 20px;
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--ink-3);
}

.status[data-tone="error"] {
  color: var(--danger);
}

.status[data-tone="live"] {
  color: var(--ok);
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.call,
.round {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  min-width: 52px;
  border-radius: 999px;
  transition:
    transform 0.15s,
    background 0.2s,
    padding 0.2s;
}

.call {
  padding: 0 15px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.call svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: none;
  transition: rotate 0.25s;
}

.call:hover,
.round:hover {
  transform: scale(1.05);
}

.call:active,
.round:active {
  transform: scale(0.96);
}

.call[data-live="true"] {
  padding: 0 18px;
  background: var(--danger);
  color: #fff;
}

.call[data-live="true"] svg {
  rotate: 135deg;
}

.timer:empty {
  display: none;
}

.round.ghost {
  width: 52px;
  background: var(--panel);
}

.round svg {
  width: 21px;
  height: 21px;
}

.round .slash {
  display: none;
}

.round[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.round[aria-pressed="true"] .slash {
  display: inline;
}

/* ---------- transcript ---------- */

.transcript {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 560px;
  max-height: 190px;
  margin: 22px 0 0;
  padding: 14px 4px 0;
  overflow-y: auto;
  list-style: none;
  border-top: 1px solid var(--line);
  scrollbar-width: thin;
}

.transcript li {
  max-width: 86%;
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.4;
  background: var(--panel);
  align-self: flex-start;
  border-bottom-left-radius: 5px;
}

.transcript li[data-role="user"] {
  align-self: flex-end;
  background: var(--ink);
  color: var(--bg);
  border-radius: 16px;
  border-bottom-right-radius: 5px;
}

/* ---------- scene ---------- */

.scene {
  padding: 26px 24px 28px;
}

.scene-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 17px;
  font-weight: 550;
}

.scene-head svg {
  width: 20px;
  height: 20px;
}

.rule {
  height: 1px;
  margin: 16px 0;
  background: var(--line);
}

.brief {
  margin: 0;
  max-width: 34em;
  font-size: clamp(20px, 3.1vw, 28px);
  line-height: 1.38;
  letter-spacing: -0.01em;
  color: var(--ink-2);
  text-wrap: pretty;
}

.brief mark {
  padding: 0.05em 0.28em;
  border-radius: 0.3em;
  background: var(--accent-soft);
  color: var(--ink);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.scene > * {
  animation: rise 0.45s both cubic-bezier(0.2, 0.8, 0.2, 1);
}

.scene > :nth-child(2) {
  animation-delay: 40ms;
}

.scene > :nth-child(3) {
  animation-delay: 90ms;
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 8px;
  }
}

/* ---------- editor (custom agent) ---------- */

.editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.field.wide {
  grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 400;
}

.field textarea {
  min-height: 180px;
  line-height: 1.45;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
}

@media (max-width: 600px) {
  .editor {
    grid-template-columns: 1fr;
  }
  .panel {
    border-radius: 26px;
  }
  .card {
    border-radius: 20px;
    padding-top: 30px;
  }
  .scene {
    padding: 22px 14px 22px;
  }
}

/* ---------- models ---------- */

.models {
  margin-top: 40px;
}

.models h2 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: center;
}

.models ol {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.models li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

@media (max-width: 760px) {
  .models ol {
    grid-template-columns: 1fr;
  }
}

.model-stage {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
}

.models a {
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.models a:hover {
  text-decoration: underline;
}

.fine {
  margin: 18px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}
