/* ===== 基礎設定與變數 ===== */
:root {
    /* 配色系統 */
    --bg-primary: #0a0e27;
    --bg-secondary: #1a1f3a;
    --bg-card: rgba(26, 31, 58, 0.6);

    --color-primary: #7c3aed;
    --color-secondary: #ec4899;
    --color-accent: #06b6d4;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* 漸層效果 */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-gold: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);

    /* 間距 */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* 陰影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.5);

    /* 動畫 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===== 全域樣式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(124, 58, 237, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 50%);
}

/* ===== 畫面切換 ===== */
.screen {
    display: none;
    min-height: 100vh;
    padding: var(--spacing-lg);
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 開始畫面 ===== */
#startScreen {
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 100%);
}

.title-container {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    animation: floatAnimation 3s ease-in-out infinite;
}

@keyframes floatAnimation {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.game-title {
    font-size: 4rem;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 40px rgba(124, 58, 237, 0.5);
    margin-bottom: var(--spacing-sm);
    letter-spacing: 2px;
}

.title-icon {
    display: inline-block;
    animation: rotateIcon 2s ease-in-out infinite;
}

@keyframes rotateIcon {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(15deg);
    }
}

.subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-top: var(--spacing-sm);
}

.btn-start {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-start::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-start:hover::before {
    width: 300px;
    height: 300px;
}

.btn-start:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.8);
}

.start-info {
    margin-top: var(--spacing-xl);
    font-size: 1.2rem;
    color: var(--text-muted);
}

/* ===== 關卡選擇畫面 ===== */
#stageSelectScreen {
    display: none;
}

#stageSelectScreen.active {
    display: block;
}

.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
}

.screen-header h2 {
    font-size: 2rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn-back {
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    backdrop-filter: blur(5px);
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--color-primary);
}

.stage-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.stage-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stage-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.stage-card:hover::before {
    opacity: 0.1;
}

.stage-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.stage-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.stage-card.locked:hover {
    transform: none;
    box-shadow: none;
}

.stage-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
    filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.5));
}

.stage-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

.stage-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stage-status {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-xs);
    background: var(--gradient-success);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.player-status-bar {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xl);
    padding: var(--spacing-md);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.status-item .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.status-item .value {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===== 遊戲畫面 ===== */
#gameScreen.active {
    display: block;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
}

.stage-info h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-xs);
}

.progress-info {
    color: var(--text-secondary);
    font-size: 1rem;
}

.game-container {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    gap: var(--spacing-md);
    height: calc(100vh - 200px);
}

/* 左側面板 - 角色 */
.left-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.character-panel {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: var(--spacing-md);
}

.character {
    width: 200px;
    height: 200px;
    margin: 0 auto var(--spacing-md);
    position: relative;
    animation: idleAnimation 2s ease-in-out infinite;
}

@keyframes idleAnimation {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* 勇者基礎造型 */
.character-base {
    width: 100%;
    height: 100%;
    position: relative;
}

.head {
    width: 60px;
    height: 60px;
    background: #fcd34d;
    border-radius: 50%;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    border: 3px solid #f59e0b;
}

.face {
    position: relative;
    width: 100%;
    height: 100%;
}

.eye {
    width: 8px;
    height: 8px;
    background: #1e293b;
    border-radius: 50%;
    position: absolute;
    top: 20px;
}

.eye-left {
    left: 15px;
}

.eye-right {
    right: 15px;
}

.mouth {
    width: 20px;
    height: 10px;
    border: 2px solid #1e293b;
    border-top: none;
    border-radius: 0 0 10px 10px;
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
}

.body {
    width: 50px;
    height: 70px;
    background: #3b82f6;
    position: absolute;
    top: 75px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 8px;
    border: 3px solid #2563eb;
}

.arm {
    width: 15px;
    height: 50px;
    background: #fcd34d;
    position: absolute;
    top: 80px;
    border-radius: 8px;
    border: 2px solid #f59e0b;
}

.arm-left {
    left: 60px;
    transform: rotate(-10deg);
}

.arm-right {
    right: 60px;
    transform: rotate(10deg);
}

.leg {
    width: 18px;
    height: 50px;
    background: #3b82f6;
    position: absolute;
    top: 140px;
    border-radius: 8px;
    border: 2px solid #2563eb;
}

.leg-left {
    left: 80px;
}

.leg-right {
    right: 80px;
}

/* 裝備層 */
.equipment-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* 角色數值 */
.character-stats {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.stat-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.stat-label {
    min-width: 60px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-accent);
}

.hp-bar,
.exp-bar {
    flex: 1;
    height: 24px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.hp-fill {
    height: 100%;
    background: var(--gradient-success);
    width: 100%;
    transition: width var(--transition-normal);
}

.exp-fill {
    height: 100%;
    background: var(--gradient-primary);
    width: 0%;
    transition: width var(--transition-normal);
}

.hp-text,
.exp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* 裝備面板 */
.equipment-panel {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: var(--spacing-md);
}

.equipment-panel h4 {
    margin-bottom: var(--spacing-sm);
    color: var(--text-secondary);
}

.equipment-slots {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-xs);
}

.equipment-slot {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: var(--spacing-sm);
    text-align: center;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.equipment-slot.equipped {
    border-color: var(--color-primary);
    background: rgba(124, 58, 237, 0.1);
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.3);
}

.equipment-slot .icon {
    font-size: 2rem;
    margin-bottom: var(--spacing-xs);
}

.equipment-slot .name {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* 中間戰鬥區 */
.battle-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-lg);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: var(--spacing-xl);
    position: relative;
}

.enemy {
    width: 150px;
    height: 150px;
    position: relative;
    animation: enemyFloat 3s ease-in-out infinite;
}

@keyframes enemyFloat {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

.enemy-body {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #8b5cf6 0%, #6d28d9 100%);
    border-radius: 40% 60% 60% 40% / 60% 40% 60% 40%;
    position: relative;
    border: 3px solid #7c3aed;
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.5);
}

.enemy-eye {
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 40px;
}

.enemy-eye::after {
    content: '';
    width: 10px;
    height: 10px;
    background: #1e293b;
    border-radius: 50%;
    position: absolute;
    top: 5px;
    left: 5px;
}

.enemy-eye-left {
    left: 30px;
}

.enemy-eye-right {
    right: 30px;
}

.enemy-mouth {
    width: 40px;
    height: 20px;
    background: #1e293b;
    border-radius: 0 0 20px 20px;
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
}

.enemy-label {
    text-align: center;
    margin-top: var(--spacing-sm);
    font-weight: 700;
    color: var(--text-secondary);
}

.question-panel {
    width: 100%;
    text-align: center;
}

.question-text {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(124, 58, 237, 0.5);
}

.answer-input-container {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
}

.answer-input {
    width: 200px;
    padding: var(--spacing-md);
    font-size: 1.5rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--text-primary);
    backdrop-filter: blur(5px);
    transition: all var(--transition-fast);
}

.answer-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

.btn-submit {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1.2rem;
    font-weight: 700;
    background: var(--gradient-primary);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.btn-submit:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.feedback-message {
    position: absolute;
    bottom: var(--spacing-lg);
    left: 50%;
    transform: translateX(-50%);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    white-space: nowrap;
}

.feedback-message.show {
    opacity: 1;
}

.feedback-message.correct {
    background: var(--gradient-success);
    color: white;
}

.feedback-message.incorrect {
    background: var(--gradient-danger);
    color: white;
}

/* 右側資訊面板 */
.right-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.info-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: var(--spacing-md);
}

.info-card h4 {
    margin-bottom: var(--spacing-sm);
    font-size: 1.1rem;
    color: var(--color-accent);
}

.info-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-xs);
}

.highlight {
    color: var(--color-primary);
    font-weight: 700;
}

.highlight-green {
    color: var(--color-success);
    font-weight: 700;
}

.highlight-red {
    color: var(--color-danger);
    font-weight: 700;
}

.muted {
    color: var(--text-muted);
    font-style: italic;
}

/* ===== 彈窗 ===== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-secondary);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: var(--spacing-xl);
    max-width: 500px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.level-up-content {
    background: linear-gradient(135deg, #1a1f3a 0%, #2d1b4e 100%);
    border-color: var(--color-primary);
}

.level-up-effect {
    font-size: 4rem;
    animation: sparkle 1s ease-in-out infinite;
}

@keyframes sparkle {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }

    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 0.8;
    }
}

.level-up-text {
    font-size: 1.5rem;
    margin: var(--spacing-md) 0;
}

.highlight-level {
    font-size: 2rem;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.new-equipment {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.equipment-reward {
    font-size: 3rem;
    margin-bottom: var(--spacing-xs);
}

.equipment-name {
    font-size: 1.2rem;
    color: var(--color-accent);
    font-weight: 700;
}

.btn-continue,
.btn-primary,
.btn-secondary {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin: var(--spacing-xs);
}

.btn-continue,
.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-continue:hover,
.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--color-primary);
}

.modal-buttons {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    margin-top: var(--spacing-lg);
}

.victory-content h2 {
    font-size: 2.5rem;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.victory-stats {
    margin: var(--spacing-lg) 0;
    text-align: left;
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.defeat-content h2 {
    color: var(--color-danger);
}

/* ===== 響應式設計 ===== */
@media (max-width: 1200px) {
    .game-container {
        grid-template-columns: 250px 1fr 250px;
    }
}

@media (max-width: 992px) {
    .game-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .left-panel,
    .right-panel {
        display: none;
    }

    .stage-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .game-title {
        font-size: 2.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .stage-grid {
        grid-template-columns: 1fr;
    }

    .question-text {
        font-size: 2rem;
    }
}

/* ===== 計時器顯示 ===== */
.timer-display {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.timer-icon {
    font-size: 1.5rem;
}

.timer-value {
    font-size: 1.3rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--color-accent);
}

/* ===== 最佳紀錄顯示 ===== */
.best-time-display {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.best-time-label {
    color: var(--text-secondary);
    font-size: 1rem;
}

.best-time-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===== 裝備加乘顯示 ===== */
.equipment-slot .bonus {
    font-size: 0.7rem;
    color: var(--color-success);
    font-weight: 600;
    margin-top: 2px;
}

.equipment-bonus {
    font-size: 0.9rem;
    color: var(--color-success);
    font-weight: 600;
    margin-top: var(--spacing-xs);
}

/* ===== 終極勝利彈窗 ===== */
.ultimate-victory-content {
    background: linear-gradient(135deg, #1a1f3a 0%, #2d1b4e 50%, #1a3a2d 100%);
    border: 3px solid #fbbf24;
    max-width: 600px;
    position: relative;
    overflow: hidden;
}

.ultimate-crown {
    font-size: 5rem;
    animation: crownBounce 1s ease-in-out infinite;
}

@keyframes crownBounce {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.1) rotate(-5deg);
    }

    75% {
        transform: scale(1.1) rotate(5deg);
    }
}

.ultimate-title {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #fbbf24 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 2s linear infinite;
    margin: var(--spacing-md) 0;
}

@keyframes shimmer {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

.new-record-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--gradient-danger);
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 700;
    animation: pulseBadge 0.5s ease-in-out infinite alternate;
}

@keyframes pulseBadge {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.1);
    }
}

.ultimate-stats {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

.ultimate-stats .stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ultimate-stats .stat-item:last-child {
    border-bottom: none;
}

.ultimate-stats .stat-label {
    color: var(--text-secondary);
}

.ultimate-stats .stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--color-accent);
}

.btn-ultimate {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border: none;
    border-radius: 15px;
    color: #1a1f3a;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.5);
}

.btn-ultimate:hover {
    transform: scale(1.05);
    box-shadow: 0 0 50px rgba(251, 191, 36, 0.8);
}

/* ===== 煙火特效 ===== */
.fireworks-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1001;
}

.firework {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: fireworkExplode 1.5s ease-out forwards;
}

.firework::before,
.firework::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: hsl(var(--hue), 100%, 60%);
    box-shadow:
        0 0 10px hsl(var(--hue), 100%, 60%),
        0 0 20px hsl(var(--hue), 100%, 60%),
        0 0 40px hsl(var(--hue), 100%, 60%);
}

@keyframes fireworkExplode {
    0% {
        transform: scale(0);
        opacity: 1;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.firework::before {
    animation: fireworkSpread1 1.5s ease-out forwards;
}

.firework::after {
    animation: fireworkSpread2 1.5s ease-out forwards;
}

@keyframes fireworkSpread1 {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(30px, -50px);
    }
}

@keyframes fireworkSpread2 {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(-30px, -50px);
    }
}
