:root {
  --bg: #EEF1EC;
  --surface: #FFFFFF;
  --surface-2: #E4E9E3;
  --ink: #1B231F;
  --muted: #5A6660;
  --line: #CDD5CE;
  --accent: #B7790A;
  --accent-ink: #FFFFFF;
  --danger: #B3261E;
  --danger-bg: #FBE9E7;
  --note-bg: #FFF4DB;
  --display: 'Lilita One', 'Arial Rounded MT Bold', 'Trebuchet MS', sans-serif;
  --body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111613; --surface: #1A211D; --surface-2: #232B26; --ink: #E6ECE7; --muted: #9BA69F;
    --line: #2F3933; --accent: #F0B429; --accent-ink: #1B1405; --danger: #F2867E; --danger-bg: #3A1D1A; --note-bg: #332A12;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111613; --surface: #1A211D; --surface-2: #232B26; --ink: #E6ECE7; --muted: #9BA69F;
  --line: #2F3933; --accent: #F0B429; --accent-ink: #1B1405; --danger: #F2867E; --danger-bg: #3A1D1A; --note-bg: #332A12;
}

body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--body); }
.page { max-width: 1120px; margin: 0 auto; padding-inline: 16px; padding-block: 24px 48px; }
h1, h2 { font-family: var(--display); font-weight: 400; letter-spacing: 0.01em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2rem, 6vw, 2.75rem); line-height: 1.05; }
h2 { font-size: 1.35rem; }
h3 { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0; }
p { margin: 0; }
.lede { color: var(--muted); max-width: 60ch; margin-top: 6px; }
.masthead { margin-bottom: 20px; }

.layout { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 820px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; }

.drop { display: grid; place-items: center; min-height: 150px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; overflow: hidden; text-align: center; padding: 12px; }
.drop.dragging, .drop:focus-within { border-color: var(--accent); }
.drop img { max-width: 100%; max-height: 260px; border-radius: 6px; }
.drop-hint { color: var(--muted); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.95rem; }
select, textarea, input[type="text"] { font: 400 1rem var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
textarea { font-family: var(--mono); font-size: 0.9rem; resize: vertical; }
input[type="file"] { font: 400 0.9rem var(--body); color: var(--muted); max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
button { font: 700 1rem var(--body); border-radius: 8px; padding: 12px 18px; cursor: pointer; border: 1px solid transparent; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.primary { background: var(--accent); color: var(--accent-ink); flex: 1; }
.secondary { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.status { color: var(--muted); min-height: 1.5em; }
.status.error { color: var(--danger); }
.errors { margin: 0; padding: 10px 14px 10px 30px; background: var(--danger-bg); color: var(--danger); border-radius: 8px; }

.meta { display: flex; flex-direction: column; gap: 10px; }
.meta:empty { display: none; }
.badge { align-self: flex-start; background: var(--note-bg); color: var(--ink); font-size: 0.85rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.note { font-size: 0.9rem; color: var(--muted); }
.callout { background: var(--note-bg); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs [role="tab"] { background: none; color: var(--muted); border-radius: 8px 8px 0 0; padding: 10px 14px; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabpanel { display: flex; flex-direction: column; gap: 16px; }
.tabpanel[hidden] { display: none; }
.summary { font-size: 1.05rem; max-width: 65ch; }
.muted { color: var(--muted); }
.block { display: flex; flex-direction: column; gap: 6px; }
.bullets { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.steps { margin: 0; padding-left: 26px; display: flex; flex-direction: column; gap: 12px; }
.steps li::marker { font-family: var(--display); color: var(--accent); }
.steps strong { display: block; }
.army { border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.mono { font-family: var(--mono); font-size: 0.88rem; overflow-wrap: anywhere; }

.chat { border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-log { display: flex; flex-direction: column; gap: 8px; }
.msg { padding: 10px 12px; border-radius: 8px; max-width: 90%; white-space: pre-wrap; }
.msg-user { align-self: flex-end; background: var(--surface-2); }
.msg-assistant { align-self: flex-start; background: var(--note-bg); }
.chat-row { display: flex; gap: 8px; }
.chat-row input { flex: 1; min-width: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.password { margin-bottom: 20px; max-width: 480px; }
.password-row { display: flex; gap: 8px; flex-wrap: wrap; }
.password-row input { flex: 1; min-width: 0; font: 400 1rem var(--body); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.password-row .primary { flex: 0 0 auto; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
body { margin: 0; }
