/* ==================== パズルゲーム専用スタイル ==================== */

/* ゲームコンテナ */
.game-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

/* ゲームヘッダー */
.game-header {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header-left {
    display: flex;
    justify-content: flex-start;
}

.header-center {
    text-align: center;
}

.header-right {
    display: flex;
    justify-content: flex-end;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-family: 'Kosugi Maru', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-5px);
}

.game-title {
    font-size: 2.5rem;
    color: white;
    font-family: 'Dela Gothic One', sans-serif;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

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

.points-display {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 16px;
    border-radius: 25px;
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ゲーム選択画面 */
.game-selection {
    max-width: 1200px;
    margin: 0 auto;
}

.selection-header {
    text-align: center;
    margin-bottom: 40px;
}

.selection-header h2 {
    font-size: 2.2rem;
    color: white;
    margin-bottom: 10px;
    font-family: 'Kiwi Maru', sans-serif;
}

.selection-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
}

.puzzle-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.puzzle-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
}

.puzzle-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

.puzzle-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.puzzle-card h3 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 15px;
    font-family: 'Kiwi Maru', sans-serif;
}

.puzzle-card p {
    color: #7f8c8d;
    line-height: 1.6;
    margin-bottom: 20px;
}

.difficulty-tags {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
}

.tag {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

.tag.easy {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.tag.medium {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
}

.tag.hard {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.start-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Kosugi Maru', sans-serif;
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* ゲームプレイエリア */
.game-play {
    max-width: 1200px;
    margin: 0 auto;
}

.game-info {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.game-stats {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
}

.game-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ゲームボード */
.game-board {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* スライディングパズル */
.sliding-puzzle {
    display: grid;
    gap: 3px;
    background: #34495e;
    padding: 10px;
    border-radius: 10px;
}

.sliding-tile {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.sliding-tile:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #5dade2, #3498db);
}

.sliding-tile.empty {
    background: transparent;
    cursor: default;
}

.sliding-tile.empty:hover {
    transform: none;
}

/* ジグソーパズル */
.jigsaw-puzzle {
    display: grid;
    gap: 2px;
    max-width: 400px;
    margin: 0 auto;
}

.jigsaw-piece {
    aspect-ratio: 1;
    background: #ecf0f1;
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.jigsaw-piece.filled {
    border: 2px solid #27ae60;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.jigsaw-piece:hover {
    background: #d5dbdb;
    transform: scale(1.02);
}

.jigsaw-piece img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

/* メモリーパズル */
.memory-puzzle {
    display: grid;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

.memory-card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.memory-card::before {
    content: '?';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.memory-card.flipped::before {
    transform: rotateY(180deg);
    opacity: 0;
}

.memory-card.matched {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    cursor: default;
    transform: scale(0.95);
}

.memory-card:hover:not(.matched) {
    transform: scale(1.05);
}

/* ヒントパネル */
.hint-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    z-index: 1000;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.hint-content h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.hint-content p {
    color: #7f8c8d;
    line-height: 1.6;
    margin-bottom: 20px;
}

.hint-content button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Kosugi Maru', sans-serif;
}

/* モーダル */
.result-modal, .pause-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 25px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.result-header h2 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 10px;
    font-family: 'Kiwi Maru', sans-serif;
}

.result-header p {
    color: #7f8c8d;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.result-stat {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

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

.stat-info {
    text-align: left;
}

.stat-name {
    display: block;
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-number {
    display: block;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: bold;
}

.star-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    font-size: 2rem;
}

.star {
    animation: starTwinkle 1.5s ease-in-out infinite alternate;
}

.star:nth-child(2) {
    animation-delay: 0.3s;
}

.star:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes starTwinkle {
    0% { transform: scale(1) rotate(0deg); opacity: 0.7; }
    100% { transform: scale(1.2) rotate(10deg); opacity: 1; }
}

.result-buttons, .pause-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.result-btn, .pause-buttons button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Kosugi Maru', sans-serif;
    font-weight: bold;
    transition: all 0.3s ease;
}

.next-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.retry-btn {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
}

.home-btn {
    background: linear-gradient(135deg, #607D8B, #455A64);
    color: white;
}

.result-btn:hover, .pause-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .game-header {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 15px;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    .puzzle-types {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .game-info {
        flex-direction: column;
        align-items: stretch;
    }
    
    .game-stats {
        justify-content: space-around;
    }
    
    .game-controls {
        justify-content: center;
    }
    
    .sliding-tile {
        width: 60px;
        height: 60px;
        font-size: 1.3rem;
    }
    
    .result-stats {
        grid-template-columns: 1fr;
    }
    
    .result-buttons, .pause-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 10px;
    }
    
    .sliding-tile {
        width: 50px;
        height: 50px;
        font-size: 1.1rem;
    }
    
    .modal-content {
        padding: 20px;
    }
}