:root {
  --paper: #f4f1ea;
  --panel: #fffdf8;
  --sunken: #ece7dc;
  --ink: #1d1b16;
  --muted: #6f6a5e;
  --line: #e0d9c9;
  --accent: #d9472b;
  --accent-soft: #f6ddd4;
  --accent-ink: #ffffff;
  --ok: #3d7a4f;
  --shadow: 0 1px 2px rgb(40 30 10 / 0.06), 0 8px 24px rgb(40 30 10 / 0.06);
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14130f;
    --panel: #1c1b16;
    --sunken: #100f0c;
    --ink: #ece7da;
    --muted: #9a9383;
    --line: #2e2c25;
    --accent: #ff6a45;
    --accent-soft: #3a2119;
    --accent-ink: #1a0d08;
    --ok: #7cc48f;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; margin: 0; }

/* ---------- layout ---------- */

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) auto;
  height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 12px;
  gap: 14px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 8px;
  font-family: var(--serif); font-size: 17px; font-weight: 600; white-space: nowrap;
}
.brand-mark {
  width: 22px; height: 15px; border-radius: 3px; background: var(--accent); flex: none;
  position: relative;
}
/* speech-bubble tail: a right triangle hanging from the left of the bubble */
.brand-mark::after {
  content: ""; position: absolute; left: 5px; top: 14px; width: 0; height: 0;
  border-top: 7px solid var(--accent); border-right: 7px solid transparent;
}
.sidebar-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sidebar-actions .btn { flex: 1 1 auto; }
.deck-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.deck-list a {
  display: block; padding: 8px 10px; border-radius: 8px;
  color: inherit; text-decoration: none;
}
.deck-list a:hover { background: var(--sunken); }
.deck-list a.active { background: var(--panel); box-shadow: var(--shadow); }
.deck-list .deck-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-list .deck-meta { font-size: 12px; color: var(--muted); }
.conn { font-size: 12px; color: var(--muted); padding: 0 8px; display: flex; align-items: center; gap: 6px; }
.conn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.conn.down::before { background: var(--accent); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  min-height: 64px;
}
.topbar h1 {
  font-size: 20px; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.view { flex: 1; overflow-y: auto; min-height: 0; }

/* ---------- phase stepper ---------- */

.phases { display: flex; gap: 4px; background: var(--sunken); padding: 4px; border-radius: 999px; }
.phases a {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 8px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 500;
}
.phases a .num {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; border: 1px solid currentColor;
}
.phases a.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.phases a.active .num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--sunken); }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.icon { padding: 4px 7px; }
.btn.danger:hover { color: var(--accent); }

label.field { display: flex; flex-direction: column; gap: 6px; }
label.field > span:first-child { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.input, textarea.input, select.input {
  width: 100%;
  border: 1px solid var(--line); background: var(--panel);
  border-radius: 8px; padding: 9px 11px; outline: none;
  resize: vertical;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 40px; line-height: 1.5; }
textarea.code { font-family: var(--mono); font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; }

/* ---------- common content ---------- */

.page { max-width: 1040px; margin: 0 auto; padding: 28px; display: flex; flex-direction: column; gap: 28px; }
.section { display: flex; flex-direction: column; gap: 14px; }
.section-head { display: flex; align-items: baseline; gap: 12px; }
.section-head h2 { font-size: 22px; }
.section-head .hint { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.empty {
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 24px; text-align: center; color: var(--muted);
}

/* ---------- welcome ---------- */

.welcome { max-width: 640px; margin: 12vh auto; padding: 0 28px; display: flex; flex-direction: column; gap: 18px; }
.welcome h1 { font-size: 44px; line-height: 1.1; }
.welcome p { font-size: 16px; color: var(--muted); margin: 0; }
.welcome ol { margin: 0; padding-left: 20px; font-size: 15px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- gather ---------- */

.details { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.details .row { display: grid; grid-template-columns: 1fr 140px; gap: 16px; }

.ideas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.idea {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 6px 6px 4px;
}
.idea.dragging { opacity: 0.4; }
.grip { cursor: grab; color: var(--muted); padding: 8px 4px; user-select: none; line-height: 1; }
.idea textarea { border: 0; background: transparent; box-shadow: none !important; padding: 6px 4px; resize: none; }
.add-row { display: flex; gap: 8px; }

.assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.asset { overflow: hidden; display: flex; flex-direction: column; }
.asset .thumb { aspect-ratio: 4 / 3; background: var(--sunken) center / contain no-repeat; position: relative; }
.asset .thumb .btn { position: absolute; top: 6px; right: 6px; opacity: 0; }
.asset:hover .thumb .btn { opacity: 1; }
.asset input { border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none !important; }
.dropzone { transition: background 0.15s, border-color 0.15s; cursor: pointer; }
.dropzone.over { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }

/* ---------- toasts ---------- */

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--ink); color: var(--paper); padding: 9px 16px; border-radius: 8px; box-shadow: var(--shadow);
  transition: opacity 0.4s, transform 0.4s;
}
.toast.error { background: var(--accent); color: var(--accent-ink); }
.toast.leaving { opacity: 0; transform: translateY(8px); }

/* ---------- prepare ---------- */

.prepare { display: grid; grid-template-columns: 232px minmax(0, 1fr); height: 100%; }
.rail { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.rail-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.rail-head .hint { flex: 1; }
.rail-list { list-style: none; margin: 0; padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.rail-empty { font-size: 13px; padding: 16px; }
.rail-item { display: grid; grid-template-columns: 18px 1fr; gap: 6px; align-items: start; cursor: pointer; }
.rail-num { font-size: 11px; color: var(--muted); text-align: right; padding-top: 2px; font-variant-numeric: tabular-nums; }
.rail-item .thumb-box { border-radius: 6px; outline: 2px solid transparent; outline-offset: 2px; }
.rail-item:hover .thumb-box { outline-color: var(--line); }
.rail-item.selected .thumb-box { outline-color: var(--accent); }
.rail-item.selected .rail-num { color: var(--accent); font-weight: 700; }
.rail-item.skip .thumb-box { opacity: 0.4; }
.rail-item.dragging { opacity: 0.3; }

.thumb-box { aspect-ratio: 16 / 9; width: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--sunken); }

.prepare-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.subtabs { display: flex; gap: 2px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.subtabs button {
  border: 0; background: none; padding: 11px 14px; cursor: pointer; color: var(--muted); font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subtabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.pane { flex: 1; overflow-y: auto; min-height: 0; }
.pane.page { max-width: none; margin: 0; }

.slide-editor { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 1.25fr); gap: 24px; padding: 20px; align-items: start; }
.editor-fields { display: flex; flex-direction: column; gap: 14px; }
.editor-preview { position: sticky; top: 0; }
.preview-box { aspect-ratio: 16 / 9; width: 100%; display: flex; align-items: center; justify-content: center; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); background: var(--sunken); }
.no-selection { margin: 40px; }
.toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.insert-strip { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.insert-thumb {
  width: 54px; height: 40px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--sunken) center / cover no-repeat; cursor: pointer;
}
.insert-thumb:hover { border-color: var(--accent); }

@media (max-width: 1320px) {
  .slide-editor { grid-template-columns: minmax(0, 1fr); }
  .editor-preview { position: static; order: -1; }
}

/* ---------- style ---------- */

.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.template-card {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 8px 8px 10px;
  cursor: pointer;
}
.template-card .thumb-box { border-radius: 6px; margin-bottom: 6px; }
.template-card:hover { border-color: var(--muted); }
.template-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.template-name { font-weight: 600; text-transform: capitalize; }
.adjustments { padding: 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; }
.colors { display: flex; flex-direction: column; gap: 10px; }
.color-row { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; }
.color-row input[type="color"] { width: 36px; height: 28px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; background: var(--panel); }
.adjust-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
input[type="range"] { accent-color: var(--accent); }
.details-tab { display: flex; flex-direction: column; gap: 14px; max-width: 900px; }

/* ---------- chat ---------- */

.aside { width: 360px; border-left: 1px solid var(--line); min-height: 0; display: flex; }
.chat { display: flex; flex-direction: column; min-height: 0; width: 100%; background: var(--panel); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 0 12px 0 18px; height: 64px; border-bottom: 1px solid var(--line); flex: none; }
.chat-head strong { font-family: var(--serif); font-size: 18px; }
.chat-status { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-empty { color: var(--muted); padding: 12px 4px; }
.chat-empty strong { color: var(--ink); display: block; margin-bottom: 4px; }
.chat-empty p { margin: 0; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; overflow-wrap: anywhere; }
.msg p { margin: 0; }
.msg p + p, .msg p + ul, .msg ul + p { margin-top: 8px; }
.msg ul { margin: 0; padding-left: 18px; }
.msg code { font-family: var(--mono); font-size: 12px; background: var(--sunken); padding: 1px 4px; border-radius: 4px; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.user code { background: rgb(0 0 0 / 0.15); }
.msg.assistant { align-self: flex-start; background: var(--sunken); border-bottom-left-radius: 4px; }
.msg.streaming { opacity: 0.85; }
.msg.tool { align-self: flex-start; padding: 0 4px; font-size: 12px; color: var(--muted); display: flex; gap: 6px; }
.tool-icon { color: var(--ok); }
.msg.error { align-self: stretch; max-width: none; background: var(--accent-soft); color: var(--ink); font-size: 13px; border: 1px solid var(--accent); }
.msg.thinking { align-self: flex-start; background: var(--sunken); display: flex; gap: 4px; padding: 12px 14px; }
.msg.thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: pulse 1.2s infinite ease-in-out; }
.msg.thinking span:nth-child(2) { animation-delay: 0.15s; }
.msg.thinking span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.quick-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.quick-actions:empty { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.chip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.chip:disabled { opacity: 0.5; cursor: default; }
.chat-input { display: flex; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-input textarea { max-height: 200px; resize: none; }
.chat-buttons { display: flex; }

@media (max-width: 1180px) {
  .aside { width: 300px; }
  .shell { grid-template-columns: 200px minmax(0, 1fr) auto; }
  .brand { font-size: 14px; gap: 8px; }
}

/* ---------- present ---------- */

.launch { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.launch h2 { font-size: 28px; }
.launch p { margin: 4px 0 0; }
.launch-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.btn.big { padding: 12px 18px; font-size: 15px; }
.overview { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.overview-item { display: flex; flex-direction: column; gap: 6px; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.overview-item .thumb-box { border-radius: 8px; box-shadow: var(--shadow); outline: 2px solid transparent; outline-offset: 2px; }
.overview-item:hover .thumb-box { outline-color: var(--accent); }
.overview-meta { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes-flag { margin-left: 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.export-row { display: flex; gap: 8px; flex-wrap: wrap; }
a.btn { text-decoration: none; }

/* ---------- audience view ---------- */

.fullscreen { position: fixed; inset: 0; z-index: 50; background: #000; }
.show { position: absolute; inset: 0; background: #000; cursor: none; }
.show.pointer { cursor: default; }
.show-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.show-blank { position: absolute; inset: 0; background: #000; }
.show-counter {
  position: absolute; right: 16px; bottom: 12px; color: #fff; font: 12px var(--sans);
  opacity: 0; transition: opacity 0.2s; background: rgb(0 0 0 / 0.5); padding: 2px 8px; border-radius: 4px;
}
.show.pointer .show-counter { opacity: 0.8; }

/* auto-present: a quiet badge, so the audience isn't told what the software is doing */
.auto-badge {
  position: absolute; left: 16px; bottom: 12px; color: #fff; font: 12px var(--sans);
  background: rgb(0 0 0 / 0.5); padding: 2px 8px; border-radius: 4px; opacity: 0;
  transition: opacity 0.2s;
}
.show.pointer .auto-badge { opacity: 0.8; }

/* the public viewer's play button: out of the way until the visitor moves the pointer */
.show-play {
  position: absolute; left: 16px; bottom: 12px; opacity: 0; transition: opacity 0.2s;
  background: rgb(0 0 0 / 0.55); border-color: rgb(255 255 255 / 0.25); color: #fff;
}
.show.pointer .show-play, .show.reading .show-play { opacity: 0.9; }
.show-play:hover { opacity: 1; }

/* How far through this slide's narration we are — a hairline, not a chrome bar */
.show-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: rgb(255 255 255 / 0.15);
}
.show-progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.25s linear; }
.narration-progress { width: 90px; height: 4px; border-radius: 2px; background: #333; overflow: hidden; }
.narration-progress.wide { width: 160px; background: var(--sunken); }
.narration-row { gap: 12px; align-items: center; margin-top: 4px; }
.narration-progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.25s linear; }

/* Phones: a finger needs a real target, and a tap shouldn't zoom or flash. */
.show { touch-action: manipulation; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
@media (pointer: coarse), (max-width: 620px) {
  .show-play { min-height: 44px; padding: 10px 16px; font-size: 15px; opacity: 0.9; }
  .show-counter { font-size: 14px; padding: 4px 10px; }
  .show-notice { font-size: 14px; left: 8px; right: 8px; transform: none; max-width: none; }
  .show-hint { font-size: 13px; }
}

/* "this browser can't do it justice" — readable over any slide, dismissible */
.show-notice {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; max-width: min(640px, 90vw);
  background: rgb(0 0 0 / 0.78); color: #fff; font: 13px/1.45 var(--sans);
  padding: 10px 12px; border-radius: 8px; border: 1px solid rgb(255 255 255 / 0.18);
}
.show-notice .btn.tiny {
  background: transparent; border-color: rgb(255 255 255 / 0.3); color: #fff;
  font-size: 11px; padding: 3px 8px; flex: none;
}

/* ---------- presenter view ---------- */

.presenter { position: absolute; inset: 0; display: flex; flex-direction: column; background: #111; color: #eee; font-family: var(--sans); }
.presenter .btn { background: #222; border-color: #333; color: #eee; }
.presenter .btn:hover { border-color: #666; }
.presenter .btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0d08; }
.presenter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; border-bottom: 1px solid #262626; }
.presenter-bar .spacer { flex: 1; }
.presenter-counter { color: #aaa; }
.presenter-clock { font: 600 26px/1 var(--mono); font-variant-numeric: tabular-nums; }
.presenter-clock.over { color: #ff6a45; }
.presenter-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 20px; padding: 20px; min-height: 0; }
.presenter-main { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.presenter-current { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.presenter-nav { display: flex; justify-content: center; gap: 10px; }
.presenter-side { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.presenter-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #888; font-weight: 600; }
.presenter-next { aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; opacity: 0.85; }
.presenter-notes { flex: 1; overflow-y: auto; font-size: 20px; line-height: 1.5; background: #1a1a1a; border-radius: 10px; padding: 14px 18px; }
.presenter-notes p { margin: 0 0 10px; }
.presenter-notes.muted { color: #666; font-style: italic; }
/* stage directions: shown to the presenter, never read aloud */
.presenter-notes .notes-aside { color: #8a8a8a; font-style: italic; font-size: 0.85em; }
.auto-card .launch-buttons { margin-bottom: 14px; }

/* ---------- settings ---------- */

.sidebar-foot { display: flex; flex-direction: column; gap: 8px; }
.sidebar-link { color: var(--muted); text-decoration: none; padding: 6px 8px; border-radius: 8px; }
.sidebar-link:hover { background: var(--sunken); color: var(--ink); }
.sidebar-link.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.welcome-head h1 { font-size: 34px; }
.welcome-head p { margin: 4px 0 0; }
.hint.block { display: block; }
.switch-row { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; cursor: pointer; }
.switch-row input, .server-head input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; margin-top: 2px; flex: none; }
.server { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.server-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.server-head .spacer { flex: 1; }
.server-name { font-size: 15px; }
.badge { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.server-command { font-family: var(--mono); font-size: 12px; background: var(--sunken); padding: 6px 8px; border-radius: 6px; overflow-wrap: anywhere; }
.server-status { font-size: 13px; color: var(--muted); }
.server-status.ok strong { color: var(--ok); }
.server-status.bad strong { color: var(--accent); }
.server-status.off { font-style: italic; }
.server-hint { margin-top: 6px; padding: 8px 10px; border-radius: 6px; background: var(--accent-soft); color: var(--ink); }
.tool-list { color: var(--muted); }
.editor-help { align-self: end; padding-bottom: 10px; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.preset { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px 14px; cursor: pointer; }
.preset:hover:not(:disabled) { border-color: var(--accent); }
.preset:disabled { opacity: 0.55; cursor: default; }
.web-badge { font-size: 11px; color: var(--ok); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.web-badge.off { color: var(--muted); }
.guidance { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.guidance p { margin: 0; }
.guidance-examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------- auth ---------- */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 22px; }
.auth-card .brand { padding: 0; justify-content: center; }
.auth-form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.auth-form h1 { font-size: 26px; }
.auth-form p { margin: 0; }
.auth-form .btn.big { margin-top: 4px; }
.auth-error { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 8px; padding: 9px 12px; }
.auth-links { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; font-size: 13px; }
.auth-links a { color: var(--muted); }
.auth-links a:hover { color: var(--accent); }
.hint.bad, .bad { color: var(--accent); }

/* ---------- user menu ---------- */

.user-menu { display: flex; flex-direction: column; gap: 2px; }
.user-row { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.user-chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; color: inherit; text-decoration: none; }
.user-chip:hover, .user-chip.active { background: var(--sunken); }
.avatar { width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.user-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- account & admin ---------- */

.page.narrow { max-width: 680px; }
.page.wide { max-width: 1180px; }
.card.pad { padding: 16px 18px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack-form { display: flex; flex-direction: column; gap: 14px; }
.admin-body { display: flex; flex-direction: column; gap: 20px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.user-cell { display: flex; flex-direction: column; gap: 2px; }
.badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.badge.accent { color: var(--ok); border-color: var(--ok); }
.badge.bad { color: var(--accent); border-color: var(--accent); }
.invite-form { display: flex; flex-direction: column; gap: 12px; }
.invite-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.invite-created { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.big-code { font-family: var(--mono); font-size: 22px; letter-spacing: 0.08em; display: block; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.stat strong { font-size: 26px; font-family: var(--serif); }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 110px; gap: 10px; align-items: center; font-size: 12px; }
.bar-track { background: var(--sunken); border-radius: 4px; height: 10px; overflow: hidden; }
.bar { background: var(--accent); height: 100%; border-radius: 4px; min-width: 2px; }
.bar-row .num { text-align: right; font-variant-numeric: tabular-nums; }
select.input.inline { width: auto; }

/* ---------- presentation menu ---------- */

.topbar-actions { position: relative; }
.menu-toggle { font-size: 20px; line-height: 1; padding: 2px 10px 6px; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 170px; padding: 6px; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.menu-panel.confirm { width: 300px; padding: 14px; gap: 8px; }
.menu-panel.confirm p { margin: 0; }
.menu-item { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu-item:hover { background: var(--sunken); }
.menu-item.danger { color: var(--accent); }
.btn.danger-solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* ---------- segmented control (logo corner) ---------- */

.field-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
div.field { display: flex; flex-direction: column; gap: 6px; }
.segmented { display: inline-flex; gap: 4px; background: var(--sunken); padding: 4px; border-radius: 8px; width: fit-content; }
.segmented button { width: 40px; height: 30px; border: 1px solid transparent; background: none; border-radius: 6px; cursor: pointer; display: grid; place-items: center; }
.segmented button.active { background: var(--panel); border-color: var(--line); box-shadow: var(--shadow); }
.segmented button:disabled { opacity: 0.4; cursor: default; }
.corner-icon { width: 22px; height: 14px; border: 1.5px solid var(--muted); border-radius: 2px; position: relative; }
.corner-icon::after { content: ""; position: absolute; width: 6px; height: 4px; background: var(--muted); }
.segmented button.active .corner-icon { border-color: var(--accent); }
.segmented button.active .corner-icon::after { background: var(--accent); }
.corner-icon.top-left::after { top: 1.5px; left: 1.5px; }
.corner-icon.top-right::after { top: 1.5px; right: 1.5px; }
.corner-icon.bottom-left::after { bottom: 1.5px; left: 1.5px; }
.corner-icon.bottom-right::after { bottom: 1.5px; right: 1.5px; }

/* ---------- gather: images referenced but not uploaded ---------- */

.missing-images { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.missing-images p { margin: 0; }
.missing-images ul { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.missing-images code { font-family: var(--mono); font-size: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }

/* ---------- public viewer (/show/<slug>) ---------- */

body.public { background: #000; }
body.public .show { position: fixed; inset: 0; }
.show-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  color: #fff; font: 12px var(--sans); background: rgb(0 0 0 / 0.5); padding: 3px 10px; border-radius: 999px;
  opacity: 0; transition: opacity 0.3s;
}
.show.pointer .show-hint { opacity: 0.75; }
.show-hint.gone { display: none; }

/* ---------- share (present phase) ---------- */

.share { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.share-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.share-row .input { flex: 1; min-width: 220px; }
.public-link { font-family: var(--mono); font-size: 12px; }

/* ---------- reference material ---------- */

.sources { display: flex; flex-direction: column; gap: 10px; }
.source { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.source.pending { opacity: 0.6; }
.source-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.source-head .spacer { flex: 1; }
.source-name { color: inherit; font-weight: 600; }
.source-name:hover { color: var(--accent); }

/* ---------- google fonts picker ---------- */

.google-fonts { gap: 8px; }
.font-results { display: flex; flex-direction: column; gap: 4px; }
.font-result { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.font-result .spacer { flex: 1; }
.font-result > span:first-child { font-size: 15px; }
.font-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.font-chips:empty { display: none; }
.font-chip { display: inline-flex; align-items: stretch; }
.font-chip .chip:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.font-chip .small-chip { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; font-size: 11px; color: var(--muted); }
