/* Flowdeck UI.
 * The slides have their own CSS inside app.js (it travels into the iframe).
 * This file styles the launcher, editor shell and presentation overlay.
 */

:root {
  --bg: #f4faff;
  --panel: #ffffff;
  --panel-2: #f1f9ff;
  --panel-3: #e4f2fc;
  --text: #12263c;
  --muted: #5f7489;
  --dim: #8ba0b3;
  --line: #cfe2f1;
  --line-soft: #e2eff8;
  --accent: #3b9fe8;
  --accent-2: #6cc4f2;
  --accent-ink: #ffffff;
  --danger: #d9534f;
  --warn: #b87a18;
  --good: #2f8fbf;
  --shadow: 0 20px 55px rgba(42, 101, 145, .15);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { color-scheme: light; }

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 82% -8%, rgba(108, 196, 242, .28), transparent 62%),
    radial-gradient(900px 600px at 4% 108%, rgba(59, 159, 232, .12), transparent 60%),
    linear-gradient(180deg, #f9fdff 0%, #f2faff 55%, #eaf6ff 100%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.editing { overflow: hidden; }
body.presenting { overflow: hidden; }

/* --------------------------------------------------------------- ambient */
/* A quiet wind field, fanned ghost slides and the owner's monogram. Fixed
 * behind the page; pointer-events none so it never catches a click. */

.ambient {
  /* Attached to the document, not the viewport: scrolling moves the scene with
   * the page instead of leaving it pinned behind the content. */
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.ambient-glow {
  position: absolute;
  inset: -12%;
  background:
    radial-gradient(48% 46% at 76% 18%, rgba(124, 201, 245, .30), transparent 68%),
    radial-gradient(42% 38% at 14% 74%, rgba(59, 159, 232, .13), transparent 70%),
    radial-gradient(30% 30% at 50% 46%, rgba(255, 255, 255, .45), transparent 72%);
  animation: ambientPulse 26s ease-in-out infinite alternate;
}
.ambient-wind {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .62;
}
.wind-lines path {
  fill: none;
  stroke: url(#windline);
  stroke-width: 1.15;
  stroke-linecap: round;
  stroke-dasharray: 2 17;
  animation: windDash 30s linear infinite;
}
.wind-lines .w1 { opacity: .8; animation-delay: -4s; }
.wind-lines .w2 { opacity: .55; animation-delay: -12s; animation-duration: 36s; }
.wind-lines .w3 { opacity: .45; animation-delay: -20s; animation-duration: 42s; }
.wind-lines .w4 { opacity: .32; animation-delay: -27s; animation-duration: 48s; }
.ambient-decks { position: absolute; inset: 0; }
.ghost-deck {
  position: absolute;
  width: clamp(168px, 17vw, 278px);
  aspect-ratio: 16 / 9;
  padding: clamp(10px, 1.15vw, 17px);
  border: 1px solid rgba(59, 159, 232, .20);
  border-radius: 15px;
  background: linear-gradient(155deg, rgba(255, 255, 255, .76), rgba(233, 247, 255, .50));
  box-shadow: 0 22px 55px rgba(46, 105, 150, .10), inset 0 1px 0 rgba(255, 255, 255, .8);
  color: #17324b;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  opacity: .68;
  rotate: var(--rot, 0deg);
  animation: deckFloat 17s ease-in-out infinite;
}
.ghost-deck .gd-kicker {
  color: rgba(47, 149, 220, .78);
  font: 700 clamp(6px, .52vw, 9px)/1.2 var(--mono);
  letter-spacing: .13em;
  text-transform: uppercase;
}
.ghost-deck b {
  font-size: clamp(14px, 1.55vw, 26px);
  line-height: 1.02;
  letter-spacing: -.04em;
  font-weight: 800;
}
.gd1 { top: 11%; right: 3.5%; --rot: 7deg; }
.gd1 .gd-rule {
  display: block;
  width: 42%;
  height: 2px;
  background: linear-gradient(90deg, #3b9fe8, transparent);
  border-radius: 2px;
}
.gd2 { top: 55%; right: 15%; --rot: -5deg; animation-delay: -5s; width: clamp(150px, 14vw, 230px); }
.gd2 .gd-live {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #2c7d59;
  font: 700 clamp(7px, .62vw, 10px)/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.gd2 .gd-live span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4caf7d;
  box-shadow: 0 0 0 4px rgba(76, 175, 125, .13);
  animation: liveDot 2.4s ease-in-out infinite;
}
.gd2 .gd-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 34%;
}
.gd2 .gd-bars i {
  flex: 1;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, #7cc9f5, #2f95dc);
  opacity: .55;
}
.gd2 .gd-bars i:nth-child(1) { height: 36%; }
.gd2 .gd-bars i:nth-child(2) { height: 62%; }
.gd2 .gd-bars i:nth-child(3) { height: 48%; }
.gd2 .gd-bars i:nth-child(4) { height: 88%; }
.gd2 .gd-bars i:nth-child(5) { height: 72%; }
.gd3 { top: 37%; left: -5.5%; --rot: -8deg; animation-delay: -9s; }
.gd3 b { font-size: clamp(22px, 2.5vw, 42px); color: #2f95dc; letter-spacing: -.06em; }
.gd3 svg { width: 100%; height: 30%; overflow: visible; }
.gd3 svg path { fill: none; stroke: #3b9fe8; stroke-width: 1.6; stroke-linecap: round; opacity: .55; }
.gd4 { top: 79%; left: 19%; --rot: 4deg; animation-delay: -13s; width: clamp(160px, 15vw, 246px); }
.gd4 b { font-size: clamp(13px, 1.3vw, 21px); color: #4f6d88; font-weight: 650; }
.drift-deck {
  top: var(--top, 20%);
  opacity: 0;
  transform-origin: center;
  /* The whole card, border included, carries the breeze, bob and rotation.
   * The inner wrapper exists only so its content is laid out. */
  animation:
    windAcross var(--dur, 72s) linear forwards,
    deckSpin var(--spinDur, 13s) ease-in-out infinite alternate;
  will-change: translate, rotate, opacity;
}
.drift-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  height: 100%;
  min-height: 0;
}
.drift-deck .dc-body {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  flex: 1;
  min-height: 0;
}
.drift-deck .dc-big {
  font-size: clamp(20px, 2.15vw, 38px);
  line-height: .98;
  letter-spacing: -.06em;
  color: #2f95dc;
  font-weight: 850;
}
.drift-deck .dc-sub {
  color: #4f6d88;
  font-size: clamp(8px, .72vw, 11px);
  line-height: 1.25;
}
.drift-deck .dc-live {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #2c7d59;
  font: 700 clamp(7px, .62vw, 10px)/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.drift-deck .dc-live span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4caf7d;
  box-shadow: 0 0 0 4px rgba(76, 175, 125, .13);
  animation: liveDot 2.4s ease-in-out infinite;
}
.drift-deck .dc-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 32%;
}
.drift-deck .dc-bars i {
  flex: 1;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, #7cc9f5, #2f95dc);
  opacity: .55;
}
.drift-deck .dc-bars i:nth-child(1) { height: 36%; }
.drift-deck .dc-bars i:nth-child(2) { height: 62%; }
.drift-deck .dc-bars i:nth-child(3) { height: 48%; }
.drift-deck .dc-bars i:nth-child(4) { height: 88%; }
.drift-deck .dc-bars i:nth-child(5) { height: 72%; }
.drift-deck svg { width: 100%; height: 28%; overflow: visible; }
.drift-deck svg path { fill: none; stroke: #3b9fe8; stroke-width: 1.6; stroke-linecap: round; opacity: .55; }
.drift-deck .dc-rule {
  display: block;
  width: 42%;
  height: 2px;
  background: linear-gradient(90deg, #3b9fe8, transparent);
  border-radius: 2px;
}
.drift-deck .dc-quote {
  font-size: clamp(13px, 1.3vw, 21px);
  color: #4f6d88;
  font-weight: 650;
  line-height: 1.08;
}

@keyframes windAcross {
  0% { translate: -18vw 0; opacity: 0; }
  6% { translate: -10vw calc(var(--sway, 1) * -1.2vh); opacity: .66; }
  12.5% { translate: -1.75vw calc(var(--sway, 1) * -2.2vh); }
  25% { translate: 14.5vw calc(var(--sway, 1) * -2.8vh); }
  37.5% { translate: 30.75vw calc(var(--sway, 1) * -1.8vh); }
  50% { translate: 47vw 0; }
  62.5% { translate: 63.25vw calc(var(--sway, 1) * 1.9vh); }
  75% { translate: 79.5vw calc(var(--sway, 1) * 2.9vh); }
  87.5% { translate: 95.75vw calc(var(--sway, 1) * 1.8vh); }
  94% { translate: 104.2vw calc(var(--sway, 1) * .8vh); opacity: .66; }
  100% { translate: 112vw 0; opacity: 0; }
}
@keyframes deckSpin {
  0% { rotate: calc(var(--rot, 0deg) - var(--spin, 3deg)); }
  100% { rotate: calc(var(--rot, 0deg) + var(--spin, 3deg)); }
}

.ambient-mark {
  position: absolute;
  right: -4vw;
  bottom: -18vh;
  font-size: 42vw;
  line-height: .72;
  font-weight: 900;
  letter-spacing: -.12em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(59, 159, 232, .11);
  transform: rotate(-7deg);
  opacity: .9;
  user-select: none;
}
.ambient-grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  opacity: .045;
  mix-blend-mode: multiply;
}
.topbar, .home, .editor, .present { position: relative; z-index: 1; }
.topbar { z-index: 30; }
body.editing .ambient { opacity: .46; }
body.editing .ambient-mark { opacity: .42; }

@keyframes ambientPulse {
  0% { transform: translate3d(-1.2%, -1%, 0) scale(1); }
  100% { transform: translate3d(1.4%, 1.6%, 0) scale(1.035); }
}
@keyframes windDash {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -190; }
}
@keyframes deckFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -11px; }
}
@keyframes liveDot {
  0%, 100% { transform: scale(1); opacity: .9; }
  50% { transform: scale(.72); opacity: .55; }
}
@media (max-width: 900px) {
  .gd3, .gd4 { display: none; }
  .gd1 { right: -8%; }
  .gd2 { right: 4%; }
  .ambient-mark { font-size: 70vw; right: -18vw; }
}
@media (prefers-reduced-motion: reduce) {
  /* Keep the preset cards moving, but calm the rest of the ambient scene. */
  .ambient-glow, .wind-lines path { animation: none !important; }
  .drift-deck .dc-live span { animation: none !important; }
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-2); }

/* ------------------------------------------------------------------ top */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(250, 253, 255, .86);
  backdrop-filter: blur(14px);
}
body.editing .topbar { display: none; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
}
.brand-mark {
  display: block;
  height: 26px;
  width: auto;
}
.brand-word { font-weight: 800; letter-spacing: -.02em; }
.top-note {
  color: var(--dim);
  font: 500 11px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.syncid-slot { display: inline-flex; align-items: center; }
.syncid-slot .syncid-chip-link { max-width: 128px; font-size: 10px; padding: 5px 8px; }
body .syncid-pop, body .syncid-dialog {
  --syncid-btn-radius: 10px;
  --syncid-btn-size: 13px;
  --syncid-btn-weight: 650;
  --syncid-accent: var(--accent);
  --syncid-accent-ink: var(--accent-ink);
}

/* ---------------------------------------------------------------- buttons */

.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  transition: background .14s ease, border-color .14s ease, transform .08s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: #a9cfe8; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.accent:hover { filter: brightness(1.06); background: var(--accent); }
.btn.big { padding: 13px 20px; font-size: 14px; border-radius: 11px; }
.btn.small { padding: 7px 11px; font-size: 12px; }
.btn.danger-ghost { background: transparent; color: var(--danger); border-color: rgba(217, 83, 79, .28); }
.btn.danger-ghost:hover { background: rgba(217, 83, 79, .07); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
}
.icon-btn:hover { background: var(--panel-3); }

/* ------------------------------------------------------------------ home */

.home {
  max-width: 1240px;
  margin: 0 auto;
  padding: 54px 24px 40px;
}

.hero { padding: 18px 0 48px; }
.hero-kicker {
  color: var(--accent);
  font: 700 12px/1 var(--mono);
  letter-spacing: .17em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.hero h1 {
  margin: 0;
  font-size: clamp(42px, 6.4vw, 82px);
  line-height: .98;
  letter-spacing: -.045em;
  font-weight: 850;
  max-width: 18ch;
}
.hero h1 span { color: var(--muted); }
.hero-lede {
  margin: 24px 0 0;
  max-width: 66ch;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}
.hero-actions { display: flex; gap: 10px; margin-top: 28px; flex-wrap: wrap; }

.generate-box {
  margin-top: 34px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(238, 248, 255, .78));
  max-width: 820px;
}
.generate-box label {
  display: block;
  color: var(--dim);
  font: 600 11px/1.4 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.generate-row { display: flex; gap: 9px; }
.generate-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fcff;
  color: var(--text);
  padding: 12px 13px;
  font-size: 14px;
  outline: none;
}
.generate-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 159, 232, .13); }
.generate-row .generate-mode { flex: 0 0 auto; padding: 10px 9px; font-size: 12.5px; }
.hint { margin: 10px 0 0; color: var(--dim); font-size: 12px; line-height: 1.5; }
.hint.bad { color: var(--warn); }

.section { padding: 26px 0 34px; border-top: 1px solid var(--line-soft); }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.section-head h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.dim { color: var(--dim); font-size: 12px; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.preset-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px 16px 14px;
  min-height: 178px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.preset-card:hover {
  transform: translateY(-3px);
  border-color: #a9cfe8;
  background: var(--panel-2);
}
.preset-kicker {
  color: var(--accent);
  font: 700 10px/1 var(--mono);
  letter-spacing: .11em;
  text-transform: uppercase;
}
.preset-card b { font-size: 18px; letter-spacing: -.02em; }
.preset-card p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.48; flex: 1; }
.preset-open { color: var(--dim); font: 600 11px/1 var(--mono); letter-spacing: .04em; }
.preset-card:hover .preset-open { color: var(--accent); }

.deck-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.deck-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  transition: border-color .16s ease, transform .16s ease;
}
.deck-card:hover { border-color: #a9cfe8; transform: translateY(-2px); }
/* The card preview is the deck's first slide. Do not frame it with a card
   border or rounded clipping: a custom slide background must reach the edge. */
.deck-card.has-slide {
  border-color: transparent;
  border-radius: 0;
  box-shadow: 0 10px 28px rgba(46, 105, 150, .10);
}
.deck-open {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 0;
  color: var(--text);
}
.deck-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
}
.deck-thumb.has-slide {
  padding: 0;
  display: block;
  cursor: pointer;
}
/* The first slide keeps its fixed logical canvas (1280x720) and is scaled by
   fitThumbs(), exactly like the editor stage. A fluid iframe would reflow the
   slide's vw/clamp() type and no longer look like the real slide. */
.deck-thumb-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 720px;
  border: 0;
  transform-origin: top left;
  pointer-events: none;
  background: #eaf5fd;
}
.deck-thumb b {
  font-size: 22px;
  line-height: 1.02;
  letter-spacing: -.035em;
  max-width: 15ch;
  position: relative;
  z-index: 1;
}
.thumb-kicker {
  font: 700 9px/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .72;
}
.thumb-bars {
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 36%;
  height: 42%;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  opacity: .9;
}
.thumb-bars i { flex: 1; border-radius: 3px 3px 0 0; min-height: 6px; }
.deck-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 13px 15px;
  border-top: 1px solid var(--line-soft);
}
.deck-meta b { font-size: 14px; letter-spacing: -.01em; }
.deck-meta span { color: var(--dim); font-size: 11.5px; }
.deck-actions {
  display: flex;
  gap: 6px;
  padding: 0 12px 12px;
}
.deck-actions button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 8px;
  color: var(--muted);
  padding: 6px 9px;
  font-size: 11px;
}
.deck-actions button:hover { color: var(--text); border-color: #a9cfe8; }
.deck-actions button.danger-ghost { color: var(--danger); margin-left: auto; }

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line-soft);
  padding-top: 22px;
  color: var(--dim);
  font: 500 11px/1.5 var(--mono);
}

.foot-logo {
  display: block;
  width: 124px;
  height: auto;
  flex: none;
}

.foot-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  text-align: right;
}


/* --------------------------------------------------------------- assets */

.asset-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.asset-pool-bar {
  margin: 0 0 9px;
  padding: 6px 9px;
  border: 1px solid rgba(47, 149, 220, .28);
  border-radius: 8px;
  background: rgba(47, 149, 220, .07);
  color: var(--accent);
  font: 600 10px/1.2 var(--mono);
}
.asset-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.asset-thumb {
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--dim);
  font: 700 10px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-thumb.is-circle {
  aspect-ratio: 1 / 1;
  width: 92px;
  margin: 0 auto;
  border-radius: 50%;
}
.asset-thumb.has-drop { box-shadow: 0 14px 28px rgba(11, 38, 62, .25); }
.asset-thumb.has-fade { outline: 1.5px solid rgba(47, 149, 220, .45); outline-offset: 5px; }
.asset-look-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.asset-look-label {
  color: var(--dim);
  font: 600 9px/1.2 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-right: 2px;
}
.look-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 4px 8px;
  font: 600 9.5px/1 var(--mono);
  letter-spacing: .03em;
  cursor: pointer;
}
.look-chip:hover { color: var(--text); border-color: #a9cfe8; background: var(--panel-2); }
.look-chip.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.panel.drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -7px;
  border-radius: 12px;
  background: rgba(47, 149, 220, .05);
}
.asset-field { display: block; color: var(--dim); font: 600 9px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.asset-field input, .asset-field textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fcff;
  color: var(--text);
  padding: 6px 7px;
  font-size: 11.5px;
  line-height: 1.4;
  outline: none;
  resize: vertical;
}
.asset-field input:focus, .asset-field textarea:focus { border-color: var(--accent); }
.asset-meta { color: var(--dim); font: 500 9.5px/1.2 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-compression {
  color: var(--accent);
  font: 500 9.5px/1.35 var(--mono);
  overflow-wrap: anywhere;
}
.asset-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: auto; }
.asset-actions button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 5px 7px;
  font: 600 9.5px/1 var(--mono);
  letter-spacing: .04em;
}
.asset-actions button:hover { color: var(--text); border-color: #a9cfe8; background: var(--panel-2); }
.asset-actions button.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.asset-actions button.danger-ghost { color: var(--danger); border-color: rgba(217, 83, 79, .22); margin-left: auto; }
.asset-empty {
  border: 1px dashed var(--line);
  border-radius: 11px;
  padding: 18px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.5;
  grid-column: 1 / -1;
}
.asset-empty b { color: var(--muted); }

/* A deck can point at pictures this browser does not hold (the decks came from
   the account, the bytes stayed on the other device). The notice sits above the
   dump so the gap in the deck is explained where it can be fixed. */
.asset-missing {
  grid-column: 1 / -1;
  border: 1px dashed rgba(217, 83, 79, .38);
  border-radius: 11px;
  background: rgba(217, 83, 79, .05);
  padding: 14px 16px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.55;
}
.asset-missing b { display: block; margin-bottom: 3px; color: var(--danger); }
.asset-missing button {
  margin-top: 9px;
  border: 1px solid var(--danger);
  border-radius: 7px;
  background: transparent;
  color: var(--danger);
  padding: 6px 10px;
  font: 600 10px/1 var(--mono);
  letter-spacing: .04em;
}
.asset-missing button:hover { color: #fff; background: var(--danger); }
.asset-missing button[disabled] { opacity: .55; }

/* Right-clicking a picture in the stage opens this menu in the editor page:
   the slide is a sandboxed iframe, so the menu cannot live inside it. */
.ctx-menu {
  position: fixed;
  z-index: 130;
  min-width: 186px;
  max-width: 260px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(42, 101, 145, .18);
}
.ctx-label {
  padding: 4px 9px 6px;
  color: var(--dim);
  font: 700 9px/1.2 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ctx-menu button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 8px 9px;
  font-size: 12.5px;
  text-align: left;
}
.ctx-menu button:hover, .ctx-menu button:focus-visible { background: var(--panel-2); outline: none; }

/* The replace picker lists the image assets the same way the dump does. */
.picker-card { width: min(820px, 100%); }
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
  gap: 10px;
  min-height: 96px;
  max-height: min(58vh, 520px);
  overflow-y: auto;
  padding: 2px;
}
.picker-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: inherit;
  font: inherit;
  padding: 8px;
  text-align: left;
  cursor: pointer;
}
.picker-item:hover { border-color: #a9cfe8; background: var(--panel-2); }
.picker-item.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(47, 149, 220, .16); }
.picker-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.picker-thumb { aspect-ratio: 16 / 11; }
.picker-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.picker-meta { color: var(--dim); font: 500 9.5px/1.2 var(--mono); }
.picker-badge {
  position: absolute;
  right: 12px;
  top: 12px;
  border-radius: 999px;
  background: rgba(47, 149, 220, .94);
  color: #fff;
  padding: 4px 6px;
  font: 700 8.5px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.picker-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 16px;
  color: var(--dim);
  font-size: 12.5px;
  line-height: 1.5;
}
.picker-empty b { display: block; margin-bottom: 3px; color: var(--text); }
.picker-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.picker-foot .btn { cursor: pointer; }
.picker-note { color: var(--dim); font: 500 10px/1.3 var(--mono); }

/* ---------------------------------------------------------------- editor */

.editor {
  height: 100vh;
  display: flex;
  flex-direction: column;
  /* translucent so the ambient wind and drifting presets pass behind the stage */
  background: rgba(244, 250, 255, .58);
}
.editor-bar {
  flex: 0 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: #f9fdff;
}
.deck-title {
  width: min(30vw, 380px);
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -.02em;
  padding: 7px 9px;
  outline: none;
}
.deck-title:hover { border-color: var(--line); }
.deck-title:focus { border-color: var(--accent); background: #f8fcff; }
/* Where this browser's decks are backed up: an account copy or just here.
 * Red is the honest state: no account holds this deck, so clearing browser
 * storage loses it. */
.save-where {
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 auto;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font: 700 10px/1 var(--mono);
  letter-spacing: .02em;
}
.save-where::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  vertical-align: 1px;
  border-radius: 50%;
  background: currentColor;
}
.save-where.local {
  color: var(--danger);
  border-color: rgba(217, 83, 79, .32);
  background: rgba(217, 83, 79, .07);
  cursor: pointer;
}
.save-where.account {
  color: var(--good);
  border-color: rgba(47, 143, 191, .3);
  background: rgba(47, 143, 191, .08);
}
.save-state { color: var(--dim); font-size: 11.5px; white-space: nowrap; }
.save-state.bad { color: var(--danger); }
.share-state {
  color: var(--accent-2);
  font: 700 9.5px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  border: 1px solid rgba(59, 159, 232, .25);
  background: rgba(59, 159, 232, .07);
  border-radius: 999px;
  padding: 5px 8px;
  white-space: nowrap;
}
.bar-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.more-wrap { position: relative; display: inline-flex; }
.more-btn { padding: 0 7px; }
.more-btn svg { fill: currentColor; display: block; }
.more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  width: 224px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(42, 101, 145, .18);
}
.more-label {
  padding: 5px 9px 6px;
  color: var(--dim);
  font: 700 9px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.more-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 8px 9px;
  font-size: 12.5px;
  text-align: left;
}
.more-menu button:hover { background: var(--panel-2); }
.more-menu button:disabled { color: var(--dim); opacity: .5; }
.more-menu kbd { font: 500 9.5px/1 var(--mono); color: var(--dim); letter-spacing: .04em; }
.more-sep { height: 1px; margin: 5px 7px; background: var(--line-soft); }

.editor-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr) 392px;
}

/* rail */
.rail {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #f9fdff;
}
.rail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 14px 10px;
  color: var(--muted);
  font: 700 10px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.rail-head-label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.slide-mode-toggle {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel);
}
.slide-mode-toggle button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 700 9px/1 var(--mono);
  letter-spacing: .02em;
  text-transform: none;
  padding: 4px 7px;
  cursor: pointer;
}
.slide-mode-toggle button + button { border-left: 1px solid var(--line-soft); }
.slide-mode-toggle button:hover { background: var(--panel-2); color: var(--text); }
.slide-mode-toggle button.on { background: var(--panel-3); color: var(--text); }
.slide-list {
  list-style: none;
  margin: 0;
  padding: 0 8px 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.slide-item {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  padding: 8px 8px;
  text-align: left;
  color: var(--muted);
}
.slide-head {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.slide-item:hover { background: var(--panel-2); color: var(--text); }
.slide-item.on { background: var(--panel-3); border-color: #a9cfe8; color: var(--text); }
.slide-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 9px;
}
.slide-row.dragging { opacity: .45; }
.slide-row.drop-before::after,
.slide-row.drop-after::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  pointer-events: none;
}
.slide-row.drop-before::after { top: -3px; }
.slide-row.drop-after::after { bottom: -3px; }
.slide-grip {
  flex: 0 0 auto;
  width: 11px;
  height: 18px;
  margin-left: 2px;
  border-radius: 3px;
  background-image: radial-gradient(currentColor 1.1px, transparent 1.2px);
  background-size: 5px 5px;
  background-position: 1px 1px;
  color: var(--dim);
  opacity: .5;
  cursor: grab;
}
.slide-row:hover .slide-grip { opacity: .9; }
.slide-row.dragging .slide-grip { cursor: grabbing; }
.slide-del {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--dim);
  font: 600 15px/1 var(--mono);
  cursor: pointer;
  opacity: 0;
}
.slide-row:hover .slide-del,
.slide-row:focus-within .slide-del { opacity: 1; }
.slide-del:hover { background: rgba(217, 83, 79, .1); color: var(--danger); }
.slide-del:focus-visible { opacity: 1; outline: 2px solid var(--accent); outline-offset: 1px; }
.slide-num { font: 600 10px/1 var(--mono); color: var(--dim); width: 17px; flex: 0 0 auto; }
.slide-item.on .slide-num { color: var(--accent); }
.slide-meta { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 3px; }
.slide-meta b {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slide-title-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  padding: 2px 4px;
  outline: none;
}
.rail-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: hidden;
  background: #eaf5fd;
}
.rail-thumb-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 720px;
  border: 0;
  transform-origin: top left;
  pointer-events: none;
  background: #eaf5fd;
}
.rail.is-detailed .slide-list { gap: 8px; }
.rail.is-detailed .slide-item { gap: 7px; }
.rail.is-detailed .slide-grip,
.rail.is-detailed .slide-del { align-self: center; }

/* stage */
.remote-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(59, 159, 232, .28);
  background: rgba(59, 159, 232, .08);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px 8px 13px;
  font-size: 12px;
}
.remote-bar span { flex: 1; color: var(--muted); }

/* The owner-only demo banner. It sits above the stage, is part of the editor
 * chrome rather than the slide, and is never rendered inside a slide iframe,
 * so it cannot leak into Present or the exported HTML. */
.demo-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(47, 149, 220, .22);
  background: linear-gradient(90deg, rgba(47, 149, 220, .10), rgba(47, 149, 220, .03));
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
}
.demo-bar #demoBarText { flex: 1; min-width: 0; }
.demo-tag {
  flex: 0 0 auto;
  font: 700 9.5px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(47, 149, 220, .3);
  background: rgba(255, 255, 255, .6);
  border-radius: 999px;
  padding: 4px 7px;
}
.stage-col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 10px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(108, 196, 242, .15), transparent 70%),
    rgba(243, 250, 255, .62);
}
.stage-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(45deg, rgba(59, 159, 232, .045) 25%, transparent 25%, transparent 75%, rgba(59, 159, 232, .045) 75%),
    linear-gradient(45deg, rgba(59, 159, 232, .045) 25%, transparent 25%, transparent 75%, rgba(59, 159, 232, .045) 75%);
  background-size: 22px 22px;
  background-position: 0 0, 11px 11px;
}
.stage {
  position: relative;
  width: min(100%, calc((100vh - 172px) * 16 / 9));
  aspect-ratio: 16 / 9;
  /* No border, ring or rounded clipping: a slide's own background must reach
     the true edge, exactly as it does in Present and the exported HTML. */
  border-radius: 0;
  overflow: hidden;
  background: #eaf5fd;
  box-shadow: 0 22px 50px rgba(46, 105, 150, .18);
}
.stage iframe {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 1280px;
  height: 720px;
  border: 0;
  background: #eaf5fd;
  transform: scale(var(--stage-scale, 1));
  transform-origin: top left;
}
.stage-bar {
  flex: 0 0 auto;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}
.slide-pos { color: var(--muted); font: 600 11px/1 var(--mono); min-width: 56px; text-align: center; }
.bar-spacer { flex: 1; }
.theme-label { color: var(--dim); font: 600 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: 7px 9px;
  font-size: 12px;
  outline: none;
}

/* inspector */
.inspector {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--panel);
}
.tabs {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.tabs button {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--dim);
  padding: 7px 4px;
  font: 700 10px/1 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { background: var(--panel-3); color: var(--text); border-color: var(--line); }

.panel {
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
}
#tab-ai { display: flex; flex-direction: column; overflow: hidden; }
.panel-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}
.panel-head h3 { margin: 0; font-size: 14px; letter-spacing: -.01em; }
.panel-head p { margin: 4px 0 0; color: var(--dim); font-size: 11.5px; line-height: 1.45; }
.mode-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(59, 159, 232, .28);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(59, 159, 232, .08);
  padding: 5px 8px;
  font: 700 9px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.mode-badge.off { color: var(--warn); border-color: rgba(184, 122, 24, .28); background: rgba(184, 122, 24, .07); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.chips button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 10.5px;
}
.chips button:hover { color: var(--text); border-color: #a9cfe8; background: var(--panel-2); }

.ai-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px 12px;
}
.ai-empty {
  border: 1px dashed var(--line);
  border-radius: 11px;
  padding: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.ai-empty b { display: block; color: var(--text); margin-bottom: 4px; }
.ai-empty p { margin: 0; }
.ai-msg {
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  padding: 9px 11px;
  background: var(--panel-2);
  max-width: 96%;
}
.ai-msg.user { align-self: flex-end; background: rgba(59, 159, 232, .08); border-color: rgba(59, 159, 232, .22); }
.ai-msg.error { border-color: rgba(217, 83, 79, .3); background: rgba(217, 83, 79, .06); }
.ai-role {
  display: block;
  color: var(--dim);
  font: 700 9px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.ai-msg p { margin: 0; font-size: 12.5px; line-height: 1.52; white-space: pre-wrap; word-break: break-word; }
.ai-changed {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font: 600 10px/1.45 var(--mono);
  letter-spacing: .01em;
}

/* Reply-limit offer: a small card in the chat log, not a modal. */
.ai-limit { border-color: rgba(184, 122, 24, .3); background: rgba(184, 122, 24, .07); }
.ai-limit .ai-role { color: var(--warn); }
.ai-limit-actions { display: flex; gap: 6px; margin-top: 8px; }
.ai-limit-note { display: block; margin-top: 6px; color: var(--dim); font-size: 10.5px; }

/* Live status line in the chat while a model turn runs. */
.ai-status {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: rgba(59, 159, 232, .05);
  color: var(--muted);
  font: 600 10px/1 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
  animation: aiStatusIn .18s ease-out;
}
.ai-status-text { color: var(--text); }
.ai-dots { display: inline-flex; align-items: center; gap: 3px; }
.ai-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: .22;
  animation: aiDot 1.1s ease-in-out infinite;
}
.ai-dot:nth-child(2) { animation-delay: .16s; }
.ai-dot:nth-child(3) { animation-delay: .32s; }
@keyframes aiDot {
  0%, 100% { opacity: .22; }
  45% { opacity: 1; }
}
@keyframes aiStatusIn {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: none; }
}
/* The dots are a progress cue, not decoration: they keep pulsing, but the
   entrance slide is dropped when the OS asks for reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .ai-status { animation: none; }
}

.ai-form { flex: 0 0 auto; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.ai-history { flex: 0 0 auto; margin: 0 0 2px; }
.ai-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 58px;
  max-height: 180px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fcff;
  color: var(--text);
  padding: 10px 11px;
  font-size: 12.5px;
  line-height: 1.45;
  outline: none;
}
.ai-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 159, 232, .12); }
.ai-mode-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; min-width: 0; }
.ai-mode-label {
  flex: 0 0 auto;
  color: var(--dim);
  font: 700 9px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ai-mode-seg { flex: 0 0 auto; }
.ai-mode-seg button { padding: 5px 9px; }
.ai-mode-seg button[data-ai-mode="max"].on { color: var(--warn); }
.ai-mode-note {
  min-width: 0;
  color: var(--dim);
  font-size: 10.5px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-form-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.ai-form-row .hint { margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.field { display: block; margin-bottom: 11px; color: var(--muted); font-size: 11.5px; }
.field input, .field textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fcff;
  color: var(--text);
  padding: 8px 9px;
  font-size: 12.5px;
  outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; line-height: 1.45; }

.code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 6px; }
.seg { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #f8fcff; }
.seg button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--dim);
  padding: 5px 8px;
  font: 700 9px/1 var(--mono);
  letter-spacing: .08em;
}
.seg button.on { background: var(--panel-3); color: var(--text); }
.code {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7fcff;
  color: #1b344b;
  padding: 10px;
  font: 11.5px/1.55 var(--mono);
  tab-size: 2;
  outline: none;
  resize: vertical;
}
.code:focus { border-color: var(--accent); }
.code.small { font-size: 10.8px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.row-actions .btn { font-size: 11.5px; padding: 7px 10px; }

.review-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.score {
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font: 800 16px/1 var(--mono);
  color: var(--muted);
}
.score.good { color: var(--good); border-color: rgba(47, 143, 191, .3); }
.score.warn { color: var(--warn); border-color: rgba(240, 197, 106, .3); }
.score.bad { color: var(--danger); border-color: rgba(217, 83, 79, .3); }
.review-summary { margin: 0 0 10px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.review-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.issue {
  text-align: left;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 9px;
  background: var(--panel-2);
  padding: 9px 11px;
  color: var(--text);
}
.issue:hover { border-color: #a9cfe8; border-left-color: var(--accent); }
.issue.sev-high { border-left-color: var(--danger); }
.issue.sev-medium { border-left-color: var(--warn); }
.issue.sev-low { border-left-color: var(--accent-2); }
.issue-cat {
  display: block;
  color: var(--dim);
  font: 700 9px/1 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.issue b { display: block; font-size: 12.5px; line-height: 1.45; font-weight: 650; }
.issue p { margin: 5px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.issue-where { display: block; margin-top: 6px; color: var(--dim); font: 500 10px/1 var(--mono); }

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

.present {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #e5f3fc;
}
.present-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1280px;
  height: 720px;
  overflow: hidden;
  background: #eaf5fd;
  transform: translate(-50%, -50%) scale(var(--present-scale, 1));
  transform-origin: center center;
  box-shadow: 0 28px 90px rgba(16, 48, 74, .22);
}
.present-stage iframe { display: block; width: 100%; height: 100%; border: 0; background: #eaf5fd; }
.present-bar {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px;
  border: 1px solid rgba(18, 38, 60, .14);
  border-radius: 12px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(12px);
  opacity: .25;
  transition: opacity .15s ease;
}
.present-bar:hover { opacity: 1; }
.present-bar .icon-btn { background: rgba(255, 255, 255, .8); border-color: rgba(18, 38, 60, .14); }
.present-bar .slide-pos { color: #35506a; }
.present-progress {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: rgba(18, 38, 60, .10);
  z-index: 3;
}
.present-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }
.present-notes {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  max-height: 38vh;
  overflow-y: auto;
  padding: 22px 28px;
  background: rgba(255, 255, 255, .94);
  border-top: 1px solid rgba(18, 38, 60, .14);
  color: #27445c;
  font: 14px/1.55 var(--mono);
  white-space: pre-wrap;
}

/* ---------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(35, 81, 116, .22);
  backdrop-filter: blur(5px);
}
.modal-card {
  width: min(860px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h3 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.modal-card .hint { margin: 6px 0 12px; }
.modal-card textarea { flex: 1; min-height: 300px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.history-card { width: min(760px, 100%); }
.history-list { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  padding: 10px 12px;
}
.history-item.current { border-color: rgba(59, 159, 232, .28); background: rgba(59, 159, 232, .07); }
.history-item .history-meta { flex: 1; min-width: 0; }
.history-item b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item span { display: block; margin-top: 3px; color: var(--dim); font: 500 10px/1.3 var(--mono); }
.history-item button { flex: 0 0 auto; }
.history-current-badge { color: var(--accent); font: 700 9px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 200;
  max-width: min(680px, calc(100vw - 32px));
  border: 1px solid rgba(59, 159, 232, .38);
  border-radius: 999px;
  background: rgba(255, 255, 255, .97);
  color: var(--text);
  padding: 10px 16px;
  font-size: 12.5px;
  box-shadow: 0 10px 28px rgba(42, 101, 145, .18);
}
.toast.bad { border-color: rgba(217, 83, 79, .4); background: rgba(255, 247, 247, .98); }

/* ----------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .preset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .deck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-grid { grid-template-columns: 210px minmax(0, 1fr) 350px; }
}
@media (max-width: 900px) {
  .top-note { display: none; }
  .deck-title { width: min(26vw, 380px); }
  .preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deck-grid { grid-template-columns: 1fr; }
  .editor-grid { grid-template-columns: 1fr; grid-template-rows: 1fr 46vh; }
  .rail { display: none; }
  .inspector { border-left: 0; border-top: 1px solid var(--line); }
  .stage { width: min(100%, calc((52vh - 120px) * 16 / 9)); }
}
@media (max-width: 560px) {
  .deck-title { width: min(22vw, 380px); }
  .save-where { flex-shrink: 1; min-width: 0; }
  .home { padding: 30px 16px; }
  .foot { flex-direction: column; align-items: flex-start; }
  .foot-copy { align-items: flex-start; text-align: left; }
  .preset-grid { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1; }
  .generate-row { flex-direction: column; }
  .generate-row .generate-mode { width: 100%; }
  .bar-actions .ghost { display: none; }
}
