/* Andzai — monochrome, dark-first. One accent: none. Hierarchy comes from weight, size and space. */
:root {
  --bg: #0a0a0a;
  --fg: #ededed;
  --fg-2: #a1a1a1;
  --fg-3: #808080;  /* 5.0:1 on --bg, 4.7:1 on --surface (WCAG AA) */
  --line: #232323;
  --line-2: #333;
  --surface: #121212;
  --surface-2: #181818;
  --invert-bg: #ededed;
  --invert-fg: #0a0a0a;
  --focus: #ededed;
  --radius: 18px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #fafafa;
  --fg: #111;
  --fg-2: #555;
  --fg-3: #6b6b6b;  /* 5.1:1 on --bg */
  --line: #e4e4e4;
  --line-2: #d2d2d2;
  --surface: #fff;
  --surface-2: #f2f2f2;
  --invert-bg: #111;
  --invert-fg: #fafafa;
  --focus: #111;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--fg);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 10; background: var(--invert-bg); color: var(--invert-fg); padding: 8px 12px; border-radius: 8px; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- Header ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) clamp(16px, 3vw, 28px) 14px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; border-radius: 8px; }
.logo { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 7; stroke-linejoin: miter; stroke-miterlimit: 10; }
.wordmark { font-weight: 560; font-size: 15px; letter-spacing: -.01em; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.text-btn { border: 1px solid var(--line-2); background: transparent; border-radius: 999px; padding: 6px 14px; font-size: 13.5px; cursor: pointer; text-decoration: none; }
.text-btn.solid { background: var(--invert-bg); color: var(--invert-fg); border-color: var(--invert-bg); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  border: 0; background: transparent; color: var(--fg-2); cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.icon-btn svg, .send svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Stage ---------- */
.home { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.stage {
  flex: 1; width: 100%; max-width: 760px; margin: 0 auto;
  display: flex; flex-direction: column; justify-content: center;
  padding: 96px clamp(16px, 4vw, 20px) 40px;
}
.greeting {
  margin: 0 0 26px; text-align: center;
  font-weight: 450; font-size: clamp(26px, 4.2vw, 34px); line-height: 1.15; letter-spacing: -.025em;
}

/* ---------- Composer ---------- */
.composer {
  position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 14px 10px 18px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.composer:focus-within { border-color: var(--line-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--fg) 4%, transparent); }
.composer textarea {
  display: block; width: 100%; resize: none; border: 0; outline: 0; background: transparent;
  font-size: 16px; line-height: 1.5; min-height: 48px; max-height: 40vh; padding: 2px 0 6px;
}
.composer textarea::placeholder { color: var(--fg-3); }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.composer select {
  max-width: calc(100% - 72px); min-height: 36px; padding: 2px 4px;
  border: 0; border-radius: 4px; background: var(--surface); color: var(--fg-2); font-size: 13px;
}
.send {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  border: 0; cursor: pointer; background: var(--invert-bg); color: var(--invert-fg);
  transition: opacity .15s var(--ease), transform .15s var(--ease);
}
.send svg { stroke-width: 2; }
.send:disabled { opacity: .22; cursor: default; }
.send:not(:disabled):active { transform: scale(.94); }

.download-note, .feedback { text-align: center; color: var(--fg-2); font-size: 13px; }
.download-note { margin: 9px 0 0; }
.download-note:empty, .notice:empty { margin: 0; }
.feedback progress { width: min(260px, 100%); height: 6px; accent-color: var(--fg); }
.model-note { margin-top: 26px; color: var(--fg-2); font-size: 13px; }
.model-note p { margin: 6px 0 0; }
.model-note p + p { color: var(--fg-3); font-size: 12.5px; }
.exchange { padding: 18px 0 0; margin: 20px 0 0; border-top: 1px solid var(--line); }
.exchange dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.exchange .passage { margin-bottom: 8px; color: var(--fg-2); }

/* ---------- Shortcuts ---------- */
.shortcuts { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.shortcuts button {
  border: 1px solid var(--line); background: transparent; color: var(--fg-2);
  border-radius: 999px; padding: 6px 13px; font-size: 13.5px; cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.shortcuts button:hover { color: var(--fg); border-color: var(--line-2); }

.notice { margin: 15px auto 4px; max-width: 520px; overflow-wrap: anywhere; }
.notice:not(:empty) { animation: rise .35s var(--ease) both; }

/* ---------- Footer ---------- */
.foot {
  display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between;
  padding: 16px clamp(16px, 3vw, 28px) max(16px, env(safe-area-inset-bottom));
  font-size: 12.5px; color: var(--fg-3);
}
.foot nav { display: flex; gap: 18px; }
.foot a { text-decoration: none; color: var(--fg-3); transition: color .15s var(--ease); }
.foot a:hover { color: var(--fg); }

/* ---------- Settings ---------- */
.settings {
  width: min(420px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-2); border-radius: 16px;
  background: var(--surface); color: var(--fg);
}
.settings::backdrop { background: rgb(0 0 0 / .55); }
.settings[open] { animation: pop .22s var(--ease) both; }
.settings form { padding: 18px 20px 20px; }
.settings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.settings h2 { margin: 0; font-size: 15px; font-weight: 560; }
.settings fieldset { border: 0; border-top: 1px solid var(--line); margin: 12px 0 0; padding: 14px 0 0; }
.settings legend { float: left; width: 100%; padding: 0; margin-bottom: 10px; font-size: 12.5px; color: var(--fg-3); }
.settings-text { clear: both; margin: 0; font-size: 13.5px; color: var(--fg-2); }
.segmented { clear: both; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; text-align: center; padding: 6px 0; border-radius: 7px; font-size: 13.5px; color: var(--fg-2); }
.segmented input:checked + span { background: var(--surface-2); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-2); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }

/* ---------- Content pages (about, privacy) ---------- */
.page { max-width: 680px; margin: 0 auto; padding: 120px clamp(16px, 4vw, 20px) 64px; }
.page h1 { font-weight: 480; font-size: clamp(28px, 4.4vw, 38px); letter-spacing: -.03em; line-height: 1.12; margin: 0 0 20px; }
.page h2 { font-weight: 560; font-size: 15px; margin: 48px 0 12px; }
.page p, .page li { color: var(--fg-2); }
.page p strong { color: var(--fg); font-weight: 560; }
.page ul { padding-left: 18px; }
.lede { font-size: 17px; color: var(--fg) !important; }
.table-wrap { overflow-x: auto; margin: 8px 0; border-radius: 6px; }
.table-wrap:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.roadmap { width: 100%; border-collapse: collapse; font-size: 14px; }
.roadmap th, .roadmap td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.roadmap th { font-weight: 450; color: var(--fg-3); font-size: 12.5px; }
.roadmap td:nth-child(2) { font-family: var(--mono); font-size: 13px; color: var(--fg-2); }
.roadmap td:last-child { color: var(--fg-3); }
.fine { font-size: 13px; color: var(--fg-3) !important; }
.page-foot { max-width: 680px; margin: 0 auto; }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
.greeting, .composer, .shortcuts { animation: rise .6s var(--ease) both; }
.composer { animation-delay: .05s; }
.shortcuts { animation-delay: .1s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .stage { justify-content: center; padding-top: 80px; padding-bottom: 24px; }
  .greeting { margin-bottom: 20px; }
  .shortcuts { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
  .shortcuts::-webkit-scrollbar { display: none; }
  .shortcuts button { white-space: nowrap; }
  .foot { justify-content: center; text-align: center; }
  .foot-note { width: 100%; }
}
