:root {
    color-scheme: dark;
    --page: #d9ebdd;
    --surface: #1f1f1f;
    --surface-soft: #282828;
    --surface-raised: #333333;
    --line: rgba(255, 255, 255, 0.1);
    --text: #f8fafc;
    --muted: #b8bec7;
    --quiet: #8e949d;
    --accent: #a6ff74;
    --accent-strong: #7dd957;
    --accent-ink: #10210a;
    --danger: #fb7185;
    --focus: #38bdf8;
    --panel-radius: 24px;
    --control-radius: 999px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
    letter-spacing: 0;
}

html {
    min-width: 320px;
    background: var(--page);
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--page);
    color: var(--text);
    overflow-x: hidden;
}

button,
input,
textarea {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

[hidden] {
    display: none !important;
}

.page-shell {
    min-height: 100vh;
    padding: 52px 32px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 30px;
}

.scanner-hero {
    width: min(1200px, 100%);
    display: grid;
    gap: 24px;
    color: #1f2937;
    text-align: center;
}

.scanner-heading {
    display: grid;
    gap: 22px;
}

.scanner-heading h1 {
    color: #2b2f3a;
    font-size: clamp(1.9rem, 3vw, 2.35rem);
    line-height: 1.12;
    font-weight: 800;
}

.scanner-heading p {
    margin: 0;
    color: #111827;
    font-size: clamp(1rem, 1.7vw, 1.3rem);
    line-height: 1.4;
}

.scanner-card {
    overflow: hidden;
    border-radius: 9px;
    background: #1f1f1f;
    box-shadow: 0 22px 50px rgba(15, 23, 42, 0.12);
}

.scanner-stage {
    position: relative;
    min-height: 216px;
    display: grid;
    place-items: center;
    background: #1f1f1f;
    overflow: hidden;
}

.scanner-stage video,
.scanner-stage canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.scanner-stage video {
    object-fit: cover;
}

.scanner-stage canvas {
    pointer-events: none;
}

.scanner-placeholder {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    gap: 18px;
    color: #ffffff;
    font-weight: 500;
}

.scanner-camera-button {
    width: 48px;
    height: 48px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: #ffffff;
    color: #232323;
    transition: transform 160ms ease, background 160ms ease;
}

.scanner-card.is-active .scanner-camera-button,
.scanner-camera-button:hover,
.scanner-camera-button:focus-visible {
    transform: translateY(-1px);
    background: var(--accent);
}

.scanner-camera-button svg {
    width: 22px;
    height: 22px;
}

.scanner-note {
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 18px;
    background: #303230;
    color: #a6ff74;
    font-size: 0.86rem;
    font-weight: 800;
}

.scanner-note svg {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
}

.scanner-result {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border: 1px solid rgba(31, 41, 55, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.64);
    color: #111827;
    text-align: left;
}

.scanner-result span {
    display: block;
    margin-bottom: 6px;
    color: #4b5563;
    font-size: 0.78rem;
    font-weight: 900;
}

.scanner-result code {
    display: block;
    max-height: 82px;
    overflow: auto;
    color: #111827;
    font-size: 0.84rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.scanner-result-actions {
    display: flex;
    gap: 8px;
}

.scanner-result .icon-button {
    background: #1f2937;
    color: #ffffff;
}

.scanner-result .ghost-button {
    background: #e5e7eb;
    color: #111827;
}

.app-surface {
    width: min(1206px, 100%);
    min-height: min(720px, calc(100vh - 52px));
    background: var(--surface);
    border-radius: var(--panel-radius);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
    overflow: hidden;
}

.topbar {
    min-height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 48px 10px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 14px;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 900;
}

.brand-name,
.brand-subtitle {
    display: block;
}

.brand-name {
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    font-weight: 800;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 0.88rem;
    margin-top: 2px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--control-radius);
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

.status-pill svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(330px, 392px);
    gap: 34px;
    padding: 8px 48px 48px;
    width: 100%;
    min-width: 0;
}

.editor-panel,
.preview-panel {
    min-width: 0;
}

.editor-panel {
    overflow: hidden;
}

.type-tabs {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(12, minmax(66px, 1fr));
    width: 100%;
    min-width: 0;
    gap: 8px;
    margin-bottom: 0;
    overflow-x: auto;
    padding-bottom: 4px;
}

.type-tab {
    min-width: 66px;
    min-height: 68px;
    display: grid;
    place-items: center;
    gap: 6px;
    padding: 10px 8px;
    border-radius: 8px;
    background: transparent;
    color: var(--accent);
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.type-tab span {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.1;
}

.type-tab svg {
    width: 21px;
    height: 21px;
    stroke-width: 2;
}

.type-tab:hover,
.type-tab:focus-visible,
.type-tab.is-active {
    background: var(--surface-raised);
    color: #d7ffbd;
}

.type-tab:active {
    transform: translateY(1px);
}

.qr-form {
    display: grid;
    gap: 22px;
    min-width: 0;
}

.form-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.form-heading > div {
    min-width: 0;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 800;
}

h1,
h2 {
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

h1 {
    font-size: clamp(1.35rem, 2.6vw, 2.15rem);
    line-height: 1.08;
}

h2 {
    font-size: 1.05rem;
    line-height: 1.2;
}

.ghost-button,
.primary-button,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border-radius: 8px;
    font-weight: 800;
    transition: transform 160ms ease, background 160ms ease, color 160ms ease, opacity 160ms ease;
}

.ghost-button {
    flex: 0 0 auto;
    padding: 0 14px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text);
}

.ghost-button:hover,
.ghost-button:focus-visible {
    background: rgba(255, 255, 255, 0.12);
}

.ghost-button svg,
.primary-button svg,
.icon-button svg {
    width: 18px;
    height: 18px;
}

.dynamic-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field {
    display: grid;
    gap: 8px;
}

.field.is-wide {
    grid-column: 1 / -1;
}

.field label {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.field input,
.field textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: #f8fafc;
    color: #111827;
    outline: 0;
    padding: 0 18px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field textarea {
    min-height: 112px;
    resize: vertical;
    border-radius: 18px;
    padding: 14px 18px;
    line-height: 1.45;
}

.field input:focus,
.field textarea:focus {
    border-color: var(--focus);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.2);
}

.field input::placeholder,
.field textarea::placeholder {
    color: #6b7280;
}

.customizer {
    display: grid;
    gap: 18px;
    margin-top: 8px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.design-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-bottom: 1px solid var(--line);
}

.design-tab {
    position: relative;
    min-width: 0;
    min-height: 54px;
    padding: 0 10px;
    background: transparent;
    color: #b9c2d2;
    font-size: clamp(1rem, 2vw, 1.35rem);
    font-weight: 900;
    overflow-wrap: anywhere;
}

.design-tab::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: transparent;
}

.design-tab:hover,
.design-tab:focus-visible,
.design-tab.is-active {
    color: #5ab8ff;
}

.design-tab.is-active::after {
    background: #0b82dc;
}

.design-panel {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
    gap: 12px;
}

.frame-grid {
    grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
}

.logo-grid {
    grid-template-columns: repeat(3, minmax(92px, 120px));
    justify-content: start;
}

.shape-grid {
    grid-template-columns: repeat(6, minmax(70px, 1fr));
}

.thumb-option {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    min-height: 82px;
    display: grid;
    place-items: center;
    padding: 8px;
    border: 1px solid rgba(56, 189, 248, 0.44);
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.92);
    color: #50648a;
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.thumb-option:hover,
.thumb-option:focus-visible {
    transform: translateY(-1px);
    border-color: #5ad0ff;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.thumb-option.is-selected {
    border-color: #0b82dc;
    box-shadow: 0 0 0 3px rgba(11, 130, 220, 0.24);
}

.frame-art,
.logo-art,
.shape-art {
    position: relative;
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    color: #53678d;
}

.frame-art-none svg,
.logo-art-none svg {
    width: 42px;
    height: 42px;
    stroke-width: 2.4;
}

.thumb-qr {
    position: relative;
    width: 34px;
    height: 34px;
    border: 2px solid currentColor;
    background:
        linear-gradient(currentColor 0 0) 6px 6px / 5px 5px no-repeat,
        linear-gradient(currentColor 0 0) 22px 6px / 5px 5px no-repeat,
        linear-gradient(currentColor 0 0) 14px 14px / 5px 5px no-repeat,
        linear-gradient(currentColor 0 0) 6px 22px / 5px 5px no-repeat,
        linear-gradient(currentColor 0 0) 22px 22px / 5px 5px no-repeat,
        #ffffff;
}

.thumb-qr::before,
.thumb-qr::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    border: 2px solid currentColor;
}

.thumb-qr::before {
    left: 3px;
    top: 3px;
}

.thumb-qr::after {
    right: 3px;
    bottom: 3px;
}

.thumb-label {
    min-width: 34px;
    min-height: 10px;
    display: inline-grid;
    place-items: center;
    padding: 1px 4px;
    border-radius: 2px;
    background: #050505;
    color: #ffffff;
    font-size: 0.36rem;
    font-weight: 900;
    line-height: 1;
}

.thumb-script {
    color: #050505;
    font-family: "Brush Script MT", "Segoe Script", cursive;
    font-size: 0.72rem;
    font-style: italic;
    font-weight: 700;
}

.frame-art-bottom,
.frame-art-compact,
.frame-art-badge,
.frame-art-ribbon,
.frame-art-script,
.frame-art-outline,
.frame-art-tag,
.frame-art-brush,
.frame-art-coupon,
.frame-art-gift,
.frame-art-mug {
    grid-template-rows: 1fr auto;
    gap: 2px;
}

.frame-art-top {
    grid-template-rows: auto 1fr;
    gap: 2px;
}

.frame-art-compact .thumb-label {
    background: transparent;
    color: #050505;
    font-size: 0.46rem;
}

.frame-art-badge .thumb-label {
    border-radius: 999px;
}

.frame-art-ribbon .thumb-label {
    transform: skewX(-12deg);
}

.frame-art-side {
    grid-template-columns: 18px 1fr;
}

.frame-art-side .thumb-script {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 0.58rem;
}

.frame-art-outline .thumb-qr {
    box-shadow: 0 0 0 2px #050505;
}

.frame-art-tag::before,
.frame-art-gift::before,
.frame-art-mug::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 50%;
    width: 14px;
    height: 7px;
    border: 2px solid #050505;
    border-bottom: 0;
    border-radius: 7px 7px 0 0;
    transform: translateX(-50%);
}

.frame-art-brush::before {
    content: "";
    position: absolute;
    inset: 12px 8px 16px;
    border: 3px solid #050505;
    border-left-width: 5px;
    border-right-width: 5px;
    transform: rotate(-3deg);
}

.frame-art-coupon::before,
.frame-art-coupon::after {
    content: "";
    position: absolute;
    top: 18px;
    bottom: 14px;
    width: 4px;
    background: #050505;
}

.frame-art-coupon::before {
    left: 8px;
}

.frame-art-coupon::after {
    right: 8px;
}

.frame-art-mug::before {
    left: auto;
    right: 4px;
    top: 23px;
    width: 10px;
    height: 16px;
    border: 3px solid #050505;
    border-left: 0;
    border-radius: 0 10px 10px 0;
    transform: none;
}

.logo-art-box {
    border: 3px solid currentColor;
}

.logo-art-box::before,
.logo-art-box::after {
    content: "";
    position: absolute;
    inset: 9px;
    border: 2px solid currentColor;
}

.logo-art-box span,
.logo-art-box strong,
.logo-art-text span,
.logo-art-text strong {
    display: block;
    color: currentColor;
    line-height: 0.9;
    text-align: center;
}

.logo-art-box span,
.logo-art-text span {
    font-size: 0.82rem;
    font-weight: 900;
}

.logo-art-box strong,
.logo-art-text strong {
    font-size: 1.5rem;
    font-weight: 500;
}

.logo-art-text {
    align-content: center;
}

.shape-art {
    width: 58px;
    height: 58px;
    background-color: transparent;
    background-image:
        radial-gradient(circle at 16% 16%, currentColor 0 4px, transparent 4px),
        radial-gradient(circle at 48% 16%, currentColor 0 4px, transparent 4px),
        radial-gradient(circle at 80% 16%, currentColor 0 4px, transparent 4px),
        radial-gradient(circle at 16% 48%, currentColor 0 4px, transparent 4px),
        radial-gradient(circle at 48% 48%, currentColor 0 4px, transparent 4px),
        radial-gradient(circle at 80% 48%, currentColor 0 4px, transparent 4px),
        radial-gradient(circle at 16% 80%, currentColor 0 4px, transparent 4px),
        radial-gradient(circle at 48% 80%, currentColor 0 4px, transparent 4px),
        radial-gradient(circle at 80% 80%, currentColor 0 4px, transparent 4px);
}

.shape-square {
    background-image:
        linear-gradient(currentColor 0 0),
        linear-gradient(currentColor 0 0),
        linear-gradient(currentColor 0 0),
        linear-gradient(currentColor 0 0),
        linear-gradient(currentColor 0 0),
        linear-gradient(currentColor 0 0),
        linear-gradient(currentColor 0 0),
        linear-gradient(currentColor 0 0),
        linear-gradient(currentColor 0 0);
    background-position: 4px 4px, 24px 4px, 44px 4px, 4px 24px, 24px 24px, 44px 24px, 4px 44px, 24px 44px, 44px 44px;
    background-size: 10px 10px;
    background-repeat: no-repeat;
}

.shape-rounded {
    border-radius: 14px;
}

.shape-extra-rounded {
    border-radius: 22px;
}

.shape-classy {
    clip-path: polygon(0 0, 72% 0, 72% 18%, 100% 18%, 100% 100%, 28% 100%, 28% 82%, 0 82%);
}

.shape-classy-rounded {
    border-radius: 18px 4px 18px 4px;
}

.upload-field {
    position: relative;
    min-height: 110px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 14px;
    row-gap: 6px;
    align-items: center;
    padding: 18px;
    border: 1px dashed rgba(56, 189, 248, 0.54);
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.08);
    color: #5ab8ff;
    cursor: pointer;
}

.upload-field:hover,
.upload-field:focus-within,
.upload-field.is-selected {
    background: rgba(56, 189, 248, 0.12);
    border-color: #0b82dc;
}

.upload-field svg {
    width: 28px;
    height: 28px;
    grid-row: 1 / span 2;
}

.upload-field span {
    font-size: 1.08rem;
    font-weight: 900;
}

.upload-field small {
    color: var(--muted);
    font-size: 0.9rem;
}

.upload-field input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    color: var(--muted);
    font-weight: 800;
}

.upload-meta span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.section-title span {
    max-width: 55%;
    color: var(--quiet);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
    text-align: right;
}

.reader-panel {
    display: grid;
    gap: 14px;
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.reader-panel .section-title {
    align-items: flex-start;
}

.reader-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: stretch;
}

.file-drop {
    position: relative;
    min-width: 0;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border: 1px dashed rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
}

.file-drop:hover,
.file-drop:focus-within {
    border-color: var(--accent);
    background: rgba(166, 255, 116, 0.08);
}

.file-drop svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    color: var(--accent);
}

.file-drop span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-drop input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.reader-submit {
    min-width: 120px;
}

.reader-result {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.reader-result-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.reader-result-heading span:last-child {
    color: var(--quiet);
    text-align: right;
}

.reader-result code {
    display: block;
    max-height: 112px;
    overflow: auto;
    color: #e2e8f0;
    font-size: 0.82rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.reader-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.color-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.color-field {
    min-width: 0;
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.color-field span,
.range-field span,
.segmented legend {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.color-field span {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.color-field output {
    color: var(--text);
    font: inherit;
}

.color-field input {
    width: 100%;
    height: 42px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    padding: 0;
}

.label-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(120px, auto);
    gap: 12px;
    align-items: stretch;
}

.text-field,
.toggle-field {
    min-width: 0;
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.text-field span,
.toggle-field span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.text-field input {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 0 12px;
    background: #f8fafc;
    color: #111827;
    font-weight: 800;
    outline: 0;
}

.text-field input:focus-visible {
    box-shadow: 0 0 0 3px var(--focus);
}

.toggle-field {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    align-content: center;
    cursor: pointer;
}

.toggle-field input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.option-row {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 12px;
}

.segmented {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.segmented legend {
    grid-column: 1 / -1;
    padding: 0;
    margin-bottom: 2px;
}

.segmented label {
    min-width: 0;
}

.segmented input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented span {
    min-height: 36px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 800;
    overflow-wrap: anywhere;
    text-align: center;
}

.segmented input:checked + span {
    background: var(--accent);
    color: var(--accent-ink);
}

.range-field {
    display: grid;
    grid-template-columns: auto minmax(120px, 1fr) 34px;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.range-field input {
    accent-color: var(--accent);
}

.range-field output {
    color: var(--text);
    font-weight: 800;
    text-align: right;
}

.preview-panel {
    align-self: start;
}

.preview-heading {
    min-height: 56px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}

.qr-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(166, 255, 116, 0.12);
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 900;
}

.preview-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px;
    gap: 14px;
    align-items: stretch;
}

.qr-frame {
    position: relative;
    aspect-ratio: 1;
    min-height: 270px;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 6px;
    align-items: stretch;
    justify-items: center;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.qr-frame img {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
    display: block;
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 10px;
    color: #64748b;
    text-align: center;
    font-weight: 800;
}

.empty-state svg {
    width: 42px;
    height: 42px;
    color: #94a3b8;
}

.qr-corner-label {
    position: static;
    max-width: 100%;
    min-width: 48px;
    min-height: 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 6px;
    background: transparent;
    color: #111827;
    font-size: 0.7rem;
    font-weight: 900;
    text-align: center;
    overflow-wrap: anywhere;
    text-transform: uppercase;
}

.preset-strip {
    display: grid;
    gap: 8px;
    align-content: start;
}

.preset {
    width: 54px;
    height: 54px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
}

.preset:hover,
.preset:focus-visible,
.preset.is-active {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.preset span {
    min-width: 0;
    border-radius: 999px;
    background: var(--swatch);
}

.payload-box {
    display: grid;
    gap: 8px;
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.payload-box span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.payload-box code {
    display: block;
    max-height: 82px;
    overflow: auto;
    color: #e2e8f0;
    font-size: 0.78rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.action-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px 48px;
    gap: 8px;
    margin-top: 16px;
}

.download-split {
    position: relative;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
}

.primary-button {
    min-width: 0;
    padding: 0 16px;
    background: #0b82dc;
    color: #ffffff;
}

.download-main {
    border-radius: 999px 0 0 999px;
}

.download-toggle {
    width: 48px;
    min-height: 48px;
    display: inline-grid;
    place-items: center;
    border-left: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 0 999px 999px 0;
    background: #0b82dc;
    color: #ffffff;
    transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.download-toggle svg {
    width: 22px;
    height: 22px;
}

.download-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 10;
    width: min(176px, calc(100vw - 32px));
    padding: 8px;
    border: 1px solid #d8dee8;
    border-radius: 4px;
    background: #ffffff;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
}

.download-menu.is-drop-up {
    top: auto;
    bottom: calc(100% + 10px);
}

.download-menu button {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 4px;
    background: transparent;
    color: #172554;
    font-weight: 500;
    text-align: left;
}

.download-menu button:hover,
.download-menu button:focus-visible {
    background: #eef5ff;
}

.primary-button:disabled,
.download-toggle:disabled,
.icon-button:disabled {
    opacity: 0.45;
}

.primary-button:hover:not(:disabled),
.primary-button:focus-visible:not(:disabled),
.download-toggle:hover:not(:disabled),
.download-toggle:focus-visible:not(:disabled),
.icon-button:hover:not(:disabled),
.icon-button:focus-visible:not(:disabled) {
    transform: translateY(-1px);
}

.icon-button {
    width: 48px;
    min-height: 48px;
    background: rgba(255, 255, 255, 0.16);
    color: var(--text);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 20;
    max-width: min(420px, calc(100vw - 32px));
    transform: translateX(-50%);
    padding: 12px 16px;
    border-radius: 999px;
    background: #111827;
    color: #f8fafc;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
    font-weight: 800;
    text-align: center;
}

.toast.is-error {
    background: #7f1d1d;
}

@media (max-width: 1040px) {
    .page-shell {
        padding: 18px;
        justify-content: flex-start;
    }

    .app-surface {
        min-height: auto;
    }

    .topbar {
        padding: 22px 24px 10px;
    }

    .workspace {
        grid-template-columns: 1fr;
        padding: 8px 24px 28px;
    }

    .preview-panel {
        max-width: 640px;
        width: 100%;
        justify-self: center;
    }
}

@media (max-width: 720px) {
    .page-shell {
        gap: 22px;
        padding: 18px 0 0;
    }

    .scanner-hero {
        width: calc(100% - 32px);
        gap: 18px;
    }

    .scanner-heading {
        gap: 14px;
    }

    .scanner-heading h1 {
        font-size: 1.72rem;
    }

    .scanner-heading p {
        font-size: 1rem;
    }

    .scanner-stage {
        min-height: 190px;
    }

    .scanner-note {
        min-height: 52px;
        gap: 10px;
        font-size: 0.78rem;
    }

    .scanner-result {
        grid-template-columns: 1fr;
    }

    .scanner-result-actions {
        justify-content: flex-end;
    }

    .app-surface {
        width: 100%;
        border-radius: 0;
    }

    .topbar {
        align-items: flex-start;
        padding: 18px 16px 8px;
    }

    .brand-mark {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .brand-subtitle,
    .status-pill {
        display: none;
    }

    .workspace {
        gap: 26px;
        padding: 8px 16px 22px;
        overflow-x: hidden;
    }

    .type-tabs {
        display: flex;
        grid-template-columns: none;
        margin-right: -16px;
        padding-right: 16px;
    }

    .type-tab {
        flex: 0 0 72px;
    }

    .form-heading {
        display: grid;
    }

    .qr-form {
        padding-right: 0;
    }

    h1 {
        font-size: 1.24rem;
        line-height: 1.12;
    }

    .ghost-button {
        justify-self: start;
    }

    .dynamic-fields,
    .control-grid,
    .option-row,
    .label-controls,
    .reader-form {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    .design-tabs {
        grid-template-columns: 1fr;
    }

    .thumb-grid,
    .logo-grid,
    .shape-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-width: 100%;
    }

    .field input,
    .field textarea {
        width: min(100%, calc(100vw - 48px));
    }

    .field input,
    .field textarea,
    .color-field,
    .text-field,
    .toggle-field,
    .segmented,
    .range-field,
    .upload-field,
    .reader-panel {
        max-width: 100%;
    }

    .reader-submit {
        justify-self: start;
    }

    .range-field {
        grid-template-columns: 1fr 42px;
    }

    .range-field span {
        grid-column: 1 / -1;
    }

    .preview-layout {
        grid-template-columns: 1fr;
    }

    .preset-strip {
        grid-template-columns: repeat(4, 54px);
        justify-content: center;
    }

    .qr-frame {
        min-height: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
