:root {
    --bg: #f4f4f4;
    --panel: #ffffff;
    --panel-strong: #efefef;
    --text: #1f1f1f;
    --muted: #666666;
    --accent: #f90;
    --accent-deep: #e08800;
    --border: #dddddd;
    --radius: 0.5rem;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
    --sans:
        "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
}

[data-theme="dark"] {
    --bg: #111111;
    --panel: #282828;
    --panel-strong: #1a1a1a;
    --text: #fff;
    --muted: #999999;
    --accent: #f90;
    --accent-deep: #e08800;
    --border: #333333;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--sans);
    color: var(--text);
    background: var(--bg);
    border-top: 10px solid var(--accent);
    overflow-x: hidden;
}

.theme-toggle {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    padding: 0;
    background: #ddd;
    color: #000;
    cursor: pointer;
    transition:
        background-color 180ms ease,
        color 180ms ease;
}

.theme-toggle:hover {
    background: #000;
    color: #fff;
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

[data-theme="dark"] .theme-toggle {
    background: #555;
    color: #fff;
}

[data-theme="dark"] .theme-toggle:hover {
    background: #fff;
    color: #000;
}

.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    padding: 0;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition:
        background-color 180ms ease,
        opacity 180ms ease,
        transform 180ms ease;
    z-index: 40;
}

.back-to-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--text);
}

.back-to-top svg {
    width: 22px;
    height: 22px;
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
}

.wrap {
    width: min(1120px, calc(100% - 3rem));
    margin: 0 auto;
}

.site-header {
    padding: 0;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0 10px;
}

.site-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.site-kicker {
    color: var(--text);
    font-size: 0.85rem;
    line-height: 1;
}

.site-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.site-title a {
    text-decoration: none;
}

.locale-switcher {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.locale-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    padding: 0;
    background: #ddd;
    color: #000;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition:
        background-color 180ms ease,
        color 180ms ease;
}

.locale-link.active {
    background: var(--accent);
    color: #fff;
}

.locale-link:hover {
    background: #000;
    color: #fff;
}

.locale-link.active:hover {
    background: #000;
    color: #fff;
}

[data-theme="dark"] .locale-link {
    background: #555;
    color: #fff;
}

[data-theme="dark"] .locale-link.active {
    background: var(--accent);
    color: #fff;
}

[data-theme="dark"] .locale-link:hover,
[data-theme="dark"] .locale-link.active:hover {
    background: #fff;
    color: #000;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    align-items: end;
    padding: 0 0 1.5rem;
}

.accent {
    font-family: var(--sans);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    margin: 0;
    letter-spacing: -0.03em;
}

h2 {
    font-size: 1.65rem;
    font-weight: 300;
}

h3 {
    font-size: 1.5rem;
    font-weight: 300;
}

.lead,
.accent-card p {
    color: var(--muted);
}

.footer p {
    color: var(--muted);
}

.lead {
    margin: 1.5rem 0 0;
    color: var(--muted);
    font-size: 1.15rem;
    line-height: 1.25;
}

.card {
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.app-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 24px;
    align-items: stretch;
}

.card {
    padding: 1.75rem;
}

.form-card,
.preview-card {
    height: 100%;
}

.form-card {
    display: flex;
    flex-direction: column;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 1.4rem;
}

.qr-form {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 1.15rem;
}

.input-group {
    display: grid;
    gap: 0.45rem;
}

.label-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

label {
    display: block;
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
}

.info-popover {
    position: relative;
}

.info-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    cursor: pointer;
    list-style: none;
}

.info-trigger::-webkit-details-marker {
    display: none;
}

.info-trigger svg {
    width: 18px;
    height: 18px;
    stroke: var(--text);
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.info-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    width: min(320px, calc(100vw - 3rem));
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--panel);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.5;
}

input,
select {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 0;
    border-radius: 0.5rem;
    background: var(--panel-strong);
    color: var(--text);
    font-size: 1.125rem;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
}

input::placeholder {
    color: var(--muted);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 119, 0, 0.16);
}

input[type="color"] {
    min-height: 54px;
    padding: 0.35rem;
    cursor: pointer;
    background: #ddd;
}

[data-theme="dark"] input[type="color"] {
    background: #353535;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 0;
    border-radius: 0.3rem;
}

.form-actions {
    display: flex;
    justify-content: center;
    margin-top: auto;
    padding-top: 1rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    margin-bottom: 1.25rem;
    padding: 10px 30px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition:
        background-color 180ms ease,
        color 180ms ease,
        transform 180ms ease,
        box-shadow 180ms ease;
}

.button:hover {
}

.primary {
    background: #4caf50;
    color: #fff;
}

.primary:hover {
    background: #3f9643;
}

.secondary {
    background: #007bff;
    color: #fff;
}

.secondary:hover {
    background: #0063cf;
}

.hidden {
    display: none;
}

.preview-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: sticky;
    top: 20px;
}

.preview-card .section-head,
.preview-card .section-head > div {
    width: 100%;
}

.preview-card .section-head {
    justify-content: center;
}

.preview-card .section-head > div {
    text-align: center;
}

.qr-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 420px;
    padding: 0 1.25rem 2rem;
    border-radius: var(--radius);
}

.preview-card.transparent-mode {
    --checker: #eaeaea;
    background-color: #fff;
    background-image:
        linear-gradient(45deg, var(--checker) 25%, transparent 25%),
        linear-gradient(-45deg, var(--checker) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--checker) 75%),
        linear-gradient(-45deg, transparent 75%, var(--checker) 75%);
    background-size: 20px 20px;
    background-position:
        0 0,
        0 10px,
        10px -10px,
        -10px 0px;
}

[data-theme="dark"] .preview-card.transparent-mode {
    color: #000;
}

[data-theme="dark"] .preview-card.transparent-mode h2,
[data-theme="dark"] .preview-card.transparent-mode label {
    color: #000;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    margin-top: -10px;
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    padding: 0;
    min-height: 0;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: var(--panel-strong);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked {
    background: #4caf50;
    border-color: #4caf50;
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.qr-stage .qrcode img,
.qr-stage .qrcode canvas {
    padding: 8px;
    border-radius: 4px;
}

.qrcode {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    overflow: auto;
}

.qrcode img,
.qrcode canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.info-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 24px;
    margin-top: 24px;
}

.accent-card {
    background: var(--panel);
}

.accent {
    display: inline-flex;
    margin-bottom: 1rem;
    color: var(--accent-deep);
}

.teal {
    color: #0c6d71;
}

.tipBody {
    margin: 1rem 0 0;
    font-size: 1.15rem;
}

.tip-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem 0.6rem;
    align-items: baseline;
    color: var(--muted);
}

.tip-num {
    font-family: "DM Mono", monospace;
}

.feature-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem 1.3rem;
    align-items: baseline;
    color: var(--muted);
    font-size: 1.15rem;
    margin: 1rem 0 0;
}

.feature-bullet {
    font-family: "DM Mono", monospace;
}

.footer {
    margin: 2rem 0;
    text-align: center;
}

.footer p {
    margin: 0;
    line-height: 1.55;
}

.nobreak {
    white-space: nowrap;
}

.footer-credit {
    margin-top: 1.5rem !important;
    font-size: 14px;
}

.footer-credit a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
}

.footer-credit a:hover {
    text-decoration: underline;
    text-underline-offset: 0.14em;
}

/* --------------------------------------------------------------------------
   Dark theme fine-tuning
   -------------------------------------------------------------------------- */
[data-theme="dark"] .teal {
    color: #4dd0e1;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus {
    box-shadow: 0 0 0 3px rgba(255, 136, 0, 0.24);
}

[data-theme="dark"] .back-to-top {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .back-to-top:hover {
    background: #f50;
}

@media (max-width: 960px) {
    .locale-switcher {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        position: absolute;
        top: 30px;
        right: 20px;
    }

    .app-shell,
    .info-grid {
        grid-template-columns: 1fr;
    }

    .preview-card {
        position: static;
    }

    .qr-stage {
        min-height: 320px;
    }
}

@media (max-width: 768px) {
    .locale-link:hover {
        background: #ddd;
        color: #000;
    }

    .locale-link.active:hover {
        background: var(--accent);
        color: #fff;
    }

    .theme-toggle:hover {
        background: #ddd;
        color: #000;
    }

    [data-theme="dark"] .locale-link:hover {
        background: #555;
        color: #fff;
    }

    [data-theme="dark"] .locale-link.active:hover {
        background: var(--accent);
        color: #fff;
    }

    [data-theme="dark"] .theme-toggle:hover {
        background: #555;
        color: #fff;
    }

    .back-to-top:hover {
        background: var(--accent);
    }

    [data-theme="dark"] .back-to-top:hover {
        background: var(--accent);
    }
}

@media (max-width: 640px) {
    .wrap {
        width: min(1120px, calc(100% - 2.5rem));
    }

    .site-nav {
        padding-top: 16px;
    }
}

/* --- large screens --- */
@media (min-width: 960px) {
    .site-title {
        font-size: 2.5rem;
    }
}
