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

body {
    font-family: 'Klee One', 'Yu Gothic', 'YuGothic', 'Hiragino Kaku Gothic Pro', 'MS PGothic', cursive;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #2c1810;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.container {
    max-width: 1200px;
    min-height: calc(100vh - 40px);
    margin: 20px auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #667eea;
    font-size: 3.5rem;
    margin-bottom: 15px;
    text-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
    background: linear-gradient(45deg, #667eea, #764ba2);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: bold;
}

.game-description {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 20px;
    line-height: 1.5;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.progress-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}

.progress-bar {
    width: 300px;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 20px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
    width: var(--progress-width, 10%);
}

.progress-icons {
    display: flex;
    gap: 4px;
}

.progress-icon {
    font-size: 20px;
    transition: all 0.3s ease;
}

.progress-icon.completed {
    color: #ffd700;
    text-shadow: 0 0 8px #ffd700;
    transform: scale(1.3);
}

.progress-icon.current {
    color: #ff6347;
    animation: pulse 1s infinite;
    transform: scale(1.2);
}

.progress-icon.remaining {
    color: rgba(139, 69, 19, 0.4);
}

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

.game-info {
    display: flex;
    justify-content: space-around;
    background: rgba(230, 240, 235, 0.95);
    border-radius: 10px;
    padding: 15px;
    margin: 0 10px;
    font-weight: bold;
    font-size: 1.3rem;
    border: 2px solid rgba(196, 154, 255, 0.8);
    box-shadow: 0 4px 12px rgba(196, 154, 255, 0.3);
}

/* メインゲームエリアのレイアウト */
.game-area {
    display: flex;
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
    align-items: flex-start;
}

.game-board-container {
    flex: 1;
    min-width: 300px;
}

.game-board {
    display: grid;
    gap: 8px;
    max-width: 400px;
    margin: 0 auto;
    padding: 0 10px;
    justify-content: center;
}

.card {
    width: 80px;
    height: 100px;
    background: linear-gradient(145deg, #e8eaf6, #c5cae9);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(102, 126, 234, 0.3);
}

.card:active {
    transform: scale(0.95);
}

.card.flipped {
    background: linear-gradient(145deg, #b39ddb, #9575cd);
    color: #ffffff;
    border: 2px solid #7e57c2;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.card.matched {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: #ffffff;
    animation: matchAnimation 0.6s ease;
    position: relative;
    overflow: visible;
    border: 2px solid #5e35b1;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.6);
}

.card.back {
    background: linear-gradient(45deg, #9c88ff, #b39ddb, #d1c4e9);
    color: #ffffff;
    border: 2px solid #7e57c2;
}

.card.back::before {
    content: '?';
    font-size: 2rem;
    font-weight: bold;
}

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

@keyframes sparkle {
    0% { 
        opacity: 0; 
        transform: scale(0) rotate(0deg);
    }
    25% {
        opacity: 1;
        transform: scale(1.5) rotate(90deg);
    }
    50% { 
        opacity: 1; 
        transform: scale(1.2) rotate(180deg);
    }
    75% {
        opacity: 0.8;
        transform: scale(1.8) rotate(270deg);
    }
    100% { 
        opacity: 0; 
        transform: scale(0) rotate(360deg);
    }
}

.sparkle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: transparent;
    border-radius: 50%;
    pointer-events: none;
    animation: sparkle 1.5s ease-out forwards;
}

.sparkle::before {
    content: '🌸';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    color: #ff69b4;
    text-shadow: 0 0 10px #ff69b4;
    animation: sparkle 1.5s ease-out forwards;
}

.card.matched::after {
    content: '🌸';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 1.5rem;
    animation: sparkle 1.5s ease-out;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
    padding: 0 10px;
}

.btn {
    padding: 12px 24px;
    font-size: 1rem;
    border: none;
    border-radius: 25px;
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn:hover {
    background: linear-gradient(145deg, #764ba2, #667eea);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
    pointer-events: auto;
}

.modal-content {
    background-color: #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    animation: slideIn 0.3s ease;
    pointer-events: auto;
    z-index: 1001;
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2.2rem;
    font-weight: bold;
    text-shadow: 
        0 2px 4px rgba(102, 126, 234, 0.3),
        0 4px 8px rgba(118, 75, 162, 0.4);
    background: linear-gradient(45deg, #667eea, #764ba2, #667eea);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: celebration 2s ease-in-out infinite alternate;
}

@keyframes celebration {
    0% {
        transform: scale(1);
        text-shadow: 
            2px 2px 0px #8b0000,
            4px 4px 8px rgba(139, 0, 0, 0.6),
            0 0 25px rgba(255, 69, 0, 0.5);
    }
    100% {
        transform: scale(1.05);
        text-shadow: 
            3px 3px 0px #8b0000,
            6px 6px 12px rgba(139, 0, 0, 0.8),
            0 0 35px rgba(255, 69, 0, 0.8);
    }
}

.modal-content p {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translate(-50%, -50%) scale(0.8); }
    to { transform: translate(-50%, -50%) scale(1); }
}

/* スマートフォン向けの調整 */
@media (max-width: 480px) {
    h1 {
        font-size: 2.8rem;
    }
    
    .game-info {
        font-size: 0.8rem;
        padding: 8px;
    }
    
    .game-area {
        flex-direction: column;
        gap: 15px;
    }
    
    .completed-kanjis {
        flex: none;
        position: static;
        order: -1;
    }
    
    .game-board {
        gap: 6px;
        padding: 0 5px;
    }
    
    .card {
        font-size: 2rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .completed-kanji {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }
    
    .completed-kanji .kanji {
        font-size: 1.5rem;
    }
}

/* 横向きの場合の調整 */
@media (orientation: landscape) and (max-height: 600px) {
    .container {
        padding: 5px;
    }
    
    h1 {
        font-size: 2.2rem;
        margin-bottom: 10px;
    }
    
    .game-info {
        margin-bottom: 10px;
    }
    
    .game-board {
        max-width: 350px;
    }
}

/* 漢字ゲーム専用スタイル */
.completed-kanjis {
    flex: 0 0 250px;
    background: rgba(248, 245, 240, 0.95);
    border-radius: 10px;
    padding: 15px;
    border: 2px solid rgba(196, 154, 255, 0.5);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.completed-kanjis h3 {
    text-align: center;
    color: #4a3728;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.kanji-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.completed-kanji {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(145deg, #b39ddb, #9575cd);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #7e57c2;
}

.completed-kanji .kanji {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ffffff;
}

.completed-kanji .reading {
    font-size: 0.9rem;
    color: #ffffff;
    font-style: italic;
}

.completed-kanji .parts {
    font-size: 1rem;
    color: #4a3728;
    opacity: 0.8;
}

.card {
    font-size: 2rem;
    font-weight: bold;
}

.card.flipped {
    transform: scale(1.05);
}


