* {
    box-sizing: border-box;
}

:root {
    --theme: #ff6ba5;
    --accent: #65d6ff;
    --ink: #22233d;
    --muted: #6f7191;
    --paper: rgba(255, 255, 255, 0.84);
    --line: rgba(85, 82, 129, 0.16);
    --shadow: 0 24px 80px rgba(71, 54, 105, 0.22);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
    background:
        radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 26%),
        radial-gradient(circle at 82% 18%, color-mix(in srgb, var(--theme) 28%, transparent), transparent 24%),
        linear-gradient(135deg, #fff7fb 0%, #edf8ff 46%, #fffaf0 100%);
    overflow-x: hidden;
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -2;
    content: "";
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.48) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.48) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: linear-gradient(to bottom, black, transparent 88%);
}

body.mode-starry {
    background:
        radial-gradient(circle at 22% 16%, rgba(255, 255, 255, 0.28), transparent 20%),
        radial-gradient(circle at 78% 10%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 24%),
        linear-gradient(135deg, #252850 0%, #4b4f87 52%, #f7b2cf 100%);
    color: #fff;
}

body.mode-starry .lottery-shell,
body.mode-starry .side-panel,
body.mode-starry .draw-panel {
    background: rgba(255, 255, 255, 0.86);
    color: var(--ink);
}

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

a {
    color: inherit;
}

.stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 28px;
}

.lottery-shell {
    width: min(1180px, 100%);
    padding: clamp(18px, 3vw, 32px);
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.68);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--theme);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 4.7rem);
    line-height: 1;
    letter-spacing: 0;
    text-shadow: 0 8px 0 rgba(255, 255, 255, 0.72);
}

.subtitle {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.25rem);
}

.admin-link {
    flex: 0 0 auto;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(73, 66, 107, 0.16);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.72fr);
    gap: 20px;
}

.draw-panel,
.side-panel {
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.66);
    box-shadow: 0 18px 50px rgba(93, 77, 130, 0.14);
}

.draw-panel {
    position: relative;
    min-height: 560px;
    padding: clamp(18px, 4vw, 36px);
    overflow: hidden;
}

.draw-panel::before {
    position: absolute;
    inset: auto -10% -28% 32%;
    height: 260px;
    content: "";
    background:
        radial-gradient(ellipse at 18% 56%, rgba(255, 255, 255, 0.95) 0 18%, transparent 19%),
        radial-gradient(ellipse at 38% 42%, rgba(255, 255, 255, 0.95) 0 24%, transparent 25%),
        radial-gradient(ellipse at 60% 54%, rgba(255, 255, 255, 0.95) 0 20%, transparent 21%),
        radial-gradient(ellipse at 80% 48%, rgba(255, 255, 255, 0.95) 0 17%, transparent 18%);
    opacity: 0.78;
    filter: blur(1px);
}

.mascot-card {
    position: absolute;
    right: clamp(16px, 4vw, 52px);
    bottom: clamp(10px, 3vw, 28px);
    width: min(270px, 38vw);
    aspect-ratio: 1;
    pointer-events: none;
}

.mascot-img {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    animation: floatFace 4.8s ease-in-out infinite;
    object-fit: contain;
}

.cloud {
    position: absolute;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    filter: blur(0.3px);
}

.cloud-a {
    right: 8%;
    bottom: 9%;
    width: 72%;
    height: 22%;
}

.cloud-b {
    left: 5%;
    bottom: 22%;
    width: 36%;
    height: 15%;
}

.screen {
    position: relative;
    z-index: 3;
    width: min(560px, 100%);
    min-height: 320px;
    padding: clamp(18px, 3vw, 32px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.58)),
        radial-gradient(circle at 88% 14%, color-mix(in srgb, var(--accent) 36%, transparent), transparent 26%);
    overflow: hidden;
}

.screen-glow {
    position: absolute;
    inset: 18px;
    border: 1px dashed color-mix(in srgb, var(--theme) 44%, transparent);
    border-radius: 8px;
    opacity: 0.6;
}

.notice {
    position: relative;
    margin: 0 0 32px;
    color: var(--muted);
    font-weight: 700;
}

.name-reel {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 112px;
    padding: 18px;
    border-radius: 8px;
    color: var(--theme);
    font-size: clamp(2.3rem, 6vw, 4.8rem);
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-shadow: 0 7px 0 rgba(255, 255, 255, 0.88);
    word-break: break-word;
}

.name-reel.spinning {
    animation: pulseName 0.42s ease-in-out infinite;
}

.prize-reel {
    position: relative;
    min-height: 28px;
    color: var(--ink);
    font-size: clamp(1rem, 2vw, 1.28rem);
    font-weight: 800;
    text-align: center;
}

.player-form {
    position: relative;
    z-index: 4;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: min(560px, 100%);
    margin-top: 18px;
}

.player-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.player-form input {
    width: 100%;
    min-height: 46px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    outline: 0;
}

.player-form input:focus {
    border-color: color-mix(in srgb, var(--theme) 72%, white);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--theme) 16%, transparent);
}

.draw-actions {
    position: relative;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 26px;
    flex-wrap: wrap;
}

.draw-button {
    position: relative;
    min-width: 180px;
    min-height: 58px;
    padding: 0 26px;
    border: 0;
    border-radius: 8px;
    background:
        linear-gradient(135deg, var(--theme), color-mix(in srgb, var(--accent) 58%, var(--theme))),
        var(--theme);
    color: #fff;
    cursor: pointer;
    font-size: 1.12rem;
    font-weight: 900;
    box-shadow: 0 18px 36px color-mix(in srgb, var(--theme) 35%, transparent);
    transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

.draw-button:hover:not(:disabled) {
    transform: translateY(-3px);
    filter: saturate(1.08);
}

.draw-button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.draw-status {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px;
}

.panel-section {
    min-width: 0;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    font-weight: 900;
}

.section-title span {
    color: var(--muted);
}

.section-title strong {
    display: grid;
    place-items: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 24%, white);
}

.prize-list,
.winner-list {
    display: grid;
    gap: 10px;
}

.winner-list {
    max-height: 340px;
    overflow: auto;
    padding-right: 4px;
}

.prize-item,
.winner-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.62);
}

.prize-dot {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--item-color);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--item-color) 18%, transparent);
}

.prize-item h2,
.winner-item strong {
    display: block;
    margin: 0;
    color: var(--ink);
    font-size: 1rem;
}

.prize-item p,
.winner-item span,
.empty {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.winner-item {
    display: block;
}

.empty {
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    text-align: center;
}

.petal-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.petal-layer span {
    position: absolute;
    top: -10vh;
    width: 12px;
    height: 18px;
    border-radius: 12px 12px 12px 2px;
    background: color-mix(in srgb, var(--theme) 64%, white);
    opacity: 0.58;
    animation: fall 12s linear infinite;
}

.petal-layer span:nth-child(1) { left: 4%; animation-delay: 0s; }
.petal-layer span:nth-child(2) { left: 11%; animation-delay: 2.4s; }
.petal-layer span:nth-child(3) { left: 18%; animation-delay: 4.2s; }
.petal-layer span:nth-child(4) { left: 24%; animation-delay: 1.1s; }
.petal-layer span:nth-child(5) { left: 31%; animation-delay: 5.4s; }
.petal-layer span:nth-child(6) { left: 38%; animation-delay: 7.1s; }
.petal-layer span:nth-child(7) { left: 46%; animation-delay: 3.7s; }
.petal-layer span:nth-child(8) { left: 53%; animation-delay: 6.4s; }
.petal-layer span:nth-child(9) { left: 61%; animation-delay: 8.3s; }
.petal-layer span:nth-child(10) { left: 67%; animation-delay: 1.8s; }
.petal-layer span:nth-child(11) { left: 73%; animation-delay: 9.6s; }
.petal-layer span:nth-child(12) { left: 79%; animation-delay: 4.9s; }
.petal-layer span:nth-child(13) { left: 84%; animation-delay: 7.8s; }
.petal-layer span:nth-child(14) { left: 89%; animation-delay: 2.9s; }
.petal-layer span:nth-child(15) { left: 94%; animation-delay: 10.1s; }
.petal-layer span:nth-child(16) { left: 57%; animation-delay: 11.4s; }
.petal-layer span:nth-child(17) { left: 15%; animation-delay: 8.9s; }
.petal-layer span:nth-child(18) { left: 43%; animation-delay: 0.8s; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 20;
    width: min(420px, calc(100vw - 32px));
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    background: rgba(34, 35, 61, 0.92);
    color: #fff;
    font-weight: 800;
    text-align: center;
    transform: translate(-50%, 18px);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

@keyframes fall {
    from {
        transform: translate3d(0, -10vh, 0) rotate(0deg);
    }
    to {
        transform: translate3d(42px, 112vh, 0) rotate(520deg);
    }
}

@keyframes floatFace {
    0%,
    100% {
        transform: translateY(0) rotate(-2deg);
    }
    50% {
        transform: translateY(-14px) rotate(2deg);
    }
}

@keyframes pulseName {
    0%,
    100% {
        transform: scale(1);
        filter: blur(0);
    }
    50% {
        transform: scale(1.03);
        filter: blur(0.6px);
    }
}

@media (max-width: 920px) {
    .stage {
        align-items: flex-start;
        padding: 16px;
    }

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

    .draw-panel {
        min-height: 620px;
    }

    .mascot-card {
        right: 50%;
        bottom: 0;
        width: min(250px, 62vw);
        transform: translateX(50%);
    }

    .screen {
        width: 100%;
    }
}

@media (max-width: 620px) {
    .lottery-shell {
        padding: 14px;
    }

    .topbar {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-link {
        width: fit-content;
    }

    .draw-panel {
        min-height: 570px;
    }

    .draw-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .player-form {
        grid-template-columns: 1fr;
    }

    .draw-button {
        width: 100%;
    }
}
