/* ─── Tokens (light, cute, playful) ──────────────────────────────────────── */
:root {
  --bg: #fbf7ef;
  --bg-2: #f3eee2;
  --card: #ffffff;
  --card-2: #fdfaf3;
  --border: #ece6d8;
  --border-strong: #ddd4c0;

  --text: #1d2238;
  --text-2: #4d5170;
  --text-dim: #8d8fa3;

  --accent: #6a5cff;          /* primary lavender-violet */
  --accent-2: #8d7eff;
  --accent-soft: #efeaff;
  --accent-glow: rgba(106, 92, 255, 0.28);

  --pink: #ff8fa3;
  --pink-soft: #ffe6ec;
  --mint: #5dd6a8;
  --mint-soft: #e1f7ec;
  --peach: #ffb37a;
  --peach-soft: #fff0de;
  --lemon: #ffd166;
  --lemon-soft: #fff5cc;

  --bubble-user: #efeaff;
  --bubble-user-border: #d8ccff;
  --bubble-bot: #fff5e6;
  --bubble-bot-border: #ffd9a8;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;

  --slider-h: 170px;
  --fader-w: 40px;
  --thumb-h: 24px;
  --thumb-w: 32px;

  --transition-fast: 130ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-bounce: 360ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(700px 380px at 12% -10%, rgba(141, 126, 255, 0.18), transparent 60%),
    radial-gradient(600px 320px at 110% 0%, rgba(255, 143, 163, 0.16), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: 'cv11', 'ss01';
}

/* Desktop locks the page to a single viewport: the page does not grow as the
   conversation grows. Only the .conversation div scrolls. Mobile drops back
   to natural document flow so virtual keyboards don't fight a fixed shell. */
@media (min-width: 721px) {
  html, body { height: 100dvh; overflow: hidden; }
}

/* ─── Page shell ─────────────────────────────────────────────────────────── */
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 22px 22px;
  display: flex;
  flex-direction: column;
}

@media (min-width: 721px) {
  main { height: 100dvh; }
}

header { margin-bottom: 18px; }

header h1 {
  font-family: 'Fraunces', 'Plus Jakarta Sans', serif;
  font-size: clamp(28px, 3.6vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--text);
}

header h1 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 600;
}

header .lead {
  color: var(--text-2);
  margin: 0;
  font-size: 14px;
}

.lead-toggle {
  background: none;
  border: 0;
  padding: 0;
  margin-left: 6px;
  color: var(--accent);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.lead-toggle:hover { color: var(--pink); }
.lead-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Read-more block floats over the layout instead of pushing it down — the
   page is locked to viewport height on desktop, so any pushy content would
   crush the cards below. Position absolute keeps the layout stable. */
header { position: relative; }

.lead-more {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 10;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.6;
  box-shadow:
    0 12px 32px rgba(28, 32, 60, 0.14),
    0 2px 8px rgba(28, 32, 60, 0.06);
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
}
.lead-more p { margin: 0 0 10px; }
.lead-more p:last-child { margin-bottom: 0; }
.lead-more strong { color: var(--text); font-weight: 700; }
.lead-more em { color: var(--accent); font-style: normal; font-weight: 600; }

/* On mobile, fall back to natural flow so the floating overlay doesn't
   cover everything below it. */
@media (max-width: 720px) {
  .lead-more {
    position: static;
    margin-top: 10px;
    box-shadow: none;
  }
}

/* ─── Two-column layout ──────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: minmax(340px, 440px) 1fr;
  gap: 18px;
  align-items: start;
  min-height: 0;
}

/* Both cards are flex columns and must allow children to shrink/scroll. */
.card { min-height: 0; }

/* ─── Card primitive ─────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow:
    0 1px 0 #fff inset,
    0 8px 24px rgba(28, 32, 60, 0.06),
    0 2px 6px rgba(28, 32, 60, 0.04);
  display: flex;
  flex-direction: column;
}

.card h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin: 0 0 14px;
  font-weight: 700;
}

/* Chat card header — h2 plus a Clear button on the right. */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 14px;
}
.chat-header h2 { margin: 0; }
.clear-btn {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.clear-btn:hover {
  background: var(--pink-soft);
  color: var(--pink);
  border-color: var(--pink);
}
.clear-btn:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }

/* ─── Equalizer card ─────────────────────────────────────────────────────── */
.equalizer { background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%); }

/* ─── Character preset row (above the sliders) ─────────────────────────── */
.characters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.character-chip {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--border-strong);
  background: var(--card-2);
  color: var(--text-2);
  font-family: inherit;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}
.character-chip .character-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.character-chip .character-tag {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.character-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.character-chip:hover .character-name { color: var(--accent); }
.character-chip:active { transform: scale(0.97); }
.character-chip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.character-chip-active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-color: var(--accent);
  color: #fff;
}
.character-chip-active .character-name { color: #fff; }
.character-chip-active .character-tag { color: rgba(255,255,255,0.85); }

.sliders-vertical {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;     /* center the sliders vertically inside any free space */
  padding: 4px 0;
  flex: 1 1 auto;
  min-height: 0;
}

.slider-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
  max-width: 70px;
}

.slider-top {
  text-align: center;
  margin-bottom: 8px;
  height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.slider-label-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

.slider-label {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* Tiny "?" button with a hover/focus tooltip. Position is relative to the
   label row so the bubble floats just below without affecting layout. */
.help-btn {
  width: 14px;
  height: 14px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--card-2);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.help-btn:hover,
.help-btn:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}
.help-bubble {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(-2px);
  width: 200px;
  padding: 8px 10px;
  background: var(--text);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  line-height: 1.4;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(28, 32, 60, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 5;
}
.help-btn:hover .help-bubble,
.help-btn:focus-visible .help-bubble {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.slider-value {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
  margin-top: 4px;
  transition: color var(--transition-fast), transform var(--transition-bounce);
}

/* The fader chassis — pastel groove on a cream board. */
.slider-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--slider-h);
  width: var(--fader-w);
  background: linear-gradient(180deg, #f5efdf 0%, #ebe4d2 100%);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 10px 0;
  position: relative;
  box-shadow:
    inset 0 2px 4px rgba(157, 134, 90, 0.18),
    inset 0 -1px 0 #fff;
}

/* Tick marks (purely decorative, gives hardware feel). */
.slider-wrap::before,
.slider-wrap::after {
  content: '';
  position: absolute;
  top: 14px;
  bottom: 14px;
  width: 1px;
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.08) 0,
    rgba(0, 0, 0, 0.08) 1px,
    transparent 1px,
    transparent 11.1%
  );
}
.slider-wrap::before { left: 7px; }
.slider-wrap::after { right: 7px; }

/* ─── Vertical range slider ──────────────────────────────────────────────── */
input[type="range"].slider-vertical {
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 26px;
  height: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  outline: none;
  cursor: pointer;
}

/* WebKit thumb — chunky pastel cap. */
input[type="range"].slider-vertical::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--thumb-w);
  height: var(--thumb-h);
  border-radius: 8px;
  background:
    linear-gradient(180deg, transparent 45%, var(--accent) 45%, var(--accent) 55%, transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #f1ecdf 100%);
  border: 1px solid var(--border-strong);
  box-shadow:
    inset 0 1px 0 #fff,
    0 2px 6px rgba(28, 32, 60, 0.15),
    0 0 0 1px rgba(28, 32, 60, 0.04);
  cursor: grab;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

/* Chaos slider — pink stripe + faint pink chassis tint to signal
   "different kind of axis". Same shape, different colour language. */
.slider-col-chaos .slider-value { color: var(--pink); }
.slider-col-chaos .slider-wrap {
  background: linear-gradient(180deg, #fbe7ee 0%, #f5d5df 100%);
}
input[type="range"].slider-vertical.slider-col-chaos::-webkit-slider-thumb {
  background:
    linear-gradient(180deg, transparent 45%, var(--pink) 45%, var(--pink) 55%, transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #fbeaef 100%);
}
input[type="range"].slider-vertical.slider-col-chaos:focus-visible::-webkit-slider-thumb {
  box-shadow:
    inset 0 1px 0 #fff,
    0 0 0 4px var(--pink),
    0 0 0 7px var(--pink-soft);
}
input[type="range"].slider-vertical::-webkit-slider-thumb:hover {
  box-shadow:
    inset 0 1px 0 #fff,
    0 4px 12px rgba(28, 32, 60, 0.18),
    0 0 0 4px var(--accent-soft);
}
input[type="range"].slider-vertical:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.05);
}

/* Firefox thumb */
input[type="range"].slider-vertical::-moz-range-thumb {
  width: var(--thumb-w);
  height: var(--thumb-h);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f1ecdf 100%);
  border: 1px solid var(--border-strong);
  box-shadow:
    inset 0 1px 0 #fff,
    0 2px 6px rgba(28, 32, 60, 0.15);
  cursor: grab;
}

/* Focus rings — visible only on keyboard navigation. */
input[type="range"].slider-vertical:focus-visible::-webkit-slider-thumb {
  box-shadow:
    inset 0 1px 0 #fff,
    0 0 0 4px var(--accent),
    0 0 0 7px var(--accent-soft);
}
input[type="range"].slider-vertical:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 4px var(--accent);
}

.slider-poles {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-top: 8px;
  height: 30px;
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.pole {
  cursor: help;
  text-align: center;
  font-weight: 700;
}
.pole-high { color: var(--text-2); }

/* ─── Equalizer hint (replaces the old Run button) ──────────────────────── */
.equalizer-hint {
  margin: 14px 0 0;
  text-align: center;
  font-size: 11.5px;
  font-style: italic;
  color: var(--text-dim);
}

/* ─── Chat card ──────────────────────────────────────────────────────────── */
.chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.chat .conversation {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 280px;
  max-height: calc(100dvh - 360px);
  padding-right: 4px;        /* breathing room for the scrollbar */
}

/* Subtle scrollbar styling for the conversation. */
.chat .conversation::-webkit-scrollbar { width: 8px; }
.chat .conversation::-webkit-scrollbar-track { background: transparent; }
.chat .conversation::-webkit-scrollbar-thumb {
  background: rgba(106, 92, 255, 0.18);
  border-radius: 999px;
}
.chat .conversation::-webkit-scrollbar-thumb:hover { background: rgba(106, 92, 255, 0.32); }

.conversation-empty {
  margin: auto;
  text-align: center;
  color: var(--text-dim);
  font-size: 13.5px;
  font-style: italic;
  padding: 20px 12px;
}

/* ─── Composer (chips + textarea + send) ────────────────────────────────── */
.composer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--border-strong);
  background: var(--card-2);
  color: var(--text-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}
.chip:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}
.chip:active { transform: scale(0.96); }
.chip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.composer-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.composer-input-wrap {
  position: relative;
  width: 100%;
}
.composer-input-wrap > .composer-input {
  width: 100%;
  display: block;
}

.composer-clear {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card-2);
  color: var(--text-dim);
  border: 0;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition:
    color var(--transition-fast),
    background var(--transition-fast);
}
.composer-clear:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
.composer-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chip.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.chip.is-active:hover {
  background: var(--accent);
  color: #fff;
}

.composer-bottom {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.provider-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1 1 auto;
  min-width: 0;
}

.provider-chip {
  border: 1px solid var(--border-strong);
  background: var(--card-2);
  color: var(--text-2);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}
.provider-chip:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}
.provider-chip:active { transform: scale(0.96); }
.provider-chip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.provider-chip.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.provider-chip.is-active:hover {
  background: var(--accent);
  color: #fff;
}

.top-bar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px 0;
}
.back-link {
  color: var(--text-2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: color var(--transition-fast);
}
.back-link:hover {
  color: var(--accent);
}

.composer-input {
  flex: 1;
  min-width: 0;
  resize: none;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.composer-input::placeholder { color: var(--text-dim); }
.composer-input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.composer-send {
  flex: 0 0 auto;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--pink) 100%);
  color: #fff;
  border: 0;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.35) inset,
    0 5px 14px var(--accent-glow);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    opacity var(--transition-fast);
}
.composer-send:hover {
  box-shadow:
    0 1px 0 rgba(255,255,255,0.45) inset,
    0 8px 18px var(--accent-glow);
  transform: translateY(-1px);
}
.composer-send:active { transform: translateY(0) scale(0.97); }
.composer-send:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.composer-send:disabled { opacity: 0.55; cursor: progress; transform: none; }

.bubble {
  position: relative;
  border-radius: 18px;
  padding: 11px 14px 13px;
  border: 1px solid var(--border);
  max-width: 95%;
  animation: bubble-in 320ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.bubble-user {
  background: var(--bubble-user);
  border-color: var(--bubble-user-border);
  align-self: flex-end;
  border-bottom-right-radius: 6px;
}

.bubble-bot {
  background: var(--bubble-bot);
  border-color: var(--bubble-bot-border);
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  width: 95%;
  display: flex;
  flex-direction: column;
}

.bubble-tag {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 4px;
  font-weight: 800;
}

.bubble-body {
  margin: 0;
  font-size: 14.5px;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text);
}

/* Bot bubble body uses monospace so the model's typography differences are
   easy to compare turn-to-turn. */
.bubble-bot pre.bubble-body {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13.5px;
}

.bubble-lock {
  position: absolute;
  top: 9px;
  right: 12px;
  font-size: 11px;
  opacity: 0.55;
}

.meta {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ─── Loading skeleton ───────────────────────────────────────────────────── */
.skeleton {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.skeleton-line {
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(106, 92, 255, 0.06) 0%,
    rgba(106, 92, 255, 0.18) 50%,
    rgba(106, 92, 255, 0.06) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-line.w-90 { width: 90%; }
.skeleton-line.w-72 { width: 72%; }
.skeleton-line.w-55 { width: 55%; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes bubble-in {
  0%   { opacity: 0; transform: translateY(8px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Block overlay ──────────────────────────────────────────────────────── */
/* The element ships with the `hidden` attribute. Author CSS would otherwise
   override the UA `[hidden] { display: none }` because of equal specificity,
   so we have to spell it out. */
.block-overlay[hidden] { display: none !important; }

.block-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(28, 32, 60, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 200ms ease-out both;
}

.block-card {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 24px 26px 22px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 20px 60px rgba(28, 32, 60, 0.28),
    0 4px 14px rgba(28, 32, 60, 0.10);
  animation: bubble-in 280ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.block-card h3 {
  margin: 0 0 10px;
  font-family: 'Fraunces', 'Plus Jakarta Sans', serif;
  font-style: italic;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.block-message {
  margin: 0 0 6px;
  font-size: 14.5px;
  color: var(--text-2);
  line-height: 1.55;
}

.block-detail {
  margin: 0 0 18px;
  font-size: 11.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  font-style: italic;
}
.block-detail:empty { display: none; }

.block-dismiss {
  padding: 10px 22px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--pink) 100%);
  color: #fff;
  border: 0;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.35) inset,
    0 5px 14px var(--accent-glow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.block-dismiss:hover { transform: translateY(-1px); }
.block-dismiss:active { transform: translateY(0) scale(0.97); }
.block-dismiss:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ─── Mobile (stack vertically, page scrolls naturally) ─────────────────── */
@media (max-width: 720px) {
  main { padding: 18px 14px 24px; }
  header h1 { font-size: 26px; }

  .layout {
    grid-template-columns: 1fr;
    flex: none;
  }

  :root {
    --slider-h: 140px;
    --fader-w: 36px;
    --thumb-w: 28px;
    --thumb-h: 22px;
  }

  .sliders-vertical { gap: 4px; }
  .slider-col { min-width: 0; max-width: 56px; }
  .composer-input { font-size: 14px; }
  .chip { font-size: 12px; padding: 5px 10px; }
  .characters { gap: 4px; }
  .character-chip { padding: 6px 8px; }
  .character-chip .character-name { font-size: 11.5px; }
  .character-chip .character-tag { font-size: 9.5px; }

  /* On small screens we want the chat to grow with content, not lock in
     viewport height. The conversation div drops its internal scroll. */
  .chat .conversation { overflow-y: visible; max-height: none; }
}
