* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: none;
    min-height: 100vh;
    color: #e8f6ff;
    animation: backgroundShift 10s ease-in-out infinite;
}
/* App Background layer to keep continuity */
.app-background {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(1000px 500px at 50% -10%, rgba(255,255,255,0.12), transparent 55%),
        radial-gradient(circle at 20% 20%, rgba(255, 215, 0, 0.05), transparent 45%),
        radial-gradient(circle at 80% 30%, rgba(46, 204, 113, 0.06), transparent 55%),
        radial-gradient(circle at 50% 80%, rgba(52, 152, 219, 0.06), transparent 50%),
        linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    background-size: auto, auto, auto, auto, 200% 200%;
    animation: bgPan 18s ease-in-out infinite;
    transition: opacity 300ms ease;
    pointer-events: none;
    overflow: hidden;
}

/* When splash hides, keep same palette so it’s not jarring */
.splash-screen + .app-background {
    opacity: 1;
}

/* Flowing gradient animation */
@keyframes bgPan {
    0% { background-position: 0% 50%, 0 0, 0 0, 0 0, 0% 50%; }
    50% { background-position: 0% 50%, 10px 10px, -10px 20px, 0 -10px, 100% 50%; }
    100% { background-position: 0% 50%, 0 0, 0 0, 0 0, 0% 50%; }
}

/* Animated soft color blobs */
.app-background::before,
.app-background::after {
    content: '';
    position: absolute;
    width: 60vmax;
    height: 60vmax;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.18;
    will-change: transform;
    pointer-events: none;
}

.app-background::before {
    background: radial-gradient(circle, rgba(231, 76, 60, 0.7), transparent 60%);
    top: -10vmax;
    left: -10vmax;
    animation: blobFlow1 24s ease-in-out infinite;
}

.app-background::after {
    background: radial-gradient(circle, rgba(52, 152, 219, 0.7), transparent 60%);
    bottom: -12vmax;
    right: -12vmax;
    animation: blobFlow2 28s ease-in-out infinite;
}

@keyframes blobFlow1 {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(8vmax, 4vmax) scale(1.08) rotate(10deg); }
    66% { transform: translate(2vmax, 10vmax) scale(0.95) rotate(-8deg); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes blobFlow2 {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-6vmax, -3vmax) scale(1.06) rotate(-6deg); }
    66% { transform: translate(-2vmax, -9vmax) scale(0.97) rotate(6deg); }
    100% { transform: translate(0, 0) scale(1); }
}


@keyframes backgroundShift {
    0%, 100% { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
    50% { background: linear-gradient(135deg, #764ba2 0%, #667eea 100%); }
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.game-header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* 旧标题样式去除（闪屏替代） */

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes titleGlow {
    0% { 
        filter: brightness(1) saturate(1);
        transform: scale(1);
    }
    100% { 
        filter: brightness(1.2) saturate(1.3);
        transform: scale(1.02);
    }
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.game-info h3 {
    color: #2c3e50;
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

/* Current Transform Card */
.current-transform {
    margin-top: 25px;
}

.current-transform h3 {
    color: #2c3e50;
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 2px solid #9b59b6;
    padding-bottom: 8px;
}

/* 删除单卡展示，改为仅筹展示 */

.owned-transforms {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    justify-content: center;
}
.owned-transform-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 999px;
    background: rgba(155, 89, 182, 0.1);
    border: 1px solid rgba(155, 89, 182, 0.25);
    color: #2c3e50;
    font-size: 0.72em;
}
.owned-transform-chip .desc {
    max-width: 220px;
    opacity: 0.8;
    color: #34495e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.owned-transform-chip .sep { opacity: 0.5; }
.owned-transform-chip .icon { font-size: 1em; }
.owned-transform-chip.activated {
    outline: 2px solid #e67e22;
    box-shadow: 0 0 10px rgba(230,126,34,0.5);
}
.owned-transform-chip.activated .desc,
.owned-transform-chip.activated .name { color: #e67e22; font-weight: 800; }

/* 命中触发时的临时高亮，不影响默认的 activated 状态 */
.owned-transform-chip.proc-activated {
    outline: 2px solid #2ecc71;
    box-shadow: 0 0 12px rgba(46,204,113,0.6);
}
.owned-transform-chip.proc-activated .desc,
.owned-transform-chip.proc-activated .name { color: #2ecc71; font-weight: 800; }

/* 已拥有变幻牌等级样式 - 使用边框颜色和轻微背景色调 */
.owned-transform-chip.level-1 {
    background: rgba(52, 152, 219, 0.12); /* 轻微蓝色背景 */
    border: 1px solid #3498db; /* 蓝色边框 */
    color: #2c3e50;
}

.owned-transform-chip.level-2 {
    background: rgba(155, 89, 182, 0.12); /* 轻微紫色背景 */
    border: 1px solid #9b59b6; /* 紫色边框 */
    color: #2c3e50;
}

.owned-transform-chip.level-3 {
    background: rgba(243, 156, 18, 0.12); /* 轻微金色背景 */
    border: 1px solid #f39c12; /* 金色边框 */
    color: #2c3e50;
}

/* 等级样式的图标和名称颜色 */
.owned-transform-chip.level-1 .icon,
.owned-transform-chip.level-1 .name {
    color: #3498db;
    font-weight: 600;
}

.owned-transform-chip.level-2 .icon,
.owned-transform-chip.level-2 .name {
    color: #9b59b6;
    font-weight: 600;
}

.owned-transform-chip.level-3 .icon,
.owned-transform-chip.level-3 .name {
    color: #f39c12;
    font-weight: 600;
}

/* 禁止文本选择 */
* { -webkit-user-select: none; -moz-user-select: none; user-select: none; }

.transform-card-display {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

/* 变幻牌激活样式 */
.transform-card-display.activated {
    outline: 2px solid #e67e22;
    box-shadow: 0 0 12px rgba(230, 126, 34, 0.6);
    border-radius: 12px;
}
.transform-card-icon.activated {
    border-color: #e67e22;
    background: rgba(230, 126, 34, 0.15);
}
.transform-card-name.activated,
.transform-card-effect.activated {
    color: #e67e22;
    font-weight: 700;
}

.transform-card-icon {
    font-size: 2em;
    background: rgba(155, 89, 182, 0.2);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(155, 89, 182, 0.5);
}

.transform-card-info {
    flex: 1;
    text-align: left;
}

.transform-card-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1em;
    margin-bottom: 4px;
}

.transform-card-effect {
    color: #7f8c8d;
    font-size: 0.85em;
    line-height: 1.3;
}

.no-transform {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 15px;
    font-size: 0.9em;
}

.score-display, .round-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.transform-selection-notice {
    margin: 10px auto 18px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(231, 76, 60, 0.08);
    border: 1px solid rgba(231, 76, 60, 0.25);
    color: #c0392b;
    font-weight: 700;
}

.score-display span, .round-info span {
    font-weight: 600;
    font-size: 0.9em;
    color: #34495e;
    padding: 4px 0;
}

/* Game Layout */
.game-layout {
    display: flex;
    gap: 20px;
    flex: 1;
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(255, 215, 0, 0.08), transparent 40%),
                radial-gradient(circle at 80% 30%, rgba(46, 204, 113, 0.08), transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(52, 152, 219, 0.08), transparent 45%),
                linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    overflow: hidden;
    pointer-events: none; /* 让覆盖层不拦截点击，交互交给子元素或底层悬浮按钮 */
}

.splash-particles::before,
.splash-particles::after {
    content: '';
    position: absolute;
    inset: -20%;
    background: radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.6), transparent 30%),
                radial-gradient(2px 2px at 50% 60%, rgba(255,255,255,0.5), transparent 30%),
                radial-gradient(2px 2px at 80% 40%, rgba(255,255,255,0.4), transparent 30%),
                radial-gradient(2px 2px at 30% 80%, rgba(255,255,255,0.45), transparent 30%),
                radial-gradient(2px 2px at 60% 20%, rgba(255,255,255,0.5), transparent 30%);
    animation: starDrift 30s linear infinite;
}
.splash-particles::after {
    animation-duration: 45s;
    opacity: 0.6;
}

@keyframes starDrift {
    0% { transform: translateY(0); }
    100% { transform: translateY(-30%); }
}

.splash-content {
    text-align: center;
    transform: translateY(-10px);
    animation: contentPop 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
    pointer-events: auto; /* 允许闪屏内容交互 */
}

@keyframes contentPop {
    0% { opacity: 0; transform: translateY(20px) scale(0.98); }
    100% { opacity: 1; transform: translateY(-10px) scale(1); }
}

.splash-title {
    font-size: clamp(2.2rem, 6vw, 4rem);
    font-weight: 900;
    letter-spacing: 4px;
    text-transform: uppercase;
    background: linear-gradient(90deg, #f1c40f, #e67e22, #e74c3c, #9b59b6, #3498db);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradientShift 4s ease-in-out infinite, titleGlow 2s ease-in-out infinite alternate;
    text-shadow: 0 0 12px rgba(255,255,255,0.2);
}

.splash-subtitle {
    margin-top: 10px;
    font-size: clamp(0.9rem, 2.6vw, 1.2rem);
    opacity: 0.85;
}

.btn-start {
    margin-top: 26px;
    padding: 14px 28px;
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: all 280ms ease;
}
.btn-start:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(255,255,255,0.2);
}

.splash-hint {
    margin-top: 10px;
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Splash Leaderboard */
.splash-leaderboard {
    margin: 18px auto 0;
    width: min(680px, 92vw);
    background: rgba(255,255,255,0.9);
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 12px 36px rgba(0,0,0,0.18);
    overflow: hidden;
}
.splash-leaderboard .lb-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    color: #2c3e50;
    font-weight: 900;
    letter-spacing: 1px;
    background: linear-gradient(90deg, rgba(52,152,219,0.12), rgba(155,89,182,0.12));
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.lb-scroll {
    height: 260px;
    overflow: hidden; /* 我们做自定义滚动动画 */
    position: relative;
}
.lb-list {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 10px 10px 10px;
}
.lb-item {
    display: grid;
    grid-template-columns: 40px 40px 1fr auto auto;
    align-items: center;
    gap: 10px;
    background: rgba(52,152,219,0.06);
    border: 1px solid rgba(52,152,219,0.2);
    border-radius: 10px;
    padding: 8px 10px;
    color: #2c3e50;
}
.lb-rank { font-weight: 900; color: #2980b9; text-align: center; }
.lb-avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.lb-avatar svg { width: 36px; height: 36px; display: block; }
.lb-name { font-weight: 800; color: #2c3e50; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 900; color: #27ae60; }
.lb-rounds { font-weight: 700; color: #8e44ad; margin-left: 8px; }
.lb-meta { display: flex; align-items: center; gap: 8px; justify-self: end; }

@keyframes lb-marquee {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

/* 让悬浮按钮在闪屏上也显示在最上层 */
.floating-register-btn { z-index: 5000; visibility: visible; opacity: 1; position: fixed; }
.floating-register-hint { z-index: 5000; }
.user-panel { z-index: 6000; }
/* 移除重复的z-index定义，统一在下面的完整定义中处理 */

/* Game Sidebar */
.game-sidebar {
    width: 250px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 20px;
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.game-sidebar::-webkit-scrollbar {
    width: 6px;
}

.game-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.game-sidebar::-webkit-scrollbar-thumb {
    background: rgba(52, 152, 219, 0.6);
    border-radius: 3px;
}

.game-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(52, 152, 219, 0.8);
}

/* Main Game Area */
.game-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Transform Card Selection */
.transform-selection {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.transform-selection h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.5em;
    font-weight: 600;
}

.transform-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.transform-card {
    background: linear-gradient(145deg, #f0f0f0, #cacaca);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    position: relative;
}

.transform-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.transform-card.selected {
    border-color: #3498db !important;
    background: linear-gradient(145deg, #3498db, #2980b9) !important;
    color: white !important;
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.4) !important;
}

/* 变幻牌等级样式 - 使用边框和轻微背景色调 */
.transform-card.level-1 {
    border: 3px solid #3498db; /* 蓝色边框 */
    background: linear-gradient(145deg, rgba(52, 152, 219, 0.1), rgba(41, 128, 185, 0.05));
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.2);
}

.transform-card.level-2 {
    border: 3px solid #9b59b6; /* 紫色边框 */
    background: linear-gradient(145deg, rgba(155, 89, 182, 0.1), rgba(142, 68, 173, 0.05));
    box-shadow: 0 0 15px rgba(155, 89, 182, 0.2);
}

.transform-card.level-3 {
    border: 3px solid #f39c12; /* 金色边框 */
    background: linear-gradient(145deg, rgba(243, 156, 18, 0.1), rgba(230, 126, 34, 0.05));
    box-shadow: 0 0 15px rgba(243, 156, 18, 0.3);
}

.transform-card.level-1:hover {
    border-color: #2980b9;
    background: linear-gradient(145deg, rgba(52, 152, 219, 0.15), rgba(41, 128, 185, 0.1));
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.3);
}

.transform-card.level-2:hover {
    border-color: #8e44ad;
    background: linear-gradient(145deg, rgba(155, 89, 182, 0.15), rgba(142, 68, 173, 0.1));
    box-shadow: 0 0 20px rgba(155, 89, 182, 0.3);
}

.transform-card.level-3:hover {
    border-color: #e67e22;
    background: linear-gradient(145deg, rgba(243, 156, 18, 0.15), rgba(230, 126, 34, 0.1));
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.4);
}

.transform-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.transform-name {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
}

.transform-effect {
    font-size: 0.85em;
    opacity: 0.8;
    color: #7f8c8d;
}

/* Game Board */
.game-board {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.played-cards-area {
    margin-bottom: 25px;
}

.played-cards-area h3, .player-hand h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.2em;
    font-weight: 600;
}

.player-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 120px;
    padding: 15px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 10px;
    border: 2px dashed #3498db;
    position: relative; /* 为分数动画提供定位上下文 */
}

.played-cards {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 120px;
    padding: 15px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 10px;
    border: 2px dashed #3498db;
}

/* Card Styles */
.card {
    width: 100px;
    height: 140px;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e9ecef;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    position: relative;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transform-style: preserve-3d;
    animation: cardFloat 3s ease-in-out infinite;
}

@keyframes cardFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-2px); }
}

@keyframes cardGroup {
    0% { 
        transform: translateY(0) scale(1);
        opacity: 0.8;
    }
    50% { 
        transform: translateY(-8px) scale(1.05);
        opacity: 1;
    }
    100% { 
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.card.grouping {
    animation: cardGroup 0.15s ease-in-out forwards;
    animation-delay: var(--float-delay, 0s);
    z-index: 10;
}

.player-cards.grouping .card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-8px) rotateY(8deg) scale(1.05);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    border-color: #3498db;
    animation: none;
}

.card.selected {
    border-color: #3498db;
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.6);
    transform: translateY(-3px) scale(1.08);
    animation: cardGlow 1s ease-in-out infinite alternate;
}

@keyframes cardGlow {
    0% { box-shadow: 0 8px 25px rgba(52, 152, 219, 0.6); }
    100% { box-shadow: 0 8px 35px rgba(52, 152, 219, 0.9); }
}

.card.selected-non-scoring {
    background: linear-gradient(145deg, #95a5a6, #7f8c8d) !important;
    color: #bdc3c7 !important;
    border-color: #7f8c8d !important;
    box-shadow: 0 8px 25px rgba(127, 140, 141, 0.4) !important;
    transform: translateY(-3px) scale(1.08) !important;
    animation: none !important;
}

@keyframes slideIn {
    0% { 
        opacity: 0; 
        transform: translateX(-20px); 
    }
    100% { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

.card.played {
    opacity: 0.7;
    transform: scale(0.9) rotateY(-2deg);
}

.play-history {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    border-left: 4px solid #3498db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    animation: slideIn 0.5s ease-out;
}

.play-history.combo-play {
    border-left: 4px solid #e74c3c;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(231, 76, 60, 0.1));
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.combo-title {
    text-align: center;
    font-weight: bold;
    color: #e74c3c;
    font-size: 1.1em;
    margin-bottom: 10px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: comboGlow 1s ease-in-out infinite alternate;
}

@keyframes comboGlow {
    0% { 
        color: #e74c3c;
        transform: scale(1);
    }
    100% { 
        color: #c0392b;
        transform: scale(1.05);
    }
}

.play-history:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.play-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9em;
}

.play-history-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.play-history .card {
    width: 75px;
    height: 105px;
    padding: 6px;
    font-size: 0.85em;
}

.play-score {
    background: linear-gradient(145deg, #27ae60, #229954);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.8em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card-faction-1 {
    border-left: 4px solid #e74c3c;
}

.card-faction-2 {
    border-left: 4px solid #f39c12;
}

.card-faction-3 {
    border-left: 4px solid #27ae60;
}

.card-icon {
    font-size: 2em;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.card-name {
    font-size: 0.8em;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    color: #2c3e50;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.card-faction {
    font-size: 0.7em;
    opacity: 0.8;
    text-align: center;
    color: #7f8c8d;
    font-weight: 500;
}

/* Score Preview */
.score-preview {
    background: rgba(52, 152, 219, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    border: 2px solid rgba(52, 152, 219, 0.3);
    text-align: center;
}

.preview-info {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.preview-label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9em;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 变幻预览专用颜色 */
#preview-transform-bonus.preview-active {
    background: rgba(230, 126, 34, 0.12);
    border: 1px solid rgba(230, 126, 34, 0.35);
}
#preview-transform-bonus .preview-label,
#preview-transform-detail {
    color: #e67e22;
    font-weight: 700;
}

.preview-label span {
    color: #3498db;
    font-weight: bold;
    font-size: 1.1em;
}

/* Game Controls */
.game-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.game-controls .button-row {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
}

.btn-primary, .btn-secondary, .btn-warning, .btn-exit {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
    position: relative;
    overflow: hidden;
}

.btn-primary::before, .btn-secondary::before, .btn-warning::before, .btn-exit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before, .btn-secondary:hover::before, .btn-warning:hover::before, .btn-exit:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(145deg, #2980b9, #21618c);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(41, 128, 185, 0.4);
}

.btn-primary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.btn-secondary {
    background: linear-gradient(145deg, #95a5a6, #7f8c8d);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(145deg, #7f8c8d, #6c7b7d);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(127, 140, 141, 0.4);
}

/* 换牌按钮可用状态 - 桔黄色背景 */
.swap-available {
    background: linear-gradient(145deg, #ff8c00, #ff6347) !important;
    color: white !important;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 140, 0, 0.3);
}

.swap-available:hover:not(:disabled) {
    background: linear-gradient(145deg, #ff6347, #e55100) !important;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 140, 0, 0.5);
}

/* 换牌按钮不可用状态 - 灰色背景 */
.swap-unavailable {
    background: linear-gradient(145deg, #bdc3c7, #95a5a6) !important;
    color: #7f8c8d !important;
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

/* 确保禁用状态的样式优先级 */
.btn-secondary:disabled.swap-unavailable {
    background: linear-gradient(145deg, #bdc3c7, #95a5a6) !important;
    color: #7f8c8d !important;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

.btn-warning {
    background: linear-gradient(145deg, #e67e22, #d35400);
    color: white;
}

.btn-warning:hover {
    background: linear-gradient(145deg, #d35400, #a04000);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(211, 84, 0, 0.4);
}

.btn-exit {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    color: white;
    margin-top: 10px;
}

.btn-exit:hover {
    background: linear-gradient(145deg, #c0392b, #a93226);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(192, 57, 43, 0.4);
}

/* Round Result */
.round-result {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    padding: 26px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    width: min(520px, 92vw);
}

.round-result h2 {
    margin-bottom: 18px;
    color: #2c3e50;
    font-size: 1.6em;
    font-weight: 700;
}

.round-status {
    margin: 4px auto 14px auto;
    padding: 8px 14px;
    width: fit-content;
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: 1px;
    font-size: 1rem;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

.round-status.win {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: #fff;
}

.round-status.lose {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
}

.result-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.result-item.stat {
    background: linear-gradient(145deg, rgba(52, 152, 219, 0.08), rgba(52, 152, 219, 0.15));
    padding: 14px 16px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(52, 152, 219, 0.25);
}

.result-item.stat .result-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #7f8c8d;
}

.result-item.stat .result-value {
    font-size: 1.4rem;
    font-weight: 900;
    color: #2c3e50;
}

.result-item.stat-total { background: linear-gradient(145deg, rgba(39, 174, 96, 0.08), rgba(39, 174, 96, 0.15)); border-color: rgba(39, 174, 96, 0.25); }
.result-item.stat-round { background: linear-gradient(145deg, rgba(52, 152, 219, 0.08), rgba(52, 152, 219, 0.15)); border-color: rgba(52, 152, 219, 0.25); }
.result-item.stat-next  { background: linear-gradient(145deg, rgba(241, 196, 15, 0.08), rgba(241, 196, 15, 0.15)); border-color: rgba(241, 196, 15, 0.25); }

@media (max-width: 640px) {
    .result-details { grid-template-columns: 1fr; }
}

/* 模态遮罩与容器 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 7000;
    animation: overlayFadeIn 200ms ease-out forwards;
}

/* 确保抽牌模态框有更高的z-index */
#draw-card-modal.modal-overlay { 
    z-index: 7500; 
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-container {
    transform: translateY(12px) scale(0.98);
    opacity: 0;
    animation: modalPopIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes modalPopIn {
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-button-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 6px;
}

/* Footer */
.game-footer {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 10px;
    margin-top: 15px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Floating Register Button */
.floating-register-btn {
    position: fixed;
    right: 18px;
    bottom: 90px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, #f1c40f, #e67e22);
    color: #fff;
    font-weight: 900;
    font-size: 1.1rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 1200;
}
.floating-register-btn.logged-in {
    background: linear-gradient(145deg, #2ecc71, #27ae60);
}
.user-panel {
    position: fixed;
    right: 18px;
    bottom: 150px;
    width: 280px;
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.18);
    backdrop-filter: blur(8px);
    padding: 12px;
    z-index: 1300;
}
.user-panel-header { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.user-panel-avatar { display: none; }
.user-panel-avatar svg { display: none; }
.user-panel-meta { display: flex; flex-direction: column; }
.user-panel-nickname { font-weight: 700; color: #2c3e50; }
.user-panel-uid { display: none; }
.user-panel-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.user-panel-stats .stat-item { background: rgba(52,152,219,0.08); border: 1px solid rgba(52,152,219,0.2); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.user-panel-stats .stat-item span { font-size: 0.8em; color: #7f8c8d; }
.user-panel-stats .stat-item b { color: #2c3e50; }
.user-panel-transforms { margin: 8px 0; }
.user-panel-transforms .transform-label { 
    font-size: 0.85em; 
    color: #7f8c8d; 
    margin-bottom: 6px; 
    font-weight: 600;
}
.user-panel-transforms .transform-list { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 4px;
}
.user-panel-transforms .transform-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, rgba(142, 68, 173, 0.1), rgba(155, 89, 182, 0.1));
    border: 1px solid rgba(142, 68, 173, 0.2);
    border-radius: 6px;
    padding: 3px 6px;
    font-size: 0.75em;
    color: #8e44ad;
    white-space: nowrap;
}
.user-panel-transforms .transform-item .icon {
    font-size: 0.9em;
}

/* 用户信息页面变幻牌等级样式 - 使用边框颜色和轻微背景色调 */
.user-panel-transforms .transform-item.level-1 {
    background: rgba(52, 152, 219, 0.12); /* 轻微蓝色背景 */
    border: 1px solid #3498db; /* 蓝色边框 */
    color: #3498db;
}

.user-panel-transforms .transform-item.level-2 {
    background: rgba(155, 89, 182, 0.12); /* 轻微紫色背景 */
    border: 1px solid #9b59b6; /* 紫色边框 */
    color: #9b59b6;
}

.user-panel-transforms .transform-item.level-3 {
    background: rgba(243, 156, 18, 0.12); /* 轻微金色背景 */
    border: 1px solid #f39c12; /* 金色边框 */
    color: #f39c12;
}

/* 用户信息页面变幻牌等级样式的图标和名称颜色 */
.user-panel-transforms .transform-item.level-1 .icon,
.user-panel-transforms .transform-item.level-1 .name {
    color: #3498db;
    font-weight: 600;
}

.user-panel-transforms .transform-item.level-2 .icon,
.user-panel-transforms .transform-item.level-2 .name {
    color: #9b59b6;
    font-weight: 600;
}

.user-panel-transforms .transform-item.level-3 .icon,
.user-panel-transforms .transform-item.level-3 .name {
    color: #f39c12;
    font-weight: 600;
}
.user-panel-transforms .transform-item .name {
    font-weight: 500;
}
.user-panel-transforms .transform-item {
    cursor: help;
    transition: all 0.2s ease;
}
.user-panel-transforms .transform-item:hover {
    background: linear-gradient(135deg, rgba(142, 68, 173, 0.15), rgba(155, 89, 182, 0.15));
    border-color: rgba(142, 68, 173, 0.3);
    transform: scale(1.02);
}
.user-panel-actions { display: flex; justify-content: flex-end; }

/* Toast */
.game-toast {
    position: fixed;
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85em;
    opacity: 0;
    transition: all 220ms ease;
    z-index: 2000;
}
.game-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.floating-register-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.25);
}

/* Floating Draw Card Button */
.floating-draw-card-btn {
    position: fixed;
    right: 18px;
    bottom: 150px; /* 在注册按钮上方 */
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, #9b59b6, #8e44ad);
    color: white;
    font-size: 0.7rem;
    box-shadow: 0 8px 24px rgba(155, 89, 182, 0.3);
    cursor: pointer;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: drawCardPulse 2s infinite;
}

.floating-draw-card-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(155, 89, 182, 0.4);
    animation: none;
}

/* 抽牌按钮闪烁动画 */
@keyframes drawCardPulse {
    0%, 100% { 
        box-shadow: 0 8px 24px rgba(155, 89, 182, 0.3);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 8px 32px rgba(155, 89, 182, 0.6);
        transform: scale(1.05);
    }
}

/* 卡片动画容器 */
.card-animation {
    position: relative;
    width: 20px;
    height: 24px;
    margin-bottom: 2px;
}

.card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    animation: cardFlip 3s infinite;
}

.card-face-2 {
    animation-delay: 1s;
}

.card-face-3 {
    animation-delay: 2s;
}

@keyframes cardFlip {
    0%, 66.67% { 
        opacity: 0;
        transform: rotateY(180deg);
    }
    33.33% { 
        opacity: 1;
        transform: rotateY(0deg);
    }
}

.draw-text {
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
}

/* Draw Card Modal */
.draw-card-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    /* 添加与其他模态框相同的动画效果 */
    transform: translateY(12px) scale(0.98);
    opacity: 0;
    animation: modalPopIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.draw-card-animation {
    position: relative;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

.card-deck {
    display: flex;
    gap: -10px;
    transform: translateX(-20px);
}

.card-back {
    width: 80px;
    height: 120px;
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    border-radius: 12px;
    border: 3px solid #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    position: relative;
    margin-left: -15px;
    animation: cardShuffle 2s infinite;
}

.card-back:nth-child(2) {
    animation-delay: 0.3s;
}

.card-back:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes cardShuffle {
    0%, 100% { 
        transform: translateY(0) rotate(0deg);
    }
    50% { 
        transform: translateY(-10px) rotate(5deg);
    }
}

.drawn-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 120px;
    height: 180px;
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border-radius: 15px;
    border: 3px solid;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.drawn-card.show {
    transform: translate(-50%, -50%) scale(1);
}

.drawn-card.level-1 {
    border-color: #3498db;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1), #fff);
}

.drawn-card.level-2 {
    border-color: #9b59b6;
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.1), #fff);
}

.drawn-card.level-3 {
    border-color: #f39c12;
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.1), #fff);
}

.card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.card-icon {
    font-size: 2.5rem;
}

.card-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #2c3e50;
}

.card-level {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.card-level.level-1 {
    background: #3498db;
    color: white;
}

.card-level.level-2 {
    background: #9b59b6;
    color: white;
}

.card-level.level-3 {
    background: #f39c12;
    color: white;
}

.draw-result-message {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 20px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.draw-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* 烟花效果 */
.fireworks-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.firework {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    animation: fireworkExplode 1.5s ease-out forwards;
}

@keyframes fireworkExplode {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: scale(20);
        opacity: 0;
    }
}
.floating-register-hint {
    position: fixed;
    right: 78px;
    bottom: 98px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.95);
    color: #2c3e50;
    font-size: 0.85rem;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    z-index: 1200;
    display: none;
}

/* Register Modal */
.register-tabs { display: flex; gap: 8px; justify-content: center; margin: 6px 0 10px; }
.register-tabs .tab-btn {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(52,152,219,0.35);
    background: rgba(52,152,219,0.08);
    color: #2c3e50;
    font-weight: 700;
    cursor: pointer;
}
.register-tabs .tab-btn.active { background: rgba(52,152,219,0.18); }
.tab-pane .form-row { margin: 8px 0; display: flex; gap: 8px; }
.tab-pane .form-row input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
}
.tab-pane .form-row.code-row input { flex: 1; }
.tab-pane .form-row.code-row button { white-space: nowrap; }
.captcha-row { align-items: center; }
.captcha-canvas {
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    background: #fff;
}
.captcha-refresh-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(145deg, #9b59b6, #8e44ad);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(155,89,182,0.35);
    cursor: pointer;
}
.register-message {
    margin: 6px auto 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(241, 196, 15, 0.1);
    border: 1px solid rgba(241, 196, 15, 0.25);
    color: #8e44ad;
    font-weight: 700;
}

.input-hint {
    font-size: 0.68em;
    line-height: 1.15;
    color: #7f8c8d;
    display: block;
}
.input-hint.ok { color: #27ae60 !important; }
.input-hint.err { color: #e74c3c !important; }
.hint-row { margin-top: -8px; }

/* Avatar chooser */
.avatar-row { align-items: center; justify-content: center; }
.avatar-card {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.08);
    background: linear-gradient(145deg, #ffffff, #f4f6f8);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
}
.avatar-preview {
    width: 84px;
    height: 84px;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.avatar-preview svg { width: 84px; height: 84px; display: block; }
.avatar-refresh-btn {
    position: absolute;
    right: -8px;
    bottom: -8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(41,128,185,0.35);
    cursor: pointer;
}
.avatar-refresh-btn:hover { transform: translateY(-1px); }

.game-status {
    font-size: 0.9em;
    font-weight: 600;
    color: #2c3e50;
    animation: pulse 2s ease-in-out infinite;
}

.rule-hint {
    color: #2980b9;
    text-decoration: underline;
    cursor: pointer;
}
.rule-hint:hover { color: #1f618d; }

.rules-container .round-result { width: min(460px, 92vw); padding: 14px; }
.rules-container .round-result h2 {
    margin-bottom: 4px;
    font-size: 1.15em;
    background: linear-gradient(90deg, #3498db, #9b59b6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.25);
}
.rules-container .result-details {
    grid-template-columns: 1fr;
    gap: 6px;
}
.rules-container .result-item {
    justify-content: flex-start;
    gap: 6px;
    align-items: stretch;
    background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(255,255,255,0.9));
    border: 1px solid rgba(52, 152, 219, 0.16);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    padding: 8px 10px;
    border-radius: 8px;
}
.rules-container .rule-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 2px;
}
.rules-container .rule-name {
    font-weight: 700;
    color: #2c3e50;
    letter-spacing: 1px;
    font-size: 0.95em;
}
.rules-container .rule-badges { display: flex; gap: 4px; align-items: center; }
.rules-container .badge {
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: .5px;
}
.rules-container .badge-score { color: #27ae60; background: rgba(39,174,96,.12); border: 1px solid rgba(39,174,96,.28); }
.rules-container .badge-mult { color: #8e44ad; background: rgba(142,68,173,.12); border: 1px solid rgba(142,68,173,.28); }
.rules-container .combo-cards { display: flex; flex-wrap: wrap; gap: 4px; }
.rules-container .combo-card {
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(52, 152, 219, 0.06);
    border: 1px solid rgba(52, 152, 219, 0.2);
    font-size: 0.8em;
    color: #2c3e50;
}
.rules-container .combo-card.f1 { background: rgba(231, 76, 60, 0.06); border-color: rgba(231,76,60,0.25); }
.rules-container .combo-card.f2 { background: rgba(243, 156, 18, 0.06); border-color: rgba(243,156,18,0.25); }
.rules-container .combo-card.f3 { background: rgba(39, 174, 96, 0.06); border-color: rgba(39,174,96,0.25); }

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Final Score Screen */
.final-score-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.final-score-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    max-width: 500px;
    width: 90%;
}

.final-score-content h1 {
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* 简易烟花效果 */
.fireworks { position: fixed; inset: 0; pointer-events: none; z-index: 2500; }
.fireworks .fw { position: absolute; left: var(--x); top: var(--y); width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--h,200), 80%, 60%); box-shadow: 0 0 12px hsla(var(--h,200), 80%, 60%, .9); animation: fw-pop 1.2s ease-out forwards; transform: translate(-50%, -50%); }
.fireworks-plus .fw { width: 10px; height: 10px; box-shadow: 0 0 16px hsla(var(--h,200), 85%, 60%, 1); animation-duration: 1.6s; }
@keyframes fw-pop {
    0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0.9; }
    60% { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.1); opacity: 0; }
}

.final-score-display {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.final-score-display .score-item {
    background: rgba(52, 152, 219, 0.1);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1em;
    font-weight: 600;
    color: #2c3e50;
}

.score-value {
    font-size: 1.3em;
    color: #3498db;
    font-weight: bold;
}

.btn-restart {
    background: linear-gradient(145deg, #27ae60, #229954);
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-restart:hover {
    background: linear-gradient(145deg, #229954, #1e8449);
    transform: translateY(-2px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }

    .game-header h1 {
        font-size: 2.2em;
        letter-spacing: 1px;
    }

    .game-layout {
        flex-direction: column;
    }

    .game-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        max-height: none;
        margin-bottom: 20px;
    }

    .transform-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .card {
        width: 60px;
        height: 85px;
        padding: 5px;
    }

    .card-icon {
        font-size: 1.2em;
    }

    .card-name {
        font-size: 0.7em;
    }

    /* Mobile: 仅显示分数，隐藏势力名，并缩小分数字体 */
    .card-faction { display: none !important; }
    .card .card-score { font-size: 0.8em; }

    .play-history .card {
        width: 60px;
        height: 85px;
        padding: 5px;
    }

    .game-controls {
        flex-direction: column;
        align-items: center;
    }

    .btn-primary, .btn-secondary, .btn-warning {
        width: 100%;
        max-width: 200px;
    }

    .preview-info {
        flex-direction: column;
        gap: 8px;
    }

    .preview-label {
        font-size: 0.8em;
        padding: 4px 8px;
    }

    .result-details {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* 确保模态框在所有屏幕尺寸上都居中显示 */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 20px;
    }
    
    .draw-card-container {
        width: 95%;
        max-width: none;
        padding: 30px 20px;
    }
    
    .modal-container {
        width: 95%;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .modal-overlay {
        padding: 15px;
    }
    
    .draw-card-container {
        width: 100%;
        padding: 25px 15px;
    }
    
    .modal-container {
        width: 100%;
    }
    
    .card {
        width: 50px;
        height: 70px;
        padding: 3px;
    }

    .card-icon {
        font-size: 1em;
    }

    .card-name {
        font-size: 0.6em;
    }

    /* Small phones: 进一步缩小分数字体，仍隐藏势力名 */
    .card-faction { display: none !important; }
    .card .card-score { font-size: 0.7em; }

    .play-history .card {
        width: 50px;
        height: 70px;
        padding: 3px;
    }

    .transform-card {
        padding: 15px;
    }

    .transform-icon {
        font-size: 2em;
    }
}

/* 分数淡出动画效果 */
.score-fade-out {
    position: absolute;
    font-size: 2em;
    font-weight: bold;
    color: #3498db;
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.8);
    pointer-events: none;
    z-index: 100;
    animation: scoreFadeUp 2s ease-out forwards;
}

@keyframes scoreFadeUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-20px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(0.8);
    }
}

/* 为不同分数值添加不同颜色 */
.score-fade-out.high-score {
    color: #e74c3c;
    text-shadow: 0 0 15px rgba(231, 76, 60, 0.9);
}

.score-fade-out.medium-score {
    color: #f39c12;
    text-shadow: 0 0 12px rgba(243, 156, 18, 0.8);
}

.score-fade-out.low-score {
    color: #27ae60;
    text-shadow: 0 0 10px rgba(39, 174, 96, 0.7);
}

/* 确保手牌中分数字体颜色不会被父级覆盖 */
.card .card-score.score-increase-text { color: #27ae60 !important; }
.card .card-score.score-decrease-text { color: #e74c3c !important; }
.card .card-score { color: #2c3e50; }

/* 特殊效果信息样式 */
.special-effects-info {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    padding: 12px;
    border: 1px solid rgba(52, 152, 219, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.special-effects-title {
    color: #2c3e50;
    font-size: 0.9em;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
    border-bottom: 1px solid #3498db;
    padding-bottom: 5px;
}

.special-effects-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.special-effect-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 0.8em;
}

.card-info {
    color: #34495e;
    font-weight: 500;
}

.score-info {
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75em;
}

.score-increase-text {
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.score-decrease-text {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}