:root { color-scheme: light; }
@font-face { font-family: Inter; src: url(/fonts/inter.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url(/fonts/inter-tight.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --brand: #ff6b35; --brand-dark: #d94f1d; --navy: #14213d;
  --ui-bg: #f5f4f1; --ui-surface: #fff; --ui-line: #e4e2dc; --ui-text: #23262f; --ui-muted: #6b6f7b;
  --shadow: 0 1px 3px rgba(20, 33, 61, .14);
  --shadow-lg: 0 8px 28px rgba(20, 33, 61, .16);
  --card-bg: #fff; --ink: #14213d; --accent: #0f766e; --cover-bg: #cdeee6;
  --art-a: #0f766e; --art-b: #14213d; --art-c: #7dd3c0;
  --font-head: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
[data-theme="harbor"]   { --card-bg:#fff; --ink:#14213d; --accent:#0f766e; --cover-bg:#cdeee6; --art-a:#0f766e; --art-b:#14213d; --art-c:#7dd3c0; }
[data-theme="ember"]    { --card-bg:#fffaf5; --ink:#3b1d0f; --accent:#d94f1d; --cover-bg:#ffe0cc; --art-a:#ff6b35; --art-b:#7a1f0c; --art-c:#ffc48a; }
[data-theme="midnight"] { --card-bg:#141a2e; --ink:#eef1fb; --accent:#7cc4ff; --cover-bg:#1f2946; --art-a:#2b4c9b; --art-b:#0a0f1f; --art-c:#7cc4ff; }
[data-theme="paper"]    { --card-bg:#fbf8f0; --ink:#2c2a26; --accent:#8a5a2b; --cover-bg:#efe6d2; --art-a:#b08d57; --art-b:#4a3b28; --art-c:#e8d9b5; --font-head:Georgia,"Times New Roman",serif; --font-body:Georgia,"Times New Roman",serif; }
[data-theme="moss"]     { --card-bg:#f6f8f1; --ink:#1f2b1c; --accent:#4d7c2f; --cover-bg:#dbe8c8; --art-a:#4d7c2f; --art-b:#1f3a1a; --art-c:#b7d58f; }
[data-theme="citrus"]   { --card-bg:#fffdf0; --ink:#2b2a10; --accent:#b58900; --cover-bg:#fff0a8; --art-a:#f5b700; --art-b:#e0561b; --art-c:#fff3b0; }
[data-theme="graphite"] { --card-bg:#1d1e22; --ink:#f1f1f3; --accent:#ff6b35; --cover-bg:#2a2b31; --art-a:#4b4d57; --art-b:#111216; --art-c:#ff6b35; }
[data-theme="blush"]    { --card-bg:#fff7f8; --ink:#3d1a26; --accent:#c2336a; --cover-bg:#fbd9e3; --art-a:#e0527f; --art-b:#5c1a3a; --art-c:#ffc2d1; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ui-bg); color: var(--ui-text); font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
@layer base {
  button, input, textarea, select { font: inherit; color: inherit; }
  button { cursor: pointer; border: 0; background: none; }
}
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; background: var(--ui-surface); border-radius: 6px; box-shadow: var(--shadow); white-space: nowrap; }
.chip:hover { background: #fbfaf8; }
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; background: var(--navy); color: #fff; border-radius: 6px; font-weight: 600; }
.btn-primary:hover { background: #1e3160; }
.btn-primary:disabled { opacity: .55; cursor: wait; }

/* Top bar */
.topbar { position: fixed; inset: 0 0 auto 0; z-index: 30; display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.crumb { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; background: var(--ui-surface); border-radius: 6px; box-shadow: var(--shadow); min-width: 0; }
.crumb a { display: flex; color: var(--ui-text); }
.crumb input { border: 0; background: none; width: 220px; max-width: 34vw; color: var(--ui-muted); outline: none; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.present-split { display: inline-flex; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow); }
.present-split button { height: 38px; background: var(--brand); color: #fff; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; }
.present-split button:hover { background: var(--brand-dark); }
.present-split button + button { padding: 0 10px; border-left: 1px solid rgba(255, 255, 255, .35); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }

/* Canvas */
.canvas { padding: 84px 340px 120px 300px; min-height: 100vh; background: var(--ui-bg); }
.card-wrap { max-width: 1240px; margin: 0 auto; }
.card { position: relative; background: var(--card-bg); color: var(--ink); border-radius: 14px; box-shadow: 0 1px 2px rgba(20, 33, 61, .1); overflow: hidden; border: 2px solid transparent; font-family: var(--font-body); }
.card.active { border-color: var(--accent); }
.card-tools { position: absolute; top: 10px; left: 10px; z-index: 3; display: flex; gap: 6px; opacity: 0; transition: opacity .12s; }
.card:hover .card-tools, .card.active .card-tools { opacity: 1; }
.card-tools button { height: 30px; min-width: 30px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; gap: 2px; background: #fff; color: #23262f; border-radius: 5px; box-shadow: var(--shadow); }
.art { min-height: 280px; background-color: var(--art-a); background-size: cover; background-position: center; }
.art-0 { background-image: radial-gradient(120% 90% at 85% 0%, var(--art-c), transparent 60%), linear-gradient(120deg, var(--art-a), var(--art-b)); }
.art-1 { background-image: conic-gradient(from 210deg at 30% 120%, var(--art-b), var(--art-a), var(--art-c), var(--art-b)); }
.art-2 { background-image: repeating-linear-gradient(115deg, transparent 0 46px, rgba(255, 255, 255, .1) 46px 92px), linear-gradient(200deg, var(--art-c), var(--art-a) 55%, var(--art-b)); }
.art-3 { background-image: radial-gradient(circle at 20% 30%, var(--art-c) 0 16%, transparent 17%), radial-gradient(circle at 72% 64%, var(--art-a) 0 28%, transparent 29%), linear-gradient(var(--art-b), var(--art-b)); }
.body { padding: 56px 84px; min-height: 300px; outline: none; }
.layout-cover .body { background: var(--cover-bg); min-height: 300px; }
.layout-image-left, .layout-image-right { display: grid; grid-template-columns: 2fr 3fr; }
.layout-image-right { grid-template-columns: 3fr 2fr; }
.layout-image-right .art { order: 2; }
.layout-image-left .art, .layout-image-right .art { min-height: 100%; }
.add-bar { display: flex; justify-content: center; padding: 20px 0; }
.add-bar > div { display: inline-flex; align-items: center; background: var(--ui-surface); border-radius: 6px; box-shadow: var(--shadow); }
.add-bar button { width: 48px; height: 38px; display: grid; place-items: center; color: var(--navy); }
.add-bar button:hover { background: var(--ui-bg); }

/* Card content */
.body p { margin: 0 0 .8em; }
.body ul { list-style: disc; padding-left: 1.4em; margin: 0 0 1em; }
.body ol { list-style: decimal; padding-left: 1.4em; margin: 0 0 1em; }
.body strong, .body b { font-weight: 700; }
.body img { display: inline-block; }

.body h1, .body h2, .body h3 { font-family: var(--font-head); color: var(--ink); line-height: 1.12; letter-spacing: -.02em; margin: 0 0 .5em; }
.body h1 { font-size: clamp(34px, 4.4vw, 60px); font-weight: 800; }
.body h2 { font-size: clamp(26px, 3vw, 38px); font-weight: 700; }
.body h3 { font-size: 22px; font-weight: 700; }
.body p, .body li { font-size: 18px; line-height: 1.6; }
.body img { max-width: 100%; border-radius: 8px; }
.body iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; }
.body a { color: var(--accent); }
.body a.cta { display: inline-block; padding: 10px 20px; border-radius: 8px; background: var(--accent); color: var(--card-bg); font-weight: 600; text-decoration: none; }
.body blockquote { margin: 1em 0; padding-left: 18px; border-left: 4px solid var(--accent); font-size: 20px; }
.body table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.body th, .body td { padding: 10px 12px; border-bottom: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); text-align: left; }
.callout { margin: 1em 0; padding: 16px 20px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 14%, transparent); border-left: 4px solid var(--accent); }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 28px; margin: 1em 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin: 1em 0; }
.stats > div { padding: 16px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.stats b { display: block; font-size: 34px; color: var(--accent); font-family: var(--font-head); }

/* Left navigator */
.nav { position: fixed; left: 12px; top: 50%; transform: translateY(-50%); z-index: 20; width: 210px; max-height: 70vh; display: flex; flex-direction: column; background: var(--ui-surface); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 10px; }
.nav-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.seg { display: inline-flex; background: var(--ui-bg); border-radius: 6px; padding: 2px; }
.seg button { width: 34px; height: 28px; display: grid; place-items: center; border-radius: 5px; color: var(--ui-muted); }
.seg button.on { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.nav-list { overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.thumb { position: relative; width: 100%; height: 106px; padding: 0; border-radius: 6px; overflow: hidden; border: 1px solid var(--ui-line); background: var(--card-bg); text-align: left; flex: none; }
.thumb.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.thumb { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; }
.thumb .art.t-art { height: 44%; min-height: 0; flex: none; }
.thumb .t-title { display: block; padding: 6px 8px; font-size: 11px; font-weight: 700; color: var(--ink); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.thumb .t-num { position: absolute; left: 6px; bottom: 6px; min-width: 22px; height: 22px; display: grid; place-items: center; border-radius: 5px; background: #fff; color: #23262f; font-size: 12px; box-shadow: var(--shadow); }
.row-item { display: flex; gap: 8px; padding: 6px; border-radius: 5px; text-align: left; font-size: 13px; }
.row-item.on, .row-item:hover { background: var(--ui-bg); }
.nav-open { position: fixed; left: 12px; top: 50%; transform: translateY(-50%); z-index: 20; width: 38px; padding: 0; justify-content: center; }

/* Right rail */
.rail { position: fixed; right: 28px; top: 50%; transform: translateY(-50%); z-index: 20; display: flex; flex-direction: column; gap: 14px; }
.rail > div { display: flex; flex-direction: column; background: var(--ui-surface); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 6px; }
.rail button { width: 48px; height: 48px; display: grid; place-items: center; color: var(--navy); border-radius: 6px; }
.rail button:hover { background: var(--ui-bg); color: var(--brand-dark); }
.rail .ai-btn { color: var(--brand-dark); }
.help { position: fixed; right: 28px; bottom: 20px; z-index: 20; width: 44px; height: 44px; border-radius: 50%; background: var(--ui-surface); box-shadow: var(--shadow-lg); font-weight: 600; }

/* Side panel + modal */
.panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: 380px; max-width: 100vw; background: var(--ui-surface); box-shadow: var(--shadow-lg); padding: 18px; overflow: auto; }
.panel h2 { margin: 0; font-size: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel textarea, .panel input[type=text], .field { width: 100%; padding: 10px 12px; border: 1px solid var(--ui-line); border-radius: 6px; background: #fff; }
.panel textarea { min-height: 96px; resize: vertical; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--ui-muted); font-size: 13px; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.suggest button { padding: 5px 10px; border: 1px solid var(--ui-line); border-radius: 999px; font-size: 13px; }
.suggest button:hover { background: var(--ui-bg); }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-tile { padding: 0; border-radius: 8px; overflow: hidden; border: 2px solid var(--ui-line); background: var(--card-bg); color: var(--ink); text-align: left; }
.theme-tile.on { border-color: var(--brand); }
.theme-tile .art { min-height: 54px; }
.theme-tile span { display: block; padding: 8px 10px; font-family: var(--font-head); font-weight: 700; text-transform: capitalize; }
.comment { padding: 10px 0; border-bottom: 1px solid var(--ui-line); }
.menu { position: fixed; z-index: 50; min-width: 200px; padding: 6px; background: var(--ui-surface); border-radius: 8px; box-shadow: var(--shadow-lg); }
.menu button { display: block; width: 100%; padding: 8px 10px; text-align: left; border-radius: 5px; }
.menu button:hover { background: var(--ui-bg); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; padding: 10px 16px; background: var(--navy); color: #fff; border-radius: 6px; box-shadow: var(--shadow-lg); }

.slash { position: fixed; z-index: 60; width: 250px; max-height: 300px; overflow: auto; padding: 6px; background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 10px; box-shadow: var(--shadow-lg); }
.slash button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 6px; text-align: left; }
.slash button.on, .slash button:hover { background: var(--ui-bg); }
.body hr { border: 0; border-top: 1px solid color-mix(in srgb, var(--ink) 20%, transparent); margin: 1.4em 0; }

/* Home + auth */
.home { max-width: 1120px; margin: 0 auto; padding: 28px 24px 60px; }
.home-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 36px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--navy); }
.logo img { width: 30px; height: 30px; }
.hero { padding: 32px; margin-bottom: 36px; background: var(--navy); color: #fff; border-radius: 14px; }
.hero h1 { margin: 0 0 14px; font-size: 32px; letter-spacing: -.02em; }
.hero textarea { width: 100%; min-height: 84px; padding: 12px 14px; border: 0; border-radius: 8px; color: var(--ui-text); background: #fff; resize: vertical; }
.hero-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; align-items: center; }
.hero-row select { height: 38px; padding: 0 10px; border-radius: 6px; border: 0; color: var(--ui-text); background: #fff; }
.hero .btn-primary { background: var(--brand); }
.hero .btn-primary:hover { background: var(--brand-dark); }
.hero .ghost { height: 38px; padding: 0 14px; color: #fff; border: 1px solid rgba(255, 255, 255, .4); border-radius: 6px; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.deck-tile { display: block; background: var(--card-bg); color: var(--ink); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); text-decoration: none; position: relative; }
.deck-tile .art { min-height: 110px; }
.deck-tile div.meta { padding: 12px 14px; }
.deck-tile strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.deck-tile small { opacity: .7; }
.deck-del { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px; background: #fff; color: #23262f; opacity: 0; }
.deck-tile:hover .deck-del, .deck-del:focus-visible { opacity: 1; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth form { width: 380px; max-width: 100%; padding: 28px; background: var(--ui-surface); border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 12px; }
.link { color: var(--brand-dark); text-decoration: underline; padding: 0; }
.error { color: #b42318; font-size: 14px; }

/* Present + public view */
.present { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: #0b0d12; padding: 3vh 4vw; overflow: auto; }
.present .card { width: min(1400px, 100%); max-height: 94vh; overflow: auto; border: 0; }
.present-hud { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 81; display: flex; align-items: center; gap: 12px; padding: 6px 12px; color: #fff; background: rgba(255, 255, 255, .14); border-radius: 8px; }
.present-hud button { color: #fff; display: grid; place-items: center; width: 30px; height: 30px; }
.public { max-width: 1120px; margin: 0 auto; padding: 32px 20px 60px; display: flex; flex-direction: column; gap: 24px; }
.public-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

@media (max-width: 1180px) {
  .canvas { padding: 72px 84px 100px 16px; }
  .nav { display: none; }
  .rail { right: 10px; }
  .rail button { width: 40px; height: 40px; }
  .body { padding: 36px 32px; }
}
@media (max-width: 720px) {
  .canvas { padding: 112px 12px 100px; }
  .rail { top: auto; bottom: 0; left: 0; right: 0; transform: none; flex-direction: row; overflow-x: auto; background: var(--ui-surface); }
  .rail > div { flex-direction: row; box-shadow: none; }
  .help { display: none; }
  .topbar { flex-wrap: wrap; }
  .top-actions { overflow-x: auto; max-width: 100%; }
  .layout-image-left, .layout-image-right { grid-template-columns: 1fr; }
  .layout-image-right .art { order: 0; }
  .layout-image-left .art, .layout-image-right .art { min-height: 180px; }
}
@media print {
  @page { size: 13.33in 7.5in; margin: 0; }
  body { background: #fff; }
  .topbar, .nav, .rail, .help, .add-bar, .card-tools, .panel, .toast, .public-bar { display: none !important; }
  .canvas, .public { padding: 0; max-width: none; gap: 0; }
  .card { break-after: page; border: 0; border-radius: 0; box-shadow: none; min-height: 7.5in; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .layout-cover .art { min-height: 1.6in; }
  .layout-cover .body { min-height: 0; }
  .body { padding: .45in .8in; min-height: 0; }
  .body h1 { font-size: 40px; }
  .body p, .body li { font-size: 16px; line-height: 1.45; }
}

/* Scaled card previews on the dashboard */
.pv { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--card-bg); }
.pv-in { position: absolute; top: 0; left: 0; width: 1200px; transform-origin: 0 0; pointer-events: none; }
.pv .card { border: 0; border-radius: 0; box-shadow: none; height: 675px; overflow: hidden; }
.pv .layout-cover { display: flex; flex-direction: column; }
.pv .layout-cover .body { flex: 1; }
.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pick-grid button { padding: 0; aspect-ratio: 1; overflow: hidden; border-radius: 6px; }
.pick-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
[data-kind="carousel"] .card-wrap { max-width: 620px; }
[data-kind="carousel"] .present .card { width: min(620px, 100%); }
[data-kind="carousel"] .public { max-width: 620px; }
