@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

html {
    scroll-behavior: smooth;
}

:root {
    --primary-font: 'Poppins', sans-serif;
    --bg-color: #f7f8fa;
    --text-color: #333;
    --primary-color: #005bff;
    --accent-color: #ff6b6b; /* Kept for contrast where needed */
    --container-bg: #ffffff;
    --border-color: #e0e6ed;
    --border-radius: 8px;
    --box-shadow: 0 4px 25px rgba(0, 31, 82, 0.05);
}

body {
    font-family: var(--primary-font);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-overflow-scrolling: touch; /* Enable momentum-based scrolling on iOS */
}

header {
    background-color: var(--container-bg);
    padding: 15px 30px;
    text-align: center;
    flex-shrink: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
}

footer {
    background-color: #1c2a4e;
    color: white;
    padding: 15px 30px;
    text-align: center;
    flex-shrink: 0;
}

header .logo {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
}

footer p {
    margin: 0;
    font-size: 0.9rem;
    color: #e0e6ed;
}

h1, h2 {
    font-family: var(--primary-font);
    font-weight: 700;
    color: #1c2a4e;
}

h2 {
    font-size: 2rem;
    animation: fadeInDown 0.5s both;
}

#game-container, main {
    flex-grow: 1;
    position: relative; /* Keep for absolutely positioned children like the HUD */
    display: flex;
    flex-direction: column;
}

.screen {
    /* No longer absolute, will flow in document */
    padding: 60px 40px;
    box-sizing: border-box;
    text-align: center;
    display: none; /* Hidden by default */
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
}

.screen.active {
    display: flex; /* Shown when active */
    animation: fadeIn 0.5s ease-in-out;
}

button, .learn-more-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-family: var(--primary-font);
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 91, 255, 0.2);
    text-decoration: none;
    display: inline-block;
}

button:hover, .learn-more-btn:hover {
    background-color: #004acc;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 91, 255, 0.3);
}

button:active {
    transform: translateY(-1px);
}

.header-icons {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    animation: fadeInDown 0.5s both;
}

.header-icons i {
    margin: 0 15px;
}

#start-screen h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    animation: fadeInDown 0.5s both;
}

#start-screen .sub-heading {
    font-size: 1.5rem;
    font-weight: 400;
    color: #5a6782;
    margin-bottom: 20px;
    animation: fadeInUp 0.5s 0.2s both;
}

.footer-links {
    margin-top: 40px;
    animation: fadeInUp 0.5s 0.4s both;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    margin: 0 15px;
    font-size: 0.9rem;
}

/* New List Styles */
ul.profile-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    text-align: left;
    max-width: 400px;
    width: 100%;
    animation: fadeInUp 0.5s 0.3s both;
}

ul.profile-list li {
    background: #f7f8fa;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
}

ul.profile-list li i {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-right: 15px;
    width: 30px;
    text-align: center;
}


/* General Animation Keyframes */
@keyframes fadeInDown {
    from { opacity: 0; transform: translate3d(0, -30px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translate3d(0, 30px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* Styles for HUD */
#hud {
    position: sticky; /* Stick to the top of its container */
    top: 0;
    width: 100%;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-around;
    padding: 10px;
    font-size: 0.9rem;
    box-sizing: border-box;
    z-index: 5;
}

#main-game-screen {
    padding: 0; /* Remove padding to allow HUD to be flush with top */
}

#main-game-screen #scenario-container {
    padding: 60px 40px; /* Add padding to the content area instead */
    width: 100%;
    box-sizing: border-box;
}

/* Styles for choice cards */
.choices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    width: 100%;
    margin-top: 20px;
}

.choice-card {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: left;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.choice-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    transform: translateY(-5px);
}

.choice-card h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.choice-card p {
    flex-grow: 1;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-color);
}

/* Remove button style from choice-card itself if it's a button */
button.choice-card {
    background: #f9f9f9;
    border: 1px solid #ddd;
    color: var(--text-color);
    text-align: left;
}

button.choice-card:hover {
     background: #f0f0f0;
}

.choice-card.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.5);
    transform: translateY(-5px);
}

.child-school-choice {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

/* New styles for Node 3: School Table & Selectors */
.school-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.9rem;
}

.school-table th, .school-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

.school-table th {
    background-color: #f2f2f2;
    font-weight: 700;
}

.school-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.choices-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.choices-buttons button {
    flex-grow: 1;
}

/* Consequence & End Screen Styles */
.consequence-card {
    background: var(--bg-color);
    border-left: 5px solid var(--primary-color);
    padding: 20px;
    margin-bottom: 20px;
    animation: fadeIn 0.5s ease-in-out;
}

.consequence-card h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.consequence-card p strong {
    color: var(--accent-color);
}

#end-screen {
    justify-content: flex-start; /* Align content to top to prevent cutoff */
    padding-top: 60px;
    padding-bottom: 60px;
}

#end-screen .summary {
    text-align: left;
    max-width: 600px;
    line-height: 1.7;
    font-size: 1.1rem;
}

#end-screen .summary h4 {
    margin-top: 20px;
}

#end-screen .summary ul {
    list-style-type: none;
    padding-left: 0;
}

#end-screen .summary li {
    background: #f9f9f9;
    padding: 10px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    border: 1px solid #eee;
}

/* New Resource Section Styles */
.resources-container {
    width: 100%;
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    box-sizing: border-box;
    text-align: left;
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Default to 3 columns */
    gap: 20px;
}

.resources-container h3 {
    grid-column: 1 / -1; /* Make header span all columns */
    text-align: center;
    font-size: 1.8rem;
    color: #1c2a4e;
    margin-bottom: 0;
}

.resource-card {
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 0; /* Use grid gap instead */
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
    display: flex; /* For equal height cards */
    flex-direction: column;
}

.resource-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 31, 82, 0.1);
}

.resource-card h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3rem;
    color: var(--primary-color);
}

.resource-card .info-list {
    flex-grow: 1; /* This pushes the button to the bottom */
    margin-bottom: 20px;
}

.resource-card .learn-more-btn {
    background-color: var(--accent-color);
    font-size: 0.9rem;
    padding: 10px 20px;
}

.resource-card .learn-more-btn:hover {
    background-color: #e65a5a;
}

.resource-card .learn-more-btn i {
    margin-left: 8px;
}

.end-buttons {
    margin-top: 30px;
    display: flex;
    gap: 20px;
}

.learn-more-btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    padding: 15px 30px;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;
    transition: background-color 0.3s ease;
}

.learn-more-btn:hover {
    background-color: #e65a5a;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .resources-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    #game-container {
        min-height: 95vh;
    }

    .screen {
        padding: 60px 25px;
    }

    #start-screen h1 {
        font-size: 2.5rem;
    }

    #start-screen .sub-heading {
        font-size: 1.1rem;
    }

    h2 {
      font-size: 1.5rem;
    }

    #main-game-screen #scenario-container {
        padding: 60px 25px;
    }

    .resources-container {
        grid-template-columns: 1fr;
    }

    /* Responsive Table: Card Layout */
    .school-table {
        border: none;
    }
    .school-table thead {
        display: none; /* Hide table headers */
    }
    .school-table tr {
        display: block;
        margin-bottom: 15px;
        border-radius: var(--border-radius);
        border: 1px solid var(--border-color);
        box-shadow: var(--box-shadow);
    }
    .school-table td {
        display: block;
        text-align: right;
        border-bottom: 1px dotted var(--border-color);
        padding-left: 50%;
        position: relative;
    }
    .school-table td:last-child {
        border-bottom: none;
    }
    .school-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        font-weight: bold;
        text-align: left;
        white-space: normal;
    }

    .content-page {
        padding: 60px 25px;
    }

    .choices-buttons {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .end-buttons {
        flex-direction: column;
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
      -webkit-text-size-adjust: 100%; /* Prevent iOS font scaling.*/
    }
    
    .screen {
        padding: 40px 20px;
    }

    #start-screen h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    #main-game-screen #scenario-container {
        padding: 40px 20px;
    }

    button, .learn-more-btn {
        padding: 12px 24px;
        font-size: 1rem;
    }

    #hud {
        font-size: 0.8rem;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding: 10px;
    }

    .choices-buttons {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .end-buttons {
        flex-direction: column;
        width: 100%;
    }

    .content-page {
        padding: 40px 20px;
    }

    .resources-container {
        grid-template-columns: 1fr;
    }
}

/* --- Dark Mode Styles --- */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e0e6ed;
        --container-bg: #252526;
        --border-color: #3e3e42;
        --box-shadow: 0 4px 25px rgba(0, 0, 0, 0.2);
    }

    body {
        background-color: var(--bg-color);
        color: var(--text-color);
    }

    h1, h2, #start-screen .sub-heading {
        color: #f5f5f7;
    }

    header {
        background-color: var(--container-bg);
        border-bottom: 1px solid var(--border-color);
    }

    ul.profile-list li {
        background: var(--container-bg);
        border-color: var(--border-color);
    }

    .school-table th {
        background-color: #333;
    }
    .school-table tbody tr:nth-child(even) {
        background-color: var(--container-bg);
    }
    .school-table, .school-table td {
        border-color: var(--border-color);
    }

    .resource-card {
        background: var(--container-bg);
        border-color: var(--border-color);
    }
}

/* Styles for About Page */
.content-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: left;
}

.content-page h1, .content-page h2, .content-page h3 {
    text-align: center;
}

.content-page h3 {
    font-size: 1.5rem;
    margin-top: 40px;
    margin-bottom: 20px;
}

.content-page p, .content-page li {
    line-height: 1.8;
    color: #4c5a78;
}

.content-page blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    font-size: 1.1rem;
    color: #1c2a4e;
}

.info-list {
    list-style: none;
    padding: 0;
}

.info-list li {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.info-list li i {
    color: var(--primary-color);
    margin-right: 15px;
    font-size: 1.2rem;
} 