/* Tetris Game Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2a3a5c 0%, #3d4f6f 50%, #4a5a7a 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
}

/* 泡泡主題背景 - 高對比夢幻漸層 */
body.theme-bubble,
body:not(.theme-candy):not(.theme-space) {
    background: linear-gradient(135deg,
        #e8a0c8 0%,      /* 深粉 - 左上 */
        #c0a0e0 15%,     /* 紫 */
        #90c8e8 30%,     /* 藍 */
        #a0e0d0 45%,     /* 青綠 */
        #d0f0e8 55%,     /* 淺青 */
        #f0e8b0 70%,     /* 黃 */
        #f8d0a0 85%,     /* 橘 */
        #fff0e8 100%);   /* 淺底 */
}

#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

header h1 {
    font-size: 3rem;
    font-weight: bold;
    letter-spacing: 0.5rem;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    margin-bottom: 10px;
    background: linear-gradient(90deg, #00d4ff, #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Mode Selection Screen */
#mode-selection {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#mode-selection.hidden {
    display: none;
}

#mode-selection-content {
    text-align: center;
    padding: 40px;
}

#mode-selection-content h2 {
    font-size: 2.5rem;
    margin-bottom: 40px;
    background: linear-gradient(90deg, #00d4ff, #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#mode-buttons {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 30px 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.mode-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: #00d4ff;
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
}

.mode-btn:active {
    transform: translateY(0);
}

.mode-icon {
    font-size: 3rem;
}

.mode-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
}

.mode-desc {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    max-width: 180px;
}

.mode-hint {
    margin-top: 30px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.4);
    animation: blink 1.5s infinite;
}

/* Stage Info Section */
#stage-info {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#stage-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stage-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

#stage-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#stage-mission {
    font-size: 0.85rem;
    color: #00d4ff;
}

#stage-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

#progress-bar {
    width: 120px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00d4ff, #9b59b6);
    border-radius: 4px;
    transition: width 0.3s ease;
}

#progress-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    min-width: 60px;
}

#time-limit {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: rgba(255, 68, 68, 0.2);
    border-radius: 5px;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

#time-limit.hidden {
    display: none;
}

.time-icon {
    font-size: 1rem;
}

#time-remaining {
    font-size: 1.2rem;
    font-weight: bold;
    color: #00d4ff;
    min-width: 40px;
    text-align: center;
}

#game-area {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* Left Section (Hold + Items) */
#left-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Hold Section */
#hold-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#hold-section h3 {
    font-size: 0.9rem;
    letter-spacing: 0.2rem;
    margin-bottom: 10px;
    color: #00d4ff;
}

#hold-canvas {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

.hint {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 8px;
}

/* Items Section */
#items-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#items-section h3 {
    font-size: 0.9rem;
    letter-spacing: 0.2rem;
    margin-bottom: 10px;
    color: #00ff88;
}

#item-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-slot {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 90px;
    height: 40px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.item-slot.has-item {
    border-color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.item-key {
    font-size: 0.7rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 5px;
    border-radius: 3px;
}

.item-icon {
    font-size: 1.1rem;
    flex: 1;
    text-align: center;
}

.item-timer {
    font-size: 0.65rem;
    color: #00ff88;
    min-width: 20px;
    text-align: right;
}

.item-timer.expiring {
    color: #ff4444;
    animation: itemExpiring 0.5s ease-in-out infinite;
}

/* 道具即將過期閃爍 */
.item-slot.item-expiring {
    animation: itemExpiring 0.5s ease-in-out infinite;
    border-color: #ff4444;
}

@keyframes itemExpiring {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 道具替換選擇介面 */
#item-replace-choice {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 20px 30px;
    z-index: 100;
    text-align: center;
    display: none;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

#item-replace-choice.show {
    display: block;
    animation: popIn 0.3s ease;
}

#item-replace-choice .choice-content p {
    margin: 10px 0;
    color: #fff;
    font-size: 1.1rem;
}

#item-replace-choice .choice-hint {
    color: #ffd700;
    font-size: 0.9rem;
}

/* 變形器方塊選擇介面 */
#transform-choice {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #00ff88;
    border-radius: 15px;
    padding: 25px 35px;
    z-index: 100;
    text-align: center;
    display: none;
    box-shadow: 0 0 40px rgba(0, 255, 136, 0.4);
}

#transform-choice.show {
    display: block;
    animation: popIn 0.3s ease;
}

#transform-choice h3 {
    color: #00ff88;
    font-size: 1.3rem;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

#transform-choice .piece-options {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 15px 0;
}

#transform-choice .piece-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
}

#transform-choice .piece-btn:hover {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00ff88;
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 255, 136, 0.3);
}

#transform-choice .piece-btn .piece-key {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

#transform-choice .piece-btn .piece-name {
    font-size: 1.5rem;
    font-weight: bold;
}

#transform-choice .piece-btn[data-piece="I"] .piece-name { color: #00d4ff; }
#transform-choice .piece-btn[data-piece="O"] .piece-name { color: #ffd700; }
#transform-choice .piece-btn[data-piece="T"] .piece-name { color: #9b59b6; }
#transform-choice .piece-btn[data-piece="S"] .piece-name { color: #2ecc71; }
#transform-choice .piece-btn[data-piece="Z"] .piece-name { color: #ff4444; }
#transform-choice .piece-btn[data-piece="J"] .piece-name { color: #3498db; }
#transform-choice .piece-btn[data-piece="L"] .piece-name { color: #ff8c00; }

#transform-choice .choice-hint {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    margin-top: 10px;
}

/* Board Section */
#board-section {
    position: relative;
}

#game-canvas {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

/* Effect Layer */
#effect-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

#combo-display,
#clear-type-display {
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 0 0 20px currentColor;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Combo Display */
#combo-display.show-combo {
    opacity: 1;
    transform: scale(1);
    color: #ffd700;
    animation: comboPopIn 0.4s ease, comboFadeOut 1.2s ease 0.4s forwards;
}

/* Clear Type Animations - Different styles for different clear types */
#clear-type-display.show-clear {
    opacity: 1;
    transform: scale(1);
    color: #00d4ff;
    animation: popIn 0.3s ease, fadeOut 1.2s ease 0.3s forwards;
}

#clear-type-display.show-clear.clear-single {
    font-size: 1.5rem;
    color: #87ceeb;
    animation: singleClear 0.3s ease, fadeOut 1s ease 0.3s forwards;
}

#clear-type-display.show-clear.clear-double {
    font-size: 2rem;
    color: #00d4ff;
    animation: doubleClear 0.4s ease, fadeOut 1.2s ease 0.4s forwards;
}

#clear-type-display.show-clear.clear-triple {
    font-size: 2.5rem;
    color: #9b59b6;
    text-shadow: 0 0 30px #9b59b6, 0 0 60px #9b59b6;
    animation: tripleClear 0.5s ease, fadeOut 1.4s ease 0.5s forwards;
}

#clear-type-display.show-clear.clear-tetris {
    font-size: 3rem;
    color: #ffd700;
    text-shadow: 0 0 40px #ffd700, 0 0 80px #ff6b6b, 0 0 120px #ff4444;
    animation: tetrisClear 0.6s ease, tetrisFadeOut 1.6s ease 0.6s forwards;
}

#clear-type-display.show-debuff {
    opacity: 1;
    transform: scale(1);
    color: #ff4444;
    animation: shake 0.5s ease, fadeOut 1s ease 0.5s forwards;
}

/* Battle mode effect layer */
.player-board-section .combo-display.show-combo,
.player-board-section .clear-type-display.show-clear {
    opacity: 1;
    transform: scale(1);
}

.player-board-section .combo-display.show-combo {
    color: #ffd700;
    animation: comboPopIn 0.4s ease, comboFadeOut 1.2s ease 0.4s forwards;
}

/* Basic animations */
@keyframes popIn {
    0% { transform: scale(0.5); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes fadeOut {
    to { opacity: 0; transform: scale(0.8) translateY(-20px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Combo specific animations */
@keyframes comboPopIn {
    0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
    50% { transform: scale(1.3) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes comboFadeOut {
    0% { opacity: 1; transform: scale(1) translateY(0); }
    100% { opacity: 0; transform: scale(1.2) translateY(-30px); }
}

/* Single clear animation */
@keyframes singleClear {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Double clear animation */
@keyframes doubleClear {
    0% { transform: scale(0.5) rotate(-5deg); opacity: 0; }
    50% { transform: scale(1.15) rotate(3deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Triple clear animation */
@keyframes tripleClear {
    0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
    30% { transform: scale(1.3) rotate(5deg); }
    60% { transform: scale(0.95) rotate(-2deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Tetris clear animation - extra flashy */
@keyframes tetrisClear {
    0% {
        transform: scale(0.2) rotate(-15deg);
        opacity: 0;
        filter: brightness(2);
    }
    25% {
        transform: scale(1.5) rotate(10deg);
        filter: brightness(2.5);
    }
    50% {
        transform: scale(0.9) rotate(-5deg);
        filter: brightness(1.5);
    }
    75% {
        transform: scale(1.1) rotate(2deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
        filter: brightness(1);
    }
}

@keyframes tetrisFadeOut {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.5);
    }
    100% {
        opacity: 0;
        transform: scale(1.5) translateY(-40px);
        filter: brightness(2);
    }
}

/* Screen shake effect for game canvas */
@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-3px, -2px); }
    20% { transform: translate(3px, 2px); }
    30% { transform: translate(-2px, 3px); }
    40% { transform: translate(2px, -3px); }
    50% { transform: translate(-3px, 1px); }
    60% { transform: translate(3px, -1px); }
    70% { transform: translate(-1px, 3px); }
    80% { transform: translate(1px, -2px); }
    90% { transform: translate(-2px, 2px); }
}

#game-canvas.shake,
.player-board-section canvas.shake {
    animation: screenShake 0.3s ease;
}

/* Stronger shake for Tetris */
@keyframes tetrisShake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5px, -4px); }
    20% { transform: translate(5px, 4px); }
    30% { transform: translate(-4px, 5px); }
    40% { transform: translate(4px, -5px); }
    50% { transform: translate(-5px, 2px); }
    60% { transform: translate(5px, -2px); }
    70% { transform: translate(-2px, 5px); }
    80% { transform: translate(2px, -4px); }
    90% { transform: translate(-4px, 4px); }
}

#game-canvas.tetris-shake,
.player-board-section canvas.tetris-shake {
    animation: tetrisShake 0.5s ease;
}

/* Overlay */
#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 5px;
    z-index: 10;
}

#overlay.hidden {
    display: none;
}

#overlay-content {
    text-align: center;
    padding: 30px;
}

#overlay-title {
    font-size: 2rem;
    margin-bottom: 15px;
    background: linear-gradient(90deg, #00d4ff, #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#overlay-message {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    animation: blink 1.5s infinite;
    white-space: pre-line;
}

@keyframes blink {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.5; }
}

#high-scores {
    margin-top: 20px;
    text-align: left;
}

#high-scores.hidden {
    display: none;
}

#high-scores h3 {
    font-size: 1rem;
    color: #ffd700;
    margin-bottom: 10px;
    text-align: center;
}

#score-list {
    list-style-position: inside;
    font-size: 0.9rem;
}

#score-list li {
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Info Section */
#info-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#next-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#next-section h3 {
    font-size: 0.9rem;
    letter-spacing: 0.2rem;
    margin-bottom: 10px;
    color: #00d4ff;
}

#next-section canvas {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    margin-bottom: 8px;
}

#next-section canvas:last-child {
    margin-bottom: 0;
}

#stats-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #00d4ff;
    min-width: 60px;
    text-align: right;
}

/* Debuff Section */
#debuff-section {
    background: rgba(255, 68, 68, 0.1);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 68, 68, 0.3);
    margin-top: 15px;
}

#debuff-section.hidden {
    display: none;
}

#debuff-section h3 {
    font-size: 0.9rem;
    letter-spacing: 0.2rem;
    margin-bottom: 10px;
    color: #ff4444;
}

#active-debuffs {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.debuff-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #ff6b6b;
    padding: 5px 8px;
    background: rgba(255, 68, 68, 0.15);
    border-radius: 5px;
}

/* Footer */
#controls-hint {
    margin-top: 20px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

/* Help Panel */
#help-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    max-width: 280px;
}

#help-panel.collapsed {
    width: 50px;
    height: auto;
}

#help-panel.collapsed #help-content {
    display: none;
}

#help-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    background: rgba(0, 212, 255, 0.15);
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #00d4ff;
    cursor: pointer;
    font-size: 0.9rem;
    text-align: left;
    transition: background 0.2s;
}

#help-toggle:hover {
    background: rgba(0, 212, 255, 0.25);
}

.toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(0, 212, 255, 0.3);
    border-radius: 50%;
    font-weight: bold;
    font-size: 1rem;
}

#help-panel.collapsed .toggle-text {
    display: none;
}

#help-content {
    padding: 15px;
    max-height: 500px;
    overflow-y: auto;
}

#help-content::-webkit-scrollbar {
    width: 5px;
}

#help-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

#help-content::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 3px;
}

.help-section {
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.help-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.help-section h4 {
    font-size: 0.85rem;
    color: #00d4ff;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.help-section ul {
    list-style: none;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

.help-section ul li {
    padding: 2px 0;
    padding-left: 12px;
    position: relative;
}

.help-section ul li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #00d4ff;
}

.key-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.7rem;
}

.key-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(255, 255, 255, 0.8);
}

.key {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
    color: #ffd700;
    min-width: 18px;
    text-align: center;
}

.item-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-entry {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.85);
    padding: 3px 5px;
    background: rgba(0, 255, 136, 0.08);
    border-radius: 3px;
}

.item-list.bad .item-entry {
    background: rgba(255, 68, 68, 0.1);
}

.item-hint {
    font-size: 0.7rem;
    font-weight: normal;
    color: #00ff88;
}

.item-hint.bad {
    color: #ff6b6b;
}

.item-note {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 6px;
    line-height: 1.5;
}

.item-note.bad {
    color: rgba(255, 100, 100, 0.7);
}

/* Single Player Container */
#single-player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#single-player-container.hidden {
    display: none;
}

/* Battle Mode Styles */
#battle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1400px;
}

#battle-container.hidden {
    display: none;
}

/* Battle Timer */
#battle-timer {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 30px;
    background: rgba(255, 215, 0, 0.1);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 20px;
}

.timer-label {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
}

#battle-time-remaining {
    font-size: 2rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    min-width: 80px;
    text-align: center;
}

#battle-time-remaining.warning {
    color: #ff4444;
    animation: timerPulse 0.5s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Battle Controls Help */
#battle-controls-help {
    display: flex;
    justify-content: center;
    gap: 25px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

#battle-controls-help .controls-player,
#battle-controls-help .controls-items,
#battle-controls-help .controls-tips {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 15px;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}

#battle-controls-help .controls-player:first-child {
    padding-left: 0;
}

#battle-controls-help .controls-player strong,
#battle-controls-help .controls-items strong,
#battle-controls-help .controls-tips strong {
    color: #ffd700;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

#battle-controls-help .controls-player span,
#battle-controls-help .controls-items span,
#battle-controls-help .controls-tips span {
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.4;
}

#battle-controls-help .controls-items {
    max-width: 280px;
}

#battle-controls-help .controls-items em {
    color: #ff6b6b;
    font-style: normal;
    font-weight: bold;
}

#battle-controls-help .controls-global {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.5);
    padding-left: 15px;
    border-right: none;
}

/* Battle Area */
#battle-area {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

/* VS Sign */
#battle-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-size: 2.5rem;
    font-weight: bold;
    color: #ff4444;
    text-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
    animation: vsPulse 2s ease-in-out infinite;
}

@keyframes vsPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* Player Area */
.player-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 15px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 15px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 10px;
}

.player-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #00d4ff;
}

.player-stats-header {
    display: flex;
    gap: 20px;
}

.ko-display, .lines-sent-display {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.ko-display span, .lines-sent-display span {
    color: #ffd700;
    font-weight: bold;
}

/* Player Game Area */
.player-game-area {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

/* Player Left Section (Hold + Items) */
.player-left-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 80px;
}

.player-hold-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.player-hold-section h4,
.player-items-section h4,
.player-next-section h4 {
    font-size: 0.75rem;
    letter-spacing: 0.1rem;
    margin-bottom: 8px;
    color: #00d4ff;
}

.player-hold-section canvas {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

/* Player Items Section */
.player-items-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.player-item-slots {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.player-item-slots .item-slot {
    width: 70px;
    height: 32px;
    font-size: 0.8rem;
}

/* Pending Garbage Indicator */
.pending-garbage {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px;
    background: rgba(255, 68, 68, 0.1);
    border-radius: 5px;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.garbage-bar {
    width: 50px;
    height: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.garbage-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--garbage-width, 0%);
    background: linear-gradient(90deg, #ff4444, #ff6b6b);
    transition: width 0.3s ease;
}

.garbage-bar[data-count]::after {
    width: calc(var(--garbage-width, 0) * 1%);
}

.garbage-count {
    font-size: 0.8rem;
    font-weight: bold;
    color: #ff4444;
    min-width: 20px;
    text-align: center;
}

/* Player Board Section */
.player-board-section {
    position: relative;
}

.player-board-section canvas {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

.player-board-section .effect-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

.player-board-section .combo-display,
.player-board-section .clear-type-display {
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 0 15px currentColor;
    opacity: 0;
    transform: scale(0.5);
}

/* Player Right Section (Next + Stats) */
.player-right-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 70px;
}

.player-next-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.player-next-section canvas {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    margin-bottom: 5px;
}

.player-next-section canvas:last-child {
    margin-bottom: 0;
}

.player-stats-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.player-stats-section .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.player-stats-section .stat-item:last-child {
    border-bottom: none;
}

.player-stats-section .stat-label {
    font-size: 0.7rem;
}

.player-stats-section .stat-value {
    font-size: 0.9rem;
    min-width: 40px;
}

/* Battle Overlay */
#battle-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#battle-overlay.hidden {
    display: none;
}

#battle-overlay-content {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

#battle-result-title {
    font-size: 2.5rem;
    margin-bottom: 30px;
    background: linear-gradient(90deg, #ffd700, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#battle-result-details {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
}

.result-player {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 10px;
    min-width: 150px;
}

.result-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #00d4ff;
}

.result-ko, .result-lines {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
}

.result-ko span, .result-lines span {
    color: #ffd700;
    font-weight: bold;
}

.result-vs {
    font-size: 1.5rem;
    color: #ff4444;
    font-weight: bold;
}

#battle-winner-text {
    font-size: 1.8rem;
    color: #ffd700;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.battle-restart-hint {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.6);
    animation: blink 1.5s infinite;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    #game-area {
        flex-direction: column;
        align-items: center;
    }

    #hold-section {
        order: 1;
        flex-direction: row;
        gap: 15px;
    }

    #board-section {
        order: 2;
    }

    #info-section {
        order: 3;
        flex-direction: row;
    }

    #controls-hint {
        font-size: 0.65rem;
        text-align: center;
        padding: 0 10px;
    }
}

/* ============================================
   主題切換系統 - Theme Switching System
   ============================================ */

/* 主題切換器 - 顯示風格名稱按鈕 */
#theme-switcher {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 2000;
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
}

#theme-switcher .theme-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
}

#theme-switcher .theme-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: translateY(-2px);
}

#theme-switcher .theme-btn.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

#theme-switcher .theme-icon {
    font-size: 1.1rem;
}

#theme-switcher .theme-name {
    font-weight: 500;
}

/* 主題背景層 */
#theme-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

#background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

/* ============================================
   夢幻泡泡主題 - Dreamy Bubble Theme
   大泡泡漂浮 + 水波紋漣漪 + 夢幻淡色系
   ============================================ */

/* 泡泡主題標題 - 高彩度漸層（與背景區隔） */
body.theme-bubble header h1,
body:not(.theme-candy):not(.theme-space) header h1 {
    background: linear-gradient(90deg,
        #e060a0,    /* 桃紅 */
        #8060c0,    /* 紫 */
        #40a0d0,    /* 藍 */
        #40c0a0,    /* 青綠 */
        #e0a040,    /* 橘黃 */
        #e060a0);   /* 桃紅 */
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: bubbleTitleGradient 4s linear infinite;
    text-shadow: none;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 20px rgba(128, 96, 192, 0.5));
}

@keyframes bubbleTitleGradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

/* 泡泡主題文字顏色 - 深色以便閱讀 */
body.theme-bubble,
body:not(.theme-candy):not(.theme-space) {
    color: #3a3a5a;
}

/* 泡泡主題 - 遊戲區塊背景（遮蓋泡泡） */
body.theme-bubble #game-container,
body:not(.theme-candy):not(.theme-space) #game-container {
    position: relative;
    z-index: 10;
    background: linear-gradient(135deg,
        rgba(255, 240, 245, 0.95) 0%,
        rgba(240, 248, 255, 0.92) 25%,
        rgba(255, 250, 240, 0.92) 50%,
        rgba(245, 255, 250, 0.92) 75%,
        rgba(255, 245, 238, 0.95) 100%);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* 泡泡主題側邊欄標題 - 黑字高對比 */
body.theme-bubble #hold-section h3,
body.theme-bubble #next-section h3,
body.theme-bubble #items-section h3,
body:not(.theme-candy):not(.theme-space) #hold-section h3,
body:not(.theme-candy):not(.theme-space) #next-section h3,
body:not(.theme-candy):not(.theme-space) #items-section h3 {
    color: #2a2a4a;
    background: none;
    -webkit-text-fill-color: #2a2a4a;
    font-weight: bold;
    text-shadow: none;
    filter: none;
}

/* 泡泡主題說明文字 - 黑字高對比 */
body.theme-bubble .hint,
body.theme-bubble .controls-hint,
body.theme-bubble #help-panel,
body.theme-bubble #help-panel h4,
body.theme-bubble #help-panel p,
body.theme-bubble #help-panel li,
body.theme-bubble #help-panel .item-entry,
body.theme-bubble #help-panel .item-hint,
body.theme-bubble #help-panel .item-note,
body.theme-bubble #help-panel .item-list,
body.theme-bubble #help-panel .key-item,
body.theme-bubble #help-panel .help-section,
body:not(.theme-candy):not(.theme-space) .hint,
body:not(.theme-candy):not(.theme-space) .controls-hint,
body:not(.theme-candy):not(.theme-space) #help-panel,
body:not(.theme-candy):not(.theme-space) #help-panel h4,
body:not(.theme-candy):not(.theme-space) #help-panel p,
body:not(.theme-candy):not(.theme-space) #help-panel li,
body:not(.theme-candy):not(.theme-space) #help-panel .item-entry,
body:not(.theme-candy):not(.theme-space) #help-panel .item-hint,
body:not(.theme-candy):not(.theme-space) #help-panel .item-note,
body:not(.theme-candy):not(.theme-space) #help-panel .item-list,
body:not(.theme-candy):not(.theme-space) #help-panel .key-item,
body:not(.theme-candy):not(.theme-space) #help-panel .help-section {
    color: #2a2a4a !important;
}

/* 泡泡主題道具說明特殊樣式 */
body.theme-bubble #help-panel .item-hint,
body:not(.theme-candy):not(.theme-space) #help-panel .item-hint {
    color: #4a8a4a !important;
}

body.theme-bubble #help-panel .item-hint.bad,
body:not(.theme-candy):not(.theme-space) #help-panel .item-hint.bad {
    color: #8a4a4a !important;
}

body.theme-bubble .stat-label,
body:not(.theme-candy):not(.theme-space) .stat-label {
    color: #4a4a6a;
}

body.theme-bubble .stat-value,
body:not(.theme-candy):not(.theme-space) .stat-value {
    color: #2a2a4a;
    text-shadow: none;
    font-weight: bold;
}

/* 泡泡主題模式選擇畫面 - 夢幻風格 */
body.theme-bubble #mode-selection,
body:not(.theme-candy):not(.theme-space) #mode-selection {
    background: linear-gradient(135deg,
        rgba(232, 160, 200, 0.97) 0%,
        rgba(192, 160, 224, 0.95) 20%,
        rgba(144, 200, 232, 0.93) 40%,
        rgba(160, 224, 208, 0.93) 60%,
        rgba(240, 232, 176, 0.95) 80%,
        rgba(248, 208, 160, 0.97) 100%);
}

body.theme-bubble #mode-selection-content h2,
body:not(.theme-candy):not(.theme-space) #mode-selection-content h2 {
    background: linear-gradient(90deg, #8b3a75, #3a5a8b, #8b6a3a);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.8));
    font-weight: bold;
}

/* 泡泡主題按鈕 - 高對比 */
body.theme-bubble .mode-btn,
body:not(.theme-candy):not(.theme-space) .mode-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid rgba(139, 90, 139, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    color: #3a3a5a;
}

body.theme-bubble .mode-btn .mode-title,
body:not(.theme-candy):not(.theme-space) .mode-btn .mode-title {
    color: #2a2a4a;
    font-weight: bold;
}

body.theme-bubble .mode-btn .mode-desc,
body:not(.theme-candy):not(.theme-space) .mode-btn .mode-desc {
    color: #4a4a6a;
}

body.theme-bubble .mode-btn:hover,
body:not(.theme-candy):not(.theme-space) .mode-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(139, 58, 117, 0.8);
    box-shadow: 0 8px 30px rgba(139, 58, 117, 0.3);
    transform: translateY(-5px);
}

body.theme-bubble .mode-hint,
body:not(.theme-candy):not(.theme-space) .mode-hint {
    color: #4a4a6a;
}

/* 泡泡主題進度條 */
body.theme-bubble #progress-fill,
body:not(.theme-candy):not(.theme-space) #progress-fill {
    background: linear-gradient(90deg, #e060a0, #6080c0, #40c0a0, #e0a040);
}

/* 泡泡主題對戰計時器標籤 - 深藍紫色高對比 */
body.theme-bubble .timer-label,
body:not(.theme-candy):not(.theme-space) .timer-label {
    color: #4040b0;
}

/* 泡泡主題遊戲面板邊框 */
body.theme-bubble #board-section::before,
body:not(.theme-candy):not(.theme-space) #board-section::before {
    background: linear-gradient(45deg, #e060a0, #8060c0, #40a0d0, #40c0a0, #e0a040, #e060a0);
    background-size: 300% 300%;
    animation: bubbleBorderGlow 4s ease infinite;
}

@keyframes bubbleBorderGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* 泡泡主題 - Canvas 保護（保持方塊原色） */
body.theme-bubble canvas,
body:not(.theme-candy):not(.theme-space) canvas {
    filter: none !important;
    opacity: 1 !important;
}

body.theme-bubble #game-canvas,
body:not(.theme-candy):not(.theme-space) #game-canvas {
    background: rgba(255, 255, 255, 0.2);
}

/* 泡泡主題背景 - 高對比光暈層 */
body.theme-bubble #theme-background,
body:not(.theme-candy):not(.theme-space) #theme-background {
    background:
        radial-gradient(ellipse 90% 60% at 0% 20%, rgba(232, 160, 200, 0.7), transparent),      /* 深粉左上 */
        radial-gradient(ellipse 80% 50% at 100% 30%, rgba(248, 208, 160, 0.6), transparent),    /* 橘右上 */
        radial-gradient(ellipse 70% 50% at 50% 50%, rgba(160, 224, 208, 0.5), transparent),     /* 青綠中央 */
        radial-gradient(ellipse 90% 70% at 20% 80%, rgba(144, 200, 232, 0.6), transparent),     /* 藍左下 */
        radial-gradient(ellipse 80% 60% at 80% 90%, rgba(192, 160, 224, 0.5), transparent),     /* 紫右下 */
        radial-gradient(ellipse 100% 40% at 50% 100%, rgba(255, 255, 255, 0.6), transparent);   /* 白色底部 */
    animation: bubbleBackgroundWave 8s ease-in-out infinite;
}

@keyframes bubbleBackgroundWave {
    0%, 100% {
        background-position: 0% 0%, 0% 0%, 0% 0%;
        filter: hue-rotate(0deg);
    }
    50% {
        background-position: 5% 5%, -5% 5%, 5% -5%;
        filter: hue-rotate(10deg);
    }
}

/* 大泡泡樣式 - 高對比夢幻泡泡 */
.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 25% 25%,
        rgba(255, 255, 255, 1),              /* 高光點 - 純白 */
        rgba(255, 255, 255, 0.85) 15%,       /* 白色漸層 */
        rgba(255, 240, 200, 0.5) 30%,        /* 淡黃 */
        rgba(160, 210, 240, 0.4) 45%,        /* 淡藍 */
        rgba(255, 180, 200, 0.35) 60%,       /* 淡粉 */
        rgba(200, 160, 220, 0.25) 75%,       /* 淡紫 */
        rgba(255, 220, 180, 0.15) 90%,       /* 淡橘 */
        transparent 100%);
    border: 2px solid rgba(255, 255, 255, 0.7);
    box-shadow:
        inset 0 0 60px rgba(255, 255, 255, 0.9),
        inset -25px -25px 70px rgba(160, 210, 240, 0.5),
        inset 15px 15px 50px rgba(255, 180, 200, 0.4),
        0 0 50px rgba(255, 255, 255, 0.7),
        0 0 100px rgba(200, 160, 220, 0.4),
        0 0 150px rgba(160, 210, 240, 0.2);
    animation: floatBubble linear infinite;
    opacity: 0;
    backdrop-filter: blur(4px);
}

.bubble::before {
    content: '';
    position: absolute;
    top: 12%;
    left: 18%;
    width: 35%;
    height: 25%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.8), transparent);
    border-radius: 50%;
    transform: rotate(-40deg);
}

.bubble::after {
    content: '';
    position: absolute;
    bottom: 18%;
    right: 18%;
    width: 18%;
    height: 12%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

@keyframes floatBubble {
    0% {
        transform: translateY(100vh) translateX(0) scale(0.4) rotate(0deg);
        opacity: 0;
    }
    8% {
        opacity: 0.95;
    }
    50% {
        transform: translateY(50vh) translateX(var(--drift, 50px)) scale(0.9) rotate(180deg);
        opacity: 1;
    }
    92% {
        opacity: 0.95;
    }
    100% {
        transform: translateY(-150px) translateX(calc(var(--drift, 50px) * 2)) scale(1.2) rotate(360deg);
        opacity: 0;
    }
}

/* 從頂部往下飄動 */
@keyframes floatBubbleFromTop {
    0% {
        transform: translateY(-150px) translateX(0) scale(0.4) rotate(0deg);
        opacity: 0;
    }
    8% {
        opacity: 0.95;
    }
    50% {
        transform: translateY(50vh) translateX(var(--drift, 50px)) scale(0.9) rotate(180deg);
        opacity: 1;
    }
    92% {
        opacity: 0.95;
    }
    100% {
        transform: translateY(100vh) translateX(calc(var(--drift, 50px) * 2)) scale(1.2) rotate(360deg);
        opacity: 0;
    }
}

/* 從左側往右飄動 */
@keyframes floatBubbleFromLeft {
    0% {
        transform: translateX(-150px) translateY(0) scale(0.4) rotate(0deg);
        opacity: 0;
    }
    8% {
        opacity: 0.95;
    }
    50% {
        transform: translateX(50vw) translateY(var(--drift, 50px)) scale(0.9) rotate(180deg);
        opacity: 1;
    }
    92% {
        opacity: 0.95;
    }
    100% {
        transform: translateX(100vw) translateY(calc(var(--drift, 50px) * 2)) scale(1.2) rotate(360deg);
        opacity: 0;
    }
}

/* 從右側往左飄動 */
@keyframes floatBubbleFromRight {
    0% {
        transform: translateX(150px) translateY(0) scale(0.4) rotate(0deg);
        opacity: 0;
    }
    8% {
        opacity: 0.95;
    }
    50% {
        transform: translateX(-50vw) translateY(var(--drift, 50px)) scale(0.9) rotate(180deg);
        opacity: 1;
    }
    92% {
        opacity: 0.95;
    }
    100% {
        transform: translateX(-100vw) translateY(calc(var(--drift, 50px) * 2)) scale(1.2) rotate(360deg);
        opacity: 0;
    }
}

/* 多方向泡泡類別 */
.bubble.bubble-from-top {
    animation: floatBubbleFromTop linear infinite, bubbleWobble ease-in-out infinite;
}

.bubble.bubble-from-left {
    animation: floatBubbleFromLeft linear infinite, bubbleWobble ease-in-out infinite;
}

.bubble.bubble-from-right {
    animation: floatBubbleFromRight linear infinite, bubbleWobble ease-in-out infinite;
}

/* 水波紋效果 - 夢幻淡色系 */
.water-ripple {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(173, 216, 230, 0.5);
    box-shadow:
        0 0 30px rgba(255, 182, 193, 0.3),
        0 0 60px rgba(255, 250, 205, 0.2);
    animation: rippleExpand 4s ease-out infinite;
    pointer-events: none;
}

@keyframes rippleExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.6;
    }
    100% {
        width: 400px;
        height: 400px;
        margin-left: -200px;
        margin-top: -200px;
        opacity: 0;
    }
}

/* ============================================
   霓虹糖果主題 - Neon Candy Theme
   彩虹條紋 + 波浪動畫 + 糖果光暈
   ============================================ */

body.theme-candy {
    background: linear-gradient(135deg, #6b3a75 0%, #8b4a8f 50%, #a55aa5 100%);
}

/* 糖果主題背景 - 粉紫黃色系 */
body.theme-candy #theme-background {
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 60px,
            rgba(255, 150, 200, 0.08) 60px,
            rgba(255, 150, 200, 0.08) 120px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 60px,
            rgba(180, 120, 200, 0.08) 60px,
            rgba(180, 120, 200, 0.08) 120px
        );
    animation: candyStripeMove 20s linear infinite;
}

body.theme-candy #theme-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 100% 60% at 50% 100%, rgba(255, 150, 200, 0.3), transparent 50%),
        radial-gradient(ellipse 80% 40% at 0% 50%, rgba(255, 230, 100, 0.25), transparent 50%),
        radial-gradient(ellipse 80% 40% at 100% 50%, rgba(200, 150, 230, 0.25), transparent 50%);
    animation: candyGlowPulse 4s ease-in-out infinite;
}

@keyframes candyStripeMove {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 120px 120px, -120px 120px; }
}

@keyframes candyGlowPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* 糖果波浪效果 - 粉紫漸層 */
body.theme-candy #theme-background::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='rgba(255,180,220,0.2)' d='M0,160L48,176C96,192,192,224,288,213.3C384,203,480,149,576,138.7C672,128,768,160,864,181.3C960,203,1056,213,1152,197.3C1248,181,1344,139,1392,117.3L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E");
    background-size: cover;
    animation: candyWave 6s ease-in-out infinite;
}

@keyframes candyWave {
    0%, 100% { transform: translateX(0) scaleY(1); }
    50% { transform: translateX(-20px) scaleY(1.1); }
}

/* 糖果主題泡泡 - 愛心形狀（保留原有漸層與光暈） */
body.theme-candy .bubble {
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 255, 255, 0.7),
        rgba(255, 180, 220, 0.5) 35%,
        rgba(200, 150, 230, 0.4) 55%,
        rgba(255, 230, 100, 0.3) 70%,
        transparent 85%);
    box-shadow:
        inset 0 0 40px rgba(255, 255, 255, 0.6),
        0 0 30px rgba(255, 180, 220, 0.5),
        0 0 50px rgba(200, 150, 230, 0.3);
    border: none;
    border-radius: 0;
    /* 愛心形狀 - 百分比 polygon */
    clip-path: polygon(
        50% 15%,
        65% 0%,
        85% 0%,
        100% 15%,
        100% 35%,
        50% 100%,
        0% 35%,
        0% 15%,
        15% 0%,
        35% 0%
    );
    animation: floatBubble linear infinite, candyBubbleGlow 2s ease-in-out infinite;
}

/* 愛心高光效果 */
body.theme-candy .bubble::before {
    content: '';
    position: absolute;
    top: 12%;
    left: 18%;
    width: 22%;
    height: 25%;
    background: radial-gradient(ellipse, rgba(255, 255, 255, 0.9), transparent 70%);
    border-radius: 50%;
    transform: rotate(-20deg);
}

body.theme-candy .bubble::after {
    content: '';
    position: absolute;
    top: 15%;
    right: 18%;
    width: 18%;
    height: 20%;
    background: radial-gradient(ellipse, rgba(255, 255, 255, 0.6), transparent 70%);
    border-radius: 50%;
    transform: rotate(20deg);
}

@keyframes candyBubbleGlow {
    0%, 100% { filter: hue-rotate(0deg) brightness(1); }
    50% { filter: hue-rotate(20deg) brightness(1.1); }
}

/* 糖果漂浮星星 - 粉紫黃色 */
body.theme-candy .candy-star {
    position: absolute;
    width: 25px;
    height: 25px;
    background: linear-gradient(135deg, #ff96c8, #c896e8, #ffe664);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    animation: candyStarFloat 8s ease-in-out infinite, candyStarSpin 4s linear infinite;
    filter: drop-shadow(0 0 15px rgba(255, 180, 220, 0.6));
}

@keyframes candyStarFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.1); }
}

@keyframes candyStarSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 糖果主題標題 - 粉紫黃 */
body.theme-candy header h1 {
    background: linear-gradient(90deg, #ff96c8, #c896e8, #ffe664, #ff96c8);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: candyGradientFlow 3s linear infinite;
    text-shadow: 0 0 30px rgba(255, 150, 200, 0.6);
}

@keyframes candyGradientFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

body.theme-candy #mode-selection-content h2 {
    background: linear-gradient(90deg, #ff96c8, #c896e8, #ffe664);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 糖果主題按鈕 - 粉紫色系 */
body.theme-candy .mode-btn {
    background: rgba(255, 150, 200, 0.15);
    border: 2px solid rgba(255, 150, 200, 0.5);
    box-shadow: 0 0 20px rgba(255, 150, 200, 0.3);
}

body.theme-candy .mode-btn:hover {
    background: rgba(200, 150, 230, 0.2);
    border-color: rgba(200, 150, 230, 0.7);
    box-shadow: 0 0 30px rgba(200, 150, 230, 0.5);
    animation: candyBounce 0.5s ease;
}

@keyframes candyBounce {
    0%, 100% { transform: translateY(-5px) scale(1); }
    50% { transform: translateY(-12px) scale(1.03); }
}

/* 糖果主題遊戲面板 - 粉紫黃 */
body.theme-candy #board-section::before {
    background: linear-gradient(45deg, #ff96c8, #c896e8, #ffe664, #ff96c8);
    background-size: 300% 300%;
    animation: candyBorderGlow 3s ease infinite;
}

@keyframes candyBorderGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

body.theme-candy #hold-section h3,
body.theme-candy #next-section h3,
body.theme-candy #items-section h3 {
    background: linear-gradient(90deg, #ff96c8, #c896e8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.theme-candy #progress-fill {
    background: linear-gradient(90deg, #ff96c8, #c896e8, #ffe664);
}

/* ============================================
   星際太空主題 - Space Galaxy Theme
   星空點點 + 大流星 + 星雲漩渦
   ============================================ */

body.theme-space {
    background: linear-gradient(135deg, #0a0a15 0%, #0d0d25 50%, #0a0a15 100%);
}

/* 太空主題背景 - 星空 + 星雲 */
body.theme-space #theme-background {
    background:
        radial-gradient(ellipse 150% 100% at 50% 0%, rgba(138, 43, 226, 0.15), transparent 50%),
        radial-gradient(ellipse 100% 80% at 0% 100%, rgba(75, 0, 130, 0.2), transparent 40%),
        radial-gradient(ellipse 100% 80% at 100% 100%, rgba(30, 144, 255, 0.15), transparent 40%);
    animation: spaceNebulaFlow 15s ease-in-out infinite;
}

body.theme-space #theme-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(2px 2px at 20px 30px, rgba(255,255,255,0.8), transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.6), transparent),
        radial-gradient(1px 1px at 90px 40px, rgba(255,255,255,0.9), transparent),
        radial-gradient(2px 2px at 130px 80px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 160px 120px, rgba(255,255,255,0.7), transparent),
        radial-gradient(2px 2px at 200px 50px, rgba(138,43,226,0.8), transparent),
        radial-gradient(1px 1px at 250px 150px, rgba(255,255,255,0.6), transparent),
        radial-gradient(2px 2px at 300px 100px, rgba(30,144,255,0.7), transparent);
    background-size: 350px 200px;
    animation: spaceStarsMove 60s linear infinite;
}

@keyframes spaceNebulaFlow {
    0%, 100% {
        filter: hue-rotate(0deg);
        opacity: 0.8;
    }
    50% {
        filter: hue-rotate(20deg);
        opacity: 1;
    }
}

@keyframes spaceStarsMove {
    0% { background-position: 0 0; }
    100% { background-position: 350px 200px; }
}

/* 星雲漩渦效果 */
body.theme-space #theme-background::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 800px;
    height: 800px;
    margin: -400px 0 0 -400px;
    background:
        conic-gradient(from 0deg,
            transparent 0deg,
            rgba(138, 43, 226, 0.1) 60deg,
            transparent 120deg,
            rgba(30, 144, 255, 0.08) 180deg,
            transparent 240deg,
            rgba(75, 0, 130, 0.1) 300deg,
            transparent 360deg
        );
    border-radius: 50%;
    animation: spaceNebulaRotate 60s linear infinite;
    opacity: 0.6;
}

@keyframes spaceNebulaRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 太空主題 - 隱藏漂浮泡泡 */
body.theme-space .bubble {
    display: none;
}

/* 太空主題 - 旋轉星球 */
body.theme-space #background-effects::before,
body.theme-space #background-effects::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    animation: spacePlanetRotate 20s linear infinite;
    pointer-events: none;
}

/* 星球 1 - 左上角 (紫色星球) */
body.theme-space #background-effects::before {
    top: 8%;
    left: 5%;
    width: 120px;
    height: 120px;
    background:
        radial-gradient(circle at 35% 35%,
            rgba(255, 255, 255, 0.8) 0%,
            rgba(200, 150, 255, 0.6) 20%,
            rgba(138, 43, 226, 0.8) 50%,
            rgba(75, 0, 130, 0.9) 80%,
            rgba(30, 0, 60, 1) 100%);
    box-shadow:
        inset -20px -20px 40px rgba(0, 0, 0, 0.6),
        inset 10px 10px 30px rgba(255, 255, 255, 0.3),
        0 0 60px rgba(138, 43, 226, 0.6),
        0 0 120px rgba(75, 0, 130, 0.4);
    animation-duration: 25s;
}

/* 星球 2 - 右下角 (藍色星球) */
body.theme-space #background-effects::after {
    bottom: 10%;
    right: 8%;
    width: 90px;
    height: 90px;
    background:
        radial-gradient(circle at 30% 30%,
            rgba(255, 255, 255, 0.9) 0%,
            rgba(150, 200, 255, 0.6) 20%,
            rgba(30, 144, 255, 0.8) 50%,
            rgba(65, 105, 225, 0.9) 80%,
            rgba(25, 25, 112, 1) 100%);
    box-shadow:
        inset -15px -15px 30px rgba(0, 0, 0, 0.5),
        inset 8px 8px 25px rgba(255, 255, 255, 0.4),
        0 0 50px rgba(30, 144, 255, 0.5),
        0 0 100px rgba(65, 105, 225, 0.3);
    animation-duration: 18s;
    animation-direction: reverse;
}

@keyframes spacePlanetRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 大流星效果 - 更大更明顯 */
.meteor {
    position: absolute;
    width: 5px;
    height: 200px;
    background: linear-gradient(to bottom,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 15%,
        rgba(255, 255, 255, 1) 45%,
        rgba(138, 43, 226, 0.9) 65%,
        rgba(30, 144, 255, 0.6) 80%,
        transparent 100%);
    transform: rotate(-45deg);
    animation: meteorFall 2.5s linear forwards;
    pointer-events: none;
    filter: blur(0.5px);
    box-shadow:
        0 0 20px rgba(255, 255, 255, 0.7),
        0 0 40px rgba(138, 43, 226, 0.5),
        0 0 60px rgba(30, 144, 255, 0.3);
}

.meteor::before {
    content: '';
    position: absolute;
    top: 45%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 20px 8px rgba(255, 255, 255, 0.9), 0 0 40px 15px rgba(138, 43, 226, 0.5);
}

@keyframes meteorFall {
    0% {
        opacity: 0;
        transform: translateX(0) translateY(0) rotate(-45deg);
    }
    10% {
        opacity: 1;
    }
    85% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateX(500px) translateY(500px) rotate(-45deg);
    }
}

/* 星星閃爍 - 太空版 */
body.theme-space .star {
    width: 3px;
    height: 3px;
    background: #fff;
    box-shadow:
        0 0 8px 3px rgba(255, 255, 255, 0.9),
        0 0 15px 5px rgba(138, 43, 226, 0.6),
        0 0 25px 8px rgba(30, 144, 255, 0.3);
}

body.theme-space .star.large {
    width: 5px;
    height: 5px;
    box-shadow:
        0 0 12px 4px rgba(255, 255, 255, 1),
        0 0 25px 8px rgba(138, 43, 226, 0.7),
        0 0 40px 12px rgba(30, 144, 255, 0.4);
}

/* 太空主題標題 */
body.theme-space header h1 {
    background: linear-gradient(90deg, #8a2be2, #4169e1, #1e90ff, #8a2be2);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: spaceGradient 4s linear infinite;
    text-shadow: 0 0 40px rgba(138, 43, 226, 0.8);
}

@keyframes spaceGradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

body.theme-space #mode-selection-content h2 {
    background: linear-gradient(90deg, #8a2be2, #4169e1, #1e90ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 太空主題按鈕 */
body.theme-space .mode-btn {
    background: rgba(138, 43, 226, 0.1);
    border: 2px solid rgba(138, 43, 226, 0.4);
    box-shadow:
        0 0 25px rgba(138, 43, 226, 0.2),
        inset 0 0 40px rgba(75, 0, 130, 0.1);
}

body.theme-space .mode-btn:hover {
    background: rgba(138, 43, 226, 0.2);
    border-color: rgba(138, 43, 226, 0.8);
    box-shadow:
        0 0 40px rgba(138, 43, 226, 0.4),
        0 0 80px rgba(30, 144, 255, 0.2);
}

/* 太空主題遊戲面板 */
body.theme-space #board-section::before {
    background: linear-gradient(45deg, #8a2be2, #4169e1, #1e90ff, #8a2be2);
    background-size: 300% 300%;
    animation: spaceBorderGlow 4s ease infinite;
}

@keyframes spaceBorderGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

body.theme-space #hold-section,
body.theme-space #next-section {
    border-color: rgba(138, 43, 226, 0.3);
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.15);
}

body.theme-space #hold-section h3,
body.theme-space #next-section h3,
body.theme-space #items-section h3 {
    background: linear-gradient(90deg, #8a2be2, #1e90ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.theme-space #progress-fill {
    background: linear-gradient(90deg, #8a2be2, #4169e1, #1e90ff);
}

/* ============================================
   通用主題星星閃爍
   ============================================ */

.star {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow:
        0 0 6px 2px rgba(255, 255, 255, 0.8),
        0 0 12px 4px rgba(0, 212, 255, 0.5);
    animation: twinkle ease-in-out infinite;
}

.star.large {
    width: 6px;
    height: 6px;
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}

/* ============================================
   強化遊戲動畫效果
   ============================================ */

/* 失敗鼓勵動畫 - 放大效果 */
.game-over-emoji {
    font-size: 5rem;
    margin-bottom: 25px;
    animation: sadBounce 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.5));
}

@keyframes sadBounce {
    0%, 100% {
        transform: translateY(0) rotate(-8deg) scale(1);
    }
    25% {
        transform: translateY(-15px) rotate(0deg) scale(1.05);
    }
    50% {
        transform: translateY(-5px) rotate(8deg) scale(1);
    }
    75% {
        transform: translateY(-20px) rotate(0deg) scale(1.1);
    }
}

.encourage-container {
    position: relative;
    padding: 25px;
    margin: 25px 0;
}

.encourage-text {
    font-size: 1.6rem;
    line-height: 1.8;
    color: #ff9ff3;
    text-shadow:
        0 0 15px rgba(255, 159, 243, 0.6),
        0 0 30px rgba(255, 159, 243, 0.3);
    animation: encouragePulse 2s ease-in-out infinite;
    white-space: pre-line;
}

@keyframes encouragePulse {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.08);
    }
}

/* 勝利祝賀動畫 - 放大效果 */
.victory-emoji {
    font-size: 6rem;
    animation: victoryBounce 0.8s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.8));
}

@keyframes victoryBounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-30px) scale(1.15);
    }
}

.new-record {
    font-size: 2.5rem;
    color: #ffd700;
    text-shadow:
        0 0 15px rgba(255, 215, 0, 0.8),
        0 0 30px rgba(255, 215, 0, 0.6),
        0 0 45px rgba(255, 215, 0, 0.4);
    animation: recordPulse 1s ease-in-out infinite, recordRainbow 3s linear infinite;
    background: linear-gradient(90deg, #ffd700, #ff6b9d, #00d4ff, #ffd700);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 15px 0;
}

@keyframes recordPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

@keyframes recordRainbow {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* 彩紙效果 - 放大 */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1000;
}

.confetti {
    position: absolute;
    width: 14px;
    height: 14px;
    opacity: 0;
    animation: confettiFall linear forwards;
}

.confetti.square { border-radius: 3px; }
.confetti.circle { border-radius: 50%; }
.confetti.star {
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.confetti.heart {
    width: 16px;
    height: 16px;
    background: #ff6b9d !important;
    clip-path: path('M8 14s-6-4.35-6-8a4 4 0 0 1 6-3.5A4 4 0 0 1 14 6c0 3.65-6 8-6 8z');
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(-30px) rotate(0deg) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(1080deg) scale(0.5);
    }
}

/* 煙火效果 - 放大 */
.firework-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: particleSpread 1.5s ease-out forwards;
}

@keyframes particleSpread {
    0% {
        transform: translate(0, 0) scale(1.5);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* 閃爍星星 - 放大 */
.sparkle {
    position: absolute;
    pointer-events: none;
    animation: sparkleAnim 1s ease-out forwards;
}

.sparkle::before,
.sparkle::after {
    content: '';
    position: absolute;
    background: #ffd700;
}

.sparkle::before {
    width: 30px;
    height: 6px;
    top: 12px;
    left: 0;
    border-radius: 3px;
}

.sparkle::after {
    width: 6px;
    height: 30px;
    top: 0;
    left: 12px;
    border-radius: 3px;
}

@keyframes sparkleAnim {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.3) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

/* 消行特效 - 放大增強 */
.clear-ripple {
    position: absolute;
    border-radius: 50%;
    border: 4px solid transparent;
    background: linear-gradient(45deg, #00d4ff, #9b59b6, #ff6b9d, #ffd700) border-box;
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    animation: rippleExpandEnhanced 1s ease-out forwards;
    pointer-events: none;
}

@keyframes rippleExpandEnhanced {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 300px;
        height: 300px;
        margin-left: -150px;
        margin-top: -150px;
        opacity: 0;
    }
}

.block-fragment {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    animation: fragmentFlyEnhanced 0.8s ease-out forwards;
    pointer-events: none;
}

@keyframes fragmentFlyEnhanced {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(var(--fx), var(--fy)) rotate(var(--fr)) scale(0);
        opacity: 0;
    }
}

.particle-burst {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: burstAnimEnhanced 0.7s ease-out forwards;
    pointer-events: none;
}

@keyframes burstAnimEnhanced {
    0% {
        transform: translate(0, 0) scale(1.5);
        opacity: 1;
    }
    100% {
        transform: translate(var(--px), var(--py)) scale(0.3);
        opacity: 0;
    }
}

/* Tetris 消除特殊效果 - 更強烈 */
.tetris-clear {
    animation: tetrisCelebrateEnhanced 1s ease-out;
}

@keyframes tetrisCelebrateEnhanced {
    0% { filter: brightness(1); }
    20% { filter: brightness(2.5) hue-rotate(30deg); }
    40% { filter: brightness(1.8) hue-rotate(60deg); }
    60% { filter: brightness(2.2) hue-rotate(90deg); }
    80% { filter: brightness(1.5) hue-rotate(120deg); }
    100% { filter: brightness(1) hue-rotate(0deg); }
}

/* 連擊顯示增強 */
#combo-display {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 107, 157, 0.25));
    border: 3px solid rgba(255, 215, 0, 0.6);
    border-radius: 20px;
    padding: 15px 30px;
    font-size: 1.3rem;
    box-shadow:
        0 0 30px rgba(255, 215, 0, 0.4),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
}

/* 消行類型顯示增強 */
#clear-type-display {
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 4px;
    font-size: 1.4rem;
}

#clear-type-display.tetris {
    color: #ffd700;
    text-shadow:
        0 0 25px rgba(255, 215, 0, 0.9),
        0 0 50px rgba(255, 215, 0, 0.6);
    animation: tetrisTextEnhanced 0.6s ease-in-out;
}

@keyframes tetrisTextEnhanced {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.5); }
}

/* 關卡進度增強 */
#progress-bar {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 212, 255, 0.4);
    border-radius: 12px;
    overflow: hidden;
}

#progress-fill {
    background: linear-gradient(90deg, #00d4ff, #9b59b6, #ff6b9d);
    background-size: 200% 100%;
    animation: progressGradient 2s linear infinite;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.6);
    border-radius: 10px;
}

@keyframes progressGradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* 遊戲面板增強發光邊框 */
#board-section {
    position: relative;
}

#board-section::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(45deg, #00d4ff, #9b59b6, #ff6b9d, #00d4ff);
    background-size: 300% 300%;
    border-radius: 14px;
    z-index: -1;
    animation: borderGlow 4s ease infinite;
    opacity: 0.6;
}

@keyframes borderGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* 增強標題光暈效果 */
header h1 {
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    0% {
        text-shadow:
            0 0 25px rgba(0, 212, 255, 0.6),
            0 0 50px rgba(0, 212, 255, 0.4);
        filter: brightness(1);
    }
    100% {
        text-shadow:
            0 0 40px rgba(0, 212, 255, 0.8),
            0 0 80px rgba(155, 89, 182, 0.6),
            0 0 100px rgba(0, 212, 255, 0.4);
        filter: brightness(1.15);
    }
}

