:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --text: #19202a;
    --muted: #687386;
    --line: #dfe4ea;
    --brand: #172d50;
    --brand-2: #24456f;
    --focus: #2a6fbb;
    --success: #126b43;
    --success-bg: #eaf7f0;
    --error: #9b2c2c;
    --error-bg: #fff0f0;
    --warning: #755314;
    --warning-bg: #fff7df;
    --radius: 18px;
    --shadow: 0 18px 55px rgba(20, 37, 63, .10);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 0%, rgba(36, 69, 111, .09), transparent 34rem),
        var(--bg);
}

button, input, select, textarea { font: inherit; }

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 44px 0 28px;
}

.site-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--brand-2);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
    margin-bottom: 10px;
    font-size: clamp(2rem, 4vw, 3.25rem);
    line-height: 1.02;
    letter-spacing: -.035em;
}

.site-header p {
    max-width: 720px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1.02rem;
}

.domain-badge {
    flex: 0 0 auto;
    padding: 10px 14px;
    border: 1px solid rgba(23, 45, 80, .15);
    border-radius: 999px;
    color: var(--brand);
    background: rgba(255, 255, 255, .7);
    font-size: .88rem;
    font-weight: 700;
}

.app-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr);
    gap: 24px;
    align-items: start;
}

.panel {
    border: 1px solid rgba(23, 45, 80, .10);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.form-panel { padding: clamp(22px, 4vw, 38px); }
.preview-panel {
    position: sticky;
    top: 20px;
    padding: 30px;
}

.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }

label {
    display: block;
    margin-bottom: 8px;
    font-size: .92rem;
    font-weight: 750;
}

.optional { color: var(--muted); font-weight: 500; }

input, select, textarea {
    width: 100%;
    border: 1px solid #cfd6df;
    border-radius: 11px;
    outline: none;
    background: #fff;
    color: var(--text);
    transition: border-color .16s ease, box-shadow .16s ease;
}

input, select { min-height: 46px; padding: 0 13px; }
textarea { padding: 12px 13px; resize: vertical; }

input:focus, select:focus, textarea:focus {
    border-color: var(--focus);
    box-shadow: 0 0 0 4px rgba(42, 111, 187, .12);
}

input[type="file"] { padding: 8px; }

small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: .8rem;
    line-height: 1.45;
}

.two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 18px;
    font-weight: 600;
}

.check-row input[type="checkbox"] {
    width: 18px;
    min-height: auto;
    height: 18px;
    margin: 0;
}

.divider {
    height: 1px;
    margin: 26px 0;
    background: var(--line);
}

.notice {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: .83rem;
    line-height: 1.45;
}
.notice.warning { color: var(--warning); background: var(--warning-bg); }

.primary-button, .secondary-button, .ghost-button {
    min-height: 48px;
    border-radius: 11px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
}

.primary-button {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    color: #fff;
    background: var(--brand);
    transition: transform .15s ease, background .15s ease, opacity .15s ease;
}

.primary-button:hover { background: var(--brand-2); transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: .72; transform: none; }

.spinner {
    display: none;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.preview-heading h2 { margin-bottom: 18px; font-size: 1.45rem; }

.qr-stage {
    display: grid;
    min-height: 330px;
    place-items: center;
    padding: 22px;
    border: 1px dashed #c7d0dc;
    border-radius: 16px;
    background: #f8fafc;
}

.qr-stage img {
    display: block;
    width: min(100%, 320px);
    height: auto;
    border-radius: 4px;
    box-shadow: 0 8px 30px rgba(20, 37, 63, .08);
}

.placeholder { text-align: center; color: var(--muted); }
.placeholder p { margin: 14px 0 0; font-size: .9rem; }
.placeholder-qr {
    width: 100px;
    height: 100px;
    margin: 0 auto;
    opacity: .16;
    background:
        linear-gradient(90deg, #172d50 16%, transparent 16% 32%, #172d50 32% 48%, transparent 48% 64%, #172d50 64% 80%, transparent 80%),
        linear-gradient(#172d50 16%, transparent 16% 32%, #172d50 32% 48%, transparent 48% 64%, #172d50 64% 80%, transparent 80%);
}

.result-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 15px;
    color: var(--muted);
    font-size: .84rem;
}

.pill {
    padding: 5px 9px;
    border-radius: 999px;
    color: var(--brand);
    background: #edf2f8;
    font-weight: 800;
}

.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.secondary-button, .ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
}

.secondary-button { border: 1px solid var(--brand); color: #fff; background: var(--brand); }
.ghost-button { border: 1px solid #cfd6df; color: var(--brand); background: #fff; }

.status {
    min-height: 0;
    margin-top: 14px;
    border-radius: 10px;
    font-size: .85rem;
    line-height: 1.45;
}
.status:not(:empty) { padding: 10px 12px; background: #f5f7fa; }
.status.success { color: var(--success); background: var(--success-bg); }
.status.error { color: var(--error); background: var(--error-bg); }

.tips {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}
.tips h3 { margin-bottom: 10px; font-size: .98rem; }
.tips ul { margin: 0; padding-left: 19px; color: var(--muted); font-size: .84rem; line-height: 1.65; }

footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 4px 0;
    color: var(--muted);
    font-size: .78rem;
}

[hidden] { display: none !important; }

@media (max-width: 900px) {
    .site-header { align-items: flex-start; flex-direction: column; }
    .app-grid { grid-template-columns: 1fr; }
    .preview-panel { position: static; }
}

@media (max-width: 600px) {
    .page-shell { width: min(100% - 20px, 1180px); padding-top: 24px; }
    .two-cols, .actions { grid-template-columns: 1fr; }
    .form-panel, .preview-panel { padding: 20px; }
    .domain-badge { max-width: 100%; overflow-wrap: anywhere; }
    footer { flex-direction: column; }
}
