/* =========================================================
   SOFT-BLUE STUDIO THEME  (light by default, dark = opt-in)
   ========================================================= */
:root {
  color-scheme: light;
  --bg: #dce7f8;
  --bg-2: #eaf1fc;
  --text: #23314f;
  --text-2: #46587a;
  --heading: #1c3a8f;      /* bold navy headings */
  --muted: #93a1bd;
  --card: #ffffff;
  --card-2: #f4f8fe;
  --card-hi: rgba(255, 255, 255, .85);
  --blur: 12px;
  --border: #e6edf8;
  --border-2: #d9e3f3;
  --field: #f6f9ff;
  --field-border: #e2eaf7;

  --accent: #2f6bf6;       /* bright blue — links/focus */
  --accent-2: #1e4fd8;
  --accent-soft: #e8f0ff;
  --accent-ring: rgba(47, 107, 246, .22);
  --on-accent: #ffffff;
  --navy: #1c3a8f;         /* primary buttons / active rail */
  --navy-2: #16307a;
  --navy-grad: linear-gradient(160deg, #274bb0 0%, #1a3792 55%, #16307a 100%);
  --panel-grad: linear-gradient(165deg, #24439f 0%, #1b3a8f 60%, #17337d 100%);
  --dl-jpg: #3d9be0; --dl-jpg-2: #2f8bd0;
  --dl-svg: #f5a623; --dl-svg-2: #ec9410;

  --grad: linear-gradient(135deg, #2f6bf6, #6366f1 55%, #7c3aed);
  --grad-text: linear-gradient(100deg, #2f6bf6, #1c3a8f);
  --glow: 0 10px 24px -8px rgba(28, 58, 143, .4);
  --glow-strong: 0 16px 34px -10px rgba(28, 58, 143, .5);

  --green: #12a150;  --green-soft: #e5f6ec;
  --orange: #e08a1e; --orange-soft: #fbeed7;
  --danger: #e5484d; --danger-soft: #fdecec;

  --shadow: 0 2px 6px rgba(28, 46, 90, .05), 0 24px 48px -18px rgba(28, 46, 90, .22);
  --shadow-sm: 0 2px 8px rgba(28, 46, 90, .06);
  --shadow-pop: 0 28px 60px -16px rgba(28, 46, 90, .28);
  --radius: 26px;
  --radius-sm: 14px;
  --topbar-bg: rgba(255, 255, 255, .7);
  --bg-mesh: radial-gradient(60% 60% at 50% -10%, var(--bg-2), transparent 70%);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1424;
  --bg-2: #131d33;
  --text: #e7edf9;
  --text-2: #b6c2da;
  --heading: #dfe8ff;
  --muted: #7f8db0;
  --card: #16203a;
  --card-2: #1b2848;
  --card-hi: rgba(255, 255, 255, .05);
  --blur: 14px;
  --border: #263354;
  --border-2: #2f3e66;
  --field: #1b2848;
  --field-border: #2f3e66;
  --accent: #5b8bff; --accent-2: #3f74f0;
  --accent-soft: rgba(91, 139, 255, .16);
  --accent-ring: rgba(91, 139, 255, .3);
  --on-accent: #ffffff;
  --navy: #2f6bf6; --navy-2: #1e4fd8;
  --navy-grad: linear-gradient(160deg, #3a74ff, #2f6bf6 55%, #1e4fd8);
  --panel-grad: linear-gradient(165deg, #1b2b52 0%, #16233f 60%, #121d34 100%);
  --green: #34d17e;  --green-soft: rgba(52,209,126,.16);
  --orange: #e6a54a; --orange-soft: rgba(230,165,74,.16);
  --danger: #ff6b6f; --danger-soft: rgba(255,107,111,.16);
  --shadow: 0 2px 8px rgba(0,0,0,.4), 0 22px 50px -18px rgba(0,0,0,.6);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-pop: 0 28px 60px -16px rgba(0,0,0,.7);
  --topbar-bg: rgba(19, 29, 51, .7);
  --bg-mesh: radial-gradient(60% 60% at 50% -10%, var(--bg-2), transparent 70%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  line-height: 1.5;
  letter-spacing: -0.011em;
  padding: 0 20px 60px;
  background-color: var(--bg);
  background-image: var(--bg-mesh);
  background-attachment: fixed;
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  transition: background-color .25s ease, color .25s ease;
}

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 12px; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  max-width: 1440px; margin: 14px auto 0; padding: 10px 14px;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 1.16rem; font-weight: 800; letter-spacing: -.02em; cursor: pointer; user-select: none; padding: 4px 6px; border-radius: 10px; transition: .16s; }
.brand:hover { background: var(--field); }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; flex: 0 0 auto;
  background: var(--grad); background-size: 160% 160%;
  box-shadow: var(--glow); position: relative;
  animation: grad-pan 6s ease infinite;
}
.brand-mark::after {
  content: ''; position: absolute; inset: 6px;
  background:
    linear-gradient(#fff 0 0) 0 0 / 6px 6px no-repeat,
    linear-gradient(#fff 0 0) 100% 0 / 6px 6px no-repeat,
    linear-gradient(#fff 0 0) 0 100% / 6px 6px no-repeat;
  opacity: .95;
}
.brand-name {
  background: var(--grad-text); background-size: 180% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: grad-pan 6s ease infinite;
}
@keyframes grad-pan { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.menu { display: contents; }               /* transparent on desktop; becomes a dropdown on mobile */
.burger { display: none; }                 /* shown only on mobile */
.theme-toggle {
  order: 3;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0; flex: 0 0 auto;
  border: 1px solid var(--border-2); border-radius: 11px;
  background: var(--card); color: var(--text); font-size: 1.05rem; cursor: pointer; transition: .16s;
}
.theme-toggle:hover { background: var(--field); border-color: var(--muted); }
.nav-links { display: flex; gap: 2px; }
.navlink {
  border: 0; background: transparent; cursor: pointer;
  padding: 9px 15px; border-radius: 11px;
  font-weight: 550; font-size: .9rem; color: var(--muted); transition: .16s;
}
.navlink:hover { color: var(--text); background: var(--field); }
.navlink.active { background: var(--solid); color: var(--on-solid); }
.navlink.active:hover { background: var(--solid); color: var(--on-solid); }
.authbar { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--muted); }
.authbar .email { font-weight: 600; color: var(--text); }

/* ---- Layout ---- */
.view { max-width: 1440px; margin: 20px auto 0; }
.layout { display: grid; grid-template-columns: 1.15fr 1fr; gap: 24px; align-items: start; }
.col-left { display: grid; gap: 24px; }
/* Before a type is picked: use the full width for the type gallery, hide the empty download column. */
#view-gen.picking.layout { grid-template-columns: 1fr; }
#view-gen.picking .col-right { display: none; }
#view-gen.picking .type-cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

/* ---- Hero (shown only while choosing a type) ---- */
.gen-hero { grid-column: 1 / -1; text-align: center; padding: 20px 12px 8px; animation: rise .5s cubic-bezier(.2,.7,.3,1) both; }
#view-gen:not(.picking) .gen-hero { display: none; }
.hero-badge {
  display: inline-block; margin-bottom: 16px; padding: 7px 15px; border-radius: 999px;
  font-size: .8rem; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.gen-hero h1 { font-size: clamp(1.9rem, 5vw, 3.1rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.06; margin: 0 0 12px; }
.gen-hero .grad-word {
  background: var(--grad-text); background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: grad-pan 6s ease infinite;
}
.gen-hero p { color: var(--muted); font-size: clamp(.98rem, 2.2vw, 1.12rem); max-width: 580px; margin: 0 auto; }

/* ---- Entrance animation ---- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.card { animation: rise .5s cubic-bezier(.2,.7,.3,1) both; }
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
}

.sec-head {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 18px; font-size: 1.18rem; font-weight: 800; letter-spacing: -.01em;
}
.num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 9px;
  background: var(--grad); color: #fff;
  font-size: .9rem; font-weight: 800; flex: 0 0 auto;
  box-shadow: 0 4px 12px -4px var(--accent-ring);
}
.optional { color: var(--muted); font-weight: 500; font-size: .9rem; }
.field-label { display: block; color: var(--muted); font-size: .9rem; margin: 4px 0 8px; font-weight: 600; }
.muted { color: var(--muted); }

/* ---- Fields ---- */
.link-input, .login-email, .domain-add input, #domain-select, .sub-input, input[type=text], input[type=email] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--field-border);
  border-radius: 13px;
  background: var(--field);
  color: var(--text);
  font-size: 1rem;
  transition: .16s;
}
.link-input:focus, .login-email:focus, .domain-add input:focus, input[type=text]:focus, input[type=email]:focus {
  outline: none; border-color: var(--accent); background: var(--card);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ---- QR type constructor ---- */
.type-group-title { font-size: .78rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin: 16px 0 10px; }
.type-group-title:first-child { margin-top: 0; }
.type-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-card {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 13px 15px; border: 1px solid var(--border-2); border-radius: 14px;
  background: var(--card); cursor: pointer; transition: transform .14s, border-color .14s, box-shadow .14s;
}
.type-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.tc-icon {
  font-size: 1.2rem; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--tc, #6366f1) 24%, transparent);
  border: 1px solid color-mix(in srgb, var(--tc, #6366f1) 40%, transparent);
  border-radius: 12px; flex: 0 0 auto; transition: .16s;
  box-shadow: 0 0 18px -6px color-mix(in srgb, var(--tc, #6366f1) 70%, transparent);
}
.type-card:hover { border-color: color-mix(in srgb, var(--tc, #6366f1) 60%, transparent); }
.type-card:hover .tc-icon { background: color-mix(in srgb, var(--tc, #6366f1) 34%, transparent); transform: scale(1.06); }
.tc-text { display: flex; flex-direction: column; min-width: 0; }
.tc-label { font-weight: 700; font-size: .95rem; }
.tc-desc { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- WYSIWYG editor ---- */
.wysiwyg { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--card); }
.wys-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 8px; background: var(--field); border-bottom: 1px solid var(--border); }
.wys-toolbar button { border: 0; background: transparent; cursor: pointer; min-width: 32px; height: 30px; padding: 0 8px; border-radius: 8px; font-size: .9rem; color: var(--text); }
.wys-toolbar button:hover { background: var(--card); }
.wys-toolbar button.on { background: var(--accent-soft); color: var(--accent); }
.wys-sep { width: 1px; background: var(--border); margin: 3px 4px; }
.wys-area { min-height: 160px; max-height: 340px; overflow-y: auto; padding: 14px 16px; outline: none; line-height: 1.6; }
.wys-area:empty::before { content: attr(data-placeholder); color: var(--muted); }
.wys-area h1 { font-size: 1.5rem; margin: .3em 0; } .wys-area h2 { font-size: 1.25rem; margin: .3em 0; }
.wys-area ul, .wys-area ol { padding-left: 1.4em; } .wys-area a { color: var(--accent); }

.type-back { margin-bottom: 16px; padding: 7px 14px; font-size: .85rem; }
.type-form-head { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 800; margin-bottom: 14px; }
.type-form-head .tf-icon { font-size: 1.35rem; }
#type-fields label.field-label { margin-top: 14px; }
#type-fields label.field-label:first-child { margin-top: 0; }
.type-form select, #type-fields textarea { width: 100%; padding: 14px 16px; border: 1px solid var(--field-border); border-radius: 13px; background: var(--field); color: var(--text); font-size: 1rem; }
.type-form select:focus, #type-fields textarea:focus { outline: none; border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 4px var(--accent-soft); }
#type-fields textarea { resize: vertical; font-family: inherit; }

@media (max-width: 460px) { .type-cards { grid-template-columns: 1fr; } }

/* ---- Dropzone ---- */
.dropzone {
  border: 1.5px dashed var(--border); border-radius: 16px;
  background: var(--field); padding: 28px 18px; text-align: center;
  cursor: pointer; transition: .16s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dz-icon { font-size: 2rem; margin-bottom: 6px; }
.dz-hint { font-size: .8rem; margin-top: 4px; }
.dz-picked { display: flex; align-items: center; justify-content: center; gap: 12px; }
.dz-picked #dz-name { font-weight: 600; word-break: break-all; }
/* Multi-file list */
.file-list { display: grid; gap: 8px; margin-top: 12px; }
.fl-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--field); }
.fl-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; }
.fl-ic { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; background: var(--card); border: 1px solid var(--border); border-radius: 8px; flex: 0 0 auto; }
.fl-name { flex: 1; font-weight: 600; font-size: .9rem; word-break: break-all; }
.fl-size { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.fl-x { border: 0; background: transparent; color: var(--muted); font-size: .95rem; cursor: pointer; padding: 4px 9px; border-radius: 8px; line-height: 1; }
.fl-x:hover { background: var(--danger-soft); color: var(--danger); }
.fm-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

/* ---- Switch ---- */
.switch { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; font-size: .9rem; cursor: pointer; }
.switch input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
.dyn-note { margin: 8px 0 0; font-size: .85rem; }

/* ---- Design tabs ---- */
.dtabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.dtab {
  border: 1px solid var(--border-2); background: var(--card); cursor: pointer;
  padding: 8px 14px; font-size: .76rem; font-weight: 700; letter-spacing: .4px;
  color: var(--muted); border-radius: 10px; transition: .16s;
}
.dtab:hover { color: var(--text); border-color: var(--muted); }
.dtab.active { color: var(--on-solid); background: var(--solid); border-color: var(--solid); }
.dpanel { display: none; }
.dpanel.active { display: block; }

/* ---- Choice grids (frames, shapes) ---- */
.grid-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; margin-bottom: 6px; }
/* Segmented control (scan level) */
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--field); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 6px; }
.seg-btn { border: 0; background: transparent; padding: 7px 16px; border-radius: 8px; font-weight: 650; font-size: .85rem; color: var(--muted); cursor: pointer; transition: .14s; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--solid); color: var(--on-solid); }
/* Style & download CTA */
.stylize-btn { width: 100%; font-size: 1.02rem; padding: 14px; margin-top: 4px; }
/* Ready-made template swatches */
.tpl-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.tpl-grid .choice { padding: 6px; }
.tpl-grid .choice svg { width: 100%; height: auto; border-radius: 6px; }
.tpl-grid .choice .cap { margin-top: 4px; }
.choice {
  aspect-ratio: 1; border: 1.5px solid var(--border); border-radius: 14px;
  background: var(--card); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 6px; transition: .15s;
}
.choice:hover { border-color: var(--accent); }
.choice.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.choice svg { width: 30px; height: 30px; }
.choice .cap { font-size: .58rem; color: var(--muted); font-weight: 700; letter-spacing: .3px; text-align: center; }
.choice.active .cap { color: var(--text); }

/* ---- Color ---- */
.color-row { display: flex; gap: 24px; flex-wrap: wrap; }
.color-field { display: flex; align-items: center; gap: 10px; font-size: .9rem; font-weight: 600; }
.color-field input[type=color] {
  width: 46px; height: 34px; padding: 0; border: 1px solid var(--border);
  border-radius: 10px; background: none; cursor: pointer;
}

/* ---- Logo ---- */
input[type=file] { font-size: .9rem; color: var(--muted); }
#logo-remove { margin-top: 14px; }

/* ---- Preview ---- */
.preview-card { position: sticky; top: 92px; }
.preview-wrap { display: flex; justify-content: center; padding: 22px 0 12px; }
.frame-wrap {
  --fc: #000;
  position: relative; isolation: isolate;
  display: inline-flex; flex-direction: column; align-items: stretch;
  background: var(--fc); padding: 14px; border-radius: 22px; gap: 8px;
  transition: opacity .2s, filter .2s;
  animation: pop-in .45s cubic-bezier(.2,.8,.3,1) both;
}
/* Soft branded glow behind the code (only rendered when a QR is shown) */
.frame-wrap::before {
  content: ''; position: absolute; inset: -16%; z-index: -1;
  background: var(--grad); border-radius: 40px;
  filter: blur(52px); opacity: .32;
  animation: grad-pan 8s ease infinite; background-size: 180% 180%;
}
@keyframes pop-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.frame-wrap.top { flex-direction: column-reverse; }
.frame-wrap.square { border-radius: 8px; }
.frame-wrap.none { background: transparent; padding: 0; gap: 0; }
.frame-wrap.placeholder { opacity: .5; }
.qr-panel .qr-empty { margin-top: 12px; color: rgba(234,240,255,.7); }
.frame-wrap .qr-box { background: #fff; border-radius: 12px; padding: 8px; line-height: 0; }
.frame-wrap.none .qr-box { padding: 0; }
.frame-wrap .frame-label { color: #fff; text-align: center; font-weight: 800; letter-spacing: 2px; font-size: 1rem; padding: 2px 0 4px; }
.frame-wrap.none .frame-label { display: none; }
#preview canvas, #preview svg { display: block; width: 240px; max-width: 100%; height: auto; border-radius: 6px; }
.frame-wrap { max-width: 100%; }
.preview-hint { text-align: center; font-size: .88rem; margin: 12px 0 0; }
.content-preview { display: flex; align-items: center; gap: 12px; margin: 14px 0 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--field); text-align: left; }
.cp-icon { width: 40px; height: 40px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.cp-icon img { width: 100%; height: 100%; object-fit: cover; }
.cp-icon .cp-fav { width: 22px; height: 22px; }
.cp-text { min-width: 0; flex: 1; }
.cp-title { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-sub { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content-preview.page-mode { display: block; padding: 0; background: transparent; border: 0; }
.pp-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--field); border: 1px solid var(--border); border-bottom: 0; border-radius: 12px 12px 0 0; }
.pp-bar i { width: 9px; height: 9px; border-radius: 50%; background: #d6dae1; flex: 0 0 auto; }
.pp-bar span { margin-left: 8px; font-size: .72rem; color: var(--muted); }
.pp-frame { width: 100%; height: 320px; border: 1px solid var(--border); border-radius: 0 0 12px 12px; background: #f1f2f5; display: block; }
.short-note { text-align: center; font-size: .85rem; color: var(--muted); word-break: break-all; margin: 12px 0 0; }
.short-note a { color: var(--accent); }

/* ---- Buttons ---- */
.dl-row { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.btn-save, .btn-primary, .btn-download {
  position: relative; overflow: hidden;
  border: 0; cursor: pointer; color: #fff;
  background: var(--grad); background-size: 160% 160%;
  font-weight: 650; border-radius: 12px; transition: transform .16s, box-shadow .16s, filter .16s;
  box-shadow: var(--glow);
}
/* subtle sheen sweep on hover */
.btn-save::after, .btn-primary::after, .btn-download::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform .6s ease;
}
.btn-save:hover::after, .btn-primary:hover::after, .btn-download:hover::after { transform: translateX(120%); }
.btn-save:hover, .btn-primary:hover, .btn-download:hover { transform: translateY(-2px); box-shadow: var(--glow-strong); filter: saturate(1.08); }
.btn-save:active, .btn-primary:active, .btn-download:active { transform: translateY(0); }
.btn-save { padding: 15px 22px; font-size: 1rem; }
.btn-primary { padding: 13px 22px; font-size: 1rem; }
.btn-download { flex: 1; padding: 15px; font-size: 1rem; }
.btn-save:disabled, .btn-primary:disabled, .btn-download:disabled { opacity: .55; cursor: default; box-shadow: none; transform: none; filter: grayscale(.2); }
.btn-save:disabled { background: var(--green); }
.btn-save:disabled::after, .btn-primary:disabled::after, .btn-download:disabled::after { display: none; }

.btn-ghost {
  background: var(--card); color: var(--text);
  border: 1px solid var(--border-2);
  padding: 12px 18px; border-radius: 12px; font-weight: 550; cursor: pointer; transition: .16s;
}
.btn-ghost:hover { border-color: var(--muted); background: var(--field); }
.authbar button {
  padding: 8px 15px; font-size: .85rem; font-weight: 550; background: var(--card); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 11px; cursor: pointer; transition: .16s;
}
.authbar button:hover { background: var(--field); border-color: var(--muted); }
.link-danger { color: var(--danger) !important; border-color: rgba(229, 72, 77, .4) !important; }
.link-danger:hover { background: var(--danger-soft) !important; }

/* ---- Login ---- */
.login { display: grid; gap: 12px; }
.login h2 { margin: 0 40px 0 0; font-size: 1.2rem; }
.login-msg { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--field); font-size: .9rem; word-break: break-all; }
.login-msg a { color: var(--accent); }
.consent { font-size: .78rem; line-height: 1.5; margin: 2px 0 0; }
.consent a { color: var(--accent); }
.login-prompt { display: grid; gap: 14px; justify-items: start; }
.login-prompt .muted { margin: 0; }

/* ---- Modal popup ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(15, 22, 40, .45);
  animation: overlay-in .16s ease;
}
.modal {
  position: relative; width: 100%; max-width: 420px; padding: 28px;
  background: var(--card);
  -webkit-backdrop-filter: blur(30px) saturate(150%); backdrop-filter: blur(30px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-pop), inset 0 1px 0 var(--card-hi);
}
.modal-overlay { background: rgba(6, 6, 14, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal-close {
  position: absolute; top: 14px; right: 16px; width: 30px; height: 30px; padding: 0;
  border: 0; background: transparent; cursor: pointer; font-size: 1.6rem; line-height: 1;
  color: var(--muted); border-radius: 8px;
}
.modal-close:hover { background: var(--field); color: var(--text); }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

/* ---- Codes / files list ---- */
.list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.code-row { display: grid; gap: 4px; padding: 16px 0; border-top: 1px solid var(--border); }
.code-row:first-child { border-top: 0; }
.code-title { font-weight: 700; }
.code-meta { font-size: .85rem; color: var(--muted); word-break: break-all; }
.code-meta a { color: var(--accent); }
.code-scans { color: var(--green); font-weight: 700; }
.code-actions { display: flex; gap: 8px; margin-top: 6px; }
.code-actions button { padding: 7px 14px; font-size: .85rem; }
.empty { color: var(--muted); text-align: center; padding: 22px; }
.code-list .code-row:first-child { border-top: 1px solid var(--border); }
.code-list .code-row:nth-child(1) { border-top: 0; }

/* Grid/list toggle */
.head-actions { display: flex; align-items: center; gap: 10px; }
.view-toggle { display: inline-flex; gap: 2px; padding: 3px; background: var(--field, #f4f5f7); border-radius: 10px; }
.vt-btn { border: 0; background: transparent; width: 34px; height: 30px; border-radius: 7px; cursor: pointer; font-size: 1rem; color: var(--muted); line-height: 1; }
.vt-btn:hover { color: var(--text); }
.vt-btn.active { background: var(--solid); color: var(--on-solid); }

/* Codes/files as a grid of real QR codes (5 per row) */
.code-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .code-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px) { .code-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .code-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.code-card { border: 1px solid var(--border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.code-card .cc-qr { display: block; width: 100%; line-height: 0; background: #fff; border-radius: 10px; overflow: hidden; }
.code-card .cc-qr svg { width: 100%; height: auto; display: block; }
.code-card .cc-title { font-weight: 700; font-size: .85rem; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.code-card .cc-sub { font-size: .78rem; }
.code-card .cc-link { font-size: .72rem; color: var(--accent); width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.code-card .cc-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 2px; }
.code-card .cc-actions button { padding: 5px 10px; font-size: .78rem; }

/* ---- Domains ---- */
.dom-option { padding: 18px 20px; margin: 16px 0; background: var(--card); border: 1px solid var(--border); border-radius: 16px; }
.dom-option-title { font-weight: 700; font-size: 1.02rem; display: flex; align-items: center; gap: 10px; }
.dom-tag { font-size: .68rem; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--green); background: var(--green-soft); padding: 3px 9px; border-radius: 20px; }
.dom-option-sub { margin: 6px 0 12px; font-size: .88rem; }
.sub-add { display: flex; gap: 10px; }
.sub-input { flex: 1; display: flex; align-items: center; padding: 0; overflow: hidden; }
.sub-input input { flex: 1; border: 0; background: transparent; box-shadow: none; padding: 13px 14px; min-width: 0; }
.sub-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--card); }
.sub-input input:focus { box-shadow: none; background: transparent; border: 0; }
.sub-suffix { color: var(--muted); padding: 0 14px 0 4px; white-space: nowrap; font-size: .95rem; }
.domain-add { display: flex; gap: 10px; }
.dom-row { padding: 16px 0; border-top: 1px solid var(--border); }
.dom-row:first-child { border-top: 0; }
.dom-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dom-name { font-weight: 700; }
.dom-badge { font-size: .72rem; font-weight: 700; padding: 4px 11px; border-radius: 20px; }
.dom-badge.active { background: var(--green-soft); color: var(--green); }
.dom-badge.pending { background: var(--orange-soft); color: var(--orange); }
.dom-badge.error { background: var(--danger-soft); color: var(--danger); }
.dom-actions { margin-left: auto; display: flex; gap: 8px; }
.dom-actions button { padding: 7px 14px; font-size: .85rem; }
.dom-help { margin: 10px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--field); font-size: .86rem; color: var(--muted); line-height: 1.6; }
.dom-help code { background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; color: var(--accent); font-size: .85rem; font-weight: 600; }
.dom-err { color: var(--danger); font-size: .85rem; margin: 8px 0 0; }

/* ---- Domain selector in generator ---- */
.domain-row { margin-top: 16px; }

/* ---- Profile / storage ---- */
.storage-head { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.storage-bar { height: 12px; border-radius: 8px; background: var(--field); overflow: hidden; margin: 10px 0 6px; }
.storage-fill { height: 100%; width: 0; background: var(--accent); border-radius: 8px; transition: width .3s, background .3s; }
.storage-fill.warn { background: var(--orange); }
.storage-fill.full { background: var(--danger); }
.plan-box { margin-top: 22px; border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; }
.plan-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 40px; height: 40px; padding: 0; font-size: 1.2rem; border-radius: 12px; }
.stepper span { min-width: 28px; text-align: center; font-weight: 700; }
.plan-summary { margin-top: 12px; }

/* ---- Analytics dashboard ---- */
.stats-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.range-btn { padding: 7px 14px; font-size: .82rem; }
.stat-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.stat-card { background: var(--field); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.stat-label { font-size: .82rem; color: var(--muted); font-weight: 600; }
.stat-num { font-size: 2rem; font-weight: 800; margin-top: 4px; }
.chart-block { margin-top: 16px; border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.chart-title { font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.chart-block svg { display: block; width: 100%; height: auto; }
.stats-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stats-two .chart-block { margin-top: 16px; }
.hbars { display: grid; gap: 8px; }
.hbar-row { display: grid; grid-template-columns: 90px 1fr 42px; align-items: center; gap: 8px; font-size: .84rem; }
.hbar-label { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 10px; background: var(--field); border-radius: 6px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.hbar-val { text-align: right; color: var(--muted); font-weight: 700; }
@media (max-width: 640px) { .stats-two { grid-template-columns: 1fr; } .stat-cards { grid-template-columns: 1fr; } }

/* ---- Terms / disclaimer ---- */
.upload-terms { margin: 12px 0 0; font-size: .78rem; line-height: 1.5; }
.upload-terms a, .linklike { color: var(--accent); }
.legal-footer { max-width: 1120px; margin: 28px auto 0; text-align: center; }
.linklike { background: none; border: 0; cursor: pointer; font: inherit; font-size: .85rem; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.linklike:hover { color: var(--accent); }
.terms-modal { max-width: 560px; max-height: 85vh; overflow-y: auto; }
.terms-body { display: grid; gap: 12px; font-size: .9rem; color: var(--text); }
.terms-body strong { font-weight: 700; }

/* =========================================================
   3-COLUMN GENERATOR  (rail · content · QR panel)
   ========================================================= */
.gen3 {
  max-width: 1440px; margin: 18px auto 0;
  display: grid; grid-template-columns: 84px minmax(0, 1fr) 400px; gap: 22px;
  align-items: start;
}
/* Full-height app: page doesn't scroll, each column scrolls inside itself */
@media (min-width: 1041px) {
  html:has(#view-gen:not([hidden])),
  body:has(#view-gen:not([hidden])) { height: 100dvh; overflow: hidden; }
  body:has(#view-gen:not([hidden])) { padding-bottom: 0; }
  .gen3 { height: calc(100dvh - 96px); align-items: stretch; grid-template-rows: minmax(0, 1fr); }
  .rail, .gen-center, .qr-panel { min-height: 0; }   /* let columns shrink so they scroll instead of growing the row */
  .rail { height: 100%; overflow-y: auto; overflow-x: hidden; }
  .gen-center { height: 100%; overflow-y: auto; }
  .qr-panel { height: 100%; display: flex; }
  .qr-panel-scroll { flex: 1; height: 100%; min-height: 0; }
  .rail::-webkit-scrollbar, .gen-center::-webkit-scrollbar { width: 8px; }
  .rail::-webkit-scrollbar-thumb, .gen-center::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 8px; }
}

/* --- Left rail --- */
.rail {
  position: sticky; top: 84px;
  background: var(--card); border: 1px solid var(--border); border-radius: 26px;
  box-shadow: var(--shadow); padding: 10px 9px;
}
.rail-types { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rail-item {
  position: relative; width: 44px; height: 44px; border: 0; border-radius: 13px;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 1.15rem;
  display: flex; align-items: center; justify-content: center; transition: .16s;
  flex: 0 0 auto;
}
.rail-item:hover { background: var(--accent-soft); }
.rail-item.active { background: var(--navy-grad); color: #fff; box-shadow: var(--glow); }
.rail-item.active .ri-icon { filter: brightness(0) invert(1); }
.rail-item .ri-tip {
  position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%) scale(.94);
  background: var(--navy); color: #fff; font-size: .78rem; font-weight: 600; white-space: nowrap;
  padding: 6px 11px; border-radius: 9px; opacity: 0; pointer-events: none; transition: .14s; z-index: 6;
  box-shadow: var(--shadow);
}
.rail-item .ri-tip::before { content: ''; position: absolute; right: 100%; top: 50%; transform: translateY(-50%); border: 5px solid transparent; border-right-color: var(--navy); }
.rail-item:hover .ri-tip { opacity: 1; transform: translateY(-50%) scale(1); }

/* --- Center content --- */
.gen-center {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 42px 46px; min-height: 480px;
}
.center-empty h1 { font-family: 'Poppins', 'Inter', sans-serif; font-size: 2.7rem; font-weight: 800; color: var(--heading); letter-spacing: -.03em; line-height: 1.08; margin: 6px 0 14px; }
.center-empty .grad-word { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.center-empty p { max-width: 440px; font-size: 1.02rem; }
.type-form-head { font-family: 'Poppins', 'Inter', sans-serif; font-size: 2.5rem; font-weight: 800; color: var(--heading); letter-spacing: -.03em; display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.type-form-head .tf-icon { font-size: 2rem; }
.center-sub { margin: 0 0 28px; font-size: .96rem; }
.gen-center .field-label { font-size: .95rem; }
.gen-center .link-input, .gen-center select, .gen-center textarea { font-size: 1.02rem; }

/* --- Right QR panel (dark) --- */
.qr-panel {
  position: sticky; top: 84px;
  background: var(--panel-grad); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 20px; color: #eaf0ff;
}
/* Panel is a flex column: QR + tabs + downloads stay fixed, only the tab body scrolls */
.qr-panel-scroll { display: flex; flex-direction: column; gap: 12px; }
.qr-stage, .qr-panel .content-preview, .ptabs, .qr-dl { flex: 0 0 auto; }
.ptab-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 4px 4px 2px; }
.ptab-body::-webkit-scrollbar { width: 8px; }
.ptab-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 8px; }
.qr-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 0 6px; }
.qr-panel .frame-wrap { animation: pop-in .4s cubic-bezier(.2,.8,.3,1) both; }
.qr-panel .frame-wrap.none { background: transparent; }
.qr-panel .frame-wrap.none .qr-box { background: #fff; border-radius: 16px; padding: 12px; box-shadow: 0 12px 30px -8px rgba(0,0,0,.5); }
.qr-empty { color: rgba(234,240,255,.6); text-align: center; font-size: .76rem; white-space: nowrap; margin: 0; }
.qr-panel .content-preview { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12); }
.qr-panel .cp-title { color: #eef3ff; } .qr-panel .cp-sub { color: rgba(234,240,255,.6); }
.qr-panel .cp-icon { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.14); }

/* Accordions */
/* Settings tabs (top of panel) + scrollable panel body */
.ptabs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px;
  background: rgba(255, 255, 255, .09); border: 1px solid rgba(255,255,255,.12);
  border-radius: 13px; padding: 5px;
}
.ptab { border: 0; background: transparent; color: rgba(234,240,255,.72); font-size: .8rem; font-weight: 700; padding: 9px 4px; border-radius: 9px; cursor: pointer; transition: .14s; }
.ptab:hover { color: #fff; }
.ptab.active { background: #fff; color: var(--navy); }
.ptab-panel { display: none; }
.ptab-panel.active { display: block; animation: fade-in .2s ease both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.acc-body { padding: 2px 0; }

/* QR code ↔ page preview switch (text type) */
.qr-mode { flex: 0 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.12); border-radius: 13px; padding: 5px; }
.qm-btn { border: 0; background: transparent; color: rgba(234,240,255,.72); font-size: .82rem; font-weight: 700; padding: 10px 6px; border-radius: 9px; cursor: pointer; transition: .14s; }
.qm-btn:hover { color: #fff; }
.qm-btn.active { background: #fff; color: var(--navy); }
#text-preview { display: none; }
.qr-panel.preview-mode .qr-stage,
.qr-panel.preview-mode #content-preview,
.qr-panel.preview-mode .ptabs,
.qr-panel.preview-mode .ptab-body,
.qr-panel.preview-mode .qr-dl { display: none; }
.qr-panel.preview-mode #text-preview { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.qr-panel.preview-mode #text-preview .pp-frame { flex: 1 1 auto; height: auto; min-height: 360px; }
.qr-panel #text-preview .pp-bar { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.16); }
.qr-panel #text-preview .pp-bar span { color: rgba(234,240,255,.7); }
/* File "after scan" preview */
.qr-panel.preview-mode #text-preview .op-view {
  flex: 1 1 auto; min-height: 360px; display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid rgba(255,255,255,.16); border-top: 0; border-radius: 0 0 12px 12px;
  overflow: auto; padding: 14px;
}
.op-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; display: block; }
.op-file { flex-direction: column; gap: 8px; text-align: center; }
.op-file-ic { font-size: 3rem; line-height: 1; }
.op-file-name { font-weight: 700; color: #1c3a8f; word-break: break-all; }
.op-file-sub { font-size: .85rem; color: #93a1bd; }
.qr-panel.preview-mode #text-preview .op-page { display: block; align-items: stretch; justify-content: flex-start; padding: 12px; }
.op-list { list-style: none; margin: 0; padding: 0; width: 100%; }
.op-list li { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-top: 1px solid #eef2fa; color: #23314f; }
.op-list li:first-child { border-top: 0; }
.op-list .oln { flex: 1; font-weight: 600; font-size: .86rem; word-break: break-all; }
.op-list .ols { color: #93a1bd; font-size: .78rem; white-space: nowrap; }
.op-list .oldl { color: #fff; background: #1c3a8f; font-size: .72rem; font-weight: 700; padding: 5px 10px; border-radius: 8px; white-space: nowrap; }
.op-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%; }
.op-gallery figure { margin: 0; background: #f6f9ff; border: 1px solid #e6edf8; border-radius: 10px; overflow: hidden; }
.op-gallery figure img { width: 100%; height: 110px; object-fit: cover; display: block; }
.op-gallery figure.ff { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 110px; }
.op-gallery figcaption { padding: 6px 8px; font-size: .72rem; color: #23314f; font-weight: 600; word-break: break-all; text-align: center; }
.op-embed { width: 100%; display: grid; gap: 14px; }
.op-embed .oe { background: #f6f9ff; border: 1px solid #e6edf8; border-radius: 10px; overflow: hidden; }
.op-embed .oe img { width: 100%; display: block; }
.op-embed .oe iframe { width: 100%; height: 300px; border: 0; display: block; background: #fff; }
.op-embed .oe.ff { display: flex; flex-direction: column; align-items: center; padding: 18px; }
.op-embed .oec { padding: 8px 10px; font-size: .74rem; color: #23314f; font-weight: 600; word-break: break-all; }

/* Profile sections (appearance / legal) */
.prof-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.prof-section .seg { background: var(--field); border: 1px solid var(--border); }
.prof-section .seg-btn.active { background: var(--navy); color: #fff; }
.qr-panel .field-label { color: rgba(234,240,255,.72); }
.qr-panel .color-field { color: #dbe4ff; }
.qr-panel .switch { color: #dbe4ff; }
.qr-panel .link-input, .qr-panel select { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #fff; }
.qr-panel .link-input::placeholder { color: rgba(234,240,255,.4); }
.qr-panel .seg { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); }
.qr-panel .seg-btn { color: rgba(234,240,255,.7); }
.qr-panel .seg-btn.active { background: #fff; color: var(--navy); }
.qr-panel .choice { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); }
.qr-panel .choice .cap { color: rgba(234,240,255,.6); }
.qr-panel .choice.active { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.qr-panel .choice svg { color: #fff; }
.qr-panel input[type=file] { color: rgba(234,240,255,.7); }

/* Download buttons (JPG blue / SVG orange) */
.qr-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 2px; }
.btn-dl { border: 0; border-radius: 999px; padding: 13px 14px; font-weight: 700; font-size: .92rem; color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: .16s; }
.btn-dl-jpg { background: var(--dl-jpg); box-shadow: 0 8px 18px -8px var(--dl-jpg); }
.btn-dl-jpg:hover:not(:disabled) { background: var(--dl-jpg-2); }
.btn-dl-svg { background: var(--dl-svg); box-shadow: 0 8px 18px -8px var(--dl-svg); }
.btn-dl-svg:hover:not(:disabled) { background: var(--dl-svg-2); }
.btn-dl:disabled { opacity: .4; cursor: default; box-shadow: none; }
.btn-dl:active:not(:disabled) { transform: translateY(1px); }

/* Generate button */
.btn-generate {
  margin-top: 10px; border: 0; border-radius: 999px; padding: 15px 30px;
  font-size: 1rem; font-weight: 700; color: #fff; background: var(--navy-grad);
  box-shadow: var(--glow); cursor: pointer; display: inline-flex; align-items: center; gap: 10px;
  transition: transform .16s, box-shadow .16s;
}
.btn-generate:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--glow-strong); }
.btn-generate:active:not(:disabled) { transform: translateY(0); }
.btn-generate:disabled { opacity: .5; cursor: default; box-shadow: none; transform: none; }
.btn-generate.done { background: var(--green); }
.btn-generate .gi { font-size: 1.1rem; }

/* ---- Responsive ---- */
@media (max-width: 1040px) {
  .gen3 { grid-template-columns: 76px minmax(0, 1fr); }
  .qr-panel { grid-column: 1 / -1; position: static; }
  .qr-panel-scroll { max-height: none; }
  .qr-stage { min-height: 220px; }
}
@media (max-width: 620px) {
  .gen3 { grid-template-columns: 1fr; gap: 14px; }
  .rail { position: static; border-radius: 20px; }
  .rail-types { flex-direction: row; flex-wrap: wrap; }
  .rail-item .ri-tip { display: none; }
  .gen-center { padding: 28px 22px; min-height: 0; }
  .type-form-head { font-size: 1.9rem; }
  .center-empty h1 { font-size: 2rem; }
}
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; }
  .preview-card { position: static; }
  .col-right { order: -1; }
}
@media (max-width: 680px) {
  body { padding: 0 12px 44px; }
  .topbar { gap: 12px; padding: 10px 14px; border-radius: 22px; }
  .brand { font-size: 1.1rem; }
  /* Burger button on the right */
  .burger {
    order: 4; margin-left: auto;
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; padding: 0;
    border: 1px solid var(--border-2); border-radius: 11px;
    background: var(--card); color: var(--text); font-size: 1.25rem; cursor: pointer;
  }
  .burger:hover { background: var(--field); }
  /* Nav + auth collapse into a dropdown panel */
  .menu {
    display: none; position: absolute; top: calc(100% + 8px); right: 0;
    flex-direction: column; align-items: stretch; gap: 10px;
    min-width: 220px; padding: 12px;
    background: var(--topbar-bg);
    -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
    border: 1px solid var(--border);
    border-radius: 16px; box-shadow: var(--shadow-pop), inset 0 1px 0 var(--card-hi); z-index: 60;
  }
  .topbar.open .menu { display: flex; }
  .nav-links { flex-direction: column; align-items: stretch; gap: 4px; width: 100%; }
  .navlink { width: 100%; text-align: left; padding: 11px 14px; font-size: .95rem; }
  .navlink[data-view="gen"] { display: none; }   /* the logo is the Generator link */
  .authbar { margin: 0; flex-direction: column; align-items: stretch; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }
  .authbar .email { max-width: none; }
  .card { padding: 20px 16px; }
  .sec-head { font-size: 1.06rem; }
  .list-head { flex-wrap: wrap; gap: 10px; }
}
@media (max-width: 560px) {
  .authbar { font-size: .84rem; }
  .authbar .email { word-break: break-all; }
  .dtabs { gap: 6px; }
  .dtab { padding: 8px 12px; font-size: .82rem; }
  .color-row { gap: 14px; }
  .dl-row button { flex: 1 1 auto; }
  #preview canvas, #preview svg { width: 210px; }
  .code-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .code-card .cc-actions button { padding: 5px 8px; font-size: .74rem; }
}
@media (max-width: 380px) {
  #preview canvas, #preview svg { width: 180px; }
  .type-cards { grid-template-columns: 1fr; }
}

/* =========================================================
   LANDING PAGE
   ========================================================= */
.lp-nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.lp-link { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; padding: 8px 12px; border-radius: 10px; }
.lp-link:hover { color: var(--text); background: var(--field); }
.lp-cta { text-decoration: none; margin-left: 6px; }
.lp { max-width: 1440px; margin: 0 auto; padding: 0 4px; }
.lp h2 { font-family: 'Poppins','Inter',sans-serif; font-size: clamp(1.5rem,3.4vw,2.2rem); font-weight: 800; letter-spacing: -.03em; color: var(--heading); text-align: center; margin: 0 0 8px; }
.lp-sub { text-align: center; color: var(--muted); max-width: 620px; margin: 0 auto 26px; font-size: 1.02rem; }
.lp-section { padding: 44px 0; }

/* Hero */
.lp-hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 30px; align-items: center; padding: 46px 0 30px; }
.lp-hero h1 { font-family: 'Poppins','Inter',sans-serif; font-size: clamp(2.1rem,5vw,3.4rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.05; margin: 14px 0 14px; color: var(--heading); }
.lp-hero .grad-word { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lp-lead { font-size: 1.12rem; color: var(--text-2); max-width: 560px; margin: 0 0 22px; }
.lp-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-primary.lp-big, .btn-ghost.lp-big { text-decoration: none; padding: 15px 26px; font-size: 1.02rem; display: inline-flex; align-items: center; }
.lp-note { margin: 14px 0 0; font-size: .88rem; }
.lp-hero-art { display: flex; justify-content: center; }
.lp-qr-card { background: var(--panel-grad); border-radius: 26px; padding: 26px; box-shadow: var(--shadow-pop); text-align: center; }
.lp-qr-card #hero-qr { background: #fff; border-radius: 18px; padding: 14px; line-height: 0; display: inline-block; }
.lp-qr-card #hero-qr svg { width: 220px; height: 220px; display: block; }
.lp-qr-cap { color: rgba(234,240,255,.8); font-size: .82rem; font-weight: 600; margin-top: 14px; }

/* Feature / use-case cards */
.lp-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.lp-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 22px; box-shadow: var(--shadow-sm); transition: transform .14s, box-shadow .14s; }
.lp-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.lp-card h3 { font-size: 1.08rem; margin: 12px 0 6px; color: var(--heading); }
.lp-card p { margin: 0; color: var(--muted); font-size: .94rem; }
.lp-ic { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; border-radius: 13px; background: color-mix(in srgb, var(--tc,#6366f1) 16%, transparent); border: 1px solid color-mix(in srgb, var(--tc,#6366f1) 30%, transparent); }

/* Types list */
.lp-types-grid { list-style: none; margin: 0 0 26px; padding: 0; display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.lp-types-grid li { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.lp-types-grid b { font-size: .96rem; color: var(--heading); }
.lp-types-grid span { color: var(--muted); font-size: .82rem; }
.lp-center { text-align: center; }
/* Distinct blocks: alternate white panels against the blue background */
.lp-types, .lp-cases { background: var(--card); border: 1px solid var(--border); border-radius: 32px; box-shadow: var(--shadow-sm); padding: 48px 36px; margin: 16px 0; }
.lp-types .lp-types-grid li, .lp-cases .lp-card { background: var(--card-2); }
@media (max-width: 680px) { .lp-types, .lp-cases { padding: 34px 18px; border-radius: 24px; } }

/* Steps */
.lp-steps { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.lp-step { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 24px; text-align: center; }
.lp-step .lp-num { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; background: var(--grad); color: #fff; font-weight: 800; font-size: 1.1rem; box-shadow: var(--glow); }
.lp-step h3 { margin: 12px 0 6px; color: var(--heading); }
.lp-step p { margin: 0; color: var(--muted); font-size: .94rem; }

/* FAQ */
.lp-faq { max-width: 760px; margin: 0 auto; display: grid; gap: 10px; }
.lp-faq details { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 4px 18px; }
.lp-faq summary { list-style: none; cursor: pointer; padding: 14px 0; font-weight: 700; color: var(--heading); display: flex; justify-content: space-between; align-items: center; }
.lp-faq summary::-webkit-details-marker { display: none; }
.lp-faq summary::after { content: '+'; font-size: 1.3rem; color: var(--accent); }
.lp-faq details[open] summary::after { content: '−'; }
.lp-faq p { margin: 0 0 16px; color: var(--muted); }

/* Final CTA + footer */
.lp-final { text-align: center; margin: 20px 0 10px; padding: 48px 24px; background: var(--panel-grad); border-radius: 26px; color: #fff; box-shadow: var(--shadow-pop); }
.lp-final h2 { color: #fff; }
.lp-final p { color: rgba(234,240,255,.85); margin: 0 0 22px; }
.lp-final .btn-primary { background: #fff; color: var(--navy); }
.lp-footer { max-width: 1440px; margin: 40px auto 0; padding: 26px 4px; text-align: center; border-top: 1px solid var(--border); }
.lp-footer .brand { justify-content: center; display: inline-flex; margin-bottom: 8px; }
.lp-footer p { margin: 4px 0; font-size: .88rem; }
.lp-footer a { color: var(--accent); }

@media (max-width: 900px) {
  .lp-hero { grid-template-columns: 1fr; text-align: center; }
  .lp-hero-text { order: 1; } .lp-hero-art { order: 0; }
  .lp-lead, .lp-actions { margin-left: auto; margin-right: auto; justify-content: center; }
  .lp-grid, .lp-steps { grid-template-columns: 1fr; }
  .lp-types-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 680px) {
  .lp-nav .lp-link { display: none; }
  .lp-types-grid { grid-template-columns: 1fr; }
}

/* Landing: Sign in link (stays visible on mobile) */
.lp-signin { color: var(--heading); font-weight: 700; text-decoration: none; padding: 8px 14px; border-radius: 10px; font-size: .9rem; }
.lp-signin:hover { background: var(--field); }
@media (max-width: 680px) { .lp-signin { display: inline-block; } }
