/*
 * PowerTokens Video Studio · Web
 * Visual language follows the desktop app (studio_ui.py): page #f5f7fb, white cards with a #dfe7ee
 * outline and 14px radius, ink #1b293c, muted #708194, teal accent #53b2a5 on pale #eaf6f2.
 * Mobile-first; the desktop two-column layout (2:1) starts at 1000px like studio_ui.Columns.
 */
:root {
  --page: #f7faf9;
  --white: #ffffff;
  --ink: #1b293c;
  --ink-2: #2f4558;
  --muted: #5f7388;
  --line: #d7e5e1;
  --accent: #53b2a5;
  --accent-active: #419f92;
  --accent-pressed: #348f83;
  --accent-text: #268b7e;
  --accent-link: #328f83;
  --pale: #eaf6f2;
  --hover: #edf7f4;
  --pressed: #deeee9;
  --btn-text: #2a3f52;
  --disabled-bg: #f3faf7;
  --disabled-text: #7a9099;
  --warn: #8a5a00;
  --warn-soft: #fff5e0;
  --bad: #b23b2e;
  --bad-soft: #fdecea;
  --radius: 14px;
  --font: "Microsoft YaHei UI", "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans GB", "Noto Sans CJK SC", "Noto Sans SC", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.55;
  color: var(--ink); background: var(--page); min-height: 100vh; display: flex; flex-direction: column;
}
/* English pages: Latin fonts first so quotes, apostrophes and middle dots don't take full-width CJK glyphs. */
html:lang(en) body, html:lang(en) textarea, html:lang(en) input, html:lang(en) select, html:lang(en) button {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}
a { color: var(--accent-link); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
p { margin: 0; }
.mock-banner { background: #fff1c2; color: #6b4e00; text-align: center; font-size: 13px; padding: 6px 12px; }

/* ---------- header (desktop: padding 28/20, logo 44, Brand 21pt bold) ---------- */
.app-header { background: var(--white); padding: calc(12px + env(safe-area-inset-top)) 0 10px; }
.header-row {
  width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; flex: none; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-row { margin-top: 6px; flex-wrap: wrap; row-gap: 6px; }
.subtitle { color: var(--muted); font-size: 12.5px; width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.subtitle .link { font-size: 12.5px; padding: 0 2px; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }

.top-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.lang-switch { display: flex; flex: none; }
.tips-wide { display: none; }
.lang-switch button, .lang-switch select {
  font: inherit; font-size: 12.5px; border: 1px solid transparent; background: var(--white); color: var(--muted);
  padding: 4px 8px; cursor: pointer; border-radius: 2px;
}
.lang-switch button.active { background: var(--pale); color: var(--accent-text); }
.lang-switch select { border-color: var(--line); }

.badge {
  display: inline-block; background: var(--pale); color: var(--accent-text); padding: 6px 12px; font-size: 13px;
  border-radius: 8px; border: 1px solid #cfe6df; font-family: inherit; line-height: 1.4; font-weight: 600;
}
.badge-btn { cursor: pointer; font-size: 12.5px; padding: 5px 10px; }
.badge-btn:hover { background: var(--pressed); }
.badge-block { display: block; margin-top: 10px; }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad {
  background: #ffe8e6; color: #ff3b30; border-color: #ffc9c4; font-weight: 600;
}
.link {
  font: inherit; font-size: 13px; color: var(--accent-link); background: none; border: 0; padding: 4px 2px; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.link:hover { text-decoration: underline; }
.link-small { font-size: 12px; padding: 0 2px; }
.btn-credits {
  font-size: 12.5px; color: var(--accent-text); border: 1px solid #bfe2da; background: var(--white);
  padding: 4px 10px; border-radius: 2px; white-space: nowrap; font-weight: 600;
}
.btn-credits::after { content: " ↗"; font-weight: 400; }
.btn-credits:hover { background: var(--hover); text-decoration: none; }


/* ---------- empty-key signup strip (under tabs) ---------- */
.header-signup { text-decoration: none; font-weight: 600; }
.header-signup::after { content: " ↗"; font-weight: 400; }
.header-signup:hover { text-decoration: none; }
.nokey-banner {
  background: var(--pale); border-bottom: 1px solid #cfe6df;
}
.nokey-inner {
  width: 100%; max-width: 1240px; margin: 0 auto; padding: 10px 12px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px;
}
.nokey-banner p { margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.45; flex: 1 1 220px; }
.nokey-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; flex: none; }

/* ---------- notebook tabs (align with .page cards: same max-width + horizontal padding) ---------- */
.tabs {
  position: sticky; top: 0; z-index: 10; background: var(--page);
  border-bottom: 1px solid #c5ddd6;
}
.tabs-inner {
  width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 12px;
  display: flex; gap: 0; overflow-x: auto; scrollbar-width: none;
}
.tabs-inner::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none; font: inherit; font-size: 13px; color: var(--muted); background: var(--white);
  border: 1px solid #c5ddd6; border-bottom: 0; margin-right: -1px; padding: 10px 14px; cursor: pointer; white-space: nowrap;
}
.tabs button:hover { background: var(--hover); color: var(--accent-text); }
.tabs button.active { background: var(--pale); color: var(--accent-text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.badge-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ff3b30; margin-left: 5px; vertical-align: 1px; box-shadow: 0 0 0 1px rgba(0,0,0,.06); }
.badge-dot-ok { background: #22c55e; }
.badge-dot-bad { background: #ff3b30; }

/* API Key tab status pill: always both dots + label (switch feel) */
.key-status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 6px; padding: 2px 7px 2px 5px;
  border-radius: 999px; border: 1px solid #d5e4df; background: #f4faf7;
  vertical-align: middle; font-size: 11px; font-weight: 600; line-height: 1.2;
  color: var(--muted); transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.key-status-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  opacity: .28; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.06);
  transition: opacity .15s ease, box-shadow .15s ease, transform .15s ease;
}
.key-status-dot-bad { background: #ff3b30; }
.key-status-dot-ok { background: #22c55e; }
.key-status-text { letter-spacing: .02em; white-space: nowrap; }
.key-status-pill.is-bad {
  color: #d70015; border-color: rgba(255, 59, 48, .38); background: rgba(255, 59, 48, .1);
}
.key-status-pill.is-bad .key-status-dot-bad {
  opacity: 1; transform: scale(1.15);
  box-shadow: 0 0 0 2px rgba(255, 59, 48, .28);
}
.key-status-pill.is-ok {
  color: #15803d; border-color: rgba(34, 197, 94, .42); background: rgba(34, 197, 94, .12);
}
.key-status-pill.is-ok .key-status-dot-ok {
  opacity: 1; transform: scale(1.15);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .28);
}

/* ---------- page / headings / cards ---------- */
.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 14px 12px 20px; flex: 1; }
.heading { margin: 2px 0 16px; }
.heading h1 { font-size: 21px; margin: 0; line-height: 1.3; letter-spacing: -.02em; }
.heading p { color: var(--muted); margin-top: 6px; font-size: 13.5px; }
.columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
.col-left, .col-right { min-width: 0; }
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(27, 41, 60, .03);
}
.card-title { font-size: 14.5px; font-weight: 700; margin: 0 0 8px; }
.card-title label { cursor: inherit; }
.muted { color: var(--muted); }
.card > .muted:not(.small) { margin-bottom: 12px; }
.small { font-size: 12.5px; margin-top: 6px; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 8px; border: 1px dashed var(--line); border-radius: 4px; }
.error { color: var(--bad); font-size: 13px; margin-top: 10px; }

/* ---------- inputs (desktop: white field, 1px #dfe7ee, teal focus) ---------- */
textarea, input[type="text"], input[type="url"], input[type="password"], input[type="number"], select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--white);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 40px; outline: none;
}
textarea { resize: vertical; min-height: 76px; line-height: 1.5; padding: 10px 12px; }
textarea:hover, input:hover, select:hover { border-color: #b7d9d1; }
textarea:focus, input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(83, 178, 165, .18); }
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none; padding-right: 32px; cursor: pointer;
  background-color: var(--white); color: var(--ink);
  background-image: linear-gradient(45deg, transparent 50%, var(--accent-text) 50%), linear-gradient(135deg, var(--accent-text) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
select:focus {
  background-color: #f7fcfa;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%);
}
/* Prefer white option menus where the browser allows it (avoids OS cement gray). */
select option, select optgroup {
  background-color: #ffffff; color: var(--ink);
}
.field-label { display: block; color: var(--ink-2); font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.field { min-width: 0; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-size: 13px; white-space: nowrap; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

/* ---------- buttons (desktop: flat, #4b6073 on white; Accent = teal) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 13.5px;
  color: var(--btn-text); background: var(--white); border: 1px solid #b7d0c9; border-radius: 8px;
  padding: 8px 14px; min-height: 38px; cursor: pointer; text-decoration: none; white-space: nowrap; font-weight: 600;
}
.btn:hover { background: var(--hover); border-color: var(--accent); color: var(--accent-text); text-decoration: none; }
.btn:active { background: var(--pressed); }
.btn:disabled {
  background: #ffffff; color: var(--disabled-text); border-color: #d5ebe5;
  cursor: not-allowed; font-weight: 500; box-shadow: none;
}
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--white); padding: 9px 18px; }
.btn-accent:hover { background: var(--accent-active); border-color: var(--accent-active); }
.btn-accent:active { background: var(--accent-pressed); }
.btn-accent:disabled { background: #bddbd5; border-color: #bddbd5; color: #f6faf9; }
.btn-small { min-height: 32px; padding: 5px 11px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.actions .btn-accent { min-width: 120px; }

/* ---------- generate ---------- */
.model-desc-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.model-desc-row .link { flex: none; margin-top: 2px; }
.model-full { margin-top: 2px; }
.model-full a { margin-right: 14px; }
.cost { margin-top: 10px; }
.adv-body { margin-top: 6px; }
.adv-body .field-label { margin-top: 10px; }
.ff-local { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.ff-preview { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ff-preview img { width: 56px; height: 56px; object-fit: cover; border: 1px solid var(--line); }
.batch-hint { font-size: 12.5px; color: var(--muted); margin: 0 4px 14px; }
.batch-hint a { white-space: nowrap; }



/* ---------- custom select (white panel + teal accent; replaces OS cement dropdown) ---------- */
.cselect { position: relative; width: 100%; }
.cselect-native {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important;
  opacity: 0 !important; pointer-events: none !important;
}
.cselect-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font: inherit; font-size: 16px; color: var(--ink); text-align: left;
  background: var(--white); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; min-height: 40px; cursor: pointer; outline: none;
  box-shadow: 0 1px 0 rgba(27, 41, 60, .03);
}
.cselect-trigger:hover { border-color: #b7d9d1; background: #fbfdfe; }
.cselect.is-open .cselect-trigger,
.cselect-trigger:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(83, 178, 165, .18); background: #f7fcfa;
}
.cselect-trigger-label {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cselect-caret {
  flex: none; width: 10px; height: 10px; margin-right: 2px;
  border-right: 2px solid var(--accent-text); border-bottom: 2px solid var(--accent-text);
  transform: rotate(45deg) translateY(-2px); opacity: .85;
}
.cselect.is-open .cselect-caret { transform: rotate(225deg) translateY(-1px); }
.cselect-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40;
  margin: 0; padding: 6px; list-style: none;
  background: #ffffff; border: 1px solid #c5ddd6; border-radius: 10px;
  box-shadow: 0 10px 28px rgba(27, 41, 60, .12), 0 0 0 1px rgba(83, 178, 165, .08);
  max-height: min(280px, 50vh); overflow: auto;
}
.cselect-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  color: var(--ink); font-size: 13.5px; line-height: 1.35;
}
.cselect-opt:hover { background: var(--hover); color: var(--accent-text); }
.cselect-opt.is-selected {
  background: var(--pale); color: var(--accent-text); font-weight: 600;
}
.cselect-opt.is-selected::after {
  content: ""; margin-left: auto; flex: none; width: 8px; height: 14px;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(45deg) translateY(-2px);
}
@media (min-width: 640px) {
  .cselect-trigger { font-size: 14px; }
}
/* ---------- examples / how-to ---------- */
.howto {
  list-style: none; margin: 14px 0 0; padding: 12px 14px; display: grid; gap: 8px;
  background: #f7fcfa; border: 1px solid #d5ebe5; border-radius: 12px; counter-reset: howto;
}
.howto li {
  display: flex; align-items: flex-start; gap: 10px; margin: 0;
  color: var(--ink-2); font-size: 13px; line-height: 1.45; counter-increment: howto;
}
.howto li::before {
  content: counter(howto); flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--pale); color: var(--accent-text); border: 1px solid #c5e4dc;
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}
.examples {
  margin: 0 0 12px; padding: 14px; border-radius: 12px;
  background: linear-gradient(180deg, #f3faf7 0%, #f9fcfb 100%);
  border: 1px solid #d5ebe5;
}
.examples-head { margin: 0 0 10px; }
.examples-label {
  margin: 0; font-size: 13.5px; font-weight: 700; color: var(--ink);
  letter-spacing: -.01em;
}
.examples-hint { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.example-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.example-chip {
  display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px;
  font-weight: 500; color: var(--accent-text); background: var(--white);
  border: 1px solid #c5e4dc; border-radius: 999px; padding: 6px 12px; cursor: pointer;
  line-height: 1.3; max-width: 100%; box-shadow: 0 1px 0 rgba(27, 41, 60, .04);
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.example-chip:hover {
  background: var(--hover); border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(83, 178, 165, .16); text-decoration: none;
}
.example-chip:active { background: var(--pressed); transform: translateY(1px); }
.example-chip.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(83, 178, 165, .28);
}
.example-chip .chip-title { font-weight: 600; }
.example-chip .chip-model {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 500; color: #5a9f94; background: var(--pale);
  border-radius: 999px; padding: 2px 7px 2px 4px; line-height: 1.2;
}
.example-chip .chip-model:not(:has(.chip-logo)) { padding-left: 7px; }
.example-chip .chip-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; flex: none; border-radius: 3px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .06);
}
.example-chip .chip-logo svg { display: block; width: 14px; height: 14px; }
.example-chip.active .chip-model { color: #e8f7f3; background: rgba(255, 255, 255, .22); }
.example-chip.active .chip-logo { box-shadow: 0 0 0 1px rgba(255, 255, 255, .35); }
.batch-sample-note { margin-top: 10px; }
/* ---------- compare ---------- */
.check-list { display: grid; gap: 2px; }
.check-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; }
.check-item input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; flex: none; }
.check-item input:disabled + .check-text { opacity: .5; }
.check-text { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; flex: 1; font-size: 13.5px; }
.model-limits { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plan { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.plan-item { font-size: 12.5px; border-top: 1px solid var(--line); padding-top: 6px; }
.plan-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; }
.plan-params { color: var(--muted); font-variant-numeric: tabular-nums; }
.plan .badge { font-size: 12px; padding: 4px 8px; margin-top: 4px; display: block; }
.cmp-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }

/* ---------- task cards ---------- */
.task-list { display: grid; gap: 10px; }
.task { border: 1px solid var(--line); border-radius: 4px; padding: 12px; background: var(--white); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.task-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.task-title { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; }
.tag { font-size: 11px; color: var(--accent-text); background: var(--pale); padding: 1px 7px; }
.state { font-size: 12px; padding: 3px 9px; white-space: nowrap; }
.state-busy { background: var(--pale); color: var(--accent-text); }
.state-ok { background: #e3f3ed; color: #236a5e; }
.state-warn { background: var(--warn-soft); color: var(--warn); }
.state-bad { background: var(--bad-soft); color: var(--bad); }
.state-idle { background: #eef7f4; color: var(--btn-text); }
.task-params { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.task-prompt { font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.task-error { font-size: 13px; color: var(--bad); background: var(--bad-soft); padding: 8px 10px; word-break: break-word; }
.tone-warn .task-error { color: var(--warn); background: var(--warn-soft); }
.task-id { display: flex; align-items: center; gap: 8px; font-size: 12px; min-width: 0; color: var(--muted); }
.task-id code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--ink-2); background: #f0f8f5; padding: 2px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.task .topup { align-self: flex-start; }
.player { width: 100%; background: #0d1522; max-height: 62vh; display: block; }
#gen-result .player { max-width: 760px; }
.progress { height: 6px; background: #e4f1ed; overflow: hidden; position: relative; }
.progress-fill { height: 100%; width: 4%; background: var(--accent); transition: width .4s ease; }
.progress.indeterminate .progress-fill { width: 30%; position: absolute; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { left: -30%; } 100% { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .progress.indeterminate .progress-fill { animation: none; left: 0; width: 100%; opacity: .35; } }
.spend-line { margin: -2px 0 12px; font-size: 12px; color: var(--muted); }

/* ---------- history / keys ---------- */
.manual { display: grid; gap: 8px; }
.key-row { display: flex; gap: 12px; align-items: center; }
.key-row input[type="password"], .key-row input[type="text"] { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.key-pool-card .key-pool-add { margin-top: 14px; padding-top: 14px; border-top: 1px dashed #d5ebe5; }
.key-pool-list {
  list-style: none; margin: 10px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.key-pool-item {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 8px; background: #f7fcfa;
  padding: 6px 8px 6px 6px;
}
.key-pool-item.is-active {
  border-color: #7ec9b8; background: #eef8f4;
  box-shadow: 0 0 0 1px rgba(83, 178, 165, .18);
}
.key-pool-select {
  flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 8px;
  font: inherit; text-align: left; background: transparent; border: 0;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; color: var(--ink);
}
.key-pool-select:hover { background: rgba(83, 178, 165, .08); }
.key-pool-radio {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid #b7d0c9; background: var(--white);
  box-shadow: inset 0 0 0 2px transparent;
}
.key-pool-item.is-active .key-pool-radio {
  border-color: var(--accent); background: var(--accent);
  box-shadow: inset 0 0 0 2px #eef8f4;
}
.key-pool-select code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; color: var(--ink-2); background: transparent; padding: 0;
}
.key-pool-active-tag {
  margin-left: auto; flex: none;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  color: #15803d; background: rgba(34, 197, 94, .12);
  border: 1px solid rgba(34, 197, 94, .35); border-radius: 999px;
  padding: 2px 8px;
}
.key-forget-one { flex: none; }


/* ---------- desktop download CTA (above footer) ---------- */
.desktop-cta {
  background: var(--white);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.desktop-cta-inner {
  width: 100%; max-width: 1240px; margin: 0 auto; padding: 16px 12px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px;
}
.desktop-cta-copy { flex: 1 1 240px; min-width: 0; }
.desktop-cta-title {
  margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: -.01em;
}
.desktop-cta-desc {
  margin: 4px 0 0; font-size: 13px; color: var(--muted); line-height: 1.45;
}
.desktop-cta-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; flex: none;
}
.desktop-cta-actions .btn { text-decoration: none; font-weight: 600; }
.desktop-cta-actions .btn:hover { text-decoration: none; }
/* ---------- footer / status bar / toast ---------- */
.footer {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; padding: 12px 12px 14px;
  font-size: 12.5px; color: var(--muted); text-align: center;
}
.footer a { color: var(--btn-text); }
.statusbar {
  position: sticky; bottom: 0; z-index: 9; background: var(--page); border-top: 1px solid var(--line);
  color: var(--btn-text); font-size: 12.5px; padding: 6px 14px calc(6px + env(safe-area-inset-bottom));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toast {
  position: fixed; left: 50%; bottom: calc(44px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(27, 41, 60, .94); color: #fff; padding: 10px 16px; border-radius: 4px; font-size: 13.5px;
  max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); z-index: 50; text-align: center;
}

/* ---------- larger screens ---------- */
@media (min-width: 640px) {
  body { font-size: 14px; }
  .app-header { padding: 20px 0 16px; }
  .header-row { padding: 0 24px; }
  .brand img { width: 44px; height: 44px; }
  .brand { gap: 12px; }
  .brand-name { font-size: 26px; }
  .sub-row { margin-top: 8px; flex-wrap: nowrap; }
  .subtitle { width: auto; font-size: 13.5px; display: block; }
  .lang-switch button { font-size: 13.5px; padding: 6px 22px; }
  .tips-wide { display: inline-block; padding: 6px 22px; font-size: 13.5px; }
  .tips-narrow { display: none; }
  .header-actions { gap: 8px 14px; }
  .badge-btn, .btn-credits { font-size: 13.5px; padding: 6px 12px; }
  .tabs-inner { padding: 0 24px; }
  .nokey-inner { padding: 12px 24px; }
  .nokey-banner p { font-size: 13.5px; }
  .desktop-cta-inner { padding: 18px 24px; }
  .desktop-cta-title { font-size: 16px; }
  .desktop-cta-desc { font-size: 13.5px; }
  .tabs button { font-size: 13.5px; padding: 11px 20px; }
  .page { padding: 20px 24px 24px; }
  .heading h1 { font-size: 23px; }
  .card { padding: 20px; margin-bottom: 16px; }
  .manual { grid-template-columns: 220px 1fr auto; }
  .cmp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-list { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  textarea, input[type="text"], input[type="url"], input[type="password"], input[type="number"], select { font-size: 14px; }
}
@media (min-width: 1000px) {
  /* studio_ui.Columns: weights (2, 1), breakpoint 1000px */
  .columns { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 0 18px; }
  .cmp-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .task-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
