/* ===== 全局重置 & 基础 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
body {
    background: #f0f0f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
    touch-action: none;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 400;
    backdrop-filter: blur(4px);
}
.panel-overlay.active {
    display: flex;
}
.panel-box {
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px 32px;
    max-width: 420px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    position: relative;
}
.panel-box h2 {
    font-size: 22px;
    font-weight: 700;
    color: #222;
    text-align: center;
    margin-bottom: 20px;
}
.panel-box .sub {
    font-size: 14px;
    color: #777;
    text-align: center;
    margin-bottom: 16px;
}
.panel-box .field-group {
    margin-bottom: 14px;
}
.panel-box .field-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #444;
    margin-bottom: 4px;
}
.panel-box .field-group input,
.panel-box .field-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    background: #fafafa;
    transition: border 0.2s;
}
.panel-box .field-group input:focus,
.panel-box .field-group select:focus {
    border-color: #1a1a1a;
    outline: none;
    background: #fff;
}
.panel-box .field-group .hint {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}
.panel-box .btn-row {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}
.panel-box .btn-row .btn {
    flex: 1;
    padding: 12px 0;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    min-width: 80px;
}
.panel-box .btn-row .btn:active {
    transform: scale(0.96);
}
.btn-primary {
    background: #1a1a1a;
    color: #fff;
}
.btn-primary:hover {
    background: #333;
}
.btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}
.btn-secondary:hover {
    background: #e5e5e5;
}
.btn-danger {
    background: #d32f2f;
    color: #fff;
}
.btn-danger:hover {
    background: #b71c1c;
}
.btn-success {
    background: #2e7d32;
    color: #fff;
}
.btn-success:hover {
    background: #1b5e20;
}
.btn-warning {
    background: #f57c00;
    color: #fff;
}
.btn-warning:hover {
    background: #e65100;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}
.info-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 14px 16px;
    margin: 10px 0 14px;
    border: 1px solid #eee;
}
.info-card .row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
}
.info-card .row .label {
    color: #777;
}
.info-card .row .value {
    font-weight: 600;
    color: #222;
}
.info-card .highlight {
    color: #1976d2;
    font-weight: 700;
}
.waiting-text {
    text-align: center;
    font-size: 16px;
    color: #555;
    padding: 10px 0;
}
.waiting-text .dot {
    display: inline-block;
    animation: dotPulse 1.4s infinite;
}
.waiting-text .dot:nth-child(2) {
    animation-delay: 0.2s;
}
.waiting-text .dot:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes dotPulse {
    0%,
    80%,
    100% {
        opacity: 0;
    }
    40% {
        opacity: 1;
    }
}
.room-id-display {
    background: #e3f2fd;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 4px;
    color: #0d47a1;
    margin: 6px 0 12px;
    font-family: monospace;
}

/* ===== 开始界面 ===== */
#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}
.start-container {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    text-align: center;
    max-width: 400px;
    width: 90%;
}
.start-container h1 {
    font-size: 28px;
    color: #222;
    margin-bottom: 30px;
}
.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}
.mode-btn {
    padding: 14px;
    font-size: 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.mode-btn:not(:disabled) {
    background: #1a1a1a;
    color: white;
}
.mode-btn:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
}
.mode-btn:not(:disabled):hover {
    background: #333;
    transform: translateY(-2px);
}
#settings-panel {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}
#settings-panel.hidden {
    display: none;
}
.setting-group {
    margin-bottom: 15px;
    text-align: left;
}
.setting-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #555;
    font-weight: 500;
}
.setting-group input[type="number"],
.setting-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}
.setting-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.setting-buttons button {
    flex: 1;
    padding: 12px;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}
#start-game-btn {
    background: #1a1a1a;
    color: white;
}
#cancel-settings-btn {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

/* ===== 游戏帮助按钮（纯文字下划线） ===== */
.help-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: #1976d2;
    text-decoration: underline;
    cursor: pointer;
    padding: 6px 0;
    margin-top: 10px;
    display: inline-block;
}
.help-btn:hover {
    color: #0d47a1;
}

/* ===== 游戏样式 ===== */
.time-display {
    font-size: 12px;
    color: #777;
    margin-top: 2px;
}
#opponent-area.hidden,
#board-container.hidden,
#player-area.hidden,
#game-over.hidden {
    display: none;
}
#opponent-area {
    width: 100%;
    max-width: 500px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
    z-index: 5;
}
.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: relative;
}
.avatar.black {
    background: #1a1a1a;
    color: white;
}
.avatar.white {
    background: #f5f5f5;
    color: #333;
    border: 2px solid #ddd;
}
.avatar.hit {
    animation: avatarHit 0.4s ease;
}
@keyframes avatarHit {
    0%,
    100% {
        transform: translateX(0) scale(1);
    }
    20% {
        transform: translateX(-8px) rotate(-8deg) scale(0.95);
    }
    40% {
        transform: translateX(6px) rotate(6deg) scale(0.95);
    }
    60% {
        transform: translateX(-4px) rotate(-4deg);
    }
    80% {
        transform: translateX(2px) rotate(2deg);
    }
}
.info {
    flex: 1;
    min-width: 0;
}
.name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}
.name {
    font-size: 16px;
    font-weight: 700;
    color: #222;
}
.turn-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.3s;
    border: 1px solid #bbdefb;
    white-space: nowrap;
}
.turn-badge.active {
    opacity: 1;
}
.hp-container {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}
.hp-bar-bg {
    flex: 1;
    height: 14px;
    background: #e8e8e8;
    border-radius: 7px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}
.hp-bar-fill {
    height: 100%;
    border-radius: 7px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.hp-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}
@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}
.hp-bar-fill.black {
    background: linear-gradient(90deg, #444, #1a1a1a);
}
.hp-bar-fill.white {
    background: linear-gradient(90deg, #ff6b6b, #e53935);
}
.hp-text {
    font-size: 14px;
    font-weight: 700;
    color: #555;
    min-width: 45px;
    text-align: right;
    flex-shrink: 0;
    position: relative;
}

/* ===== 攻击计数（在血量数字上方） ===== */
.attack-count {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    color: #fff;
    font-weight: 800;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    z-index: 100;
    background: rgba(0, 0, 0, 0.75);
    padding: 3px 12px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    display: block;
    letter-spacing: 1px;
    min-width: 28px;
    text-align: center;
}
.attack-count.hidden {
    display: none !important;
    opacity: 0;
}
.attack-count.fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(-4px);
}

.placeholder {
    width: 44px;
    flex-shrink: 0;
    margin-left: 8px;
    visibility: hidden;
    align-self: stretch;
}
#board-container {
    position: relative;
    margin: 15px auto;
    width: 95vw;
    max-width: 450px;
    aspect-ratio: 1;
    perspective: 1000px;
    transform-style: preserve-3d;
}
#board-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotateX(0deg) rotateY(0deg) translateZ(0);
}
#board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    width: 100%;
    height: 100%;
    gap: 2px;
    background: #d0d0d0;
    border: 2px solid #bbb;
    border-radius: 8px;
    padding: 2px;
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.cell {
    background: #fff;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}
.cell:active {
    background: #f0f0f0;
}
.cell.special {
    background: #fff8e1;
    box-shadow: inset 0 0 12px rgba(255, 193, 7, 0.4);
}
.cell.special::after {
    content: '✦';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: #ffc107;
    opacity: 0.7;
    pointer-events: none;
    text-shadow: 0 0 4px rgba(255, 193, 7, 0.5);
}
.cell.heal {
    background: #e8f5e9;
    box-shadow: inset 0 0 12px rgba(76, 175, 80, 0.5);
}
.cell.heal::after {
    content: '\f621';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    color: #2e7d32;
    opacity: 0.9;
    pointer-events: none;
    text-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}
.cell.weak {
    background: #ffebee;
    box-shadow: inset 0 0 12px rgba(244, 67, 54, 0.5);
}
.cell.weak::after {
    content: '\f57a';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    color: #c62828;
    opacity: 0.9;
    pointer-events: none;
    text-shadow: 0 0 8px rgba(244, 67, 54, 0.6);
}
@keyframes spawnHeal {
    0% { background: #4caf50; box-shadow: 0 0 30px #4caf50; transform: scale(1.2); }
    100% { background: #e8f5e9; box-shadow: 0 0 12px rgba(76,175,80,0.5); transform: scale(1); }
}
@keyframes spawnWeak {
    0% { background: #f44336; box-shadow: 0 0 30px #f44336; transform: scale(1.2); }
    100% { background: #ffebee; box-shadow: 0 0 12px rgba(244,67,54,0.5); transform: scale(1); }
}
.cell.spawn-heal {
    animation: spawnHeal 0.6s ease forwards;
}
.cell.spawn-weak {
    animation: spawnWeak 0.6s ease forwards;
}
.cell.heal .place-ripple {
    background: rgba(76, 175, 80, 0.5) !important;
    border-color: rgba(76, 175, 80, 0.8) !important;
}
.cell.weak .place-ripple {
    background: rgba(244, 67, 54, 0.6) !important;
    border-color: rgba(244, 67, 54, 0.9) !important;
}
.place-ripple {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 8;
    animation: rippleExpand 0.6s ease-out forwards;
}
@keyframes rippleExpand {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}
.threat-line {
    position: absolute;
    height: 3px;
    background: #ff9800;
    border-radius: 2px;
    z-index: 15;
    pointer-events: none;
    box-shadow: 0 0 8px rgba(255, 152, 0, 0.6);
    transform-origin: left center;
    opacity: 0.9;
}
.achievement-line {
    position: absolute;
    height: 5px;
    background: linear-gradient(90deg, #ffd700, #ff8c00, #ffd700);
    background-size: 200% 100%;
    border-radius: 3px;
    z-index: 16;
    pointer-events: none;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 140, 0, 0.4);
    transform-origin: left center;
    animation: achievementGlow 0.4s ease infinite alternate;
}
@keyframes achievementGlow {
    from {
        opacity: 0.8;
        filter: brightness(1);
    }
    to {
        opacity: 1;
        filter: brightness(1.3);
    }
}
#piece-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    transform-style: preserve-3d;
}
.piece {
    position: absolute;
    width: calc(100% / 9 - 4px);
    height: calc(100% / 9 - 4px);
    border-radius: 50%;
    top: 0;
    left: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
    z-index: 5;
    transform: translateZ(25px);
    backface-visibility: hidden;
}
.piece.black {
    background: radial-gradient(circle at 35% 35%, #555, #0d0d0d);
    border: 1px solid #333;
}
.piece.white {
    background: radial-gradient(circle at 35% 35%, #fff, #e0e0e0);
    border: 1px solid #ccc;
}
.piece.placing {
    animation: placeDrop 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
@keyframes placeDrop {
    0% {
        transform: translateZ(80px) scale(1.5);
        opacity: 0;
    }
    60% {
        transform: translateZ(25px) scale(0.9);
        opacity: 1;
    }
    100% {
        transform: translateZ(25px) scale(1);
        opacity: 1;
    }
}
.piece.eliminating {
    animation: eliminate 0.5s ease forwards;
}
@keyframes eliminate {
    0% {
        transform: translateZ(25px) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateZ(25px) scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: translateZ(25px) scale(0);
        opacity: 0;
    }
}
#battle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
    display: none;
}
#battle-canvas.active {
    display: block;
}
#effect-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
    overflow: hidden;
    transform-style: preserve-3d;
}
.damage-text {
    position: fixed;
    font-size: 22px;
    font-weight: bold;
    z-index: 150;
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.damage-text.normal {
    color: #ff4444;
}
@keyframes damageFloat {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-50px) scale(1.3);
        opacity: 0;
    }
}
#player-area {
    width: 100%;
    max-width: 500px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    position: relative;
    z-index: 5;
}
.special-flash {
    animation: specialFlash 0.6s ease;
}
@keyframes specialFlash {
    0% {
        background: #fff8e1;
    }
    50% {
        background: #ffe082;
    }
    100% {
        background: #fff8e1;
    }
}
.line-highlight {
    animation: lineFlash 0.8s ease infinite;
}
@keyframes lineFlash {
    0%,
    100% {
        opacity: 0.3;
        background: #ffebee;
    }
    50% {
        opacity: 0.8;
        background: #ffcdd2;
    }
}
#game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.96);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    gap: 20px;
}
#game-over.show {
    display: flex;
}
#game-over h1 {
    font-size: 36px;
    color: #222;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    padding: 0 20px;
}
#game-over .game-over-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}
#game-over .game-over-buttons button {
    padding: 14px 36px;
    font-size: 18px;
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-weight: 600;
}
#game-over .game-over-buttons button:active {
    transform: scale(0.95);
}
@media (max-height: 700px) {
    .avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    #board-container {
        margin: 8px auto;
    }
}
.status-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
.status-badge.waiting {
    background: #fff3e0;
    color: #e65100;
}
.status-badge.ready {
    background: #e8f5e9;
    color: #2e7d32;
}
.status-badge.playing {
    background: #e3f2fd;
    color: #0d47a1;
}
.player-list {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 8px 0 12px;
    flex-wrap: wrap;
}
.player-chip {
    background: #f5f5f5;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}
.player-chip .color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.2);
}
.player-chip .color-dot.black-dot {
    background: #1a1a1a;
}
.player-chip .color-dot.white-dot {
    background: #f5f5f5;
    border-color: #bbb;
}
.player-chip.host {
    border-color: #ffc107;
    background: #fff8e1;
}
.player-chip.you {
    border-color: #1976d2;
    background: #e3f2fd;
}
.player-chip .kick-btn {
    background: #d32f2f;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    margin-left: 6px;
    transition: background 0.2s;
}
.player-chip .kick-btn:active {
    background: #b71c1c;
    transform: scale(0.95);
}
.countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
    backdrop-filter: blur(6px);
}
.countdown-overlay.active {
    display: flex;
}
.countdown-number {
    font-size: 120px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    animation: countPop 0.6s ease;
    line-height: 1;
}
.countdown-label {
    color: #fff;
    font-size: 28px;
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    letter-spacing: 2px;
}
@keyframes countPop {
    0% {
        transform: scale(2);
        opacity: 0;
    }
    60% {
        transform: scale(0.9);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}
.toast-msg {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 12px 28px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 500;
    z-index: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
    max-width: 90%;
    text-align: center;
}
.toast-msg.show {
    opacity: 1;
}
.loading-tip {
    position: fixed;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 14px;
    z-index: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.loading-tip.show {
    opacity: 1;
}
.loading-tip .progress-text {
    font-weight: 700;
    color: #ffc107;
    min-width: 36px;
}
#surrender-container {
    position: relative;
    flex-shrink: 0;
    margin-left: 8px;
    width: 44px;
    height: 44px;
}
.surrender-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid #e0e0e0;
    background: #fafafa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s, border-color 0.2s;
    touch-action: none;
    -webkit-touch-callout: none;
    outline: none;
    padding: 0;
}
.surrender-btn:active {
    transform: scale(0.94);
}
.surrender-btn .surrender-text {
    font-size: 9px;
    font-weight: 700;
    color: #777;
    pointer-events: none;
    z-index: 1;
    line-height: 1.2;
    text-align: center;
    letter-spacing: 0.3px;
    transition: color 0.2s;
}
.surrender-btn .surrender-text .icon {
    display: block;
    font-size: 14px;
    margin-bottom: 1px;
}
.surrender-btn .progress-ring {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 56px;
    height: 56px;
    pointer-events: none;
    transform: rotate(-90deg);
}
.surrender-btn .progress-ring .ring-bg {
    fill: none;
    stroke: #e8e8e8;
    stroke-width: 4;
}
.surrender-btn .progress-ring .ring-fill {
    fill: none;
    stroke: #d32f2f;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.08s linear;
    filter: drop-shadow(0 0 4px rgba(211, 47, 47, 0.3));
}
.surrender-btn.pressing {
    border-color: #d32f2f;
    background: #fff5f5;
    animation: surrenderPulse 0.5s ease infinite alternate;
}
.surrender-btn.pressing .surrender-text {
    color: #d32f2f;
}
@keyframes surrenderPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.2);
    }
    100% {
        box-shadow: 0 0 0 12px rgba(211, 47, 47, 0);
    }
}
.surrender-btn.surrendered {
    border-color: #d32f2f;
    background: #d32f2f;
    transform: scale(0.9);
}
.surrender-btn.surrendered .surrender-text {
    color: #fff;
}
.surrender-btn.surrendered .progress-ring .ring-fill {
    stroke: #fff;
}
.btn-match {
    background: linear-gradient(135deg, #43a047, #2e7d32);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 0;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: center;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}
.btn-match:active {
    transform: scale(0.96);
}
.btn-match:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}
.btn-row .btn-full {
    flex: 1 1 100%;
}
.waiting-as-joiner .waiting-text {
    color: #1976d2;
}
.waiting-as-joiner .waiting-text .dot {
    color: #1976d2;
}
#game-over .sub-text {
    font-size: 18px;
    color: #666;
    margin-top: -10px;
}
/* ===== 特殊机制开关样式 ===== */
.specials-group {
    border-top: 1px solid #eee;
    padding-top: 12px;
    margin-top: 12px;
}
.specials-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #444;
    margin-bottom: 6px;
}
.switch-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
.switch input:checked + .slider {
    background-color: #2e7d32;
}
.switch input:checked + .slider:before {
    transform: translateX(20px);
}
.switch-label {
    font-size: 14px;
    color: #333;
}

/* ===== 游戏帮助 - 纯文字 + 横线分隔 ===== */
.help-content {
    padding: 4px 0;
}
.help-section {
    padding: 14px 0 12px 0;
    border-bottom: 1px solid #e8e8e8;
}
.help-section:last-child {
    border-bottom: none;
}
.help-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 6px;
}
.help-section p {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin: 0;
}
.help-section ul {
    margin: 4px 0 0 0;
    padding-left: 18px;
}
.help-section ul li {
    font-size: 14px;
    color: #555;
    line-height: 1.7;
    margin-bottom: 2px;
    list-style-type: disc;
}
.help-section ul li strong {
    color: #222;
    font-weight: 600;
}
/* 快速匹配按钮 - 匹配中状态 */
.btn-match.matching {
    background: linear-gradient(135deg, #f57c00, #e65100);
    animation: matchPulse 1s ease infinite alternate;
    cursor: not-allowed;
}
@keyframes matchPulse {
    0% { box-shadow: 0 0 0 0 rgba(245, 124, 0, 0.4); }
    100% { box-shadow: 0 0 0 10px rgba(245, 124, 0, 0); }
}
/* ===== 头像图片样式 ===== */
.avatar {
    overflow: hidden;
}
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.player-chip .avatar-thumb {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    margin-right: 6px;
    vertical-align: middle;
}
.player-chip .avatar-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.player-chip .color-dot {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    margin-right: 6px;
    flex-shrink: 0;
}

/* ===== 冲天光柱 ===== */
.beam {
    position: absolute;
    width: 4px;
    background: currentColor;
    left: 50%;
    transform: translateX(-50%) scaleY(0);
    animation: beamRise 0.2s ease-out forwards;
    pointer-events: none;
    z-index: 999;
    box-shadow:
        0 0 30px currentColor,
        0 0 60px currentColor,
        0 0 100px currentColor;
    border-radius: 2px;
}
@keyframes beamRise {
    0% {
        transform: translateX(-50%) scaleY(0);
        opacity: 0.95;
    }
    100% {
        transform: translateX(-50%) scaleY(1);
        opacity: 0.7;
    }
}

/* ===== 水波扩散（替换原雾效） ===== */
.wave-container {
    position: absolute;
    pointer-events: none;
    z-index: 60;
    overflow: visible;
    will-change: transform;
    border-radius: 50%;
}
.wave-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.7;
    animation: waveExpand 1.8s ease-out infinite;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border: 2px solid currentColor;
    background: none;
    box-shadow: 0 0 15px currentColor, inset 0 0 15px currentColor;
    will-change: transform, opacity;
}
@keyframes waveExpand {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.8;
        border-width: 3px;
    }
    50% {
        opacity: 0.5;
        border-width: 2px;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
        border-width: 0.5px;
    }
}
