:root {
  --bg: #0f0e0d;
  --surface: #1a1816;
  --surface-2: #24211e;
  --line: #34302b;
  --text: #f3eee7;
  --muted: #a79e92;
  --accent: #e8b86b;
  --accent-ink: #1a1408;
  --ok: #8fcf9b;
  --warn: #f0a46a;
  --radius: 18px;
  --dock-h: 190px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -200px, #2a2219 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
[hidden] { display: none !important; }

.brand {
  position: fixed; top: 18px; left: 22px;
  font: 600 13px/1 ui-sans-serif, system-ui; letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}

.greeting {
  font: 400 clamp(28px, 4.4vw, 44px)/1.15 ui-serif, Georgia, "Times New Roman", serif;
  letter-spacing: -.01em;
  margin: 0 0 28px;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.primary {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px;
  padding: 11px 22px; font-weight: 600;
}
.primary:hover:not(:disabled) { filter: brightness(1.06); }

input, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px;
}
textarea { resize: vertical; }
label { display: block; font-size: 14px; color: var(--muted); }
label input, label textarea { margin-top: 6px; }
small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.error { color: var(--warn); font-size: 14px; min-height: 1em; margin: 4px 0; }
.error:empty { display: none; }

/* ---- auth ---- */
.auth { max-width: 560px; margin: 0 auto; padding: 110px 22px 60px; }
.stack > * + * { margin-top: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { border: 0; padding: 0; margin: 18px 0 0; }
legend { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.tiers { display: grid; gap: 10px; }
.tier {
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; color: var(--text);
}
.tier:has(input:checked) { border-color: var(--accent); background: #221c14; }
.tier input { width: auto; margin: 0; accent-color: var(--accent); }
.tier-name { font-weight: 600; }
.tier-price { color: var(--accent); font-size: 14px; }
.tier-summary { grid-column: 2 / 4; color: var(--muted); font-size: 13px; }
.switch { color: var(--muted); margin-top: 22px; }

/* ---- studio ---- */
.studio { max-width: 760px; margin: 0 auto; padding: 96px 22px calc(var(--dock-h) + 40px); }
.logout { position: fixed; top: 14px; right: 22px; font-size: 14px; color: var(--muted); }
.notice { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; color: var(--muted); }
.feed { display: grid; gap: 14px; }
.empty { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card header { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.card h2 { font-size: 17px; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.card .sub { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
.card p { margin: 10px 0 0; }
.chip { flex: none; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.card.ready .chip { background: #1f2c22; color: var(--ok); }
.card.needs_attention { border-color: #5a3a22; }
.card.needs_attention .chip { background: #33241a; color: var(--warn); }
.bar { height: 4px; background: var(--surface-2); border-radius: 4px; margin-top: 14px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .6s ease; }
.card.in_progress .bar span { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.media { display: block; width: 100%; max-height: 70vh; margin-top: 12px; border-radius: 12px; background: #000; }
.dl { display: inline-block; margin-top: 8px; color: var(--accent); font-size: 14px; }
.actions { display: flex; gap: 18px; align-items: center; margin-top: 14px; }
.changes, .card.needs_attention textarea { margin-top: 12px; }
.changes .primary, .card.needs_attention .primary { margin-top: 10px; }
.problem { color: var(--text); }

/* ---- dock: floating pills over the chat box ---- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.dock > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 15px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.35);
  transition: transform .15s ease, border-color .15s ease;
}
button.pill:hover { transform: translateY(-2px); border-color: var(--accent); }
.pill.pinned { border-color: #6b5634; }
.pill.ghost { color: var(--muted); border-style: dashed; box-shadow: none; }
.pill.tool { color: var(--muted); box-shadow: none; background: transparent; }
.pill.editing { padding-right: 8px; }
.mini { background: var(--surface-2); border: 0; border-radius: 999px; width: 26px; height: 26px; line-height: 1; padding: 0; }

.chat { display: flex; gap: 10px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 8px 8px 8px 16px; }
.chat textarea { background: transparent; border: 0; padding: 8px 0; resize: none; min-height: 24px; max-height: 140px; }
.chat textarea:focus-visible { outline: none; }
.chat:focus-within { border-color: var(--accent); }
.send { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 18px; }
.hint { color: var(--muted); font-size: 12px; text-align: center; margin: 8px auto 0; }
.flash { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin-bottom: 10px; }

.flow { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.flow-head { display: flex; align-items: center; gap: 12px; }
.flow-head .link { margin-left: auto; color: var(--muted); }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--accent); }
.flow-q { color: var(--text); font-size: 16px; margin: 14px 0 10px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; }
.choice.on { border-color: var(--accent); color: var(--accent); }
.flow-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }

@media (max-width: 560px) {
  .row { grid-template-columns: 1fr; }
  .brand { top: 14px; left: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
