/* PA1KA Stream Tools — shared studio layout for /hud and /hud?tool=commands.
   Tokens follow docs/PA1KA_DESIGN_SYSTEM.md (hub reference). */

:root {
  /* Core --pa-* colors come from hud-site-header.css (main site tokens). */
  --pa-field: var(--pa-bg);
  --pa-line: color-mix(in srgb,var(--pa-accent) 12%,transparent);
  --pa-line-soft: color-mix(in srgb,var(--pa-accent) 7%,transparent);
  --pa-line-strong: color-mix(in srgb,var(--pa-accent) 26%,transparent);
  --pa-accent-ink: var(--pa-surface-quiet);
  --pa-accent-soft: color-mix(in srgb,var(--pa-accent) 12%,transparent);
  --pa-gold: #dec17d;
  --pa-success: #64d79a;
  --pa-danger: #ed7180;
  --pa-content-width: 1240px;
  --pa-gutter: 32px;
  --pa-header: 65px;
  --pa-ease: cubic-bezier(.22, .61, .36, 1);
  --pa-shadow: 0 18px 44px rgba(0, 0, 0, .42);
  /* legacy variable names still read by inline styles in the dialogs */
  --muted: var(--pa-text-muted);
  --text: var(--pa-text);
}

/* Same Inter Variable file as the main site (SIL OFL, see hud-fonts/OFL.txt). */
@font-face { font-family: Inter; src: url('/hud-fonts/InterVariable.woff2') format('woff2'); font-style: normal; font-weight: 100 900; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; background: var(--pa-bg); scrollbar-color: var(--pa-border) var(--pa-bg); }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--pa-text);
  background: var(--pa-bg);
  font: 500 13px/1.5 var(--pa-font, Inter), system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
/* Same link reset as the main site, which the generated header styles rely on. */
#site-header-root a, .site-footer a { text-decoration: none; }
#site-header-root summary { list-style: none; }
#site-header-root summary::-webkit-details-marker { display: none; }
h1, h2, h3, p, ol, ul { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--pa-accent-bright); outline-offset: 2px; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  border: 0; white-space: nowrap;
}

/* Twitch sign-in hint injected by hud-auth.js for guests: one thin line, the button lives in step 4. */
.pa-hud-auth {
  display: flex; align-items: center; gap: 10px;
  width: min(var(--pa-content-width), calc(100% - 2 * var(--pa-gutter)));
  min-height: 36px; margin: 14px auto 0; padding: 6px 8px 6px 10px;
  border-radius: 10px; color: var(--pa-text-secondary); background: color-mix(in srgb,var(--pa-accent) 7%,transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--pa-accent) 18%,transparent);
  font-size: 12px; line-height: 1.4;
}
.pa-hud-auth::before {
  content: ""; flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px;
  background: color-mix(in srgb,var(--pa-accent) 18%,transparent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23c9a8ff'%3E%3Cpath d='M4.3 3 3 6.4v13.1h4.5V22h2.6l2.5-2.5h3.7l4.9-4.9V3H4.3Zm15.2 10.8-2.8 2.8h-4.5l-2.5 2.5v-2.5H5.9V4.8h13.6v9Zm-2.8-5.7v4.8h-1.8V8.1h1.8Zm-4.8 0v4.8H10V8.1h1.9Z'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.pa-hud-auth span { flex: 1 1 auto; min-width: 0; }
.pa-hud-auth b { color: var(--pa-text); font-weight: 650; }
.pa-hud-auth a {
  flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 28px; padding: 0 12px;
  border-radius: 7px; color: #fff; background: var(--pa-accent); font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background 220ms var(--pa-ease);
}
.pa-hud-auth a:hover { background: var(--pa-accent); }

/* ───────────── Page shell ───────────── */

.studio {
  width: min(var(--pa-content-width), calc(100% - 2 * var(--pa-gutter)));
  margin: 0 auto;
  padding: 20px 0 0;
}
.studio-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.studio-title { min-width: 0; }
.studio-title-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.studio-eyebrow { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--pa-text-meta); font-size: 11px; font-weight: 500; }
.studio-eyebrow a { color: var(--pa-text-secondary); text-decoration: none; }
.studio-eyebrow a:hover { color: var(--pa-accent-bright); }
.studio-eyebrow svg { width: 12px; height: 12px; opacity: .6; }
.studio-head h1 { color: var(--pa-text); font-size: 24px; font-weight: 750; line-height: 1.15; letter-spacing: -.5px; white-space: nowrap; }
.studio-head h1 span { color: var(--pa-accent); }
.studio-head p { max-width: 640px; color: var(--pa-text-muted); font-size: 12.5px; line-height: 1.45; }
.studio-head-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }

.tool-tabs { display: inline-flex; gap: 2px; padding: 4px; border-radius: 12px; background: var(--pa-surface-quiet); box-shadow: inset 0 0 0 1px var(--pa-line-soft); }
.tool-tabs a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 12px;
  border-radius: 8px; color: var(--pa-text-secondary); font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: color 220ms var(--pa-ease), background 220ms var(--pa-ease);
}
.tool-tabs a svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool-tabs a:hover { color: var(--pa-text); }
.tool-tabs a[aria-current="page"] { color: var(--pa-text); background: var(--pa-surface-raised); box-shadow: inset 0 0 0 1px var(--pa-line-strong); }
.tool-tabs a[aria-current="page"] svg { color: var(--pa-accent); }

/* ───────────── Buttons ───────────── */

.pa-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 11px 16px;
  border: 0; border-radius: 8px;
  color: var(--pa-text); background: var(--pa-surface-raised);
  box-shadow: inset 0 0 0 1px var(--pa-line);
  font-size: 12px; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background 220ms var(--pa-ease), box-shadow 220ms var(--pa-ease), color 220ms var(--pa-ease), transform 220ms var(--pa-ease);
}
.pa-btn:hover { background: var(--pa-surface-raised); box-shadow: inset 0 0 0 1px var(--pa-line-strong); }
.pa-btn svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pa-btn.primary { color: var(--pa-accent-ink); background: var(--pa-accent); box-shadow: 0 10px 28px color-mix(in srgb,var(--pa-accent) 16%,transparent); }
.pa-btn.primary:hover { background: var(--pa-accent-bright); }
.pa-btn.primary:active { transform: scale(.99); }
.pa-btn.block { width: 100%; min-height: 46px; font-size: 13px; }
.pa-btn.ghost { background: transparent; box-shadow: none; color: var(--pa-text-secondary); }
.pa-btn.ghost:hover { color: var(--pa-text); background: rgba(255, 255, 255, .03); }
.pa-icon-btn {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 38px; height: 38px; padding: 0;
  border: 0; border-radius: 8px;
  color: var(--pa-text-secondary); background: var(--pa-surface-quiet);
  box-shadow: inset 0 0 0 1px var(--pa-line);
  font-size: 11px; font-weight: 700; letter-spacing: .03em;
  transition: color 220ms var(--pa-ease), background 220ms var(--pa-ease), box-shadow 220ms var(--pa-ease);
}
.pa-icon-btn:hover { color: var(--pa-text); background: var(--pa-surface-raised); box-shadow: inset 0 0 0 1px var(--pa-line-strong); }
.pa-icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.primary-btn.is-copied { color: #0c1d13; background: var(--pa-success); }
.primary-btn.attention-pulse { animation: pa-pulse 1.6s var(--pa-ease) 2; }
@keyframes pa-pulse {
  0%, 100% { box-shadow: 0 10px 28px color-mix(in srgb,var(--pa-accent) 16%,transparent), 0 0 0 0 color-mix(in srgb,var(--pa-accent) 45%,transparent); }
  50% { box-shadow: 0 10px 28px color-mix(in srgb,var(--pa-accent) 16%,transparent), 0 0 0 8px color-mix(in srgb,var(--pa-accent) 0%,transparent); }
}

/* ───────────── Studio grid ───────────── */

.studio-grid { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); align-items: start; gap: 16px; }
.studio-steps { display: grid; gap: 12px; min-width: 0; }
.studio-output { position: sticky; top: calc(var(--pa-header) + 16px); display: grid; gap: 12px; min-width: 0; }

.studio-card {
  position: relative; min-width: 0;
  padding: 16px 18px 18px;
  border-radius: 14px;
  background: var(--pa-surface);
  box-shadow: inset 0 0 0 1px var(--pa-line);
}

.step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 26px; }
.step-head > div { flex: 1 1 auto; min-width: 0; }
.step-aside { flex: 1 1 140px; min-width: 0; margin-left: auto; overflow: hidden; color: var(--pa-text-muted); font-size: 11.5px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.step-num {
  display: grid; place-items: center; flex: 0 0 auto; width: 24px; height: 24px;
  border-radius: 50%;
  color: var(--pa-accent); background: var(--pa-accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--pa-accent) 28%,transparent);
  font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums;
  transition: background 220ms var(--pa-ease), color 220ms var(--pa-ease);
}
.step-num svg { display: none; width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
[data-step-done="true"] > .step-head .step-num { color: var(--pa-accent-ink); background: var(--pa-accent); box-shadow: none; }
[data-step-done="true"] > .step-head .step-num span { display: none; }
[data-step-done="true"] > .step-head .step-num svg { display: block; }
.step-head h2 { flex: 0 0 auto; color: var(--pa-text); font-size: 14.5px; font-weight: 700; line-height: 1.3; letter-spacing: -.15px; }
.step-head p { margin-top: 2px; color: var(--pa-text-muted); font-size: 11.5px; line-height: 1.45; }
.step-head p.step-aside { margin-top: 0; }
.step-aside--wrap { flex-basis: 100%; margin-left: 34px; white-space: normal; text-align: left; }
.step-body { display: grid; gap: 12px; margin-top: 12px; }

/* Status pill in the step header (#connectionState). */
.connection-state {
  display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px;
  border-radius: 999px; color: var(--pa-text-muted); background: var(--pa-surface-quiet);
  box-shadow: inset 0 0 0 1px var(--pa-line-soft);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.connection-state-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pa-text-muted); }
.connection-state[data-state="ready"] { color: var(--pa-success); background: rgba(100, 215, 154, .08); box-shadow: inset 0 0 0 1px rgba(100, 215, 154, .22); }
.connection-state[data-state="ready"] .connection-state-dot { background: var(--pa-success); box-shadow: 0 0 0 3px rgba(100, 215, 154, .16); }

/* ───────────── Fields ───────────── */

.form-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 12px 10px; }
.form-group { position: relative; display: grid; align-content: start; gap: 6px; min-width: 0; }
.form-group.span-2 { grid-column: 1 / -1; }
.form-group > label, .field-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--pa-text-secondary); font-size: 11.5px; font-weight: 600; }
.field-shell {
  position: relative; display: flex; align-items: center; min-width: 0; height: 40px;
  border-radius: 8px; background: var(--pa-field);
  box-shadow: inset 0 0 0 1px var(--pa-line);
  transition: box-shadow 220ms var(--pa-ease), background 220ms var(--pa-ease);
}
.field-shell:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--pa-accent) 20%,transparent); }
.field-shell:focus-within { background: var(--pa-bg); box-shadow: inset 0 0 0 1px var(--pa-accent), 0 0 0 3px color-mix(in srgb,var(--pa-accent) 12%,transparent); }
.field-shell.invalid { box-shadow: inset 0 0 0 1px rgba(237, 113, 128, .7); }
.field-icon { display: grid; place-items: center; flex: 0 0 auto; width: 36px; color: var(--pa-text-muted); }
.field-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.field-shell:focus-within .field-icon { color: var(--pa-accent); }
.field-shell input {
  flex: 1 1 auto; min-width: 0; height: 100%; padding: 0 12px 0 0;
  border: 0; outline: 0; background: transparent;
  color: var(--pa-text); font-size: 13px; font-weight: 600;
}
.field-shell input::placeholder { color: var(--pa-text-muted); font-weight: 500; }
.field-shell input[type="password"] { letter-spacing: .12em; }
.field-shell input[type="password"]::placeholder { letter-spacing: 0; }
.field-actions { display: flex; flex: 0 0 auto; gap: 2px; padding-right: 6px; }
.field-action {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 7px; color: var(--pa-text-muted); background: transparent;
  transition: color 220ms var(--pa-ease), background 220ms var(--pa-ease);
}
.field-action:hover { color: var(--pa-text); background: color-mix(in srgb,var(--pa-accent) 10%,transparent); }
.field-action svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.text-link {
  display: inline-flex; align-items: center; gap: 4px; padding: 0;
  border: 0; background: none; color: var(--pa-accent); font-size: 11.5px; font-weight: 600; text-decoration: none;
}
.text-link:hover { color: var(--pa-accent-bright); text-decoration: underline; text-underline-offset: 3px; }
.hint { color: var(--pa-text-muted); font-size: 11.5px; line-height: 1.45; }
.format-status { display: none; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; }
.format-status[data-state] { display: inline-flex; }
.format-status[data-state="valid"] { color: var(--pa-success); }
.format-status[data-state="invalid"] { color: var(--pa-danger); }
.format-status[data-state="checking"] { color: var(--pa-text-muted); }
.fs-icon { display: grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: currentColor; }
.fs-icon svg { width: 10px; height: 10px; fill: none; stroke: var(--pa-surface); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.format-status[data-state="valid"] + .field-error, .form-group:has(.format-status[data-state]) > .hint { display: none; }
.field-error { display: none; color: var(--pa-danger); font-size: 11.5px; font-weight: 600; }
.field-error.active { display: block; }
.slot-status { display: none; align-items: center; gap: 6px; color: var(--pa-success); font-size: 11.5px; }
.slot-status--active { display: flex; flex-wrap: wrap; }
.slot-lock-icon { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
.slot-revoke { padding: 0; border: 0; background: none; color: var(--pa-accent); font-size: 11.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* Custom select (region / chat bot). */
.region-select, .bot-select { position: relative; }
.region-trigger, .bot-trigger {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 12px;
  border: 0; border-radius: 8px; background: var(--pa-field);
  box-shadow: inset 0 0 0 1px var(--pa-line);
  color: var(--pa-text); font-size: 13px; font-weight: 600; text-align: left;
  transition: box-shadow 220ms var(--pa-ease);
}
.region-trigger:hover, .bot-trigger:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--pa-accent) 20%,transparent); }
.region-trigger[aria-expanded="true"], .bot-trigger[aria-expanded="true"] { box-shadow: inset 0 0 0 1px var(--pa-accent), 0 0 0 3px color-mix(in srgb,var(--pa-accent) 12%,transparent); }
.region-label, .bot-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.region-caret { display: grid; place-items: center; width: 16px; color: var(--pa-text-muted); transition: transform 220ms var(--pa-ease); }
.region-caret svg { width: 11px; height: 8px; fill: none; stroke: currentColor; }
[aria-expanded="true"] .region-caret { transform: rotate(180deg); }
.region-flags { display: inline-flex; flex: 0 0 auto; }
.region-flags .fi { width: 20px; height: 14px; border-radius: 3px; display: inline-block; background-color: var(--pa-surface-raised); background-position: center; background-size: cover; background-repeat: no-repeat; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); }
/* Region flags are served by the HUD itself (flag-icons, MIT; see hud-flags/LICENSE). */
.fi-eu { background-image: url('/hud-flags/eu.svg'); }
.fi-us { background-image: url('/hud-flags/us.svg'); }
.fi-jp { background-image: url('/hud-flags/jp.svg'); }
.fi-kr { background-image: url('/hud-flags/kr.svg'); }
.fi-br { background-image: url('/hud-flags/br.svg'); }
.fi-mx { background-image: url('/hud-flags/mx.svg'); }
.region-dropdown, .bot-dropdown {
  position: absolute; z-index: 60; top: calc(100% + 6px); right: 0; left: 0;
  max-height: 300px; margin: 0; padding: 6px; overflow: auto; list-style: none;
  border-radius: 12px; background: color-mix(in srgb,var(--pa-surface-quiet) 98%,transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--pa-accent) 20%,transparent), var(--pa-shadow);
}
.bot-select--dropup .bot-dropdown { top: auto; bottom: calc(100% + 6px); }
.region-option, .bot-option {
  display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px;
  border-radius: 7px; color: var(--pa-text-secondary); font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.region-option:hover, .region-option:focus, .bot-option:hover, .bot-option:focus { outline: 0; color: var(--pa-text); background: color-mix(in srgb,var(--pa-accent) 9%,transparent); }
.region-option[aria-selected="true"], .bot-option[aria-selected="true"] { color: var(--pa-text); background: var(--pa-accent-soft); }
.bot-option-copy { display: grid; min-width: 0; }
.bot-option-copy small { color: var(--pa-text-muted); font-size: 11px; }
.bot-trigger-copy { display: flex; flex: 1 1 auto; align-items: center; gap: 10px; min-width: 0; }
.bot-icon { display: inline-grid; place-items: center; flex: 0 0 auto; width: 22px; height: 22px; overflow: hidden; border-radius: 6px; background: var(--pa-surface-raised); }
.bot-icon img, .bot-icon svg { width: 100%; height: 100%; object-fit: cover; }
.bot-icon--fallback { color: var(--pa-accent); font-size: 11px; font-weight: 800; }

/* ───────────── HUD style presets ───────────── */

.hud-preset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.hud-preset-button {
  position: relative; display: grid; justify-items: center; align-content: start; gap: 5px;
  min-width: 0; padding: 8px 4px 8px;
  border: 0; border-radius: 10px;
  color: var(--pa-text-secondary); background: var(--pa-surface-quiet);
  box-shadow: inset 0 0 0 1px var(--pa-line-soft);
  text-align: center;
  transition: background 220ms var(--pa-ease), box-shadow 220ms var(--pa-ease), color 220ms var(--pa-ease);
}
.hud-preset-button:hover { color: var(--pa-text); box-shadow: inset 0 0 0 1px var(--pa-line-strong); }
.hud-preset-button.active { color: var(--pa-text); background: var(--pa-surface-raised); box-shadow: inset 0 0 0 1.5px var(--pa-accent); }
.hud-preset-thumb { display: block; width: 100%; max-width: 64px; }
.hud-preset-thumb svg { display: block; width: 100%; height: auto; }
.hud-preset-thumb .t-plate { fill: var(--pa-surface-raised); }
.hud-preset-thumb .t-icon { fill: var(--pa-text-muted); transition: fill 220ms var(--pa-ease); }
.hud-preset-thumb .t-text { fill: var(--pa-text); }
.hud-preset-thumb .t-accent { fill: #dec17d; }
.hud-preset-thumb .t-track { fill: var(--pa-surface-raised); }
.hud-preset-thumb .t-soft { fill: var(--pa-text-muted); }
.hud-preset-thumb .t-win { fill: #64d79a; }
.hud-preset-thumb .t-loss { fill: #ed7180; }
.hud-preset-thumb .t-win-box { fill: rgba(100, 215, 154, .18); stroke: #64d79a; stroke-width: 1; }
.hud-preset-thumb .t-loss-box { fill: rgba(237, 113, 128, .18); stroke: #ed7180; stroke-width: 1; }
.hud-preset-button.active .t-icon { fill: var(--pa-accent); }
.hud-preset-copy { display: grid; min-width: 0; }
.hud-design-option-name { display: block; color: inherit; font-size: 11.5px; font-weight: 600; line-height: 1.25; }
/* The description of the selected style is shown once, next to the step title (hud-studio.js). */
.hud-design-option-note { display: none; }
/* hud-logic.js appends this badge to the default style button; it shows as a small gold mark. */
.hud-design-recommended {
  position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; padding: 0; overflow: hidden;
  border-radius: 50%; background: var(--pa-gold); box-shadow: 0 0 0 3px rgba(222, 193, 125, .14);
  color: transparent; font-size: 0;
}

/* ───────────── Element chips ───────────── */

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-toggle {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  min-height: 34px; padding: 0 12px 0 8px;
  border-radius: 999px; cursor: pointer;
  color: var(--pa-text-secondary); background: var(--pa-surface-quiet);
  box-shadow: inset 0 0 0 1px var(--pa-line);
  font-size: 12px; font-weight: 600; white-space: nowrap; user-select: none;
  transition: color 220ms var(--pa-ease), background 220ms var(--pa-ease), box-shadow 220ms var(--pa-ease);
}
.chip-toggle b { font-weight: inherit; }
.chip-toggle:hover { color: var(--pa-text); box-shadow: inset 0 0 0 1px var(--pa-line-strong); }
.chip-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.chip-check {
  display: grid; place-items: center; flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--pa-border);
  transition: background 220ms var(--pa-ease), box-shadow 220ms var(--pa-ease);
}
.chip-check svg { width: 11px; height: 11px; fill: none; stroke: var(--pa-accent-ink); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity 160ms var(--pa-ease); }
.chip-toggle:has(input:checked) { color: var(--pa-text); background: var(--pa-surface-raised); box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--pa-accent) 38%,transparent); }
.chip-toggle:has(input:checked) .chip-check { background: var(--pa-accent); box-shadow: none; }
.chip-toggle:has(input:checked) .chip-check svg { opacity: 1; }
.chip-toggle:has(input:focus-visible) { outline: 2px solid var(--pa-accent-bright); outline-offset: 2px; }
.chip-toggle:has(input:disabled) { cursor: not-allowed; opacity: .45; }

.color-lock {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px;
  border-radius: 10px; color: var(--pa-text-muted); background: var(--pa-surface-quiet);
  font-size: 12px;
}
.color-lock svg { width: 16px; height: 16px; flex: 0 0 auto; }
.color-lock strong { color: var(--pa-text-secondary); font-weight: 600; }
.legacy-colors { display: none; }

/* ───────────── Preview ───────────── */

.preview-card { padding: 0; overflow: hidden; }
.preview-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 8px 12px 8px 16px; }
.preview-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.preview-label { display: inline-flex; align-items: center; gap: 8px; color: var(--pa-text); font-size: 14.5px; font-weight: 700; }
.preview-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--pa-success); box-shadow: 0 0 0 4px rgba(100, 215, 154, .14); animation: pa-live 2.4s ease-in-out infinite; }
@keyframes pa-live { 50% { box-shadow: 0 0 0 7px rgba(100, 215, 154, 0); } }
.preview-preset-badge { padding: 4px 9px; overflow: hidden; border-radius: 6px; color: var(--pa-accent-bright); background: var(--pa-accent-soft); font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.preview-header-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.scale-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--pa-surface-quiet); box-shadow: inset 0 0 0 1px var(--pa-line-soft); }
.scale-switch button {
  min-height: 30px; padding: 0 10px; border: 0; border-radius: 6px;
  color: var(--pa-text-muted); background: transparent; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  transition: color 220ms var(--pa-ease), background 220ms var(--pa-ease);
}
.scale-switch button:hover { color: var(--pa-text); }
.scale-switch button[aria-pressed="true"] { color: var(--pa-text); background: var(--pa-surface-raised); box-shadow: inset 0 0 0 1px var(--pa-line-strong); }

.hud-stage { position: relative; margin: 0 12px; border-radius: 10px; overflow: hidden; background: var(--pa-bg); }
.hud-stage[data-stage-bg="neutral"] {
  background-color: var(--pa-surface-quiet);
  background-image: conic-gradient(var(--pa-surface) 25%, transparent 0 50%, var(--pa-surface) 0 75%, transparent 0);
  background-size: 20px 20px;
}
/* "Large" crops to the HUD itself, so the stage is wide and low; "As on stream" keeps the 16:9 canvas. */
.hud-screen { position: relative; width: 100%; aspect-ratio: 2.3 / 1; overflow: hidden; }
.preview.is-scene .hud-screen { width: min(100%, 640px); margin: 0 auto; aspect-ratio: 16 / 9; }
.hud-glow { display: none; }
.preview-frame {
  position: absolute; z-index: 2; top: 0; left: 0;
  width: 1600px; height: 900px;
  border: 0; background: transparent;
  /* Must match the widget document (normal) or Chrome paints an opaque white backdrop. */
  color-scheme: normal;
  transform: scale(.4); transform-origin: top left;
  pointer-events: none;
}
.hud-skeleton { position: absolute; z-index: 3; top: 50%; left: 50%; display: grid; gap: 10px; width: 46%; transform: translate(-50%, -50%); transition: opacity 280ms var(--pa-ease); pointer-events: none; }
.hud-skeleton.is-hidden { opacity: 0; }
.skel-row { display: flex; align-items: center; gap: 10px; }
.skel-block { border-radius: 6px; background: linear-gradient(90deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .11), rgba(255, 255, 255, .05)); background-size: 200% 100%; animation: pa-shimmer 1.4s linear infinite; }
.skel-icon { width: 44px; height: 44px; border-radius: 10px; }
.skel-name { flex: 1; height: 22px; }
.skel-bar { height: 8px; }
.skel-stats { width: 70%; height: 14px; }
@keyframes pa-shimmer { to { background-position: -200% 0; } }
.preview-empty { position: absolute; z-index: 1; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--pa-text-muted); font-size: 12px; text-align: center; transition: opacity 280ms; }
.preview-empty svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.preview-empty.is-hidden { opacity: 0; visibility: hidden; }
.preview-foot { display: flex; align-items: center; gap: 8px; padding: 9px 16px 11px; color: var(--pa-text-muted); font-size: 11.5px; }
.preview-foot svg { width: 14px; height: 14px; flex: 0 0 auto; fill: none; stroke: var(--pa-accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.preview-foot strong { color: var(--pa-text-secondary); font-weight: 650; }

/* Fullscreen preview (togglePreviewExpand). */
body.hud-preview-open { overflow: hidden; }
/* The sticky column is its own stacking context; lift it above the backdrop. */
body.hud-preview-open .studio-output { z-index: 20000; }
body.hud-preview-open::before { content: ""; position: fixed; z-index: 19999; inset: 0; background: color-mix(in srgb,var(--pa-bg) 82%,transparent); backdrop-filter: blur(10px); }
.studio-card.preview.is-expanded {
  position: fixed; z-index: 20000; inset: 18px; width: auto; max-width: none;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--pa-bg); box-shadow: inset 0 0 0 1px var(--pa-line-strong), 0 28px 90px rgba(0, 0, 0, .85);
}
.studio-card.preview.is-expanded .hud-stage { display: grid; place-items: center; min-height: 0; padding: 14px; }
.studio-card.preview.is-expanded .hud-screen { width: var(--expanded-preview-width, 100%); height: var(--expanded-preview-height, auto); max-width: 1600px; aspect-ratio: auto; border-radius: 8px; }

/* ───────────── OBS step ───────────── */

.ready-list { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 0 auto; padding: 0; list-style: none; }
.ready-list li {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  color: var(--pa-text-muted); font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.ready-list li::before {
  content: ""; flex: 0 0 auto; width: 14px; height: 14px; border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--pa-border);
}
.ready-list li[data-ok="true"] { color: var(--pa-text); }
.ready-list li[data-ok="true"]::before {
  box-shadow: none;
  background: var(--pa-success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230c1d13' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 9px no-repeat;
}
.ready-list li a { color: var(--pa-accent); }
.cta-row { display: grid; gap: 6px; }
/* Guests sign in right where the link is copied; the copy button returns after sign-in. */
.auth-login-btn { display: none !important; }
html[data-hud-auth="required"] .auth-login-btn { display: inline-flex !important; color: #fff; background: var(--pa-accent); box-shadow: 0 10px 28px color-mix(in srgb,var(--pa-accent) 20%,transparent); }
html[data-hud-auth="required"] .auth-login-btn:hover { background: var(--pa-accent); }
html[data-hud-auth="required"] .auth-login-btn svg { fill: currentColor; stroke: none; }
html[data-hud-auth="required"] .auth-login-btn svg path + path { fill: none; stroke: currentColor; stroke-width: 1.9; }
html[data-hud-auth="required"] .primary-btn { display: none; }
.cta-note { color: var(--pa-text-muted); font-size: 11.5px; text-align: center; }
.cta-note[data-ready="true"] { display: none; }
.check-state, .status { min-height: 0; color: var(--pa-text-muted); font-size: 12px; font-weight: 600; text-align: center; }
.check-state:empty, .status:empty { display: none; }
.check-state.ok, .status.ok { color: var(--pa-success); }
.check-state.error, .status.error { color: var(--pa-danger); }
.check-state.pending { color: var(--pa-gold); }
.result-box { display: none; padding: 14px 16px; border-radius: 12px; background: rgba(100, 215, 154, .07); box-shadow: inset 0 0 0 1px rgba(100, 215, 154, .2); }
.result-box h3 { display: flex; align-items: center; gap: 8px; color: var(--pa-text); font-size: 13px; font-weight: 700; }
.result-box h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--pa-success); }
.result-box p { margin-top: 4px; color: var(--pa-text-secondary); font-size: 12px; }
.masked-url { display: none; margin-top: 8px; color: var(--pa-text-muted); font-size: 11.5px; }
.masked-url.is-shown { display: block; }
.mu-key { color: var(--pa-accent); }
.result-actions { margin-top: 10px; }
.copy-btn {
  min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px;
  color: var(--pa-text); background: var(--pa-surface-raised); box-shadow: inset 0 0 0 1px var(--pa-line);
  font-size: 12px; font-weight: 600;
}
.copy-btn:hover { box-shadow: inset 0 0 0 1px var(--pa-line-strong); }
.obs-help { border-radius: 10px; background: var(--pa-surface-quiet); }
.obs-help summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 0 12px;
  color: var(--pa-text-secondary); font-size: 12px; font-weight: 600; list-style: none; cursor: pointer;
}
.obs-help summary::-webkit-details-marker { display: none; }
.obs-help summary:hover { color: var(--pa-text); }
.obs-help summary svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 220ms var(--pa-ease); }
.obs-help[open] summary svg { transform: rotate(180deg); }
.obs-help .obs-steps { padding-top: 2px; background: transparent; }
.obs-steps { display: grid; gap: 8px; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--pa-surface-quiet); list-style: none; counter-reset: obs; }
.obs-steps li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; color: var(--pa-text-secondary); font-size: 12px; line-height: 1.5; counter-increment: obs; }
.obs-steps li::before { content: counter(obs); display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; color: var(--pa-text-meta); background: var(--pa-surface); font-size: 10.5px; font-weight: 700; }
.obs-steps strong { color: var(--pa-text); font-weight: 650; }
.obs-steps code { padding: 1px 5px; border-radius: 4px; color: var(--pa-accent-bright); background: var(--pa-surface); font: 600 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ───────────── Chat commands ───────────── */

.preset-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.preset-btn {
  position: relative; display: grid; place-items: center; min-height: 36px; padding: 0 6px;
  border: 0; border-radius: 8px;
  color: var(--pa-text-secondary); background: var(--pa-surface-quiet);
  box-shadow: inset 0 0 0 1px var(--pa-line-soft);
  font: 650 12.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: background 220ms var(--pa-ease), box-shadow 220ms var(--pa-ease), color 220ms var(--pa-ease);
}
.preset-btn:hover { color: var(--pa-text); box-shadow: inset 0 0 0 1px var(--pa-line-strong); }
.preset-btn.active { color: var(--pa-text); background: var(--pa-surface-raised); box-shadow: inset 0 0 0 1.5px var(--pa-accent); }
.preset-recommended { position: absolute; top: -7px; right: 6px; padding: 1px 5px; border-radius: 4px; color: #241a0c; background: var(--pa-gold); font: 750 8.5px/1.4 Inter, sans-serif; letter-spacing: .02em; }
.preset-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.text-field {
  width: 100%; min-height: 40px; padding: 9px 12px;
  border: 0; border-radius: 8px; outline: 0;
  color: var(--pa-text); background: var(--pa-field);
  box-shadow: inset 0 0 0 1px var(--pa-line);
  font: 600 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: box-shadow 220ms var(--pa-ease);
}
.text-field:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--pa-accent) 20%,transparent); }
.text-field:focus { box-shadow: inset 0 0 0 1px var(--pa-accent), 0 0 0 3px color-mix(in srgb,var(--pa-accent) 12%,transparent); }
textarea.text-field { min-height: 64px; resize: vertical; }
.text-field.invalid { box-shadow: inset 0 0 0 1px rgba(237, 113, 128, .7); }
.command-name { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 12px; align-items: start; }
.tokens { display: flex; flex-wrap: wrap; gap: 6px; }
.token {
  min-height: 30px; padding: 0 9px; border: 0; border-radius: 7px;
  color: var(--pa-accent-bright); background: var(--pa-surface); box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--pa-accent) 16%,transparent);
  font: 600 11.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: background 220ms var(--pa-ease), box-shadow 220ms var(--pa-ease);
}
.token:hover { background: var(--pa-surface-raised); box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--pa-accent) 40%,transparent); }
.reset-btn { min-height: 32px; padding: 0 10px; border: 0; border-radius: 7px; color: var(--pa-text-muted); background: transparent; font-size: 12px; font-weight: 600; }
.reset-btn:hover { color: var(--pa-text); background: rgba(255, 255, 255, .04); }
.reset-template-btn { display: none; }
.subsection { display: grid; gap: 8px; }
.subsection-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.subsection-head > span { color: var(--pa-text-secondary); font-size: 12px; font-weight: 600; }

.chat-stage { margin: 0 12px; padding: 14px; border-radius: 12px; background: radial-gradient(80% 120% at 100% 0%, color-mix(in srgb,var(--pa-accent) 10%,transparent), transparent 60%), var(--pa-bg); }
.twitch-preview-wrap { overflow: hidden; border-radius: 10px; background: var(--pa-surface); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.twitch-window-head { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-bottom: 1px solid rgba(255, 255, 255, .06); color: var(--pa-text); font-size: 12.5px; }
.twitch-window-head span { color: var(--pa-accent); font-weight: 800; }
.twitch-window-head i { margin-left: auto; color: var(--pa-text-secondary); font-size: 10px; font-style: normal; font-weight: 700; letter-spacing: .06em; }
.twitch-preview { display: grid; align-content: end; gap: 2px; min-height: 140px; max-height: 320px; padding: 12px 8px; overflow-y: auto; font-family: Inter, "Roobert", sans-serif; }
.tw-line { padding: 5px 10px; border-radius: 6px; color: var(--pa-text); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.tw-badges { display: inline-flex; gap: 3px; margin-right: 4px; vertical-align: -3px; }
.tw-badge-tip { display: inline-flex; }
.tw-badge { width: 18px; height: 18px; border-radius: 3px; }
.tw-badge--broadcaster { display: inline-grid; place-items: center; background: #e91916; }
.tw-name { font-weight: 700; }
.tw-sep { margin-right: 5px; color: var(--pa-text); }
.tw-command .tw-message { font-weight: 700; }
.tw-highlight { background: color-mix(in srgb,var(--pa-accent) 14%,transparent); box-shadow: inset 3px 0 0 var(--pa-accent); }
.tw-highlight .tw-message { font-weight: 600; }

/* ───────────── Footer (same geometry as SiteFooter on the main site) ───────────── */

.site-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 16px;
  width: min(var(--pa-content-width), calc(100% - 2 * var(--pa-gutter)));
  margin: 54px auto 0; padding: 28px 0;
  border-top: 1px solid color-mix(in srgb,var(--pa-accent) 9.8%,transparent);
  color: var(--pa-text-muted); font-size: 11px; font-weight: 400;
}
.site-footer > span { width: auto; margin-left: auto; line-height: 1.6; text-align: right; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--pa-accent-bright); }

/* ───────────── Dialogs, toast, tooltip ───────────── */

.modal-overlay {
  position: fixed; z-index: 21000; inset: 0;
  display: grid; place-items: center; padding: 20px;
  background: color-mix(in srgb,var(--pa-bg) 86%,transparent); backdrop-filter: blur(12px);
  opacity: 0; visibility: hidden; transition: opacity 220ms var(--pa-ease), visibility 220ms;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  width: min(440px, 100%); max-height: calc(100dvh - 40px); overflow: auto;
  padding: 24px; border-radius: 16px;
  background: var(--pa-surface-quiet); box-shadow: inset 0 0 0 1px var(--pa-line-strong), 0 28px 80px rgba(0, 0, 0, .72);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.modal-head h3 { color: var(--pa-text); font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.modal-close { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; color: var(--pa-text-muted); background: var(--pa-surface-quiet); font-size: 18px; line-height: 1; }
.modal-close:hover { color: var(--pa-text); background: var(--pa-surface-raised); }
.modal-steps { display: grid; gap: 10px; padding: 0; list-style: none; counter-reset: modal; }
.modal-step { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; color: var(--pa-text-secondary); font-size: 13px; line-height: 1.55; counter-increment: modal; }
.modal-step::before { content: counter(modal); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: var(--pa-accent); background: var(--pa-accent-soft); font-size: 11px; font-weight: 750; }
.modal-step strong { color: var(--pa-text); }
.modal-trust { display: flex; gap: 10px; margin-bottom: 16px; padding: 12px 14px; border-radius: 12px; color: var(--pa-text-secondary); background: rgba(100, 215, 154, .06); font-size: 12px; line-height: 1.5; }
.modal-trust svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--pa-success); }
.link-inline { color: var(--pa-accent); font-weight: 650; }
.help-brand { display: inline-flex; align-items: center; gap: 5px; }
.help-logo { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; color: #fff; background: #5865f2; }
.help-logo svg { width: 12px; height: 12px; fill: currentColor; }
.adv-color-body { display: grid; gap: 8px; }
.adv-color-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--pa-surface-quiet); }
.adv-color-info p { color: var(--pa-text-muted); font-size: 11.5px; }
.color-field { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 10px; border-radius: 8px; background: var(--pa-field); box-shadow: inset 0 0 0 1px var(--pa-line); font-size: 12px; }
.color-field input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.cf-swatch { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }

.toast {
  position: fixed; z-index: 30000; left: 50%; bottom: 24px;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px); padding: 12px 16px;
  border-radius: 12px; color: var(--pa-text); background: var(--pa-surface);
  box-shadow: inset 0 0 0 1px var(--pa-line-strong), var(--pa-shadow);
  font-size: 13px; font-weight: 600;
  opacity: 0; visibility: hidden; transform: translate(-50%, 10px);
  transition: opacity 220ms var(--pa-ease), transform 220ms var(--pa-ease), visibility 220ms;
}
.toast.toast-show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.toast-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #0c1d13; background: var(--pa-success); }
.toast-icon svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.toast.toast-error .toast-icon { color: #2a0c11; background: var(--pa-danger); }
#tt {
  position: fixed; z-index: 99999; max-width: 280px; padding: 6px 10px;
  border-radius: 8px; color: var(--pa-text); background: var(--pa-surface);
  box-shadow: inset 0 0 0 1px var(--pa-line-strong), 0 8px 22px rgba(0, 0, 0, .55);
  font-size: 11.5px; font-weight: 500; line-height: 1.4;
  opacity: 0; transform: translateY(4px); pointer-events: none;
  transition: opacity 160ms ease, transform 180ms ease;
}
#tt.tt-visible { opacity: 1; transform: translateY(0); }

.pa-thanks-backdrop { position: fixed; z-index: 21000; inset: 0; display: grid; place-items: center; padding: 20px; background: color-mix(in srgb,var(--pa-bg) 88%,transparent); backdrop-filter: blur(12px); }
.pa-thanks-card { position: relative; width: min(520px, 100%); padding: 30px; border-radius: 16px; color: var(--pa-text); background: var(--pa-surface-quiet); box-shadow: inset 0 0 0 1px var(--pa-line-strong), 0 28px 80px rgba(0, 0, 0, .72); font-size: 13px; line-height: 1.7; }
.pa-thanks-card::before { content: ""; display: block; width: 32px; height: 2px; margin-bottom: 20px; background: var(--pa-accent); }
.pa-thanks-card small { color: var(--pa-text-meta); font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.pa-thanks-card h2 { margin: 7px 0 13px; font-size: 25px; line-height: 1.15; letter-spacing: -.5px; }
.pa-thanks-card p { margin: 0 0 12px; color: var(--pa-text-secondary); }
.pa-thanks-close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 0; border-radius: 8px; color: var(--pa-text-muted); background: var(--pa-surface-quiet); font-size: 18px; }
.pa-thanks-help { margin: 16px 0; padding: 12px 14px; border-radius: 12px; color: var(--pa-text-secondary); background: var(--pa-surface-quiet); font-size: 12px; }
.pa-thanks-help a { color: var(--pa-accent); }
.pa-thanks-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pa-thanks-actions a, .pa-thanks-actions button { display: inline-flex; align-items: center; min-height: 44px; padding: 11px 16px; border: 0; border-radius: 8px; color: var(--pa-text); background: var(--pa-surface-raised); box-shadow: inset 0 0 0 1px var(--pa-line); font-size: 12px; font-weight: 600; text-decoration: none; }
.pa-thanks-actions button { color: var(--pa-accent-ink); background: var(--pa-accent); box-shadow: none; }

/* ───────────── Responsive ───────────── */

@media (max-width: 1100px) {
  .studio-grid { display: flex; flex-direction: column; gap: 12px; }
  .studio-steps, .studio-output { display: contents; }
  .studio-grid > *, .studio-steps > *, .studio-output > * { width: 100%; }
  /* The preview stays pinned under the site header while the steps scroll. */
  [data-order="preview"] { order: 0; position: sticky; z-index: 20; top: calc(var(--pa-header) + 8px); box-shadow: inset 0 0 0 1px var(--pa-line), 0 14px 30px color-mix(in srgb,var(--pa-bg) 55%,transparent); }
  [data-order="account"] { order: 1; }
  [data-order="style"] { order: 2; }
  [data-order="elements"] { order: 3; }
  [data-order="obs"] { order: 4; }
  .studio-head { flex-direction: column; align-items: flex-start; gap: 12px; }
}

@media (max-width: 750px) {
  :root { --pa-gutter: 24px; }
  .studio { padding-top: 16px; }
  .studio-head h1 { font-size: 22px; }
}

@media (max-width: 600px) {
  :root { --pa-gutter: 18px; }
  .studio-head h1 { font-size: 21px; }
  .studio-head p { display: none; }
  .site-footer { gap: 20px; margin-top: 35px; font-size: 10px; }
  .studio-head-actions { width: 100%; }
  .tool-tabs { flex: 1 1 auto; }
  .tool-tabs a { flex: 1 1 0; justify-content: center; padding: 0 8px; }
  .studio-card { padding: 14px 14px 16px; }
  .preview-card { padding: 0; }
  .hud-preset-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .hud-preset-button { padding: 7px 3px; }
  .hud-design-option-name { font-size: 11px; }
  .step-aside { flex-basis: 100%; margin-left: 34px; text-align: left; }
  .ready-list { flex-basis: 100%; margin-left: 34px; }
  .form-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 10px 8px; }
  .region-trigger { gap: 8px; padding: 0 10px; }
  .hud-stage, .chat-stage { margin: 0 8px; }
  .chat-stage { padding: 10px; }
  .preview-top { min-height: 44px; padding: 6px 8px 6px 12px; }
  .preview-preset-badge { display: none; }
  .scale-switch button { padding: 0 8px; font-size: 11px; }
  .preview-header-actions .pa-icon-btn { width: 32px; height: 32px; }
  .hud-screen { aspect-ratio: 2.6 / 1; }
  .preview.is-scene .hud-screen { width: min(100%, 300px); }
  .preview-foot { display: none; }
  .command-name { grid-template-columns: minmax(0, 1fr); }
  .preset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .twitch-window-head { min-height: 34px; }
  .twitch-preview { min-height: 72px; max-height: 150px; padding: 8px 6px; }
  .pa-hud-auth span { font-size: 11.5px; }
}

@media (max-width: 400px) {
  .tool-tabs a { gap: 0; padding: 0 6px; font-size: 11.5px; }
  .tool-tabs a svg { display: none; }
}

@media (max-width: 360px) {
  :root { --pa-gutter: 12px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .studio-head h1 { font-size: 21px; }
  }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .pa-btn.primary:active { transform: none; }
}
