:root {
  color-scheme: light;
  --bg: #f7f1e3;
  --ink: #1c1712;
  --muted: #5c5348;
  --line: #d9ccb4;
  --card: #fffaf0;
  --accent: #e25b1a;
  --accent-ink: #fff8f2;
  --user: #1f3d2b;
  --bot: #fffaf0;
  --err: #8b1e12;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 0%, #ffe7c2 0%, transparent 36%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
}

a {
  color: var(--accent);
}

.shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lede {
  margin: 0;
  color: var(--muted);
}

.auth,
.panel,
.messages {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.auth,
.panel {
  padding: 14px 16px;
  margin: 18px 0;
}

.auth label,
.panel label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.86rem;
  font-weight: 650;
}

.auth-row {
  display: flex;
  gap: 8px;
}

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

#token,
#prompt,
#max-tokens {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.chat {
  margin-top: 8px;
}

.messages {
  min-height: 280px;
  max-height: min(62vh, 560px);
  overflow: auto;
  padding: 16px;
}

.empty h2 {
  margin: 48px 0 8px;
  text-align: center;
}

.empty p {
  margin: 0 auto 24px;
  max-width: 28rem;
  color: var(--muted);
  text-align: center;
}

.bubble {
  max-width: 92%;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble.user {
  margin-left: auto;
  background: var(--user);
  color: #f4fff8;
}

.bubble.assistant {
  background: #fff;
  border: 1px solid var(--line);
}

.bubble.error {
  background: #fde8e4;
  color: var(--err);
  border: 1px solid #f0b8ae;
}

.composer {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

#prompt {
  resize: vertical;
  min-height: 48px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.examples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.examples button {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  text-align: left;
  font-weight: 550;
  font-size: 0.88rem;
}

.panel summary {
  cursor: pointer;
  font-weight: 700;
}

.panel label {
  margin-top: 12px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

table {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 6px 0;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.disclaimer {
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 640px) {
  .auth-row,
  .composer {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .messages {
    min-height: 240px;
    max-height: 50vh;
  }
}
