/* 
 * Math Pet Adventures - Game Styles
 * Core Gameplay UI and Layout
 */

/* Main Content Wrapper */
#game-app {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 500px;
    /* Mobile focused max-width */
    height: 100%;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-x: hidden;
    overflow-y: hidden;
    box-sizing: border-box;
    /* Hide scrollbar on all browsers */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

#game-app::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Opera */
}

/* Ensure screens fill available height */
#game-app>.screen {
    min-height: 100%;
}

@media (max-width: 767px) {
    #game-app {
        height: auto;
        min-height: 100vh;
        max-height: none;
        padding: 5px;
        overflow-y: auto;
        overflow-x: hidden;
        /* Hide scrollbar but allow scrolling */
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE and Edge */
    }

    #game-app::-webkit-scrollbar {
        display: none;
        /* Chrome, Safari, Opera */
    }
}

@media (min-width: 768px) {
    #game-app {
        height: auto;
        max-height: 90vh;
        /* Floating card on desktop */
        border: 1px solid var(--glass-border);
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        border-radius: var(--radius-lg);
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
        overflow-y: auto;
        overflow-x: hidden;
        /* Hide scrollbar */
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE and Edge */
    }

    #game-app::-webkit-scrollbar {
        display: none;
        /* Chrome, Safari, Opera */
    }

    #login-screen {
        overflow-y: auto !important;
        max-height: 100%;
        padding-bottom: 2rem;
    }
}

/* Screens */
.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    transition: opacity 0.3s ease;
    overflow-x: hidden;
    overflow-y: hidden;
    box-sizing: border-box;
    /* Hide scrollbar on all browsers */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.screen::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Opera */
}

/* Login screen - no scrolling on any device */
#login-screen {
    overflow-y: hidden !important;
    overflow-x: hidden !important;
}

@media (max-width: 767px) {
    .screen {
        min-height: 100vh;
        justify-content: flex-start;
        padding-bottom: 1rem;
        padding-top: 3rem;
        /* Space for language toggle */
        overflow-y: auto;
        overflow-x: hidden;
        /* Hide scrollbar but allow scrolling */
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE and Edge */
    }

    .screen::-webkit-scrollbar {
        display: none;
        /* Chrome, Safari, Opera */
    }

    .screen.active-screen {
        padding-top: 3rem;
        /* Extra space for language toggle on start screen */
    }

    /* Login screen - no scrolling */
    #login-screen {
        overflow-y: auto !important;
        padding-bottom: 2rem;
    }

    /* Standardizing all screens for mobile app-feel */
    #game-screen,
    #home-screen,
    #shop-screen,
    #leaderboard-screen,
    #player-profile-screen,
    #exam-screen,
    #exam-selection-screen,
    #exam-results-screen {
        height: 100vh;
        /* Lock height to viewport */
        overflow: hidden;
        /* Prevent body scroll */
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    /* Scrollable Content Areas */
    .prize-cabinet,
    .shop-grid,
    .leaderboard-list,
    .settings-container,
    .pet-stage,
    .scroll-content {
        flex: 1;
        /* Take remaining space */
        overflow-y: auto;
        /* Internal scroll */
        min-height: 0;
        /* Flexbox fix */
        width: 100%;
        margin-bottom: 0.5rem;
        /* Custom scrollbar handling if needed, but keeping it simple for now */
    }

    /* Exception for game screen components that shouldn't scroll excessively */
    #game-screen .pet-stage,
    #exam-screen .pet-stage {
        flex: 0 0 auto;
        overflow: visible;
    }

    #game-screen .question-area,
    #exam-screen .question-area {
        flex: 0 0 auto;
    }

    #game-screen .answers-grid,
    #exam-screen .answers-grid {
        flex: 1;
        /* Allow grid to take space */
        overflow-y: auto;
        min-height: 0;
        margin-bottom: 2rem;
        /* Increased margin significantly */
        padding-bottom: 1rem;
        /* Padding for scroll content */
    }

    /* Ensure screens fill available height on mobile */
    #game-app>.screen {
        min-height: 100vh;
    }
}

.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

/* Typography & Titles */
.hero-content {
    text-align: center;
    /* padding-right removed to center properly */
}

.game-title {
    font-size: 2.5rem;
    line-height: 1.2;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, #fff 0%, #a5a5ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.3rem;
    filter: drop-shadow(0 4px 10px rgba(100, 100, 255, 0.3));
    display: block;
    white-space: pre-line;
}

.subtitle {
    text-align: center;
    color: var(--text-dim);
    font-size: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 767px) {
    .hero-content {
        padding-right: 3.5rem;
        /* Less space on mobile */
    }

    .game-title {
        font-size: 2rem;
        margin-bottom: 0.2rem;
    }

    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 0.8rem;
    }
}

/* Player Input */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
}

.player-input-container {
    width: 100%;
    max-width: 240px;
    margin-bottom: 0.8rem;
}

.error-message {
    color: var(--error-color);
    font-size: 0.9rem;
    margin: 0.5rem 0;
    text-align: center;
    min-height: 1.5rem;
}

.error-message.hidden {
    display: none;
}

@media (max-width: 767px) {
    .player-input-container {
        margin-bottom: 0.6rem;
        max-width: 100%;
    }
}

.glass-input {
    width: 100%;
    padding: 0.7rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    font-family: inherit;
    text-align: center;
    outline: none;
    transition: all 0.2s;
}

@media (max-width: 767px) {
    .glass-input {
        padding: 0.6rem;
        font-size: 0.9rem;
    }
}

.glass-input:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.15);
}

.glass-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.password-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-md);
    cursor: pointer;
    min-width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.password-toggle:hover {
    color: white;
    transform: scale(1.1);
}

/* Compact Registration Mode */
/* Title should stay visible per user request
#login-screen.registration-mode .hero-content {
    display: none;
}
*/

#login-screen.registration-mode .login-container {
    padding-top: 1rem;
}

@media (max-width: 767px) {
    #login-screen.registration-mode .pet-choice-disclaimer {
        display: none;
    }

    #login-screen.registration-mode .pet-selection-container h2 {
        display: none;
    }

    #login-screen.registration-mode .pet-cards {
        padding-bottom: 1rem;
    }
}

/* Pet Selection */
.pet-selection-container {
    width: 100%;
    margin-bottom: 1rem;
}

.pet-selection-container h2 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
    text-align: center;
}

.pet-choice-disclaimer {
    font-size: 0.8rem;
    color: var(--text-light);
    opacity: 0.9;
    text-align: center;
    margin: 0 auto 1.2rem auto;
    line-height: 1.4;
    max-width: 450px;
}

@media (max-width: 767px) {
    .pet-selection-container {
        margin-bottom: 0.8rem;
    }

    .pet-selection-container h2 {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
}

/* Current Pet Display */
.current-pet-display-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1.5rem 0;
    min-height: 180px;
}

.current-pet-display {
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (max-width: 767px) {
    .current-pet-display-container {
        margin: 1rem 0;
        min-height: 150px;
    }
}

/* Bigger pet in current-pet-display on larger screens */
@media (min-width: 1024px) {
    #current-pet-display .pet-placeholder-img,
    #start-screen #current-pet-display .pet-placeholder-img {
        max-width: 180px !important;
    }
}

.pet-cards {
    display: flex;
    gap: 0.75rem;
    overflow-x: visible;
    width: 100%;
    padding-bottom: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.pet-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    min-width: 80px;
    max-width: 90px;
    flex: 0 0 auto;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    /* Light bg for pet blend mode */
    background: rgba(255, 255, 255, 0.05);
    /* Restore simple glass bg */
}

.pet-card.selected {
    background: rgba(100, 100, 255, 0.2);
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.pet-card div {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
}

.pet-card-emoji {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

/* Pet Animations */
@keyframes pet-float {

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

    50% {
        transform: translateY(-1px);
        /* Reduced from -3px */
    }
}

@keyframes pet-wiggle {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-1.5deg);
        /* Reduced from -2deg */
    }

    75% {
        transform: rotate(1.5deg);
        /* Reduced from 2deg */
    }
}

@keyframes pet-breathe {

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

    50% {
        transform: scale(1.03);
        /* Reduced from 1.05 */
    }
}

@keyframes pet-complex {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(0, -1px) rotate(1deg);
    }

    /* Up & Right tilt */
    50% {
        transform: translate(1px, 0) scale(1.02);
    }

    /* Right & Breathe */
    75% {
        transform: translate(-1px, 0) rotate(-1deg);
    }

    /* Left & Left tilt */
    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}

.pet-card img {
    transition: transform 0.3s ease;
    will-change: transform;
    /* Performance optimization */
    border-radius: 2px;
    /* Requested border radius 2px */
}

/* Apply different animations to pets based on position */
/* Slower durations: 3s->4s, 4s->5s, 3.5s->4.5s */
/* Hammy (1st) and Dino (4th) get breathing only (no vertical move) to prevent layout issues */
.pet-card:nth-child(1) img,
.pet-card:nth-child(4) img {
    animation: pet-breathe 4.5s ease-in-out infinite;
}

/* Others get regular rotation/float/complex combo */
.pet-card:nth-child(3n+1):not(:nth-child(1)):not(:nth-child(4)) img {
    animation: pet-complex 5s ease-in-out infinite;
}

.pet-card:nth-child(3n+2) img {
    animation: pet-complex 6s ease-in-out infinite;
}

.pet-card:nth-child(3n+3) img {
    animation: pet-complex 5.5s ease-in-out infinite;
}

/* Pause animation and scale up on hover */
.pet-card:hover img {
    animation: none;
    transform: scale(1.15) translateY(-2px);
}

/* Ensure animations run on mobile */
@media (max-width: 767px) {

    /* Hammy (1st) and Dino (4th) get breathing only */
    .pet-card:nth-child(1) img,
    .pet-card:nth-child(4) img {
        animation: pet-breathe 4.5s ease-in-out infinite;
    }

    /* Others */
    .pet-card:nth-child(3n+1):not(:nth-child(1)):not(:nth-child(4)) img {
        animation: pet-complex 5s ease-in-out infinite;
    }

    .pet-card:nth-child(3n+2) img {
        animation: pet-complex 6s ease-in-out infinite;
    }

    .pet-card:nth-child(3n+3) img {
        animation: pet-complex 5.5s ease-in-out infinite;
    }

    /* Adventure mode: slower floating on small screens */
    body.adventure-theme .floating-anim {
        animation: pet-float 8s ease-in-out infinite;
    }

    .shake-anim,
    .shake {
        animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both !important;
    }
}

@keyframes shake {

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

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.shake-anim,
.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both !important;
}

.floating-anim {
    animation: pet-float 4s ease-in-out infinite;
}

body.adventure-theme .floating-anim {
    animation: pet-float 8s ease-in-out infinite;
}

/* Table Selection */
.settings-container {
    width: 100%;
    margin-bottom: 1.5rem;
}

.settings-container h2 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    text-align: center;
    color: var(--text-dim);
}

@media (max-width: 767px) {
    .settings-container {
        margin-bottom: 0.2rem;
        /* Reduced from 1rem to bring start button closer */
    }

    .settings-container h2 {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }
}

.table-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.4rem;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}

@media (max-width: 767px) {
    .table-grid {
        gap: 0.3rem;
        max-width: 100%;
    }
}

.table-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.3rem;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

@media (max-width: 767px) {
    .table-toggle {
        padding: 0.35rem 0.25rem;
        font-size: 0.85rem;
    }
}

.table-toggle.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(100, 100, 255, 0.3);
    border-color: var(--primary-color);
}

.table-toggle.completed {
    background: rgba(74, 222, 128, 0.25);
    border: 2px solid var(--success-color);
    color: #4ade80;
    font-weight: 700;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.15);
}

.table-toggle.active.completed {
    background: linear-gradient(135deg, var(--primary-color), var(--success-color));
    color: white;
    border-color: var(--success-color);
}

.table-toggle.disabled {
    opacity: 0.4;
    cursor: not-allowed !important;
    pointer-events: none !important;
    filter: grayscale(0.5);
}

/* Controls Container */
.controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
    margin-bottom: 1.5rem;
    padding-top: 0.5rem;
    flex-shrink: 0;
}

.controls-row {
    width: 100%;
    max-width: 300px;
    display: flex;
    gap: 0.4rem;
    flex-direction: column;
}

@media (min-width: 768px) {
    .controls {
        margin-bottom: 2rem;
    }
}

@media (max-width: 767px) {
    .controls {
        margin-top: 0.2rem;
        margin-bottom: 0.5rem;
        padding-top: 0.2rem;
        gap: 0.3rem;
    }

    .controls-row {
        gap: 0.4rem;
    }
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #FFD700 0%, #FF8C00 100%);
    /* Gold to Orange */
    border: none;
    color: #fff;
    /* Dark text for contrast */
    font-family: inherit;
    font-weight: 800;
    font-size: 1rem;
    padding: 0.6rem 2rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 140, 0, 0.4);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 100%;
    max-width: 280px;
    margin-top: 0;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(255, 140, 0, 0.6);
    filter: brightness(1.1);
}

@media (max-width: 767px) {
    .btn-primary {
        font-size: 0.75rem;
        padding: 0.35rem 1rem;
        max-width: 100%;
    }
}

.btn-primary:active {
    transform: scale(0.95);
    box-shadow: 0 5px 10px -5px rgba(100, 100, 255, 0.4);
}

.pulse {
    animation: pulse-anim 2s infinite;
}

@keyframes pulse-anim {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

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

/* Game Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 100%;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 100;
    gap: 0.5rem;
    box-sizing: border-box;
    overflow: hidden;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.header-action {
    flex-shrink: 0;
}

/* Ensure quit button is always visible in game header */
#game-screen .game-header {
    flex-wrap: nowrap;
    min-width: 0;
}

#game-screen .game-header .btn-icon {
    flex-shrink: 0;
    font-size: 1.2rem;
    padding: 0.5rem 0.75rem;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Username display in game header - inside stats-bar */
#game-screen .game-header .stats-bar .username-display,
#home-screen .game-header .stats-bar .username-display,
#shop-screen .game-header .stats-bar .username-display,
#exam-screen .game-header .stats-bar .username-display {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    min-width: 60px;
    margin: 0 !important;
    text-align: center;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* Ensure username display works as stat-item */
#game-screen .game-header .stats-bar .username-display.stat-item,
#home-screen .game-header .stats-bar .username-display.stat-item,
#shop-screen .game-header .stats-bar .username-display.stat-item,
#exam-screen .game-header .stats-bar .username-display.stat-item {
    display: flex;
    align-items: center;
    gap: 0;
}

/* Shop screen header - same as other screens */
#shop-screen .game-header {
    margin-bottom: 0.5rem;
}

/* Shop screen layout - ensure back button is visible */
#shop-screen {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: 1rem;
    min-height: 0;
}

#shop-screen h2 {
    margin: 0.3rem 0;
    font-size: 1.1rem;
    flex-shrink: 0;
}

#shop-screen .shop-grid {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
    margin-bottom: 0.5rem;
}

#shop-screen #btn-shop-back {
    flex-shrink: 0;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 280px;
    align-self: center;
}

@media (max-width: 767px) {
    #shop-screen {
        padding-bottom: 2rem;
    }

    #shop-screen .game-header {
        margin-bottom: 0.5rem;
    }

    #shop-screen .game-header .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    #shop-screen h2 {
        margin: 0.2rem 0;
        font-size: 1rem;
    }

    #shop-screen .shop-grid {
        max-height: calc(100vh - 350px);
        margin-bottom: 1rem;
    }

    #shop-screen #btn-shop-back {
        margin-top: 1rem;
        margin-bottom: 1.5rem;
        max-width: 100%;
        position: relative;
        order: 999;
    }
}

.score-pill,
.streak-pill {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

/* Pet Display Area */
.pet-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    max-height: 38%;
    min-height: 140px;
    /* Subtle backlight that doesn't block constellations */
    background: radial-gradient(circle, rgba(200, 200, 255, 0.2) 0%, rgba(200, 200, 255, 0) 70%);
    border-radius: 50%;
    overflow: visible;
    z-index: 5;
}



@media (max-width: 767px) {
    .pet-stage {
        max-height: 32%;
        min-height: 120px;
        margin-bottom: 0.5rem;
    }

    .pet-game-size {
        max-height: min(180px, 38vmin) !important;
        margin-top: 16px;
    }
}

.pet-blend-fix {
    /* Multiply blend mode to hide white background */
    mix-blend-mode: multiply;
    /* Increase contrast to counteract the blend */
    filter: contrast(1.1) brightness(1.1);
}

.pet-game-size {
    /* Responsive: scales with viewport (vmin) while staying within bounds */
    max-height: clamp(160px, 24vmin, 260px) !important;
    width: auto;
    object-fit: contain;
    margin-top: 24px;
}

.pet-sprite {
    width: 150px;
    height: 150px;
    background-size: 400% 100%;
    background-repeat: no-repeat;
    animation: sprite-play 0.8s steps(3) infinite !important;
    /* steps(3) because 0% is frame 1, 100% is frame 4. */
}

@keyframes sprite-play {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 100% 0;
    }
}

.floating-anim {
    animation: float-idle 3s ease-in-out infinite;
}

/* Adventure mode: slower, kid-friendly pet animations (calm on all screen sizes) */
body.adventure-theme .floating-anim {
    animation: float-idle 7s ease-in-out infinite;
}

@keyframes float-idle {

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

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

/* Super happy: bouncy animation when happiness is high */
.pet-placeholder-img.super-happy {
    animation: super-happy-bounce 2s ease-in-out infinite;
}

/* Adventure mode: gentler, slower super-happy (kid-friendly, all screen sizes) */
body.adventure-theme .pet-placeholder-img.super-happy {
    animation: super-happy-bounce 6s ease-in-out infinite;
}

@keyframes super-happy-bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    20% {
        transform: translateY(-10px) scale(1.04);
    }
    40% {
        transform: translateY(-3px) scale(1.02);
    }
    60% {
        transform: translateY(-8px) scale(1.03);
    }
    80% {
        transform: translateY(-2px) scale(1.01);
    }
}

/* Subtle breathing/living animation for start screen pet (skip when border animation is active) */
#start-screen .current-pet-display img:not(.highlight-rainbow):not(.highlight-golden):not(.highlight-neon):not(.trophy-glow),
#start-screen #current-pet-display img:not(.highlight-rainbow):not(.highlight-golden):not(.highlight-neon):not(.trophy-glow) {
    animation: pet-breathe 5s ease-in-out infinite !important;
}

@keyframes pet-breathe {

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

    25% {
        transform: translateY(-2px) scale(1.01);
    }

    50% {
        transform: translateY(-4px) scale(1.015);
    }

    75% {
        transform: translateY(-2px) scale(1.01);
    }
}

/* Player Profile Screen */
#player-profile-screen {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding-bottom: 0.5rem;
}

#player-profile-screen .game-header {
    flex-shrink: 0;
}

#player-profile-screen .pet-stage {
    flex-shrink: 0;
}

#profile-prize-cabinet {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    margin-bottom: 0.5rem;
}

/* Ensure nav bar stays at bottom */
#player-profile-screen .nav-bar {
    margin-top: auto;
    flex-shrink: 0;
}

.pet-avatar {
    font-size: 8rem;
    /* Bigger pet */
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.4));
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: pet-float 6s ease-in-out infinite;
    z-index: 10;
    position: relative;
    /* Ensure it stays above canvas */
}

@keyframes pet-float {

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

    50% {
        transform: translateY(-15px) scale(1.02);
    }
}

.pet-avatar.bounce {
    animation: bounce 0.5s;
}

.pet-avatar.shake {
    animation: shake 0.5s;
}

@keyframes bounce {

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

    50% {
        transform: translateY(-30px) scale(1.1);
    }
}

@keyframes shake {

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

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}



.pet-feedback-bubble {
    background: white;
    color: var(--bg-dark);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: normal;
    max-width: 90%;
    text-align: center;
    word-wrap: break-word;
}

/* On mobile, ensure feedback is fixed and always visible */
@media (max-width: 767px) {
    .pet-feedback-bubble {
        position: fixed !important;
        top: 45% !important;
        /* Visible area */
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: auto;
        min-width: auto;
        padding: 0.5rem !important;
        z-index: 20000 !important;
        /* Above everything */
        border: 2px solid var(--primary-color);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }
}

/* Game and Exam screen feedback bubble - position below pet */
#game-screen .pet-feedback-bubble,
#exam-screen .pet-feedback-bubble {
    position: absolute;
    top: auto;
    bottom: 20px;
    /* Position below the pet */
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    min-width: auto;
}

.pet-feedback-bubble.hidden {
    display: none !important;
}

@keyframes pop-in {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Question & Answers */
.question-area {
    margin: 2rem 0;
    text-align: center;
}

.math-problem {
    font-size: 4.5rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: #fff;
    text-shadow:
        0 5px 0 #000,
        0 0 20px rgba(255, 255, 255, 0.5);
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.5));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.math-problem .factor {
    display: inline-block;
}

.math-problem .operator {
    margin: 0 0.2rem;
}

/* Base Styles (Move before media query) */
.answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    width: 100%;
}

.answer-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-family: inherit;
    font-size: 2rem;
    padding: 0.8rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.answer-btn:active {
    background: rgba(255, 255, 255, 0.2);
}


@media (max-width: 767px) {
    .question-area {
        margin: 0.5rem 0;
        /* Reduced from 2rem */
    }

    .math-problem {
        font-size: 2.5rem;
        /* Reduced from 3rem */
        gap: 0.2rem;
    }

    .answers-grid {
        gap: 0.3rem;
        margin-bottom: 1rem;
        /* Increased margin for better separation */
        padding: 0.2rem;
        padding-bottom: 0.5rem;
        /* Ensure scroll padding */
    }

    .answer-btn {
        padding: 0.2rem;
        /* Minimal padding */
        font-size: 1rem;
        /* Small, crisp text */
        border-radius: 8px;
        /* Tighter radius */
        border-width: 2px;
        min-height: 50px;
        /* Ensure touch target size but keep it compact */
        display: flex;
        align-items: center;
        justify-content: center;
    }
}



.answer-btn.correct {
    background: var(--success-color);
    border-color: var(--success-color);
    box-shadow: 0 0 20px var(--success-color);
}

.answer-btn.wrong {
    background: var(--error-color);
    border-color: var(--error-color);
    opacity: 0.7;
}

/* --- New Features Styles --- */

/* Lang Toggle */
.lang-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    z-index: 100;
}

.username-display {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--text-light);
    padding: 0.2rem 0.8rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    margin-top: 0.3rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    min-width: 100px;
    display: inline-block;
    cursor: pointer;
    transition: all 0.2s ease;
}

.username-display:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.username-display:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.lang-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    min-width: 40px;
    text-align: center;
    transition: all 0.2s;
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Info Button */
.info-btn {
    background: linear-gradient(135deg, hsl(210, 80%, 55%), hsl(210, 80%, 45%));
    border: 2px solid hsl(210, 80%, 70%);
    color: white;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    text-align: center;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    font-size: 1.2rem;
    color: white;
}

.info-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.info-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(100, 150, 255, 0.4);
}

/* Info Modal */
.info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

.info-modal.hidden {
    display: none !important;
}

.info-modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.info-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.info-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-light);
}

.info-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-light);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.info-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--error-color);
    transform: scale(1.1);
}

.info-close-btn:active {
    transform: scale(0.95);
}

.info-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    color: var(--text-light);
    line-height: 1.6;
}

/* Trophy modal specific styling */
#trophy-modal .info-modal-body {
    max-height: 80vh;
    overflow-y: auto;
}

@media (max-width: 767px) {
    #trophy-modal .info-modal-body {
        padding: 1rem;
    }

    #trophy-modal .info-modal-body>div[style*="grid"] {
        grid-template-columns: 1fr !important;
        gap: 0.8rem !important;
    }
}

.info-section {
    margin-bottom: 1.5rem;
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-section h3 {
    color: var(--accent-color);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-btn {
    background: rgba(255, 193, 7, 0.2);
    border: 2px solid rgba(255, 193, 7, 0.5);
    color: #ffc107;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.admin-btn:hover {
    background: rgba(255, 193, 7, 0.3);
    border-color: rgba(255, 193, 7, 0.8);
    transform: scale(1.05);
}

.admin-btn:active {
    transform: scale(0.95);
}

.admin-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    scrollbar-width: none;
}

.admin-tabs::-webkit-scrollbar {
    display: none;
}

.admin-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.admin-tab:hover {
    background: rgba(255, 255, 255, 0.1);
}

.admin-tab.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #000;
    font-weight: 700;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

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

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

/* Admin Modal Specific Sizing */
#admin-modal .info-modal-content {
    width: 95vw;
    max-width: 900px;
    height: 85vh;
    min-height: 500px;
}

@media (min-width: 768px) {
    #admin-modal .info-modal-content {
        width: 80vw;
    }
}

#admin-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: none !important;
}

.admin-dashboard {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#admin-tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tab-pane {
    flex: 1;
    display: none;
    flex-direction: column;
    min-height: 0;
}

.tab-pane.active {
    display: flex;
}

.admin-section {
    margin-bottom: 1rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-section.flex-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.admin-section h3 {
    color: var(--accent-color);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.admin-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-loader {
    text-align: center;
    padding: 2rem;
    font-style: italic;
    opacity: 0.6;
}

.admin-chart-container {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-description {
    font-size: 0.85rem;
    opacity: 0.75;
    margin-top: 0.25rem;
    line-height: 1.4;
}

.admin-user-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 10px;
    margin-top: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-user-card h4 {
    color: var(--accent-color);
    margin-bottom: 0.4rem;
    font-size: 1rem;
}

.admin-user-card p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.75rem;
}

.admin-user-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

/* User List Table */
.admin-table-container {
    flex: 1;
    overflow-y: auto;
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 500px;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-color);
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Pagination */
.admin-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0.5rem;
    flex-wrap: wrap;
}

.admin-pagination .page-info {
    font-size: 0.85rem;
    opacity: 0.7;
    font-weight: 600;
}

.admin-pagination .btn-secondary {
    margin: 0;
    width: auto;
    min-width: 80px;
}

.nav-btn-plus {
    background-color: #2a2a2a;
    /* Darker background for gold plus icon */
    border: 1px solid gold;
}

.admin-error {
    color: var(--error-color);
    padding: 0.75rem;
    background: rgba(255, 0, 0, 0.1);
    border-radius: 8px;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 0, 0, 0.2);
}

.admin-message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid;
    font-size: 1rem;
    font-weight: 600;
}

.admin-message-success {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.5);
    color: #4caf50;
}

.admin-message-error {
    background: rgba(244, 67, 54, 0.2);
    border-color: rgba(244, 67, 54, 0.5);
    color: #f44336;
}

.admin-message-info {
    background: rgba(33, 150, 243, 0.2);
    border-color: rgba(33, 150, 243, 0.5);
    color: #2196f3;
}

.admin-stats {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 0.75rem;
}

.admin-stats p {
    margin: 0.4rem 0;
    font-size: 0.85rem;
}

.admin-stats h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

#admin-modal-body {
    max-height: 85vh;
    overflow-y: auto;
    padding: 0.75rem;
}

#admin-modal-body::-webkit-scrollbar {
    width: 6px;
}

#admin-modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

#admin-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#admin-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.info-section p {
    margin: 0;
    color: var(--text-dim);
    white-space: pre-line;
    font-size: 0.95rem;
}

@media (max-width: 767px) {
    .lang-toggle {
        top: 0.75rem;
        right: 0.75rem;
        gap: 0.4rem;
        /* Use safe-area-inset if supported */
        top: calc(0.75rem + env(safe-area-inset-top, 0px));
        right: calc(0.75rem + env(safe-area-inset-right, 0px));
    }

    .lang-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        min-width: 36px;
    }

    .username-display {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
        min-width: 80px;
    }

    #game-screen .game-header .username-display {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
        min-width: 50px;
    }

    #game-screen .game-header .btn-icon {
        font-size: 1rem;
        padding: 0.5rem 0.75rem;
        min-width: 28px;
        min-height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .info-btn {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
        font-size: 1rem;
    }

    .info-modal {
        padding: 0.5rem;
    }

    .info-modal-content {
        max-height: 95vh;
    }

    .info-modal-header {
        padding: 1rem;
    }

    .info-modal-header h2 {
        font-size: 1.2rem;
    }

    .info-modal-body {
        padding: 1rem;
    }

    .info-section h3 {
        font-size: 1rem;
    }

    .info-section p {
        font-size: 0.85rem;
    }
}

/* Navigation Bar - Consistent across all pages */
.nav-bar {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    width: 100%;
    max-width: 460px;
    margin: 1rem auto 0 auto;
    margin-top: auto;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    justify-content: center;
    flex-wrap: nowrap;
    /* Prevent wrapping to keep on one line */
    align-items: center;
    flex-shrink: 0;
}

/* Hide back button on start screen */
#start-screen .nav-btn-back {
    display: none;
}

.nav-btn {
    flex: 1;
    min-width: 40px;
    /* Reduced min-width for icons */
    padding: 0.6rem 0.4rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 1.2rem;
    /* larger font for icons */
    transition: all 0.2s ease;
    text-align: center;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.nav-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Home button - Blue */
.nav-btn-home {
    background: linear-gradient(135deg, hsl(210, 80%, 55%), hsl(210, 80%, 45%));
}

.nav-btn-home:hover {
    background: linear-gradient(135deg, hsl(210, 80%, 60%), hsl(210, 80%, 50%));
}

.nav-btn-home.active {
    background: linear-gradient(135deg, hsl(210, 90%, 60%), hsl(210, 90%, 50%));
    box-shadow: 0 0 15px rgba(100, 150, 255, 0.6);
}

/* Shop button - Orange */
.nav-btn-shop {
    background: linear-gradient(135deg, hsl(35, 90%, 60%), hsl(35, 90%, 50%));
}

.nav-btn-shop:hover {
    background: linear-gradient(135deg, hsl(35, 90%, 65%), hsl(35, 90%, 55%));
}

.nav-btn-shop.active {
    background: linear-gradient(135deg, hsl(35, 95%, 65%), hsl(35, 95%, 55%));
    box-shadow: 0 0 15px rgba(255, 180, 50, 0.6);
}

/* Leaderboard button - Green to match Trophies/Scores usually or distinct Gold/Yellow */
.nav-btn-leaderboard {
    background: linear-gradient(135deg, hsl(150, 80%, 45%), hsl(150, 80%, 35%));
}

.nav-btn-leaderboard:hover {
    background: linear-gradient(135deg, hsl(150, 80%, 50%), hsl(150, 80%, 40%));
}

.nav-btn-leaderboard.active {
    background: linear-gradient(135deg, hsl(150, 90%, 50%), hsl(150, 90%, 40%));
    box-shadow: 0 0 15px rgba(50, 200, 100, 0.6);
}

/* Share button - Purple */
.nav-btn-share {
    background: linear-gradient(135deg, #9c27b0, #673ab7);
}

.nav-btn-share:hover {
    background: linear-gradient(135deg, #ba68c8, #7e57c2);
}

/* Logout button - Red */
.nav-btn-logout {
    background: linear-gradient(135deg, #f44336, #d32f2f);
}

.nav-btn-logout:hover {
    background: linear-gradient(135deg, #e57373, #ef5350);
}

/* Back button - Gray */
.nav-btn-back {
    background: linear-gradient(135deg, hsl(0, 0%, 45%), hsl(0, 0%, 35%));
}

.nav-btn-back:hover {
    background: linear-gradient(135deg, hsl(0, 0%, 50%), hsl(0, 0%, 40%));
}

@media (max-width: 767px) {
    .nav-bar {
        gap: 0.2rem;
        padding: 0.4rem 0.2rem;
        width: 100%;
        max-width: 100%;
        margin: 0;
        background: rgba(0, 0, 0, 0.4);
        /* Darker background for visibility */
        backdrop-filter: blur(10px);
        border-top: 1px solid var(--glass-border);
        border-radius: 20px 20px 0 0;
        /* Rounded top corners only */
        justify-content: space-around;
        position: relative;
        z-index: 1000;
        flex-shrink: 0;
        /* Never shrink */
        margin-top: auto;
        /* Push to bottom if space exists, but flex layout handles this */
    }

    .nav-btn {
        font-size: 1rem;
        /* Slightly smaller icons */
        /* Keep icons decent size */
        padding: 0.4rem 0.1rem;
        /* Minimize horizontal padding */
        min-width: 32px;
        /* Allow shrinking further */
    }

    /* Shrink badges if they exist */
    .nav-btn .badge,
    .nav-badge,
    .notification-badge {
        font-size: 0.6rem;
        padding: 0.1rem 0.2rem;
        min-width: 12px;
        height: 12px;
        line-height: 12px;
        top: 2px;
        right: 2px;
    }

    /* Start Button Optimization */
    #btn-start {
        font-size: 1rem;
        /* Reduced from 1.1rem */
        padding: 0.6rem 1.2rem;
        /* Reduced padding */
        margin-top: 0.2rem;
        width: auto;
        min-width: 140px;
        /* Reduced min-width */
        letter-spacing: 0.5px;
    }

    /* Master Mode Button Optimization */
    #btn-mode-ultimate {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
        width: auto;
        min-width: auto;
        letter-spacing: 0.5px;
        margin-top: 0.5rem;
    }
}

/* Global Nav Feedback Bubble */
.nav-feedback-bubble {
    position: fixed;
    bottom: 80px;
    /* Above nav bar */
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: var(--text-dark);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.nav-feedback-bubble.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.nav-feedback-bubble.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
    pointer-events: none;
}

/* Secondary Buttons */
.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.35rem 1rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.7rem;
    margin-top: auto;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 240px;
    text-transform: capitalize;
    align-self: center;
}

.mode-btn {
    margin-bottom: 0.5rem !important;
    max-width: 200px !important;
}

@media (max-width: 767px) {
    .btn-secondary {
        padding: 0.3rem 0.85rem;
        font-size: 0.65rem;
        margin-bottom: 1.5rem;
        max-width: 100%;
    }
}

.btn-icon {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    color: var(--text-light);
    transition: all 0.2s ease;
    z-index: 10;
    position: relative;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.btn-icon:active {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(0.95);
}

/* Home Screen */
.stats-pill {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.pet-stage.large {
    flex: 2;
}

/* Home screen specific adjustments */
#home-screen .pet-stage.large {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding-top: 0.5rem;
    flex-shrink: 1;
}

#home-screen .pet-stage.large #home-pet-display {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: auto;
}

/* Home & profile: bigger responsive pet image */
#home-screen .pet-stage.large .pet-placeholder-img,
#player-profile-screen .pet-stage.large .pet-placeholder-img {
    width: auto;
    height: auto;
    max-height: clamp(200px, 32vmin, 340px);
    max-width: min(340px, 85vw);
    display: block;
    object-fit: contain;
}

/* Slightly smaller pet on larger screens */
@media (min-width: 1024px) {
    #home-screen .pet-stage.large .pet-placeholder-img,
    #player-profile-screen .pet-stage.large .pet-placeholder-img {
        max-height: clamp(180px, 26vmin, 280px);
        max-width: min(280px, 72vw);
    }
}

#home-screen #evolution-level-display {
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem;
}

/* Animations */
@keyframes shake {

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

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.shake-anim {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes bounce {

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

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

    60% {
        transform: translateY(-10px);
    }
}

.bounce-anim {
    animation: bounce 0.5s ease;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-50px) scale(1.5);
        opacity: 0;
    }
}

/* Progress Bar */
.progress-bar-bg {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    height: 12px;
    width: 100%;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.progress-bar-fill {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease-out;
    box-shadow: 0 0 10px rgba(139, 195, 74, 0.5);
}

/* Kid-Friendly UX Improvements */

/* Enhanced Feedback Bubble */
.pet-feedback-bubble {
    font-size: 2rem !important;
    font-weight: 900 !important;
    padding: 1rem 2rem !important;
    border-radius: 50px !important;
    background: linear-gradient(135deg, #FFD700, #FFA500) !important;
    color: white !important;
    box-shadow: 0 10px 25px rgba(255, 165, 0, 0.5) !important;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1) !important;
    border: 4px solid white !important;
    transform: scale(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000 !important;
    bottom: 20% !important;
    /* Position it better */
}

.pet-feedback-bubble.happiness {
    background: linear-gradient(135deg, #4CAF50, #8BC34A) !important;
    box-shadow: 0 10px 25px rgba(76, 175, 80, 0.5) !important;
}

.pet-feedback-bubble.sadness {
    background: linear-gradient(135deg, #F44336, #FF5252) !important;
    box-shadow: 0 10px 25px rgba(244, 67, 54, 0.5) !important;
}

.pet-feedback-bubble:not(.hidden) {
    transform: scale(1);
    animation: bounce 0.5s 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: block !important;
}

/* Larger Math Problem */
.math-problem {
    font-size: 5rem;
    /* Larger base size */
    text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
}

@media (max-width: 767px) {
    .math-problem {
        font-size: 4rem;
        /* Still large on mobile */
    }
}

/* Enhanced Buttons */
.answer-btn {
    font-size: 2.5rem;
    /* Larger numbers */
    padding: 1rem;
    border-radius: 20px;
    /* Softer corners */
    border-width: 3px;
    font-weight: 900;
    box-shadow: 0 5px 0 rgba(255, 255, 255, 0.1);
    /* 3D effect */
    transition: transform 0.1s, box-shadow 0.1s;
}

.answer-btn:active {
    transform: translateY(5px);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0.1);
}

/* Simplified Stats */
.stat-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    margin: 0 0.2rem;
}

.stat-value {
    font-weight: 800;
    font-size: 1.1rem;
}

.stat-divider {
    display: none;
    /* Remove dividers for cleaner look */
}

/* Hide percentages for cleaner look on small screens if desired, but keeping for now */


.scale-up {
    font-size: 8rem;
}

.prize-cabinet {
    width: 100%;
    max-width: 300px;
    /* Reduced from 350px */
    margin: 0.5rem auto;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    /* Reduced from 0.75rem */
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* Reduced from 1rem */
}

/* Smaller prize-cabinet on small screens */
@media (max-width: 767px) {
    .prize-cabinet {
        max-width: 280px;
        /* Reduced from 320px */
        margin: 0.3rem auto;
        padding: 0.5rem;
        gap: 0.5rem;
    }
}

.cabinet-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cabinet-title {
    font-size: 0.8rem;
    /* Reduced from 0.9rem */
    font-weight: 600;
    color: var(--accent-color);
    text-align: center;
    margin-bottom: 0.2rem;
    /* Reduced from 0.5rem */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 767px) {
    .cabinet-title {
        font-size: 0.7rem;
        margin-bottom: 0.1rem;
    }
}


.tables-display,
.exams-display,
.trophies-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    min-height: 40px;
    align-items: center;
}

@media (max-width: 767px) {

    .tables-display,
    .exams-display,
    .trophies-display {
        gap: 0.3rem;
        min-height: 30px;
    }

    /* Trophies specifically closer */
    .trophies-display {
        gap: 0.15rem;
    }
}


/* Specific tighter spacing for trophies */
.trophies-display {
    gap: 0.25rem;
}


.table-badge,
.exam-badge {
    background: linear-gradient(135deg, var(--success-color), hsl(150, 80%, 35%));
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

@media (max-width: 767px) {

    .table-badge,
    .exam-badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}


.table-badge:hover,
.exam-badge:hover {
    transform: scale(1.1);
}

.trophy-badge {
    font-size: 2rem;
    cursor: pointer;
    transition: transform 0.2s;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

@media (max-width: 767px) {
    .trophy-badge {
        font-size: 1.5rem;
    }
}


.trophy-badge:hover {
    transform: scale(1.2) rotate(5deg);
}

.empty-message {
    color: var(--text-dim);
    font-size: 0.8rem;
    font-style: italic;
    text-align: center;
    padding: 0.5rem;
    opacity: 0.7;
}

/* Stats Bar - Unified design for all screens (Game, Home, Shop, Exam) */
.stats-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 0.75rem;
    padding: 0.4rem 0.75rem;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.2),
        inset 0 1px 1px rgba(255, 255, 255, 0.08);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 1;
    transition: all 0.2s ease;
}

.stats-bar::-webkit-scrollbar {
    display: none;
}

.stats-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Username inside stats-bar - same visual weight as other stats */
#game-screen .game-header .stats-bar .username-display,
#home-screen .game-header .stats-bar .username-display,
#shop-screen .game-header .stats-bar .username-display,
#exam-screen .game-header .stats-bar .username-display {
    margin: 0;
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
    min-height: auto;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-screen .game-header .stats-bar .username-display.stat-item,
#home-screen .game-header .stats-bar .username-display.stat-item,
#shop-screen .game-header .stats-bar .username-display.stat-item,
#exam-screen .game-header .stats-bar .username-display.stat-item {
    display: flex;
    align-items: center;
    gap: 0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.4rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.8rem;
    font-weight: 600;
    min-height: 26px;
    white-space: nowrap;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.stat-item .icon {
    font-size: 0.95rem;
}

.stat-item .stat-label {
    display: none;
}

.stat-item .stat-value {
    font-weight: 600;
    font-size: 0.85rem;
}

.stat-divider {
    width: 1px;
    height: 1rem;
    background: rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}


/* Hide stat labels on small mobile screens if needed */
/* Mobile Stats Bar Redesign */
/* Mobile override block removed as styles are now global */


/* Ensure header buttons are consistent */
.header-action {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    padding: 0;
}

#btn-profile-back {
    width: 40px;
    height: 40px;
}

/* Ensure stats bar fits in header - consistent across all screens */
#game-screen .game-header,
#home-screen .game-header,
#shop-screen .game-header,
#exam-screen .game-header {
    flex-wrap: wrap;
    min-height: auto;
    overflow: visible;
    align-items: flex-start;
}

/* Ensure stats-bar is visible and consistent */
#game-screen .game-header .stats-bar,
#home-screen .game-header .stats-bar,
#shop-screen .game-header .stats-bar,
#exam-screen .game-header .stats-bar {
    width: 100%;
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

/* Ensure header content doesn't hide stats-bar */
#home-screen .game-header .header-content {
    width: 100%;
    flex-wrap: wrap;
}

.home-controls {
    width: 100%;
    margin-top: auto;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-shrink: 0;
}

/* Ensure nav-bar is visible on home screen */
#home-screen {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    position: relative;
    /* Ensure canvas anchors here */
}

#home-screen .nav-bar {
    margin-top: auto;
    margin-bottom: 1rem;
    flex-shrink: 0;
    z-index: 10;
}

@media (max-width: 767px) {

    /* Fixed nav bar for all main screens on mobile */
    #home-screen .nav-bar,
    #player-profile-screen .nav-bar,
    #shop-screen .nav-bar,
    #leaderboard-screen .nav-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.8) !important;
        backdrop-filter: blur(15px);
        z-index: 1000;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding-bottom: env(safe-area-inset-bottom, 10px);
        margin: 0 !important;
        border-radius: 0 !important;
    }

    /* Ensure content has enough padding to clear the fixed nav */
    #home-screen,
    #player-profile-screen {
        padding-bottom: 5rem !important;
        overflow-y: auto;
        display: block;
        /* Change from flex to allow normal scrolling */
    }
}



/* Shop Screen Mobile Layout Support */
@media (max-width: 767px) {
    #shop-screen .shop-grid {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        padding-bottom: 2rem;
        /* Buffer for scrolling */
        /* Enable scrollbar */
        scrollbar-width: thin;
        -ms-overflow-style: auto;
    }

    #shop-screen .shop-grid::-webkit-scrollbar {
        display: block;
        width: 6px;
    }

    #shop-screen .shop-grid::-webkit-scrollbar-thumb {
        background-color: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
    }

    /* Ensure content doesn't get hidden behind fixed nav */
    #shop-screen .shop-grid {
        padding-bottom: 5rem !important;
    }
}


/* On small screens - layout and spacing adjustments */
@media (max-width: 767px) {

    /* Reduce spacing on small screens to fit content */
    #home-screen .pet-stage.large {
        margin-top: 0.75rem;
        margin-bottom: 0.5rem;
    }

    #home-screen .prize-cabinet {
        margin: 0.5rem auto;
    }

    #home-screen .home-controls {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }

    /* Ensure stats-bar is visible on small screens */
    #game-screen .game-header,
    #home-screen .game-header,
    #shop-screen .game-header,
    #exam-screen .game-header {
        margin-bottom: 0.5rem;
    }

    #game-screen .game-header .stats-bar,
    #home-screen .game-header .stats-bar,
    #shop-screen .game-header .stats-bar,
    #exam-screen .game-header .stats-bar {
        font-size: 0.75rem;
        padding: 0.35rem 0.5rem;
        gap: 0.4rem 0.5rem;
    }

    .stat-item {
        font-size: 0.75rem;
        padding: 0.15rem 0.3rem;
        min-height: 24px;
    }

    /* Home & profile pet: slightly smaller on mobile for balance */
    #home-screen .pet-stage.large .pet-placeholder-img,
    #player-profile-screen .pet-stage.large .pet-placeholder-img {
        max-height: clamp(160px, 36vmin, 240px);
        max-width: min(280px, 90vw);
    }

    /* Player Profile screen mobile adjustments */
    #player-profile-screen .pet-stage.large {
        margin-top: 0.75rem;
        margin-bottom: 0.5rem;
        flex-shrink: 1;
    }

    #player-profile-screen .prize-cabinet {
        margin: 0.5rem auto;
        margin-bottom: 1.5rem;
        /* Extra margin to clear nav-bar */
    }
}

.btn-logout {
    background: rgba(244, 67, 54, 0.2);
    border: 2px solid rgba(244, 67, 54, 0.5);
    color: #f44336;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(244, 67, 54, 0.3);
    border-color: rgba(244, 67, 54, 0.8);
    transform: translateY(-2px);
}

.btn-logout:active {
    transform: translateY(0);
}

.action-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-action {
    flex: 1;
    background: linear-gradient(135deg, var(--accent-color), #ff8e53);
    border: none;
    color: white;
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-md);
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 100, 50, 0.3);
}

/* Shop */
.shop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    width: 100%;
    margin-top: 1rem;
    margin-bottom: 1rem;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    padding-bottom: 0.5rem;
}

.shop-item {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    min-height: auto;
}

.shop-item:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(100, 100, 255, 0.3);
}

.shop-item:active:not(.disabled) {
    transform: scale(0.95);
}

.item-icon {
    font-size: 2rem;
    margin-bottom: 0.1rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.item-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: capitalize;
}

.item-effects {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
    margin: 0.3rem 0;
}

.effect-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.25rem 0.4rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.75rem;
    text-align: center;
}

.hunger-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.happiness-badge {
    background: linear-gradient(135deg, #f472b6, #ec4899);
    color: white;
    box-shadow: 0 2px 8px rgba(244, 114, 182, 0.4);
}

.item-status {
    font-size: 0.75rem;
    color: var(--error-color);
    font-weight: 600;
    padding: 0.2rem 0.4rem;
    background: rgba(239, 68, 68, 0.2);
    border-radius: 8px;
}

.shop-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.3);
}

.shop-item.disabled .item-icon {
    filter: grayscale(0.5);
}

.shop-item.disabled:hover {
    transform: none;
    border-color: var(--glass-border);
    box-shadow: none;
}

.item-price {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 215, 0, 0.1));
    border: 1px solid rgba(255, 215, 0, 0.5);
    padding: 0.2rem 0.4rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffd700;
    margin-top: 0.2rem;
    min-width: 60px;
}

/* Stat change animation */
.stat-change-indicator {
    font-size: 1.5rem !important;
    text-shadow: 0 2px 8px rgba(74, 222, 128, 0.6);
    animation: statBounce 1s ease-out forwards;
}

@keyframes statBounce {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    50% {
        transform: translateY(-15px) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translateY(-30px) scale(0.8);
        opacity: 0;
    }
}

@media (max-width: 767px) {
    .prize-cabinet {
        padding: 0.8rem;
        gap: 1rem;
        margin: 0.8rem auto;
    }

    .cabinet-title {
        font-size: 0.8rem;
    }

    .table-badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    .trophy-badge {
        font-size: 1.5rem;
    }

    .shop-grid {
        gap: 0.5rem;
        max-width: 100%;
        margin-bottom: 1rem;
        max-height: calc(100vh - 300px);
    }

    .shop-item {
        padding: 0.5rem 0.4rem;
    }

    .item-icon {
        font-size: 1.8rem;
    }

    .item-name {
        font-size: 0.75rem;
    }

    .effect-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.35rem;
    }

    .item-price {
        font-size: 0.7rem;
        padding: 0.15rem 0.3rem;
        min-width: 55px;
    }

    #shop-screen #btn-shop-back {
        margin-top: 1rem;
        margin-bottom: 1.5rem;
        max-width: 100%;
        position: relative;
        order: 999;
        padding: 0.5rem 1rem;
    }

    #btn-exam-selection-back {
        margin-top: 1rem;
        margin-bottom: 2rem;
        max-width: 100%;
        order: 999;
    }
}

/* Explore */
#explore-canvas-container {
    width: 100%;
    height: 70%;
    background: #2d3b2a;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    margin: 1rem 0;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

#explore-player {
    position: absolute;
    font-size: 2rem;
    transition: all 0.1s linear;
}

.explore-object {
    position: absolute;
    font-size: 1.5rem;
    animation: float 2s infinite ease-in-out;
}

@keyframes float {

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

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



/* Leaderboard */
/* Leaderboard screen layout - ensure buttons are at bottom */
#leaderboard-screen {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: 1rem;
    min-height: 0;
}

#leaderboard-screen h2 {
    margin: 0.3rem 0;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.leaderboard-list {
    width: 100%;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    /* Show ~10 rows (#1–10) then scrollbar for the rest */
    max-height: 32.5rem;
}

.score-row {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    transition: background 0.2s, transform 0.2s;
    min-width: 0;
    overflow: hidden;
}

.score-row:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.score-row.top-3 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), rgba(255, 255, 255, 0.05));
    border-color: rgba(255, 215, 0, 0.3);
}

.score-rank {
    width: 30px;
    color: var(--text-dim);
}

.score-name {
    flex: 1;
    text-align: left;
    padding-left: 1rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
}

.score-val {
    color: var(--accent-color);
    font-size: 1.1rem;
}

.score-view {
    margin-left: 0.8rem;
    color: #ffffff !important;
    opacity: 1;
    font-size: 1.3rem;
    transition: opacity 0.2s, transform 0.2s, color 0.2s;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    line-height: 1;
    font-weight: bold;
}

.score-row:hover .score-view {
    opacity: 1;
    color: var(--primary-color) !important;
    transform: scale(1.15);
}

/* Leaderboard Pagination */
.leaderboard-pagination {
    width: 100%;
    margin: 1rem 0;
    padding: 0 1rem;
    flex-shrink: 0;
}

.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    border: 1px solid var(--glass-border);
}

.pagination-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(100, 100, 255, 0.3);
    min-width: 100px;
}

.pagination-btn:hover:not(.disabled) {
    background: linear-gradient(135deg, hsl(var(--primary-hue), 85%, 65%), hsl(var(--primary-hue), 85%, 50%));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(100, 100, 255, 0.5);
}

.pagination-btn:active:not(.disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(100, 100, 255, 0.3);
}

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.5);
}

.pagination-info {
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    flex: 1;
}

.pagination-count {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.2rem;
    font-weight: 400;
}

@media (max-width: 767px) {
    .leaderboard-pagination {
        margin: 0.8rem 0;
        padding: 0 0.5rem;
    }

    .pagination-controls {
        padding: 0.6rem 0.8rem;
        gap: 0.8rem;
    }

    .pagination-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
        min-width: 80px;
    }

    .pagination-info {
        font-size: 0.8rem;
        width: 100%;
        order: -1;
    }

    .pagination-count {
        font-size: 0.7rem;
    }
}

@media (max-width: 767px) {
    #leaderboard-screen {
        padding-bottom: 2rem;
    }

    #leaderboard-screen h2 {
        margin: 0.2rem 0;
        font-size: 1rem;
    }

    .leaderboard-list {
        /* Show ~10 rows then scrollbar on mobile too */
        max-height: 32.5rem;
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        margin-bottom: 0.5rem;
        scrollbar-width: thin;
        -ms-overflow-style: auto;
    }

    .leaderboard-list::-webkit-scrollbar {
        display: block;
        width: 6px;
    }

    .leaderboard-list::-webkit-scrollbar-thumb {
        background-color: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
    }

    /* Ensure list doesn't get hidden behind fixed nav */
    #leaderboard-screen .leaderboard-list {
        padding-bottom: 5rem !important;
        margin-bottom: 0;
        /* Remove margin as padding handles spacing */
    }


    .score-name {
        font-size: 0.8rem;
    }

    .score-view {
        color: #ffffff !important;
        opacity: 1;
    }

    #home-screen #btn-share-profile {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
        max-width: 100%;
        padding: 0.5rem 1rem;
    }
}

/* Ultimate Mode Styles */
.world-selector-container {
    display: flex;
    flex-direction: row;
    gap: 0.3rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
}

.world-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
    transition: all 0.3s ease;
    cursor: pointer !important;
    pointer-events: auto !important;
    user-select: none;
    position: relative;
    z-index: 10;
    border-radius: 50px;
    color: white;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    width: auto;
}

.world-btn:hover {
    background: rgba(100, 100, 255, 0.3);
    border-color: rgba(100, 100, 255, 0.7);
    transform: scale(1.02);
}

.world-btn:active {
    transform: scale(0.98);
}

.world-btn.active {
    background: linear-gradient(135deg, #4d79ff, #2b3bc0);
    border-color: #ccccff;
    box-shadow: 0 0 15px rgba(77, 121, 255, 0.6), 0 0 30px rgba(77, 121, 255, 0.3);
    transform: scale(1.02);
    color: #ffffff;
    font-weight: 700;
}

.mode-toggle-container {
    margin-top: 0.5rem;
    text-align: center;
}

/* Share button styling for home screen */
#home-screen #btn-share-profile {
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 280px;
    align-self: center;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 767px) {
    .world-selector-container {
        gap: 0.25rem;
        margin-bottom: 0.4rem;
    }

    .world-btn {
        font-size: 0.55rem;
        padding: 0.15rem 0.35rem;
    }

    .mode-toggle-container {
        margin-top: 0.4rem;
    }

}

.mode-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    font-size: 0.75rem;
    padding: 0.35rem 0.85rem;
    transition: all 0.3s ease;
    cursor: pointer !important;
    pointer-events: auto !important;
    user-select: none;
    position: relative;
    z-index: 10;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.mode-btn:hover {
    background: rgba(100, 100, 255, 0.3);
    border-color: rgba(100, 100, 255, 0.7);
    transform: scale(1.02);
}

.mode-btn:active {
    transform: scale(0.98);
}

.mode-btn.active {
    background: linear-gradient(135deg, #ff4d4d, #c0392b);
    border-color: #ffcccc;
    box-shadow: 0 0 20px rgba(255, 77, 77, 0.6), 0 0 40px rgba(255, 77, 77, 0.3);
    transform: scale(1.05);
    color: #ffffff;
    font-weight: 800;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 77, 77, 0.6), 0 0 40px rgba(255, 77, 77, 0.3);
    }

    50% {
        box-shadow: 0 0 30px rgba(255, 77, 77, 0.8), 0 0 60px rgba(255, 77, 77, 0.5);
    }
}

body.ultimate-theme .bg-orb {
    filter: hue-rotate(150deg) saturate(200%);
    /* Turn orbs reddish/purple */
}

body.ultimate-theme {
    background-color: #1a0505;
    /* Darker reddish tint */
}

body.teaching-theme .bg-orb {
    filter: hue-rotate(280deg) saturate(150%) blur(80px);
    /* Turn orbs towards teal/cyan */
    opacity: 0.6;
}

body.teaching-theme {
    background-color: #0d1117;
    /* Deep academic blue */
    background-image: radial-gradient(circle at 50% 50%, rgba(13, 17, 23, 0) 0%, rgba(13, 17, 23, 0.5) 100%),
        radial-gradient(circle at 10% 20%, rgba(56, 139, 253, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(56, 139, 253, 0.1) 0%, transparent 50%);
}

/* Default white border for pet images (applies to both normal and ultimate mode) */
.pet-placeholder-img {
    border: 3px solid white !important;
    border-radius: 20px;
}

/* Normal mode - override special effects (unless highlight or super-happy is active) */
body:not(.ultimate-theme) .pet-placeholder-img:not(.highlight-rainbow):not(.highlight-golden):not(.highlight-neon):not(.trophy-glow):not(.super-happy) {
    box-shadow: none !important;
    animation: none !important;
    padding: 0 !important;
    background: none !important;
}



/* Ultimate mode - keep white border but allow special effects */
body.ultimate-theme .pet-placeholder-img:not(.highlight-rainbow):not(.highlight-golden):not(.highlight-neon):not(.trophy-glow) {
    border: 3px solid white !important;
    border-radius: 20px;
}




/* Pet Side Items (Ultimate Rewards) */
.pet-side-items {
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 1.5rem;
    max-height: 200px;
    flex-wrap: wrap-reverse;
    width: 40px;
    pointer-events: none;
    z-index: 5;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    animation: floatItems 3s ease-in-out infinite;
}

@keyframes floatItems {

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

    50% {
        transform: translateY(-55%);
    }
}

.footer-credit {
    margin-top: 1.5rem;
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'Outfit', sans-serif;
    padding-bottom: 1rem;
    padding-top: 0.5rem;
}

/* In normal mode, adjust footer credit higher */
body:not(.ultimate-theme) .footer-credit {
    margin-top: 2.5rem;
}

@media (max-width: 767px) {
    .footer-credit {
        margin-top: 0.3rem;
        margin-bottom: 0.5rem;
        font-size: 0.65rem;
        padding: 0.3rem 0.5rem;
        padding-bottom: 1rem;
    }

    /* In normal mode on mobile, adjust footer credit higher */
    body:not(.ultimate-theme) .footer-credit {
        margin-top: 1rem;
    }
}

.tip-container {
    text-align: center;
    margin-bottom: 1rem;
    width: 100%;
    position: relative;
    min-height: 60px;
}

.tips-carousel {
    position: relative;
    width: 100%;
    min-height: 50px;
    overflow: hidden;
}

.tip-slide {
    position: absolute;
    width: 100%;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
    color: var(--accent-color);
    font-size: 0.9rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    padding: 0.5rem 1rem;
}

.tip-slide.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dim);
    opacity: 0.4;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.carousel-indicator.active {
    opacity: 1;
    background: var(--accent-color);
    transform: scale(1.2);
}

.carousel-indicator:hover {
    opacity: 0.7;
}

@media (max-width: 767px) {
    .tip-container {
        margin-bottom: 0.8rem;
        min-height: 50px;
    }

    .tip-slide {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .carousel-indicator {
        width: 6px;
        height: 6px;
    }
}

/* Ultimate Evolution Aura */
.ultimate-aura {
    filter: drop-shadow(0 0 10px gold) drop-shadow(0 0 20px orange) !important;
    animation: aura-pulse 2s infinite alternate !important;
}

@keyframes aura-pulse {
    0% {
        filter: drop-shadow(0 0 10px gold) drop-shadow(0 0 20px orange);
    }

    100% {
        filter: drop-shadow(0 0 20px gold) drop-shadow(0 0 40px orangered);
    }
}

/* Golden Border Glow for Trophies - outer border only, on image edge */
.pet-placeholder-img.trophy-glow {
    position: relative;
    border-radius: 20px;
    border: none !important;
    box-shadow:
        0 0 0 3px gold,
        0 0 10px rgba(255, 215, 0, 0.9),
        0 0 20px rgba(255, 215, 0, 0.7),
        0 0 30px rgba(255, 215, 0, 0.5);
    animation: trophy-glow-pulse 2s ease-in-out infinite;
}

@keyframes trophy-glow-pulse {

    0%,
    100% {
        box-shadow:
            0 0 0 3px gold,
            0 0 10px rgba(255, 215, 0, 0.9),
            0 0 20px rgba(255, 215, 0, 0.7),
            0 0 30px rgba(255, 215, 0, 0.5);
    }

    50% {
        box-shadow:
            0 0 0 4px #ffd700,
            0 0 14px rgba(255, 215, 0, 1),
            0 0 28px rgba(255, 215, 0, 0.9),
            0 0 42px rgba(255, 215, 0, 0.7);
    }
}

/* Highlight Border Effects - Shop Purchases (border on image edge, not inside) */
.pet-placeholder-img.highlight-rainbow {
    position: relative;
    border-radius: 20px;
    border: none !important;
    padding: 4px;
    box-sizing: border-box;
    background: linear-gradient(45deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
    background-origin: border-box;
    background-clip: padding-box;
    background-size: 400% 400%;
    animation: rainbow-border 3s ease infinite;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

@keyframes rainbow-border {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.pet-placeholder-img.highlight-golden {
    position: relative;
    border-radius: 20px;
    border: none !important;
    box-shadow:
        0 0 0 3px #ffd700,
        0 0 12px rgba(255, 215, 0, 0.9),
        0 0 24px rgba(255, 215, 0, 0.7),
        0 0 36px rgba(255, 215, 0, 0.5);
    animation: golden-border-pulse 2s ease-in-out infinite;
}

@keyframes golden-border-pulse {

    0%,
    100% {
        box-shadow:
            0 0 0 3px #ffd700,
            0 0 12px rgba(255, 215, 0, 0.9),
            0 0 24px rgba(255, 215, 0, 0.7),
            0 0 36px rgba(255, 215, 0, 0.5);
    }

    50% {
        box-shadow:
            0 0 0 4px #ffed4e,
            0 0 14px rgba(255, 215, 0, 1),
            0 0 28px rgba(255, 215, 0, 0.9),
            0 0 42px rgba(255, 215, 0, 0.7);
    }
}

.pet-placeholder-img.highlight-neon {
    position: relative;
    border-radius: 20px;
    border: none !important;
    box-shadow:
        0 0 0 3px #00ffff,
        0 0 10px #00ffff,
        0 0 20px #00ffff,
        0 0 30px #00ffff;
    animation: neon-border-flicker 1.5s ease-in-out infinite;
}

@keyframes neon-border-flicker {

    0%,
    100% {
        box-shadow:
            0 0 0 3px #00ffff,
            0 0 10px #00ffff,
            0 0 20px #00ffff,
            0 0 30px #00ffff;
    }

    25% {
        box-shadow:
            0 0 0 3px #ff00ff,
            0 0 10px #ff00ff,
            0 0 20px #ff00ff,
            0 0 30px #ff00ff;
    }

    50% {
        box-shadow:
            0 0 0 3px #ffff00,
            0 0 10px #ffff00,
            0 0 20px #ffff00,
            0 0 30px #ffff00;
    }

    75% {
        box-shadow:
            0 0 0 3px #00ff00,
            0 0 10px #00ff00,
            0 0 20px #00ff00,
            0 0 30px #00ff00;
    }
}


.pet-stage {
    position: relative;
    /* Ensure context for bubble */
}

/* Message Center - Standardized Unified UI below pet */
.message-center {
    width: 100%;
    min-height: 40px;
    max-width: 100%;
    /* Allow height to grow for multi-line messages */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    padding: 0 10px;
    z-index: 100;
    pointer-events: none;
    overflow: visible;
}

.game-message {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-color);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: messageIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    white-space: normal;
    /* Allow text wrapping */
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: center;
    max-width: 100%;
    line-height: 1.3;
    opacity: 0;
    padding: 0 5px;
}

.game-message.happiness {
    color: var(--success-color, #4caf50);
}

.game-message.sadness {
    color: var(--error-color, #f44336);
}

.game-message.neutral {
    color: var(--text-dim, #888);
}

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

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

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

    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

/* Mobile responsive message center */
@media (max-width: 768px) {
    .message-center {
        min-height: 30px;
        margin-top: 5px;
        padding: 0 8px;
    }

    .game-message {
        font-size: 1.1rem;
        line-height: 1.2;
    }
}

/* Tablet and medium screens */
@media (min-width: 769px) and (max-width: 1023px) {
    .game-message {
        font-size: 1.3rem;
    }
}

/* PLUS Account Styles */
.plus-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem;
}

.plus-features {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid var(--glass-border);
}

.plus-features h3 {
    margin-bottom: 0.8rem;
    color: var(--accent-color);
    font-size: 1.1rem;
    text-align: center;
}

.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.feature-list li {
    font-size: 0.95rem;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.plus-price-tag {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color);
    text-align: center;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    margin: 0.5rem 0;
}

.success-message {
    text-align: center;
    color: var(--success-color);
    font-weight: 800;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.email-section {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.email-section label {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-left: 0.2rem;
}

.feedback-text {
    font-size: 0.85rem;
    text-align: center;
    min-height: 1.2rem;
    margin-top: 0.2rem;
}

.feedback-text.success {
    color: var(--success-color);
}

.feedback-text.error {
    color: var(--error-color);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Nav Plus Button */
.nav-btn-plus.active {
    color: gold !important;
    transform: scale(1.1);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Fix for Modal Stacking */
/* Ensure generic info modal (used for Welcome message) appears above PLUS modal */
#info-modal {
    z-index: 2000 !important;
}

#plus-modal {
    z-index: 1000 !important;
}

/* Teaching Mode Styles */
.teaching-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    width: 100%;
}

.teaching-bubble {
    padding: 0.5rem;
    max-width: 90%;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: floating 3s ease-in-out infinite;
}

.teaching-buttons {
    display: flex;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
}

.teaching-btn {
    flex: 1;
    padding: 1.25rem;
    font-size: 1.1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.teaching-btn i {
    font-size: 2.5rem;
    /* Make icons significantly larger */
}

.teaching-btn.correct {
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.teaching-btn.wrong {
    background: linear-gradient(135deg, #f44336 0%, #c62828 100%);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.mode-btn {
    opacity: 0.7;
    transition: all 0.3s ease;
}

.mode-btn.active {
    opacity: 1;
    transform: scale(1.05);
    background: var(--primary);
    color: white;
    border-color: var(--primary-light);
    box-shadow: 0 0 15px var(--primary-light);
}

@keyframes floating {
    0% {
        transform: translateY(0px);
    }

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

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

/* Constellations Styles */
.constellations-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

#home-screen {
    position: relative;
    overflow: hidden;
}

/* --- VISUAL ENHANCEMENTS --- */

/* Enhanced Button Styles */
.btn-primary,
.answer-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary::after,
.answer-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    opacity: 0.5;
    pointer-events: none;
}

.btn-primary:hover,
.answer-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 7px 14px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    filter: brightness(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-primary:active,
.answer-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Typography Enhancements */
.math-problem {
    font-family: 'Outfit', sans-serif;
    /* Ensure bold font */
    text-shadow:
        0 4px 0 #000,
        0 8px 12px rgba(0, 0, 0, 0.5);
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.2));
}

.math-problem span {
    display: inline-block;
    transition: transform 0.2s;
}

/* Hover effect on numbers */
.math-problem span:hover {
    transform: scale(1.1);
    color: #ffd700;
}

/* Animation Refinements */
@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 10px var(--primary-color);
    }

    50% {
        box-shadow: 0 0 20px var(--accent-color);
    }
}

.btn-primary.large {
    animation: pulse-glow 3s infinite;
}

/* Specific override for Start Button as requested */
#btn-start {
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Magical Shockwave Effect */
#shockwave-container,
#exam-shockwave-container,
#grid-shockwave-container,
#exam-grid-shockwave-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: -1;
}

#grid-shockwave-container,
#exam-grid-shockwave-container {
    top: 50%;
}

.shockwave {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 4px solid var(--primary-color);
    box-shadow: 0 0 20px var(--primary-color), inset 0 0 20px var(--primary-color);
    animation: shockwave-anim 0.8s ease-out forwards;
}

@keyframes shockwave-anim {
    0% {
        width: 0;
        height: 0;
        opacity: 0.8;
        border-width: 10px;
    }

    100% {
        width: 500px;
        height: 500px;
        opacity: 0;
        border-width: 1px;
    }
}

/* --- Seasonal Themes (Admin Controlled) --- */

/* Theme Container */
#game-theme-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    /* Behind UI (UI is usually z-index 10+) */
    overflow: hidden;
}

/* Base Overrides for Math Magic BG based on Theme */
/* User Request: Keep background same as Winter (default) for all themes */
body.theme-winter .math-magic-bg,
body.theme-summer .math-magic-bg,
body.theme-spring .math-magic-bg,
body.theme-autumn .math-magic-bg {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

/* Seasonal Symbol Colors */
/* Summer: Green/Teal */
body.theme-summer .math-problem,
body.theme-summer .math-problem .operator,
body.theme-summer .math-problem .equals,
body.theme-summer .math-problem .question-mark {
    color: #4ade80;
    text-shadow: 0 0 20px rgba(74, 222, 128, 0.4);
}

body.theme-summer .answers-grid .answer-btn {
    border-color: rgba(74, 222, 128, 0.3);
    color: #86efac;
}

/* Spring: Pink/Purple */
body.theme-spring .math-problem,
body.theme-spring .math-problem .operator,
body.theme-spring .math-problem .equals,
body.theme-spring .math-problem .question-mark {
    color: #f472b6;
    text-shadow: 0 0 20px rgba(244, 114, 182, 0.4);
}

body.theme-spring .answers-grid .answer-btn {
    border-color: rgba(244, 114, 182, 0.3);
    color: #fbcfe8;
}

/* Autumn: Orange/Amber */
body.theme-autumn .math-problem,
body.theme-autumn .math-problem .operator,
body.theme-autumn .math-problem .equals,
body.theme-autumn .math-problem .question-mark {
    color: #fb923c;
    text-shadow: 0 0 20px rgba(251, 146, 60, 0.4);
}

body.theme-autumn .answers-grid .answer-btn {
    border-color: rgba(251, 146, 60, 0.3);
    color: #fdba74;
}

/* Animations */
@keyframes floatDown {
    0% {
        transform: translateY(-10vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        transform: translateY(110vh) rotate(360deg);
        opacity: 0;
    }
}

@keyframes floatUp {
    0% {
        transform: translateY(0) translateX(0) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 0.8;
    }

    90% {
        opacity: 0.8;
    }

    100% {
        transform: translateY(-120vh) translateX(20px) scale(1.2);
        opacity: 0;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

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

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

/* Diploma Button Styles */
#btn-download-diploma {
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #3d2c00;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btn-download-diploma i {
    font-size: 1.2rem;
    /* Smaller icon as requested */
}

#btn-download-diploma:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
    filter: brightness(1.1);
}

#btn-download-diploma:active {
    transform: scale(0.98) translateY(0);
}

/* Mobile Adjustments for Diploma Button & Cabinet */
@media (max-width: 768px) {
    /* No download button override needed for icon style */

    .cabinet-section {
        margin-top: 1rem !important;
        /* Tighter margins */
        padding: 0.5rem !important;
    }
}

/* Trophies - Make smaller globally as requested */
.trophy-badge {
    font-size: 1.5rem !important;
    /* Smaller than previous (was likely 2rem+) */
    width: 2.5rem !important;
    height: 2.5rem !important;
    margin: 0.1rem !important;
    /* Tighter margins */
}

/* Elements */
.snow-flake,
.forest-leaf,
.forest-flower {
    position: absolute;
    pointer-events: none;
}

.snow-flake {
    color: rgba(255, 255, 255, 0.8);
    animation: floatDown linear infinite;
}

.forest-leaf {
    animation: floatDown linear infinite;
}

.forest-flower {
    animation: floatDown linear infinite;
}

.forest-butterfly {
    position: absolute;
    pointer-events: none;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
}