:root {
    --primary: #FF5733;
    /* Tomato Red */
    --secondary: #FFC300;
    /* Sun Yellow */
    --accent: #2ECC71;
    /* Basil Green */
    --info: #3498DB;
    /* Sky Blue */
    --brown-dark: #3D2B1F;
    /* Espresso Brown */
    --brown-medium: #5D4037;
    --bg-light: #FFF9F0;
    --text-dark: #2C3E50;
    --glass: rgba(255, 255, 255, 0.9);
    --shadow-main: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 20px 50px rgba(0, 0, 0, 0.18);
}

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

body {
    font-family: 'Fredoka', 'Quicksand', sans-serif;
    /* background-color: #f8f9fa; */
    color: var(--text-dark);
    line-height: 1.4;
    font-size: 1.25rem;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    margin-top: 0 !important;
    padding-top: 0 !important;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Navbar */
/* .navbar removed */

/* .nav-brand removed */

.nav-brand img {
    height: 50px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.btn-nav {
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* .btn-nav-home removed */

.btn-nav-home:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
}

/* Home Body */
.home-body {
    background: #f8f9fa;
}

.home-body .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Ensure titles inside white boxes are always dark and readable */
.box .title {
    color: var(--brown-dark) !important;
}

.box .subtitle {
    color: var(--brown-medium) !important;
}

/* Safe Banner & Trust Sections */
.safe-banner {
    background: rgba(46, 204, 113, 0.1);
    border: 2px solid var(--accent);
    border-radius: 25px;
    padding: 1rem 2rem;
    margin: 1.5rem auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.8s ease-out;
}

.safe-banner p {
    color: #1e8449;
    /* Darker green for better contrast on light green bg */
    font-weight: 700;
    margin: 0;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 2rem 5rem 2rem;
    /* Added bottom space */
    text-align: center;
}

.hero {
    margin-bottom: 3rem;
    animation: fadeIn 1s ease-out;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.logo {
    width: 280px;
    height: auto;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.15));
    margin: 0 auto 2rem auto;
    display: block;
}

.hero .title {
    font-size: 4.5rem;
    color: var(--brown-dark);
    text-shadow: 2px 2px 0px white, 4px 4px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    letter-spacing: -2px;
    text-align: center;
}

.hero .subtitle {
    font-size: 1.5rem;
    color: var(--brown-medium);
    font-weight: 700;
    text-align: center;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.4rem 1.5rem;
    border-radius: 50px;
    max-width: 90%;
    /* Removed inline-block, flex parent handles alignment */
}

.recipe-grid {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.recipe-card {
    background: white;
    border-radius: 40px;
    padding: 2.5rem;
    width: 340px;
    text-decoration: none;
    color: var(--text-dark) !important;
    box-shadow: var(--shadow-main);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 5px solid white;
    position: relative;
    overflow: hidden;
}

.recipe-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

.recipe-card:hover {
    transform: translateY(-12px);
    box-shadow: var(--shadow-hover);
    border-color: var(--secondary);
}

.card-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    display: block;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.1));
}

.recipe-card h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Animations */
@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    80% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes starPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.8);
        color: #F1C40F;
        filter: drop-shadow(0 0 10px gold);
    }

    100% {
        transform: scale(1);
    }
}

.animate-pop {
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.animate-slide {
    animation: slideUp 0.6s ease-out forwards;
}

.animate-bounce {
    animation: bounce 3s ease-in-out infinite;
}

.star-collect {
    animation: starPulse 0.5s ease-out;
}

/* Lobby Page */
.lobby-body {
    background: #f8f9fa;
    min-height: 100vh;
}

.overlay {
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
}

/* Play Page UI */
.play-body {
    background: #f8f9fa;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.game-container {
    max-width: 1000px;
    margin: 2rem auto;
    background: white;
    border-radius: 50px;
    padding: 2rem;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.2);
    min-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    position: relative;
    width: 100%;
}

.game-canvas-area {
    flex-grow: 1;
    background: #fdfcfb;
    border-radius: 30px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: 8px solid #f0f0f0;
    transition: border-color 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-canvas-area:hover {
    border-color: #e0e0e0;
}

.game-content {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    position: relative;
}

.instruction-bubble {
    background: var(--secondary);
    padding: 1.2rem 2.5rem;
    border-radius: 30px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #5D4037;
    margin-top: -25px;
    align-self: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    z-index: 10;
    border: 4px solid white;
    animation: popIn 0.6s 0.3s backwards;
}

/* SEO Section */
.seo-section {
    max-width: 900px;
    margin: 4rem auto;
    padding: 3rem;
    background: white;
    border-radius: 40px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
    text-align: left;
    line-height: 1.8;
}

.seo-section h2 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

.seo-section p {
    margin-bottom: 1.2rem;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.seo-section ul {
    margin-bottom: 1.5rem;
    margin-left: 1.5rem;
}

.seo-section li {
    margin-bottom: 0.5rem;
}

/* .footer {
    padding: 4rem 2rem;
    background: white;
    width: 100%;
    margin-top: auto;
    text-align: center;
    border-top: 3px solid white;
    border-radius: 80px 80px 0 0;
    box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.08);
} */

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer p {
    color: var(--text-dark);
    font-weight: 700;
    font-size: 1.1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #E67E22;
}

.social-icons {
    display: flex;
    gap: 1.5rem;
    font-size: 1.5rem;
}

/* Large Kid Friendly Buttons */
.btn-large {
    display: inline-block;
    padding: 1.2rem 2.5rem;
    background: var(--primary);
    color: white;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.3rem;
    box-shadow: 0 8px 0 #C0392B;
    transition: all 0.1s;
    border: none;
}

.btn-large:active {
    transform: translateY(4px);
    box-shadow: 0 4px 0 #C0392B;
}

/* Page Transition Overlay */
#page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary);
    z-index: 9999;
    clip-path: circle(0% at 50% 50%);
    transition: clip-path 0.8s cubic-bezier(0.77, 0, 0.175, 1);
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

#page-transition.active {
    clip-path: circle(150% at 50% 50%);
}

.serving-img {
    width: 450px;
    border-radius: 30px;
    border: 15px solid white;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
    animation: popIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Success Overlay */
.success-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    border-radius: 22px;
}

.success-card {
    background: white;
    padding: 3rem;
    border-radius: 40px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border: 8px solid var(--accent);
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.performance-stars {
    font-size: 4rem;
    margin: 1.5rem 0;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.star-gold {
    color: #F1C40F;
    text-shadow: 0 0 20px rgba(241, 196, 15, 0.3);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

.star-gray {
    color: #BDC3C7;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

/* New Responsive Classes */
.main-hero-card {
    display: block;
    border: 8px solid white;
    border-radius: 60px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
    position: relative;
    background: white;
    overflow: hidden;
    width: 100%;
}

.hero-card-header {
    background: linear-gradient(135deg, #FF5733, #FFC300);
    padding: 4rem 2rem;
}

.hero-card-icon {
    font-size: 8rem;
    margin: 0;
}

.hero-card-title {
    font-family: 'Fredoka', sans-serif;
}

.hero-play-btn {
    background-color: var(--primary) !important;
    box-shadow: 0 12px 0 #d35400;
    height: 100px;
    font-size: 2.5rem !important;
    font-weight: 800;
    border: none;
}

.lobby-title {
    margin-bottom: 3rem;
    font-size: 2.8rem;
    color: #5D4037;
    font-weight: 700;
}

.lobby-card {
    border-radius: 50px;
    overflow: hidden;
    height: 100%;
    border: 6px solid white;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.lobby-card-img-wrapper {
    background: white;
    padding: 2rem;
}

.lobby-card-img {
    width: 100%;
    max-width: 200px;
    margin-bottom: 1rem;
    border-radius: 30px;
    aspect-ratio: 1;
    object-fit: contain;
}

.lobby-card-content {
    background: white;
}

.lobby-card-title {
    color: var(--brown-dark) !important;
    font-family: 'Fredoka', sans-serif;
}

.lobby-card-desc {
    color: var(--brown-medium) !important;
    font-weight: 600;
}

.lobby-play-btn {
    background-color: var(--primary) !important;
    box-shadow: 0 10px 0 #d35400;
    height: 80px;
    font-size: 1.8rem !important;
    font-weight: 800;
    border: none;
}

.jigsaw-piece {
    transition: transform 0.2s, box-shadow 0.2s;
    touch-action: none;
}

.jigsaw-piece:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.cookie-banner {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: white;
    padding: 1.5rem;
    border-radius: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 4px solid var(--accent);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    animation: slideUp 0.5s ease-out;
}

.cookie-banner .content {
    font-size: 0.95rem;
    color: var(--brown-dark);
}

.cookie-banner button {
    white-space: nowrap;
}

.loading-pizza {
    text-align: center;
    padding: 3rem;
    color: var(--brown-dark);
    font-size: 2rem;
    font-weight: 700;
    animation: fadeIn 1s infinite alternate;
}

/* --- RESPONSIVELY OVERRIDES --- */

@media (max-width: 1024px) {
    .recipe-card {
        width: 45%;
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 1.1rem;
    }

    .navbar {
        height: 60px;
        padding: 0 1rem;
    }

    .nav-brand span {
        display: none;
    }

    .nav-brand img {
        height: 35px;
    }

    .hero .title {
        font-size: 2.4rem;
    }

    .main-title {
        font-size: 3rem !important;
    }

    .hero .subtitle,
    .hero-subtitle {
        font-size: 1.2rem !important;
    }

    .recipe-card {
        width: 100% !important;
        margin-bottom: 1rem;
    }

    .game-container {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        width: 100vw;
        padding: 0.5rem;
    }

    .game-canvas-area {
        height: 60vh;
        min-height: 300px;
    }

    .game-header h1 {
        font-size: 1.3rem !important;
    }

    .btn-large {
        width: 100%;
        padding: 1.2rem;
        font-size: 1.3rem;
        height: auto !important;
    }

    /* Force Bulma columns to stack on small mobile if they don't */
    .columns.is-multiline {
        display: block !important;
    }

    .column.is-4,
    .column.is-6 {
        width: 100% !important;
        padding: 0.75rem 0.5rem !important;
    }

    .hero-card-header {
        padding: 2rem 1rem;
    }

    .hero-card-icon {
        font-size: 5rem;
    }

    .hero-play-btn {
        height: 70px;
        font-size: 1.5rem !important;
        box-shadow: 0 8px 0 #d35400;
    }

    .lobby-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    .lobby-play-btn {
        height: 60px;
        font-size: 1.3rem !important;
    }

    .footer {
        padding: 3rem 1.5rem;
        border-radius: 40px 40px 0 0;
    }

    .footer-links {
        gap: 1rem;
    }

    .footer-links a {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .nav-links {
        gap: 0.5rem;
    }

    .btn-nav {
        padding: 0.5rem 0.8rem !important;
        font-size: 0.85rem !important;
    }

    .cookie-banner {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
        bottom: 1rem;
        gap: 1rem;
    }

    .cookie-banner .content {
        font-size: 0.85rem;
    }

    .cookie-banner button {
        width: 100%;
    }
}

/* Mobile Landscape Optimization */
@media screen and (orientation: landscape) and (max-height: 600px) {

    /* Force single column layout */
    .columns.is-multiline {
        display: block !important;
    }

    .column.is-4 {
        width: 100% !important;
        padding: 0.5rem 0 !important;
    }

    /* Horizontal Card Layout for Landscape */
    .recipe-card {
        display: flex !important;
        flex-direction: row !important;
        width: 100% !important;
        max-width: 900px;
        margin: 0 auto 1rem auto;
        padding: 0 !important;
        align-items: center;
        height: auto !important;
    }

    .lobby-card-img-wrapper {
        width: 35%;
        min-width: 150px;
        max-width: 220px;
        padding: 1rem;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-bottom: 0;
    }

    .lobby-card-img {
        max-width: 100%;
        width: auto;
        max-height: 140px;
        margin-bottom: 0;
    }

    .lobby-card-content {
        padding: 1rem 1.5rem !important;
        text-align: left;
        flex: 1;
    }

    .lobby-card-title {
        font-size: 1.4rem !important;
        margin-bottom: 0.5rem !important;
    }

    .lobby-card-desc {
        font-size: 0.95rem !important;
        margin-bottom: 0.8rem !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .lobby-play-btn {
        width: 100% !important;
        height: 45px;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 1.1rem !important;
        margin-top: 0.5rem;
    }

    .hero {
        margin-bottom: 1.5rem;
    }

    .hero .title {
        font-size: 2rem;
    }

    .hero .subtitle {
        font-size: 1rem;
    }
}

/* Install App Prompt */
.install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    z-index: 10000;
    border-top: 4px solid var(--primary);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 1rem;
    display: flex;
    justify-content: center;
}

.install-prompt.show {
    transform: translateY(0);
}

.install-content {
    max-width: 600px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.install-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
}

.install-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.install-text strong {
    color: var(--brown-dark);
    font-size: 1.1rem;
}

.install-text span {
    color: var(--brown-medium);
    font-size: 0.9rem;
}

.install-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1rem;
    box-shadow: 0 4px 0 #c0392b;
    cursor: pointer;
}

.install-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #c0392b;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #95a5a6;
    cursor: pointer;
    padding: 0 0.5rem;
}