/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: #FFF8E1;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
}

/* ===== Header / Nav ===== */
header {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    padding: 12px 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 24px;
    transition: background 0.2s;
}

.nav-link:hover {
    background: rgba(255,255,255,0.35);
}

/* ===== Main ===== */
main {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px;
    width: 100%;
}

/* ===== Hero ===== */
.hero {
    text-align: center;
    margin-bottom: 32px;
}

.hero h1 {
    font-size: 2.6rem;
    color: #2E7D32;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 1.3rem;
    color: #666;
}

/* ===== Card Grid ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.disaster-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 24px;
    border-radius: 24px;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}

.disaster-card:hover, .disaster-card:active {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}

.card-emoji {
    font-size: 4rem;
    margin-bottom: 12px;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.3));
}

.disaster-card h2 {
    font-size: 1.8rem;
    margin-bottom: 6px;
}

.disaster-card p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ===== Disaster Detail Page ===== */
.disaster-header {
    text-align: center;
    margin-bottom: 24px;
}

.disaster-header .big-emoji {
    font-size: 5rem;
    display: block;
    margin-bottom: 8px;
}

.disaster-header h1 {
    font-size: 2.4rem;
    margin-bottom: 4px;
}

.disaster-header .tagline {
    font-size: 1.2rem;
    color: #666;
}

.sound-effect {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin: 16px 0;
    letter-spacing: 2px;
    opacity: 0.7;
}

.explanation {
    font-size: 1.2rem;
    line-height: 1.7;
    background: #fff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    margin-bottom: 24px;
}

.fun-fact {
    font-size: 1.1rem;
    line-height: 1.6;
    background: #E8F5E9;
    border-left: 6px solid #4CAF50;
    padding: 16px 20px;
    border-radius: 0 12px 12px 0;
    margin-bottom: 24px;
}

.fun-fact strong {
    color: #2E7D32;
}

/* ===== Canvas ===== */
.sim-section {
    margin-bottom: 24px;
}

.sim-instruction {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 12px;
}

.canvas-wrap {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.canvas-wrap canvas {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
}

/* ===== Navigation (prev/next) ===== */
.detail-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.detail-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    transition: opacity 0.2s;
}

.detail-nav a:hover {
    opacity: 0.85;
}

.detail-nav .map-link {
    background: #4CAF50;
}

.detail-nav .prev-link, .detail-nav .next-link {
    background: #78909C;
}

/* ===== World Map Page ===== */
.map-page h1 {
    text-align: center;
    font-size: 2rem;
    color: #2E7D32;
    margin-bottom: 16px;
}

.map-container {
    width: 100%;
    height: 70vh;
    min-height: 400px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
    font-weight: 600;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
}

/* ===== Footer ===== */
footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 0.95rem;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .hero h1 {
        font-size: 1.8rem;
    }
    .subtitle {
        font-size: 1.05rem;
    }
    .card-grid {
        grid-template-columns: 1fr;
    }
    .disaster-card {
        padding: 24px 16px;
    }
    .card-emoji {
        font-size: 3rem;
    }
    .disaster-header .big-emoji {
        font-size: 3.5rem;
    }
    .disaster-header h1 {
        font-size: 1.8rem;
    }
    .explanation, .fun-fact {
        font-size: 1.05rem;
    }
    .detail-nav {
        flex-direction: column;
    }
    .detail-nav a {
        width: 100%;
        justify-content: center;
    }
    .map-container {
        height: 55vh;
        border-radius: 12px;
    }
}
