/* Falling Type - 打字练习游戏样式 */

/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: #333;
}

/* 游戏头部 */
.game-header {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.game-title {
    font-size: 2.5rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
    animation: pulse 2s infinite;
}

.game-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
}

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

/* 主游戏容器 */
.game-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* 模式选择界面 */
.mode-selection {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.mode-selection h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2rem;
}

.mode-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
}

.mode-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 20px 30px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 120px;
}

.mode-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

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

.mode-text {
    font-weight: bold;
}

/* 难度选择 */
.difficulty-selection {
    margin-bottom: 30px;
}

.difficulty-selection h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-width: 300px;
    margin: 0 auto;
}

.difficulty-btn {
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-btn:hover {
    background: #e0e0e0;
    border-color: #667eea;
}

.difficulty-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 音乐选择 */
.music-selection {
    margin-bottom: 24px;
    text-align: center;
}

.music-selection h3 {
    color: #333;
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.music-track-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 400px;
    margin: 0 auto 12px;
}

.music-track-btn {
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.music-track-btn:hover {
    border-color: #667eea;
    background: #e8ecff;
}

.music-track-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.volume-control {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #555;
}

.volume-control input[type="range"] {
    width: 120px;
    accent-color: #667eea;
}

.music-hint {
    font-size: 0.75rem;
    color: #888;
    margin-top: 8px;
    line-height: 1.4;
}

.music-hint code {
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 4px;
}

.now-playing {
    font-size: 0.85rem;
    color: #555;
    margin-top: 4px;
}

/* 开始按钮 */
.start-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(40, 167, 69, 0.3);
}

/* 游戏区域 */
.game-area {
    width: 100%;
    max-width: 1200px;
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* 游戏统计信息 */
.game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 15px;
}

.player-stats {
    text-align: center;
    min-width: 150px;
}

.player-stats h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.player-stats div {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.game-info {
    text-align: center;
}

.game-info div {
    margin-bottom: 5px;
    font-weight: bold;
}

/* 下落区域 */
.falling-area {
    position: relative;
    height: 500px;
    background: linear-gradient(180deg, #f0f8ff 0%, #e6f3ff 100%);
    border-radius: 15px;
    border: 2px solid #ddd;
    overflow: hidden;
    margin-bottom: 20px;
}

/* 下落字母样式 */
.falling-letter {
    position: absolute;
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid #667eea;
    border-radius: 10px;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    animation: fall linear forwards;
    transition: none;
}

/* Phigros 风格击打成功：金光爆开并原地消失 */
.falling-letter.hit-success {
    z-index: 200;
    pointer-events: none;
    animation: hitGoldenVanish 0.28s ease-out forwards !important;
    border-color: #ffe566 !important;
    transition: none !important;
}

.hit-golden-burst {
    position: absolute;
    inset: -60%;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(255, 230, 120, 0.75) 30%,
        rgba(255, 200, 50, 0.35) 55%,
        transparent 70%
    );
    animation: hitBurstFlash 0.35s ease-out forwards;
}

.hit-golden-ring {
    position: absolute;
    width: 20px;
    height: 20px;
    margin-left: -10px;
    margin-top: -10px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 199;
    border: 2px solid rgba(255, 240, 180, 0.95);
    box-shadow: 0 0 16px #ffd700, 0 0 32px rgba(255, 215, 0, 0.6);
    animation: hitRingExpand 0.4s ease-out forwards;
}

@keyframes hitGoldenVanish {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: brightness(1);
        box-shadow: 0 0 0 rgba(255, 215, 0, 0);
    }
    35% {
        transform: scale(1.18);
        opacity: 1;
        background: linear-gradient(145deg, #fffef5 0%, #ffd700 45%, #ffb300 100%) !important;
        color: #4a3800 !important;
        filter: brightness(1.7);
        box-shadow:
            0 0 20px #ffd700,
            0 0 40px rgba(255, 236, 139, 0.85),
            inset 0 0 16px rgba(255, 255, 255, 0.7);
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
        filter: brightness(2.2);
        box-shadow: 0 0 50px rgba(255, 215, 0, 0);
    }
}

@keyframes hitBurstFlash {
    0% {
        transform: scale(0.6);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

@keyframes hitRingExpand {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(5);
        opacity: 0;
        border-width: 1px;
    }
}

.falling-letter.missed {
    pointer-events: none;
}

.falling-letter.instant-vanish {
    animation: none !important;
    transition: opacity 0.18s ease, transform 0.18s ease !important;
    opacity: 0 !important;
    transform: scale(0.85) !important;
    pointer-events: none;
}

/* 单词下落 */
.falling-letter.falling-word {
    width: auto;
    min-width: 72px;
    height: 52px;
    padding: 0 14px;
    letter-spacing: 0.08em;
}

.falling-word .word-text {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    font-weight: bold;
    white-space: nowrap;
}

.falling-word .word-typed {
    color: rgba(102, 126, 234, 0.45);
    text-decoration: line-through;
}

.falling-word .word-remaining {
    color: #333;
}

.falling-word.on-judgment-line .word-remaining {
    color: #ff4757;
    text-shadow: 0 0 8px rgba(255, 71, 87, 0.5);
}

@keyframes fall {
    from {
        transform: translateY(-100px);
    }
    to {
        transform: translateY(520px);
    }
}

/* 控制按钮 */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.control-btn {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.control-btn.pause {
    background: #ffc107;
}

.control-btn.pause:hover {
    background: #e0a800;
}

.control-btn.restart {
    background: #17a2b8;
}

.control-btn.restart:hover {
    background: #138496;
}

/* 游戏结果 */
.game-results {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.game-results h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2rem;
}

.final-scores {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
}

.player-result {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    min-width: 200px;
}

.player-result h3 {
    color: #333;
    margin-bottom: 15px;
}

.player-result p {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.winner-announcement {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
}

.play-again-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.play-again-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(40, 167, 69, 0.3);
}

/* 游戏页脚 */
.game-footer {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-title {
        font-size: 2rem;
    }
    
    .mode-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .mode-btn {
        min-width: 200px;
    }
    
    .difficulty-buttons {
        grid-template-columns: 1fr;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .final-scores {
        flex-direction: column;
        gap: 20px;
    }
    
    .falling-area {
        height: 400px;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 10px;
    }
    
    .mode-selection,
    .game-area,
    .game-results {
        padding: 20px;
    }
    
    .falling-letter {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .falling-area {
        height: 350px;
    }
}

/* 动画和过渡效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}


.judgment-feedback.show {
    opacity: 1;
    animation: feedbackPop 0.5s ease;
}

.judgment-feedback.perfect {
    color: #ffd700;
    text-shadow: 0 0 10px #ffd700;
}

.judgment-feedback.good {
    color: #28a745;
}

.judgment-feedback.miss {
    color: #dc3545;
}

@keyframes feedbackPop {
    0% { transform: translate(-50%, -50%) scale(0.5); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* 字母经过判定线时的高亮 */
.falling-letter.on-judgment-line {
    box-shadow: 0 0 12px rgba(255, 71, 87, 0.9), 0 0 24px rgba(255, 71, 87, 0.4);
    transform: scale(1.08);
    border-color: #ff4757;
}


/* ========== 多种方块类型样式 ========== */

/* Phigros 风格长按条 */
.falling-letter.hold-letter {
    width: 52px;
    height: auto;
    min-height: unset;
    padding: 0;
    background: transparent !important;
    border: none !important;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.hold-note {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 52px;
}

.hold-body {
    position: relative;
    width: 22px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.hold-body-glow {
    position: absolute;
    inset: -4px -8px;
    border-radius: 12px;
    background: radial-gradient(ellipse at center bottom, rgba(0, 220, 255, 0.35) 0%, transparent 70%);
    pointer-events: none;
}

.hold-body-track {
    position: absolute;
    inset: 0;
    border-radius: 11px;
    border: 2px solid rgba(180, 240, 255, 0.85);
    background: linear-gradient(180deg,
        rgba(0, 60, 120, 0.15) 0%,
        rgba(0, 120, 200, 0.25) 100%);
    box-shadow:
        inset 0 0 12px rgba(0, 200, 255, 0.2),
        0 0 8px rgba(0, 180, 255, 0.4);
}

.hold-body-fill {
    position: absolute;
    left: 2px;
    right: 2px;
    bottom: 2px;
    height: 0%;
    border-radius: 0 0 9px 9px;
    background: linear-gradient(180deg,
        rgba(120, 240, 255, 0.95) 0%,
        rgba(0, 200, 255, 1) 40%,
        rgba(0, 140, 255, 1) 100%);
    box-shadow: 0 0 12px rgba(0, 220, 255, 0.9);
    transition: height 0.05s linear;
}

.hold-head {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #e8fcff 0%, #00d4ff 35%, #0088ff 100%);
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-shadow:
        0 0 12px rgba(0, 220, 255, 0.8),
        0 0 24px rgba(0, 160, 255, 0.5),
        inset 0 0 10px rgba(255, 255, 255, 0.5);
}

.hold-head-letter {
    font-size: 1.6rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 8px rgba(0, 100, 180, 0.8);
}

.falling-letter.hold-letter.on-judgment-line {
    transform: none;
}

.falling-letter.hold-letter.on-judgment-line .hold-head {
    box-shadow:
        0 0 16px rgba(255, 71, 87, 0.9),
        0 0 28px rgba(0, 220, 255, 0.8),
        inset 0 0 12px rgba(255, 255, 255, 0.6);
    border-color: #fff;
}

.falling-letter.hold-letter.hold-active .hold-body-track {
    border-color: #fff;
    box-shadow:
        inset 0 0 16px rgba(0, 255, 255, 0.5),
        0 0 20px rgba(0, 220, 255, 0.9);
}

.falling-letter.hold-letter.hold-active .hold-body-fill {
    box-shadow: 0 0 18px rgba(0, 255, 255, 1);
}

.falling-letter.hold-letter.hold-active {
    animation: none !important;
}

.falling-letter.hold-letter.hit-success .hold-head {
    background: linear-gradient(145deg, #fffef5 0%, #ffd700 45%, #ffb300 100%) !important;
    border-color: #ffe566 !important;
    color: #4a3800;
}

.falling-letter.hold-letter.hit-success .hold-body-fill {
    height: 100% !important;
    background: linear-gradient(180deg, #fff9c4 0%, #ffd700 50%, #ffb300 100%) !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.9);
}

.falling-letter.hold-letter.hold-failed .hold-head {
    background: linear-gradient(145deg, #ffcccc 0%, #ff4757 100%);
    border-color: #ff6b6b;
    animation: holdFailShake 0.3s ease;
}

@keyframes holdFailShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* 连击方块 */
.combo-letter {
    width: 120px !important;
}

.combo-letters {
    display: flex;
    gap: 5px;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.combo-letter {
    font-size: 1.2rem;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.combo-letter.hit {
    opacity: 1;
    transform: scale(1.2);
    color: #28a745;
    font-weight: bold;
}

/* 炸弹方块动画 */
@keyframes bombPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.bomb-letter .letter-content {
    font-size: 1.5rem;
}

.bomb-icon {
    font-size: 1rem;
    position: absolute;
    top: 2px;
    right: 2px;
}

/* 奖励方块动画 */
@keyframes bonusShine {
    0%, 100% { 
        box-shadow: 0 0 5px #ffd700;
        filter: brightness(1);
    }
    50% { 
        box-shadow: 0 0 20px #ffd700, 0 0 30px #ffed4e;
        filter: brightness(1.2);
    }
}

.bonus-letter .letter-content {
    font-size: 1.5rem;
    color: #333;
}

.bonus-icon {
    font-size: 0.8rem;
    position: absolute;
    top: 2px;
    right: 2px;
}


/* ===== Phigros 风格判定线（轻微浮动） ===== */
.judgment-area {
    position: absolute;
    bottom: 80px;
    left: 0;
    right: 0;
    height: 0;
    pointer-events: none;
    z-index: 100;
    will-change: transform;
    animation: judgmentAreaFloat 2.4s ease-in-out infinite;
}

.judgment-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.6) 15%,
        #ff4757 50%,
        rgba(255, 255, 255, 0.6) 85%,
        transparent 100%
    );
    transform: translateY(-50%);
    will-change: transform, filter, box-shadow;
    animation: judgmentLineGlow 1.6s ease-in-out infinite;
}

@keyframes judgmentAreaFloat {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-10px);
    }
    75% {
        transform: translateY(8px);
    }
}

@keyframes judgmentLineGlow {
    0%, 100% {
        transform: translateY(-50%) scaleX(1);
        filter: brightness(1);
        box-shadow:
            0 0 6px #ff4757,
            0 0 14px rgba(255, 71, 87, 0.65),
            0 1px 0 rgba(255, 255, 255, 0.5);
    }
    50% {
        transform: translateY(-50%) scaleX(1.03);
        filter: brightness(1.25);
        box-shadow:
            0 0 10px #ff4757,
            0 0 24px rgba(255, 71, 87, 0.9),
            0 0 36px rgba(255, 71, 87, 0.35),
            0 1px 0 rgba(255, 255, 255, 0.7);
    }
}

.falling-area.game-paused .judgment-area,
.falling-area.game-paused .judgment-line {
    animation-play-state: paused;
}

.judgment-line::before,
.judgment-line::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    border: 2px solid #ff4757;
    border-radius: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 8px rgba(255, 71, 87, 0.8);
    animation: judgmentNodePulse 1.6s ease-in-out infinite;
}

@keyframes judgmentNodePulse {
    0%, 100% {
        opacity: 0.85;
        transform: translateY(-50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1.25);
    }
}

.falling-area.game-paused .judgment-line::before,
.falling-area.game-paused .judgment-line::after {
    animation-play-state: paused;
}

.judgment-line::before {
    left: 12px;
}

.judgment-line::after {
    right: 12px;
}

.judgment-feedback {
    position: absolute;
    left: 50%;
    bottom: 95px;
    transform: translateX(-50%);
    font-size: 1.4rem;
    font-weight: bold;
    pointer-events: none;
    z-index: 101;
    opacity: 0;
}


