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

body {
    font-family: 'Hiragino Mincho ProN', 'Yu Mincho', 'MS Mincho', serif;
    overflow: hidden;
    background: linear-gradient(180deg, #2C1810 0%, #3D2817 50%, #2C1810 100%);
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* 木目テクスチャ風の背景 */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            90deg,
            rgba(92, 64, 51, 0.3) 0px,
            rgba(92, 64, 51, 0.3) 2px,
            transparent 2px,
            transparent 4px
        ),
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.1) 0px,
            rgba(0, 0, 0, 0.1) 1px,
            transparent 1px,
            transparent 3px
        );
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
}

#game-container {
    width: 100%;
    max-width: 600px;
    height: 100vh;
    max-height: 900px;
    background: linear-gradient(180deg, #F5E6D3 0%, #E8D5C4 50%, #D4C4B0 100%);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.6),
        inset 0 0 100px rgba(0, 0, 0, 0.1);
    border-left: 8px solid #5C4033;
    border-right: 8px solid #5C4033;
    border-radius: 0;
    z-index: 1;
}

/* 瓦屋根風の装飾（上部） */
#game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    right: -8px;
    height: 30px;
    background: linear-gradient(180deg, #4A4A4A 0%, #696969 50%, #4A4A4A 100%);
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.2),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    border-bottom: 3px solid #2C2C2C;
    z-index: 101;
}

/* 瓦の模様 */
#game-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    right: -8px;
    height: 30px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 30px,
        rgba(0, 0, 0, 0.3) 30px,
        rgba(0, 0, 0, 0.3) 32px
    );
    z-index: 102;
}

/* 木目テクスチャをゲームエリアにも追加 */
#game-area {
    background: 
        repeating-linear-gradient(
            90deg,
            rgba(139, 90, 43, 0.03) 0px,
            rgba(139, 90, 43, 0.03) 1px,
            transparent 1px,
            transparent 3px
        );
}

/* ヘッダー（暖簾風） */
#game-header {
    position: absolute;
    top: 30px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    padding: 15px 10px;
    background: linear-gradient(180deg, rgba(139, 0, 0, 0.95) 0%, rgba(178, 34, 34, 0.9) 100%);
    border-bottom: 4px solid #8B0000;
    border-top: 2px solid #A0522D;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
    z-index: 100;
    flex-wrap: wrap;
}

/* 暖簾の縦線模様 */
#game-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 48px,
        rgba(0, 0, 0, 0.15) 48px,
        rgba(0, 0, 0, 0.15) 50px
    );
    pointer-events: none;
}

.info-box {
    text-align: center;
    color: #FFF8DC;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8),
                 0 0 8px rgba(255, 215, 0, 0.3);
    flex: 1;
    min-width: 80px;
    animation: infoPulse 2s ease-in-out infinite;
    font-weight: bold;
}

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

.time-box #time {
    color: #FFFF00;
    font-size: 32px !important;
    text-shadow: 0 0 15px #FFD700,
                 0 0 30px #FFA500,
                 2px 2px 6px rgba(0, 0, 0, 0.6);
    transition: all 0.3s;
}

.time-box #time.time-warning {
    color: #FF4500;
    text-shadow: 0 0 20px #FF0000,
                 0 0 40px #FF4500,
                 2px 2px 6px rgba(0, 0, 0, 0.6);
    animation: timeWarningPulse 0.5s ease-in-out infinite;
}

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

.label {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
    opacity: 0.8;
}

#score, #combo, #next-char {
    display: block;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8),
                 2px 2px 6px rgba(0, 0, 0, 0.6);
}

#next-char {
    font-size: 44px;
    color: #8B0000;
    background: linear-gradient(135deg, #FFF8DC 0%, #F5DEB3 100%);
    padding: 8px 16px;
    border-radius: 4px;
    border: 3px solid #8B4513;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4),
                inset 0 1px 2px rgba(255, 255, 255, 0.5);
    animation: nextCharGlow 1s ease-in-out infinite;
    display: inline-block;
    font-weight: 900;
}

@keyframes nextCharGlow {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8),
                    0 4px 10px rgba(0, 0, 0, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(255, 215, 0, 1),
                    0 6px 15px rgba(0, 0, 0, 0.5);
    }
}

/* ゲームエリア */
#game-area {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* 表示される文字 */
.falling-char {
    position: absolute;
    font-size: 56px;
    font-weight: 900;
    cursor: pointer;
    user-select: none;
    padding: 20px;
    margin: -20px;
    transition: opacity 0.2s;
    z-index: 10;
    font-family: 'Comic Sans MS', 'Hiragino Sans', 'Meiryo', sans-serif;
    touch-action: none;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform;
}

.falling-char:active {
    transform: scale(1.2) !important;
    transition: transform 0.05s;
    filter: brightness(1.5);
}

.falling-char.char-kawa {
    color: #FFFFFF;
    background: linear-gradient(135deg, #4682B4 0%, #5F9EA0 100%);
    border-radius: 8px;
    border: 2px solid #2F4F4F;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5),
                inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.falling-char.char-yutaka {
    color: #FFFFFF;
    background: linear-gradient(135deg, #8B4789 0%, #9B59B6 100%);
    border-radius: 8px;
    border: 2px solid #6B3869;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5),
                inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.falling-char.char-u {
    color: #FFFFFF;
    background: linear-gradient(135deg, #C41E3A 0%, #DC143C 100%);
    border-radius: 8px;
    border: 2px solid #8B0000;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5),
                inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.falling-char.char-na {
    color: #FFFFFF;
    background: linear-gradient(135deg, #2E8B57 0%, #3CB371 100%);
    border-radius: 8px;
    border: 2px solid #1C5739;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5),
                inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.falling-char.char-gi {
    color: #8B4513;
    background: linear-gradient(135deg, #FFD700 0%, #F0E68C 100%);
    border-radius: 8px;
    border: 2px solid #B8860B;
    text-shadow: 1px 1px 3px rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5),
                inset 0 1px 2px rgba(255, 255, 255, 0.5);
}

/* 正解エフェクト */
.falling-char.correct {
    animation: correctAnim 0.25s ease-out;
}

@keyframes correctAnim {
    0% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1);
    }
    40% {
        transform: scale(2) rotate(180deg);
        filter: brightness(3) drop-shadow(0 0 40px currentColor);
        opacity: 1;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

/* 不正解エフェクト */
.falling-char.wrong {
    animation: wrongAnim 0.3s ease-out;
}

@keyframes wrongAnim {
    0%, 100% {
        transform: translateX(0) rotate(0deg);
    }
    10% {
        transform: translateX(-20px) rotate(-20deg) scale(1.2);
    }
    30% {
        transform: translateX(20px) rotate(20deg) scale(1.2);
    }
    50% {
        transform: translateX(-15px) rotate(-15deg) scale(1.1);
    }
    70% {
        transform: translateX(15px) rotate(15deg) scale(1.1);
    }
}

/* スタート画面（和風） */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(180deg, rgba(92, 64, 51, 0.97) 0%, rgba(62, 39, 35, 0.97) 100%);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    color: #FFF8DC;
    padding: 15px 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 障子風の格子模様 */
#start-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 98px,
            rgba(139, 90, 43, 0.3) 98px,
            rgba(139, 90, 43, 0.3) 100px
        ),
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 98px,
            rgba(139, 90, 43, 0.3) 98px,
            rgba(139, 90, 43, 0.3) 100px
        );
    pointer-events: none;
    opacity: 0.5;
}

#start-screen h1 {
    font-size: 64px;
    margin-bottom: 12px;
    margin-top: 20px;
    color: #FFD700;
    text-shadow: 3px 3px 0px #8B0000,
                 5px 5px 10px rgba(0, 0, 0, 0.8);
    font-weight: 900;
    letter-spacing: 8px;
    animation: titleBounce 2s ease-in-out infinite;
    background: linear-gradient(180deg, #FFED4E 0%, #FFD700 50%, #FFA500 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
    line-height: 1.1;
}

#start-screen h2.subtitle {
    font-size: 28px;
    margin-bottom: 20px;
    color: #F4A460;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9),
                 0 0 8px rgba(0, 0, 0, 0.5);
    font-weight: 700;
    letter-spacing: 3px;
    opacity: 1;
    font-family: 'Georgia', 'Times New Roman', serif;
}

/* スタート画面のベストスコア表示 */
.best-scores-start {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.5) 0%, rgba(101, 67, 33, 0.5) 100%);
    padding: 15px 25px;
    border-radius: 8px;
    border: 3px solid #DAA520;
    margin-bottom: 25px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6),
                inset 0 2px 8px rgba(255, 215, 0, 0.2);
    backdrop-filter: blur(5px);
    position: relative;
    z-index: 1;
}

.best-score-label {
    font-size: 18px;
    font-weight: 700;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8),
                 0 0 8px rgba(139, 0, 0, 0.4);
    margin: 0 0 8px 0;
    text-align: center;
}

.best-score-start-text {
    font-size: 26px;
    font-weight: 700;
    color: #FFF8DC;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    margin: 0 0 6px 0;
    text-align: center;
}

.best-score-note {
    font-size: 13px;
    color: #D2B48C;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
    margin: 0;
    text-align: center;
    opacity: 0.9;
    font-style: italic;
}

#best-score-start, #best-combo-start {
    font-size: 30px;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8),
                 0 0 10px rgba(255, 215, 0, 0.5);
}

@keyframes titleBounce {
    0%, 100% {
        transform: scale(1) rotate(-2deg);
    }
    50% {
        transform: scale(1.1) rotate(2deg);
    }
}

.en-text {
    display: block;
    font-size: 0.88em;
    color: #F5DEB3;
    opacity: 0.95;
    margin-top: 3px;
    font-style: italic;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

.instructions {
    background: linear-gradient(135deg, rgba(245, 222, 179, 0.4) 0%, rgba(222, 184, 135, 0.4) 100%);
    padding: 25px 30px;
    border-radius: 8px;
    border: 3px solid #8B4513;
    margin: 0 0 20px 0;
    max-width: 480px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6),
                inset 0 2px 8px rgba(255, 248, 220, 0.4);
    backdrop-filter: blur(5px);
}

.instructions p {
    text-align: center;
    line-height: 1.6;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    color: #FFF8DC;
}

.instructions p:first-child {
    font-size: 28px;
    margin-bottom: 20px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8),
                 0 0 10px rgba(139, 0, 0, 0.5);
}

.instructions p:not(:first-child) {
    font-size: 18px;
    margin-bottom: 14px;
    text-align: left;
    line-height: 1.7;
}

#start-btn, #restart-btn {
    font-size: 32px;
    padding: 18px 60px;
    background: linear-gradient(180deg, #8B0000 0%, #B22222 50%, #8B0000 100%);
    color: #FFED4E;
    border: 4px solid #D2691E;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 900;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6),
                inset 0 2px 8px rgba(255, 255, 255, 0.2),
                inset 0 -2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: 'Hiragino Mincho ProN', 'Yu Mincho', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9),
                 0 0 12px rgba(255, 215, 0, 0.6);
    animation: buttonPulse 2s ease-in-out infinite;
    margin-top: 0;
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6),
                    inset 0 2px 8px rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8),
                    inset 0 2px 12px rgba(255, 255, 255, 0.3),
                    0 0 20px rgba(255, 215, 0, 0.4);
    }
}

#start-btn:hover, #restart-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8),
                inset 0 2px 12px rgba(255, 255, 255, 0.3),
                0 0 25px rgba(255, 215, 0, 0.6);
    background: linear-gradient(180deg, #A52A2A 0%, #DC143C 50%, #A52A2A 100%);
}

#start-btn:active, #restart-btn:active {
    transform: translateY(0);
}

.bgm-note {
    margin-top: 20px;
    font-size: 20px;
    color: #F0E68C;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    animation: bgmPulse 2s ease-in-out infinite;
    font-weight: bold;
}

/* 川豊HPリンク */
.homepage-link {
    text-decoration: none;
    display: block;
    margin-top: 25px;
    margin-bottom: 15px;
}

.homepage-btn {
    font-size: 22px;
    padding: 14px 45px;
    background: linear-gradient(180deg, #2F4F4F 0%, #1C3334 50%, #2F4F4F 100%);
    color: #FFED4E;
    border: 3px solid #8B4513;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6),
                inset 0 2px 6px rgba(255, 255, 255, 0.15);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    font-family: 'Hiragino Mincho ProN', 'Yu Mincho', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9),
                 0 0 8px rgba(255, 215, 0, 0.4);
}

.homepage-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.8),
                inset 0 2px 8px rgba(255, 255, 255, 0.2);
    background: linear-gradient(180deg, #3A5F5F 0%, #274444 50%, #3A5F5F 100%);
}

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

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

/* ゲームオーバー画面（和風） */
#gameover-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(92, 64, 51, 0.97) 0%, rgba(62, 39, 35, 0.97) 100%);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    color: #FFF8DC;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 障子風の格子模様 */
#gameover-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 98px,
            rgba(139, 90, 43, 0.3) 98px,
            rgba(139, 90, 43, 0.3) 100px
        ),
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 98px,
            rgba(139, 90, 43, 0.3) 98px,
            rgba(139, 90, 43, 0.3) 100px
        );
    pointer-events: none;
    opacity: 0.5;
}

#gameover-screen h1 {
    font-size: 56px;
    margin-bottom: 15px;
    color: #8B0000;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
    font-weight: 900;
    animation: gameoverShake 0.5s ease-in-out;
    position: relative;
    z-index: 1;
}

#gameover-screen h2.subtitle {
    font-size: 24px;
    margin-bottom: 30px;
    color: #D2691E;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    font-weight: 700;
    letter-spacing: 3px;
    opacity: 0.95;
    font-family: 'Georgia', 'Times New Roman', serif;
    position: relative;
    z-index: 1;
}

@keyframes gameoverShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px) rotate(-5deg); }
    75% { transform: translateX(10px) rotate(5deg); }
}

.result {
    background: linear-gradient(135deg, rgba(245, 222, 179, 0.4) 0%, rgba(222, 184, 135, 0.4) 100%);
    padding: 35px 60px;
    border-radius: 8px;
    border: 4px solid #8B4513;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7),
                inset 0 2px 10px rgba(255, 248, 220, 0.3);
    backdrop-filter: blur(5px);
    position: relative;
    z-index: 1;
}

.final-score, .max-combo {
    font-size: 28px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
}

.final-score span, .max-combo span {
    font-size: 52px;
    font-weight: 900;
    color: #FFD700;
    display: block;
    margin-top: 10px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8),
                 0 0 15px rgba(255, 215, 0, 0.6);
    animation: scorePulse 1s ease-in-out infinite;
}

/* ベストスコア表示 */
.best-scores {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.4) 0%, rgba(101, 67, 33, 0.4) 100%);
    padding: 22px 30px;
    border-radius: 8px;
    border: 3px solid #DAA520;
    margin-top: 25px;
    margin-bottom: 30px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6),
                inset 0 2px 8px rgba(255, 215, 0, 0.2);
    backdrop-filter: blur(5px);
    position: relative;
    z-index: 1;
}

.best-scores-title {
    font-size: 22px;
    font-weight: 700;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8),
                 0 0 8px rgba(139, 0, 0, 0.4);
    margin: 0 0 15px 0;
    text-align: center;
}

.best-score-text, .best-combo-text {
    font-size: 22px;
    margin-bottom: 12px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
    color: #FFF8DC;
}

.best-scores-note {
    font-size: 14px;
    color: #D2B48C;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
    margin: 12px 0 0 0;
    text-align: center;
    opacity: 0.9;
    font-style: italic;
}

#best-score, #best-combo {
    font-size: 32px;
    font-weight: 900;
    color: #FFD700;
    margin-left: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8),
                 0 0 10px rgba(255, 215, 0, 0.5);
}

/* 新記録アニメーション */
.new-record {
    animation: newRecordFlash 0.5s ease-in-out 4;
}

@keyframes newRecordFlash {
    0%, 100% {
        color: #FFD700;
        transform: scale(1);
    }
    50% {
        color: #FF4500;
        transform: scale(1.2);
        text-shadow: 0 0 20px #FF4500,
                     0 0 40px #FFD700,
                     2px 2px 4px rgba(0, 0, 0, 0.8);
    }
}

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

.hidden {
    display: none !important;
}

/* 泳ぐうなぎ */
#swimming-unagi {
    position: absolute;
    z-index: 1000;
    pointer-events: none;
    animation: swimAcross 2.5s linear;
    filter: drop-shadow(0 0 20px #FFD700) drop-shadow(0 0 40px #FFA500);
}

.unagi-body {
    width: 200px;
    height: 200px;
    animation: wiggle 0.2s ease-in-out infinite, floatUpDown 1.5s ease-in-out infinite;
}

@keyframes floatUpDown {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.unagi-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
}

@keyframes swimAcross {
    0% {
        left: -250px;
        top: 25%;
        transform: scale(0.7);
    }
    25% {
        top: 40%;
        transform: scale(1.0);
    }
    50% {
        top: 50%;
        transform: scale(1.2);
    }
    75% {
        top: 60%;
        transform: scale(1.0);
    }
    100% {
        left: 110%;
        top: 70%;
        transform: scale(0.7);
    }
}

@keyframes wiggle {
    0%, 100% {
        transform: rotate(-5deg);
    }
    50% {
        transform: rotate(5deg);
    }
}

/* 面白メッセージ */
#funny-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    pointer-events: none;
}

#funny-text {
    font-size: 96px;
    font-weight: 900;
    background: linear-gradient(45deg, #FF1493, #00FFFF, #FFFF00, #FF1493);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 40px #FF1493) 
            drop-shadow(0 0 80px #00FFFF)
            drop-shadow(6px 6px 20px rgba(0, 0, 0, 0.8));
    margin: 0;
    font-family: 'Comic Sans MS', 'Hiragino Sans', sans-serif;
    animation: funnyBounce 0.5s ease-out, rainbowShift 1s linear infinite;
}

@keyframes funnyBounce {
    0% {
        transform: scale(0) rotate(-720deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.6) rotate(30deg);
    }
    80% {
        transform: scale(0.9) rotate(-15deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

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

/* コンボ表示システム */
#combo-display {
    position: absolute;
    top: 35%;
    right: 30px;
    z-index: 900;
    pointer-events: none;
    animation: comboSlideIn 0.3s ease-out;
}

@keyframes comboSlideIn {
    0% {
        transform: translateX(100px) scale(0.5);
        opacity: 0;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.combo-number {
    font-size: 80px;
    font-weight: 900;
    color: #FFD700;
    text-align: center;
    text-shadow: 0 0 20px #FF1493,
                 0 0 40px #00FFFF,
                 4px 4px 10px rgba(0, 0, 0, 0.8);
    font-family: 'Comic Sans MS', 'Arial Black', sans-serif;
    animation: comboNumberPulse 0.6s ease-in-out infinite;
    line-height: 1;
}

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

.combo-label {
    font-size: 24px;
    font-weight: 900;
    color: #FF1493;
    text-align: center;
    text-shadow: 0 0 10px #FFFF00,
                 2px 2px 6px rgba(0, 0, 0, 0.8);
    font-family: 'Comic Sans MS', sans-serif;
    margin-top: 5px;
    animation: comboLabelShake 0.5s ease-in-out infinite;
}

@keyframes comboLabelShake {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

.combo-stars {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 10px;
}

.combo-stars .star {
    font-size: 30px;
    color: #FFD700;
    filter: drop-shadow(0 0 10px #FFA500);
    animation: starRotate 1s linear infinite;
    display: inline-block;
}

.combo-stars .star:nth-child(1) {
    animation-delay: 0s;
}

.combo-stars .star:nth-child(2) {
    animation-delay: 0.2s;
}

.combo-stars .star:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* うなぎ連続表示 */
#unagi-combo-display {
    position: absolute;
    top: 35%;
    left: 30px;
    z-index: 900;
    pointer-events: none;
    animation: unagiComboSlideIn 0.4s ease-out;
}

@keyframes unagiComboSlideIn {
    0% {
        transform: translateX(-100px) rotate(-180deg) scale(0);
        opacity: 0;
    }
    100% {
        transform: translateX(0) rotate(0deg) scale(1);
        opacity: 1;
    }
}

.unagi-combo-icon {
    font-size: 60px;
    text-align: center;
    animation: unagiIconBounce 0.5s ease-in-out infinite;
    filter: drop-shadow(0 0 20px #FFD700);
}

@keyframes unagiIconBounce {
    0%, 100% {
        transform: translateY(0) rotate(-10deg);
    }
    50% {
        transform: translateY(-15px) rotate(10deg);
    }
}

.unagi-combo-number {
    font-size: 70px;
    font-weight: 900;
    color: #FF6B35;
    text-align: center;
    text-shadow: 0 0 20px #FFD700,
                 0 0 40px #FF8C00,
                 4px 4px 10px rgba(0, 0, 0, 0.8);
    font-family: 'Comic Sans MS', 'Arial Black', sans-serif;
    line-height: 1;
    margin-top: 10px;
}

.unagi-combo-label {
    font-size: 20px;
    font-weight: 900;
    color: #FFD700;
    text-align: center;
    text-shadow: 0 0 10px #FF8C00,
                 2px 2px 6px rgba(0, 0, 0, 0.8);
    font-family: 'Comic Sans MS', sans-serif;
    margin-top: 5px;
    animation: unagiLabelWave 0.8s ease-in-out infinite;
}

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

/* コンボアニメーション */
@keyframes comboAnim {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

#combo.combo-active {
    animation: comboAnim 0.3s ease-out;
    color: #FFD700;
}

/* 減点メッセージ */
.penalty-message {
    position: absolute;
    font-size: 48px;
    font-weight: 900;
    color: #FF0000;
    text-shadow: 0 0 20px #FF0000,
                 0 0 40px #FF4500,
                 3px 3px 10px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 1000;
    animation: penaltyFloat 0.6s ease-out forwards;
    font-family: 'Comic Sans MS', 'Hiragino Sans', sans-serif;
}

@keyframes penaltyFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(2.5) rotate(360deg);
    }
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    #game-container {
        max-width: 100%;
        border-radius: 0;
    }
    
    /* ヘッダー調整 */
    #game-header {
        padding: 8px 5px;
        flex-wrap: wrap;
    }
    
    .info-box {
        min-width: 60px;
        flex: 1 1 auto;
    }
    
    .label {
        font-size: 11px;
        margin-bottom: 3px;
    }
    
    #score, #combo, #next-char {
        font-size: 20px;
    }
    
    #next-char {
        font-size: 32px;
        padding: 5px 12px;
    }
    
    .time-box #time {
        font-size: 24px !important;
    }
    
    /* スタート画面 */
    #start-screen {
        padding: 15px;
        justify-content: flex-start;
    }
    
    #start-screen h1 {
        font-size: 38px;
        margin-bottom: 8px;
        margin-top: 10px;
        letter-spacing: 2px;
    }
    
    #start-screen h2.subtitle {
        font-size: 20px;
        margin-bottom: 16px;
        letter-spacing: 1.5px;
    }
    
    .best-scores-start {
        padding: 12px 20px;
        margin-bottom: 20px;
    }
    
    .best-score-label {
        font-size: 16px;
        margin-bottom: 6px;
    }
    
    .best-score-start-text {
        font-size: 22px;
        margin-bottom: 5px;
    }
    
    .best-score-note {
        font-size: 12px;
    }
    
    #best-score-start, #best-combo-start {
        font-size: 26px;
    }
    
    .en-text {
        font-size: 0.8em;
        margin-top: 1px;
    }
    
    .instructions {
        padding: 18px 15px;
        margin: 0 0 18px 0;
        max-width: 90%;
    }
    
    .instructions p {
        line-height: 1.4;
    }
    
    .instructions p:first-child {
        font-size: 24px;
        margin-bottom: 14px;
    }
    
    .instructions p:not(:first-child) {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    #start-btn, #restart-btn {
        font-size: 28px;
        padding: 16px 52px;
        margin-top: 0;
    }
    
    .homepage-link {
        margin-top: 20px;
        margin-bottom: 10px;
    }
    
    .homepage-btn {
        font-size: 20px;
        padding: 12px 40px;
    }
    
    /* ゲームオーバー画面 */
    #gameover-screen h1 {
        font-size: 36px;
        margin-bottom: 12px;
    }
    
    #gameover-screen h2.subtitle {
        font-size: 18px;
        margin-bottom: 25px;
        letter-spacing: 2px;
    }
    
    .result {
        padding: 25px 40px;
    }
    
    .final-score, .max-combo {
        font-size: 22px;
        margin-bottom: 15px;
    }
    
    .final-score span, .max-combo span {
        font-size: 40px;
    }
    
    .best-scores {
        padding: 18px 25px;
        margin-top: 20px;
        margin-bottom: 25px;
    }
    
    .best-scores-title {
        font-size: 19px;
        margin-bottom: 12px;
    }
    
    .best-score-text, .best-combo-text {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .best-scores-note {
        font-size: 12px;
        margin-top: 10px;
    }
    
    #best-score, #best-combo {
        font-size: 28px;
    }
    
    /* 文字サイズ */
    .falling-char {
        font-size: 40px;
        padding: 12px;
        width: 48px;
        height: 48px;
    }
    
    /* コンボ表示 */
    #combo-display {
        right: 15px;
        top: 30%;
    }
    
    .combo-number {
        font-size: 60px;
    }
    
    .combo-label {
        font-size: 18px;
    }
    
    .combo-stars .star {
        font-size: 24px;
    }
    
    /* うなぎコンボ表示 */
    #unagi-combo-display {
        left: 15px;
        top: 30%;
    }
    
    .unagi-combo-icon {
        font-size: 50px;
    }
    
    .unagi-combo-number {
        font-size: 55px;
    }
    
    .unagi-combo-label {
        font-size: 16px;
    }
    
    /* 面白メッセージ */
    #funny-text {
        font-size: 64px;
    }
    
    /* うなぎアニメーション */
    .unagi-body {
        width: 150px;
        height: 150px;
    }
    
    /* 減点メッセージ */
    .penalty-message {
        font-size: 36px;
    }
}

/* さらに小さい画面用（iPhone SE等） */
@media (max-width: 375px) {
    #start-screen {
        padding: 12px;
    }
    
    #start-screen h1 {
        font-size: 32px;
        letter-spacing: 1.5px;
        margin-bottom: 6px;
        margin-top: 8px;
    }
    
    #start-screen h2.subtitle {
        font-size: 18px;
        margin-bottom: 14px;
        letter-spacing: 1px;
    }
    
    .best-scores-start {
        padding: 10px 18px;
        margin-bottom: 16px;
    }
    
    .best-score-label {
        font-size: 15px;
        margin-bottom: 5px;
    }
    
    .best-score-start-text {
        font-size: 20px;
        margin-bottom: 4px;
    }
    
    .best-score-note {
        font-size: 11px;
    }
    
    #best-score-start, #best-combo-start {
        font-size: 24px;
    }
    
    .en-text {
        font-size: 0.75em;
    }
    
    .instructions {
        padding: 15px 12px;
        margin: 0 0 15px 0;
    }
    
    .instructions p {
        line-height: 1.35;
    }
    
    .instructions p:first-child {
        font-size: 22px;
        margin-bottom: 12px;
    }
    
    .instructions p:not(:first-child) {
        font-size: 15px;
        margin-bottom: 8px;
    }
    
    #start-btn, #restart-btn {
        font-size: 24px;
        padding: 14px 46px;
        margin-top: 0;
    }
    
    .homepage-link {
        margin-top: 16px;
        margin-bottom: 8px;
    }
    
    .homepage-btn {
        font-size: 18px;
        padding: 11px 36px;
    }
    
    #gameover-screen h1 {
        font-size: 30px;
        margin-bottom: 10px;
    }
    
    #gameover-screen h2.subtitle {
        font-size: 16px;
        margin-bottom: 20px;
        letter-spacing: 1.5px;
    }
    
    .result {
        padding: 20px 30px;
    }
    
    .final-score, .max-combo {
        font-size: 20px;
    }
    
    .final-score span, .max-combo span {
        font-size: 36px;
    }
    
    .best-scores {
        padding: 16px 20px;
        margin-top: 18px;
        margin-bottom: 22px;
    }
    
    .best-scores-title {
        font-size: 18px;
        margin-bottom: 10px;
    }
    
    .best-score-text, .best-combo-text {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    .best-scores-note {
        font-size: 11px;
        margin-top: 9px;
    }
    
    #best-score, #best-combo {
        font-size: 26px;
    }
    
    .falling-char {
        font-size: 36px;
        padding: 10px;
        width: 44px;
        height: 44px;
    }
    
    #combo-display {
        right: 10px;
        top: 28%;
    }
    
    .combo-number {
        font-size: 50px;
    }
    
    .combo-label {
        font-size: 16px;
    }
    
    .combo-stars .star {
        font-size: 20px;
    }
    
    #unagi-combo-display {
        left: 10px;
        top: 28%;
    }
    
    .unagi-combo-icon {
        font-size: 40px;
    }
    
    .unagi-combo-number {
        font-size: 45px;
    }
    
    .unagi-combo-label {
        font-size: 14px;
    }
    
    #funny-text {
        font-size: 48px;
    }
    
    .unagi-body {
        width: 120px;
        height: 120px;
    }
    
    .penalty-message {
        font-size: 30px;
    }
    
    .label {
        font-size: 10px;
    }
    
    #score, #combo, #next-char {
        font-size: 18px;
    }
    
    #next-char {
        font-size: 28px;
        padding: 4px 10px;
    }
    
    .time-box #time {
        font-size: 20px !important;
    }
}

/* 極小画面用（古いスマホ） */
@media (max-width: 320px) {
    #start-screen {
        padding: 10px;
    }
    
    #start-screen h1 {
        font-size: 28px;
        letter-spacing: 1px;
        margin-bottom: 5px;
        margin-top: 6px;
    }
    
    #start-screen h2.subtitle {
        font-size: 16px;
        margin-bottom: 10px;
        letter-spacing: 0.5px;
    }
    
    .best-scores-start {
        padding: 8px 15px;
        margin-bottom: 12px;
    }
    
    .best-score-label {
        font-size: 14px;
        margin-bottom: 4px;
    }
    
    .best-score-start-text {
        font-size: 18px;
        margin-bottom: 3px;
    }
    
    .best-score-note {
        font-size: 10px;
    }
    
    #best-score-start, #best-combo-start {
        font-size: 22px;
    }
    
    .en-text {
        font-size: 0.7em;
    }
    
    .instructions {
        padding: 12px 10px;
        margin: 0 0 12px 0;
    }
    
    .instructions p {
        line-height: 1.3;
    }
    
    .instructions p:first-child {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .instructions p:not(:first-child) {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    #start-btn, #restart-btn {
        font-size: 22px;
        padding: 12px 40px;
        margin-top: 0;
    }
    
    .homepage-link {
        margin-top: 14px;
        margin-bottom: 6px;
    }
    
    .homepage-btn {
        font-size: 17px;
        padding: 10px 32px;
    }
    
    #gameover-screen h1 {
        font-size: 26px;
        margin-bottom: 8px;
    }
    
    #gameover-screen h2.subtitle {
        font-size: 14px;
        margin-bottom: 18px;
        letter-spacing: 1px;
    }
    
    .result {
        padding: 18px 25px;
    }
    
    .final-score, .max-combo {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .final-score span, .max-combo span {
        font-size: 32px;
    }
    
    .best-scores {
        padding: 14px 18px;
        margin-top: 15px;
        margin-bottom: 20px;
    }
    
    .best-scores-title {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .best-score-text, .best-combo-text {
        font-size: 16px;
        margin-bottom: 6px;
    }
    
    .best-scores-note {
        font-size: 10px;
        margin-top: 8px;
    }
    
    #best-score, #best-combo {
        font-size: 24px;
    }
    
    .falling-char {
        font-size: 32px;
        padding: 8px;
        width: 40px;
        height: 40px;
    }
    
    #combo-display {
        right: 8px;
        top: 26%;
    }
    
    .combo-number {
        font-size: 44px;
    }
    
    .combo-label {
        font-size: 14px;
    }
    
    .combo-stars .star {
        font-size: 18px;
        gap: 3px;
    }
    
    #unagi-combo-display {
        left: 8px;
        top: 26%;
    }
    
    .unagi-combo-icon {
        font-size: 36px;
    }
    
    .unagi-combo-number {
        font-size: 40px;
    }
    
    .unagi-combo-label {
        font-size: 12px;
    }
    
    #funny-text {
        font-size: 40px;
    }
    
    .unagi-body {
        width: 100px;
        height: 100px;
    }
    
    .penalty-message {
        font-size: 26px;
    }
    
    .label {
        font-size: 9px;
    }
    
    #score, #combo {
        font-size: 16px;
    }
    
    #next-char {
        font-size: 24px;
        padding: 3px 8px;
    }
    
    .time-box #time {
        font-size: 18px !important;
    }
    
    #game-header {
        padding: 6px 3px;
    }
    
    .info-box {
        min-width: 50px;
    }
}
