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

body {
    font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 15px;
    font-size: clamp(1.3rem, 5vw, 2rem);
}

.hidden {
    display: none !important;
}

/* 地方選択画面 */
.subtitle {
    text-align: center;
    font-size: clamp(1rem, 3.5vw, 1.3rem);
    color: #666;
    margin-bottom: 25px;
}

.region-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.region-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 25px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.region-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.region-btn:active {
    transform: translateY(-2px);
}

.region-name {
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    font-weight: bold;
}

.region-count {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    opacity: 0.9;
}

/* ゲーム画面ヘッダー */
.game-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    position: relative;
}

.back-btn {
    position: absolute;
    left: 0;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 15px;
    cursor: pointer;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #e0e0e0;
}

.back-btn:active {
    transform: scale(0.95);
}

.score-board {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #f5f5f5;
    border-radius: 10px;
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    font-weight: bold;
}

.score-board span:first-child {
    color: #4caf50;
}

.score-board span:last-child {
    color: #f44336;
}

.question-box {
    text-align: center;
    margin-bottom: 15px;
    padding: 15px;
    background: #fff3cd;
    border-radius: 10px;
    border: 2px solid #ffc107;
}

.question-box h2 {
    color: #856404;
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    word-break: break-word;
}

.map-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    padding: 10px 0;
}

#japan-map {
    width: 100%;
    max-width: 1100px;
    height: auto;
    display: block;
    border: 2px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#click-canvas {
    border-radius: 10px;
}

/* ポップアップ */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup.hidden {
    display: none;
}

.popup-content {
    background: white;
    padding: 30px 20px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.popup-content h2 {
    font-size: clamp(1.5rem, 5vw, 2rem);
    margin-bottom: 15px;
}

.popup-content h2.correct-title {
    color: #4caf50;
}

.popup-content h2.incorrect-title {
    color: #f44336;
}

.popup-content p {
    font-size: clamp(1rem, 3.5vw, 1.2rem);
    margin-bottom: 20px;
    color: #666;
    word-break: break-word;
}

#next-button {
    padding: 12px 40px;
    font-size: clamp(1rem, 3vw, 1.1rem);
    font-weight: bold;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
}

#next-button:hover {
    background: #764ba2;
    transform: scale(1.05);
}

#next-button:active {
    transform: scale(0.95);
}

/* タブレット用 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        border-radius: 15px;
    }

    .map-container {
        padding: 5px 0;
    }

    #japan-map {
        max-width: 500px;
    }
}

/* スマートフォン用 */
@media (max-width: 480px) {
    body {
        padding: 5px;
        align-items: flex-start;
        padding-top: 20px;
    }

    .container {
        padding: 15px 10px;
        border-radius: 15px;
    }

    h1 {
        margin-bottom: 10px;
    }

    .score-board {
        margin-bottom: 10px;
        padding: 10px;
        flex-direction: row;
        gap: 10px;
    }

    .question-box {
        margin-bottom: 10px;
        padding: 12px;
    }

    .map-container {
        margin-top: 5px;
        padding: 0;
    }

    .popup-content {
        padding: 25px 15px;
        width: 85%;
    }

    #next-button {
        padding: 10px 30px;
        width: 100%;
        max-width: 280px;
    }
}

/* 極小スマートフォン用 */
@media (max-width: 360px) {
    .container {
        padding: 10px 8px;
    }

    .score-board {
        padding: 8px;
        font-size: 0.85rem;
    }

    .popup-content {
        padding: 20px 12px;
    }
}
