/* --- Variables and Base Styles --- */
:root {
    --primary: #a7c7e7; /* Pastel Blue */
    --secondary: #fce1e4; /* Pastel Pink */
    --accent: #fdfd96; /* Pastel Yellow */
    --background: #f8f8f8; /* Very light grey */
    --text-color: #3a3a3a;
    --title-color: #0e67b1;
    --light: #ffffff;
    --border-radius: 0.5rem;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

@font-face {
    font-family: 'Bubblegum Sans';
    src: url('../fonts/BubblegumSans-Regular.woff2') format('woff2'),
         url('../fonts/BubblegumSans-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

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

html {
    font-size: 16px; /* Set a base font size */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    background-color: var(--background);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2 {
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* --- Navbar --- */
.navbar {
    background-color: var(--light);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--title-color);
    font-family: 'Bubblegum Sans', cursive;
}

#langSelect {
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
    background-color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
}

/* --- Main Content & Screens --- */
.container {
    flex-grow: 1;
    width: 100%;
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--light);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

/* --- Buttons --- */
button {
    cursor: pointer;
    border: none;
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    margin: 0.5rem;
    color: var(--text-color);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-color);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--text-color);
}
.name-btn {
    background-color: var(--primary);
    font-size: 1.5rem;
    min-width: 250px;
    flex: 1;
    padding: 1.5rem;
    line-height: 1.2;
}

/* --- Screen Specifics --- */
#genderScreen {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
}

#genderScreen h1 {
    width: 100%;
}
#genderScreen h2 {
    width: 100%;
}

#genderScreen button {
    font-size: 1.5rem;
    min-width: 250px;
    flex: 1;
    padding: 1.5rem;
    line-height: 1.2;
}

#btnMale {
    background-color: var(--primary);
}

#btnFemale {
    background-color: var(--secondary);
}

/* Give the second name button a different color for better UX */
#name2Btn.name-btn {
    background-color: var(--accent);
}

/* Crown Animation */
@keyframes crown-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.king-btn {
    position: relative;
    animation: crown-float 1s ease-in-out infinite;
}

.king-btn::before {
    content: '👑';
    position: absolute;
    top: -20px;
    right: 95%;
    rotate: -45deg;
    transform: none;
    font-size: 2rem;
    animation: crown-bounce 1s ease-in-out infinite;
}

.battle-arena {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 2rem;
    gap: 1rem;
}

.vs {
    font-size: 2rem;
    font-weight: 500;
    color: var(--accent);
    background-color: var(--text-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.battle-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

#winnerText {
    font-size: 2.25rem; /* 36px */
    color: var(--primary);
    margin-bottom: 2rem;
    font-weight: bold;
    padding: 1rem 2rem;
    background-color: #eef6fc;
    border-radius: var(--border-radius);
}

.kings-list {
    list-style: none;
    padding: 0;
    text-align: center;
    margin-top: 2rem;
    width: 100%;
    max-width: 400px;
}

.kings-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.kings-list li:last-child {
    border-bottom: none;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 1rem;
    margin-top: auto;
    font-size: 0.9rem;
    color: #888;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .container {
        margin: 0;
        padding: 1.5rem 1rem;
        box-shadow: none;
        border-radius: 0;
        background-color: transparent;
    }

    .battle-arena {
        flex-direction: column;
    }

    .name-btn {
        width: 100%;
        font-size: 1.3rem;
        min-width: unset;
        padding: 1rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    #winnerText {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .navbar {
        flex-direction: row;
        gap: 0.5rem;
        padding: 1rem;
    }

    #genderScreen button {
        width: 100%;
    }
}