:root {
    --bg-top: #f8f1e4;
    --bg-bottom: #efe4d2;
    --paper: rgba(255, 251, 245, 0.92);
    --ink: #1d232f;
    --muted: #677182;
    --line: rgba(29, 35, 47, 0.1);
    --line-strong: rgba(29, 35, 47, 0.16);
    --brand: #c56735;
    --brand-deep: #8f4220;
    --ok: #167e5d;
    --bad: #be4437;
    --idle: #8f7b64;
    --shadow-lg: 0 28px 80px rgba(59, 34, 15, 0.14);
    --shadow-md: 0 18px 36px rgba(59, 34, 15, 0.1);
    --radius-xl: 30px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: "MiSans", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(197, 103, 53, 0.22), transparent 26%),
        radial-gradient(circle at bottom right, rgba(22, 126, 93, 0.12), transparent 24%),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

[hidden] {
    display: none !important;
}

.card-shell {
    min-height: 100vh;
}

.card-main {
    width: min(960px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 60px;
    display: grid;
    gap: 22px;
}

.panel {
    position: relative;
    overflow: hidden;
    padding: 30px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.45);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 252, 247, 0.84)),
        var(--paper);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(14px);
}

.panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.84), rgba(197, 103, 53, 0.12), rgba(255, 255, 255, 0.84));
}

.hero-panel {
    padding-top: 34px;
    background:
        radial-gradient(circle at right top, rgba(197, 103, 53, 0.14), transparent 24%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 249, 242, 0.88));
}

.eyebrow,
.section-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.eyebrow {
    margin-bottom: 16px;
    background: rgba(197, 103, 53, 0.12);
    color: var(--brand-deep);
}

.section-kicker {
    margin-bottom: 16px;
    background: rgba(197, 103, 53, 0.12);
    color: var(--brand-deep);
}

.hero-head,
.panel-head,
.toolbox-head,
.submit-row,
.action-row,
.scanner-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.hero-head {
    align-items: flex-start;
    margin-bottom: 22px;
}

.hero-head h1,
.panel-head h2,
.guide-card h2 {
    margin: 0 0 8px;
    line-height: 1.1;
}

.hero-head h1 {
    font-size: clamp(34px, 4vw, 48px);
    letter-spacing: -0.04em;
}

.panel-head h2,
.guide-card h2 {
    font-size: 28px;
}

.hero-head p,
.panel-head p,
.muted,
.toolbox-tip,
.guide-list,
.validation-text,
.info-strip,
.hero-point span {
    margin: 0;
    color: var(--muted);
    line-height: 1.75;
}

.hero-link {
    flex: none;
}

.hero-points,
.guide-grid,
.form-grid,
.info-strip {
    display: grid;
    gap: 14px;
}

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

.hero-point,
.guide-card,
.toolbox {
    padding: 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow-md);
}

.hero-point {
    display: grid;
    gap: 8px;
}

.hero-point strong,
.toolbox-title {
    font-size: 15px;
    font-weight: 700;
}

.panel-step {
    scroll-margin-top: 18px;
}

.panel-head {
    align-items: flex-start;
    margin-bottom: 20px;
}

.state-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.state-ok {
    color: var(--ok);
    background: rgba(22, 126, 93, 0.14);
}

.state-bad {
    color: var(--bad);
    background: rgba(190, 68, 55, 0.14);
}

.state-idle {
    color: var(--idle);
    background: rgba(143, 123, 100, 0.14);
}

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

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

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

.field span {
    font-size: 14px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    padding: 14px 15px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    color: var(--ink);
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(197, 103, 53, 0.66);
    box-shadow: 0 0 0 4px rgba(197, 103, 53, 0.12);
}

input[readonly] {
    color: #59606e;
    background: rgba(247, 243, 236, 0.9);
}

.validation-text {
    min-height: 52px;
    padding: 14px 15px;
    border-radius: 16px;
    border: 1px dashed rgba(29, 35, 47, 0.14);
    background: rgba(255, 248, 238, 0.92);
}

.info-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 18px;
}

.info-strip div {
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(248, 241, 229, 0.85);
    border: 1px solid rgba(29, 35, 47, 0.06);
}

.toolbox {
    margin-top: 18px;
    background:
        radial-gradient(circle at right top, rgba(197, 103, 53, 0.12), transparent 28%),
        rgba(255, 251, 246, 0.88);
}

.toolbox-head {
    align-items: flex-start;
    margin-bottom: 16px;
}

.submit-row {
    margin-top: 12px;
}

.btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0 20px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, filter 0.18s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    filter: saturate(0.8);
    transform: none;
    box-shadow: none;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-deep));
    box-shadow: 0 14px 28px rgba(143, 66, 32, 0.22);
}

.btn-secondary {
    color: var(--ink);
    background: #efe3d2;
}

.guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.guide-card {
    display: grid;
    gap: 14px;
}

.guide-list {
    padding-left: 20px;
}

.guide-list li + li {
    margin-top: 12px;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 60;
    max-width: min(420px, calc(100vw - 32px));
    padding: 14px 18px;
    border-radius: 16px;
    color: #fff;
    box-shadow: 0 24px 50px rgba(18, 20, 24, 0.24);
}

.toast-info,
.toast-success {
    background: #1b7d62;
}

.toast-error {
    background: #bc4034;
}

.scanner-modal {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(12, 12, 16, 0.72);
    backdrop-filter: blur(14px);
}

.scanner-card {
    width: min(760px, 100%);
    padding: 22px;
    border-radius: 28px;
    background: linear-gradient(180deg, #11151d, #171d26);
    color: #fff;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
}

.scanner-head {
    margin-bottom: 16px;
}

.scanner-stage {
    position: relative;
    border-radius: 22px;
    overflow: hidden;
    background: #090b0e;
}

#scannerVideo {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.scanner-focus {
    position: absolute;
    inset: 50%;
    width: min(56vw, 260px);
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    border-radius: 24px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.24);
}

.mobile-dock {
    display: none;
}

@media (max-width: 900px) {
    .card-main {
        width: calc(100% - 24px);
        padding: 18px 0 24px;
        gap: 18px;
    }

    .panel {
        padding: 22px 18px;
        border-radius: 26px;
    }

    .hero-head,
    .panel-head,
    .toolbox-head,
    .action-row,
    .submit-row {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-points,
    .guide-grid,
    .form-grid,
    .info-strip,
    .action-row,
    .submit-row {
        grid-template-columns: 1fr;
    }

    .action-row,
    .submit-row {
        display: grid;
        width: 100%;
    }

    .action-row .btn,
    .submit-row .btn,
    .submit-row a,
    .hero-link {
        width: 100%;
    }

    .toast {
        right: 12px;
        bottom: 12px;
        left: 12px;
        max-width: none;
    }

    .scanner-modal {
        align-items: end;
        padding: 12px;
        padding-bottom: calc(12px + var(--safe-bottom));
    }

    .scanner-card {
        width: 100%;
        padding: 18px;
        border-radius: 28px;
    }
}

@media (max-width: 640px) {
    .hero-head h1,
    .panel-head h2,
    .guide-card h2 {
        font-size: 24px;
    }

    .scanner-focus {
        width: min(72vw, 240px);
    }
}
