:root {
    --color-bg-top: #f31d34;
    --color-bg-mid: #ff5b3c;
    --color-bg-bottom: #ffe0ae;
    --color-panel: rgba(255, 255, 255, 0.92);
    --color-text: #74270f;
    --color-text-soft: #9b5e45;
    --color-primary: #ee2434;
    --color-accent-strong: #ffb833;
    --color-line: #ffd2aa;
    --shadow-panel: 0 16px 34px rgba(182, 22, 34, 0.18);
    --shadow-wheel: 0 18px 38px rgba(148, 13, 23, 0.3);
    --radius-xl: 24px;
    --radius-pill: 999px;
    --font-display: "YouSheBiaoTiHei", "STHeiti", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    --font-body: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    --duration-base: 240ms;
    --ease-base: cubic-bezier(0.2, 0.8, 0.2, 1);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
}

html {
    background: linear-gradient(180deg, #eb1830 0%, #ff603e 38%, #ffe3b6 100%);
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--color-text);
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.28) 0 12%, transparent 30%),
        linear-gradient(180deg, var(--color-bg-top) 0%, var(--color-bg-mid) 38%, var(--color-bg-bottom) 100%);
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

.page {
    width: min(100%, 430px);
    min-height: 100vh;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.page::before,
.page::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.page::before {
    opacity: 0.52;
    background:
        radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.4) 0 2px, transparent 3px),
        radial-gradient(circle at 86% 12%, rgba(255, 255, 255, 0.42) 0 2px, transparent 4px),
        radial-gradient(circle at 15% 44%, rgba(255, 255, 255, 0.38) 0 2px, transparent 4px),
        radial-gradient(circle at 84% 40%, rgba(255, 255, 255, 0.32) 0 3px, transparent 5px),
        repeating-conic-gradient(from -18deg at 50% 18%, rgba(255, 255, 255, 0.24) 0 1deg, transparent 1.2deg 13deg);
}

.page::after {
    background:
        radial-gradient(circle at 50% 16%, rgba(255, 255, 255, 0.22), transparent 32%),
        linear-gradient(180deg, transparent 0%, transparent 60%, rgba(255, 196, 123, 0.18) 100%);
}

.hero {
    position: relative;
    z-index: 1;
    padding: 18px 16px 0;
    min-height: 250px;
    text-align: center;
}

.hero-decor {
    position: absolute;
    user-select: none;
    filter: drop-shadow(0 10px 12px rgba(130, 0, 0, 0.18));
    animation: float-decor 3.2s ease-in-out infinite;
}

.hero-decor.left {
    left: 14px;
    bottom: 18px;
    font-size: 46px;
}

.hero-decor.right {
    right: 16px;
    top: 56px;
    font-size: 42px;
    animation-delay: 0.8s;
}

.hero-coin {
    position: absolute;
    font-size: 24px;
    user-select: none;
    filter: drop-shadow(0 6px 8px rgba(130, 0, 0, 0.16));
    animation: coin-glow 2.6s ease-in-out infinite;
}

.hero-coin.one {
    left: 40px;
    top: 94px;
}

.hero-coin.two {
    right: 38px;
    bottom: 36px;
    animation-delay: 1.1s;
}

.hero-mark {
    position: relative;
    z-index: 2;
    display: inline-block;
    margin-top: 10px;
}

.hero-title {
    margin: 0;
    line-height: 0.9;
    letter-spacing: 2px;
    font-family: var(--font-display);
    font-weight: 900;
    color: #fff9d4;
    text-shadow: 0 4px 0 #e24b20, 0 8px 0 #b40f18, 0 18px 24px rgba(107, 0, 0, 0.3);
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.42);
}

.hero-title span {
    display: block;
}

.hero-title .small {
    font-size: clamp(54px, 15vw, 72px);
}

.hero-title .large {
    font-size: clamp(58px, 16vw, 80px);
}

.hero-ribbon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 252px;
    margin-top: 18px;
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    background: linear-gradient(180deg, #fff1aa, #ffd56c);
    color: #b53214;
    font-weight: 800;
    font-size: 16px;
    box-shadow: 0 10px 18px rgba(182, 26, 16, 0.18);
}

.hero-note {
    margin: 16px auto 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 16px;
    border-radius: var(--radius-pill);
    background: rgba(130, 0, 16, 0.18);
    color: rgba(255, 255, 255, 0.96);
    font-size: 13px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.wheel-section {
    position: relative;
    z-index: 1;
    padding: 0 16px 16px;
}

.wheel-stage {
    position: relative;
    width: min(92vw, 382px);
    aspect-ratio: 1;
    margin: 0 auto;
    display: grid;
    place-items: center;
}

.wheel-stand {
    position: absolute;
    bottom: -16px;
    width: 52%;
    height: 42px;
    border-radius: 0 0 70% 70%;
    background: linear-gradient(180deg, #cb1c1e, #7d080d);
    clip-path: polygon(16% 0, 84% 0, 100% 100%, 0 100%);
    z-index: 0;
}

.pointer {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 70px;
    overflow: visible;
    z-index: 6;
    pointer-events: none;
    filter: drop-shadow(0 5px 10px rgba(140, 60, 0, 0.55)) drop-shadow(0 2px 3px rgba(180, 80, 0, 0.4));
}

.wheel-shell {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 16px;
    border-radius: 50%;
    background:
        radial-gradient(circle, transparent 64%, rgba(255, 248, 205, 0.18) 64.4% 68%, transparent 68.4%),
        repeating-conic-gradient(from 0deg, #fff1a8 0 4deg, #ed272f 4deg 12deg),
        linear-gradient(145deg, #ff4034, #c5001a);
    box-shadow: var(--shadow-wheel), inset 0 0 0 4px #ffb734, inset 0 0 0 10px #d60d1b;
    z-index: 1;
}

.wheel-shell::before {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, #ffe984 0 4deg, transparent 4deg 12deg);
    mask: radial-gradient(circle, transparent 0 82%, #000 83% 100%);
    opacity: 0.9;
    pointer-events: none;
}

.light-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
}

.wheel-core {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.2), transparent 56%);
}

.wheel-core::after {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 2px rgba(146, 54, 6, 0.1);
    pointer-events: none;
}

#wheel-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    pointer-events: none;
}

.spin-btn {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 7;
    transform: translate(-50%, -50%);
    width: 58px;
    height: 58px;
    border-radius: 50%;
    color: #fff9e0;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 2px;
    background: radial-gradient(circle at 38% 28%, #ff8050 0%, #e82030 48%, #a80018 100%);
    box-shadow:
        0 0 0 4px #ffd740,
        0 0 0 8px rgba(255, 175, 0, 0.5),
        0 14px 28px rgba(130, 0, 0, 0.38),
        inset 0 -5px 0 rgba(90, 0, 0, 0.28),
        inset 0 3px 0 rgba(255, 255, 255, 0.48);
    text-shadow: 0 2px 5px rgba(100, 0, 0, 0.45);
    transition: transform var(--duration-base) var(--ease-base), box-shadow var(--duration-base) var(--ease-base), opacity var(--duration-base) var(--ease-base);
}

.spin-btn:hover {
    transform: translate(-50%, -50%) scale(1.03);
}

.spin-btn:active {
    transform: translate(-50%, -50%) scale(0.97);
}

.spin-btn:disabled {
    opacity: 0.85;
    cursor: not-allowed;
}

.btn-pulse {
    animation: pulse-glow 1.8s infinite ease-in-out;
}

.action-row {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 12px;
    margin: 18px 18px 0;
}

.status-pill,
.action-pill {
    min-height: 54px;
    border-radius: 16px;
    border: 2px solid rgba(255, 173, 117, 0.75);
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 8px 18px rgba(255, 89, 41, 0.16);
    backdrop-filter: blur(4px);
}

.status-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 14px;
    color: #8c2c12;
    font-weight: 900;
    font-size: 15px;
}

.status-pill strong {
    display: block;
    font-size: 17px;
    color: var(--color-primary);
}

.status-pill small {
    display: block;
    color: var(--color-text-soft);
    font-weight: 700;
    font-size: 11px;
    margin-top: 2px;
}

.status-badge {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-pill);
    color: #fff;
    background: linear-gradient(180deg, #ff6c48, #e81c2f);
    box-shadow: inset 0 -2px 0 rgba(112, 0, 0, 0.18);
}

.action-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #8c2c12;
    font-weight: 900;
    font-size: 15px;
    transition: transform var(--duration-base) var(--ease-base), box-shadow var(--duration-base) var(--ease-base);
}

.action-pill:hover,
.primary-btn:hover,
.ghost-btn:hover,
.single-btn:hover {
    transform: translateY(-1px);
}

.content {
    position: relative;
    z-index: 1;
    padding: 8px 14px calc(20px + var(--safe-bottom));
}

.section {
    position: relative;
    margin-top: 18px;
    padding: 20px 14px 16px;
    background: var(--color-panel);
    border: 2px solid rgba(255, 118, 82, 0.36);
    border-radius: 18px;
    box-shadow: var(--shadow-panel);
}

.section-title {
    position: absolute;
    left: 50%;
    top: -2px;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 182px;
    height: 44px;
    padding: 0 24px;
    border-radius: 0 0 18px 18px;
    background: linear-gradient(180deg, #ff9a37 0%, #f03134 58%, #d21422 100%);
    box-shadow: 0 8px 16px rgba(191, 0, 13, 0.22);
    color: #fff;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 1px;
}

.section-title::before,
.section-title::after {
    content: "";
    position: absolute;
    top: 0;
    width: 18px;
    height: 18px;
    background: #d21422;
}

.section-title::before {
    left: -17px;
    clip-path: polygon(100% 0, 100% 100%, 0 0);
}

.section-title::after {
    right: -17px;
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

.section-body {
    margin-top: 34px;
}

.prize-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.prize-card {
    min-height: 112px;
    padding: 10px 6px 8px;
    border: 1.5px solid var(--color-line);
    border-radius: 12px;
    background: linear-gradient(180deg, #fff, #fff8f1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.prize-card-media {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #fff1e5;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 195, 151, 0.4);
}

.prize-card-media img,
.win-media img,
.prize-card-media svg,
.win-media svg {
    width: 100%;
    height: 100%;
    display: block;
}

.prize-card strong {
    font-size: 13px;
    line-height: 1.2;
    color: #61270e;
    text-align: center;
}

.prize-card span {
    font-size: 11px;
    color: var(--color-text-soft);
    text-align: center;
}

.prize-rank-tag,
.prize-card .prize-rank-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #c0111d, #d4360a);
    padding: 2px 8px;
    border-radius: 100px;
    line-height: 1.5;
    text-align: center;
    letter-spacing: 0.03em;
}

.info-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px 9px 14px;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, #fff2d6, #fff);
    box-shadow: inset 0 0 0 1px rgba(255, 203, 140, 0.55);
    color: #a63614;
    font-size: 20px;
    font-weight: 900;
}

.rules,
.meta-list {
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.rules li,
.meta-list li {
    position: relative;
    padding-left: 18px;
    color: #5f4034;
    font-size: 14px;
    line-height: 1.85;
}

.rules li::before,
.meta-list li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ff7442;
}

.time-table {
    width: 100%;
    margin-top: 12px;
    border-collapse: collapse;
    color: #5f4034;
    font-size: 14px;
    line-height: 1.75;
}

.time-table td {
    padding: 4px 0;
    vertical-align: top;
}

.time-table td:last-child {
    text-align: right;
    color: #6b3019;
    font-weight: 800;
}

.footer {
    padding: 18px 0 6px;
    text-align: center;
    color: rgba(255, 255, 255, 0.95);
    font-size: 12px;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(65, 0, 0, 0.56);
    backdrop-filter: blur(6px);
}

.modal.show {
    display: flex;
}

.modal-card {
    width: min(100%, 340px);
    border-radius: var(--radius-xl);
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.26);
    animation: pop-in 220ms ease-out;
    overflow: hidden;
}

.input-card {
    padding: 24px 20px 20px;
    background: linear-gradient(180deg, #fffdf8, #fff0dc);
    text-align: center;
}

.input-card h3,
.win-card h3 {
    margin: 0;
    font-family: var(--font-display);
    color: #dd1d28;
}

.input-card h3 {
    font-size: 26px;
}

.input-card p {
    margin: 10px 0 18px;
    color: var(--color-text-soft);
    font-size: 13px;
    line-height: 1.7;
}

.code-field {
    width: 100%;
    min-height: 50px;
    border: 2px solid #ffd1aa;
    border-radius: 16px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.82);
    color: #6d2610;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 4px;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    transition: border-color var(--duration-base) var(--ease-base), box-shadow var(--duration-base) var(--ease-base);
}

.code-field:focus {
    border-color: var(--color-accent-strong);
    box-shadow: 0 0 0 4px rgba(255, 194, 86, 0.18);
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.primary-btn,
.ghost-btn,
.single-btn {
    min-height: 46px;
    border-radius: var(--radius-pill);
    font-weight: 900;
    transition: transform var(--duration-base) var(--ease-base), box-shadow var(--duration-base) var(--ease-base);
}

.primary-btn,
.single-btn {
    color: #fff;
    background: linear-gradient(180deg, #ff7b45, #e7192b);
    box-shadow: 0 8px 18px rgba(206, 24, 34, 0.25);
}

.ghost-btn {
    color: #a63614;
    background: #fff;
    border: 1.5px solid #ffc397;
}

.win-card {
    background: #fff;
}

.win-head {
    padding: 26px 18px 18px;
    background: linear-gradient(180deg, #eb4a43, #c93032);
    color: #fff;
    text-align: center;
    position: relative;
}

.win-head::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, rgba(255, 215, 117, 0.75), rgba(255, 255, 255, 0.22), rgba(255, 215, 117, 0.75));
}

.win-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    background: #ffd64f;
    color: #b93517;
    font-size: 11px;
    font-weight: 900;
}

.win-head h3 {
    margin-top: 12px;
    font-size: 32px;
    line-height: 1;
    color: #ffe58b;
    text-shadow: 0 3px 10px rgba(108, 0, 0, 0.24);
}

.win-head small {
    display: block;
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 1px;
}

.win-body {
    padding: 22px 24px 24px;
    text-align: center;
}

.win-tag {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
    color: #d0302b;
    background: #fff0f0;
    font-size: 12px;
    font-weight: 900;
}

.win-body h4 {
    margin: 12px 0 0;
    font-size: 22px;
    line-height: 1.4;
    color: #c91c28;
}

.win-media {
    width: 128px;
    height: 128px;
    margin: 16px auto;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #fffdfa, #fff3e1);
    border: 2px solid #ffd0a7;
    box-shadow: inset 0 0 0 1px rgba(255, 198, 129, 0.4);
    overflow: hidden;
}

.win-body p {
    margin: 0;
    color: #8c6552;
    font-size: 13px;
    line-height: 1.8;
}

.single-btn {
    width: 100%;
    margin-top: 18px;
}

.hidden {
    display: none !important;
}

@keyframes pop-in {
    from {
        transform: scale(0.92);
        opacity: 0.5;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow:
            0 0 0 4px #ffd740,
            0 0 0 8px rgba(255, 175, 0, 0.5),
            0 0 0 15px rgba(255, 120, 0, 0.14),
            0 14px 28px rgba(130, 0, 0, 0.38),
            inset 0 -5px 0 rgba(90, 0, 0, 0.28),
            inset 0 3px 0 rgba(255, 255, 255, 0.48);
    }
    50% {
        box-shadow:
            0 0 0 5px #fff066,
            0 0 0 12px rgba(255, 205, 0, 0.72),
            0 0 0 24px rgba(255, 130, 0, 0.22),
            0 16px 32px rgba(130, 0, 0, 0.48),
            inset 0 -5px 0 rgba(90, 0, 0, 0.28),
            inset 0 3px 0 rgba(255, 255, 255, 0.48);
    }
}

@keyframes float-decor {
    0%, 100% {
        transform: translateY(0) rotate(var(--decor-rotate, 0deg));
    }
    50% {
        transform: translateY(-8px) rotate(calc(var(--decor-rotate, 0deg) + 2deg));
    }
}

@keyframes coin-glow {
    0%, 100% {
        opacity: 0.72;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.12);
    }
}

@media (max-width: 380px) {
    .hero-title .small {
        font-size: 48px;
    }

    .hero-title .large {
        font-size: 52px;
    }

    .hero-ribbon {
        min-width: 220px;
        font-size: 14px;
    }

    .action-row {
        grid-template-columns: 1fr;
    }

    .prize-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .spin-btn {
        width: 78px;
        height: 78px;
        font-size: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
