:root {
    --red-900: #7b0f13;
    --red-700: #bd1b22;
    --red-500: #ec3b2f;
    --gold-500: #ffd268;
    --gold-700: #bb7615;
    --cream: #fff7e7;
    --paper: #fffdf7;
    --ink: #311111;
    --muted: #8d665b;
    --line: rgba(91, 21, 13, .16);
    --shadow: 0 28px 70px rgba(82, 0, 0, .35);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
    background:
        radial-gradient(circle at 12% 10%, rgba(255, 231, 143, .58), transparent 28%),
        radial-gradient(circle at 88% 18%, rgba(255, 128, 72, .42), transparent 24%),
        linear-gradient(145deg, #95151b 0%, #e3322c 52%, #6f1016 100%);
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.shell {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 24px 18px 44px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0 22px;
    color: #fff2ce;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-weight: 900;
}

.brand-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 8px;
    color: #7a2800;
    background: linear-gradient(180deg, #fff1a7, var(--gold-500));
    box-shadow: 0 8px 20px rgba(74, 0, 0, .25);
}

.nav-link {
    color: #fff2ce;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 242, 206, .5);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 410px);
    gap: 30px;
    align-items: center;
    min-height: calc(100vh - 120px);
}

.hero-copy {
    color: white;
}

.hero-copy h1 {
    margin: 0;
    max-width: 720px;
    font-size: clamp(42px, 8vw, 92px);
    line-height: .94;
    letter-spacing: 0;
    text-shadow: 0 10px 30px rgba(54, 0, 0, .32);
}

.hero-copy p {
    max-width: 620px;
    margin: 20px 0 0;
    color: #ffe5b0;
    font-size: clamp(16px, 2.3vw, 20px);
    line-height: 1.75;
}

.status-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
}

.pill {
    padding: 10px 13px;
    border: 1px solid rgba(255, 235, 187, .35);
    border-radius: 8px;
    color: #fff5d6;
    background: rgba(80, 0, 0, .16);
    backdrop-filter: blur(8px);
}

.packet {
    position: relative;
    overflow: hidden;
    min-height: 530px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 8px;
    background: linear-gradient(180deg, #ff6048 0%, #d9242a 48%, #901419 100%);
    box-shadow: var(--shadow);
}

.packet::before {
    content: "";
    position: absolute;
    inset: -85px -52px auto;
    height: 245px;
    border-radius: 0 0 50% 50%;
    background: rgba(255, 211, 106, .2);
}

.packet::after {
    content: "";
    position: absolute;
    left: -18%;
    right: -18%;
    bottom: -170px;
    height: 310px;
    border-radius: 50% 50% 0 0;
    background: rgba(88, 0, 0, .18);
}

.packet-content {
    position: relative;
    z-index: 1;
    min-height: 530px;
    display: grid;
    align-content: center;
    gap: 18px;
    padding: 34px 28px;
    text-align: center;
    color: white;
}

.coin {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #8a3900;
    font-size: 50px;
    font-weight: 900;
    background: radial-gradient(circle at 35% 25%, #fff6c7, #fac04d 64%, #b86f12);
    box-shadow: inset 0 8px 22px rgba(255, 255, 255, .45), 0 18px 38px rgba(80, 0, 0, .3);
}

.packet h2 {
    margin: 8px 0 0;
    font-size: clamp(26px, 6vw, 36px);
}

.packet-note {
    margin: 0;
    color: #ffe6bd;
    line-height: 1.65;
}

.primary-btn {
    width: 100%;
    min-height: 58px;
    border: 0;
    border-radius: 8px;
    padding: 15px 18px;
    color: #68140f;
    font-size: 18px;
    font-weight: 900;
    background: linear-gradient(180deg, #fff0a6, var(--gold-500));
    box-shadow: 0 12px 0 var(--gold-700), 0 22px 38px rgba(66, 0, 0, .26);
}

.primary-btn:active {
    transform: translateY(4px);
    box-shadow: 0 8px 0 var(--gold-700), 0 16px 28px rgba(66, 0, 0, .24);
}

.primary-btn:disabled {
    cursor: wait;
    opacity: .7;
}

.result-card {
    min-height: 112px;
    padding: 14px;
    border-radius: 8px;
    color: var(--ink);
    text-align: left;
    background: var(--paper);
}

.result-card strong {
    display: block;
    margin-bottom: 9px;
    color: var(--red-900);
}

.result-card span {
    color: var(--muted);
    line-height: 1.55;
}

.code-box {
    display: block;
    margin-top: 8px;
    padding: 12px;
    border: 1px dashed #c99b45;
    border-radius: 6px;
    background: #fffdf7;
    color: #2b1510;
    font-family: Consolas, "Courier New", monospace;
    font-size: 16px;
    line-height: 1.5;
    word-break: break-all;
}

.admin-page {
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(255, 248, 231, .98), rgba(255, 242, 219, .94)),
        linear-gradient(145deg, #95151b, #e3322c);
}

.admin-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    background: rgba(255, 253, 247, .94);
    box-shadow: 0 18px 45px rgba(128, 48, 18, .12);
}

.panel h1,
.panel h2 {
    margin: 0 0 14px;
}

.panel p {
    color: var(--muted);
    line-height: 1.65;
}

.field {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.field label {
    font-weight: 800;
}

.input,
.textarea {
    width: 100%;
    border: 1px solid #e0c7a1;
    border-radius: 8px;
    padding: 12px;
    color: var(--ink);
    background: white;
}

.textarea {
    min-height: 320px;
    resize: vertical;
    font-family: Consolas, "Courier New", monospace;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat {
    padding: 16px;
    border-radius: 8px;
    background: #fff1d7;
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.stat b {
    display: block;
    margin-top: 4px;
    font-size: 30px;
}

.message {
    margin-top: 14px;
    padding: 12px;
    border-radius: 8px;
    color: #65120f;
    background: #ffe4d8;
}

.message.ok {
    color: #20512a;
    background: #e6f7dd;
}

.hidden {
    display: none !important;
}

@media (max-width: 860px) {
    .hero,
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
        padding-top: 14px;
    }

    .packet,
    .packet-content {
        min-height: 470px;
    }
}

@media (max-width: 560px) {
    .shell {
        padding: 16px 12px 32px;
    }

    .topbar {
        padding-bottom: 14px;
    }

    .brand span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .hero-copy h1 {
        font-size: 44px;
    }

    .packet-content {
        padding: 28px 18px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 18px;
    }
}
