/* --- 全局基础样式 --- */
html, body {
    touch-action: manipulation;
}
body {
    font-family: 'Noto Sans SC', sans-serif;
    color: #e0e0e0;
    background-image: url('../bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}
body.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
body.announcement-visible {
    padding-bottom: 40px; /* 公告栏高度 */
}
.sticky-header {
    position: -webkit-sticky; /* for Safari */
    position: sticky;
    top: 0;
    z-index: 999;
    background: rgba(20, 20, 20, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
/* --- 特殊UI组件样式 --- */
.glass-card {
    background: rgba(20, 20, 20, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.tab-btn {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}
.tab-btn.active {
    color: #fde047;
    border-bottom-color: #fde047;
}
.glowing-btn:hover {
    box-shadow: 0 0 10px #fde047, 0 0 20px #fde047, 0 0 30px #fde047;
}
.room-btn {
    position: relative;
    padding: 20px 5px 20px 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease-in-out;
    min-height: 100px;
    overflow: hidden;
    z-index: 1;
    background-size: cover;
    background-position: center;
}
.room-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.65);
    transition: all 0.3s ease-in-out;
    z-index: -1;
}
.room-btn.selected {
    background-color: transparent;
    transform: scale(1.05);
    box-shadow: 0 0 15px #fde047;
    border: 2px solid #fde047;
}
.room-btn.selected::before {
    background-color: rgba(0, 0, 0, 0.4);
}
.room-name {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #d1d5db;
}
.room-yuanbao {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #fde047;
}
.room-players {
    position: absolute;
    bottom: 4px;
    left: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #9ca3af;
}
.my-bet-indicator {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    background-color: rgba(250, 204, 21, 0.8);
    color: #18181b;
    padding: 1px 5px;
    border-radius: 9999px;
}
.room-btn.selected .my-bet-indicator {
     background-color: #fde047;
}
.avatar-container {
    position: absolute;
    inset: 22px 5px 22px 5px;
    overflow: hidden;
}
.avatar-wrapper {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.avatar-name {
    font-size: 9px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    pointer-events: none;
    line-height: 1;
    margin-bottom: 1px;
}
.room-avatar-generic {
    display: block;
    font-size: 1.6rem;
    line-height: 1;
}
.stake-btn {
    background-color: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.2s ease-in-out;
    color: #d1d5db;
    font-weight: 500;
}
.stake-btn:hover {
    background-color: rgba(255,255,255,0.2);
}
.stake-btn.selected {
    background-color: #fde047;
    color: #1a1a1a;
    font-weight: 700;
    border-color: #fde047;
    box-shadow: 0 2px 8px rgba(253, 224, 71, 0.4);
}
.toast {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}
.toast.show { opacity: 1; }
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 1001; opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-content {
    transform: scale(0.95);
    transition: transform 0.3s ease-in-out;
}
.modal-overlay.show .modal-content { transform: scale(1); }
.result-win { border: 2px solid #22c55e; box-shadow: 0 0 30px #22c55e; }
.result-lose { border: 2px solid #ef4444; box-shadow: 0 0 30px #ef4444; }

.killer-icon {
    position: absolute; font-size: 3rem; z-index: 50;
    display: none; transition: left 1s ease-in-out, top 1s ease-in-out;
    text-shadow: 0 0 8px rgba(255, 100, 100, 1), 0 0 12px rgba(239, 68, 68, 0.8);
}

.flash-red {
    animation: flash-red-border 0.5s ease-out;
}
.flash-red::before {
    animation: flash-red-overlay 0.5s ease-out;
}
@keyframes flash-red-border {
    0%, 100% {
        /* 动画开始和结束时，恢复为 .room-btn 默认的边框颜色 */
        border-color: rgba(255, 255, 255, 0.2);
    }
    50% {
        /* 动画中途，边框变为红色 */
        border-color: #ef4444;
    }
}
@keyframes flash-red-overlay {
    0%, 100% {
        /* 动画开始和结束时，恢复为 .room-btn::before 默认的背景色 */
        background-color: rgba(0, 0, 0, 0.65);
    }
    50% {
        /* 动画中途，背景变为红色蒙版 */
        background-color: rgba(239, 68, 68, 0.55);
    }
}
#danger-alert {
    position: fixed; top: 30%; left: 0; width: 100%;
    transform: translateY(-50%); padding: 1.5rem 0;
    background-color: rgba(239, 68, 68, 0.5); color: #f8fafc;
    font-size: 2.5rem; font-weight: 700; text-align: center;
    text-shadow: 0 0 10px rgba(0,0,0,0.7); z-index: 2100;
    opacity: 0; pointer-events: none; transition: opacity 0.4s ease-in-out;
}
#danger-alert.show {
    opacity: 1;
    animation: pulse-and-shake 1.2s infinite ease-in-out;
}

/* 紧急倒计时样式：直接在标题栏内变红和跳动 */
.countdown-urgent {
    color: #ef4444 !important;
    text-shadow: 0 0 10px #ef4444, 0 0 20px #ef4444;
    animation: pulse-red-text 1s infinite;
}
@keyframes pulse-red-text {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes pulse-and-shake {
    0%, 100% { transform: translateY(-50%) scale(1) rotate(0deg); }
    25% { transform: translateY(-50%) scale(1.05) rotate(-1.5deg); }
    50% { transform: translateY(-50%) scale(1.1) rotate(1.5deg); }
    75% { transform: translateY(-50%) scale(1.05) rotate(-1.5deg); }
}

.yuanbao-particle {
    position: fixed; z-index: 2000; font-size: 1.5rem;
    transition: left 0.8s cubic-bezier(0.5, 0, 1, 0.5), top 0.8s cubic-bezier(0.5, 0, 1, 1), transform 0.8s ease-in;
    pointer-events: none; text-shadow: 0 0 2px #fff, 0 0 6px #fde047, 0 0 10px #f59e0b;
}
#flying-avatar {
    position: absolute; z-index: 40; font-size: 1.8rem;
    display: none; transition: left 0.5s ease-in-out, top 0.5s ease-in-out;
    pointer-events: none;
}
.avatar-in-room { animation: walk-and-shake 2s infinite ease-in-out; }
@keyframes walk-and-shake {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-3px, 2px) rotate(-4deg); }
    50% { transform: translate(3px, -2px) rotate(4deg); }
    75% { transform: translate(1px, -1px) rotate(-2deg); }
}
.data-table-container {
    max-height: 60vh; overflow-y: auto; overflow-x: auto;
}
.data-table th, .data-table td {
    padding: 8px 12px; text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); white-space: nowrap;
}
.data-table thead { background-color: rgba(255, 255, 255, 0.1); }
.shop-item-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem; max-height: 60vh; overflow-y: auto; padding: 1rem;
}

/* ******** 代码修改处 1/2 ******** */
/* 修改了 .avatar-fallen 的样式，将 opacity 从 0 改为 0.6 */
/* 这使得倒下的玩家头像不会立即消失，而是以半透明状态留在原地，为后续的赏金动画做铺垫 */
.avatar-fallen {
    transform: rotate(90deg) scale(0.8);
    opacity: 0.6; /* 从 0 修改为 0.6 */
    transition: transform 0.4s ease-in, opacity 0.4s ease-in;
}

/* ******** 代码新增处 2/2 ******** */
/* 新增 .avatar-vanished 类，用于在赏金动画结束后，让倒下的玩家头像优雅地消失 */
.avatar-vanished {
    opacity: 0 !important;
    transform: scale(0.5) !important;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out !important;
}

.progress-bar-bg {
    background-color: rgba(255, 255, 255, 0.1); border-radius: 9999px; overflow: hidden;
}
.progress-bar-fg {
    background-color: #fde047; height: 100%; border-radius: 9999px; transition: width 0.5s ease-in-out;
}
#announcement-bar-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
}
.announcement-bar {
    background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 0; width: 100%; overflow: hidden; white-space: nowrap; position: relative;
}
.announcement-bar .content {
    display: inline-block; padding-left: 100%; animation: scroll-left 30s linear infinite;
}
.announcement-bar .content span { margin: 0 2em; font-weight: 500; }
@keyframes scroll-left {
    0% { transform: translateX(0); } 100% { transform: translateX(-100%); }
}
.killer-shard {
    position: absolute; font-size: 1rem; color: #ef4444;
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
}
.confetti {
    position: absolute; width: 8px; height: 15px;
    background-color: #fde047; opacity: 0.9;
    animation: fall 3s linear infinite;
}
@keyframes fall {
    to { transform: translateY(120px) rotate(360deg); opacity: 0; }
}
.avatar-jumping { animation: jump-up 0.8s ease-in-out infinite; }
@keyframes jump-up {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.1); }
}
#stake-drawer.open {
    transform: translateX(0);
}
.avatar-particle {
    position: fixed;
    z-index: 2100;
    font-size: 1.8rem;
    pointer-events: none;
    transition: left 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
                top 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
                opacity 0.2s linear;
}
.avatar-switching-out {
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
.killer-hesitating {
    animation: killer-hesitate-anim 1s infinite ease-in-out;
}
@keyframes killer-hesitate-anim {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1.5) rotate(720deg);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.6) rotate(715deg);
        opacity: 0.8;
    }
}
.room-btn.interaction-locked {
    cursor: wait;
    pointer-events: none;
    filter: brightness(0.7);
}
.room-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-left-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}
@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}
.game-entry-card {
    background: rgba(40, 40, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease-in-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.game-entry-card:hover {
    transform: translateY(-5px);
    border-color: rgba(253, 224, 71, 0.7);
    box-shadow: 0 8px 25px rgba(253, 224, 71, 0.2);
}