@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    color-scheme: light dark;
    --paper: #f2f4f0;
    --ink: #17211f;
    --muted: #68736e;
    --line: #d8ded8;
    --panel: #fbfcf9;
    --panel-secondary: #f7f9f5;
    --qrstage: #efefef;
    --grid-line: rgba(23, 33, 31, 0.035);
    --signal: #b8dd16;
    --signal-dark: #7e9613;
    --warning: #b64235;
    --shadow: rgba(32, 48, 41, 0.08);
    --mono: 'IBM Plex Mono', monospace;
    --sans: 'Space Grotesk', sans-serif;
}

* { box-sizing: border-box; }
body { display: flex; min-width: 320px; min-height: 100vh; flex-direction: column; margin: 0; color: var(--ink); background-color: var(--paper); background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 32px 32px; font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }

.page-shell { width: min(1120px, calc(100% - 64px)); margin: 0 auto; padding: 58px 0 32px; }
.intro { margin-bottom: 30px; animation: rise-in 500ms ease-out both; }
.intro-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.eyebrow, .secure-tag, .site-footer { font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0; }
.eyebrow { display: flex; align-items: center; gap: 11px; margin: 0 0 17px; color: var(--muted); }
.eyebrow-line { width: 36px; height: 1px; background: var(--signal); }
.theme-button { flex: 0 0 auto; margin: 0 0 17px; padding: 7px 10px; border: 1px solid var(--line); background: var(--panel); font-size: 11px; font-weight: 600; }
.theme-button:hover, .field-control:hover { border-color: var(--muted); }
.theme-button:focus-visible, .field-control:focus-visible, .download-button:focus-visible, .size-slider:focus-visible { outline: 2px solid var(--signal-dark); outline-offset: 3px; }
h1 { margin: 0; font-size: 52px; line-height: 1.08; font-weight: 500; }
h1 em { color: var(--signal-dark); font-style: normal; }
.underline-loop { position: relative; display: inline-block; }
.underline-loop-svg { position: absolute; inset: -0.12em; width: calc(100% + 0.24em); height: calc(100% + 0.24em); overflow: visible; pointer-events: none; }
.underline-loop-svg path { fill: none; stroke: var(--signal-dark); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1000; stroke-dashoffset: 1000; vector-effect: non-scaling-stroke; opacity: 0; animation: underline-outline 6s cubic-bezier(0.2, 0.7, 0.2, 1) infinite; }
.intro-copy { margin: 12px 0 0; color: var(--muted); font-size: 15px; }

.workspace { padding: 30px 34px 20px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 22px 54px var(--shadow); animation: rise-in 600ms 80ms ease-out both; }
.generator-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 0.82fr); gap: 38px; }
.editor { min-width: 0; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.section-eyebrow { margin: 0 0 7px; color: var(--signal-dark); }
h2 { margin: 0; font-size: 19px; line-height: 1.25; font-weight: 600; }
.secure-tag { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; padding: 7px 9px; border: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.status-light { display: inline-block; width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #41a976; box-shadow: 0 0 0 3px rgba(65, 169, 118, 0.14); }
.field-label { display: block; margin: 15px 0 7px; color: var(--muted); font-size: 12px; font-weight: 600; }
.field-control { display: block; width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 0; background: var(--panel); font-size: 13px; }
textarea.field-control { min-height: 72px; resize: vertical; }
.field-control::placeholder { color: var(--muted); opacity: 0.72; }
.type-fields[hidden] { display: none; }
.type-fields { animation: rise-in 180ms ease-out both; }
.optional { float: right; font-family: var(--mono); font-size: 8px; font-weight: 500; }
.check-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 12px; cursor: pointer; }
.check-row input { width: 15px; height: 15px; accent-color: var(--signal-dark); }
.style-heading { margin-top: 22px; padding-bottom: 13px; }
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.option-grid .field-label { margin-top: 12px; }
.color-grid { margin-top: 1px; }
.color-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; margin-top: 11px; padding: 0 10px; border: 1px solid var(--line); background: var(--panel); }
.color-field .field-label { margin: 0; }
.color-field input { width: 32px; height: 26px; padding: 2px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.size-row { display: flex; align-items: center; justify-content: space-between; margin-top: 13px; }
.size-row .field-label { margin: 0; }
.size-row output, .preview-size { color: var(--muted); font-family: var(--mono); font-size: 10px; }
.size-slider { width: 100%; height: 17px; margin: 8px 0 0; accent-color: var(--signal-dark); cursor: pointer; }
.size-limits { display: flex; justify-content: space-between; color: var(--muted); font-family: var(--mono); font-size: 8px; }
.export-row { display: grid; grid-template-columns: minmax(104px, 0.72fr) minmax(150px, 1fr); gap: 10px; margin-top: 18px; }
.format-select { min-width: 0; }
.download-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; padding: 9px 14px; border: 1px solid var(--ink); background: var(--ink); color: var(--panel); font-size: 12px; font-weight: 600; }
.download-button:hover { border-color: var(--signal-dark); background: var(--signal-dark); color: #fff; }
.download-button:disabled { opacity: 0.55; cursor: not-allowed; }
.download-button span { color: var(--signal); font-size: 16px; line-height: 0.8; }
.status-message { min-height: 14px; margin: 7px 0 0; color: var(--warning); font-family: var(--mono); font-size: 10px; }

.preview { display: flex; min-width: 0; flex-direction: column; padding: 17px; border: 1px solid var(--line); background: var(--panel-secondary); }
.preview-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.preview-topline .eyebrow { margin: 0; }
.qr-stage { display: grid; width: 100%; min-height: 340px; aspect-ratio: 1; place-items: center; margin: 15px 0 0; padding: 16px; overflow: hidden; background-color: var(--qrstage); background-image: linear-gradient(rgba(23, 33, 31, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(23, 33, 31, 0.035) 1px, transparent 1px); background-size: 16px 16px; }
#qr-code { display: grid; width: 100%; height: 100%; min-width: 0; min-height: 0; place-items: center; }
#qr-code canvas, #qr-code svg { display: block; width: min(100%, 100%) !important; height: auto !important; max-height: 100%; object-fit: contain; }
.scan-note { display: flex; align-items: center; gap: 8px; margin: 13px 0 17px; color: var(--muted); font-size: 11px; }
.scan-mark { display: grid; width: 17px; height: 17px; place-items: center; border: 1px solid var(--line); color: var(--signal-dark); font-family: var(--mono); font-size: 13px; }
.preview-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 9px; }
.preview-footer > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.privacy-note { display: flex; align-items: center; gap: 8px; margin: 17px 0 0; color: var(--muted); font-size: 11px; }
.privacy-mark { color: #41a976; font-size: 8px; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(1120px, calc(100% - 64px)); min-height: 62px; margin: 0 auto; color: var(--muted); }
.site-footer > span { display: flex; flex-wrap: wrap; gap: 9px; }
.footer-separator { color: #a5ada7; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) { color-scheme: dark; --paper: #111714; --ink: #e8eee9; --muted: #a1ada5; --line: #354139; --panel: #1b241f; --panel-secondary: #161e19; --qrstage: #232323; --grid-line: rgba(215, 231, 220, 0.045); --signal-dark: #b8dd16; --warning: #ff8c7d; --shadow: rgba(0, 0, 0, 0.28); }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; --paper: #111714; --ink: #e8eee9; --muted: #a1ada5; --line: #354139; --panel: #1b241f; --panel-secondary: #161e19; --qrstage: #232323; --grid-line: rgba(215, 231, 220, 0.045); --signal-dark: #b8dd16; --warning: #ff8c7d; --shadow: rgba(0, 0, 0, 0.28); }

@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes underline-outline { 0% { opacity: 1; stroke-dashoffset: 1000; } 16.667% { opacity: 1; stroke-dashoffset: 0; } 16.668% { opacity: 0; stroke-dashoffset: 0; } 100% { opacity: 0; stroke-dashoffset: 0; } }
@media (max-width: 850px) {
    .page-shell { width: min(720px, calc(100% - 40px)); padding-top: 44px; }
    .generator-grid { grid-template-columns: 1fr; gap: 25px; }
    .preview { width: min(100%, 460px); margin: 0 auto; }
    .qr-stage { min-height: 0; }
    .site-footer { width: min(720px, calc(100% - 40px)); }
}
@media (max-width: 520px) {
    .page-shell { width: calc(100% - 28px); padding-top: 32px; }
    .intro { margin-bottom: 21px; }
    .intro-topline { align-items: flex-start; }
    .eyebrow { gap: 7px; font-size: 8px; }
    .eyebrow-line { width: 20px; }
    .theme-button { padding: 6px 8px; font-size: 10px; }
    h1 { max-width: 410px; font-size: 36px; }
    .intro-copy { max-width: 340px; font-size: 14px; line-height: 1.5; }
    .workspace { padding: 20px 16px 16px; }
    .secure-tag { gap: 6px; padding: 6px 7px; font-size: 8px; }
    h2 { font-size: 17px; }
    .preview { padding: 12px; }
    .qr-stage { padding: 12px; }
    .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; width: calc(100% - 28px); padding: 13px 0; font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
    .underline-loop-svg path { animation: none; }
}