/*
 * QR Generator: the tool's own components, styled in the site's design language (3 Nov 2026, on the UltraCompress Pro
 * template, after AgeCalc). Base: /libs/site-pages.css (tokens, Inter and Space Grotesk, buttons, theme toggle, focus
 * rings) and /libs/shared-nav.css (the site's header and footer). This file holds only what the tool needs: the
 * toolbar with the status pill, the cards, the fields, the kinds of code, the ready styles, the design tabs and
 * pickers, the logo drop zone, the preview with its notes and download buttons, the batch, the windows, the toasts,
 * the print layout and the information sections. Light is the default; dark applies when <html> has no data-theme.
 */

/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --radius-lg: 16px;
    --line: rgba(0, 0, 0, 0.1);
    --line-strong: rgba(0, 0, 0, 0.24);
    --ok: #166534;
    --ok-soft: rgba(22, 101, 52, 0.09);
    --bad: #b91c1c;
    --bad-soft: rgba(185, 28, 28, 0.08);
    --warn: #92400e;
    --warn-soft: rgba(217, 119, 6, 0.1);
    --stage: #f3f4f8;
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.26);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.1);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.1);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.1);
    --stage: #1c1c2b;
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container { max-width: calc(var(--app-max) + 2 * var(--content-gutter)); margin-top: 16px; }
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- The site header is the first thing on the page and stays at the top ----- */
body { padding-top: 0; }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: 90px; }
@media (max-width: 639.98px) { .theme-toggle { top: 75px; } } /* the header is 81 px tall from 640 px, 65 px below */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ----- Hero ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Small helpers ----- */
main [hidden], .dialog [hidden] { display: none !important; } /* the script hides fields that carry their own display */
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.small { font-size: 0.9rem; }
.block { display: block; }
.hint { color: var(--text-3); font-size: 0.8rem; font-weight: 400; line-height: 1.45; }
.err { color: var(--bad); font-size: 0.85rem; font-weight: 600; }
.err:empty { display: none; }
.note { font-size: 0.875rem; color: var(--text-2); line-height: 1.55; max-width: 80ch; }
.note.warn { color: var(--warn); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link:hover { color: var(--link-hover); }
code { font-size: 0.85em; padding: 1px 6px; border-radius: 6px; background: var(--code-bg); color: var(--code-text); }
kbd { font-family: inherit; font-size: 0.72rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 9999px; font-family: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; padding: 12px 24px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn .ico { width: 17px; height: 17px; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid rgba(185, 28, 28, 0.35); padding: 11px 23px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; transform: translateY(-2px); }
.btn-sm { font-size: 0.85rem; padding: 9px 16px; }
.btn-secondary.btn-sm, .btn-danger.btn-sm { padding: 8px 15px; }
.btn-stack { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; padding: 0; font-family: inherit; transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.icon-btn:hover { border-color: var(--brand); color: var(--link); background: var(--surface); }
.icon-btn.del:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn:focus-visible, .link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Toolbar ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin: 0 0 1.25rem; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 10px; border-radius: 9999px; border: 1px solid var(--tint-brand-border); background: var(--tint-brand); min-width: 220px; max-width: 100%; }
.status-icon { font-size: 1.3rem; line-height: 1; }
.status-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.status-main { font-weight: 700; font-size: 0.85rem; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-sub { font-size: 0.72rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 9999px; background: var(--surface-2); max-width: 100%; }
.view-tab { padding: 8px 16px; border: 0; border-radius: 9999px; background: transparent; font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.view-tab:hover { color: var(--link); }
.view-tab.active { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.view-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.view[hidden] { display: none; }
.shell-hint { margin-top: 14px; }

/* ----- Cards ----- */
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.card-grid:empty { display: none; }
.card--wide { grid-column: span 2; }
.card--full { grid-column: 1 / -1; }
.card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); overflow: hidden; display: flex; flex-direction: column; min-width: 0; margin-bottom: 0; }
.view > .card { margin-bottom: 20px; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { margin: 0; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-note { font-size: 0.8125rem; color: var(--text-3); }
.card-body { padding: 16px 20px 20px; flex: 1; min-width: 0; }
.card-body > * + * { margin-top: 16px; }
.form-hint { font-size: 0.8rem; color: var(--text-3); margin: 10px 0 0; line-height: 1.5; }

/* ----- Fields ----- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.label { font-weight: 600; font-size: 0.85rem; color: var(--text-strong); }
.input, .select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.input::placeholder { color: var(--placeholder); }
.input[aria-invalid="true"] { border-color: var(--bad); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.5; }
input[type="time"].input { color-scheme: light; width: 9em; }
:root:not([data-theme="light"]) input[type="time"].input { color-scheme: dark; }
.select { width: auto; max-width: 100%; appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; cursor: pointer; }
.select option { color: #0a0a14; background: #fff; }
.num-input { width: 7.5em; }
.num-input.wide { width: 10em; }
.check-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 0.925rem; color: var(--text); padding: 4px 0; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex-shrink: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.seg button:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.seg button[aria-checked="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--chip); font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.chip .ico { width: 15px; height: 15px; color: var(--link); }
.chip:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Windows ----- */
.dialog { margin: auto; border: 1px solid var(--surface-border); border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 16px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); }
.dialog--narrow { width: min(420px, calc(100vw - 16px)); }
.dialog--wide { width: min(680px, calc(100vw - 16px)); }
.dialog::backdrop { background: rgba(10, 10, 20, 0.6); backdrop-filter: blur(6px); }
.dialog[open] { animation: pop 0.2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.dialog-head { padding: 18px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-title { margin: 0; font-size: 1.15rem; }
.dialog-close { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: border-color 0.2s ease, color 0.2s ease; }
.dialog-close:hover { border-color: var(--brand); color: var(--link); }
.dialog-body { padding: 20px; overflow-y: auto; max-height: calc(100vh - 210px); display: flex; flex-direction: column; gap: 14px; }
.dialog-actions { padding: 14px 20px; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.confirm-message { margin: 0; color: var(--text); }
.help-body h3 { margin: 6px 0 0; font-size: 1rem; }
.help-body p { margin: 0; color: var(--text-2); }

/* ----- Toasts ----- */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; background: #0a0a14; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid var(--brand); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); min-width: 260px; max-width: 420px; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; animation: slideIn 0.3s ease; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast button { background: none; border: 0; padding: 0; color: #c4b5fd; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.toast.leaving { opacity: 0; transform: translateX(40px); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.toast.good { border-left-color: #4ade80; }
.toast.bad { border-left-color: #f87171; }

/* ----- Information sections ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.step-card { position: relative; padding-top: 24px; }
.step-num { position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand); color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ===== QR Generator components ===== */

/* ----- Layout: the code on the right on wide screens, first on phones ----- */
.app-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.editor-column, .preview-column { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
@media (min-width: 1024px) {
    .app-layout { grid-template-columns: minmax(0, 1fr) 400px; }
    .preview-column { order: 2; position: sticky; top: 97px; max-height: calc(100vh - 113px); overflow-y: auto; scrollbar-width: thin; border-radius: var(--radius-lg); }
    .preview-column > .card { flex-shrink: 0; } /* the column scrolls on short screens; the card is never squeezed */
}
@media (min-width: 1280px) { .app-layout { grid-template-columns: minmax(0, 1fr) 440px; } }

/* ----- Fields written by the script ----- */
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px 16px; }
@media (min-width: 560px) { .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid2 > .full { grid-column: 1 / -1; }
.field > span:first-child:not(.color-input) { font-weight: 600; font-size: 0.85rem; color: var(--text-strong); }
.field input:not([type="checkbox"]):not([type="color"]):not([type="range"]), .field textarea, .field select {
    width: 100%; min-width: 0; min-height: 44px; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px;
    font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus, textarea.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.field input::placeholder, .field textarea::placeholder { color: var(--placeholder); }
.field input.invalid, .field textarea.invalid { border-color: var(--bad); }
.field select, select.select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; cursor: pointer; }
.field select option { color: #0a0a14; background: #fff; }
input[type="datetime-local"] { color-scheme: light; }
:root:not([data-theme="light"]) input[type="datetime-local"] { color-scheme: dark; }
.req { color: var(--bad); }
.count { color: var(--text-3); font-weight: 500; font-size: 0.8rem; }
.fhint { font-size: 0.8rem; color: var(--text-3); line-height: 1.45; }
.fnote { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--tint-brand); border: 1px solid var(--tint-brand-border); font-size: 0.85rem; color: var(--text-2); line-height: 1.5; }
.field .err { font-size: 0.82rem; }
.check { display: flex; gap: 12px; align-items: center; cursor: pointer; font-size: 0.925rem; color: var(--text); padding: 4px 0; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); flex-shrink: 0; }
.with-btn { display: flex; gap: 8px; align-items: center; }
.with-btn input { flex: 1; min-width: 0; }
.with-btn .icon-btn { width: 44px; height: 44px; border-color: var(--field-border); background: var(--field); border-radius: 12px; }
.sub { padding: 14px 16px; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 14px; }
.sub.grid2 { display: grid; }
.range-field input[type="range"] { width: 100%; accent-color: var(--brand); min-height: 28px; }
.range-field b { color: var(--link); font-weight: 700; }
.color-input { display: flex; align-items: center; gap: 8px; border: 1px solid var(--field-border); border-radius: 12px; padding: 3px 6px 3px 4px; background: var(--field); min-height: 46px; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.color-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.color-input input[type="color"] { width: 38px; height: 38px; padding: 0; border: 0; background: none; border-radius: 9px; cursor: pointer; flex: none; }
.color-input input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-input input[type="color"]::-webkit-color-swatch { border: 1px solid var(--line-strong); border-radius: 9px; }
.color-input input[type="color"]::-moz-color-swatch { border: 1px solid var(--line-strong); border-radius: 9px; }
.field .color-input .hex, .color-input .hex { flex: 1; min-width: 0; min-height: 0; padding: 6px 4px; border: 0; background: transparent; box-shadow: none; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; text-transform: uppercase; color: var(--text-strong); }
.color-input .hex:focus { outline: none; box-shadow: none; }

/* ----- The kinds of code ----- */
.types { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.type { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 72px; padding: 10px 4px; border: 1px solid var(--chip-border); border-radius: 14px; background: var(--surface); font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-2); cursor: pointer; text-align: center; transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease; }
.type .ico { width: 22px; height: 22px; stroke-width: 1.8; }
.type:hover { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.type[aria-pressed="true"] { background: var(--gradient-brand); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3); }
.type:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.raw { border-top: 1px solid var(--line); padding-top: 10px; }
.raw summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--link); padding: 4px 0; }
.raw summary:hover { color: var(--link-hover); }
.raw pre { margin: 10px 0 0; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; white-space: pre-wrap; word-break: break-all; font-size: 0.82rem; line-height: 1.5; max-height: 200px; overflow: auto; color: var(--text); }

/* ----- Design: ready styles, tabs, pickers ----- */
.presets { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; margin: 0 -2px; scrollbar-width: thin; }
.preset { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 8px 6px; border: 1px solid var(--chip-border); border-radius: 14px; background: var(--surface); font-family: inherit; font-size: 0.78rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.preset svg { width: 56px; height: 56px; border-radius: 8px; display: block; }
.preset:hover { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.preset[aria-pressed="true"] { border-color: var(--brand); background: var(--tint-brand); color: var(--link); box-shadow: 0 0 0 1px var(--brand); }
.preset:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.design-tabs { display: flex; width: max-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tab[aria-selected="true"] { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.tabpane { display: flex; flex-direction: column; gap: 16px; }
.tabpane[hidden] { display: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 76px; padding: 8px 4px 6px; border: 1px solid var(--chip-border); border-radius: 14px; background: var(--surface); font-family: inherit; font-size: 0.75rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, background 0.2s ease; }
.swatch svg { width: 40px; height: 40px; display: block; }
.swatch:hover { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.swatch[aria-pressed="true"] { border-color: var(--brand); background: var(--tint-brand); color: var(--link); box-shadow: 0 0 0 1px var(--brand); }
.swatch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.seg button { min-height: 40px; }
.seg button[aria-pressed="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.seg button small { font-weight: 500; opacity: 0.85; }

/* ----- Logo: a drop zone like the site's other tools ----- */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 1.75rem 1rem; border: 3px dashed rgba(139, 92, 246, 0.45); border-radius: 20px; background: var(--surface); cursor: pointer; transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.over { border-color: var(--brand); background: var(--tint-brand); transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); outline: none; }
.dropzone.over { border-style: solid; }
.drop-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.drop-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--gradient-brand); color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; box-shadow: 0 10px 30px rgba(139, 92, 246, 0.35); transition: transform 0.3s ease; }
.drop-icon .ico { width: 28px; height: 28px; }
.dropzone:hover .drop-icon, .dropzone:focus-visible .drop-icon { transform: scale(1.1); }
.drop-title { margin: 0; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.drop-sub { margin: 0; color: var(--text-2); font-size: 0.9rem; max-width: 40ch; }
.logo-has { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--surface-border); border-radius: 16px; background: var(--surface-2); }
.logo-has img { width: 64px; height: 64px; object-fit: contain; border-radius: 12px; background: #fff; border: 1px solid var(--line); flex: none; }
.logo-has-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.logo-has-text p { margin: 0; font-size: 0.875rem; font-weight: 600; color: var(--text-strong); overflow-wrap: anywhere; }

/* ----- The code, its notes and the downloads ----- */
.stage { position: relative; width: min(100%, max(240px, calc(100vh - 610px))); aspect-ratio: 1; margin: 0 auto; border-radius: 14px; background: var(--stage); display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; overflow: hidden; }
@media (max-width: 1023px) { .stage { width: min(100%, 380px); } }
.stage-art { grid-area: 1 / 1; width: 100%; height: 100%; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 14px; }
.stage-art svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.12)); } /* the viewBox keeps the shape: a framed code fits inside the square */
.stage.empty .stage-art { opacity: 0.14; filter: grayscale(1); }
.placeholder { grid-area: 1 / 1; z-index: 1; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.placeholder p { margin: 0; padding: 10px 16px; border-radius: 12px; background: var(--surface); box-shadow: var(--surface-shadow); font-weight: 600; color: var(--text-strong); max-width: 28ch; }
.placeholder.error p { color: var(--bad); }
.stage:not(.empty) .placeholder { display: none; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; }
.meta:empty { display: none; }
.meta .chip { cursor: default; font-weight: 500; padding: 5px 11px; }
.meta .chip b { color: var(--text-strong); font-weight: 700; }
.meta .chip:hover { transform: none; border-color: var(--chip-border); color: var(--text-2); }
.advice { display: flex; flex-direction: column; gap: 6px; }
.advice:empty { display: none; }
.advice-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; font-size: 0.85rem; line-height: 1.45; }
.advice-note .ico { width: 18px; height: 18px; margin-top: 1px; }
.advice-note.good { background: var(--ok-soft); color: var(--ok); }
.advice-note.warn { background: var(--warn-soft); color: var(--warn); }
.advice-note.bad { background: var(--bad-soft); color: var(--bad); }
.advice-note button { margin-left: auto; background: none; border: 0; padding: 0 2px; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.export { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.export-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.size-field { display: flex; align-items: center; gap: 10px; }
.size-field .select { min-height: 40px; padding-top: 7px; padding-bottom: 7px; font-size: 0.9rem; }
.pxinfo { font-size: 0.8rem; color: var(--text-3); }
.export-formats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.export-formats .btn { padding-left: 6px; padding-right: 6px; }
.export-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.export-actions .btn { padding-left: 6px; padding-right: 6px; }
.export-actions .btn[hidden] { display: none; }
.export-actions:has(.btn[hidden]) { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ----- Batch ----- */
.batch-lead { margin-top: 0; }
#batchText { width: 100%; min-height: 120px; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; color: var(--text); line-height: 1.5; resize: vertical; outline: none; }
.batch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.batch-row .select { min-height: 44px; }

/* ----- Recent codes ----- */
.history-lead { margin: 0; }
.history { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.hist { position: relative; min-width: 0; }
.hist-open { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 10px; border: 1px solid var(--surface-border); border-radius: 14px; background: var(--surface); font-family: inherit; text-align: left; cursor: pointer; transition: border-color 0.2s ease, transform 0.2s ease; }
.hist-open:hover { border-color: var(--brand); transform: translateY(-2px); }
.hist-open:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.hist-open svg { width: 100%; height: auto; border-radius: 8px; display: block; background: #fff; }
.hist .t { font-size: 0.72rem; font-weight: 700; color: var(--link); text-transform: uppercase; letter-spacing: 0.04em; }
.hist .t .count { text-transform: none; letter-spacing: 0; }
.hist .c { font-size: 0.78rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist .del { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--surface-border); background: var(--surface); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; transition: opacity 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.hist:hover .del, .hist:focus-within .del { opacity: 1; }
.hist .del:hover { color: var(--danger); border-color: var(--danger); }
.hist .del .ico { width: 15px; height: 15px; }
@media (hover: none) { .hist .del { opacity: 1; } }
.history-empty { color: var(--text-2); grid-column: 1 / -1; text-align: center; padding: 30px 0; margin: 0; }

/* ----- Print: only the code (printImage puts it in .print-area and sets body.qr-printing) ----- */
.print-area { display: none; }
@media print {
    body.qr-printing > *:not(.print-area) { display: none !important; }
    body.qr-printing .print-area { display: flex !important; align-items: center; justify-content: center; min-height: 90vh; }
    .print-area img { width: 80mm; height: auto; max-width: 90vw; }
    body:not(.qr-printing) > header, body:not(.qr-printing) .theme-toggle, body:not(.qr-printing) .site-footer, body:not(.qr-printing) .toasts, body:not(.qr-printing) .dialog, body:not(.qr-printing) #zdu-cookie-banner { display: none !important; }
}

/* ----- Tablets ----- */
@media (max-width: 1023px) {
    .info-section .info-grid { grid-template-columns: repeat(2, 1fr); }
    .info-three { grid-template-columns: 1fr; }
}

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .app-toolbar { gap: 10px; }
    .toolbar-left, .toolbar-right { width: 100%; }
    .toolbar-right .btn { flex: 1 1 0; }
    .status-pill { flex: 1; min-width: 0; }
    .app-layout, .editor-column, .preview-column { gap: 14px; }
    .card-header { padding-left: 16px; padding-right: 16px; }
    .card-body { padding: 14px 16px 16px; }
    .types { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
    .type { min-height: 64px; font-size: 0.78rem; }
    .swatches { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 6px; }
    #eyeFramePicker { --n: 5; }
    .swatch { width: auto; min-width: 0; padding-left: 2px; padding-right: 2px; font-size: 0.72rem; }
    .swatch svg { width: 36px; height: 36px; }
    .design-tabs { width: 100%; }
    .design-tabs .view-tab { flex: 1 1 auto; padding: 8px 6px; font-size: 0.78rem; }
    .export-formats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .export-formats .btn-primary { grid-column: 1 / -1; }
    .export-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .export-actions:has(.btn[hidden]) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .history { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .toasts { bottom: 16px; right: 16px; left: 16px; align-items: stretch; }
    .toast { min-width: 0; max-width: none; }
    .dialog-body, .dialog-head, .dialog-actions { padding-left: 16px; padding-right: 16px; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .info-card, .dialog, .toast, .chip, .seg button, .view-tab, .type, .preset, .swatch, .dropzone, .drop-icon, .hist-open { transition: none; animation: none; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026) */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not(.hex):not([type="color"]) { min-height: 44px; }
    main .icon-btn { min-width: 44px; }
    main .check { min-height: 44px; }
    main input[type="range"] { min-height: 44px; }
    main .color-input input[type="color"] { width: 44px; height: 44px; }
    main .color-input .hex { min-height: 44px; }
    main .seg button { min-width: 44px; min-height: 44px; }
    main .range-field input[type="range"] { min-height: 44px; }
    main .design-tabs .view-tab { min-width: 44px; }
    main .size-field .select { min-height: 44px; }
    main p, main li, main dd, main td, main figcaption,
    main .form-hint, main .fhint, main .fnote, main .advice-note, main .pxinfo, main .drop-sub, main .muted, main .small, main .raw pre { font-size: 1rem; }
    .dialog .hist .del { opacity: 1; width: 44px; height: 44px; }
    .dialog button, .dialog .btn { min-height: 44px; }
}
