/* Game Studio (public service). Follows the Game Studio monochrome language: black app bar, icon Dock,
   white surfaces, bold sans headings, 2px black card outlines, pill buttons and chips.
   Hover rules: selectable = black, display-only = grey (#f4f4f4); in the Dock hover = blue, selected = black. */
:root {
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --black: #000; --ink: #0b0b0b; --ink-2: #2b2b2b; --muted: #666; --faint: #9b9b9b;
  --line: #e2e2e2; --line-2: #cfcfcf; --surface: #fff; --soft: #f4f4f4; --soft-2: #ececec;
  --active: #2563eb; --active-tint: #f1f6ff; --active-ring: rgba(37, 99, 235, .24);
  --danger: #b42318; --danger-soft: #fef3f2; --warn: #8a5300; --warn-soft: #fff6e6; --ok: #0a6b39; --ok-soft: #edfaf2;
  --radius: 16px; --radius-sm: 10px; --pill: 999px;
  --appbar-h: 64px; --rail-w: 76px; --rail-open: 248px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .14);
  --ease: cubic-bezier(.2, .8, .2, 1); --quick: .12s; --glide: .18s;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--surface); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.02em; }
h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--active-ring); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Icons (line icons as CSS masks) ---------- */
.icon { display: inline-block; width: 22px; height: 22px; flex: none; background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 28px; height: 28px; }

/* ---------- Buttons, chips, fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 18px;
  border: 2px solid var(--black); border-radius: var(--pill); background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--quick) var(--ease), color var(--quick) var(--ease), transform var(--quick) var(--ease); }
.btn:hover { background: var(--black); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--black); color: #fff; }
.btn.primary:hover { background: #262626; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--black); color: #fff; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.lg { min-height: 52px; padding: 0 26px; font-size: 16px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1.5px solid var(--line-2); border-radius: var(--pill);
  font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.chip.dark { background: var(--black); border-color: var(--black); color: #fff; }
.chip.ok { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.chip.warn { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.chip.blue { border-color: var(--active); color: var(--active); background: var(--active-tint); }
button.chip { cursor: pointer; }
button.chip:hover, button.chip[aria-pressed="true"] { background: var(--black); border-color: var(--black); color: #fff; }

.field { display: grid; gap: 6px; }
.field > span, .field-label { font-size: 13px; font-weight: 700; }
.field small, .hint { color: var(--muted); font-size: 13px; }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border: 2px solid var(--line-2); border-radius: 12px; background: var(--surface);
  transition: border-color var(--quick) var(--ease), box-shadow var(--quick) var(--ease); }
.field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--active); box-shadow: 0 0 0 4px var(--active-ring); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13px; font-weight: 600; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--black); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Text that would be cut off scrolls into view on hover (Game Studio rule: never hide text). */
.reveal { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reveal.revealing { text-overflow: clip; }
.reveal > .reveal-inner { display: inline-block; transition: transform var(--glide) linear; }

/* ---------- Cards ---------- */
.card { border: 2px solid var(--black); border-radius: var(--radius); background: var(--surface); padding: 20px; }
.card.soft { border-color: var(--line); }
.card.tight { padding: 14px; }
.panel { border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--surface); }
.display:hover { background: var(--soft); }

/* ---------- App shell ---------- */
.appbar { position: fixed; inset: 0 0 auto 0; height: var(--appbar-h); z-index: 40; display: flex; align-items: center; gap: 16px;
  padding: 0 18px 0 0; background: var(--black); color: #fff; }
.appbar-brand { display: flex; align-items: center; gap: 12px; width: var(--rail-w); justify-content: center; text-decoration: none; flex: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #fff; color: #000; font-weight: 900; font-size: 15px; letter-spacing: -.04em; }
.appbar-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.appbar-title strong { font-size: 15px; letter-spacing: -.01em; }
.appbar-title small { color: #bdbdbd; font-size: 12px; max-width: 40vw; }
.appbar-search { flex: 1; max-width: 460px; margin-left: auto; position: relative; }
.appbar-search input { width: 100%; height: 40px; padding: 0 14px 0 40px; border-radius: var(--pill); border: 1.5px solid #333; background: #111; color: #fff; }
.appbar-search input::placeholder { color: #8a8a8a; }
.appbar-search input:focus { outline: none; border-color: #fff; }
.appbar-search .icon { position: absolute; left: 13px; top: 9px; color: #8a8a8a; }
.search-results { position: absolute; top: 46px; left: 0; right: 0; background: #fff; color: var(--ink); border: 2px solid var(--black); border-radius: 14px;
  box-shadow: var(--shadow); padding: 6px; max-height: 60vh; overflow: auto; }
.search-results a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; text-decoration: none; }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--black); color: #fff; }
.search-results .muted { color: var(--muted); font-size: 12px; margin-left: auto; }
.search-results a:hover .muted, .search-results a[aria-selected="true"] .muted { color: #ccc; }
.account { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border: 1.5px solid #333; border-radius: var(--pill);
  background: transparent; color: #fff; cursor: pointer; }
.account:hover { border-color: #fff; }
.account-name { font-weight: 700; font-size: 13px; max-width: 160px; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: #fff; color: #000;
  font-weight: 800; font-size: 14px; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 28px; }
.avatar.ring { box-shadow: 0 0 0 2px var(--black); }
.menu { position: absolute; z-index: 60; min-width: 220px; background: #fff; color: var(--ink); border: 2px solid var(--black); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; }
.menu button, .menu a { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 12px; border: 0; border-radius: 10px; background: none; text-align: left; text-decoration: none; cursor: pointer; font-weight: 600; }
.menu button:hover, .menu a:hover { background: var(--black); color: #fff; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu .menu-head { padding: 8px 12px 10px; font-size: 13px; color: var(--muted); }

/* Dock: icon rail that glides open on hover. Hover = blue, selected Studio = black. */
.dock { position: fixed; z-index: 30; top: var(--appbar-h); bottom: 0; left: 0; width: var(--rail-w); padding: 12px 10px; display: flex; flex-direction: column; gap: 2px;
  background: rgba(255, 255, 255, .74); -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px); border-right: 2px solid var(--black);
  overflow: hidden auto; transition: width var(--glide) var(--ease), box-shadow var(--glide) var(--ease); scrollbar-width: none; }
.dock::-webkit-scrollbar { display: none; }
.dock.open { width: var(--rail-open); box-shadow: var(--shadow); }
.dock-label { position: relative; flex: none; height: 30px; padding: 12px 14px 0; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.dock-label span { opacity: 0; transition: opacity var(--quick); }
.dock.open .dock-label span { opacity: 1; }
/* Closed: a thin rule stands in for the label, in the same space, so nothing moves when the Dock opens. */
.dock-label::after { content: ""; position: absolute; left: 14px; right: 14px; top: 18px; height: 1px; background: var(--line); transition: opacity var(--quick); }
.dock.open .dock-label::after { opacity: 0; }
.dock-label:first-child::after { display: none; }
.dock a, .dock button { display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 15px; border-radius: 12px; border: 0; background: none;
  text-decoration: none; color: var(--ink); font-weight: 700; font-size: 14px; white-space: nowrap; cursor: pointer; flex: none; position: relative; }
.dock a .dock-text, .dock button .dock-text { opacity: 0; transition: opacity var(--quick); }
.dock.open a .dock-text, .dock.open button .dock-text { opacity: 1; }
.dock a:hover, .dock button:hover { background: var(--active); color: #fff; }
.dock a:hover .icon, .dock button:hover .icon { animation: dock-bounce .32s var(--ease); }
.dock a[aria-current="page"] { background: var(--black); color: #fff; }
.dock .dock-count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--faint); opacity: 0; }
.dock.open .dock-count { opacity: 1; }
.dock a:hover .dock-count, .dock a[aria-current="page"] .dock-count { color: #cfcfcf; }
.dock-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 8px; }
@keyframes dock-bounce { 0% { transform: translateY(0); } 40% { transform: translateY(-4px); } 100% { transform: translateY(0); } }

.main { margin-left: var(--rail-w); padding: calc(var(--appbar-h) + 28px) clamp(16px, 4vw, 44px) 80px; max-width: 1480px; }
.page-head { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 26px; }
.page-head > div:first-child { flex: 1; min-width: 260px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.lede { color: var(--muted); font-size: 16px; margin-top: 8px; max-width: 720px; }
.section { margin-top: 34px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.section-head .hint { margin-left: auto; }
@media (max-width: 760px) {
  .appbar-search { display: none; }
  .dock { width: 0; padding: 0; border: 0; }
  .dock.open { width: var(--rail-open); padding: 12px 10px; border-right: 2px solid var(--black); }
  .main { margin-left: 0; }
  .appbar .mobile-dock-toggle { display: inline-flex; }
  .appbar .save-state, .appbar .account-name { display: none; }
  .appbar-brand { width: 60px; }
  .appbar { gap: 8px; }
  .account { padding: 4px; }
}
.mobile-dock-toggle { display: none; }

/* ---------- Toasts & dialogs ---------- */
.toasts { position: fixed; z-index: 90; right: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast { background: var(--black); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); max-width: 380px; animation: toast-in .22s var(--ease); }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.save-state { font-size: 12px; font-weight: 700; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.save-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.save-state[data-state="saving"]::before { background: var(--warn); }
.save-state[data-state="error"]::before { background: var(--danger); }
.save-state[data-state="error"] { color: var(--danger); }
dialog.modal { border: 2px solid var(--black); border-radius: 20px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow); color: var(--ink); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .4); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal-body { padding: 26px; display: grid; gap: 16px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 26px 24px; flex-wrap: wrap; }

/* ---------- Home ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 980px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { border: 2px solid var(--black); border-radius: var(--radius); padding: 18px; display: grid; gap: 4px; text-decoration: none; transition: background var(--quick); }
.stat:hover { background: var(--black); color: #fff; }
.stat:hover .stat-note { color: #cfcfcf; }
.stat-top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.stat-value { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.stat-note { color: var(--muted); font-size: 13px; }
.stat.dark { background: var(--black); color: #fff; }
.stat.dark .stat-note { color: #cfcfcf; }
.progress { height: 10px; border-radius: var(--pill); background: var(--soft-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--black); border-radius: inherit; transition: width .4s var(--ease); }
.stat.dark .progress { background: #333; } .stat.dark .progress > span { background: #fff; }
.checklist { display: grid; gap: 8px; }
.checklist a { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; text-decoration: none; transition: border-color var(--quick), background var(--quick); }
.checklist a:hover { border-color: var(--black); background: var(--black); color: #fff; }
.checklist a:hover .hint { color: #cfcfcf; }
.tick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; flex: none; font-size: 13px; font-weight: 900; }
.done .tick { background: var(--black); border-color: var(--black); color: #fff; }
.checklist a:hover .tick { border-color: #fff; }
.studio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.studio-card { display: grid; gap: 10px; padding: 18px; border: 2px solid var(--black); border-radius: var(--radius); text-decoration: none; transition: background var(--quick), color var(--quick); min-height: 132px; }
.studio-card:hover { background: var(--black); color: #fff; }
.studio-card:hover .hint { color: #cfcfcf; }
.studio-card .icon-box { width: 44px; height: 44px; border-radius: 12px; border: 2px solid currentColor; display: grid; place-items: center; }
.activity { display: grid; gap: 2px; }
.activity-row { display: flex; gap: 10px; align-items: baseline; padding: 10px 12px; border-radius: 10px; }
.activity-row:hover { background: var(--soft); }
.activity-row time { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---------- Capsule library ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .input { max-width: 320px; min-height: 40px; border-radius: var(--pill); }
.capsules { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.capsule { position: relative; display: grid; grid-template-rows: auto 1fr; border: 2px solid var(--black); border-radius: var(--radius); overflow: hidden; background: var(--surface);
  text-decoration: none; cursor: pointer; transition: transform var(--quick) var(--ease), box-shadow var(--quick) var(--ease); text-align: left; padding: 0; }
.capsule:hover { box-shadow: 0 0 0 2px var(--black); }
.capsule[aria-selected="true"] { box-shadow: 0 0 0 3px var(--active); border-color: var(--active); }
.capsule.dragging { opacity: .4; }
.capsule.drop-before { box-shadow: -6px 0 0 -2px var(--active); }
.capsule-thumb { aspect-ratio: 16 / 10; background: var(--soft); display: grid; place-items: center; border-bottom: 2px solid var(--black); overflow: hidden; color: var(--faint); }
.capsule-thumb img, .capsule-thumb video { width: 100%; height: 100%; object-fit: cover; }
.capsule-thumb .initial { font-size: 42px; font-weight: 900; color: var(--ink); letter-spacing: -.04em; }
.capsule-body { padding: 12px 14px 14px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.capsule-body h3 { font-size: 15px; }
.capsule-body p { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.capsule-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.capsule.new { border-style: dashed; place-items: center; grid-template-rows: 1fr; min-height: 200px; color: var(--muted); font-weight: 700; }
.capsule.new:hover { background: var(--black); color: #fff; border-style: solid; }
.capsule.new .plus { font-size: 34px; line-height: 1; font-weight: 300; }
.empty { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 36px; text-align: center; display: grid; gap: 12px; justify-items: center; color: var(--muted); }
.empty h3 { color: var(--ink); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); gap: 22px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.inspector { position: sticky; top: calc(var(--appbar-h) + 20px); border: 2px solid var(--black); border-radius: var(--radius); background: var(--surface); max-height: calc(100vh - var(--appbar-h) - 40px); overflow: auto; }
.inspector-head { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 16px 18px 12px; border-bottom: 2px solid var(--line); display: flex; gap: 10px; align-items: center; }
.inspector-head h2 { font-size: 18px; flex: 1; min-width: 0; }
.inspector-body { padding: 18px; display: grid; gap: 16px; }
.inspector-foot { padding: 0 18px 18px; display: flex; gap: 10px; flex-wrap: wrap; }

/* Lists inside forms */
.list-editor { display: grid; gap: 8px; }
.list-editor .list-row { display: flex; gap: 8px; align-items: flex-start; }
.list-editor .list-row input, .list-editor .list-row textarea { flex: 1; min-height: 40px; padding: 8px 12px; border: 2px solid var(--line-2); border-radius: 10px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; border: 2px solid var(--line-2); background: #fff; cursor: pointer; font-weight: 800; }
.icon-btn:hover { background: var(--black); color: #fff; border-color: var(--black); }
.image-field { display: flex; gap: 12px; align-items: center; }
.image-field .preview { width: 96px; height: 96px; border-radius: 14px; border: 2px solid var(--line-2); background: var(--soft) center / cover no-repeat; flex: none; display: grid; place-items: center; color: var(--faint); font-size: 12px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-2); cursor: pointer; }
.swatch[aria-pressed="true"] { border-color: var(--black); box-shadow: 0 0 0 2px #fff inset; }

/* ---------- Character editor (Main Character, Companions, NPCs) ---------- */
.char-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.portrait { width: 96px; height: 96px; border-radius: 22px; border: 2px solid var(--black); background: var(--soft) center / cover no-repeat; display: grid; place-items: center; font-size: 40px; font-weight: 900; flex: none; overflow: hidden; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 2px solid var(--black); margin-bottom: 22px; }
.tabs button { border: 2px solid transparent; border-bottom: 0; background: none; padding: 10px 16px; border-radius: 12px 12px 0 0; font-weight: 700; cursor: pointer; margin-bottom: -2px; display: inline-flex; gap: 8px; align-items: center; }
.tabs button:hover { background: var(--black); color: #fff; }
.tabs button[aria-selected="true"] { border-color: var(--black); background: #fff; color: var(--ink); border-bottom: 2px solid #fff; }
.tabs .count { font-size: 12px; color: var(--muted); }
.viewer-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .viewer-wrap { grid-template-columns: 1fr; } }
.viewer { position: relative; aspect-ratio: 4 / 3; border: 2px solid var(--black); border-radius: var(--radius); overflow: hidden; background: radial-gradient(circle at 50% 35%, #fff, #e9e9e9); }
.viewer canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.viewer-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); gap: 12px; align-content: center; }
.viewer-bar { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; gap: 8px; align-items: center; background: rgba(255, 255, 255, .86); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border: 2px solid var(--black); border-radius: var(--pill); padding: 6px 8px 6px 14px; }
.viewer-bar input[type=range] { flex: 1; accent-color: var(--black); }
.viewer-bar .time { font: 12px var(--mono); min-width: 88px; text-align: right; }
.viewer-status { position: absolute; top: 12px; left: 12px; }
.anim-list { display: grid; gap: 6px; }
.anim-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff; text-align: left; width: 100%; }
.anim-row:hover { border-color: var(--black); background: var(--black); color: #fff; }
.anim-row:hover .hint { color: #cfcfcf; }
.anim-row[aria-pressed="true"] { border-color: var(--active); box-shadow: 0 0 0 2px var(--active-ring); }
.anim-row .meta { margin-left: auto; white-space: nowrap; flex: none; font: 12px var(--mono); color: var(--muted); }
.anim-row:hover .meta { color: #cfcfcf; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.slot { border: 2px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; }
.slot:hover { background: var(--soft); }
.slot.filled { border-color: var(--black); }
.slot select { min-height: 38px; border: 2px solid var(--line-2); border-radius: 10px; padding: 6px 10px; background: #fff; }

/* ---------- Onboarding ---------- */
.onboarding { min-height: 100vh; display: grid; grid-template-columns: minmax(280px, 380px) 1fr; }
@media (max-width: 900px) { .onboarding { grid-template-columns: 1fr; } .ob-side { display: none !important; } }
.ob-side { background: var(--black); color: #fff; padding: 36px 32px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; }
.ob-side .brand { display: flex; gap: 12px; align-items: center; font-weight: 800; }
.ob-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ob-steps li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; color: #8f8f8f; font-weight: 700; }
.ob-steps li .tick { border-color: #444; }
.ob-steps li.current { color: #fff; background: #1a1a1a; }
.ob-steps li.current .tick { border-color: #fff; }
.ob-steps li.done { color: #d4d4d4; }
.ob-steps li.done .tick { background: #fff; border-color: #fff; color: #000; }
.ob-side .credit { margin-top: auto; color: #8f8f8f; font-size: 12px; }
.ob-main { padding: clamp(24px, 6vw, 72px); display: grid; align-content: start; justify-items: start; }
.ob-panel { width: min(720px, 100%); display: grid; gap: 22px; animation: ob-in .3s var(--ease); }
@keyframes ob-in { from { opacity: 0; transform: translateY(10px); } }
.ob-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.choice { border: 2px solid var(--line-2); border-radius: 14px; padding: 14px; background: #fff; cursor: pointer; text-align: left; display: grid; gap: 4px; font-weight: 700; }
.choice small { font-weight: 500; color: var(--muted); }
.choice:hover { border-color: var(--black); background: var(--black); color: #fff; }
.choice:hover small { color: #cfcfcf; }
.choice[aria-pressed="true"] { border-color: var(--black); box-shadow: 0 0 0 2px var(--black); }
.avatar-choices { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.avatar-choice { border: 2px solid var(--line-2); border-radius: 50%; padding: 3px; background: #fff; cursor: pointer; }
.avatar-choice:hover { border-color: var(--black); }
.avatar-choice[aria-pressed="true"] { border-color: var(--black); box-shadow: 0 0 0 2px var(--black); }
.companion-rows { display: grid; gap: 10px; }
.companion-row { display: grid; grid-template-columns: 1fr 190px 40px; gap: 10px; align-items: center; }
@media (max-width: 640px) { .companion-row { grid-template-columns: 1fr; } }

/* ---------- Game Draft ---------- */
.draft-doc { border: 2px solid var(--black); border-radius: var(--radius); padding: clamp(22px, 4vw, 48px); background: #fff; display: grid; gap: 28px; }
.draft-doc h2 { font-size: 24px; border-bottom: 2px solid var(--black); padding-bottom: 8px; }
.draft-doc h3 { font-size: 17px; margin-bottom: 6px; }
.draft-doc .muted { color: var(--muted); }
.draft-doc dl { display: grid; grid-template-columns: 170px 1fr; gap: 6px 16px; margin: 0; }
.draft-doc dt { font-weight: 700; color: var(--muted); }
.draft-doc dd { margin: 0; white-space: pre-wrap; }
.draft-doc .entry { border-left: 3px solid var(--black); padding-left: 14px; display: grid; gap: 6px; }
.draft-title { display: grid; gap: 8px; }
.draft-title h1 { font-size: clamp(32px, 5vw, 52px); }
.missing { color: var(--warn); font-weight: 600; }
@media print {
  .appbar, .dock, .no-print, .toasts { display: none !important; }
  .main { margin: 0; padding: 0; }
  .draft-doc { border: 0; padding: 0; }
}

/* ---------- About ---------- */
.about-credit { font-size: 17px; line-height: 1.55; }
.about-mark { display: flex; gap: 14px; align-items: center; }

/* Bare pages (onboarding) take the whole window. */
.bare .main, .main.ob-host { margin: 0; padding: 0; max-width: none; }
.viewer-status { right: 12px; } .viewer-status .chip { white-space: normal; max-width: 100%; }

#main:focus { outline: none; }
