@charset "utf-8";

/* ============ 主题变量 ============ */
:root {
    --gold: #f7b50b;
    --yellow: #ffca00;
    --yellow-light: #ffe082;
    --orange: #ff9d00;
    --orange-deep: #fd851f;
    --red: #ff5a3c;
    --red-deep: #e6392e;
    --brown: #7a3b00;
    --ink: #4a2600;
    --card: #fff7e0;
    --card-border: #ffe0a3;
    --shadow-sm: 0 2px 0 rgba(180, 90, 0, 0.25);
    --shadow-md: 0 6px 16px rgba(180, 90, 0, 0.22);
    --shadow-lg: 0 16px 40px rgba(160, 70, 0, 0.28);
}

/* ============ 基础重置 ============ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; border: 0; }
ul { list-style: none; margin: 0; padding: 0; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: 0; }

/* ============ 全屏装饰背景 ============ */
.app-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(120% 80% at 50% 0%, #ffe9a0 0%, rgba(255, 233, 160, 0) 60%),
        linear-gradient(160deg, #ffe082 0%, #ffca00 42%, #ff9d00 100%);
    overflow: hidden;
}
.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    opacity: 0.55;
}
.orb-1 { width: 240px; height: 240px; left: -60px; top: -40px; background: radial-gradient(circle at 30% 30%, #fff6cf, rgba(255, 246, 207, 0)); animation: float 9s ease-in-out infinite; }
.orb-2 { width: 180px; height: 180px; right: 8%; top: 12%; background: radial-gradient(circle at 30% 30%, #fff, rgba(255, 255, 255, 0)); animation: float 11s ease-in-out infinite reverse; }
.orb-3 { width: 300px; height: 300px; right: -80px; bottom: -60px; background: radial-gradient(circle at 30% 30%, #ffb347, rgba(255, 179, 71, 0)); animation: float 13s ease-in-out infinite; }
.orb-4 { width: 120px; height: 120px; left: 12%; bottom: 16%; background: radial-gradient(circle at 30% 30%, #fff3c4, rgba(255, 243, 196, 0)); animation: float 8s ease-in-out infinite reverse; }
.orb-5 { width: 90px; height: 90px; left: 42%; top: 8%; background: radial-gradient(circle at 30% 30%, #fff, rgba(255, 255, 255, 0)); animation: float 10s ease-in-out infinite; }

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-24px) translateX(10px); }
}

/* ============ 布局容器 ============ */
.lottery {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

/* ============ 头部 ============ */
.lottery-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}
.title {
    margin: 0;
    font-size: 30px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 2px 0 rgba(180, 70, 0, 0.35), 0 6px 18px rgba(180, 70, 0, 0.35);
}
.subtitle { margin: 6px 0 0; font-size: 14px; color: #7a3b00; }
.subtitle b { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.head-actions { display: flex; gap: 10px; }
.chip {
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: #7a3b00;
    background: linear-gradient(180deg, #fff6d8, #ffe9a8);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.8); }
.chip:active { transform: translateY(0); }

/* ============ 主体 ============ */
.lottery-main {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}

/* ============ 棋盘 ============ */
.board-wrap { flex: 0 0 auto; }
.board {
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(180deg, #ffcf3f 0%, #ffab2e 100%);
    box-shadow: var(--shadow-lg), inset 0 2px 0 rgba(255, 255, 255, 0.5), inset 0 -2px 0 rgba(180, 70, 0, 0.3);
}
.play {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.cell {
    position: relative;
    min-width: 0;
    min-height: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, #fff8dc 0%, #ffe8a3 100%);
    border: 2px solid #ffd66b;
    box-shadow: 0 3px 0 #e0a83e, 0 6px 14px rgba(180, 90, 0, 0.16);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}
.cell-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
}
.cell-inner img {
    width: 62%;
    height: 62%;
    object-fit: contain;
    border-radius: 6px;
}
.cell-name {
    font-size: 12px;
    font-weight: 700;
    color: #a84300;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* 选中高亮 */
.cell.active {
    background: linear-gradient(180deg, #ffd54f 0%, #ff9d00 100%);
    border-color: #fff;
    box-shadow: 0 0 0 4px #ffca00, 0 0 26px 6px rgba(255, 157, 0, 0.65), 0 4px 0 #e08a00;
    transform: translateY(-2px) scale(1.02);
}
.cell.active .cell-name { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }

/* 开始按钮 */
.cell-start {
    border: 2px solid #fff;
    background: linear-gradient(180deg, #ff9d00 0%, #ff4d00 100%);
    box-shadow: 0 5px 0 #c23400, 0 0 24px rgba(255, 90, 60, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: startPulse 1.8s ease-in-out infinite;
}
.cell-start .btn-label {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    letter-spacing: 1px;
}
.cell-start.disabled { opacity: 0.6; animation: none; cursor: not-allowed; }
@keyframes startPulse {
    0%, 100% { box-shadow: 0 5px 0 #c23400, 0 0 18px rgba(255, 90, 60, 0.4); }
    50% { box-shadow: 0 5px 0 #c23400, 0 0 34px rgba(255, 90, 60, 0.75); }
}

.board-empty {
    grid-column: 1 / -1;
    padding: 40px 20px;
    text-align: center;
    color: #7a3b00;
    font-size: 14px;
}

/* ============ 信息栏 ============ */
.info-wrap {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.info-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 247, 224, 0.92));
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow-md);
}
.card-title {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 800;
    color: #a84300;
    padding-left: 10px;
    border-left: 4px solid var(--orange);
}

/* 奖品一览 */
.prize-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.prize-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #ffe0a3;
    box-shadow: var(--shadow-sm);
}
.prize-item img { width: 52px; height: 52px; object-fit: contain; }
.prize-item span { font-size: 12px; color: #7a3b00; text-align: center; }

/* 中奖滚动 */
.scroll {
    overflow: hidden;
    height: 156px;
    border-radius: 12px;
    background: linear-gradient(180deg, #fff8e6, #ffe9b8);
    border: 1px solid #ffe0a3;
    padding: 8px 12px;
}
.scroll li {
    position: relative;
    top: 0;
    height: 28px;
    line-height: 28px;
    font-size: 13px;
    color: #7a3b00;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: top 0.5s ease-in-out;
}

/* ============ 弹窗 ============ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
}
.modal.show { display: flex; }

.modal-card {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: 82vh;
    border-radius: 18px;
    background: linear-gradient(180deg, #fff9ea 0%, #ffecc0 100%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    padding: 22px;
    overflow: hidden;
}
.modal-title {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: 800;
    color: #a84300;
    text-align: center;
}
.modal-body { display: flex; flex-direction: column; gap: 12px; }
.scroll-body { overflow: auto; max-height: 58vh; font-size: 14px; color: #7a3b00; line-height: 1.7; }

.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    color: #a84300;
}
.modal-close::before,
.modal-close::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 2px;
    background: #a84300;
    border-radius: 2px;
}
.modal-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.modal-close::after { transform: translate(-50%, -50%) rotate(-45deg); }

.record-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #ffe0a3;
    font-size: 13px;
}
.record-item span { color: #b98a4b; white-space: nowrap; }
.empty-tip { text-align: center; color: #b98a4b; padding: 20px; }

/* 中奖弹窗 */
.win-card {
    position: relative;
    width: 100%;
    max-width: 380px;
    border-radius: 18px;
    background: linear-gradient(180deg, #fff9ea 0%, #ffecc0 100%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    padding: 34px 24px 26px;
    text-align: center;
}
.win-star {
    display: block;
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    background: linear-gradient(180deg, #ffe27a, #ffb300);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    box-shadow: 0 6px 18px rgba(255, 179, 0, 0.5);
    animation: starSpin 4s linear infinite;
}
@keyframes starSpin { to { transform: rotate(360deg); } }
.win-title { margin: 0 0 16px; font-size: 24px; font-weight: 800; color: #e6392e; }
.win-prize { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; }
.win-prize img { width: 120px; height: 120px; object-fit: contain; border-radius: 12px; background: #fff; padding: 8px; box-shadow: var(--shadow-md); }
.win-prize p { margin: 0; font-size: 16px; font-weight: 700; color: #7a3b00; }

/* ============ 按钮 & 输入 ============ */
.btn-primary {
    width: 100%;
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
    background: linear-gradient(180deg, #ff9d00 0%, #ff4d00 100%);
    box-shadow: 0 4px 0 #c23400, 0 8px 18px rgba(230, 57, 46, 0.35);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 2px 0 #c23400; }

.px {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #ffe0a3;
    background: #fff;
    font-size: 15px;
    color: #4a2600;
    outline: none;
}
.px:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 157, 0, 0.25); }

/* ============ 音乐按钮 ============ */
#musicBtn {
    position: fixed;
    top: 16px;
    right: 18px;
    z-index: 200;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: #7a3b00;
    background: linear-gradient(180deg, #fff6d8, #ffe9a8);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
#musicBtn.playing { color: var(--red-deep); animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 响应式：移动端竖版 ============ */
@media (max-width: 767px) {
    .lottery { padding: 18px 14px 40px; }
    .lottery-head { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
    .title { font-size: 26px; }
    .head-actions { width: 100%; }
    .chip { flex: 1; text-align: center; }

    .lottery-main { flex-direction: column; gap: 18px; }

    .board-wrap { width: 100%; }
    .board { max-width: 420px; margin: 0 auto; padding: 12px; border-radius: 18px; }
    .play { gap: 8px; }
    .cell { border-radius: 12px; }
    .cell-name { font-size: 11px; }
    .cell-start .btn-label { font-size: 16px; }

    .info-wrap { width: 100%; }
    .prize-grid { grid-template-columns: repeat(4, 1fr); }
    .prize-item img { width: 44px; height: 44px; }
}

/* ============ 响应式：PC 横版 ============ */
@media (min-width: 768px) {
    .lottery { padding: 32px 28px 56px; }
    .board { width: 520px; padding: 22px; }
    .play { gap: 12px; }
    .cell-name { font-size: 14px; }
    .cell-start .btn-label { font-size: 22px; }
    .prize-grid { grid-template-columns: repeat(4, 1fr); }
    .prize-item img { width: 64px; height: 64px; }
    .scroll { height: 184px; }
}
