/* ==========================================================================
   365Lab WIFI QR Poster Studio — stylesheet
   No external requests. System font stacks only.
   ========================================================================== */

:root {
  /* Ocean Signal — cyan → indigo brand system (WiFi / connectivity theme) */
  --bg: #f3f7fc;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f1f6fb;
  --text: #0f1c2e;
  --text-2: #44556e;
  --text-3: #64748b;
  --line: #d7e2ef;
  --line-2: #c6d5e6;
  --brand: #0891b2;
  --brand-2: #6366f1;
  --brand-soft: #e0f3f9;
  --brand-ink: #0e7490;
  --brand-press: #0e7490;
  --focus-ring: #33b2d1;   /* visible focus ring: meets WCAG 1.4.11 on white */
  --ok: #10b981;
  --warn: #d97706;
  --warn-amber: #f59e0b;
  --danger: #dc2626;
  --shadow-s: 0 1px 2px rgba(15, 32, 60, .05), 0 1px 3px rgba(15, 32, 60, .07);
  --shadow-m: 0 4px 14px rgba(15, 32, 60, .07), 0 2px 4px rgba(15, 32, 60, .04);
  --shadow-l: 0 18px 44px rgba(15, 32, 60, .13);
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 18px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --font-ui: var(--sans);
  --header-h: 60px;
}

html[data-theme="dark"] {
  --bg: #0a0f1e;
  --bg-2: #0e1628;
  --panel: #111a2e;
  --panel-2: #16233c;
  --text: #e6edf9;
  --text-2: #9db0cd;
  --text-3: #7085a6;
  --line: #243450;
  --line-2: #2e3f5e;
  --brand: #22b8cf;
  --brand-2: #8b7bff;
  --brand-soft: #0e2738;
  --brand-press: #0e7490;
  --brand-ink: #7dd3fc;
  --focus-ring: #4fc6da;   /* visible focus ring on dark panels: meets WCAG 1.4.11 */
  --warn: #fbbf24;
  --warn-amber: #fbbf24;
  --danger: #f87171;
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-m: 0 4px 14px rgba(0, 0, 0, .35);
  --shadow-l: 0 18px 44px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/* brand-colored text selection */
::selection { background: color-mix(in srgb, var(--brand) 22%, transparent); color: inherit; }

/* custom scrollbar (webkit) — subtle, brand-tinted */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* Firefox scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* button active state feedback */
.btn:active, .btn-primary:active, .icon-btn:active, .tab:active {
  transform: scale(0.97);
}

/* link transition */
a { transition: color .15s ease; }

/* skip-link for a11y */
.skip-link {
  position: absolute; top: -100%; left: 16px; z-index: 9999;
  padding: 8px 16px; background: var(--brand); color: #fff;
  font: 700 13px/1.4 var(--sans); border-radius: 0 0 8px 8px;
  transition: top .2s ease; text-decoration: none;
}
.skip-link:focus { top: 0; }

/* skip-link must stay high-contrast in dark mode (white-on-brand fails AA) */
html[data-theme="dark"] .skip-link {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--brand); box-shadow: var(--shadow-m);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ambient glow — soft cyan/indigo aura at the top of the viewport (connectivity mood) */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 420px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(640px 300px at 18% -60px, color-mix(in srgb, #06b6d4 14%, transparent), transparent 70%),
    radial-gradient(700px 320px at 82% -80px, color-mix(in srgb, #6366f1 13%, transparent), transparent 70%);
}
html[data-theme="dark"] body::before {
  background:
    radial-gradient(640px 300px at 18% -60px, color-mix(in srgb, #06b6d4 11%, transparent), transparent 70%),
    radial-gradient(700px 320px at 82% -80px, color-mix(in srgb, #6366f1 10%, transparent), transparent 70%);
}

img, svg, canvas { max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
/* long unbreakable tokens (e.g. WiFi payload strings) must wrap instead of overflowing on narrow screens */
code { overflow-wrap: anywhere; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ------------------------------- header --------------------------------- */
/* ====== Header — 365Lab clean style ====== */
.site-header {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center;
  padding: 0 28px;
  height: 60px;
  background: var(--bg); /* fallback for browsers without color-mix() */
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
}
.site-header:not(.site-header--tool) {
  /* full-width header: background spans viewport, content centered via .header-inner */
}
/* Tool page: header spans full viewport width */
.site-header--tool .header-inner {
  max-width: none;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  height: 100%;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 8px;
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; display: block; }
.brand-text { font-size: 16px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand-text small { display: block; font-size: 11px; font-weight: 500; color: var(--text-3); margin-top: 1px; }

/* Nav — clean text links */
.header-nav { display: flex; align-items: center; gap: 6px; margin-left: 32px; }
.header-nav a {
  padding: 8px 14px; border-radius: 8px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  text-decoration: none; transition: all .18s ease; position: relative;
}
.header-nav a:hover { color: var(--brand); background: var(--brand-soft); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Language switch — minimal text style */
.lang-switch { display: inline-flex; align-items: center; gap: 2px; background: var(--bg-2); border-radius: 8px; padding: 2px; border: 1px solid var(--line); }
.lang-switch button, .lang-switch a {
  border: 0; background: transparent; color: var(--text-3); cursor: pointer; text-decoration: none;
  font: 500 13px/1 var(--sans); padding: 6px 12px; border-radius: 6px; transition: all .16s ease;
}
.lang-switch button:hover, .lang-switch a:hover { color: var(--text); background: var(--panel); }
.lang-switch button[aria-pressed="true"], .lang-switch a[aria-pressed="true"] { background: var(--brand); color: #fff; box-shadow: 0 2px 6px rgba(8,145,178,.25); }

/* Theme toggle — subtle circle */
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2);
  border-radius: 50%; cursor: pointer; transition: all .18s ease;
}
.icon-btn:hover { color: var(--brand); background: var(--brand-soft); border-color: var(--brand); transform: rotate(15deg); }
.icon-btn svg { width: 16px; height: 16px; }

/* -------------------------------- studio -------------------------------- */
.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 18px;
  max-width: 1500px;
  margin: 16px auto 0;
  padding: 0 16px 40px;
  align-items: start;
}

/* slim, themed scrollbar for the control panel on Windows/narrow screens */
.col-control { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.col-control::-webkit-scrollbar { width: 9px; }
.col-control::-webkit-scrollbar-track { background: transparent; }
.col-control::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 999px; border: 2px solid var(--panel);
}
.col-control::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* hero stacked cards micro-interaction */
.hero-stack-card { transition: transform .35s cubic-bezier(.34,1.56,.64,1), box-shadow .35s ease; }

/* preview canvas fade-in after first paint */
#posterCanvas { animation: posterIn .35s ease both; }
@keyframes posterIn { from { opacity: 0; transform: scale(.992); } to { opacity: 1; transform: none; } }
/* dark: active/pressed buttons use a darker brand so white text keeps >=4.5:1 */
html[data-theme="dark"] .lang-switch button[aria-pressed="true"],
html[data-theme="dark"] .chip[aria-pressed="true"],
html[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--brand-press); border-color: var(--brand-press); }

@media (prefers-reduced-motion: reduce) {
  #posterCanvas { animation: none; }
  .hero-stack-card { transition: none; }
}

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-l); box-shadow: var(--shadow-m); overflow: hidden;
}
.panel + .panel { margin-top: 16px; }

/* tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 10px 0; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.tab {
  flex: 1 1 auto; justify-content: center; min-width: 0;
  border: 0; background: transparent; cursor: pointer;
  padding: 9px 10px; border-radius: 10px 10px 0 0;
  font: 700 13px/ 1 var(--sans); color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .18s ease;
}
.tab svg { width: 15px; height: 15px; }
.tab:hover { color: var(--brand); }
.tab[aria-selected="true"] { color: var(--brand); background: var(--panel); border-bottom-color: var(--brand); }
.tab-panels { padding: 16px; }
.tab-panel[hidden] { display: none; }

/* form primitives */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; color: var(--text);
  margin-bottom: 6px; letter-spacing: .01em;
}
.field-label .hint { font-weight: 500; color: var(--text-3); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 420px) { .grid-3 { grid-template-columns: 1fr 1fr; } }

input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 9px 11px; font: 400 14px/1.4 var(--sans);
  color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--r-s);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; appearance: none;
}
textarea { resize: vertical; min-height: 62px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus-ring); outline: none; background: var(--panel); }
select:hover { border-color: var(--text-3); }
select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%238a94ab' d='M6 8.5 1.8 4.3l.9-.9L6 6.7l3.3-3.3.9.9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 11px;
  padding-right: 28px; cursor: pointer;
}
.input-group { display: flex; gap: 8px; }
.input-group > input { flex: 1; min-width: 0; }
.input-group .icon-btn { flex: 0 0 38px; width: 38px; height: 38px; border-radius: var(--r-s); }

/* compact input variants used across the studio */
.inp { width: 100%; }
.inp-sm { padding: 7px 10px; font-size: 13px; border-radius: var(--r-s); }
/* template search box inside the template column */
.col-control #tplSearch { margin: 2px 12px 10px; width: calc(100% - 24px); flex: 0 0 auto; }
/* keep-text switch aligned with search box / filters (12px side gutters) */
.col-control .switch.small { margin: 4px 12px 10px; }

/* live char counter for SSID / password */
.char-count { display: block; text-align: right; font-size: 11px; color: var(--text-3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.char-count.near { color: var(--warn-amber, var(--warn)); }
.char-count.over { color: var(--danger); font-weight: 600; }
.char-warn { font-size: 11.5px; color: var(--danger); margin-top: 3px; line-height: 1.4; }

/* color row */
.color-row { display: flex; align-items: center; gap: 8px; }
input[type="color"] {
  width: 40px; height: 38px; padding: 3px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--r-s); cursor: pointer; flex: 0 0 40px;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
.color-row input[type="text"] { font-family: var(--mono); font-size: 12.5px; text-transform: uppercase; }

/* range — premium sliders */
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; width: 100%; height: 24px; background: transparent; cursor: pointer; --range-progress: 0%; }

/* size + color same row */
.field--split .split-row { display: flex; align-items: center; gap: 10px; }
.field--split .color-inline { flex: 0 0 38px; }
.field--split .color-inline input[type="color"] { width: 38px; height: 38px; padding: 0; border: 1px solid var(--line-2); border-radius: var(--r-s); cursor: pointer; background: transparent; }
.field--split .color-inline-group { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }
.field--split .color-inline-group input[type="color"] { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line-2); border-radius: var(--r-s); cursor: pointer; background: transparent; }

/* Track — webkit */
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 99px;
  background: linear-gradient(to right, var(--brand) var(--range-progress), var(--line) var(--range-progress));
  transition: background .15s ease;
}
/* Track — firefox */
input[type="range"]::-moz-range-track {
  height: 6px; border-radius: 99px; background: var(--line);
}
input[type="range"]::-moz-range-progress {
  height: 6px; border-radius: 99px; background: var(--brand);
}

/* Thumb — webkit */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; margin-top: -6px;
  border-radius: 50%; background: #fff;
  border: 3px solid var(--brand);
  box-shadow: 0 1px 4px rgba(0,0,0,.14), 0 2px 8px rgba(8,145,178,.18);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
/* Thumb — firefox */
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%; background: #fff;
  border: 3px solid var(--brand);
  box-shadow: 0 1px 4px rgba(0,0,0,.14), 0 2px 8px rgba(8,145,178,.18);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

/* Hover */
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.15); }
input[type="range"]:hover::-moz-range-thumb { transform: scale(1.15); }

/* Focus (a11y) */
input[type="range"]:focus { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(8,145,178,.20), 0 2px 8px rgba(8,145,178,.18);
}
input[type="range"]:focus-visible::-moz-range-thumb {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(8,145,178,.20), 0 2px 8px rgba(8,145,178,.18);
}

/* Active / dragging */
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.06); }
input[type="range"]:active::-moz-range-thumb { transform: scale(1.06); }

/* Value label */
.range-val {
  flex: 0 0 48px; text-align: right;
  font: 600 12px/1 var(--mono); color: var(--text-2);
  letter-spacing: .02em; transition: color .18s ease;
}
.range-row:hover .range-val { color: var(--brand); }

/* logo preview area */
.logo-preview {
  margin-top: 8px; min-height: 58px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-2); border: 2px dashed var(--line);
  border-radius: 10px; padding: 10px;
  transition: border-color .2s ease;
  max-width: 200px;
}
.logo-preview:hover { border-color: var(--brand-2); }
.logo-preview img {
  max-height: 56px; max-width: 100%; border-radius: 8px;
  object-fit: contain;
}

/* logo panel field spacing */
#logoCenterPanel > .field + .field { margin-top: 14px; }

/* hint text at bottom of panels */
.hint-text { font-size: 12px; color: var(--text-3); margin: 7px 0 12px; line-height: 1.5; padding-left: 1px; }

/* switch */
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; padding: 3px 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 38px; height: 22px; flex: 0 0 38px; border-radius: 99px;
  background: var(--line); position: relative; transition: .2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: .2s; box-shadow: var(--shadow-s);
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--focus-ring); }
.switch span.txt { font-size: 13.5px; font-weight: 600; color: var(--text); }

/* segmented / chip pickers */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button, .chip {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2);
  padding: 7px 11px; border-radius: 99px; cursor: pointer;
  font: 600 12.5px/1.1 var(--sans); transition: .15s; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.seg button:hover, .chip:hover { border-color: var(--brand); color: var(--brand); }
.seg button[aria-pressed="true"], .chip[aria-pressed="true"] {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.seg.block { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.seg.block button { border-radius: var(--r-s); justify-content: center; text-align: center; }

/* swatch palette */
.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch {
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line) inset; position: relative;
}
.swatch[aria-pressed="true"] { border-color: var(--text); }
.swatch[aria-pressed="true"]::after {
  content: ""; position: absolute; inset: 0; border-radius: 6px; border: 2px solid #fff;
}

/* style preview tiles (qr styles / decor / layout) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 9px; }
.tile {
  border: 1px solid var(--line); background: var(--bg-2); border-radius: var(--r-m);
  padding: 8px 6px 6px; cursor: pointer; text-align: center; transition: .15s;
}
.tile:hover { border-color: var(--brand); }
.tile[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.tile svg, .tile canvas { display: block; margin: 0 auto 5px; }
.tile .t-name { font-size: 11px; font-weight: 700; color: var(--text-2); line-height: 1.25; }
.tile[aria-pressed="true"] .t-name { color: var(--brand); }

/* template gallery */
.tpl-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.tpl-card {
  border: 1px solid var(--line); border-radius: var(--r-m); background: var(--bg-2);
  padding: 7px; cursor: pointer; transition: .15s; position: relative; text-align: left;
}
.tpl-card:hover { border-color: var(--brand); transform: translateY(-3px) scale(1.025); box-shadow: 0 14px 30px rgba(15,32,60,.14), 0 4px 10px rgba(8,145,178,.12); }
.tpl-card[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 2px var(--focus-ring), var(--shadow-m); background: color-mix(in srgb, var(--brand) 6%, var(--bg-2)); }
.tpl-card canvas { width: 100%; height: auto; border-radius: 7px; display: block; background: var(--panel-2); }
.tpl-card .tpl-name {
  font-size: 11.5px; font-weight: 700; color: var(--text-2);
  margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tpl-card[aria-pressed="true"] .tpl-name { color: var(--brand); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 15px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); cursor: pointer;
  font: 700 13.5px/1 var(--sans); transition: all .16s ease; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover {
  border-color: var(--brand);
  color: var(--brand-ink, var(--brand));
  background: var(--brand-soft);
  box-shadow: 0 4px 14px rgba(8, 145, 178, .16);
  transform: translateY(-1px);
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(8,145,178,.3);
}
.btn-primary:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); /* keep gradient, override .btn:hover tint */
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(8,145,178,.38);
}
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* -------------------------------- preview ------------------------------- */
.preview-col { position: sticky; top: calc(var(--header-h) + 16px); }
.preview-wrap {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow-m); padding: 14px;
}
.preview-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.preview-head h2 { font-size: 13px; margin: 0; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.preview-head .spacer { flex: 1; }
/* preview toolbar icon buttons */
.preview-head .btn-icon, .preview-head button {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-s); border: 1px solid var(--line);
  background: var(--panel); color: var(--text-2);
  cursor: pointer; transition: all .15s ease;
}
.preview-head .btn-icon:hover, .preview-head button:hover {
  border-color: var(--brand); color: var(--brand); background: var(--brand-soft);
}
.preview-head .btn-icon:active, .preview-head button:active {
  transform: scale(0.92);
}
.preview-stage {
  border-radius: var(--r-m); padding: 14px;
  background:
    linear-gradient(45deg, var(--panel-2) 25%, transparent 25%, transparent 75%, var(--panel-2) 75%) 0 0/18px 18px,
    linear-gradient(45deg, var(--panel-2) 25%, transparent 25%, transparent 75%, var(--panel-2) 75%) 9px 9px/18px 18px,
    var(--bg-2);
  display: grid; place-items: center; min-height: 260px;
}
#posterCanvas {
  display: block; max-width: 100%; max-height: min(70vh, 720px); height: auto;
  border-radius: 8px; box-shadow:
    var(--shadow-l),
    inset 0 0 0 1px rgba(128,128,128,.08);
  background: #fff;
  transition: box-shadow .2s;
}
#posterCanvas:hover { box-shadow:
    0 24px 52px rgba(16,24,40,.18), 0 6px 18px rgba(16,24,40,.08),
    inset 0 0 0 1px rgba(128,128,128,.08);
}
.btn-accent { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(8,145,178,.3); }
.btn-accent:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); /* keep gradient, override .btn:hover tint */
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(8,145,178,.38);
}

/* ---- export panel — organized sections ---- */
.export-section {
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: var(--r-m); padding: 12px 14px; margin-bottom: 12px;
}
.export-section .field { margin-bottom: 10px; }
.export-section .field:last-child { margin-bottom: 0; }
.export-section .field-label { font-size: 12px; }

.export-meta {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; margin-top: 4px;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--r-s);
}
.preview-meta {
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 0;
}
.meta-pill {
  font: 600 11px/1 var(--mono); color: var(--text-2); background: var(--bg-2);
  border: 1px solid var(--line); padding: 4px 7px; border-radius: 5px;
}
.meta-pill.ok { color: var(--ok); }
.meta-pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.size-est {
  margin: 0; font: 600 11.5px/1.3 var(--mono); color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--bg-2));
  border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
  padding: 5px 9px; border-radius: 6px; display: inline-block;
}
.size-est[hidden] { display: none; }

/* export actions — hero primary + compact grid */
.export-actions {
  display: flex; flex-direction: column; gap: 8px; margin-top: 12px;
}
.export-actions .btn-primary {
  padding: 13px 16px; font-size: 14px; border-radius: 11px;
  order: -1; /* always first */
}
.export-actions .btn-primary svg { width: 18px; height: 18px; }
.export-actions .secondary-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px;
}
.export-actions .secondary-row .btn {
  padding: 9px 6px; font-size: 12px; justify-content: center;
}
.export-actions .secondary-row .btn svg { width: 15px; height: 15px; flex: 0 0 15px; }
.export-actions .tertiary-row {
  display: flex; gap: 7px; justify-content: stretch;
}
.export-actions .tertiary-row .btn { flex: 1; padding: 8px 10px; font-size: 12px; justify-content: center; }

/* saved block inside export */
.saved-block {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--line-2);
}
.divider {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; font-size: 12px; font-weight: 700;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .04em;
}
.divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line-2);
}

/* alert */
.alert {
  display: flex; gap: 9px; padding: 9px 11px; border-radius: var(--r-s);
  font-size: 12px; line-height: 1.45; margin-top: 8px;
  background: color-mix(in srgb, var(--warn) 10%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  color: color-mix(in srgb, var(--warn) 72%, var(--text));
}
.alert svg { width: 15px; height: 15px; flex: 0 0 15px; margin-top: 1px; }
.alert[hidden] { display: none; }

/* saved designs */
.saved-list { display: flex; flex-direction: column; gap: 8px; }
.saved-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--r-s); background: var(--bg-2);
}
.saved-item .nm { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-item .dt { font-size: 11px; color: var(--text-3); font-family: var(--mono); white-space: nowrap; }
.saved-item .btn { flex: 0 0 auto; padding: 6px 9px; }
.empty-note { font-size: 12.5px; color: var(--text-3); text-align: center; padding: 14px; border: 1px dashed var(--line); border-radius: var(--r-s); }

/* accordion inside panels */
.acc { border: 1px solid var(--line); border-radius: var(--r-m); margin-bottom: 10px; overflow: hidden; }
.acc > summary {
  cursor: pointer; padding: 10px 12px; font: 700 13px/1.3 var(--sans); color: var(--text);
  background: var(--panel-2); list-style: none; display: flex; align-items: center; gap: 8px;
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after {
  content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3); transform: rotate(45deg); transition: .2s;
}
.acc[open] > summary::after { transform: rotate(-135deg); }
.acc > summary svg { width: 15px; height: 15px; color: var(--brand); }
.acc-body { padding: 13px; border-top: 1px solid var(--line); }

/* ------------------------------ content/SEO ----------------------------- */
.section { max-width: 1100px; margin: 0 auto; padding: 40px 16px; }
.section-narrow { max-width: 860px; }
.section h2 {
  font-size: clamp(21px, 3vw, 28px); text-align: center; margin-bottom: 8px;
  letter-spacing: -.01em; font-weight: 800;
}
/* gradient tick above section titles */
.section h2::before {
  content: ""; display: block; width: 46px; height: 4px; border-radius: 3px;
  margin: 0 auto 16px;
  background: linear-gradient(90deg, #06b6d4, #6366f1 65%, #8b5cf6);
}
.section .lead { text-align: center; color: var(--text-2); max-width: 640px; margin: 0 auto 28px; line-height: 1.6; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  position: relative; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px 18px; box-shadow: var(--shadow-s);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, background .22s ease;
}
/* gradient hairline on card top — revealed on hover */
.card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #06b6d4, #6366f1 60%, #8b5cf6);
  opacity: 0; transition: opacity .25s ease;
}
.card:hover::before { opacity: 1; }
.card:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(15,32,60,.13), 0 4px 10px rgba(8,145,178,.10); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.card:hover .ic { transform: scale(1.1) rotate(-3deg); }
.card .ic {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  margin-bottom: 13px; box-shadow: 0 4px 12px rgba(8,145,178,.22);
  transition: transform .22s ease;
}
.card .ic svg { width: 20px; height: 20px; }
.card h3 { font-size: 16px; margin-bottom: 7px; }
.card p { color: var(--text-2); font-size: 14px; margin: 0; line-height: 1.65; }

.steps { counter-reset: s; display: grid; gap: 16px; }
.step {
  display: flex; gap: 16px; align-items: flex-start; padding: 16px 18px;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.step:hover { border-color: color-mix(in srgb, var(--brand) 40%, transparent); box-shadow: var(--shadow-m); transform: translateY(-2px); }
.step::before {
  counter-increment: s; content: counter(s);
  flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 14%, transparent), 0 4px 12px rgba(8,145,178,.25);
  transition: transform .2s ease, box-shadow .2s ease;
}
.step:hover::before { transform: scale(1.08); box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand) 20%, transparent), 0 6px 16px rgba(8,145,178,.32); }
.step h3 { font-size: 15.5px; margin-bottom: 5px; }
.step p { color: var(--text-2); font-size: 14px; margin: 0; line-height: 1.65; }

.faq details, .faq-item {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  margin-bottom: 10px; overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.faq details:hover, .faq-item:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); box-shadow: var(--shadow-s); }
.faq details[open], .faq-item[open] { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.faq summary, .faq-item > summary {
  cursor: pointer; padding: 15px 18px; font-weight: 700; font-size: 15px;
  list-style: none; display: flex; align-items: center; gap: 10px;
  transition: background .15s ease;
}
.faq summary::-webkit-details-marker, .faq-item > summary::-webkit-details-marker { display: none; }
.faq summary::after, .faq-item > summary::after {
  content: ""; margin-left: auto; flex: 0 0 18px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700; line-height: 1;
  transition: transform .2s ease, background .2s ease;
}
.faq details[open] summary::after, .faq-item[open] > summary::after {
  content: "–";
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  transform: rotate(180deg);
}
.faq summary:not([open])::after, .faq-item > summary:not([open])::after { content: "+"; }
.faq .faq-a { padding: 0 18px 16px; color: var(--text-2); font-size: 14.2px; }
.faq .faq-a p:last-child { margin-bottom: 0; }

/* steps + FAQ compact on small screens */
@media (max-width: 560px) {
  .step { padding: 12px; gap: 12px; }
  .step::before { flex: 0 0 30px; width: 30px; height: 30px; font-size: 13px; }
  .step h3 { font-size: 14.5px; }
  .step p { font-size: 13.2px; }
  .faq summary { padding: 12px 14px; font-size: 14px; }
  .faq .faq-a { padding: 0 14px 13px; font-size: 13.3px; }
}

/* spec table — rounded card table */
.tbl-wrap {
  overflow-x: auto; max-width: 100%;
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
  box-shadow: var(--shadow-s);
}
table.info { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 460px; }
table.info th, table.info td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line-2); }
table.info th {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 8%, var(--panel-2)), var(--panel-2));
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2);
  font-weight: 700;
}
table.info tr:last-child td { border-bottom: 0; }
table.info tbody tr { transition: background .15s ease; }
table.info tbody tr:hover td { background: color-mix(in srgb, var(--brand) 4%, var(--panel)); }
table.info td code.spec-field {
  font-family: var(--mono); font-size: 12.5px; font-weight: 700;
  background: linear-gradient(135deg, var(--brand-soft), color-mix(in srgb, var(--brand) 12%, var(--bg-2)));
  color: var(--brand-ink); padding: 3px 9px; border-radius: 7px;
  border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
}
table.info code:not(.spec-field) { font-family: var(--mono); font-size: 12.5px; background: var(--panel-2); padding: 2px 6px; border-radius: 5px; }
.spec-code {
  font-family: var(--mono); font-size: 12.6px;
  background: color-mix(in srgb, var(--brand) 8%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent);
  color: var(--brand-ink); padding: 4px 9px; border-radius: 7px;
  word-break: break-all;
}
/* friendly plain-language note under the example payload */
.spec-note {
  display: flex; gap: 8px; align-items: flex-start;
  margin: 14px 0 0; padding: 12px 14px;
  font-size: 13.2px; line-height: 1.7; color: var(--text-2);
  background: color-mix(in srgb, var(--brand) 6%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
  border-radius: 10px;
}
.spec-note svg { width: 15px; height: 15px; flex: 0 0 15px; margin-top: 3px; color: var(--brand); }

/* use cases — two-column checklist card */
.use-card { padding: 24px 26px; }
.use-card::before { opacity: .85; } /* keep the gradient hairline visible */
.use-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 28px;
}
.use-list li {
  position: relative; padding: 7px 0 7px 30px;
  color: var(--text-2); font-size: 14.2px; line-height: 1.55;
  transition: color .15s ease, transform .15s ease;
}
.use-list li::before {
  content: ""; position: absolute; left: 4px; top: 14px;
  width: 9px; height: 9px; border-radius: 50%;
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
  transition: transform .15s ease;
}
.use-list li:hover { color: var(--text); transform: translateX(3px); }
.use-list li:hover::before { transform: scale(1.25); }

/* footer — clean column layout (overrides the global .col card look) */
.site-footer {
  background: var(--bg-2);
  padding: 46px 24px 28px;
  margin-top: 56px;
  border-top: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
/* gradient hairline on top — connectivity spectrum */
.site-footer::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #06b6d4, #6366f1 55%, #8b5cf6);
  opacity: .75;
}

/* Tool page (generator): ultra-compact single-line footer */
body:has(.studio-shell) .site-footer {
  border-top: 1px solid var(--line);
  background: transparent;
  padding: 10px 20px;
  margin-top: 0;
}
body:has(.studio-shell) .site-footer::before { display: none; }
body:has(.studio-shell) .footer-bottom {
  max-width: none;
  margin: 0 auto;
  padding: 0;
  border-top: 0; /* single hairline from .site-footer only */
  font-size: 11px;
  color: var(--text-3);
  justify-content: center;
  gap: 16px;
}
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 32px; align-items: start;
}
.footer-inner .col {
  min-width: 0;
  /* strip the global .col card styling */
  background: none; border: 0; border-radius: 0; box-shadow: none;
  padding: 0; overflow: visible;
}
.footer-inner .col-about p { font-size: 13.5px; color: var(--text-3); line-height: 1.8; margin: 0; max-width: 320px; }
.footer-inner h3 {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; letter-spacing: .05em; color: var(--text);
  margin-bottom: 16px; font-weight: 700;
}
.footer-inner h3::before {
  content: ""; width: 3px; height: 14px; border-radius: 2px; flex: 0 0 3px;
  background: linear-gradient(180deg, #06b6d4, #6366f1);
}
.footer-inner ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.footer-inner a, .footer-inner li { font-size: 13px; color: var(--text-3); line-height: 1.6; transition: all .16s ease; }
.footer-inner a { display: inline-block; padding: 2px 2px; }
.footer-inner a:hover { color: var(--brand); transform: translateX(3px); }
.footer-bottom {
  max-width: 1100px; margin: 28px auto 0; padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center;
}
.footer-bottom a.footer-lang { display: none; }

/* toast */
.toast-host { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 300; display: grid; gap: 8px; pointer-events: none; }
.toast {
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 99px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-l);
  animation: toast-in .22s ease-out;
  display: flex; align-items: center; gap: 8px; max-width: 90vw;
}
.toast.err { background: var(--danger); }
.toast.ok { background: #0f9d58; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

/* fullscreen preview modal */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 250; background: rgba(9, 12, 22, .82);
  display: grid; place-items: center; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-inner { max-width: 96vw; max-height: 92vh; display: grid; gap: 12px; justify-items: center; }
.modal-inner img { max-width: 96vw; max-height: 80vh; object-fit: contain; border-radius: 8px; box-shadow: var(--shadow-l); background: #fff; }
.modal-close { position: absolute; top: 16px; right: 18px; }


/* ---- confirm dialog (reset / destructive actions) ---- */
.confirm-dialog {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  padding: 28px 26px 22px;
  max-width: 380px;
  width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  display: grid; gap: 14px; justify-items: center;
  text-align: center;
  animation: confirmIn .2s ease-out;
}
@keyframes confirmIn {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.confirm-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: color-mix(in srgb, var(--warn) 12%, var(--bg-2));
  display: grid; place-items: center;
  color: var(--warn);
}
.confirm-icon svg { width: 24px; height: 24px; }
.confirm-title { font: 700 16px/1.3 var(--font-ui); color: var(--text); margin: 2px 0 0; }
.confirm-desc { font: 13px/1.55 var(--font-ui); color: var(--text-2); margin: 0; max-width: 300px; }
.confirm-actions { display: flex; gap: 10px; margin-top: 6px; width: 100%; }
.confirm-actions .btn { flex: 1; padding: 10px 16px; font-size: 13px; border-radius: 10px; justify-content: center; font-weight: 600; }
.confirm-actions .btn-danger {
  background: var(--danger, #dc3545); color: #fff; border-color: transparent;
}
.confirm-actions .btn-danger:hover { opacity: .9; }

/* responsive */
@media (max-width: 400px) {
  .confirm-dialog { padding: 22px 18px 18px; }
  .confirm-actions { flex-direction: column; }
}

/* responsive */
@media (max-width: 1080px) {
  .studio { grid-template-columns: 1fr; }
  .studio-shell { min-height: auto; }
  .preview-col { position: static; order: -1; }
  #posterCanvas { max-height: 52vh; }
  .header-nav { display: none; }
}
@media (max-width: 860px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .hero { padding-top: 20px; }
  /* index page hero: collapse two-column grid to single column on mobile */
  .hero { grid-template-columns: 1fr !important; gap: 20px; text-align: center; }
  .hero-inner { text-align: center; }
  .hero-art { order: -1; } /* show card above text on mobile */
  .hero-stack { width: 220px; height: 300px; }
  .hero-stack-card { width: 180px; padding: 16px 13px; border-radius: 14px; }
  .hero-qr { width: 64px; height: 64px; border-radius: 10px; padding: 7px; }
  .hero-card-title { font-size: 14px; }
  .hero-card-sub { font-size: 10px; }
  .hero-kicker { justify-content: center; }
  .hero-cta { justify-content: center; }
  .hero-badges { justify-content: center; }
  .studio { padding: 0 11px 30px; gap: 13px; }
  .tab-panels { padding: 13px; }
  .brand-text small { display: none; }
  .export-actions .secondary-row { grid-template-columns: 1fr 1fr 1fr; }
  .export-actions .tertiary-row { flex-wrap: wrap; }
  .cards { grid-template-columns: 1fr; }
  .export-actions .tertiary-row .btn { flex: 1 1 calc(50% - 4px); }
  .export-section { padding: 10px 12px; margin-bottom: 10px; }
  .preview-wrap { padding: 11px; }
  .canvas-ad-banner { grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px; }
  .canvas-ad-banner a { min-height: 60px; }
  .section { padding: 26px 14px; }
  table.info { min-width: 0; font-size: 13px; }
  table.info th, table.info td { padding: 9px 10px; }
  .site-header { padding: 0 14px; height: 56px; }
  .header-nav { gap: 2px; margin-left: 12px; }
  .header-nav a { padding: 6px 8px; font-size: 13px; }
  .header-actions { gap: 6px; }
  .brand { min-width: 0; }
  .brand-text { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
  .lang-switch button { padding: 11px 11px; font-size: 12px; min-height: 36px; }
  /* footer mobile */
  .site-footer { padding: 24px 16px 18px; margin-top: 28px; }
  .footer-inner { grid-template-columns: 1fr !important; gap: 22px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 18px; padding-top: 14px; }
}

/* print: only the poster canvas */
@media print {
  /* @page size is injected dynamically by doPrint() to match poster mm dimensions;
     fallback: auto with zero margin */
  @page { margin: 0; size: auto; }
  html, body {
    margin: 0 !important; padding: 0 !important;
    background: #fff !important;
    width: 100% !important; height: 100% !important;
    overflow: hidden !important;
  }
  /* hide ambient glows / decorative fixed layers that would print on the paper */
  body::before, body::after,
  .hero-stack::before, .hero-stack::after { display: none !important; }
  /* hide everything except the poster canvas — aggressive whitelist */
  .site-header, .site-footer, .hero, .section,
  .col-control, .export-actions,
  .saved-block, .field, .tabs, .studio-topbar,
  .hint-text, .preview-head,
  #emojiPickerModal,
  .col-main,
  .canvas-ad-banner,
  #toastHost, .toast { display: none !important; }

  /* studio-shell: full-page container for poster only */
  .studio-shell {
    display: block !important;
    visibility: visible !important;
    position: absolute !important;
    top: 0 !important; left: 0 !important;
    width: 100% !important; height: 100% !important;
    padding: 0 !important; margin: 0 !important;
    background: transparent !important;
  }

  /* preview-wrap: fill entire page */
  .preview-wrap {
    display: block !important;
    visibility: visible !important;
    position: absolute !important;
    top: 0 !important; left: 0 !important;
    width: 100% !important; height: 100% !important;
    padding: 0 !important; margin: 0 !important;
    border: none !important; border-radius: 0 !important;
    background: transparent !important; box-shadow: none !important;
    overflow: visible !important;
  }
  /* preview-stage: canvas container — stretch to fill */
  .preview-stage {
    display: block !important;
    position: static !important;
    width: 100% !important; height: 100% !important;
    background: transparent !important;
    padding: 0 !important; margin: 0 !important;
    visibility: visible !important;
    border: none !important; border-radius: 0 !important;
    overflow: visible !important;
  }
  /* canvas fills the printable area — @page size matches poster so no whitespace */
  #posterCanvas {
    display: block !important;
    visibility: visible !important;
    width: 100% !important; height: auto !important;
    max-width: 100% !important; max-height: 100vh !important;
    box-shadow: none !important; border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    page-break-inside: avoid;
    overflow: visible !important;
    margin: 0 !important; padding: 0 !important;
  }
  /* belt-and-suspenders: kill ALL border-radius on every element inside studio-shell */
  .studio-shell * {
    border-radius: 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ==========================================================================
   NEW: homepage hero + full-screen 3-column studio
   ========================================================================== */

/* ------------------------------- hero ------------------------------- */
.hero {
  max-width: 1180px; margin: 18px auto 8px; padding: 34px 20px 30px;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 28px; align-items: center;
}
.hero-inner { min-width: 0; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700;
  color: var(--brand-ink); background: var(--brand-soft); padding: 6px 12px; border-radius: 999px; margin-bottom: 16px;
}
.hero-kicker .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.hero h1 { font-size: clamp(27px, 4.4vw, 46px); margin: 0 0 14px; letter-spacing: -.02em; }
.hero h1 .grad {
  background: linear-gradient(100deg, #06b6d4, #3b82f6 45%, #8b5cf6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-2); font-size: 17px; line-height: 1.6; max-width: 600px; margin: 0 0 22px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.btn-lg { padding: 14px 26px; font-size: 15px; border-radius: 12px; font-weight: 700; transition: transform .2s ease, box-shadow .2s ease, filter .2s ease; }
.btn-lg:hover { transform: translateY(-2px); }
.btn-lg svg { width: 18px; height: 18px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-badges .badge {
  font-size: 12.5px; font-weight: 600; padding: 6px 13px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px;
  color: var(--text-2); box-shadow: var(--shadow-s);
  transition: border-color .15s ease, background .15s ease;
}
.hero-badges .badge:hover { border-color: var(--brand); background: var(--brand-soft); }
.hero-badges .badge b { color: var(--brand); }

/* hero visual — single poster card (inline SVG template preview) */
.hero-art { display: grid; place-items: center; }
.hero-stack {
  position: relative;
  width: 280px; max-width: 100%;
}
/* gradient halo behind the hero card — connectivity spectrum */
.hero-stack::before {
  content: "";
  position: absolute; inset: -3px; border-radius: 21px;
  background: linear-gradient(135deg, #06b6d4, #6366f1 55%, #8b5cf6);
  opacity: 0; filter: blur(6px);
  transition: opacity .4s ease;
  z-index: 0;
}
.hero-stack:hover::before { opacity: .45; }
.hero-stack-card {
  position: relative; z-index: 1;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.14);
  transition: transform .35s ease, box-shadow .35s ease;
}
.hero-stack-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 48px rgba(8,145,178,.28);
}
/* SVG fills card completely */
.hero-stack-card svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ============================ studio shell ============================ */
.studio-shell { display: flex; flex-direction: column; min-height: calc(100vh - var(--header-h)); }
.studio-topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg-2) 85%, transparent);
  position: sticky; top: var(--header-h); z-index: 40;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.studio-title { font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.studio-topbar .spacer, .preview-head .spacer, .preview-head .spacer { flex: 1; }

.studio-grid {
  flex: 1; display: grid; grid-template-columns: 280px minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 14px; padding: 14px; align-items: stretch; min-height: 0;
}

/* column base */
.col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-s); overflow: hidden; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.col-head h2 { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; margin: 0; }
.col-head h2 svg { width: 17px; height: 17px; color: var(--brand); }
.col-head .btn-sm { flex: 0 0 auto; }

/* column 1: templates control panel, scrollable */
.col-control { align-self: stretch; max-height: calc(100vh - var(--header-h) - 28px); position: sticky; top: calc(var(--header-h) + 14px); }
.col-control .tpl-filter { padding: 10px 12px 4px; }
.col-control .tpl-grid { padding: 4px 12px 14px; overflow-y: auto; flex: 0 1 auto; align-content: start; }
.col-control #tplApplied { padding: 0 12px; }

/* column 2 (center): canvas / preview — fixed viewport height so it never
   stretches when the side panel content changes between tabs */
.col-canvas {
  display: flex; flex-direction: column; min-height: 0;
  align-self: start;
  height: calc(100vh - var(--header-h) - 28px);
}

/* Ad banner above canvas — 3 images in a row, height matches side panels */
.canvas-ad-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  flex: 0 0 auto;
}
.canvas-ad-banner a {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: var(--r-s);
  background: var(--panel-2);
  min-height: 80px;
  max-height: 90px;
}
.canvas-ad-banner a img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s;
}
.canvas-ad-banner a:hover img { transform: scale(1.03); }
/* AdSense mode: let ins fill the banner */
.canvas-ad-banner ins { width: 100%; }
.col-canvas .preview-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.col-canvas .preview-stage { flex: 1; min-height: 360px; }

/* column 3: editor tools */
.col-main { background: transparent; border: 0; box-shadow: none; overflow: visible; display: flex; flex-direction: column; min-height: 0; align-self: start; height: calc(100vh - var(--header-h) - 28px); }
.col-main > .panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.col-main .tab-panels { overflow-y: auto; flex: 1; }

/* studio on tablet: single column, canvas stacked between control and tools */
@media (max-width: 1100px) {
  .studio-grid { grid-template-columns: minmax(0, 1fr); }
  .col-control { position: static; max-height: none; order: 1; }
  .col-canvas { order: 2; }
  .col-main { order: 3; }
}

/* studio on mobile: single column, canvas first */
@media (max-width: 820px) {
  .studio-grid { grid-template-columns: minmax(0, 1fr); padding: 10px; gap: 10px; }
  .col-canvas { order: 1; }
  .col-control { order: 2; }
  .col-main { order: 3; }
  .preview-wrap { order: -1; }
  #posterCanvas { max-height: 56vh; }
  .studio-topbar { top: var(--header-h); }
}

/* mini switch for template column */
.switch.small .track { width: 32px; height: 19px; flex: 0 0 32px; }
.switch.small .track::after { width: 13px; height: 13px; }
.switch.small input:checked + .track::after { transform: translateX(13px); }
.switch.small span.txt { font-size: 12.5px; }

/* homepage content spacing tweak */
.section:first-of-type { padding-top: 30px; }


/* ---- emoji picker modal ---- */
.emoji-picker-dialog {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  padding: 20px 18px 16px;
  max-width: 480px;
  width: 94vw;
  max-height: 80vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  display: grid; gap: 14px;
  animation: confirmIn .2s ease-out;
}
.emoji-picker-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2px;
  position: relative;
}
.emoji-picker-title {
  font: 700 15px/1.3 var(--sans); color: var(--text);
}
.emoji-picker-dialog .emoji-cats {
  display: flex; gap: 5px; flex-wrap: wrap;
}
.emoji-picker-dialog .emoji-cats .chip {
  font-size: 11.5px; padding: 4px 10px; border-radius: 20px;
  transition: all .15s ease; cursor: pointer;
}
.emoji-picker-dialog .emoji-cats .chip-active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 2px 6px rgba(8,145,178,.25);
}
.emoji-picker-dialog .emoji-grid {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px;
}
.emoji-picker-dialog .emoji-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 40px; aspect-ratio: 1; padding: 0; /* min-height = aspect-ratio fallback for older browsers */
  border: 2px solid var(--line); border-radius: 12px;
  background: var(--bg-2); cursor: pointer;
  font-size: 26px; line-height: 1;
  transition: all .18s ease;
}
.emoji-picker-dialog .emoji-btn:hover {
  border-color: var(--brand); transform: scale(1.1) translateY(-2px);
  box-shadow: 0 3px 10px rgba(8,145,178,.12), var(--shadow-s);
}
.emoji-picker-dialog .emoji-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.emoji-picker-dialog .emoji-btn.emoji-sel {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(8,145,178,.14), 0 2px 8px rgba(8,145,178,.12);
}
@media (max-width: 480px) {
  .emoji-picker-dialog { padding: 16px 14px 12px; max-width: 96vw; }
  .emoji-picker-dialog .emoji-grid { grid-template-columns: repeat(7, 1fr); gap: 5px; }
  .emoji-picker-dialog .emoji-btn { font-size: 22px; }
}
