/* Vaccie Overlay — site styles (homepage, configurator, presets, news, admin).
   The OBS overlay (overlay.html) keeps its own styles and is not affected. */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #ececea;
  --line: #d9d9d5;
  --line-strong: #b9b9b3;
  --text: #17171a;
  --muted: #5d5e66;
  --soft: #8b8c93;
  --accent: #c62a52;        /* brand red, darkened for text contrast */
  --accent-soft: #fbe9ee;
  --ok: #1f7a4d;
  --ok-soft: #e5f3eb;
  --error: #b42318;
  --error-soft: #fdecea;
  --stage: #18181b;
  --stage-check: #202024;
  --radius: 6px;
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --on-text: #ffffff;       /* text on a var(--text) background (primary buttons) */
  --text-strong: #000000;
  --ring: rgba(23, 23, 26, .1);
  color-scheme: light;
}

/* Dark theme: follows the system unless the visitor picked one with the
   theme button (stored as data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214; --surface: #1a1a1d; --surface-2: #24242a; --line: #2c2c32; --line-strong: #41414a;
    --text: #ececef; --muted: #a3a4ac; --soft: #7b7c85; --accent: #ff6f8f; --accent-soft: #3b1d27;
    --ok: #4cc38a; --ok-soft: #15291f; --error: #ff7b70; --error-soft: #341a1a;
    --stage: #0b0b0d; --stage-check: #141417; --on-text: #121214; --text-strong: #ffffff; --ring: rgba(236, 236, 239, .14);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121214; --surface: #1a1a1d; --surface-2: #24242a; --line: #2c2c32; --line-strong: #41414a;
  --text: #ececef; --muted: #a3a4ac; --soft: #7b7c85; --accent: #ff6f8f; --accent-soft: #3b1d27;
  --ok: #4cc38a; --ok-soft: #15291f; --error: #ff7b70; --error-soft: #341a1a;
  --stage: #0b0b0d; --stage-check: #141417; --on-text: #121214; --text-strong: #ffffff; --ring: rgba(236, 236, 239, .14);
  color-scheme: dark;
}

/* overlay.html has no color-scheme. When the page is dark, browsers paint an
   opaque white backdrop behind an iframe whose scheme differs; matching it
   keeps every overlay preview transparent. */
iframe { color-scheme: light; }

.theme-toggle { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--muted); cursor: pointer; }
.theme-toggle:hover { color: var(--text); border-color: var(--text); }
.theme-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme-active="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme-active="dark"] .theme-toggle .icon-moon { display: none; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: 0; }

/* ---------- Shared primitives ---------- */
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

.btn, .landing-nav-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn:hover { border-color: var(--text); }
.btn-dark { border-color: var(--text); background: var(--text); color: var(--on-text); }
.btn-dark:hover { background: var(--text-strong); }
.link-quiet { color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.link-quiet:hover { color: var(--text); }

select, input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]), textarea {
  width: 100%; min-height: 38px; padding: 7px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 14px;
}
textarea { min-height: 120px; resize: vertical; }
select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 14px center, right 9px center; background-size: 5px 5px; background-repeat: no-repeat; }
input::placeholder, textarea::placeholder { color: var(--soft); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--ring); }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--text); cursor: pointer; }
input[type=range] { accent-color: var(--text); }

.lang-select, .landing-lang, .lang, .language { width: auto; min-height: 32px; height: 32px; padding: 0 28px 0 10px; font-size: 13px; }

/* Dark surface used behind every overlay preview. The faint checkerboard
   says "transparent background", like OBS does. */
.stage-dark, .stage, .format-screen, .preview-stage {
  position: relative; overflow: hidden;
  background-color: var(--stage);
  background-image:
    linear-gradient(45deg, var(--stage-check) 25%, transparent 25%),
    linear-gradient(-45deg, var(--stage-check) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--stage-check) 75%),
    linear-gradient(-45deg, transparent 75%, var(--stage-check) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  border-radius: var(--radius);
}

/* ---------- Homepage ---------- */
.topbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; text-decoration: none; }
.logo img { display: block; }
.tag-beta, .beta-badge {
  padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 4px;
  color: var(--muted); font: 500 11px/1.4 var(--mono); text-transform: lowercase;
}
.topnav { display: flex; align-items: center; gap: 20px; }
.topnav > a:not(.btn) { color: var(--muted); font-size: 14px; text-decoration: none; }
.topnav > a:not(.btn):hover { color: var(--text); }

.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 48px; align-items: end; padding: 64px 0 36px; }
.hero h1 { font-size: clamp(32px, 4.4vw, 46px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.08; }
.hero .lede { max-width: 520px; margin-top: 16px; color: var(--muted); font-size: 17px; }
.hero-actions { display: flex; align-items: center; gap: 20px; margin-top: 28px; }
.specs { margin: 0; border-top: 1px solid var(--text); }
.specs div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.specs dt { color: var(--muted); font-size: 13px; }
.specs dd { margin: 0; font: 500 13px/1.5 var(--mono); }

.showcase { margin: 0; }
.showcase-stage { height: 260px; }
.showcase-stage iframe { position: absolute; left: 50%; top: 50%; width: 640px; height: 180px; border: 0; transform: translate(-50%, -50%) scale(var(--fit-scale, var(--showcase-scale, 1))) translate(var(--fit-dx, 0px), var(--fit-dy, 0px)); transform-origin: center; }
.showcase figcaption { display: flex; gap: 18px; padding: 10px 2px 0; color: var(--muted); font-size: 13px; }
.showcase figcaption span:first-child { color: var(--text); font-weight: 500; }

.block { padding: 72px 0 0; }
.block-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 32px; align-items: end; padding-bottom: 18px; border-bottom: 1px solid var(--text); }
.block-head h2 { font-size: 26px; }
.block-head p { color: var(--muted); font-size: 14px; }

.format-list { margin: 0; padding: 0; list-style: none; }
.format-row { display: grid; grid-template-columns: 300px minmax(0, 1fr) auto; gap: 28px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.format-row .format-screen { height: 124px; }
.format-screen iframe { position: absolute; left: 50%; top: 50%; width: var(--source-w); height: var(--source-h); border: 0; pointer-events: none; transform: translate(-50%, -50%) scale(var(--fit-scale, var(--source-scale))) translate(var(--fit-dx, 0px), var(--fit-dy, 0px)); transform-origin: center; }
.format-copy h3 { font-size: 16px; }
.format-copy p { margin-top: 4px; color: var(--muted); font-size: 14px; }
.format-size { color: var(--muted); }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 40px 220px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); counter-increment: step; }
.steps li::before { content: counter(step) "."; color: var(--soft); font: 500 14px/1.6 var(--mono); }
.steps strong { font-weight: 600; }
.steps span { color: var(--muted); font-size: 14px; }
.url-sample { margin-top: 20px; padding: 12px 14px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: 13px; white-space: nowrap; }
.url-sample b { color: var(--text); font-weight: 500; }

.site-footer { display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; margin-top: 88px; padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-footer .credit { grid-column: 1; color: var(--soft); }
.footer-links { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 18px; align-items: start; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }

/* ---------- Configurator ---------- */
.shell { width: min(1240px, 100% - 32px); margin-inline: auto; padding-bottom: 40px; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; border-bottom: 1px solid var(--line); background: var(--surface); box-shadow: 0 0 0 100vmax var(--surface); clip-path: inset(0 -100vmax); }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.brand-logo { width: 24px; height: 24px; display: block; }
.brand-name { font-size: 15px; font-weight: 600; }
.brand-name b { font-weight: 600; }
.head-right { display: flex; align-items: center; gap: 18px; }
.config-home-link, .changelog-trigger { display: inline-flex; align-items: center; gap: 6px; border: 0; padding: 0; background: none; color: var(--muted); font-size: 14px; text-decoration: none; cursor: pointer; }
.config-home-link:hover, .changelog-trigger:hover { color: var(--text); }
.new-badge { padding: 0 5px; border-radius: 3px; background: var(--accent-soft); color: var(--accent); font: 500 10px/1.6 var(--mono); }

.intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: end; padding: 32px 0 24px; }
.eyebrow { display: none; }
.intro h1 { font-size: 28px; }
.intro h1 span { color: inherit; }
.intro-copy { color: var(--muted); font-size: 14px; }

.workspace { display: grid; grid-template-columns: minmax(0, 470px) minmax(0, 1fr); gap: 28px; align-items: start; }
.editor { display: grid; gap: 16px; min-width: 0; }
.section { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.section-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.section-title { display: flex; align-items: baseline; gap: 10px; font-size: 15px; font-weight: 600; }
.section-title .number { color: var(--soft); font: 500 12px var(--mono); font-style: normal; }
.section-note { color: var(--soft); font-size: 12px; }
.section-body { padding: 16px; }
.group-label { margin-bottom: 10px; color: var(--muted); font-size: 12px; }

.fields { display: grid; grid-template-columns: 1fr 120px; gap: 12px; }
.fields > label { display: grid; gap: 5px; align-content: start; }
.fields > label > span, .fields label > .key-heading { color: var(--muted); font-size: 12px; font-weight: 500; }
.wide { grid-column: 1 / -1; }
.hint { color: var(--soft); font-size: 12px; line-height: 1.45; }
.key-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.key-help { border: 0; padding: 0; background: none; color: var(--accent); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.key-state { font-size: 12px; }
.key-state:empty { display: none; }
.key-state.ok { color: var(--ok); }
.key-state.error { color: var(--error); }

/* Region picker */
.region-picker { position: relative; }
.region-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; }
.region-button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 12px 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.region-button:hover { border-color: var(--text); }
.region-button:focus-visible, .region-button[aria-expanded="true"] { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px var(--ring); }
.region-label { flex: 1; font-size: 14px; }
/* Same chevron as the native selects, drawn in CSS instead of the "⌄" glyph. */
.region-chevron { position: relative; flex: none; width: 10px; height: 6px; font-size: 0; transition: transform .18s ease; }
.region-chevron::before, .region-chevron::after { content: ""; position: absolute; top: 0; width: 6px; height: 1.6px; border-radius: 1px; background: var(--muted); }
.region-chevron::before { left: 0; transform: translateY(2.2px) rotate(40deg); }
.region-chevron::after { right: 0; transform: translateY(2.2px) rotate(-40deg); }
.region-button[aria-expanded="true"] .region-chevron { transform: rotate(180deg); }
.region-flag { display: inline-flex; flex: none; width: 20px; height: 15px; overflow: hidden; border-radius: 2px; box-shadow: 0 0 0 1px rgba(127, 127, 127, .25); }
.region-flag img { display: block; width: 20px; height: 15px; }
.region-menu { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0; display: grid; gap: 1px; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: 0 12px 32px rgba(0, 0, 0, .18); }
.region-option { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: 4px; background: none; color: var(--text); text-align: left; cursor: pointer; }
/* Region code on the right: LATAM's flag alone is easy to misread. */
.region-option::after { content: attr(data-region); margin-left: auto; color: var(--soft); font: 500 11px var(--mono); text-transform: uppercase; }
.region-option:hover, .region-option:focus-visible { outline: none; background: var(--surface-2); }
.region-option[aria-selected="true"] { background: var(--surface-2); }
.region-option[aria-selected="true"] .region-label { font-weight: 600; }
.region-option[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--accent); }
.region-option[aria-selected="true"]::after { color: var(--accent); }

/* Checkbox chips */
.chip-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.chip { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 13px; cursor: pointer; user-select: none; }
.chip:hover { border-color: var(--line-strong); }
.chip:has(input:checked) { border-color: var(--text); }
.fields > label.chip { display: flex; }
.chip.key-mode { min-height: 40px; }
.chip.is-locked { cursor: not-allowed; }

/* Select rows (RR, K/D, animations) and colour rows */
.kd-scope, .background-control { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.kd-scope > span, .background-control > span:first-child { color: var(--muted); }
.kd-scope select { width: 190px; }
.kd-scope .hint { flex-basis: 100%; }
.color, .opacity-control { display: inline-flex; align-items: center; gap: 8px; }
.color input[type=color] { width: 30px; height: 26px; padding: 0; border: 1px solid var(--line-strong); border-radius: 4px; background: none; cursor: pointer; }
.color output, .opacity-control output { min-width: 64px; font: 500 12px var(--mono); color: var(--muted); }
.opacity-control input { width: 130px; }

/* Twitch session */
.twitch-live { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.twitch-live-head { display: grid; gap: 10px; }
.twitch-live-head strong { font-size: 13px; font-weight: 600; }
.twitch-live-head p { margin-top: 2px; color: var(--muted); font-size: 12px; }
.twitch-live-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.twitch-live-actions button { height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: 13px; cursor: pointer; }
.twitch-live-actions button:hover { border-color: var(--text); }
#twitchState { color: var(--muted); font-size: 12px; }
#twitchState.ok, #twitchState.live { color: var(--ok); }
#twitchState.error { color: var(--error); }

/* Format picker (generated by JS) */
.style-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
.preset { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-align: left; cursor: pointer; }
.preset:hover { border-color: var(--line-strong); }
.preset.active { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.preset strong { display: block; font-size: 13px; font-weight: 600; }
.preset small { display: block; color: var(--muted); font-size: 12px; }
.thumb { position: relative; display: block; width: 120px; height: 44px; overflow: hidden; border-radius: 4px; background: var(--stage); }
.thumb::before, .thumb::after { display: none; }
.thumb iframe { position: absolute; left: 50%; top: 50%; width: var(--thumb-w); height: var(--thumb-h); border: 0; pointer-events: none; transform: translate(-50%, -50%) scale(var(--thumb-scale)); transform-origin: center; }

.feedback-notice, .streamer-notice { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; }
.feedback-notice svg, .streamer-notice-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.feedback-notice button, .streamer-notice button { border: 0; padding: 0; background: none; color: var(--text); font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Preview column */
.preview-column { position: sticky; top: 16px; display: grid; gap: 16px; min-width: 0; }
.preview-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.preview-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.preview-title { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.preview-title .dot { display: none; }
.hud-name { color: var(--muted); font-weight: 400; }
.preview-modes { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.preview-modes button { height: 28px; padding: 0 10px; border: 0; border-radius: 4px; background: none; color: var(--muted); font-size: 12px; font-weight: 500; cursor: pointer; }
.preview-modes button.active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.preview-panel .stage { min-height: 380px; margin: 12px; }
.stage iframe { position: absolute; z-index: 1; left: 50%; top: 50%; border: 0; transform: translate(-50%, -50%) scale(var(--fit-scale, var(--preview-scale, .8))) translate(var(--fit-dx, 0px), var(--fit-dy, 0px)); transform-origin: center; }
/* "In stream" shows the whole Browser Source canvas in a corner, outlined,
   so the empty part of the canvas is visible. "Large" centres the panel. */
.stage.is-stream iframe { outline: 2px dashed rgba(255, 255, 255, .3); left: 24px !important; top: 24px !important; transform: scale(var(--stream-scale, .54)) !important; transform-origin: top left !important; }
/* In stream the stage stands for a 1920×1080 live: the overlay keeps its real
   proportion, including the size chosen in the configurator. */
.preview-panel .stage.is-stream { min-height: 0; aspect-ratio: 16 / 9; }
.stage.is-stream::after { content: "1920 × 1080"; position: absolute; right: 10px; bottom: 8px; z-index: 2; color: rgba(255, 255, 255, .45); font: 500 11px var(--mono); pointer-events: none; }

.output { display: grid; gap: 10px; padding: 4px 16px 16px; }
.output-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 600; }
.output-heading strong { color: var(--ok); font: 500 11px var(--mono); text-transform: lowercase; }
.urlrow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.urlrow .url { grid-column: 1 / -1; }
.urlrow .copy, .urlrow .reset { justify-content: center; text-align: center; }
.obs-drag { display: inline-flex; align-items: center; color: inherit; text-decoration: none; cursor: grab; }
.obs-drag:active { cursor: grabbing; }
.obs-drag[aria-disabled="true"], .urlrow .copy:disabled { opacity: .45; cursor: not-allowed; }
.drag-hint { margin: 8px 0 0; }
.url { min-height: 38px; padding: 9px 10px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg); font: 400 12px/1.5 var(--mono); white-space: nowrap; text-overflow: ellipsis; user-select: all; }
.copy, .reset { height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.copy { border-color: var(--text); background: var(--text); color: var(--on-text); }
.copy:hover { background: var(--text-strong); }
.copy.changed { border-color: var(--ok); background: var(--ok); }
.reset:hover { border-color: var(--text); }
.obs { color: var(--muted); font-size: 13px; }
.obs strong { color: var(--text); font: 500 13px var(--mono); }
.refresh-note { display: flex; gap: 10px; align-items: flex-start; padding-top: 10px; border-top: 1px solid var(--line); }
.refresh-icon { flex: none; width: 16px; height: 16px; margin-top: 2px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.refresh-copy { display: grid; gap: 1px; font-size: 12px; color: var(--muted); }
.refresh-copy strong { color: var(--text); font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; }

/* Live streamers */
.live-board { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.live-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 600; }
.live-label { display: inline-flex; align-items: center; gap: 8px; }
.live-label i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
#liveCount { color: var(--muted); font: 500 12px var(--mono); }
.live-empty { padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); font-size: 13px; }
.live-empty strong { font-weight: 500; }
.live-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.live-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.live-card:hover { border-color: var(--text); }
.live-shot { position: relative; aspect-ratio: 16 / 9; background: var(--stage); }
.live-shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.live-badge, .live-viewers { position: absolute; top: 6px; padding: 1px 5px; border-radius: 3px; color: #fff; font: 500 10px/1.5 var(--mono); }
.live-badge { left: 6px; background: #d4183a; }
.live-viewers { right: 6px; background: rgba(0,0,0,.7); }
.live-info { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 4px 8px; padding: 8px; }
.live-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.live-name { display: block; overflow: hidden; font-size: 12px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.live-game { display: block; overflow: hidden; color: var(--muted); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.live-stream-title { grid-column: 1 / -1; display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.4; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* FAQ and footer of the configurator */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 40px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--text); }
.about h2 { font-size: 22px; }
.about > div > p { margin-top: 8px; color: var(--muted); font-size: 14px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { padding: 12px 0; font-size: 14px; font-weight: 500; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--soft); font-family: var(--mono); }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding: 0 0 14px; color: var(--muted); font-size: 14px; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.footer .credit { color: var(--soft); }

/* ---------- Dialogs ---------- */
dialog { padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0,0,0,.2); }
dialog::backdrop, .changelog-modal { background: rgba(20, 20, 22, .45); }
.key-guide { width: min(460px, 100% - 32px); }
.key-guide-inner { display: grid; gap: 16px; padding: 20px; }
.key-guide-head, .feedback-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.key-guide-head h2, .feedback-dialog-head h2 { font-size: 18px; }
.feedback-dialog-head p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.guide-close, .feedback-close, .changelog-close { width: 30px; height: 30px; flex: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.guide-close:hover, .feedback-close:hover, .changelog-close:hover { color: var(--text); border-color: var(--text); }
.guide-security { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--ok-soft); color: var(--ok); font-size: 13px; }
.guide-security i { display: none; }
.key-steps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.key-steps li { display: flex; gap: 10px; font-size: 14px; }
.key-steps b { flex: none; width: 22px; color: var(--soft); font: 500 13px var(--mono); }
.key-steps a { color: var(--accent); }

.feedback-dialog { width: min(440px, 100% - 32px); }
.feedback-dialog form { display: grid; gap: 14px; padding: 20px; }
.feedback-dialog label { display: grid; gap: 5px; }
.feedback-dialog label > span { color: var(--muted); font-size: 12px; font-weight: 500; }
.feedback-submit { height: 40px; border: 1px solid var(--text); border-radius: var(--radius); background: var(--text); color: var(--on-text); font-size: 14px; font-weight: 500; cursor: pointer; }
.feedback-submit:disabled { opacity: .5; cursor: progress; }
.feedback-status { min-height: 1em; color: var(--muted); font-size: 13px; }
.feedback-status.ok { color: var(--ok); }
.feedback-status.error { color: var(--error); }

.changelog-modal { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 16px; }
.changelog-card { position: relative; display: grid; gap: 14px; width: min(480px, 100%); padding: 24px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); box-shadow: 0 24px 60px rgba(0,0,0,.2); }
.changelog-close { position: absolute; top: 14px; right: 14px; }
.changelog-kicker { color: var(--accent); font: 500 12px var(--mono); text-transform: lowercase; }
.changelog-card h2 { padding-right: 40px; font-size: 20px; }
.changelog-intro { color: var(--muted); font-size: 14px; }
.changelog-items { display: grid; border-top: 1px solid var(--line); }
.changelog-items article { padding: 10px 0; border-bottom: 1px solid var(--line); }
.changelog-items strong { font-size: 14px; font-weight: 600; }
.changelog-items p { margin-top: 2px; color: var(--muted); font-size: 13px; }
.changelog-history { color: var(--muted); font-size: 13px; }
.changelog-confirm { justify-self: start; height: 38px; padding: 0 18px; border: 1px solid var(--text); border-radius: var(--radius); background: var(--text); color: var(--on-text); font-size: 14px; font-weight: 500; cursor: pointer; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-column { position: static; }
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 44px; }
}
@media (max-width: 760px) {
  .topnav > a:not(.btn) { display: none; }
  .block-head, .intro, .about { grid-template-columns: 1fr; gap: 10px; }
  .format-row { grid-template-columns: 1fr auto; gap: 10px 16px; }
  .format-row .format-screen { grid-column: 1 / -1; }
  .steps li { grid-template-columns: 28px minmax(0, 1fr); }
  .steps li span { grid-column: 2; }
  .showcase-stage { height: 220px; }
  .showcase-stage { --showcase-scale: .6; }
  .site-footer { grid-template-columns: 1fr; }
  .footer-links { grid-row: auto; grid-column: 1; }
  .chip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-panel .stage { min-height: 260px; }
  .head-right { gap: 12px; }
}
@media (max-width: 480px) {
  .topnav .lang-select { display: none; }
  .brand-name { white-space: nowrap; }
  .masthead .beta-badge, .config-home-link, .masthead .new-badge { display: none; }
  .masthead { gap: 12px; }
  .head-right { gap: 10px; }
  .showcase-stage { --showcase-scale: .5; }
  .fields { grid-template-columns: 1fr 96px; }
  .style-grid { grid-template-columns: 1fr; }
  .urlrow { grid-template-columns: 1fr 1fr; }
  .url { grid-column: 1 / -1; }
  .obs-drag { display: none; }
  .specs div { grid-template-columns: 1fr; gap: 0; }
  .hero-actions { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Format picker thumbnails are wider than the original 96px ones. */
.thumb iframe { transform: translate(-50%, -50%) scale(calc(var(--thumb-scale) * 1.25)); }

/* ---------- Shared header for secondary pages ---------- */
.page .shell { width: min(1040px, 100% - 32px); }
.page .masthead, .page .nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; border-bottom: 1px solid var(--line); background: var(--surface); box-shadow: 0 0 0 100vmax var(--surface); clip-path: inset(0 -100vmax); }
.page .brand img { width: 24px; height: 24px; }
.page .brand strong, .page .brand span { font-size: 15px; font-weight: 600; }
.page .brand b { font-weight: 600; }
.page .nav-actions { display: flex; align-items: center; gap: 18px; }
.page .nav-actions > a:not(.cta):not(.back) { color: var(--muted); font-size: 14px; text-decoration: none; }
.page .nav-actions > a:not(.cta):not(.back):hover { color: var(--text); }
.page .cta, .page .back { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border: 1px solid var(--text); border-radius: var(--radius); background: var(--text); color: var(--on-text); font-size: 14px; font-weight: 500; text-decoration: none; }
.page .hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: end; padding: 40px 0 24px; border-bottom: 1px solid var(--text); }
.page .hero h1 { font-size: 30px; }
.page .hero h1 span, .page .hero h1 em { font-style: normal; color: inherit; }
.page .hero h1 br { display: none; }
.page .hero p { color: var(--muted); font-size: 14px; }
.page .eyebrow, .page .kicker { display: none; }
.page .footer { margin-top: 48px; }

/* ---------- Presets page ---------- */
.page-presets .workspace { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 24px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel-head { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 15px; }
.panel-head p { margin-top: 2px; color: var(--muted); font-size: 12px; }
.panel-body { display: grid; gap: 12px; padding: 16px; }
.current-preview { position: relative; height: 200px; overflow: hidden; border-radius: var(--radius); background-color: var(--stage); background-image: linear-gradient(45deg, var(--stage-check) 25%, transparent 25%), linear-gradient(-45deg, var(--stage-check) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--stage-check) 75%), linear-gradient(-45deg, transparent 75%, var(--stage-check) 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.current-preview iframe { position: absolute; top: 50%; left: 50%; border: 0; pointer-events: none; }
.style-summary { display: flex; flex-wrap: wrap; gap: 6px; }
.style-summary > * { padding: 2px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font: 500 12px var(--mono); }
.save-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.button:hover { border-color: var(--text); }
.button.primary { border-color: var(--text); background: var(--text); color: var(--on-text); }
.button.full { width: 100%; }
.button.ghost { background: transparent; }
.button:disabled { opacity: .5; cursor: progress; }
.privacy { color: var(--soft); font-size: 12px; }
.status { min-height: 1em; color: var(--muted); font-size: 13px; }
.status.ok, .status.success { color: var(--ok); }
.status.error { color: var(--error); }
.preset-list { align-content: start; }
.preset-card { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.preset-card .thumb { width: 110px; height: 46px; }
.preset-info { display: grid; gap: 6px; min-width: 0; }
.preset-name { overflow: hidden; font-size: 14px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.preset-card .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.preset-card .actions button { height: 30px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); font-size: 12px; cursor: pointer; }
.preset-card .actions button:hover { border-color: var(--text); }
.preset-card .actions .delete { color: var(--error); }
.preset-list .empty { padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); font-size: 13px; }
.tip { display: flex; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 13px; }
.tip b { display: none; }

/* ---------- News page ---------- */
.timeline { display: grid; margin-top: 8px; }
.entry { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 24px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.entry .marker { display: none; }
.entry-card, .entry-head { display: contents; }
.entry-head > div { grid-column: 2; grid-row: 1; }
.entry-head h2 { font-size: 19px; }
.entry-head p { margin-top: 4px; color: var(--muted); font-size: 14px; }
.date { grid-column: 1; grid-row: 1; color: var(--muted); font: 500 12px/1.9 var(--mono); text-transform: lowercase; }
.changes { grid-column: 2; display: grid; gap: 12px; margin: 12px 0 0; padding: 0; list-style: none; }
.changes li { padding-left: 14px; border-left: 2px solid var(--line); }
.changes strong { display: block; font-size: 14px; font-weight: 600; }
.changes span { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; }

/* ---------- Admin ---------- */
.page-admin .shell { width: min(1100px, 100% - 32px); padding: 24px 0 48px; }
.page-admin .shell > .brand { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 28px; }
.page-admin .heading { font-size: 28px; }
.page-admin .lede { margin: 6px 0 24px; color: var(--muted); font-size: 14px; }
.page-admin .card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
#loginCard { max-width: 420px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-head h2 { font-size: 18px; }
.card-head p { margin-top: 2px; color: var(--muted); font-size: 13px; }
.field { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.row { display: flex; gap: 8px; margin-top: 12px; }
.page-admin .card > h2 { margin-top: 28px; font-size: 17px; }
.page-admin .card > h2 + p, .note { color: var(--muted); font-size: 13px; }
.note { margin-top: 14px; }

.page-admin .admin-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); padding: 0; overflow: hidden; }
.admin-sidebar { display: flex; flex-direction: column; gap: 8px; padding: 16px 12px; border-right: 1px solid var(--line); background: var(--bg); }
.admin-nav-label { padding: 0 8px; color: var(--soft); font-size: 12px; }
.admin-nav { display: grid; gap: 2px; }
.admin-nav button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 4px; background: none; color: var(--muted); font-size: 14px; text-align: left; cursor: pointer; }
.admin-nav button i { color: var(--soft); font: 500 11px var(--mono); font-style: normal; }
.admin-nav button:hover { color: var(--text); }
.admin-nav button.active { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.admin-side-bottom { margin-top: auto; }
.admin-side-bottom .button { width: 100%; }
.admin-main { min-width: 0; padding: 20px; }
.admin-view { display: grid; gap: 14px; align-content: start; }
.admin-view > h2 { font-size: 18px; }
.admin-view > p { color: var(--muted); font-size: 13px; }
.admin-view .card-head { margin-bottom: 0; }
.operations { display: grid; gap: 14px; }
.operations-title { color: var(--muted); font-size: 13px; font-weight: 500; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); }
.metric { display: grid; gap: 2px; padding: 14px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { font: 500 24px/1.3 var(--mono); }
.metric-detail { color: var(--soft); font-size: 12px; }
.services { display: flex; flex-wrap: wrap; gap: 6px; }
.service { padding: 3px 8px; border-radius: 4px; background: var(--ok-soft); color: var(--ok); font: 500 12px var(--mono); }
.service.off { background: var(--error-soft); color: var(--error); }
.operations-note { color: var(--soft); font-size: 12px; }
.streamer-list, .feedback-list { display: grid; gap: 8px; }
.streamer { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.streamer-main { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; }
.streamer .avatar { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font: 500 12px var(--mono); }
.streamer .login { overflow: hidden; font: 400 13px var(--mono); white-space: nowrap; text-overflow: ellipsis; }
.remove { border: 0; padding: 0; background: none; color: var(--error); font-size: 13px; cursor: pointer; }
.feedback-item { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.feedback-item-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.feedback-tag { padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 4px; font: 500 11px var(--mono); text-transform: lowercase; }
.feedback-date, .feedback-contact { color: var(--muted); font-size: 12px; }
.feedback-message { font-size: 14px; white-space: pre-wrap; }
.feedback-actions, .request-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.feedback-actions button, .request-actions button { height: 30px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); font-size: 12px; cursor: pointer; }
.feedback-actions button.active { border-color: var(--text); background: var(--text); color: var(--on-text); }
.request-actions .approve { border-color: var(--ok); color: var(--ok); }
.empty { color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
  .page .hero, .page-presets .workspace { grid-template-columns: 1fr; }
  .page .nav-actions > a:not(.cta):not(.back) { display: none; }
  .entry { grid-template-columns: 1fr; }
  .date, .entry-head > div { grid-row: auto; }
  .entry-head > div, .changes { grid-column: 1; }
  .page-admin .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

/* ---------- Motion ----------
   Short and quiet on purpose: things settle into place instead of bouncing.
   Everything sits behind prefers-reduced-motion. */
:root { --ease-out: cubic-bezier(.2, .7, .2, 1); }

/* The rotating showcase works with or without motion: only the cross-fade is
   animated. Before motion.js runs, the first iframe is simply visible. */
.showcase-stage.is-rotating iframe { opacity: 0; }
.showcase-stage.is-rotating iframe.is-visible { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  /* Interactive elements react softly. */
  .btn, .landing-nav-cta, .button, .copy, .reset, .feedback-submit, .changelog-confirm, .theme-toggle,
  .chip, .preset, .region-button, .region-option, .preview-modes button, .twitch-live-actions button,
  .live-card, .admin-nav button, .preset-card .actions button, .feedback-actions button,
  .topnav > a, .config-home-link, .changelog-trigger, .link-quiet, .footer-links a,
  input, select, textarea {
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .12s ease, opacity .15s ease;
  }
  .btn:active, .button:active, .copy:active, .reset:active, .feedback-submit:active, .changelog-confirm:active,
  .theme-toggle:active, .preset:active, .chip:active, .preview-modes button:active { transform: translateY(1px); }

  /* Homepage: the first screen settles in, one line after the other. */
  .hero-text > *, .specs > div, .showcase { animation: rise .5s var(--ease-out) both; }
  .hero-text > :nth-child(2) { animation-delay: .06s; }
  .hero-text > :nth-child(3) { animation-delay: .12s; }
  .specs > div:nth-child(1) { animation-delay: .1s; }
  .specs > div:nth-child(2) { animation-delay: .15s; }
  .specs > div:nth-child(3) { animation-delay: .2s; }
  .specs > div:nth-child(4) { animation-delay: .25s; }
  .showcase { animation-delay: .2s; }
  .showcase-stage.is-rotating iframe { transition: opacity .6s ease; }
  .showcase figcaption.is-changing span:nth-child(-n+2) { animation: swap-in .4s var(--ease-out); }

  /* Scroll reveal (class added by motion.js only). */
  .reveal { opacity: 0; transform: translateY(14px); }
  .reveal.is-in { opacity: 1; transform: none; transition: opacity .5s ease var(--reveal-delay, 0ms), transform .5s var(--ease-out) var(--reveal-delay, 0ms); }

  /* Format list: the preview leans in on hover. */
  .format-screen iframe { transition: transform .35s var(--ease-out); }
  .format-row:hover .format-screen iframe { transform: translate(-50%, -50%) scale(calc(var(--fit-scale, var(--source-scale)) * 1.06)) translate(var(--fit-dx, 0px), var(--fit-dy, 0px)); }
  .format-row h3 { transition: color .15s ease; }
  .format-row:hover h3 { color: var(--accent); }

  /* Configurator: picking a format. The tile gives a small press, its
     thumbnail lights up, and the large preview slides in once loaded. */
  .preset.selecting { animation: press .28s var(--ease-out); }
  .preset .thumb { transition: box-shadow .2s ease; }
  .preset.active .thumb { box-shadow: 0 0 0 2px var(--accent); }
  .preset:hover .thumb iframe { transition: transform .3s var(--ease-out); transform: translate(-50%, -50%) scale(calc(var(--thumb-scale) * 1.36)); }
  .stage iframe { transition: left .3s var(--ease-out), top .3s var(--ease-out), transform .3s var(--ease-out); }
  .stage.is-loaded iframe { animation: fade-in .25s ease; }
  .stage.is-switching iframe { animation: switch-in .42s var(--ease-out); }
  .chip.changed input { animation: press .25s var(--ease-out); }
  .copy.is-copied { border-color: var(--ok); background: var(--ok); color: #fff; animation: press .3s var(--ease-out); }

  /* Menus and dialogs open instead of appearing. */
  .region-menu:not([hidden]) { animation: drop .16s var(--ease-out); transform-origin: top; }
  dialog[open] { animation: pop .2s var(--ease-out); }
  dialog[open]::backdrop { animation: fade-in .2s ease; }
  .changelog-modal:not([hidden]) { animation: fade-in .2s ease; }
  .changelog-modal:not([hidden]) .changelog-card { animation: pop .24s var(--ease-out); }
  .faq details[open] p { animation: drop .2s var(--ease-out); }
  .faq summary::after { display: inline-block; transition: transform .2s var(--ease-out); }
  .faq details[open] summary::after { transform: rotate(180deg); }

  /* Live streamers, presets and admin views. */
  .live-card:hover { transform: translateY(-2px); }
  .live-card { animation: rise .35s var(--ease-out) both; }
  .preset-card { animation: rise .3s var(--ease-out) both; }
  .admin-view:not([hidden]) { animation: fade-in .2s ease; }
  .live-label i { animation: live-dot 2s ease-in-out infinite; }

  /* Theme switch: a quick cross-fade (View Transitions, where supported). */
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; }
  .theme-toggle svg { transition: transform .35s var(--ease-out); }
  .theme-toggle:hover svg { transform: rotate(-20deg); }
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes press { 0% { scale: 1; } 40% { scale: .97; } 100% { scale: 1; } }
@keyframes swap-in { from { opacity: 0; translate: 0 4px; } to { opacity: 1; translate: 0 0; } }
/* `translate`/`opacity` only: the preview's transform is owned by the fit()
   script and by the stream mode's inline styles. */
@keyframes switch-in { from { opacity: 0; translate: 0 12px; filter: blur(3px); } to { opacity: 1; translate: 0 0; filter: none; } }
@keyframes live-dot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Format picker: schematic icon grid ----------
   Eleven formats no longer fit a list of live previews: the large preview on
   the right already shows the real overlay, so each tile only needs to convey
   the format's shape. Icons are inline SVG drawn with theme tokens. */
.style-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.style-grid .preset { display: grid; grid-template-columns: 1fr; justify-items: center; gap: 7px; min-width: 0; padding: 10px 6px 9px; text-align: center; }
.style-grid .preset strong { max-width: 100%; overflow: hidden; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.style-grid .preset small { max-width: 100%; margin-top: -5px; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; }
.preset-icon { display: block; width: 100%; max-width: 76px; height: auto; aspect-ratio: 64 / 36; overflow: visible; }
.preset-icon .t { fill: var(--text); opacity: .82; }
.preset-icon .s { fill: var(--soft); opacity: .55; }
.preset-icon .e { fill: var(--muted); opacity: .75; }
.preset-icon .p { fill: var(--surface-2, var(--line)); stroke: var(--line-strong); stroke-width: .6; }
.preset-icon .k { fill: var(--surface-2, var(--line)); stroke: var(--line-strong); stroke-width: .5; }
.preset-icon .g { fill: #e0a82e; }
.preset-icon .w { fill: #1fbf75; }
.preset-icon .l { fill: #e5484d; }
.preset-icon .c { fill: #38bdf8; }
.preset-icon .ow, .preset-icon .ol, .preset-icon .o, .preset-icon .ring-track, .preset-icon .ring-arc, .preset-icon .bracket { fill: none; stroke-width: 1.6; }
.preset-icon .ow { stroke: #1fbf75; }
.preset-icon .ol { stroke: #e5484d; }
.preset-icon .o, .preset-icon .bracket { stroke: var(--soft); }
.preset-icon .ring-track { stroke: var(--line-strong); stroke-width: 3; }
.preset-icon .ring-arc { stroke: #b45ee6; stroke-width: 3; stroke-linecap: round; }
.preset.active .preset-icon .e { fill: var(--accent); opacity: 1; }
@media (max-width: 420px) { .style-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* "New" tag for recently added formats: a small pill in the corner and a soft
   accent border, without competing with the selected-state outline. */
.style-grid .preset { position: relative; }
.style-grid .preset.is-new:not(.active) { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.preset-new { position: absolute; top: 5px; right: 5px; padding: 2px 5px 1px; border-radius: 999px; background: var(--accent); color: var(--on-text, #fff); font-size: 8.5px; font-weight: 700; letter-spacing: .06em; line-height: 1.3; text-transform: uppercase; pointer-events: none; }

/* Chat commands page (comandi.html) */
.commands-layout { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 24px; }
.commands-side, .commands-main { display: grid; gap: 16px; }
.commands-layout .kd-scope select { width: 180px; }
.bot-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bot-picker label { position: relative; }
.bot-picker input { position: absolute; opacity: 0; pointer-events: none; }
.bot-picker span { display: flex; align-items: center; justify-content: center; height: 36px; border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: 13px; cursor: pointer; }
.bot-picker input:checked + span { border-color: var(--text); background: var(--text); color: var(--on-text); }
.bot-picker input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }
.how-to { margin: 14px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.how-to li + li { margin-top: 4px; }
.cmd-name { font-family: var(--mono); }
.chat-link { padding: 0; border: 0; background: none; color: var(--soft); font-size: 12px; text-decoration: underline; cursor: pointer; }
.chat-link:hover { color: var(--text); }
.chat-template { width: 100%; min-height: 76px; font: 400 13px/1.5 var(--mono); }
.chat-preview { margin: 10px 0 14px; padding: 10px 12px; border-radius: var(--radius); background: var(--bg); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.chat-user { margin-right: 6px; color: var(--accent); font-weight: 600; }
.chat-user::after { content: ":"; }
.out-label { margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.chat-out { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.chat-out .url { display: block; }
.chat-out .url.is-empty { color: var(--soft); font-family: inherit; }
.chat-out .copy:disabled { opacity: .45; cursor: not-allowed; }
.chat-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.chat-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-align: left; cursor: pointer; }
.chat-chip:hover { border-color: var(--text); }
.chat-chip code { font: 500 12px var(--mono); }
.chat-chip span { color: var(--soft); font-size: 11px; }
.data-status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); font-size: 13px; }
.data-status .chat-link { margin-left: auto; }
.status-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--soft); }
.status-dot[data-state="live"] { background: var(--ok); }
.status-dot[data-state="loading"], .status-dot[data-state="queued"] { background: #e0a526; }
.status-dot[data-state="failed"] { background: var(--error); }
.phrase-group { margin-top: 14px; }
.phrase-group-title { margin-bottom: 6px; }
.phrase-group-title code { font: 500 12px var(--mono); color: var(--muted); }
.phrase-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 12px; padding: 4px 0; font-size: 13px; }
.phrase-row > span { color: var(--muted); }
.phrase-row input { width: 100%; }
.phrase-label { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.phrase-active { display: none; padding: 1px 6px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: 11px; font-style: normal; font-weight: 600; }
.phrase-row.is-active .phrase-active { display: inline-block; }
.phrase-row.is-active input { border-color: var(--ok); }
.phrase-field { display: grid; gap: 3px; }
.phrase-example { color: var(--soft); font-size: 11px; }
.phrase-example:empty { display: none; }
@media (max-width: 820px) {
  .commands-layout { grid-template-columns: 1fr; }
  .commands-side { display: contents; }
  .values-section { order: 2; }
  .phrase-row { grid-template-columns: 1fr; gap: 4px; }
}
.nav-new { display: inline-flex; align-items: center; gap: 6px; }

/* Narrow phones: keep the brand and the "open configurator" button on one
   line and inside the screen. The language select hides like on the home. */
@media (max-width: 560px) {
  .page .nav .lang { display: none; }
  .page .nav-actions { gap: 10px; }
  .page .brand span, .logo > span:first-of-type { white-space: nowrap; }
  .page .cta, .topnav .btn { padding: 0 12px; white-space: nowrap; }
}
@media (max-width: 400px) {
  .logo .tag-beta { display: none; }
  .topnav { gap: 10px; }
  .page .nav { gap: 10px; }
  .page .brand img + span { font-size: 14px; }
}
@media (max-width: 360px) {
  .logo > span:first-of-type, .page .brand img + span { display: none; }
}

/* Stable OBS link: status in the heading, one line under the buttons. */
.output-heading strong[data-tone="error"] { color: #d64545; }
.output-heading strong[data-tone="busy"] { color: var(--muted); }
.stable-link { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 14px; margin-top: 10px; }
.stable-link .hint { margin: 0; }
.stable-link .chat-link { flex: none; }

/* Automatic phrases inside the command that uses them (Comandi chat). */
.cmd-phrases { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.cmd-phrases > summary { padding: 9px 12px; color: var(--muted); font-size: 13px; cursor: pointer; }
.cmd-phrases > summary:hover, .cmd-phrases[open] > summary { color: var(--text); }
.cmd-phrases-body { padding: 0 12px 10px; }
.cmd-phrases .phrase-group { margin-top: 4px; }
.cmd-phrases .phrase-group + .phrase-group { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.phrase-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.phrase-group-head .hint { margin: 0; }
.phrase-group-head .chat-link { flex: none; }
.cmd-phrases + .out-label { margin-top: 14px; }

/* Shown only when the chosen format/size no longer matches the OBS source. */
.size-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 10px 12px; border: 1px solid #d99a1e; border-radius: var(--radius); background: rgba(240, 170, 40, .12); font-size: 13px; }
.size-notice[hidden] { display: none; }
.size-notice p { margin: 0; }
.size-notice strong { color: #b97700; }
.size-notice .reset { flex: none; height: 32px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .size-notice strong { color: #f2b544; } }
:root[data-theme="dark"] .size-notice strong { color: #f2b544; }
.size-notice .size-notice-dims { color: inherit; white-space: nowrap; }

/* ---- Quick account switch (configurator, Riot account section) ---- */
.account-switch { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.account-switch-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.account-switch-head strong { font-size: 13px; font-weight: 600; }
.account-switch-head .chat-link { color: var(--text); }
.account-list { display: flex; flex-wrap: wrap; gap: 6px; }
.account-list[hidden] { display: none; }
.account-chip { display: inline-flex; align-items: stretch; min-width: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.account-chip.active { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.account-pick { display: inline-flex; align-items: baseline; gap: 0; min-width: 0; height: 32px; padding: 0 4px 0 10px; border: 0; background: none; color: var(--muted); font-size: 13px; line-height: 32px; cursor: pointer; white-space: nowrap; }
.account-pick b { overflow: hidden; color: var(--text); font-weight: 600; text-overflow: ellipsis; }
.account-pick small { margin-left: 8px; color: var(--soft); font: 500 10px var(--mono); }
.account-remove { width: 26px; border: 0; background: none; color: var(--soft); font-size: 15px; line-height: 1; cursor: pointer; }
.account-remove:hover { color: var(--error); }
.account-chip:hover { border-color: var(--text); }

/* ---- Full-screen scenes in the configurator ---- */
.scene-label { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.scene-intro { margin-bottom: 12px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.scene-steps { display: grid; gap: 4px; margin: 14px 0 10px; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.scene-social:not([hidden]) { display: grid; gap: 8px; justify-items: start; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.scene-social .hint { margin: 0; }
#sceneSection .fields { grid-template-columns: 1fr 1fr; }
/* A scene previews as the whole 16:9 canvas, edge to edge. */
body.scene-mode .preview-panel .stage { min-height: 0; aspect-ratio: 16 / 9; }
body.scene-mode .stage iframe { transform: translate(-50%, -50%) scale(var(--scene-scale, .4)) !important; }
body.scene-mode .preview-modes { visibility: hidden; }

/* ---- Public page link under the OBS link ---- */
.public-page { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: 13px; }
.public-page[hidden] { display: none; }
.public-page a { min-width: 0; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }

/* ---- Public profile page (/u/<region>/<name>-<tag>) ---- */
.page-profile { --win: var(--ok); --loss: var(--error); --draw: var(--soft); --chart-line: var(--accent); --chart-line-2: #9b6bff; }
.page-profile .shell { width: min(880px, 100% - 32px); }
.profile-notice { margin: 48px 0; color: var(--muted); font-size: 15px; text-align: center; }
.profile-notice[hidden] { display: none; }
.profile-head { display: flex; align-items: center; gap: 20px; margin-top: 32px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.profile-emblem { width: 88px; height: 88px; flex: none; object-fit: contain; }
.profile-id { flex: 1; min-width: 0; }
.profile-id h1 { overflow: hidden; margin: 0; font-size: 28px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.profile-tag { color: var(--soft); font-weight: 500; }
.profile-rank { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; color: var(--muted); font-size: 14px; }
.profile-rank strong { color: var(--text); font-size: 17px; font-weight: 600; }
.profile-rank .mono { color: var(--text); }
.profile-bar { max-width: 320px; height: 6px; margin-top: 10px; border-radius: 3px; background: var(--line); overflow: hidden; }
.profile-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.profile-sub { margin-top: 8px; color: var(--soft); font-size: 12px; }
.profile-block { margin-top: 28px; }
.profile-block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.profile-block-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.profile-block-head p { margin: 0; color: var(--muted); font-size: 13px; }
.profile-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); overflow: hidden; }
.profile-stats > div { min-width: 0; padding: 14px 16px; background: var(--surface); }
.profile-stats dt { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.profile-stats dd { margin: 6px 0 0; font-size: 22px; font-weight: 600; line-height: 1.15; white-space: nowrap; }
.profile-stats dd small { color: var(--soft); font-size: 12px; font-weight: 500; }
.page-profile .win { color: var(--win); }
.page-profile .loss { color: var(--loss); }
.page-profile .draw { color: var(--soft); }
.profile-chart { padding: 12px 8px 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.profile-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.profile-chart .ct { fill: var(--muted); font-family: var(--mono); }
.profile-chart .cg { stroke: var(--line); stroke-width: 1; }
.profile-chart .cz { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 4 5; }
.profile-chart .cv { stroke-width: 1.5; stroke-dasharray: 3 4; opacity: .7; }
.profile-chart .cv.up { stroke: var(--win); }
.profile-chart .cv.down { stroke: var(--loss); }
.profile-chart .cl { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.profile-chart .ch { fill-opacity: .18; }
.profile-chart .ch.win { fill: var(--win); }
.profile-chart .ch.loss { fill: var(--loss); }
.profile-chart .ch.draw { fill: var(--soft); }
.profile-chart .ch.best { fill: #e0a82e; fill-opacity: .25; }
.profile-chart .cd { stroke: var(--surface); stroke-width: 2; }
.profile-chart .cd.win { fill: var(--win); }
.profile-chart .cd.loss { fill: var(--loss); }
.profile-chart .cd.draw, .profile-chart .cd.start { fill: var(--soft); }
.profile-chart .cs { fill: #e0a82e; stroke: var(--surface); stroke-width: 1.5; stroke-linejoin: round; }
.profile-chart .cpb { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1; }
.profile-chart .cpt { fill: var(--text); font-family: var(--mono); font-weight: 500; }
.profile-chart .cpl.up .cpb { stroke: var(--win); }
.profile-chart .cpl.up .cpt { fill: var(--win); }
.profile-chart .cpl.down .cpb { stroke: var(--loss); }
.profile-chart .cpl.down .cpt { fill: var(--loss); }
.profile-dots { display: flex; align-items: center; gap: 5px; }
.profile-dots span { margin-right: 4px; }
.profile-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--soft); }
.profile-dots i.win { background: var(--win); }
.profile-dots i.loss { background: var(--loss); }
.profile-games { display: grid; gap: 1px; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); list-style: none; overflow: hidden; }
.profile-games:empty { display: none; }
.profile-game { display: grid; grid-template-columns: 40px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) 76px; align-items: center; gap: 14px; padding: 10px 14px 10px 11px; border-left: 3px solid var(--soft); background: var(--surface); font-size: 13px; }
.page-profile .profile-game { color: var(--text); }
.profile-game.win { border-left-color: var(--win); }
.profile-game.loss { border-left-color: var(--loss); }
.profile-game img, .profile-game-blank { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--bg); }
.profile-game div { display: grid; gap: 1px; min-width: 0; }
.profile-game strong { overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.profile-game span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.profile-game-score.win strong, .profile-game-rr.win { color: var(--win); }
.profile-game-score.loss strong, .profile-game-rr.loss { color: var(--loss); }
.profile-game-rr { font-size: 14px; font-weight: 500; text-align: right; white-space: nowrap; }
.profile-empty { padding: 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); font-size: 13px; line-height: 1.5; }
.profile-empty[hidden] { display: none; }
.profile-search { display: grid; gap: 8px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.profile-search label { color: var(--muted); font-size: 13px; }
.profile-search-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px auto; gap: 8px; max-width: 520px; }
@media (max-width: 720px) {
  .profile-head { flex-wrap: wrap; }
  .profile-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .profile-game { grid-template-columns: 36px minmax(0, 1fr) auto auto; gap: 10px; }
  .profile-game img, .profile-game-blank { width: 36px; height: 36px; }
  .profile-game-kda { display: none !important; }
}
@media (max-width: 420px) {
  .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-emblem { width: 64px; height: 64px; }
  .profile-id h1 { font-size: 22px; }
}
