@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&family=Zen+Kaku+Gothic+New:wght@400;700&display=swap');

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

body {
    font-family: 'Zen Kaku Gothic New', 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #8B4513 0%, #D2691E 20%, #CD853F 40%, #F4A460 60%, #DEB887 80%, #F5DEB3 100%);
    background-size: 400% 400%;
    animation: woodGrain 20s ease infinite;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
}

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

.game-container {
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: linear-gradient(45deg, #F5F5DC 0%, #FFF8DC 25%, #FFFACD 50%, #FFF8DC 75%, #F5F5DC 100%);
    background-size: 20px 20px;
    background-image: 
        radial-gradient(circle at 10px 10px, rgba(139, 69, 19, 0.1) 1px, transparent 1px),
        linear-gradient(45deg, rgba(139, 69, 19, 0.05) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(139, 69, 19, 0.05) 25%, transparent 25%);
    border: 5px solid #8B4513;
    border-radius: 15px;
    box-shadow: 
        0 0 0 3px #CD853F,
        0 20px 40px rgba(139, 69, 19, 0.4),
        inset 0 0 20px rgba(139, 69, 19, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ui-panel {
    background: linear-gradient(135deg, #8B4513 0%, #654321 50%, #5D4037 100%);
    background-image: 
        linear-gradient(90deg, rgba(139, 69, 19, 0.8) 0%, rgba(160, 82, 45, 0.8) 50%, rgba(139, 69, 19, 0.8) 100%),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.1) 0px, rgba(0, 0, 0, 0.1) 1px, transparent 1px, transparent 4px);
    color: #FFF8DC;
    padding: 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 3px solid #654321;
    box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.3);
}

.score-display, .high-score-display, .timer-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(139, 69, 19, 0.3);
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #8B4513;
}

.score-label, .high-score-label, .timer-label {
    font-size: 12px;
    opacity: 0.9;
    color: #FFF8DC;
    font-weight: 400;
}

.score-value, .high-score-value, .timer-value {
    font-size: 24px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.timer-value {
    color: #FF6B6B;
}

.game-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: linear-gradient(to bottom, #E6E6FA 0%, #F0F8FF 30%, #F5F5DC 70%, #FFF8DC 100%);
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(139, 69, 19, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 69, 19, 0.03) 0%, transparent 50%),
        linear-gradient(45deg, rgba(139, 69, 19, 0.02) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(139, 69, 19, 0.02) 25%, transparent 25%);
    background-size: 100px 100px, 100px 100px, 50px 50px, 50px 50px;
}

.instruction {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 24px;
    color: #FFF8DC;
    background: linear-gradient(135deg, #8B4513 0%, #654321 50%, #5D4037 100%);
    background-image: 
        repeating-linear-gradient(90deg, rgba(139, 69, 19, 0.8) 0px, rgba(139, 69, 19, 0.8) 1px, transparent 1px, transparent 4px);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 
        0 0 0 5px #CD853F,
        0 0 0 10px #A0522D,
        0 20px 50px rgba(139, 69, 19, 0.5);
    transition: all 0.3s ease;
    z-index: 9999;
    max-width: 300px;
    width: 90%;
    border: 3px solid #A0522D;
    font-weight: bold;
    font-family: 'Zen Kaku Gothic New', serif;
}

.instruction::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #2F1B14 0%, #4A2C2A 50%, #3D2914 100%);
    background-image: 
        repeating-linear-gradient(45deg, rgba(139, 69, 19, 0.2) 0px, rgba(139, 69, 19, 0.2) 10px, transparent 10px, transparent 20px);
    z-index: -1;
}

.tile {
    position: absolute;
    width: 160px;
    height: 25px;
    background: linear-gradient(135deg, #D2691E 0%, #CD853F 20%, #8B4513 40%, #A0522D 60%, #D2691E 80%, #F4A460 100%);
    background-image: 
        repeating-linear-gradient(90deg, rgba(139, 69, 19, 0.3) 0px, rgba(139, 69, 19, 0.3) 1px, transparent 1px, transparent 3px),
        repeating-linear-gradient(0deg, rgba(160, 82, 45, 0.2) 0px, rgba(160, 82, 45, 0.2) 1px, transparent 1px, transparent 2px);
    border: 3px solid #654321;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 6px 12px rgba(139, 69, 19, 0.4), 
        inset 0 2px 4px rgba(255, 255, 255, 0.3),
        inset 0 -2px 4px rgba(139, 69, 19, 0.3);
}

.tile::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    right: 6px;
    bottom: 55%;
    background: linear-gradient(to bottom, rgba(255, 248, 220, 0.6), rgba(255, 248, 220, 0.2));
    border-radius: 4px;
    background-image: repeating-linear-gradient(90deg, rgba(139, 69, 19, 0.1) 0px, rgba(139, 69, 19, 0.1) 1px, transparent 1px, transparent 4px);
}

.tile::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 6px;
    right: 6px;
    bottom: 3px;
    background: linear-gradient(to bottom, rgba(139, 69, 19, 0.1), rgba(139, 69, 19, 0.4));
    border-radius: 4px;
    background-image: repeating-linear-gradient(90deg, rgba(101, 67, 33, 0.2) 0px, rgba(101, 67, 33, 0.2) 1px, transparent 1px, transparent 4px);
}

.tile.breaking {
    animation: breakAnimation 0.3s ease-out forwards;
}

@keyframes breakAnimation {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.1) rotate(5deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.8) rotate(15deg);
        opacity: 0;
    }
}

.crack-effect {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
}

.crack-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: linear-gradient(45deg, #8B4513, #654321);
    border-radius: 50%;
    animation: particleAnimation 0.6s ease-out forwards;
    box-shadow: 0 0 3px rgba(139, 69, 19, 0.5);
}

@keyframes particleAnimation {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0) translate(var(--dx), var(--dy));
        opacity: 0;
    }
}

.continuous-combo-text {
    position: absolute;
    font-size: 20px;
    font-weight: bold;
    color: #FF6B6B;
    pointer-events: none;
    z-index: 1001;
    text-shadow: 
        2px 2px 4px rgba(139, 69, 19, 0.7),
        0 0 10px rgba(255, 107, 107, 0.5);
    transition: all 0.2s ease;
    font-family: 'Zen Kaku Gothic New', serif;
    background: linear-gradient(135deg, rgba(255, 248, 220, 0.9), rgba(255, 250, 205, 0.9));
    padding: 5px 10px;
    border-radius: 15px;
    border: 2px solid #8B4513;
}

.combo-text {
    position: absolute;
    font-size: 28px;
    font-weight: bold;
    color: #FF6B6B;
    pointer-events: none;
    z-index: 1001;
    animation: comboAnimation 1s ease-out forwards;
    text-shadow: 
        2px 2px 4px rgba(139, 69, 19, 0.7),
        0 0 15px rgba(255, 107, 107, 0.7);
    font-family: 'Zen Kaku Gothic New', serif;
    background: linear-gradient(135deg, rgba(255, 248, 220, 0.95), rgba(255, 250, 205, 0.95));
    padding: 8px 15px;
    border-radius: 20px;
    border: 3px solid #8B4513;
}

@keyframes comboAnimation {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1) translateY(-50px);
        opacity: 0;
    }
}

.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #2F1B14 0%, #4A2C2A 50%, #3D2914 100%);
    background-image: 
        repeating-linear-gradient(45deg, rgba(139, 69, 19, 0.2) 0px, rgba(139, 69, 19, 0.2) 20px, transparent 20px, transparent 40px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.game-over-dialog {
    background: linear-gradient(135deg, #8B4513 0%, #654321 50%, #5D4037 100%);
    background-image: 
        repeating-linear-gradient(90deg, rgba(139, 69, 19, 0.8) 0px, rgba(139, 69, 19, 0.8) 1px, transparent 1px, transparent 4px);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 
        0 0 0 5px #CD853F,
        0 0 0 10px #A0522D,
        0 20px 50px rgba(139, 69, 19, 0.5);
    max-width: 300px;
    width: 90%;
    border: 3px solid #A0522D;
}

.game-over-title {
    font-size: 32px;
    font-weight: bold;
    color: #FFF8DC;
    margin-bottom: 20px;
    font-family: 'Zen Kaku Gothic New', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-over-score {
    font-size: 24px;
    color: #FFD700;
    margin-bottom: 20px;
    font-family: 'Zen Kaku Gothic New', serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.restart-button {
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 50%, #8B4513 100%);
    background-image: 
        repeating-linear-gradient(90deg, rgba(139, 69, 19, 0.8) 0px, rgba(139, 69, 19, 0.8) 1px, transparent 1px, transparent 3px);
    color: #FFF8DC;
    border: 3px solid #654321;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Zen Kaku Gothic New', 'Noto Sans JP', sans-serif;
    font-weight: bold;
    box-shadow: 
        0 4px 8px rgba(139, 69, 19, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.restart-button:hover {
    background: linear-gradient(135deg, #A0522D 0%, #CD853F 50%, #A0522D 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 12px rgba(139, 69, 19, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

@media (max-width: 480px) {
    .game-container {
        border-radius: 0;
        height: 100vh;
    }
    
    .ui-panel {
        padding: 15px;
    }
    
    .score-value, .high-score-value {
        font-size: 20px;
    }
    
    .tile {
        width: 140px;
        height: 22px;
    }
    
    .instruction {
        font-size: 16px;
        padding: 15px;
    }
}