:root {
    --bg: #140804;
    --panel: rgba(28, 12, 8, 0.86);
    --line: rgba(232, 92, 42, 0.38);
    --rust: #e85c2a;
    --ember: #ff8a3d;
    --sand: #f3d2b0;
    --text: #f7ece2;
    --muted: #c9b09a;
    --ok: #8fd39a;
    --err: #ff7a6b;
    --issued: #8fd39a;
    --pending: #ffb347;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
}

.bg {
    position: fixed;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(18, 4, 2, 0.42) 0%, rgba(18, 4, 2, 0.78) 58%, #120402 100%),
        url("/assets/hero.jpg") center top / cover no-repeat;
    z-index: -2;
}

.scan {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        180deg,
        transparent 0,
        transparent 3px,
        rgba(0, 0, 0, 0.08) 4px
    );
    z-index: -1;
}

.wrap {
    width: min(920px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0 80px;
}

.hero { margin-bottom: 22px; }
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--rust);
    color: var(--ember);
    font-size: 11px;
    letter-spacing: 0.08em;
    background: rgba(0, 0, 0, 0.35);
}
.brand-name {
    font-size: 18px;
    letter-spacing: 0.12em;
    color: var(--sand);
}
.tag {
    letter-spacing: 0.18em;
    color: var(--ember);
    font-size: 12px;
    margin: 0 0 10px;
}
h1 {
    margin: 0 0 8px;
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 800;
    text-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}
.sub { margin: 0; color: var(--muted); }

.intro { margin-bottom: 18px; }
.intro h2,
.card h2 {
    margin: 0 0 12px;
    font-size: 18px;
}
.intro p {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
    font-size: 14px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 24px;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(8px);
    clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

.hint {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    background: rgba(232, 92, 42, 0.14);
    border: 1px solid rgba(232, 92, 42, 0.38);
    color: var(--sand);
    margin-bottom: 18px;
    line-height: 1.5;
}
.hint strong {
    color: var(--ember);
    white-space: nowrap;
}

.alert {
    padding: 12px 14px;
    margin-bottom: 16px;
    border-left: 3px solid transparent;
}
.alert.ok {
    background: rgba(143, 211, 154, 0.12);
    border-left-color: var(--ok);
    color: var(--ok);
}
.alert.err {
    background: rgba(255, 122, 107, 0.12);
    border-left-color: var(--err);
    color: var(--err);
}

form { display: grid; gap: 18px; }
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.field span, .gift-legend {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.08em;
}
input[type="text"] {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid rgba(243, 210, 176, 0.16);
    background: rgba(10, 4, 2, 0.72);
    color: var(--text);
    outline: none;
}
input[type="text"]:focus {
    border-color: var(--rust);
    box-shadow: 0 0 0 3px rgba(232, 92, 42, 0.18);
}

.gift-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.gift-card { cursor: pointer; }
.gift-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.gift-face {
    min-height: 132px;
    padding: 16px;
    border: 1px solid rgba(243, 210, 176, 0.16);
    background:
        linear-gradient(135deg, rgba(232, 92, 42, 0.08), rgba(10, 4, 2, 0.7)),
        repeating-linear-gradient(135deg, transparent 0 10px, rgba(255,255,255,0.015) 10px 12px);
    display: grid;
    align-content: start;
    gap: 6px;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.gift-code {
    font-size: 11px;
    letter-spacing: 0.16em;
    color: var(--ember);
}
.gift-face strong {
    font-size: 22px;
}
.gift-face em {
    font-style: normal;
    color: var(--muted);
    font-size: 13px;
}
.gift-face b {
    margin-top: 8px;
    width: fit-content;
    font-size: 12px;
    padding: 3px 8px;
    border: 1px solid rgba(232, 92, 42, 0.4);
    color: var(--sand);
    font-weight: 600;
}
.gift-card:hover .gift-face,
.gift-card input:focus-visible + .gift-face {
    border-color: var(--ember);
}
.gift-card input:checked + .gift-face {
    border-color: var(--rust);
    box-shadow: inset 0 0 0 1px var(--rust), 0 10px 24px rgba(232, 92, 42, 0.18);
    background:
        linear-gradient(135deg, rgba(232, 92, 42, 0.22), rgba(10, 4, 2, 0.72));
}

button {
    height: 50px;
    border: 0;
    background: linear-gradient(180deg, #ff7a3a 0%, #c63a16 100%);
    color: #1a0804;
    font-weight: 800;
    letter-spacing: 0.18em;
    cursor: pointer;
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
button:hover { filter: brightness(1.08); }

.list { margin-top: 18px; }
.list-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 14px;
}
.list h2 { margin: 0; font-size: 18px; }
.list-note { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); margin: 0; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td {
    text-align: left;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 14px;
    white-space: nowrap;
}
th { color: var(--muted); font-weight: 500; }

.status {
    display: inline-flex;
    align-items: center;
    min-width: 68px;
    justify-content: center;
    padding: 4px 10px;
    font-size: 12px;
    letter-spacing: 0.08em;
    border: 1px solid currentColor;
}
.status.issued { color: var(--issued); background: rgba(143, 211, 154, 0.12); }
.status.pending { color: var(--pending); background: rgba(255, 179, 71, 0.12); }

.record-cards { display: none; }
.record {
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.record-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.record p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.site-footer {
    margin-top: 22px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
}
.site-footer p { margin: 0; }
.site-footer a {
    color: var(--sand);
    text-decoration: none;
}

@media (max-width: 760px) {
    .wrap { width: min(100% - 20px, 920px); padding: 22px 0 48px; }
    .grid, .gift-cards { grid-template-columns: 1fr; }
    .card { padding: 18px 16px; }
    .hint { flex-direction: column; gap: 4px; }
    .list-head { flex-direction: column; align-items: flex-start; }
    .table-scroll { display: none; }
    .record-cards { display: block; }
    button { letter-spacing: 0.12em; }
}

@media (min-width: 761px) {
    .record-cards { display: none; }
}
