/* ── Reset & Base ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

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

/* ── Header ── */
header {
    background: linear-gradient(135deg, #5C6BC0, #3949AB);
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    color: white;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-emoji { font-size: 1.6rem; }

.lang-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.5);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.lang-btn:hover { background: rgba(255,255,255,0.35); }
.lang-btn .active-lang { text-decoration: underline; }

/* ── Main ── */
main {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 16px;
    width: 100%;
}

/* ── Hero ── */
.hero {
    text-align: center;
    padding: 30px 10px 20px;
}

.hero h1 {
    font-size: 2.4rem;
    color: #283593;
    margin-bottom: 8px;
}

.hero .subtitle {
    font-size: 1.3rem;
    color: #5C6BC0;
}

/* ── Card Grid ── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    padding: 10px 0 30px;
}

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

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

.card-emoji { font-size: 3.5rem; margin-bottom: 10px; }
.card h2 { font-size: 1.5rem; margin-bottom: 6px; }
.card p { font-size: 1.05rem; opacity: 0.9; }

/* ── Game Detail ── */
.game-header {
    text-align: center;
    padding: 20px 10px 15px;
    border-bottom: 4px solid;
    margin-bottom: 20px;
}

.game-emoji { font-size: 4rem; margin-bottom: 6px; }
.game-header h1 { font-size: 2rem; color: #283593; }
.game-header .tagline { font-size: 1.15rem; color: #5C6BC0; margin-top: 4px; }

.explanation-box {
    background: white;
    padding: 20px 24px;
    border-radius: 16px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    margin-bottom: 16px;
    font-size: 1.15rem;
    line-height: 1.6;
}

.fun-fact {
    background: #E8F5E9;
    padding: 16px 20px;
    border-radius: 14px;
    margin-bottom: 20px;
    font-size: 1.05rem;
    line-height: 1.5;
}

/* ── Canvas ── */
.canvas-wrapper {
    text-align: center;
    margin-bottom: 20px;
}

#sim-canvas {
    width: 100%;
    max-width: 600px;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    background: #fff;
    touch-action: none;
    display: block;
    margin: 0 auto;
}

.instruction {
    margin-top: 12px;
    font-size: 1.1rem;
    color: #5C6BC0;
    font-weight: 600;
}

/* ── Game Navigation ── */
.game-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 30px;
    gap: 10px;
}

.nav-btn {
    padding: 10px 20px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s;
}

.nav-btn.prev, .nav-btn.next {
    background: #C5CAE9;
    color: #283593;
}

.nav-btn.prev:hover, .nav-btn.next:hover {
    background: #9FA8DA;
}

.nav-btn.home {
    background: #5C6BC0;
    color: white;
}

.nav-btn.home:hover { background: #3949AB; }

/* ── Footer ── */
footer {
    text-align: center;
    padding: 16px;
    color: #7986CB;
    font-size: 0.95rem;
}

/* ── Admin ── */
.admin-box {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    max-width: 600px;
    margin: 30px auto;
}

.admin-box h2 { margin-bottom: 20px; color: #283593; }
.admin-box h3 { margin: 24px 0 12px; color: #3949AB; }

.admin-box input[type="password"],
.admin-box select,
.admin-box input[type="file"] {
    display: block;
    width: 100%;
    padding: 10px 14px;
    margin: 8px 0 16px;
    border: 2px solid #C5CAE9;
    border-radius: 10px;
    font-size: 1rem;
}

.admin-box label {
    font-weight: 600;
    color: #333;
}

.btn-primary {
    background: #5C6BC0;
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover { background: #3949AB; }

.flash-error { color: #D32F2F; margin-bottom: 12px; font-weight: 600; }
.flash-success { color: #2E7D32; margin-bottom: 12px; font-weight: 600; }

.char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.char-card {
    text-align: center;
    padding: 12px;
    background: #F5F5F5;
    border-radius: 12px;
}

.char-card h4 { font-size: 0.85rem; margin-bottom: 8px; color: #333; }

.char-preview {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #5C6BC0;
}

.char-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #E0E0E0;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #999;
}

.upload-form {
    margin-bottom: 20px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .hero h1 { font-size: 1.8rem; }
    .hero .subtitle { font-size: 1.1rem; }
    .card-grid { grid-template-columns: 1fr; }
    .card { padding: 22px 16px; }
    .card-emoji { font-size: 3rem; }
    .game-header h1 { font-size: 1.6rem; }
    .game-emoji { font-size: 3rem; }
    .explanation-box { padding: 16px 18px; font-size: 1.05rem; }
    .nav-btn { padding: 8px 14px; font-size: 0.9rem; }
}
