:root {
    --text:#1d1d1f;
    --muted:#76767d;
    --line:#e8e8ec;
    --accent:#000000;
    color-scheme:light;
}
* {
    box-sizing:border-box;
}
body {
    margin:0;
    background:#f5f5f7;
    color:var(--text);
    font:14px -apple-system,BlinkMacSystemFont,"Helvetica Neue",sans-serif;
}
button,input,textarea,select {
    font:inherit;
}
button,a,input,select,textarea {
    -webkit-tap-highlight-color:transparent;
}
button {
    cursor:pointer;
}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible {
    outline:2px solid #8b8b8b;
    outline-offset:2px;
}
[hidden] {
    display:none!important;
}
/* Hide persistent focus rings after mouse/touch interaction, including dialog autofocus. */
html.pointer-input :focus,
html.pointer-input :focus-visible,
html.pointer-input .transparency-switch input:focus-visible + .switch-track {
    outline: none;
}
.page {
    max-width:1160px;
    margin:auto;
    padding:0 32px;
}
.nav {
    height:80px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    border-bottom:1px solid var(--line);
}
.brand {
    display:flex;
    align-items:center;
    gap:10px;
    font-size:21px;
    font-weight:650;
    letter-spacing:-1px;
}
.brand-logo {
    display:block;
    width:56px;
    height:21px;
    object-fit:contain;
}
.nav-actions {
    display:flex;
    gap:18px;
    align-items:center;
}
.nav-note {
    font-size:12px;
    color:var(--muted);
}
.pill {
    border:0;
    background:transparent;
    color:var(--muted);
    padding:8px 0;
    font-size:12px;
}
.pill:hover {
    color:var(--accent);
}
.hero {
    padding:30px 0 24px;
}
.hero-copy {
    display:flex;
    align-items:baseline;
    gap:18px;
}
h1 {
    margin:0;
    font-size:32px;
    font-weight:600;
    letter-spacing:-1.3px;
}
.hero p {
    margin:0;
    color:var(--muted);
    font-size:14px;
}
.app-shell {
    display:grid;
    grid-template-columns:420px minmax(0,1fr);
    min-height:530px;
    background:#fff;
    border:1px solid var(--line);
    border-radius:22px;
    overflow:hidden;
    box-shadow: none;
}
.controls {
    padding:26px 28px;
    border-right:1px solid var(--line);
    min-width:0;
}
.card-title {
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:16px;
}
.card-title h2 {
    font-size:16px;
    font-weight:600;
    letter-spacing:-.3px;
    margin:0;
}
.card-title h3 {
    font-size:13px;
    font-weight:600;
    margin:0;
}
.tabs {
    display:flex;
    padding:4px;
    background:#f1f1f4;
    border-radius:10px;
    margin-bottom:24px;
}
.tabs button {
    flex:1;
    border:0;
    color:var(--muted);
    background:none;
    font-size:12px;
    font-weight:550;
    padding:9px;
    border-radius:7px;
}
.tabs button[aria-selected=true] {
    background:white;
    color:var(--text);
    box-shadow: none;
}
.section {
    padding:0;
}
.section+.section {
    margin-top:20px;
}
.field {
    min-width:0;
    margin-bottom:14px;
}
label {
    display:block;
    margin-bottom:7px;
    font-size:12px;
    font-weight:550;
}
input,textarea,select {
    color:var(--text);
}
.input,.select,.textarea {
    width:100%;
    border:1px solid #e2e2e7;
    background:#fafafa;
    border-radius:9px;
    padding:0 12px;
    min-width:0;
}
.input,.select {
    height:39px;
}
.textarea {
    padding:10px 12px;
    min-height:76px;
    resize:vertical;
}
.input:focus,.select:focus,.textarea:focus {
    background:#fff;
    border-color:var(--accent);
}
.grid-2 {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:12px;
}
.help {
    font-size:11px;
    color:var(--muted);
    line-height:1.55;
    margin:6px 0 0;
}
.content-note {
    margin-top:26px;
    padding-top:18px;
    border-top:1px solid var(--line);
    font-size:12px;
    line-height:1.6;
    color:var(--muted);
}
.content-note strong {
    font-weight:500;
    color:#424248;
    display:block;
    margin-bottom:3px;
}
.presets {
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:8px;
    margin-bottom:20px;
}
.preset {
    border:1px solid var(--line);
    border-radius:10px;
    background:#fff;
    padding:12px 3px 9px;
    font-size:10px;
    color:var(--muted);
}
.preset:hover {
    background:#F3F8F8;
    border-color:#8DB8B9;
}
.preset[aria-pressed=true] {
    border-color:var(--accent);
    background:#F3F8F8;
    color:var(--accent);
}
.preset-symbol {
    display:block;
    font-size:25px;
    line-height:26px;
    margin-bottom:7px;
    color:var(--preset-color,#1d1d1f);
}
.color-row {
    display:flex;
    gap:8px;
    align-items:center;
}
.color {
    width:34px;
    height:34px;
    border:0;
    padding:0;
    border-radius:7px;
    overflow:hidden;
    background:#eee;
    flex-shrink:0;
}
.color::-webkit-color-swatch-wrapper {
    padding:0;
}
.color::-webkit-color-swatch {
    border:0;
    border-radius:7px;
}
.color-row .input {
    font-size:11px;
    padding:0 8px;
}
.background-label-row {
    display:flex;
    justify-content:space-between;
    gap:4px;
}
.transparent-inline-label {
    font-size:10px;
    color:var(--muted);
}
.background-input-wrap {
    display:flex;
    align-items:center;
    gap:4px;
    min-width:0;
}
.transparent-toggle input {
    accent-color:var(--accent);
}
.transparent-swatch {
    background:repeating-conic-gradient(#ddd 0% 25%,white 0% 50%) 0/12px 12px;
}
.transparent-swatch::-webkit-color-swatch {
    opacity:0;
}
.file-input {
    position:relative;
    display:flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    min-height:116px;
    border:1px dashed #c9c9d1;
    border-radius:12px;
    padding:20px;
    color:var(--muted);
    font-size:11px;
    line-height:1.6;
    background:#fafafa;
    cursor:pointer;
}
.file-input strong {
    display:block;
    font-size:13px;
    font-weight:500;
    color:var(--accent);
}
.file-input input {
    position:absolute;
    inset:0;
    opacity:0;
    width:100%;
    cursor:pointer;
}
.file-input.drag-over {
    border-color:var(--accent);
    background:#f0f2f6;
}
.logo-controls-row {
    margin-top:24px;
}
.logo-adjust-row {
    display:flex;
    gap:16px;
    align-items:center;
}
.logo-adjust-row input[type=range] {
    flex:1;
    min-width:0;
    accent-color:var(--accent);
}
.logo-adjust-row .input {
    width:62px;
    text-align:center;
    font-size:12px;
}
.logo-remove-row {
    text-align:right;
}
.preview-panel {
    padding:28px 40px;
    background:#fafafa;
    display:flex;
    align-items:center;
    justify-content:center;
    min-width:0;
}
.qr-stage {
    width:100%;
    max-width:360px;
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:18px;
}
.qr-card {
    width:clamp(200px,30vh,280px);
    aspect-ratio:1;
    padding:24px;
    border-radius:16px;
    background:transparent;
    box-shadow:none;
}
#qr-code {
    width:100%;
    height:100%;
    display:grid;
    place-items:center;
}
#qr-code svg,#qr-code canvas {
    width:100%!important;
    height:100%!important;
    display:block;
}
.preview-meta {
    display:flex;
    align-items:center;
    justify-content:space-between;
    width:100%;
    font-size:11px;
    color:var(--muted);
}
.status-dot {
    display:inline-block;
    width:5px;
    height:5px;
    background:#38a66b;
    border-radius:50%;
    margin-right:6px;
}
.mode-toggle {
    display:flex;
    gap:2px;
    background:#eeeef0;
    border-radius:7px;
    padding:3px;
}
.mode-toggle button {
    font-size:10px;
    padding:5px 10px;
    border:0;
    border-radius:5px;
    color:var(--muted);
    background:none;
}
.mode-toggle button.active {
    background:white;
    color:var(--text);
    box-shadow: none;
}
.preview-settings {
    width:100%;
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:12px;
    padding-top:16px;
    border-top:1px solid var(--line);
}
.preview-settings .field {
    margin:0;
}
.preview-actions {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    width:100%;
}
.export-format { min-width: 0; }
#exportStatus { grid-column: 1 / -1; margin: 0; }
.button {
    border:0;
    border-radius:9px;
    min-height:42px;
    font-size:12px;
    font-weight:500;
}
.primary {
    background:var(--accent);
    color:#fff;
}
.primary:hover {
    background:#222222;
}
.secondary {
    background:#eaeaf0;
    color:var(--text);
}
.secondary:hover {
    background:#e1e1e8;
}
.button:disabled {
    opacity:.45;
    cursor:wait;
}
.scan-note {
    font-size:10px;
    color:var(--muted);
    margin:-6px 0 0;
}
.footer {
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:20px 0;
    color:#8b8b92;
    font-size:10px;
}
.footer a {
    color:inherit;
    text-decoration:none;
}
.footer a:hover {
    color:var(--text);
}
.footer-center {
    max-width:450px;
    text-align:right;
    font-size:9px;
    line-height:1.5;
}
.footer-right {
    display:none;
}
dialog {
    border:1px solid var(--line);
    border-radius:20px;
    max-width:620px;
    width:calc(100% - 32px);
    padding:28px;
    color:var(--text);
    box-shadow: none;
}
dialog::backdrop {
    background:#0005;
    backdrop-filter:blur(4px);
}
.about-overlay { display: none; }
/* Keep the mobile dim/blur layer in the page instead of Safari's modal backdrop. */
@media (max-width: 799px), (hover: none) and (pointer: coarse) {
    #aboutDialog::backdrop {
        background: transparent;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    .about-overlay:has(+ #aboutDialog[open]) {
        display: block;
        position: fixed;
        inset: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
        z-index: 200;
        background: #0005;
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
        pointer-events: none;
    }
}
.about-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.about-section h2 {
    margin: 0;
    font-size:23px;
    letter-spacing:-.6px;
}
.about-section p {
    color:var(--muted);
    font-size:13px;
    line-height:1.6;
}
.about-grid {
    display:grid;
    grid-template-columns:minmax(0, 1fr);
    gap:20px;
    margin:24px 0;
}
.about-card h3 {
    font-size:13px;
    margin:0 0 8px;
}
.about-card p { margin:0; }
.about-kicker {
    display:none;
}
.dialog-close {
    flex-shrink:0;
    border:0;
    background:#f1f1f4;
    border-radius:8px;
    padding:8px 12px;
}
@media(min-width:800px) and (max-height:780px) {
    .nav {
        height:62px;
    }
    .hero {
        padding:20px 0;
    }
    .app-shell {
        min-height:490px;
    }
    .controls {
        padding:22px 28px;
    }
    .preview-panel {
        padding:22px 40px;
    }
    .qr-stage {
        gap:14px;
    }
    .tabs {
        margin-bottom:20px;
    }
    .footer {
        padding:14px 0;
    }
}
@media(max-width:799px) {
    .page {
        padding:0 18px;
        max-width:620px;
    }
    .nav {
        height:64px;
    }
    .nav-note {
        display:none;
    }
    .hero {
        padding:24px 0 20px;
    }
    .hero-copy {
        display:block;
    }
    h1 {
        font-size:28px;
    }
    .hero p {
        margin-top:8px;
        font-size:13px;
    }
    .app-shell {
        grid-template-columns:1fr;
    }
    .controls {
        border-right:0;
        border-bottom:1px solid var(--line);
        padding:22px;
    }
    .preview-panel {
        padding:24px;
    }
    .qr-card {
        width:210px;
    }
    .content-note {
        margin-top:18px;
    }
    .footer {
        align-items:start;
        gap:20px;
    }
    .footer-center {
        max-width:190px;
    }
    .about-grid {
        grid-template-columns:1fr;
    }
    .nav-actions {
        gap:12px;
    }
}

/* Refined control system: quiet surfaces, consistent geometry, visual choices. */
:root { --accent: #000000; --line: #ebedf1; --muted: #747a87; }
/* Background pattern retained but disabled. To enable, change background-image: none to url("./qr-gray-pattern.svg"). */
html { background-color: #f6f7f9; background-image: none; /* url("./qr-gray-pattern.svg") */ background-repeat: repeat; background-size: 384px 384px; min-height: 100lvh; }
body { background: transparent; -webkit-font-smoothing: antialiased; }
.app-shell { border-radius: 26px; box-shadow: none; }
.controls { padding: 24px; }
.tabs { background: #f0f2f5; border-radius: 12px; padding: 4px; margin-bottom: 22px; }
.tabs button { border-radius: 9px; font-size: 12px; transition: background .18s, color .18s; }
.input, .select, .textarea { background: #f5f6f8; border: 1px solid transparent; border-radius: 11px; font-size: 13px; transition: background .16s, border-color .16s; }
.input:hover, .textarea:hover { background: #eff1f5; }
.input:focus, .textarea:focus { border-color: #d5dce7; background: #fff; }
label { color: #626976; font-weight: 500; font-size: 11px; }
.grid-2 { gap: 12px; }
.grid-2 > .field { margin-bottom: 12px; }
.select-trigger { width: 100%; min-width: 0; height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 13px; border: 1px solid transparent; border-radius: 11px; background: #f3f5f8; color: #252b36; text-align: left; font-size: 13px; transition: background .16s, border-color .16s; }
.select-trigger:hover { background: #ebeff5; }
.select-trigger[aria-expanded=true] { background: #fff; border-color: #d5dce7; box-shadow: none; }
.select-trigger > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.select-trigger svg { display: block; align-self: center; width: 14px; height: 14px; color: #8a93a3; flex-shrink: 0; transition: transform .18s; }
.select-trigger[aria-expanded=true] svg { transform: rotate(180deg); }
.select-menu { position: fixed; z-index: 100; padding: 5px; overflow-y: auto; overscroll-behavior: contain; background: #fffffffa; border: 1px solid #e8ebf1; border-radius: 14px; box-shadow: none; backdrop-filter: blur(20px); }
.select-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 35px; padding: 8px 10px; border-radius: 8px; font-size: 12px; color: #4b5362; cursor: pointer; }
.select-option.is-highlighted { background: #f0f2f6; color: #000000; }
.select-option[aria-selected=true] { color: #000000; font-weight: 550; }
.select-option .option-check { opacity: 0; width: 14px; height: 14px; }
.select-option[aria-selected=true] .option-check { opacity: 1; }
.presets { gap: 8px; margin-bottom: 18px; }
.preset { border: 1px solid transparent; border-radius: 12px; background: #f6f7fa; padding: 10px 3px 8px; font-size: 10px; transition: background .16s, border-color .16s; }
.preset[aria-pressed=true] { background: #f0f2f6; border-color: #d5dce7; color: #000000; }
.preset-symbol { display: flex; align-items: center; justify-content: center; width: 100%; height: 29px; line-height: 0; margin: 0 0 6px; }
.preset-symbol svg { display: block; flex: none; width: 29px; height: 29px; margin: 0; }
#pane-style > .section > .card-title { display: none; }
.shape-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.shape-field > label { margin: 0; flex-shrink: 0; }
.shape-options { display: flex; gap: 5px; padding: 3px; background: #f4f5f8; border-radius: 11px; }
.shape-choice { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 39px; width: 39px; height: 32px; padding: 0; line-height: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #8c94a2; transition: color .16s, background .16s; }
.shape-choice:hover { background: #e8edf6; color: #303c51; }
.shape-choice[aria-pressed=true] { background: #fff; color: #000000; border-color: #e1e7f0; box-shadow: none; }
.shape-choice svg { display: block; flex: none; width: 19px; height: 19px; margin: 0; }
.correction-field { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 12px 0 6px; }
.correction-field label { margin: 0; }
.correction-field .select-trigger { width: 182px; height: 34px; font-size: 11px; }
#pane-style .section + .section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.color-row { background: #f4f5f8; padding: 5px; border-radius: 11px; gap: 5px; }
.color { width: 27px; height: 27px; border-radius: 7px; box-shadow: none; }
.color-row .input { background: transparent; height: 27px; padding: 0 5px; font-size: 11px; font-variant-numeric: tabular-nums; }
.color-row .input:focus { background: #fff; }
.background-input-wrap { flex: 1; }
.background-label-row { margin-bottom: 7px; }
.background-label-row label { margin: 0; }
.style-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.transparency-switch { display: flex; align-items: center; gap: 7px; cursor: pointer; margin: 0; font-size: 10px; }
.transparency-switch input { position: absolute; opacity: 0; width: 30px; height: 18px; margin: 0; }
.switch-track { width: 28px; height: 17px; border-radius: 20px; background: #d5dae3; padding: 2px; transition: background .18s; }
.switch-track::after { content: ''; display: block; width: 13px; height: 13px; border-radius: 50%; background: white; box-shadow: none; transition: transform .18s; }
.transparency-switch input:checked + .switch-track { background: var(--accent); }
.transparency-switch input:checked + .switch-track::after { transform: translateX(11px); }
.transparency-switch input:focus-visible + .switch-track { outline: 2px solid #8b8b8b; outline-offset: 2px; }
.style-footer .pill { font-size: 10px; }
.logo-controls-row { background: #f6f7fa; border-radius: 15px; padding: 16px; margin-top: 20px; }
.logo-controls-row .field { margin-bottom: 20px; }
.logo-adjust-row { gap: 16px; }
.logo-adjust-row .input { width: 60px; height: 32px; background: #fff; border: 1px solid #e7eaf0; border-radius: 8px; font-variant-numeric: tabular-nums; font-size: 11px; }
.logo-adjust-row input[type=range] { appearance: none; -webkit-appearance: none; height: 28px; margin: 0; background: transparent; cursor: pointer; }
.logo-adjust-row input[type=range]::-webkit-slider-runnable-track { height: 5px; border-radius: 8px; background: linear-gradient(to right, var(--accent) 0 var(--range-fill,50%), #dce1eb var(--range-fill,50%) 100%); }
.logo-adjust-row input[type=range]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 19px; height: 19px; margin-top: -7px; border: 3px solid white; border-radius: 50%; background: var(--accent); box-shadow: none; transition: box-shadow .15s; }
.logo-adjust-row input[type=range]:hover::-webkit-slider-thumb { box-shadow: none; }
.logo-adjust-row input[type=range]::-moz-range-track { height: 5px; border-radius: 8px; background: #dce1eb; }
.logo-adjust-row input[type=range]::-moz-range-progress { height: 5px; background: var(--accent); border-radius: 8px; }
.logo-adjust-row input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border: 3px solid white; border-radius: 50%; background: var(--accent); box-shadow: none; }
.file-input { background: #f8faff; border: 1px dashed #cbd8ed; border-radius: 15px; }
.logo-remove-row .pill { font-size: 11px; padding: 0; }
.preview-panel { background: var(--qr-preview-bg, #fff); }
.preview-settings label { color: var(--preview-label-color, #626976); }
.button { border-radius: 11px; }
.preview-settings .select-trigger { background: #eceff5; font-size: 12px; }
@media(max-width:799px) { .controls { padding: 22px; } }
@media(prefers-reduced-motion:reduce) { *, *::after { transition: none !important; scroll-behavior: auto !important; } }

/* The viewport is the workspace. Only an overflowing panel scrolls. */
html, body { width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
.page { width: 100%; height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding-top: 24px; padding-bottom: 0; }
.page-footer { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 48px; padding-block: 8px; }
.page-footer .trademark-notice { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.page-footer .pill { flex-shrink: 0; }
.nav { flex: 0 0 72px; height: 72px; border-bottom: 0; }
.app-shell { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); }
.controls { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.controls > .card-title, .controls > .tabs { flex-shrink: 0; }
.controls > [role="tabpanel"] { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #d4d9e2 transparent; padding: 3px 4px 4px; margin: -3px -4px -4px; }
.preview-panel { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.qr-stage { margin: auto; flex-shrink: 0; }
.about-credits { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); line-height: 1.6; }
.about-credits a { color: inherit; }
.about-credits .footer-center { max-width: none; text-align: left; margin-top: 8px; }
dialog { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
#aboutDialog { padding: 12px; overflow: hidden; }
.about-scroll {
    max-height: calc(100dvh - 58px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 16px;
}
@media (max-width: 799px) {
    .page { padding-top: 12px; padding-bottom: 0; }
    .page-footer { min-height: 44px; }
    .nav { flex-basis: 56px; height: 56px; }
    .app-shell { grid-template-rows: minmax(0, 1fr) minmax(260px, .8fr); }
    .controls { padding: 16px 20px; }
    .controls > .card-title { margin-bottom: 10px; }
    .tabs { margin-bottom: 14px; }
    .preview-panel { padding: 16px 20px; }
    .qr-stage { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px 16px; max-width: 420px; }
    .qr-card { width: 112px; padding: 12px; border-radius: 12px; grid-column: 1; grid-row: 1 / 3; }
    .preview-meta { grid-column: 2; flex-wrap: wrap; gap: 8px; font-size: 10px; }
    .preview-settings { grid-column: 2; padding-top: 0; border: 0; gap: 6px; }
    .preview-settings label { font-size: 10px; }
    .preview-settings .select-trigger { padding: 0 8px; gap: 3px; font-size: 10px; height: 34px; }
    .preview-actions { grid-column: 1 / -1; }
    .scan-note { grid-column: 1 / -1; text-align: center; margin: 0; }
}
@media (max-width: 799px) and (max-height: 500px) {
    .app-shell { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
    .controls { border-bottom: 0; border-right: 1px solid var(--line); padding: 12px; }
    .preview-panel { padding: 12px; }
    .qr-stage { grid-template-columns: 90px minmax(0, 1fr); gap: 8px; }
    .qr-card { width: 90px; padding: 10px; }
}

.history-actions { display: flex; align-items: center; gap: 8px; }
.history-actions .pill { min-height: 30px; padding: 0 11px; border: 1px solid #f0f2f6; border-radius: 8px; background: #fff; color: #59636c; font-size: 11px; font-weight: 500; transition: background .16s, border-color .16s, color .16s; }
.history-actions #undoButton { background: #f0f2f6; border: 0; color: #343d45; }
.history-actions .pill:not(:disabled):hover, .history-actions #undoButton:not(:disabled):hover { background: #e4e9ec; border-color: #e4e9ec; color: #263238; }
.history-actions .pill:not(:disabled):active, .history-actions #undoButton:not(:disabled):active { background: #d9e1e5; border-color: #d9e1e5; }
.history-actions #undoButton:disabled { background: #f0f2f6; color: #a6adb4; cursor: default; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.qr-stage { max-width: 440px; gap: 14px; }
.preview-panel { padding: 22px 32px; }
.preview-viewport { width: min(100%, max(180px, calc(100dvh - 420px))); max-width: 440px; aspect-ratio: 1; display: grid; place-items: center; }
.qr-card { width: 100%; transform: scale(var(--preview-scale, .75)); transform-origin: center; }
.preview-scale-control { display: flex; align-items: center; gap: 12px; width: 100%; padding: 4px 0; }
.preview-scale-control label { margin: 0; flex-shrink: 0; font-size: 11px; }
.preview-scale-control output { width: 36px; text-align: right; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.preview-scale-control input { min-width: 0; flex: 1; appearance: none; height: 24px; background: transparent; cursor: pointer; }
.preview-scale-control input::-webkit-slider-runnable-track { height: 4px; border-radius: 8px; background: linear-gradient(to right, var(--accent) 0 var(--range-fill,100%), #dce1eb var(--range-fill,100%) 100%); }
.preview-scale-control input::-webkit-slider-thumb { appearance: none; width: 17px; height: 17px; margin-top: -6.5px; border: 3px solid white; border-radius: 50%; background: var(--accent); box-shadow: none; }
.preview-scale-control input::-moz-range-track { height: 4px; border-radius: 8px; background: #dce1eb; }
.preview-scale-control input::-moz-range-progress { height: 4px; border-radius: 8px; background: var(--accent); }
.preview-scale-control input::-moz-range-thumb { width: 11px; height: 11px; border: 3px solid white; border-radius: 50%; background: var(--accent); }
@media(max-width:799px) {
    .preview-panel { padding: 14px 20px; }
    .qr-stage { gap: 8px 14px; }
    .preview-viewport { width: 112px; grid-column: 1; grid-row: 1 / 3; }
    .qr-card { width: 100%; grid-column: auto; grid-row: auto; }
    .preview-scale-control { grid-column: 1 / -1; padding: 0; }
    .preview-scale-control label, .preview-scale-control output { font-size: 10px; }
}
@media(max-width:799px) and (max-height:500px) {
    .preview-viewport { width: 90px; }
}

/* Fit artwork to the remaining panel space; toolbar rows never add scroll. */
.preview-panel { overflow: hidden; }
.qr-stage { height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto auto auto; justify-items: center; gap: 12px; }
.preview-viewport { width: 100%; height: 100%; min-height: 0; max-width: none; aspect-ratio: auto; overflow: hidden; }
.qr-card { width: var(--fitted-preview-size, 180px); max-width: 100%; padding: min(24px, 6%); }
.preview-meta { gap: 12px; flex-wrap: nowrap; }
.preview-scale-control { min-width: 0; flex: 1; width: auto; gap: 10px; padding: 8px 10px; background: #f0f2f6; border-radius: 12px; }
.preview-scale-control output { flex: 0 0 39px; padding: 5px 3px; border: 1px solid #e7eaf0; border-radius: 7px; background: #fff; text-align: center; }
.preview-scale-control input { width: 0; }
.preview-meta .mode-toggle { flex-shrink: 0; }
.preview-settings { padding-top: 0; border-top: 0; }
@media(max-width:799px) {
    .qr-stage { grid-template-columns: 112px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto auto; gap: 8px 14px; }
    .preview-viewport { width: 100%; height: 100%; grid-column: 1; grid-row: 1 / 3; }
    .preview-meta { flex-direction: column; align-items: stretch; gap: 5px; }
    .preview-meta .mode-toggle { align-self: flex-end; }
    .preview-scale-control { flex: initial; width: 100%; gap: 7px; padding: 5px 7px; }
    .preview-scale-control label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .preview-scale-control output { flex-basis: 34px; }
}
@media(max-width:799px) and (max-height:500px) {
    .qr-stage { grid-template-columns: 90px minmax(0, 1fr); gap: 6px; }
}

/* Compact volume-style sliders with read-only percentage readouts. */
.preview-scale-control, .preview-meta .mode-toggle { height: 32px; border-radius: 9px; background: #eef0f4; }
.preview-scale-control { padding: 0 10px; }
.preview-meta .mode-toggle { padding: 3px; align-items: center; }
.preview-meta .mode-toggle button { height: 26px; padding: 0 10px; border-radius: 6px; }
.preview-scale-control output, .slider-value { flex: 0 0 36px; width: 36px; padding: 0; border: 0; border-radius: 0; background: transparent; text-align: right; color: #737c8a; font-size: 11px; font-variant-numeric: tabular-nums; line-height: 24px; user-select: none; }
.logo-adjust-row { gap: 14px; }
.logo-adjust-row input[type=range], .preview-scale-control input[type=range] { height: 28px; margin: 0; }
.logo-adjust-row input[type=range]::-webkit-slider-runnable-track,
.preview-scale-control input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(to right, #69778c 0 var(--range-fill,50%), #d5dbe4 var(--range-fill,50%) 100%); }
.logo-adjust-row input[type=range]::-webkit-slider-thumb,
.preview-scale-control input[type=range]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 7px; height: 15px; margin-top: -6px; border: 1px solid #a6afbc; border-radius: 2px; background: linear-gradient(90deg, #fff, #e4e8ee); box-shadow: none; transition: border-color .15s; }
.logo-adjust-row input[type=range]:hover::-webkit-slider-thumb,
.preview-scale-control input[type=range]:hover::-webkit-slider-thumb { border-color: #637086; box-shadow: none; }
.logo-adjust-row input[type=range]::-moz-range-track,
.preview-scale-control input[type=range]::-moz-range-track { height: 3px; border-radius: 3px; background: #d5dbe4; }
.logo-adjust-row input[type=range]::-moz-range-progress,
.preview-scale-control input[type=range]::-moz-range-progress { height: 3px; border-radius: 3px; background: #69778c; }
.logo-adjust-row input[type=range]::-moz-range-thumb,
.preview-scale-control input[type=range]::-moz-range-thumb { box-sizing: border-box; width: 7px; height: 15px; border: 1px solid #a6afbc; border-radius: 2px; background: linear-gradient(90deg, #fff, #e4e8ee); box-shadow: none; }
@media(max-width:799px) {
    .preview-scale-control { padding: 0 7px; }
    .preview-scale-control output { flex-basis: 34px; }
}

/* Preview-only background color shares a compact toolbar with the scale control. */
.preview-meta { gap: 10px; }
.preview-scale-control { gap: 7px; padding: 0 8px; }
.preview-scale-control label { font-size: 10px; }
.preview-scale-control output { flex-basis: 31px; font-size: 10px; }
.preview-color-control { display: flex; align-items: center; gap: 8px; flex-shrink: 0; height: 32px; }
.preview-color-control label { margin: 0; white-space: nowrap; font-size: 10px; }
.preview-color-control .color-row { height: 32px; padding: 4px; gap: 3px; border-radius: 9px; background: #eef0f4; }
.preview-color-control .color { width: 24px; height: 24px; border-radius: 6px; }
.preview-color-control .input { width: 65px; font-size: 10px; padding: 0 4px; height: 24px; }
.logo-adjust-row input[type=range]::-webkit-slider-runnable-track,
.preview-scale-control input[type=range]::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--accent) 0 var(--range-fill,50%), #d5dbe4 var(--range-fill,50%) 100%); }
.logo-adjust-row input[type=range]::-webkit-slider-thumb,
.preview-scale-control input[type=range]::-webkit-slider-thumb { width: 7px; height: 15px; border: 0; border-radius: 4px; background: var(--accent); box-shadow: none; }
.logo-adjust-row input[type=range]:hover::-webkit-slider-thumb,
.preview-scale-control input[type=range]:hover::-webkit-slider-thumb { border: 0; box-shadow: none; background: #222222; }
.logo-adjust-row input[type=range]::-moz-range-progress,
.preview-scale-control input[type=range]::-moz-range-progress { background: var(--accent); }
.logo-adjust-row input[type=range]::-moz-range-thumb,
.preview-scale-control input[type=range]::-moz-range-thumb { width: 7px; height: 15px; border: 0; border-radius: 4px; background: var(--accent); box-shadow: none; }
@media(min-width:800px) and (max-width:1050px) {
    .preview-scale-control label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .preview-color-control .input { display: none; }
}
@media(max-width:799px) {
    .preview-color-control { justify-content: space-between; width: 100%; gap: 5px; }
    .preview-color-control .input { width: 57px; }
}

/* One preview toolbar, with a subtle divider between size and color. */
.preview-meta { padding: 6px 10px; gap: 10px; background: #eef0f4; border: 1px solid #e9ecf1; border-radius: 12px; }
.preview-scale-control { background: transparent; border-radius: 0; padding: 0; height: 30px; }
.preview-color-control { border-left: 1px solid #dce1e9; padding-left: 10px; height: 30px; }
.preview-color-control .color-row { background: transparent; padding: 0; height: 28px; }
.preview-color-control .color { box-shadow: none; }
.preview-color-control .input { background: transparent; }
/* Explicit square dimensions prevent the SVG's intrinsic size from stretching
   its parent and consuming the bottom inset. */
.qr-card { width: var(--fitted-preview-size, 180px); height: var(--fitted-preview-size, 180px); aspect-ratio: auto; min-width: 0; min-height: 0; padding: min(24px, calc(var(--fitted-preview-size, 180px) * .055)); display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
#qr-code { position: relative; min-width: 0; min-height: 0; }
#qr-code > svg, #qr-code > canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
@media(max-width:799px) {
    .preview-meta { padding: 5px 8px; gap: 4px; }
    .preview-scale-control { padding: 0; height: 28px; }
    .preview-color-control { border-left: 0; border-top: 1px solid #dce1e9; padding: 4px 0 0; height: 32px; }
}


/* Distinct groups within the shared preview toolbar. */
.preview-meta { gap: 0; padding: 6px; }
.preview-scale-control { padding: 0 12px 0 8px; }
.preview-color-control { margin-left: 8px; padding: 0 8px 0 16px; border-left: 1px solid #cbd2dd; gap: 10px; }
.preview-color-control .color-row { padding: 3px 6px; height: 30px; border-radius: 7px; background: #fff; box-shadow: none; }
@media(max-width:799px) {
    .preview-meta { gap: 6px; padding: 6px 8px; }
    .preview-scale-control { padding: 0; }
    .preview-color-control { margin-left: 0; padding: 6px 0 0; border-left: 0; border-top: 1px solid #cbd2dd; height: 36px; gap: 5px; }
    .preview-color-control .color-row { padding-inline: 3px; }
}

/* Balanced spacing and one surface hierarchy for the preview toolbar. */
.preview-meta { min-height: 42px; padding: 6px 12px; gap: 14px; border: 1px solid #e5e9ef; border-radius: 12px; background: #f0f2f6; }
.preview-scale-control { height: 28px; padding: 0; gap: 10px; }
.preview-scale-control label, .preview-color-control label { color: #626d7d; font-size: 10px; font-weight: 500; white-space: nowrap; }
.preview-scale-control output { flex-basis: 30px; color: #788293; font-size: 10px; }
.preview-color-control { position: relative; height: 28px; margin: 0; padding: 0 0 0 14px; gap: 10px; border: 0; }
.preview-color-control::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 1px; background: #cdd5e0; }
.preview-color-control .color-row { height: 28px; gap: 5px; padding: 0; border-radius: 0; background: transparent; box-shadow: none; }
.preview-color-control .color { width: 24px; height: 24px; padding: 0; border-radius: 7px; box-shadow: none; }
.preview-color-control .color::-webkit-color-swatch { border: 0; border-radius: 7px; }
.preview-color-control .color::-moz-color-swatch { border: 0; border-radius: 7px; }
.preview-color-control .input { width: 58px; height: 26px; padding: 0 3px; font-size: 10px; border-radius: 5px; background: transparent; color: #4a5566; }
.preview-color-control .input:hover { background: #e8ecf2; }
.preview-color-control .input:focus { background: #fff; }
@media(min-width:800px) and (max-width:1050px) {
    .preview-meta { gap: 10px; padding-inline: 10px; }
    .preview-color-control { padding-left: 10px; gap: 7px; }
}
@media(max-width:799px) {
    .preview-meta { gap: 6px; padding: 6px 8px; }
    .preview-scale-control { gap: 7px; }
    .preview-color-control { height: 34px; padding: 6px 0 0; gap: 5px; }
    .preview-color-control::before { top: 0; bottom: auto; left: 0; right: 0; width: auto; height: 1px; }
    .preview-color-control .input { width: 54px; }
}

/* Circular preview-color swatch; preserve the square QR canvas. */
.preview-color-control .color { border-radius: 50%; }
.preview-color-control .color::-webkit-color-swatch { border-radius: 50%; }
.preview-color-control .color::-moz-color-swatch { border-radius: 50%; }
.logo-adjust-row input[type=range]::-webkit-slider-thumb,
.preview-scale-control input[type=range]::-webkit-slider-thumb { width: 12px; height: 12px; margin-top: -4.5px; border: 0; border-radius: 50%; background: var(--accent); box-shadow: none; }
.logo-adjust-row input[type=range]::-moz-range-thumb,
.preview-scale-control input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--accent); box-shadow: none; }

/* Consistent outlined fields and two separate preview controls. */
:root { --control-outline: #d5dce7; }
.input, .select, .textarea, .select-trigger { border: 1px solid var(--control-outline); }
.color-row, .logo-controls-row, .shape-options, .tabs { border: 1px solid var(--control-outline); }
.preset { border-color: var(--control-outline); }
/* Grouped color inputs share their outer outline. */
.color-row .input { border-color: transparent; }
.color-row .input:focus { border-color: #d5dce7; }
.preview-meta { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); width: 100%; gap: 10px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.preview-scale-control, .preview-color-control { width: 100%; min-width: 0; height: 40px; margin: 0; padding: 0 10px; border: 1px solid var(--control-outline); border-radius: 11px; background: #f0f2f6; gap: 8px; }
.preview-color-control { justify-content: space-between; }
.preview-color-control::before { display: none; }
.preview-color-control .color-row { border: 0; }
.preview-scale-control output { flex-basis: 29px; }
@media(min-width:800px) and (max-width:1050px) {
    .preview-meta { gap: 8px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .preview-scale-control, .preview-color-control { padding-inline: 8px; gap: 6px; }
}
@media(max-width:799px) {
    /* Use the full preview width so both boxes remain adjacent on phones. */
    .preview-meta { grid-column: 1 / -1; grid-row: 2; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 8px; }
    .preview-viewport { grid-row: 1; }
    .preview-settings { grid-row: 1; }
    .qr-stage { grid-template-rows: minmax(0, 1fr) auto auto auto; }
    .preview-scale-control, .preview-color-control { height: 36px; padding: 0 8px; gap: 6px; }
    .preview-color-control .input { width: 50px; }
}

/* Shape choices sit directly on the panel, without a surrounding gray box. */
.shape-options { background: transparent; border: 0; padding: 0; gap: 7px; border-radius: 0; }
/* Preview controls lead the canvas, followed by export controls. */
.qr-stage { grid-template-rows: auto minmax(0, 1fr) auto auto auto; }
.preview-meta { grid-column: 1; grid-row: 1; }
.preview-viewport { grid-column: 1; grid-row: 2; }
.preview-settings { grid-column: 1; grid-row: 3; }
.preview-actions { grid-column: 1; grid-row: 4; }
.scan-note { grid-column: 1; grid-row: 5; }
@media(max-width:799px) {
    .qr-stage { grid-template-rows: auto minmax(0, 1fr) auto auto; }
    .preview-meta { grid-column: 1 / -1; grid-row: 1; }
    .preview-viewport { grid-column: 1; grid-row: 2; }
    .preview-settings { grid-column: 2; grid-row: 2; }
    .preview-actions { grid-column: 1 / -1; grid-row: 3; }
    .scan-note { grid-column: 1 / -1; grid-row: 4; }
}

/* Borderless control surfaces throughout the app. */
.input, .select, .textarea, .select-trigger,
.color-row, .logo-controls-row, .shape-options, .tabs,
.preset, .shape-choice, .preview-scale-control, .preview-color-control,
.logo-adjust-row .input, .preview-color-control .input,
.color-row .input { border-color: transparent; }
.input:hover, .textarea:hover, .select-trigger:hover,
.preset:hover, .preset[aria-pressed=true], .shape-choice[aria-pressed=true] { border-color: transparent; }
.color, .preview-color-control .color { border: 1px solid #cbd2dd; box-shadow: none; }
.file-input { border-color: transparent; }
.file-input.drag-over { border-color: var(--accent); }
/* Preserve visible feedback for active keyboard and editing states. */
.input:focus, .textarea:focus, .select-trigger[aria-expanded=true],
.color-row .input:focus { border-color: #d5dce7; }

/* Selected options are unmistakable without restoring gray outlines. */
.shape-choice[aria-pressed=true], .preset[aria-pressed=true] { background: #e5e7eb; color: #000000; border-color: transparent; box-shadow: none; }
.shape-choice[aria-pressed=false] { background: transparent; color: #8993a3; box-shadow: none; }
.shape-choice:hover { background: #f0f2f6; }
.shape-choice[aria-pressed=true]:hover, .preset[aria-pressed=true]:hover { background: #dadee4; }
.preset-symbol svg { width: 24px; height: 24px; }

/* Quiet neutral selection, distinct from blue focus/error-like outlines. */
.shape-choice[aria-pressed=true], .preset[aria-pressed=true] { background: #e5e7eb; color: #1d1d1f; border-color: transparent; box-shadow: none; }
.shape-choice[aria-pressed=true]:hover, .preset[aria-pressed=true]:hover { background: #dadee4; }
.shape-choice[aria-pressed=false] { color: #9299a5; }
.style-footer { justify-content: flex-end; }

/* Shared label width keeps both logo slider tracks exactly aligned. */
.logo-controls-row .field { display: grid; grid-template-columns: 82px minmax(0, 1fr); align-items: center; column-gap: 12px; margin-bottom: 16px; }
.logo-controls-row .field > label { margin: 0; white-space: nowrap; }
.logo-adjust-row { min-width: 0; gap: 10px; }
.logo-adjust-row .slider-value { flex: 0 0 34px; width: 34px; }
@media(max-width:380px) {
    .logo-controls-row .field { grid-template-columns: 76px minmax(0, 1fr); column-gap: 8px; }
    .logo-adjust-row { gap: 6px; }
}

/* Custom shape uploads stay in the same compact selection row. */
.shape-options { gap: 4px; }
.shape-choice { width: 30px; flex-basis: 30px; height: 32px; }
.shape-choice svg { width: 18px; height: 18px; }
.shape-add { background: #f2f3f6; color: #656f7e; font-size: 21px; font-weight: 300; line-height: 1; }
.custom-shape img { width: 20px; height: 20px; object-fit: contain; border-radius: 3px; }
.blend-settings { margin-top: 8px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.blend-settings summary { cursor: pointer; color: #626976; font-size: 11px; padding: 12px 0; }
.blend-settings .grid-2 { margin-top: 2px; }
.blend-balance { display: grid; grid-template-columns: 60px minmax(0, 1fr); align-items: center; gap: 12px; }
.blend-balance > label { margin: 0; }
.blend-balance input[type=range] { flex: 1; min-width: 0; }
.blend-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.blend-actions .help { font-size: 10px; }
#shapeUploadStatus { margin-bottom: 8px; }
#logoStatus:empty { display: none; }

/* The upload occupies one slot, replaced in place by its image. */
.shape-upload-slot { position: relative; width: 30px; height: 32px; flex: 0 0 30px; }
.shape-remove { position: absolute; top: -5px; right: -5px; z-index: 1; display: grid; place-items: center; width: 17px; height: 17px; padding: 0; border: 0; border-radius: 50%; background: #333a45; color: #fff; font-size: 14px; line-height: 1; box-shadow: none; }
.shape-remove svg { display: block; width: 16px; height: 16px; margin: 0; pointer-events: none; }
.shape-remove:hover { background: #15191f; }

/* Keep the remove badge inside its allocated slot so panel edges cannot clip it. */
.shape-upload-slot { width: 38px; height: 38px; flex-basis: 38px; padding-top: 3px; }
.shape-remove { top: 0; right: 0; width: 16px; height: 16px; }
.shape-add { display: inline-flex; align-items: center; justify-content: center; padding: 0; line-height: 0; background: transparent; border: 1px solid #cbd2dd; box-shadow: none; }
.shape-add:hover { background: transparent; border-color: #8995a6; }
.shape-add svg { display: block; flex: none; width: 18px; height: 18px; margin: 0; }
.shape-options { align-items: center; }

/* Quiet unselected shapes; only the active choice receives a surface. */
.preset[aria-pressed=false] { background: transparent; color: #9097a3; border-color: transparent; box-shadow: none; }
.preset[aria-pressed=false] .preset-symbol { color: #9299a4; }
.preset[aria-pressed=false]:hover { background: transparent; color: #454d5a; }
.preset[aria-pressed=false]:hover .preset-symbol { color: #454d5a; }
.shape-choice[aria-pressed=false], .shape-choice[aria-pressed=false]:hover { background: transparent; box-shadow: none; }
.shape-choice[aria-pressed=false]:hover { color: #454d5a; }
/* Navigation reads as tabs rather than a second row of filled choices. */
.tabs { background: transparent; border: 0; border-bottom: 1px solid #eceef2; border-radius: 0; padding: 0; gap: 16px; }
.tabs button { position: relative; padding: 10px 0 13px; border-radius: 0; background: transparent; color: #9298a3; font-weight: 500; }
.tabs button[aria-selected=true] { background: transparent; color: #24272c; box-shadow: none; }
.tabs button[aria-selected=true]::after { content: ''; position: absolute; bottom: -1px; left: 24%; right: 24%; height: 2px; border-radius: 2px; background: #343a44; }
.tabs button:hover { color: #343a44; }
/* An unused secondary color is shown as empty without losing its saved value. */
#secondaryColor.transparent-swatch { background: repeating-conic-gradient(#d7dcdf 0% 25%, #fff 0% 50%) 0 / 10px 10px; cursor: pointer; opacity: 1; }
#secondaryColor.transparent-swatch::-webkit-color-swatch,
#secondaryColor.transparent-swatch::-moz-color-swatch { opacity: 0; }
.secondary-inactive { margin: 0; padding: 8px; color: #8a939b; font-size: 11px; cursor: pointer; }
/* Shared outlined action style for Reset and image uploads. */
:root { --action-outline: #E6E9EE; --action-hover: #e4e9ec; --action-pressed: #d9e1e5; }
.button-outline, .history-actions .button-outline { border: 1px solid var(--action-outline); border-radius: 8px; background: #fff; color: #59636c; box-shadow: none; transition: background .16s, border-color .16s, color .16s; }
.button-outline:not(:disabled):hover, .history-actions .button-outline:not(:disabled):hover { background: var(--action-hover); border-color: var(--action-hover); color: #263238; }
.button-outline:not(:disabled):active, .history-actions .button-outline:not(:disabled):active { background: var(--action-pressed); border-color: var(--action-pressed); color: #263238; }
.no-fill-button { display: grid; place-items: center; flex: 0 0 26px; width: 26px; height: 26px; padding: 3px; border: 0; border-radius: 6px; color: #8a939b; background: transparent; }
.no-fill-button:hover { background: #e4e9ec; color: #59636c; }
.no-fill-button svg { display: block; width: 20px; height: 20px; }
.background-input-wrap .input { min-width: 0; }
    /* Keep the black download action visible against dark preview backgrounds. */
#downloadButton { border: 1px solid var(--action-outline); border-radius: 8px; background: #9299a4; color: #fff; }
#downloadButton:not(:disabled):hover { background: #818995; }
#downloadButton:not(:disabled):active { background: #707986; }
.contact-address { min-width: 0; margin: 4px 0 0; padding: 0; border: 0; }
.contact-address legend { margin-bottom: 12px; padding: 0; font-size: 12px; font-weight: 500; }

/* On narrow screens, keep the desktop preview order and let the page scroll. */
@media(max-width:799px) {
    html, body { height: auto; min-height: 100%; overflow: auto; overscroll-behavior: auto; }
    .page { height: auto; min-height: 100dvh; padding-top: 12px; }
    .app-shell { flex: none; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; }
    .controls { overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
    .controls > [role="tabpanel"] { flex: none; overflow: visible; }
    .preview-panel { padding: 20px; overflow: visible; }
    .qr-stage { height: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto auto auto; gap: 16px; }
    .preview-meta { grid-column: 1; grid-row: 1; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
    .preview-viewport { grid-column: 1; grid-row: 2; width: 100%; height: auto; aspect-ratio: 1; }
    .preview-settings { grid-column: 1; grid-row: 3; gap: 12px; }
    .preview-actions { grid-column: 1; grid-row: 4; gap: 12px; }
    .scan-note { grid-column: 1; grid-row: 5; }
    .preview-scale-control { grid-column: auto; }
    .preview-scale-control label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
    .preview-scale-control, .preview-color-control { height: 40px; }
    .preview-settings label { font-size: 11px; }
    .preview-settings .select-trigger { height: 42px; padding: 0 12px; font-size: 12px; }
}
@media(max-width:479px) {
    .preview-meta { grid-template-columns: minmax(0, 1fr); }
    .preview-scale-control, .preview-color-control { grid-column: 1; }
}

/* Independent ink swatches precede each row's shape choices. */
.shape-options { align-items: center; }
.shape-options .shape-color { flex: 0 0 30px; width: 30px; height: 32px; margin-right: 5px; border-radius: 8px; }
.shape-color::-webkit-color-swatch { border-radius: 8px; }
.shape-color::-moz-color-swatch { border-radius: 8px; }
@media(max-width:400px) {
    .shape-field { gap: 5px; }
    .shape-options { gap: 2px; padding: 2px; }
    .shape-choice { width: 26px; flex-basis: 26px; }
    .shape-options .shape-color { width: 26px; flex-basis: 26px; margin-right: 2px; }
}

/* Match the Gradient disclosure to the other dropdown chevrons. */
.blend-settings summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; list-style: none; }
.blend-settings summary::-webkit-details-marker { display: none; }
.gradient-chevron { width: 14px; height: 14px; flex-shrink: 0; color: #8a93a3; transition: transform .18s; }
.blend-settings[open] .gradient-chevron { transform: rotate(180deg); }
@media(prefers-reduced-motion: reduce) { .gradient-chevron { transition: none; } }

/* Separate logo adjustments from scan density. */
#pane-logo .correction-field { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }

/* Keep ink swatches directly beside shape buttons on smaller screens. */
@media (max-width: 799px) {
    .shape-field { justify-content: flex-start; gap: 6px; }
    .shape-field > .shape-color { margin-left: auto; flex-shrink: 0; }
    .shape-field > .shape-options { flex-shrink: 0; }
}
@media (max-width: 480px) {
    .shape-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 6px; }
    .shape-field > label { grid-column: 1 / -1; }
    .shape-field > .shape-color { grid-column: 1; justify-self: end; margin-left: 0; }
    .shape-field > .shape-options { grid-column: 2; }
}

/* Mobile: keep each label left and align the entire swatch + shape group right. */
@media (max-width: 799px) {
    .shape-field {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
    }
    .shape-field > label {
        margin: 0 auto 0 0;
        flex: 0 0 auto;
        white-space: nowrap;
    }
    .shape-field > .shape-color {
        margin-left: 0;
        flex: 0 0 auto;
    }
    .shape-field > .shape-options {
        margin-left: 0;
        flex: 0 0 auto;
    }
}
@media (max-width: 480px) {
    .shape-field { gap: 4px; }
    .shape-field > label { font-size: 10px; }
    .shape-options { gap: 2px; }
    .shape-choice { width: 26px; flex-basis: 26px; }
}

/* Circular color swatches for the three shape controls. */
.shape-field > .shape-color,
.shape-options .shape-color {
    border-radius: 50%;
}
.shape-field > .shape-color::-webkit-color-swatch,
.shape-options .shape-color::-webkit-color-swatch,
.shape-field > .shape-color::-moz-color-swatch,
.shape-options .shape-color::-moz-color-swatch {
    border-radius: 50%;
}

/* Keep color inputs perfectly square so circular swatches cannot stretch. */
.shape-field > input.shape-color,
.shape-options > input.shape-color {
    box-sizing: border-box;
    display: block;
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
    max-width: 26px;
    max-height: 26px;
    flex: 0 0 26px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    padding: 0;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
}
.shape-field > input.shape-color::-webkit-color-swatch-wrapper,
.shape-options > input.shape-color::-webkit-color-swatch-wrapper { padding: 0; }
.shape-field > input.shape-color::-webkit-color-swatch,
.shape-options > input.shape-color::-webkit-color-swatch { border: 0; border-radius: 50%; }
.shape-field > input.shape-color::-moz-color-swatch,
.shape-options > input.shape-color::-moz-color-swatch { border: 0; border-radius: 50%; }
@media (max-width: 480px) {
    .shape-field > input.shape-color,
    .shape-options > input.shape-color {
        width: 23px;
        height: 23px;
        min-width: 23px;
        min-height: 23px;
        max-width: 23px;
        max-height: 23px;
        flex-basis: 23px;
    }
}

/* Dots row toggles its advanced controls; no separate More options row/divider. */
.shape-field > .dots-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-right: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: #626976;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    flex: 0 0 auto;
}
.dots-toggle svg { width: 15px; height: 15px; flex: 0 0 15px; transition: transform .18s ease; }
.dots-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.shape-field:has(.dots-toggle) { justify-content: flex-end; }
.shape-field:has(.dots-toggle) > .sr-only { position: absolute; }
.blend-settings { border: 0; padding-bottom: 0; margin-top: 2px; }
.blend-settings > summary { display: none !important; }
.blend-settings[open] { padding-top: 8px; }
@media (max-width: 799px) {
    .shape-field > .dots-toggle { margin-right: auto; }
}
@media (max-width: 480px) {
    .shape-field > .dots-toggle { font-size: 10px; }
}

/* Layout refinements: align Dots chevron with labels, and density with shape controls. */
.shape-field > .dots-toggle svg {
    margin-left: -4px;
}
/* Light separators make the three shape rows easier to follow. */
#pane-style .shape-field {
    border-top: 1px solid #e6e9ee;
    padding-top: 10px;
}
#pane-style > .section {
    border-bottom: 1px solid #e6e9ee;
    padding-bottom: 10px;
}
/* Reduce space below Dots, not above it. */
#pane-style > .section:has(.shape-field > .dots-toggle) {
    padding-bottom: 7px;
}
#pane-style .shape-field:has(> .dots-toggle) {
    margin-bottom: 5px;
}
#pane-style .correction-field {
    margin-top: 20px;
}
#pane-style .correction-field .select-trigger {
    width: 166px;
    margin-right: 8px;
}
#pane-logo .correction-field {
    border-top: 0;
    padding-top: 0;
    margin-top: 20px;
}
@media (max-width: 480px) {
    #pane-style .correction-field .select-trigger {
        max-width: calc(100vw - 190px);
    }
}

/* Let the pattern run under the mobile browser bars; keep content clear of them. */
.page { padding-top: calc(24px + env(safe-area-inset-top, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); }
@media(max-width:799px) {
    .page { padding-top: calc(12px + env(safe-area-inset-top, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); }
}

/* Compact, outlined ink controls and conditional logo editing. */
.page-footer .trademark-notice { font-size: 9px; line-height: 1.4; }
.color, .preview-color-control .color { box-shadow: none; }
.preview-color-control .color {
    width: 18px; height: 18px; min-width: 18px; min-height: 18px;
    max-width: 18px; max-height: 18px; flex: 0 0 18px;
}
.shape-field > input.shape-color, .shape-options > input.shape-color {
    width: 18px; height: 18px; min-width: 18px; min-height: 18px;
    max-width: 18px; max-height: 18px; flex: 0 0 18px; margin-right: 11px;
}
.unify-colors { position: relative; display: flex; align-items: center; gap: 8px; min-height: 32px; margin: 14px 0 0; }
.unify-colors .switch-track { flex-shrink: 0; }
.unify-colors input { margin: 0; accent-color: #000; }
.logo-upload-box { position: relative; }
.logo-upload-box > #removeLogoButton {
    position: absolute; z-index: 2; top: 8px; right: 8px;
    padding: 6px 9px; font-size: 11px;
}
.file-input.has-logo { flex-direction: column; gap: 10px; padding-top: 42px; }
.logo-preview { width: 72px; height: 72px; object-fit: contain; }
.logo-controls-row .field:last-child { margin-bottom: 0; }

@media(max-width:799px) {
    html, body { height: 100%; min-height: 0; overflow: hidden; overscroll-behavior: none; }
    .page { height: 100dvh; min-height: 0; }
    .app-shell {
        flex: 1; min-height: 0; display: block; overflow-y: auto; overflow-x: hidden;
        overscroll-behavior: contain; scrollbar-width: thin;
    }
    .controls { overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
    .controls > [role="tabpanel"] { flex: none; overflow: visible; }
    .preview-panel { padding: 20px; overflow: visible; }
    .qr-stage { height: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto auto; gap: 16px; }
    .preview-viewport { grid-column: 1; grid-row: 1; width: 100%; height: auto; aspect-ratio: 1; }
    .preview-meta {
        grid-column: 1; grid-row: 2; display: flex; flex-direction: row;
        flex-wrap: nowrap; align-items: center; gap: 8px; padding: 6px 8px;
    }
    .preview-scale-control { flex: 1; width: auto; min-width: 0; gap: 5px; height: 30px; }
    .preview-scale-control label { position: static; width: auto; height: auto; clip-path: none; overflow: visible; }
    .preview-scale-control output { flex-basis: 25px; }
    .preview-color-control { flex: 0 0 auto; width: auto; height: 30px; padding: 0 0 0 8px; border: 0; gap: 5px; }
    .preview-color-control .input { display: none; }
    .preview-settings { grid-column: 1; grid-row: 3; }
    .preview-actions { grid-column: 1; grid-row: 4; }
    .shape-options { gap: 5px; flex-wrap: nowrap; }
    .shape-choice { width: 32px; height: 32px; flex: 0 0 32px; }
}
@media(max-width:390px) {
    .controls { padding-inline: 14px; }
    .shape-field { flex-wrap: wrap; gap: 6px; }
    .shape-field > label, .shape-field > .dots-toggle { flex-basis: 100%; }
    .shape-field > .sr-only { flex-basis: auto; }
    .preview-panel { padding-inline: 12px; }
    .preview-meta { gap: 6px; }
}

@media(max-width:799px) {
    body { position: fixed; inset: 0; }
    .page { overflow: hidden; }
    .preview-meta { padding: 0; }
    .preview-scale-control, .preview-color-control {
        height: 40px; padding: 0 8px; border: 1px solid var(--control-outline);
    }
}

/* Four discrete density settings, using the preview slider's quiet surface. */
.density-control {
    display: flex; align-items: flex-start; gap: 16px; margin: 16px 0 6px;
    padding: 12px 14px; border-radius: 12px; background: #f0f2f6;
}
.density-control > label { flex-shrink: 0; margin: 5px 0 0; color: #626d7d; }
.density-slider { position: relative; isolation: isolate; flex: 1; min-width: 0; }
.density-slider input {
    position: relative; z-index: 1;
    display: block; width: 100%; height: 24px; margin: 0; padding: 0;
    appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer;
}
.density-slider input::-webkit-slider-runnable-track {
    height: 3px; border-radius: 3px;
    background: linear-gradient(to right, #000 0 var(--range-fill, 100%), #d5dbe4 var(--range-fill, 100%) 100%);
}
.density-slider input::-webkit-slider-thumb {
    appearance: none; -webkit-appearance: none; width: 12px; height: 12px;
    margin-top: -4.5px; border: 0; border-radius: 50%; background: #000;
}
.density-slider input::-moz-range-track { height: 3px; border-radius: 3px; background: #d5dbe4; }
.density-slider input::-moz-range-progress { height: 3px; background: #000; }
.density-slider input::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #000; }
.density-stops { position: absolute; z-index: 0; top: 9.5px; left: 3.5px; right: 3.5px; display: flex; justify-content: space-between; pointer-events: none; }
.density-stops span { width: 5px; height: 5px; border-radius: 50%; background: #000; }
.density-endpoints { display: flex; justify-content: space-between; margin-top: -3px; font-size: 10px; color: #626d7d; }

/* Match Reset's white surface and light outline across the slider controls. */
.density-control, .preview-scale-control, .preview-color-control {
    background: #fff;
    border: 1px solid var(--action-outline);
    border-radius: 8px;
    box-shadow: none;
}

/* Export settings share the preview controls' white, gray-outlined surface. */
.preview-settings .select-trigger {
    background: #fff;
    border: 1px solid var(--action-outline);
    border-radius: 8px;
    color: #626d7d;
    box-shadow: none;
}
.preview-settings .select-trigger:hover {
    background: #fafbfc;
    border-color: #cbd2dc;
}
.preview-settings .select-trigger[aria-expanded=true] {
    background: #fff;
    border-color: #b8c1ce;
    box-shadow: none;
}

/* Keep the export tab anchored while its settings extend above it. */
.qr-stage { grid-template-rows: auto minmax(0, 1fr) auto; }
.preview-actions { position: relative; grid-row: 3; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; align-items: start; }
.export-options { width: 100%; min-width: 0; z-index: 3; }
.export-options > summary {
    display: flex; align-items: center; justify-content: center; gap: 5px; height: 42px;
    padding: 0 6px; list-style: none; cursor: pointer; white-space: nowrap;
    border: 1px solid var(--action-outline); border-radius: 8px;
    background: #fff; color: #626976; font-size: 11px; font-weight: 500;
}
.export-options > summary::-webkit-details-marker { display: none; }
.export-options > summary:hover { background: #fafbfc; }
.export-options > summary:focus-visible { outline: 2px solid #b8c1ce; outline-offset: 3px; }
.export-options > summary svg { width: 15px; height: 15px; flex: 0 0 15px; transition: transform .18s ease; }
.export-options[open] > summary {
    position: relative;
    border-top-color: transparent;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.export-options[open] > summary::before {
    content: '';
    position: absolute;
    z-index: 1;
    left: -1px;
    right: -1px;
    top: -10px;
    height: 11px;
    border-inline: 1px solid var(--action-outline);
    background: #fff;
    pointer-events: none;
}
.export-options[open] > summary svg { transform: rotate(180deg); }
.export-options > .preview-settings {
    position: absolute; bottom: calc(100% + 8px); left: 0; width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px;
    padding: 16px; border: 1px solid var(--action-outline);
    border-radius: 12px 12px 12px 0; background: #fff;
    box-shadow: none;
}
.export-options .preview-settings label { color: #626976; }
@media(max-width:799px) {
    .qr-stage { grid-template-rows: auto auto auto; }
    .preview-actions .select-trigger { padding-inline: 8px; font-size: 11px; }
    .preview-actions > .button { padding-inline: 8px; }
}

/* Suppress native slider shadows as well, including mobile WebKit controls. */
input[type=range]::-webkit-slider-thumb { box-shadow: none; }
input[type=range]::-webkit-slider-runnable-track { box-shadow: none; }
input[type=range]::-moz-range-thumb { box-shadow: none; }
input[type=range]::-moz-range-track { box-shadow: none; }

/* Shared disclosure chevrons match the format selector's original icon. */
.select-trigger svg, .dots-toggle svg, .export-options > summary svg, .gradient-chevron {
    width: 14px; height: 14px; flex: 0 0 14px; color: #8a93a3;
}
.select-trigger svg path, .dots-toggle svg path, .export-options > summary svg path, .gradient-chevron path {
    stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.export-format .select-trigger {
    justify-content: center; gap: 5px; padding-inline: 6px;
    border: 1px solid var(--action-outline); border-radius: 8px;
    background: #fff; color: #626976; font-size: 11px; font-weight: 500;
}
.export-format .select-trigger:hover { background: #fafbfc; border-color: var(--action-outline); }
.export-format .select-trigger svg { order: -1; transform: rotate(180deg); }
.export-format .select-trigger[aria-expanded=true] {
    background: #fff; border-color: var(--action-outline); border-top-color: transparent;
    border-top-left-radius: 0; border-top-right-radius: 0;
}
.export-format .select-trigger[aria-expanded=true] svg { transform: rotate(0); }
#exportFormat-menu {
    border-color: var(--action-outline); border-bottom: 0;
    border-radius: 8px 8px 0 0; background: #fff; backdrop-filter: none;
}
#exportFormat-menu .select-option { gap: 4px; padding-inline: 6px; font-size: 11px; }
#exportFormat-menu .option-check { flex-shrink: 0; }

/* Identical sizing and icon/text spacing for the two export disclosures. */
.export-options > summary, .export-format .select-trigger {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 42px; padding: 0 16px 0 12px; gap: 5px;
    font-size: 11px; font-weight: 500; line-height: 1.2;
}
.export-options > summary > span, .export-format .select-trigger > span {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Mobile: retain desktop disclosure spacing; only Download flexes narrower. */
@media (max-width: 799px) {
    .preview-actions { min-width: 0; grid-template-columns: max-content max-content minmax(0, 1fr); }
    .export-options > summary, .export-format .select-trigger {
        justify-content: center; padding: 0 16px 0 12px; gap: 5px;
    }
    #downloadButton { width: 100%; min-width: 0; white-space: nowrap; padding-inline: 4px; }
}

/* A 16px editing font prevents iOS focus zoom without disabling pinch zoom. */
@media (max-width: 799px), (hover: none) and (pointer: coarse) {
    html body input.input,
    html body textarea.textarea,
    html body select.select {
        font-size: 16px;
    }
    .preview-color-control .input { width: 88px; }
}

/* Frames are a separate compact section below the shared color switch. */
.frames-section { border-top: 1px solid #e6e9ee; border-bottom: 1px solid #e6e9ee; margin-top: 12px; padding: 10px 0; }
.frame-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.frame-row > .dots-toggle { display: flex; align-items: center; gap: 5px; padding: 0; border: 0; background: transparent; color: #626976; font-size: 11px; }
.frame-choices { display: flex; gap: 7px; }
.frame-choices .shape-choice { flex-basis: 32px; width: 32px; }
.frame-choices svg { width: 22px; height: 22px; }
#framesOptions { padding-top: 14px; }
#framesOptions .field:last-child { margin-bottom: 0; }
