/* ✅ Kiosk Mode - Hide Progress Indicators & PWA Optimization */

/* CSS Variables for Fredoka Font System */
:root {
    --font-primary: "Fredoka", sans-serif;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-variation-width: 100;
}

html {
  margin: 0;
  padding: 0;
  overscroll-behavior: none;  /* Prevent overscroll bounce */
  -webkit-user-select: none;
  user-select: none;
}

* { 
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
}

/* Hide browser progress bar */
::-webkit-progress-bar {
  display: none !important;
}

::-webkit-progress-value {
  display: none !important;
}

/* Hide native loading indicator */
::before {
  content: none !important;
}

body::before {
  content: none !important;
}

body {
    font-family: var(--font-primary);
    font-optical-sizing: auto;
    font-weight: var(--font-weight-regular);
    font-style: normal;
    font-variation-settings: "wdth" var(--font-variation-width);
    margin: 0;
    background-color: #065461;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Sticky Home Button */
#sticky-home-container {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1000;
    pointer-events: none;
}

.sticky-home-button {
    font-family: var(--font-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsla(10, 78%, 47%, 0.101);
    border: none;
    border-radius: 20px;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

#home-button-text {
    display: none;
}

/* Target Resolution Optimizations */
@media (min-width: 1385px) and (max-width: 1385px) and (min-height: 865px) and (max-height: 865px) {
    .sticky-home-button {
        width: 120px !important;
        height: 80px !important;
    }
    
    .analyzer-btn-row {
        bottom: 40px !important;
    }
    
    .analyzer-btn {
        padding: 18px 36px !important;
        font-size: 1.3em !important;
    }
}

@media (min-width: 1920px) and (max-width: 1920px) and (min-height: 1200px) and (max-height: 1200px) {
    .sticky-home-button {
        width: 120px !important;
        height: 80px !important;
    }
    
    .analyzer-btn-row {
        bottom: 40px !important;
    }
    
    .analyzer-btn {
        padding: 18px 36px !important;
        font-size: 1.3em !important;
    }
}

@media (min-width: 1386px) and (max-width: 1520px) and (min-height: 750px) and (max-height: 800px) {
    .sticky-home-button {
        width: 120px !important;
        height: 80px !important;
    }
    
    .analyzer-btn-row {
        bottom: 40px !important;
    }
    
    .analyzer-btn {
        padding: 18px 36px !important;
        font-size: 1.3em !important;
    }
}

/* Lenovo Tablet 1463x915 (Pilot Group) */
@media (min-width: 1400px) and (max-width: 1500px) and (min-height: 880px) and (max-height: 950px) {
    .sticky-home-button,
    .sticky-profile-button {
        width: 100px !important;
        height: 100px !important;
    }
    
    .button-icon {
        width: 60px !important;
        height: 60px !important;
    }
    
    .analyzer-btn-row {
        bottom: 45px !important;
    }
    
    .analyzer-btn {
        padding: 20px 40px !important;
        font-size: 1.4em !important;
    }
}

.button-icon {
    width: 40px !important;
    height: 40px !important;
    object-fit: contain;
}

.sticky-home-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.sticky-home-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(181, 161, 224, 0.3);
}

/* Sticky Profile Button */
#sticky-profile-container {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1000;
    pointer-events: none;
}

.sticky-profile-button {
    font-family: var(--font-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsla(120, 60%, 50%, 0.1);
    border: none;
    border-radius: 20px;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    backdrop-filter: blur(10px);
}

.sticky-profile-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.sticky-profile-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Responsive Design for Sticky Buttons */
@media (max-width: 768px) {
    #sticky-home-container {
        top: 15px;
        right: 15px;
    }
    
    .sticky-home-button {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    #sticky-profile-container {
        top: 15px;
        left: 15px;
    }
    
    .sticky-profile-button {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    /* #sticky-fullscreen-container {
        bottom: 15px;
        right: 15px;
    }
    
    /* .sticky-fullscreen-button {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    #sticky-home-container {
        top: 10px;
        right: 10px;
    }
    
    .sticky-home-button {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    #sticky-profile-container {
        top: 10px;
        left: 10px;
    }
    
    .sticky-profile-button {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    /* #sticky-fullscreen-container {
        bottom: 10px;
        right: 10px;
    }
    
    /* .sticky-fullscreen-button {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
}

@media (max-width: 360px) {
    #sticky-home-container {
        top: 8px;
        right: 8px;
    }
    
    .sticky-home-button {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
    
    #sticky-profile-container {
        top: 8px;
        left: 8px;
    }
    
    .sticky-profile-button {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
    
    /* #sticky-fullscreen-container {
        bottom: 8px;
        right: 8px;
    } */
    
    /* .sticky-fullscreen-button {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    } */
}

#app-container {
    background-color: transparent;
    border-radius: 20px;
    box-sizing: border-box;
    width: 100%;
    max-width: 1200px;          /* Increased max width for better content fit */
    max-height: 95vh;           /* Increased to 95% of viewport height */
    min-height: 500px;          /* Reduced minimum height for better flexibility */
    padding: 24px 20px;         /* Reduced padding for more content space */
    margin: auto;               /* Center in flex parent */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    overflow: hidden;           /* Prevent content from overflowing */
}

#main-flex-layout {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 40px;
    width: 100%;
    max-width: 1100px;
    min-height: 450px;
    box-sizing: border-box;
}
.kai-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 280px;
    max-width: 340px;
    /* Optionally, add a background or border for visual separation */
}

.kai-gif {
    max-width: 600px;
    min-width: 250px;
    height: auto;
    display: block;
}
.game-selection-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    flex: 1;
    min-width: 600px;
}

.game-selection-column h1 {
    font-size: 2.2em;
    color: #222;
    margin-bottom: 25px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.16);
}

.home-button {
    font-family: var(--font-primary);
    background: linear-gradient(135deg, #20B2AA 0%, #48D1CC 100%);
    border: none;
    border-radius: 25px;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    margin-top: 15px;
}

.home-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #48D1CC 0%, #20B2AA 100%);
}

.home-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
@media (max-width: 900px) {
    #main-flex-layout {
        flex-direction: column;
        gap: 18px;
    }
    .kai-column,
    .game-selection-column {
        align-items: center;
        min-width: unset;
        max-width: unset;
    }
    .kai-gif {
        width: 55vw;
        min-width: 110px;
        max-width: 320px;
    }
    .game-options-grid {
        grid-template-columns: repeat(2, 1fr);   /* Back to 2 columns on smaller screens */
        max-width: 600px;
    }
    .game-option-button {
        width: 200px;         /* Equal width and height for round buttons */
        height: 200px;
        max-width: 200px;
        max-height: 200px;
    }
}

.view { /* Common styling for all views */
    width: 100%;
    box-sizing: border-box;
}

.view h1 {
    font-size: 3em; 
    margin-bottom: 30px;
    font-weight: bold;
    color: rgb(255, 255, 255); /* Titles are black on the lighter app-container */
    text-shadow: 2px 2px 6px rgba(0,0,0,0.30), 
                 0px 1px 8px rgba(0,0,0,0.12);
}

#item-selection-title { /* Specific title styling for item selection screen */
    font-size: 2.8em; 
    color: black; 
    margin-bottom: 30px;
}

.grid-container {
    gap: 20px; /* Space between grid items */
    margin-bottom: 30px;
    padding: 0 10px; /* Add some padding if grid gets too close to app-container edges */
}

/* Styling for ITEM buttons (larger images) */
.item-button {
    justify-content: space-between; 
    min-height: 220px;  
}

.item-button img {
    width: 100%;        
    max-width: 130px;   
    height: 130px;      
    object-fit: cover;  
    border-radius: 8px; 
    margin-bottom: 10px; 
}

.item-button span {
    font-weight: bold;
    font-size: 1.2em; 
    margin-top: auto;   
    text-align: center; 
    padding-bottom: 5px; 
    word-break: break-word; 
}

/* Word Game Specifics */
#word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
    position: relative;
}

.word-game-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 1100px;
}

.word-game-left-column {
    display: none; /* Hide the left column since koala is now positioned absolutely */
}

.word-game-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 140px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.word-game-koala:hover {
    transform: scale(1.05);
}

.word-game-right-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
}

#word-game-view h1#word-game-title { 
    color: #333; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 30px; 
    font-size: clamp(2em, 6vw, 3em);
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    max-width: 100%;
}

#word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
}

.word-game-image-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#word-game-item-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border: 3px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.word-game-puzzle-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    min-width: 250px;
}
#word-puzzle-container {
    background-color: white;
    color: #333;
    padding: 15px 25px; 
    border-radius: 12px; 
    display: inline-flex; 
    gap: 8px;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    margin-bottom: 8px;
}

.puzzle-letter-box {
    font-size: 2.8em; 
    font-weight: bold;
    width: 50px; 
    height: 65px; 
    line-height: 65px;
    text-align: center;
    background-color: #E9E9E9; 
    border-radius: 8px; 
    color: #333745; 
}
.puzzle-letter-input {
    font-size: 2.8em;
    width: 50px;
    height: 65px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    border: 3px dashed #FFD600;
    background: #FFF9C4;
    color: #FF8F00;
    caret-color: transparent;     /* Hides the blinking caret */
    outline: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0;
    margin: 0;
    text-align: center;
}

.puzzle-letter-input::placeholder {
    color: #FF8F00;
    opacity: 0.7;
}

.puzzle-letter-input:focus {
    outline: 2px solid #FFD600;
    border-color: #FFD600;
    background: #fffde7;
    box-shadow: 0 4px 8px rgba(255, 214, 0, 0.3);
}

/* THIS SECTION IS KEY FOR HORIZONTAL LETTER BUTTONS */
#letter-choices-container {
    display: flex;
    flex-direction: row;    /* <<< ENSURES BUTTONS ARE IN A ROW */
    justify-content: center; /* Center the row of buttons */
    align-items: center;    /* Vertically align buttons if they have different heights */
    gap: 15px;              /* Space between letter buttons */
    margin-top: 10px;       /* Space above the letter choices */
    margin-bottom: 4px;
}

#letter-choices-container button {
    font-size: 2em; 
    font-weight: bold;
    /* Padding is tricky with fixed width/height for text centering.
       Using flexbox on the button itself is better. */
    padding: 0; 
    width: 70px;     
    height: 70px;    
    border-radius: 12px; 
    border: none; 
    cursor: pointer;
    color: white;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.25);
    display: flex; /* For centering text within the button */
    align-items: center;
    justify-content: center;
    text-align: center; /* Fallback text alignment */
}
#letter-choices-container button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 10px rgba(0,0,0,0.3);
}
#letter-choices-container button:active {
    transform: translateY(0px) scale(1);
    box-shadow: 0 2px 3px rgba(0,0,0,0.2);
}

.letter-choice-yellow { background-color: #F8D15C; }
.letter-choice-blue { background-color: #6CAEE2; }
.letter-choice-green { background-color: #A1C96C; }

#word-game-feedback {
    font-size: 1.3em; 
    font-weight: bold;
    margin-top: 15px; /* Adjusted from 10px to give more space */
    padding: 10px 20px;
    border-radius: 8px;
    display: inline-block; 
    color: white; 
    text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
    min-height: 1.8em; 
    margin-bottom: 8px;
    margin-top: 6px;
}

#kai-character-sprite {
    position: absolute; 
    bottom: 30px; 
    right: 40px;  
    width: 130px; 
    height: auto;
    display: block; /* JS toggles this based on view */
    z-index: 5; 
}

/* General Buttons Styling */
button.action-button, 
#ask-kai-general-btn { 
    padding: 12px 25px;
    font-size: 1.1em;
    font-family: var(--font-primary);
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background-color: #FFCA28; 
    color: #A66300; 
    margin-top: 20px; /* Default top margin */
    margin-bottom: 10px; /* Added default bottom margin for buttons like "Ask Kai" */
    transition: background-color 0.2s, transform 0.1s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Specific placement for Ask Kai button if needed, e.g., to ensure it's at bottom of theme view */
/* #theme-selection-view #ask-kai-general-btn {
/*     margin-top: auto; /* Pushes it down if theme-selection-view is flex column */
/*     margin-bottom: 20px; /* Ensure some space at the very bottom */

/* Specific Styling for the "Ask Kai Anything" Button */
#ask-kai-general-btn {
    display: inline-flex; /* To align image and text span in a row */
    align-items: center;  /* Vertically align items in the center */
    justify-content: center; /* Center content if button is wider than content */
    padding: 10px 20px; /* Adjust padding as needed */
    font-size: 1.2em;   /* Adjust font size for "Ask Kai Anything!" */
    font-weight: bold;
    font-family: var(--font-primary);
    border-radius: 5px; 
    border: none;
    cursor: pointer;
    
    /* Gradient background like your example image */
    background-image: linear-gradient(to right, #fbc828, #ecb404); /* Example gradient, adjust colors */
    /* Fallback background color if gradient isn't supported (less common now) */
    background-color: #2a93d5; /* A mid-blue */

    color: white; /* Text color */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3); /* Optional text shadow */

    margin-top: 25px; 
    margin-bottom: 20px; 
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 3px 7px rgba(0,0,0,0.2);
}

#ask-kai-general-btn img {
    width: 36px;  /* Adjust size of the small Kai icon */
    height: 36px; /* Adjust size of the small Kai icon */
    margin-right: 10px; /* Space between Kai icon and the text */
    vertical-align: middle; /* Helps with alignment if not using flex on button */
}

#ask-kai-general-btn span {
    /* Inherits styling from parent button */
    display: inline-block;
}

#ask-kai-general-btn:hover {
    /* background-color: #FFB300; */ /* Old hover */
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 5px 10px rgba(0,0,0,0.3);
    /* You could also slightly change the gradient on hover if desired */
}
#ask-kai-general-btn:active {
    transform: translateY(0px) scale(1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
button.action-button:hover,
#ask-kai-general-btn:hover {
    background-color: #FFB300; 
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}
button.action-button:active,
#ask-kai-general-btn:active {
    transform: translateY(0px);
    box-shadow: 0 2px 3px rgba(0,0,0,0.15);
}

.back-to-themes-btn {
    background-color: #E8E8E8; 
    color: #333333;
    padding: 10px 20px;
    font-size: 1em;
    border: 1px solid #C0C0C0; 
    margin-top: 20px; /* Reduced from 30px */
    margin-bottom: 10px; /* Added to ensure space at bottom of item view */
    border-radius: 8px; 
    transition: background-color 0.2s, transform 0.1s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.back-to-themes-btn:hover {
    background-color: #D8D8D8; 
    transform: translateY(-1px);
    box-shadow: 0 3px 5px rgba(0,0,0,0.15);
}
.back-to-themes-btn:active{
    transform: translateY(0px);
}
/* Game Selection View Styling */

.game-options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);   /* Exactly 3 columns */
    grid-template-rows: repeat(2, 1fr);      /* Exactly 2 rows */
    gap: 12px 12px;                          /* Smaller gap for 6 items */
    max-width: 800px;                        /* Increased to accommodate 3 columns */
    margin-left: auto;
    margin-right: auto;
    justify-items: center;
    align-items: center;
    min-height: 320px;                       /* Reduced height for better fit */
}
#back-to-home-btn {
    position: absolute;
    left: 32px;
    bottom: 32px;
    z-index: 50;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    box-shadow: none;
    transition: transform 0.1s;
    display: none; /* Shown only when not on home screen */
}

#back-to-home-btn img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

#back-to-home-btn:hover {
    transform: scale(1.1);
}

@media (max-width: 700px) {
    #back-to-home-btn {
        left: 8px;
        bottom: 8px;
    }
    #back-to-home-btn img {
        width: 36px;
        height: 36px;
    }
}


/* Responsive for mobile */
@media (max-width: 700px) {
    #app-container {
        max-width: 98vw;
        padding: 16px 12px;
        max-height: 98vh;
    }
    
    #word-game-view,
    #match-word-game-view,
    #write-word-game-view,
    #numbers-game-view,
    #activities-game-view,
    #image-analyzer-view {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
        max-width: 100%;
        min-height: 300px;
    }
    
    .word-game-image-col,
    .word-game-puzzle-col,
    .match-word-image-col,
    .match-word-choices-col {
        min-width: unset;
    }
    
    #write-word-input-text {
        width: 250px;
        font-size: 1.1em;
    }
    
    .game-options-grid {
        grid-template-columns: 1fr;   /* Single column on very small screens */
        max-width: 400px;
    }
    .game-option-button {
        width: 180px;         /* Equal width and height for round buttons on small screens */
        height: 180px;
        max-width: 180px;
        max-height: 180px;
    }
    
    #profile-view {
        padding: 15px;
        min-height: 300px;
    }
    
    .profile-container {
        padding: 20px;
    }
}

.game-option-button {
    font-family: var(--font-primary);
    width: 200px;         /* Equal width and height for round buttons */
    height: 200px;        /* Equal height for round buttons */
    min-width: 0;         /* Prevent content from stretching the box */
    min-height: 0;
    max-width: 200px;
    max-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* ...other styles... */
    background-color: #FDF6E3;
    color: #4A4A4A;
    border-radius: 100px; /* Round corners for circular appearance */
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    padding: 12px 8px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}

.game-option-button:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 10px 15px rgba(0,0,0,0.2);
}

.game-option-button img {
    width: 80px; 
    height: 80px;
    object-fit: contain;
    margin-bottom: 15px;
}

.game-option-button span {
    font-weight: bold;
    font-size: 1.3em;
    word-break: break-word; 
}

/* Back to Games button styling (similar to back-to-themes) */
.back-to-games-btn {
    font-family: var(--font-primary);
    background-color: #E8E8E8; 
    color: #333333;
    padding: 10px 20px;
    font-size: 1em;
    font-weight: 500;
    border: 1px solid #C0C0C0; 
    margin-top: 30px;
    margin-bottom: 10px; 
    border-radius: 10px; 
    transition: background-color 0.2s, transform 0.1s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* New Game Views Styling */
#activities-game-view,
#numbers-game-view {
    padding: 20px;
    border-radius: 10px;
    box-sizing: border-box;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    min-height: 400px;
}

#activities-game-view h1,
#numbers-game-view h1 {
    color: white; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.6); 
    margin-bottom: 20px; 
    font-size: 3em; 
}

.game-content-container {
    background: rgba(255,255,255,0.96);
    border-radius: 20px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.07);
    padding: 38px 38px;
    text-align: center;
    max-width: 600px;
}

.game-content-container p {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 30px;
}

.button-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

/* Numbers Games Specific Styling */
.numbers-game-content {
    background: rgba(255,255,255,0.96);
    border-radius: 20px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.07);
    padding: 40px;
    text-align: center;
    max-width: 700px;
    width: 100%;
}

.game-instruction {
    margin-bottom: 30px;
}

.game-instruction p {
    font-size: 1.8em;
    color: #333;
    font-weight: bold;
    margin: 0;
}

/* Game 1: Number Match Styling */
.number-display {
    margin-bottom: 40px;
}

.big-number {
    font-size: 6em;
    font-weight: bold;
    color: #FF6B35;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin: 20px 0;
}

.word-choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 400px;
    margin: 0 auto;
}

.word-choice-btn {
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
    border: none;
    border-radius: 15px;
    padding: 20px 15px;
    font-size: 1.5em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-transform: capitalize;
}

.word-choice-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.word-choice-btn.correct {
    background: linear-gradient(135deg, #4CAF50 0%, #45A049 100%);
    animation: bounce 0.6s ease;
}

.word-choice-btn.incorrect {
    background: linear-gradient(135deg, #F44336 0%, #D32F2F 100%);
    animation: fadeOut 0.5s ease forwards;
}

/* Game 2: Equation Fix Styling */
.equation-display {
    margin-bottom: 40px;
}

.equation {
    font-size: 4em;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.equation-number {
    color: #FF6B35;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.equation-operator {
    color: #FF69B4;
    font-weight: bold;
}

.equation-blank {
    color: #FFD700;
    font-size: 1.2em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

/* Game 3: Count & Solve Styling */
.objects-display {
    margin-bottom: 40px;
}

.objects-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.object-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.object-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 15px;
}

.apple-images, .banana-images, .fruit-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 300px;
}

/* Object count styling removed - children now count the actual fruits */

.plus-sign, .equals-sign {
    font-size: 3em;
    font-weight: bold;
    color: #FF69B4;
}

.question-mark {
    font-size: 3em;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

/* Common Number Choices Styling */
.number-choices {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.number-choice-btn {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8E53 100%);
    border: none;
    border-radius: 15px;
    padding: 20px 25px;
    font-size: 2em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    min-width: 80px;
}

.number-choice-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.number-choice-btn.correct {
    background: linear-gradient(135deg, #4CAF50 0%, #45A049 100%);
    animation: bounce 0.6s ease;
}

.number-choice-btn.incorrect {
    background: linear-gradient(135deg, #F44336 0%, #D32F2F 100%);
    animation: fadeOut 0.5s ease forwards;
}

/* Game Feedback Styling */
.game-feedback {
    font-size: 1.5em;
    font-weight: bold;
    margin-top: 20px;
    padding: 15px 25px;
    border-radius: 15px;
    min-height: 1.5em;
}

.game-feedback.correct {
    background: rgba(76, 175, 80, 0.2);
    color: #2E7D32;
    border: 2px solid #4CAF50;
}

.game-feedback.incorrect {
    background: rgba(244, 67, 54, 0.2);
    color: #C62828;
    border: 2px solid #F44336;
}

.game-feedback.partial {
    background: rgba(255, 152, 0, 0.2);
    color: #E65100;
    border: 2px solid #FF9800;
}

/* Animations */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0.3;
        transform: scale(0.9);
    }
}

/* Responsive Design for Numbers Games */
@media (max-width: 768px) {
    .numbers-game-content {
        padding: 30px 20px;
        max-width: 95vw;
    }
    
    .big-number {
        font-size: 4em;
    }
    
    .equation {
        font-size: 2.5em;
        gap: 15px;
    }
    
    .objects-row {
        gap: 20px;
    }
    
    .object-image {
        width: 80px;
        height: 80px;
    }
    
    .word-choices {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .number-choices {
        gap: 15px;
    }
    
    .number-choice-btn {
        padding: 15px 20px;
        font-size: 1.5em;
    }
}
.back-to-games-btn:hover {
    background-color: #D8D8D8; 
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}


/* Placeholder Styles for New Game Views - Match Word */
#match-word-game-view {
    /* Similar background to word-game-view or a new one */
    /* background-image: url('../images/word_game_bg.png');
    background-size: cover;
    background-position: center; */
    padding: 20px;
    border-radius: 10px;
    box-sizing: border-box;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    min-height: calc(100vh - 80px);
}

#match-word-game-view h1#match-word-title {
    color: white; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.6); 
    margin-bottom: 20px; 
    font-size: 3em; 
}

#match-word-content-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;        /* <-- vertical center image and choices */
    justify-content: center;
    gap: 48px;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    background: rgba(255,255,255,0.96);
    border-radius: 20px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.07);
    padding: 38px 38px;
    min-height: 250px;           /* REDUCE height! */
}

.match-word-image-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

#match-word-item-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border: 3px solid white;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.25);
}

.match-word-choices-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;   /* left align choices within col */
    justify-content: center;
    gap: 18px;
    min-width: 260px;
    height: 100%;
}

#match-word-choices-container {
    display: flex;
    flex-direction: row;
    gap: 18px;
    margin-bottom: 12px;
    align-items: center;
}
#match-word-choices-container button {
    font-size: 1.2em;
    font-weight: bold;
    min-width: 110px;
    min-height: 48px;
    padding: 12px 18px;
    border-radius: 10px;
    border: none;
    background: #fdf6e3;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    cursor: pointer;
    margin: 0;
    transition: transform 0.08s, box-shadow 0.13s;
}

#match-word-choices-container button:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 12px rgba(0,0,0,0.19);
}
#match-word-feedback {
    font-size: 1.2em;
    min-height: 1.8em;
    margin-bottom: 4px;
    margin-top: 4px;
}

/* Responsive for mobile */
@media (max-width: 700px) {
    #match-word-content-wrapper {
        flex-direction: column;
        gap: 18px;
        padding: 20px 8px;
        max-width: 98vw;
    }
    .match-word-image-col,
    .match-word-choices-col {
        min-width: unset;
        height: unset;
    }
    #match-word-choices-container {
        flex-direction: column;
        gap: 12px;
    }
}


/* Placeholder Styles for New Game Views - Write Word */
#write-word-game-view {
    /* Similar background */
    /* background-image: url('../images/word_game_bg.png'); /* Re-use or change
    background-size: cover;
    background-position: center; */
    padding: 20px;
    border-radius: 10px;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
}
#write-word-game-view h1#write-word-title {
     color: white; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.6); 
    margin-bottom: 20px; 
    font-size: 3em; 
}

#write-word-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#write-word-prompt-text {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 10px;
}
#write-word-prompt-text strong {
    font-size: 1.5em; /* Make the word to write bigger */
    color: #185a9d; /* Blue for the word */
    display: block; /* Put word on new line if desired */
    margin-top: 5px;
    letter-spacing: 2px; /* Space out letters */
}

#write-word-input-text {
    font-size: 1.5em;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #ccc;
    text-align: center;
    width: 80%;
    max-width: 300px;
}
#write-word-input-text:focus {
    outline: none;
    border-color: #4A90E2; /* Blue focus */
}

#write-word-submit-btn {
    font-size: 1.2em;
    padding: 12px 25px;
    background-color: #A1C96C; /* Green button */
    color: white;
    /* Inherits general button styles for hover etc. if you have a common .button class */
}
/* Image Analyzer View */
#image-analyzer-view {
    padding: 20px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

#image-analyzer-view h1 {
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.27);
  font-size: 2.4em;
  margin-bottom: 32px;
}

.analyzer-main-flex, #analyzer-main-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 48px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 24px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.07);
  padding: 38px 40px;
}

.analyzer-left-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  max-width: 420px;
  min-width: 260px;
}

.analyzer-right-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 0;
  max-width: 550px;
  min-width: 300px;
  justify-content: flex-start;
}

#analyzer-video-feed {
  width: 100%;
  max-width: 340px;
  height: 300px;
  background: #222;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
}

.analyzer-btn-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: auto;
}

.analyzer-btn {
  font-size: 1.1em;
  padding: 12px 26px;
  border: none;
  border-radius: 20px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}
.analyzer-btn-blue { background: #8D6ECF; }
.analyzer-btn-blue:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-green { background: #8D6ECF; }
.analyzer-btn-green:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-purple { background: #8D6ECF; }
.analyzer-btn-purple:hover { background: #7a5bb8; transform: translateY(-2px); }

.analyzer-status {
  min-height: 1.4em;
  margin-top: 8px;
  color: #2678b5;
  font-size: 1em;
  text-align: center;
}

.analyzer-output-wrapper {
  background: #fff;
  border-radius: 18px;
  border: 2px solid #dadada;
  padding: 24px 18px 16px 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.07);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 340px;
}
.analyzer-output-wrapper h2 {
  font-family: inherit;
  color: #1c3456;
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 14px;
  text-align: left;
  letter-spacing: 0.5px;
}

.analyzer-text-output, #analyzer-text-output {
  font-family: var(--font-primary);
  font-size: 1.12em;
  min-height: 245px;
  border: none;
  background: #f8f8fa;
  color: #303050;
  border-radius: 10px;
  resize: none;
  padding: 14px 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  margin-bottom: 0;
  outline: none;
  white-space: pre-line;
}

.back-to-games-btn {
  margin: 30px auto 0 auto;
  display: block;
}

@media (max-width: 900px) {
  .analyzer-main-flex, #analyzer-main-content {
    flex-direction: column;
    padding: 18px 4vw;
    gap: 18px;
  }
  .analyzer-left-pane, .analyzer-right-pane {
    max-width: 98vw;
    min-width: unset;
  }
  #analyzer-video-feed {
    max-width: 95vw;
    height: 32vw;
    min-height: 100px;
  }
}
.analyzer-text-output, #analyzer-text-output {
  overflow-y: auto;
  max-height: 260px;
}
.kai-gif-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  transition: transform 0.09s;
}
.kai-gif-btn:hover,
.kai-gif-btn:focus {
  transform: scale(1.06);
}
.kai-gif {
  height: auto;
  display: block;
}


#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

#draw-lines-game-view .images-row {
    order: 1;
}

#draw-lines-game-view .words-row {
    order: 2;
}

#draw-lines-game-view .image-item, 
#draw-lines-game-view .word-item {
    position: relative;
    background: white;
    border: 3px solid #EADDC7;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    flex-shrink: 0;
    margin: 5px;
}

#draw-lines-game-view .image-item {
    padding: 15px; /* Add padding back for proper spacing */
    overflow: visible; /* Allow normal overflow */
    min-width: 130px; /* Ensure cards are wide enough for images + padding */
    min-height: 130px; /* Ensure cards are tall enough for images + padding */
}

#draw-lines-game-view .word-item {
    padding: 15px; /* Keep padding for word cards */
}

#draw-lines-game-view .image-item:hover, 
#draw-lines-game-view .word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #FF6B35;
}

#draw-lines-game-view .image-item img {
    width: 100px;  /* Fixed size that fits inside cards */
    height: 100px; /* Fixed size that fits inside cards */
    object-fit: contain; /* Fit image within bounds, maintain aspect ratio */
    border-radius: 10px;
    display: block; /* Remove any inline spacing */
}

#draw-lines-game-view .word-item {
    font-size: 1.4em;  /* Increased from 1.2em */
    font-weight: bold;
    color: #4A4A4A;
    min-height: 100px; /* Increased from 80px to match image height */
    display: flex;
    align-items: center;
    justify-content: center;
}

#draw-lines-game-view .image-item.connected, 
#draw-lines-game-view .word-item.connected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

#draw-lines-game-view .image-item.incorrect, 
#draw-lines-game-view .word-item.incorrect {
    border-color: #F44336;
    background: rgba(244, 67, 54, 0.1);
}

#draw-lines-game-view .image-item.selected, 
#draw-lines-game-view .word-item.selected {
    border-color: #FF6B35;
    background: rgba(255, 107, 53, 0.2);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
    transition: all 0.2s ease;
}

.draw-lines-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.draw-lines-controls .game-button {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8E53 100%);
    border: none;
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.draw-lines-controls .game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.draw-lines-controls .game-button:active {
    transform: translateY(0);
}

/* Canvas for drawing lines */
.draw-lines-game-area {
    position: relative;
}

.draw-lines-game-area canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.image-item, .word-item {
    position: relative;
    z-index: 2;
}

/* Responsive design for draw lines game */
@media (max-width: 768px) {
    .draw-lines-game-area {
        flex-direction: column;
        gap: 20px;
    }
    
    .images-row, .words-row {
        width: 100%;
    }
    
    .image-item, .word-item {
        min-width: 100px;
    }
    
    .draw-lines-controls {
        flex-direction: column;
        align-items: center;
    }
}

/* Force horizontal layout for draw lines game */
#draw-lines-game-view .draw-lines-game-area {
    display: flex !important;
    flex-direction: column !important;
    gap: 40px;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 400px; /* Ensure enough height for two rows */
}

#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
    min-height: 120px; /* Ensure consistent height */
}

#draw-lines-game-view .images-row {
    order: 1;
    background: rgba(255, 0, 0, 0.1); /* Debug: red tint for images row */
}

#draw-lines-game-view .words-row {
    order: 2;
    background: rgba(0, 255, 0, 0.1); /* Debug: green tint for words row */
}

/* Override any conflicting flexbox styles */
#draw-lines-game-view .images-row *,
#draw-lines-game-view .words-row * {
    flex-direction: row !important;
}

#draw-lines-game-view .images-container,
#draw-lines-game-view .words-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

/* Profile/Account Styling */
/* Note: Profile button styling moved to sticky-profile-button above */

/* Profile View Styling */
#profile-view {
    padding: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.profile-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    border: 2px solid #f0f0f0;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.profile-header h1 {
    color: #333;
    margin: 0;
    font-size: 2.2em;
}

.profile-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.profile-avatar-section {
    text-align: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-section h2 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 1.8em;
}

.profile-avatar-section p {
    color: #666;
    margin: 0;
    font-size: 1.2em;
}

.profile-form-section h3 {
    color: #333;
    margin: 0 0 20px 0;
    font-size: 1.5em;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
    font-size: 1.1em;
}

.profile-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.profile-input:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.profile-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.profile-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.cancel-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.profile-feedback {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    display: none;
}

.profile-feedback.success {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    border: 2px solid #4CAF50;
}

.profile-feedback.error {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
    border: 2px solid #f44336;
}

/* Responsive Design for Profile */
@media (max-width: 768px) {
    .profile-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .profile-container {
        padding: 20px;
        margin: 20px;
    }
    
    .profile-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .profile-actions {
        flex-direction: column;
    }
}

/* Profile Display on Homepage and Profile Creation */
.profile-display {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.profile-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #FF6B35;
}

.avatar-small {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#homescreen-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.1em;
}

/* Profile Creation Page Profile Display */
.profile-display-top {
    margin-bottom: 30px;
    text-align: center;
}

.profile-info-display {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.profile-avatar-display {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #FF6B35;
}

.avatar-display {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#profile-creation-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.2em;
}

/* Match Word Game View */
#match-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
}

#match-word-game-view h1#match-word-title {
    color: #333;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    font-size: 3em;
}

.match-word-image-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#match-word-item-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border: 3px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.match-word-choices-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    min-width: 250px;
}

/* Write Word Game View */
#write-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
    position: relative;
}

.write-word-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 140px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.write-word-koala:hover {
    transform: scale(1.05);
}

#write-word-game-view h1#write-word-title {
    color: #333; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 30px; 
    font-size: clamp(2em, 6vw, 3em);
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    max-width: 100%;
}

#write-word-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#write-word-prompt-text {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 10px;
}
#write-word-prompt-text strong {
    font-size: 1.5em; /* Make the word to write bigger */
    color: #185a9d; /* Blue for the word */
    display: block; /* Put word on new line if desired */
    margin-top: 5px;
    letter-spacing: 2px; /* Space out letters */
}

#write-word-input-text {
    font-size: 1.5em;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #ccc;
    text-align: center;
    width: 80%;
    max-width: 300px;
}
#write-word-input-text:focus {
    outline: none;
    border-color: #4A90E2; /* Blue focus */
}

#write-word-submit-btn {
    font-size: 1.2em;
    padding: 12px 25px;
    background-color: #A1C96C; /* Green button */
    color: white;
    /* Inherits general button styles for hover etc. if you have a common .button class */
}
/* Image Analyzer View */
#image-analyzer-view {
    padding: 20px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

#image-analyzer-view h1 {
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.27);
  font-size: 2.4em;
  margin-bottom: 32px;
}

.analyzer-main-flex, #analyzer-main-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 48px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 24px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.07);
  padding: 38px 40px;
}

.analyzer-left-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  max-width: 420px;
  min-width: 260px;
}

.analyzer-right-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 0;
  max-width: 550px;
  min-width: 300px;
  justify-content: flex-start;
}

#analyzer-video-feed {
  width: 100%;
  max-width: 340px;
  height: 300px;
  background: #222;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
}

.analyzer-btn-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: auto;
}

.analyzer-btn {
  font-size: 1.1em;
  padding: 12px 26px;
  border: none;
  border-radius: 20px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}
.analyzer-btn-blue { background: #8D6ECF; }
.analyzer-btn-blue:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-green { background: #8D6ECF; }
.analyzer-btn-green:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-purple { background: #8D6ECF; }
.analyzer-btn-purple:hover { background: #7a5bb8; transform: translateY(-2px); }

.analyzer-status {
  min-height: 1.4em;
  margin-top: 8px;
  color: #2678b5;
  font-size: 1em;
  text-align: center;
}
.analyzer-output-wrapper {
  background: #fff;
  border-radius: 18px;
  border: 2px solid #dadada;
  padding: 24px 18px 16px 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.07);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 340px;
}

.analyzer-output-wrapper h2 {
  font-family: inherit;
  color: #1c3456;
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 14px;
  text-align: left;
  letter-spacing: 0.5px;
}

.analyzer-text-output, #analyzer-text-output {
  font-family: var(--font-primary);
  font-size: 1.12em;
  min-height: 245px;
  border: none;
  background: #f8f8fa;
  color: #303050;
  border-radius: 10px;
  resize: none;
  padding: 14px 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  margin-bottom: 0;
  outline: none;
  white-space: pre-line;
}

.back-to-games-btn {
  margin: 30px auto 0 auto;
  display: block;
}

@media (max-width: 900px) {
  .analyzer-main-flex, #analyzer-main-content {
    flex-direction: column;
    padding: 18px 4vw;
    gap: 18px;
  }
  .analyzer-left-pane, .analyzer-right-pane {
    max-width: 98vw;
    min-width: unset;
  }
  #analyzer-video-feed {
    max-width: 95vw;
    height: 32vw;
    min-height: 100px;
  }
}
.analyzer-text-output, #analyzer-text-output {
  overflow-y: auto;
  max-height: 260px;
}
.kai-gif-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  transition: transform 0.09s;
}
.kai-gif-btn:hover,
.kai-gif-btn:focus {
  transform: scale(1.06);
}
.kai-gif {
  height: auto;
  display: block;
}


#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

#draw-lines-game-view .images-row {
    order: 1;
}

#draw-lines-game-view .words-row {
    order: 2;
}

#draw-lines-game-view .image-item, 
#draw-lines-game-view .word-item {
    position: relative;
    background: white;
    border: 3px solid #EADDC7;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    flex-shrink: 0;
    margin: 5px;
}

#draw-lines-game-view .image-item {
    padding: 15px; /* Add padding back for proper spacing */
    overflow: visible; /* Allow normal overflow */
    min-width: 130px; /* Ensure cards are wide enough for images + padding */
    min-height: 130px; /* Ensure cards are tall enough for images + padding */
}

#draw-lines-game-view .word-item {
    padding: 15px; /* Keep padding for word cards */
}

#draw-lines-game-view .image-item:hover, 
#draw-lines-game-view .word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #FF6B35;
}

#draw-lines-game-view .image-item img {
    width: 100px;  /* Fixed size that fits inside cards */
    height: 100px; /* Fixed size that fits inside cards */
    object-fit: contain; /* Fit image within bounds, maintain aspect ratio */
    border-radius: 10px;
    display: block; /* Remove any inline spacing */
}

#draw-lines-game-view .word-item {
    font-size: 1.4em;  /* Increased from 1.2em */
    font-weight: bold;
    color: #4A4A4A;
    min-height: 100px; /* Increased from 80px to match image height */
    display: flex;
    align-items: center;
    justify-content: center;
}

#draw-lines-game-view .image-item.connected, 
#draw-lines-game-view .word-item.connected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

#draw-lines-game-view .image-item.incorrect, 
#draw-lines-game-view .word-item.incorrect {
    border-color: #F44336;
    background: rgba(244, 67, 54, 0.1);
}

#draw-lines-game-view .image-item.selected, 
#draw-lines-game-view .word-item.selected {
    border-color: #FF6B35;
    background: rgba(255, 107, 53, 0.2);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
    transition: all 0.2s ease;
}

.draw-lines-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.draw-lines-controls .game-button {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8E53 100%);
    border: none;
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.draw-lines-controls .game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.draw-lines-controls .game-button:active {
    transform: translateY(0);
}

/* Canvas for drawing lines */
.draw-lines-game-area {
    position: relative;
}

.draw-lines-game-area canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.image-item, .word-item {
    position: relative;
    z-index: 2;
}

/* Responsive design for draw lines game */
@media (max-width: 768px) {
    .draw-lines-game-area {
        flex-direction: column;
        gap: 20px;
    }
    
    .images-row, .words-row {
        width: 100%;
    }
    
    .image-item, .word-item {
        min-width: 100px;
    }
    
    .draw-lines-controls {
        flex-direction: column;
        align-items: center;
    }
}

/* Force horizontal layout for draw lines game */
#draw-lines-game-view .draw-lines-game-area {
    display: flex !important;
    flex-direction: column !important;
    gap: 40px;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 400px; /* Ensure enough height for two rows */
}

#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
    min-height: 120px; /* Ensure consistent height */
}

#draw-lines-game-view .images-row {
    order: 1;
    background: rgba(255, 0, 0, 0.1); /* Debug: red tint for images row */
}

#draw-lines-game-view .words-row {
    order: 2;
    background: rgba(0, 255, 0, 0.1); /* Debug: green tint for words row */
}

/* Override any conflicting flexbox styles */
#draw-lines-game-view .images-row *,
#draw-lines-game-view .words-row * {
    flex-direction: row !important;
}

#draw-lines-game-view .images-container,
#draw-lines-game-view .words-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

/* Profile/Account Styling */
/* Note: Profile button styling moved to sticky-profile-button above */

/* Profile View Styling */
#profile-view {
    padding: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.profile-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    border: 2px solid #f0f0f0;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.profile-header h1 {
    color: #333;
    margin: 0;
    font-size: 2.2em;
}

.profile-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.profile-avatar-section {
    text-align: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #FF6B35;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-section h2 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 1.8em;
}

.profile-avatar-section p {
    color: #666;
    margin: 0;
    font-size: 1.2em;
}

.profile-form-section h3 {
    color: #333;
    margin: 0 0 20px 0;
    font-size: 1.5em;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
    font-size: 1.1em;
}

.profile-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.profile-input:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.profile-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.profile-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.cancel-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.profile-feedback {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    display: none;
}

.profile-feedback.success {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    border: 2px solid #4CAF50;
}

.profile-feedback.error {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
    border: 2px solid #f44336;
}

/* Responsive Design for Profile */
@media (max-width: 768px) {
    .profile-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .profile-container {
        padding: 20px;
        margin: 20px;
    }
    
    .profile-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .profile-actions {
        flex-direction: column;
    }
}

/* Profile Display on Homepage and Profile Creation */
.profile-display {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.profile-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #FF6B35;
}

.avatar-small {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#homescreen-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.1em;
}

/* Profile Creation Page Profile Display */
.profile-display-top {
    margin-bottom: 30px;
    text-align: center;
}

.profile-info-display {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.profile-avatar-display {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #FF6B35;
}

.avatar-display {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#profile-creation-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.2em;
}

/* Match Word Game View */
#match-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
}

#match-word-game-view h1#match-word-title {
    color: #333;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    font-size: 3em;
}

.match-word-image-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#match-word-item-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border: 3px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.match-word-choices-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    min-width: 250px;
}

/* Write Word Game View */
#write-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
    position: relative;
}

.write-word-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 140px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.write-word-koala:hover {
    transform: scale(1.05);
}

#write-word-game-view h1#write-word-title {
    color: #333; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 30px; 
    font-size: clamp(2em, 6vw, 3em);
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    max-width: 100%;
}

#write-word-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#write-word-prompt-text {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 10px;
}
#write-word-prompt-text strong {
    font-size: 1.5em; /* Make the word to write bigger */
    color: #185a9d; /* Blue for the word */
    display: block; /* Put word on new line if desired */
    margin-top: 5px;
    letter-spacing: 2px; /* Space out letters */
}

#write-word-input-text {
    font-size: 1.5em;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #ccc;
    text-align: center;
    width: 80%;
    max-width: 300px;
}
#write-word-input-text:focus {
    outline: none;
    border-color: #4A90E2; /* Blue focus */
}

#write-word-submit-btn {
    font-size: 1.2em;
    padding: 12px 25px;
    background-color: #A1C96C; /* Green button */
    color: white;
    /* Inherits general button styles for hover etc. if you have a common .button class */
}
/* Image Analyzer View */
#image-analyzer-view {
    padding: 20px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

#image-analyzer-view h1 {
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.27);
  font-size: 2.4em;
  margin-bottom: 32px;
}

.analyzer-main-flex, #analyzer-main-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 48px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 24px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.07);
  padding: 38px 40px;
}

.analyzer-left-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  max-width: 420px;
  min-width: 260px;
}

.analyzer-right-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 0;
  max-width: 550px;
  min-width: 300px;
  justify-content: flex-start;
}

#analyzer-video-feed {
  width: 100%;
  max-width: 340px;
  height: 300px;
  background: #222;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
}

.analyzer-btn-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: auto;
}

.analyzer-btn {
  font-size: 1.1em;
  padding: 12px 26px;
  border: none;
  border-radius: 20px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}
.analyzer-btn-blue { background: #8D6ECF; }
.analyzer-btn-blue:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-green { background: #8D6ECF; }
.analyzer-btn-green:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-purple { background: #8D6ECF; }
.analyzer-btn-purple:hover { background: #7a5bb8; transform: translateY(-2px); }

.analyzer-status {
  min-height: 1.4em;
  margin-top: 8px;
  color: #2678b5;
  font-size: 1em;
  text-align: center;
}

.analyzer-output-wrapper {
  background: #fff;
  border-radius: 18px;
  border: 2px solid #dadada;
  padding: 24px 18px 16px 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.07);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 340px;
}

.analyzer-output-wrapper h2 {
  font-family: inherit;
  color: #1c3456;
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 14px;
  text-align: left;
  letter-spacing: 0.5px;
}

.analyzer-text-output, #analyzer-text-output {
  font-family: var(--font-primary);
  font-size: 1.12em;
  min-height: 245px;
  border: none;
  background: #f8f8fa;
  color: #303050;
  border-radius: 10px;
  resize: none;
  padding: 14px 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  margin-bottom: 0;
  outline: none;
  white-space: pre-line;
}

.back-to-games-btn {
  margin: 30px auto 0 auto;
  display: block;
}

@media (max-width: 900px) {
  .analyzer-main-flex, #analyzer-main-content {
    flex-direction: column;
    padding: 18px 4vw;
    gap: 18px;
  }
  .analyzer-left-pane, .analyzer-right-pane {
    max-width: 98vw;
    min-width: unset;
  }
  #analyzer-video-feed {
    max-width: 95vw;
    height: 32vw;
    min-height: 100px;
  }
}
.analyzer-text-output, #analyzer-text-output {
  overflow-y: auto;
  max-height: 260px;
}
.kai-gif-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  transition: transform 0.09s;
}
.kai-gif-btn:hover,
.kai-gif-btn:focus {
  transform: scale(1.06);
}
.kai-gif {
  height: auto;
  display: block;
}


#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

#draw-lines-game-view .images-row {
    order: 1;
}

#draw-lines-game-view .words-row {
    order: 2;
}

#draw-lines-game-view .image-item, 
#draw-lines-game-view .word-item {
    position: relative;
    background: white;
    border: 3px solid #EADDC7;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    flex-shrink: 0;
    margin: 5px;
}

#draw-lines-game-view .image-item {
    padding: 15px; /* Add padding back for proper spacing */
    overflow: visible; /* Allow normal overflow */
    min-width: 130px; /* Ensure cards are wide enough for images + padding */
    min-height: 130px; /* Ensure cards are tall enough for images + padding */
}

#draw-lines-game-view .word-item {
    padding: 15px; /* Keep padding for word cards */
}

#draw-lines-game-view .image-item:hover, 
#draw-lines-game-view .word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #FF6B35;
}

#draw-lines-game-view .image-item img {
    width: 100px;  /* Fixed size that fits inside cards */
    height: 100px; /* Fixed size that fits inside cards */
    object-fit: contain; /* Fit image within bounds, maintain aspect ratio */
    border-radius: 10px;
    display: block; /* Remove any inline spacing */
}

#draw-lines-game-view .word-item {
    font-size: 1.4em;  /* Increased from 1.2em */
    font-weight: bold;
    color: #4A4A4A;
    min-height: 100px; /* Increased from 80px to match image height */
    display: flex;
    align-items: center;
    justify-content: center;
}

#draw-lines-game-view .image-item.connected, 
#draw-lines-game-view .word-item.connected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

#draw-lines-game-view .image-item.incorrect, 
#draw-lines-game-view .word-item.incorrect {
    border-color: #F44336;
    background: rgba(244, 67, 54, 0.1);
}

#draw-lines-game-view .image-item.selected, 
#draw-lines-game-view .word-item.selected {
    border-color: #FF6B35;
    background: rgba(255, 107, 53, 0.2);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
    transition: all 0.2s ease;
}

.draw-lines-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.draw-lines-controls .game-button {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8E53 100%);
    border: none;
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.draw-lines-controls .game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.draw-lines-controls .game-button:active {
    transform: translateY(0);
}

/* Canvas for drawing lines */
.draw-lines-game-area {
    position: relative;
}

.draw-lines-game-area canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.image-item, .word-item {
    position: relative;
    z-index: 2;
}

/* Responsive design for draw lines game */
@media (max-width: 768px) {
    .draw-lines-game-area {
        flex-direction: column;
        gap: 20px;
    }
    
    .images-row, .words-row {
        width: 100%;
    }
    
    .image-item, .word-item {
        min-width: 100px;
    }
    
    .draw-lines-controls {
        flex-direction: column;
        align-items: center;
    }
}

/* Force horizontal layout for draw lines game */
#draw-lines-game-view .draw-lines-game-area {
    display: flex !important;
    flex-direction: column !important;
    gap: 40px;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 400px; /* Ensure enough height for two rows */
}

#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
    min-height: 120px; /* Ensure consistent height */
}

#draw-lines-game-view .images-row {
    order: 1;
    background: rgba(255, 0, 0, 0.1); /* Debug: red tint for images row */
}

#draw-lines-game-view .words-row {
    order: 2;
    background: rgba(0, 255, 0, 0.1); /* Debug: green tint for words row */
}

/* Override any conflicting flexbox styles */
#draw-lines-game-view .images-row *,
#draw-lines-game-view .words-row * {
    flex-direction: row !important;
}

#draw-lines-game-view .images-container,
#draw-lines-game-view .words-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

/* Profile/Account Styling */
/* Note: Profile button styling moved to sticky-profile-button above */

/* Profile View Styling */
#profile-view {
    padding: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.profile-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    border: 2px solid #f0f0f0;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.profile-header h1 {
    color: #333;
    margin: 0;
    font-size: 2.2em;
}

.profile-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.profile-avatar-section {
    text-align: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #FF6B35;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-section h2 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 1.8em;
}

.profile-avatar-section p {
    color: #666;
    margin: 0;
    font-size: 1.2em;
}

.profile-form-section h3 {
    color: #333;
    margin: 0 0 20px 0;
    font-size: 1.5em;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
    font-size: 1.1em;
}

.profile-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.profile-input:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.profile-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.profile-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.cancel-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.profile-feedback {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    display: none;
}

.profile-feedback.success {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    border: 2px solid #4CAF50;
}

.profile-feedback.error {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
    border: 2px solid #f44336;
}

/* Responsive Design for Profile */
@media (max-width: 768px) {
    .profile-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .profile-container {
        padding: 20px;
        margin: 20px;
    }
    
    .profile-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .profile-actions {
        flex-direction: column;
    }
}

/* Profile Display on Homepage and Profile Creation */
.profile-display {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.profile-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #FF6B35;
}

.avatar-small {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#homescreen-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.1em;
}

/* Profile Creation Page Profile Display */
.profile-display-top {
    margin-bottom: 30px;
    text-align: center;
}

.profile-info-display {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.profile-avatar-display {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #FF6B35;
}

.avatar-display {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#profile-creation-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.2em;
}

/* Match Word Game View */
#match-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
}

#match-word-game-view h1#match-word-title {
    color: #333;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    font-size: 3em;
}

.match-word-image-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#match-word-item-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border: 3px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.match-word-choices-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    min-width: 250px;
}

/* Write Word Game View */
#write-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
    position: relative;
}

.write-word-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 140px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.write-word-koala:hover {
    transform: scale(1.05);
}

#write-word-game-view h1#write-word-title {
    color: #333; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 30px; 
    font-size: clamp(2em, 6vw, 3em);
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    max-width: 100%;
}

#write-word-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#write-word-prompt-text {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 10px;
}
#write-word-prompt-text strong {
    font-size: 1.5em; /* Make the word to write bigger */
    color: #185a9d; /* Blue for the word */
    display: block; /* Put word on new line if desired */
    margin-top: 5px;
    letter-spacing: 2px; /* Space out letters */
}

#write-word-input-text {
    font-size: 1.5em;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #ccc;
    text-align: center;
    width: 80%;
    max-width: 300px;
}
#write-word-input-text:focus {
    outline: none;
    border-color: #4A90E2; /* Blue focus */
}

#write-word-submit-btn {
    font-size: 1.2em;
    padding: 12px 25px;
    background-color: #A1C96C; /* Green button */
    color: white;
    /* Inherits general button styles for hover etc. if you have a common .button class */
}
/* Image Analyzer View */
#image-analyzer-view {
    padding: 20px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

#image-analyzer-view h1 {
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.27);
  font-size: 2.4em;
  margin-bottom: 32px;
}

.analyzer-main-flex, #analyzer-main-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 48px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 24px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.07);
  padding: 38px 40px;
}

.analyzer-left-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  max-width: 420px;
  min-width: 260px;
}

.analyzer-right-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 0;
  max-width: 550px;
  min-width: 300px;
  justify-content: flex-start;
}

#analyzer-video-feed {
  width: 100%;
  max-width: 340px;
  height: 300px;
  background: #222;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
}

.analyzer-btn-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: auto;
}
.analyzer-btn {
  font-size: 1.1em;
  padding: 12px 26px;
  border: none;
  border-radius: 20px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}
.analyzer-btn-blue { background: #8D6ECF; }
.analyzer-btn-blue:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-green { background: #8D6ECF; }
.analyzer-btn-green:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-purple { background: #8D6ECF; }
.analyzer-btn-purple:hover { background: #7a5bb8; transform: translateY(-2px); }

.analyzer-status {
  min-height: 1.4em;
  margin-top: 8px;
  color: #2678b5;
  font-size: 1em;
  text-align: center;
}

.analyzer-output-wrapper {
  background: #fff;
  border-radius: 18px;
  border: 2px solid #dadada;
  padding: 24px 18px 16px 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.07);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 340px;
}

.analyzer-output-wrapper h2 {
  font-family: inherit;
  color: #1c3456;
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 14px;
  text-align: left;
  letter-spacing: 0.5px;
}

.analyzer-text-output, #analyzer-text-output {
  font-family: var(--font-primary);
  font-size: 1.12em;
  min-height: 245px;
  border: none;
  background: #f8f8fa;
  color: #303050;
  border-radius: 10px;
  resize: none;
  padding: 14px 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  margin-bottom: 0;
  outline: none;
  white-space: pre-line;
}

.back-to-games-btn {
  margin: 30px auto 0 auto;
  display: block;
}

@media (max-width: 900px) {
  .analyzer-main-flex, #analyzer-main-content {
    flex-direction: column;
    padding: 18px 4vw;
    gap: 18px;
  }
  .analyzer-left-pane, .analyzer-right-pane {
    max-width: 98vw;
    min-width: unset;
  }
  #analyzer-video-feed {
    max-width: 95vw;
    height: 32vw;
    min-height: 100px;
  }
}
.analyzer-text-output, #analyzer-text-output {
  overflow-y: auto;
  max-height: 260px;
}
.kai-gif-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  transition: transform 0.09s;
}
.kai-gif-btn:hover,
.kai-gif-btn:focus {
  transform: scale(1.06);
}
.kai-gif {
  height: auto;
  display: block;
}


#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

#draw-lines-game-view .images-row {
    order: 1;
}

#draw-lines-game-view .words-row {
    order: 2;
}

#draw-lines-game-view .image-item, 
#draw-lines-game-view .word-item {
    position: relative;
    background: white;
    border: 3px solid #EADDC7;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    flex-shrink: 0;
    margin: 5px;
}

#draw-lines-game-view .image-item {
    padding: 15px; /* Add padding back for proper spacing */
    overflow: visible; /* Allow normal overflow */
    min-width: 130px; /* Ensure cards are wide enough for images + padding */
    min-height: 130px; /* Ensure cards are tall enough for images + padding */
}

#draw-lines-game-view .word-item {
    padding: 15px; /* Keep padding for word cards */
}

#draw-lines-game-view .image-item:hover, 
#draw-lines-game-view .word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #FF6B35;
}

#draw-lines-game-view .image-item img {
    width: 100px;  /* Fixed size that fits inside cards */
    height: 100px; /* Fixed size that fits inside cards */
    object-fit: contain; /* Fit image within bounds, maintain aspect ratio */
    border-radius: 10px;
    display: block; /* Remove any inline spacing */
}

#draw-lines-game-view .word-item {
    font-size: 1.4em;  /* Increased from 1.2em */
    font-weight: bold;
    color: #4A4A4A;
    min-height: 100px; /* Increased from 80px to match image height */
    display: flex;
    align-items: center;
    justify-content: center;
}

#draw-lines-game-view .image-item.connected, 
#draw-lines-game-view .word-item.connected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

#draw-lines-game-view .image-item.incorrect, 
#draw-lines-game-view .word-item.incorrect {
    border-color: #F44336;
    background: rgba(244, 67, 54, 0.1);
}

#draw-lines-game-view .image-item.selected, 
#draw-lines-game-view .word-item.selected {
    border-color: #FF6B35;
    background: rgba(255, 107, 53, 0.2);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
    transition: all 0.2s ease;
}

.draw-lines-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.draw-lines-controls .game-button {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8E53 100%);
    border: none;
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.draw-lines-controls .game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.draw-lines-controls .game-button:active {
    transform: translateY(0);
}

/* Canvas for drawing lines */
.draw-lines-game-area {
    position: relative;
}

.draw-lines-game-area canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.image-item, .word-item {
    position: relative;
    z-index: 2;
}

/* Responsive design for draw lines game */
@media (max-width: 768px) {
    .draw-lines-game-area {
        flex-direction: column;
        gap: 20px;
    }
    
    .images-row, .words-row {
        width: 100%;
    }
    
    .image-item, .word-item {
        min-width: 100px;
    }
    
    .draw-lines-controls {
        flex-direction: column;
        align-items: center;
    }
}

/* Force horizontal layout for draw lines game */
#draw-lines-game-view .draw-lines-game-area {
    display: flex !important;
    flex-direction: column !important;
    gap: 40px;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 400px; /* Ensure enough height for two rows */
}

#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
    min-height: 120px; /* Ensure consistent height */
}

#draw-lines-game-view .images-row {
    order: 1;
    background: rgba(255, 0, 0, 0.1); /* Debug: red tint for images row */
}

#draw-lines-game-view .words-row {
    order: 2;
    background: rgba(0, 255, 0, 0.1); /* Debug: green tint for words row */
}

/* Override any conflicting flexbox styles */
#draw-lines-game-view .images-row *,
#draw-lines-game-view .words-row * {
    flex-direction: row !important;
}

#draw-lines-game-view .images-container,
#draw-lines-game-view .words-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

/* Profile/Account Styling */
/* Note: Profile button styling moved to sticky-profile-button above */

/* Profile View Styling */
#profile-view {
    padding: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.profile-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    border: 2px solid #f0f0f0;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.profile-header h1 {
    color: #333;
    margin: 0;
    font-size: 2.2em;
}

.profile-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.profile-avatar-section {
    text-align: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #FF6B35;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-section h2 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 1.8em;
}

.profile-avatar-section p {
    color: #666;
    margin: 0;
    font-size: 1.2em;
}

.profile-form-section h3 {
    color: #333;
    margin: 0 0 20px 0;
    font-size: 1.5em;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
    font-size: 1.1em;
}

.profile-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.profile-input:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.profile-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.profile-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.cancel-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.profile-feedback {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    display: none;
}

.profile-feedback.success {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    border: 2px solid #4CAF50;
}

.profile-feedback.error {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
    border: 2px solid #f44336;
}

/* Responsive Design for Profile */
@media (max-width: 768px) {
    .profile-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .profile-container {
        padding: 20px;
        margin: 20px;
    }
    
    .profile-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .profile-actions {
        flex-direction: column;
    }
}

/* Profile Display on Homepage and Profile Creation */
.profile-display {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.profile-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #FF6B35;
}

.avatar-small {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#homescreen-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.1em;
}

/* Profile Creation Page Profile Display */
.profile-display-top {
    margin-bottom: 30px;
    text-align: center;
}

.profile-info-display {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.profile-avatar-display {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #FF6B35;
}

.avatar-display {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#profile-creation-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.2em;
}

/* Match Word Game View */
#match-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
}

#match-word-game-view h1#match-word-title {
    color: #333;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    font-size: 3em;
}

.match-word-image-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#match-word-item-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border: 3px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.match-word-choices-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    min-width: 250px;
}

/* Write Word Game View */
#write-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
    position: relative;
}

.write-word-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 140px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.write-word-koala:hover {
    transform: scale(1.05);
}

#write-word-game-view h1#write-word-title {
    color: #333; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 30px; 
    font-size: clamp(2em, 6vw, 3em);
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    max-width: 100%;
}

#write-word-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#write-word-prompt-text {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 10px;
}
#write-word-prompt-text strong {
    font-size: 1.5em; /* Make the word to write bigger */
    color: #185a9d; /* Blue for the word */
    display: block; /* Put word on new line if desired */
    margin-top: 5px;
    letter-spacing: 2px; /* Space out letters */
}

#write-word-input-text {
    font-size: 1.5em;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #ccc;
    text-align: center;
    width: 80%;
    max-width: 300px;
}
#write-word-input-text:focus {
    outline: none;
    border-color: #4A90E2; /* Blue focus */
}

#write-word-submit-btn {
    font-size: 1.2em;
    padding: 12px 25px;
    background-color: #A1C96C; /* Green button */
    color: white;
    /* Inherits general button styles for hover etc. if you have a common .button class */
}
/* Image Analyzer View */
#image-analyzer-view {
    padding: 20px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

#image-analyzer-view h1 {
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.27);
  font-size: 2.4em;
  margin-bottom: 32px;
}

.analyzer-main-flex, #analyzer-main-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 48px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 24px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.07);
  padding: 38px 40px;
}

.analyzer-left-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  max-width: 420px;
  min-width: 260px;
}

.analyzer-right-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 0;
  max-width: 550px;
  min-width: 300px;
  justify-content: flex-start;
}

#analyzer-video-feed {
  width: 100%;
  max-width: 340px;
  height: 300px;
  background: #222;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
}
.analyzer-btn-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: auto;
}

.analyzer-btn {
  font-size: 1.1em;
  padding: 12px 26px;
  border: none;
  border-radius: 20px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}
.analyzer-btn-blue { background: #8D6ECF; }
.analyzer-btn-blue:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-green { background: #8D6ECF; }
.analyzer-btn-green:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-purple { background: #8D6ECF; }
.analyzer-btn-purple:hover { background: #7a5bb8; transform: translateY(-2px); }

.analyzer-status {
  min-height: 1.4em;
  margin-top: 8px;
  color: #2678b5;
  font-size: 1em;
  text-align: center;
}

.analyzer-output-wrapper {
  background: #fff;
  border-radius: 18px;
  border: 2px solid #dadada;
  padding: 24px 18px 16px 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.07);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 340px;
}

.analyzer-output-wrapper h2 {
  font-family: inherit;
  color: #1c3456;
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 14px;
  text-align: left;
  letter-spacing: 0.5px;
}

.analyzer-text-output, #analyzer-text-output {
  font-family: var(--font-primary);
  font-size: 1.12em;
  min-height: 245px;
  border: none;
  background: #f8f8fa;
  color: #303050;
  border-radius: 10px;
  resize: none;
  padding: 14px 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  margin-bottom: 0;
  outline: none;
  white-space: pre-line;
}

.back-to-games-btn {
  margin: 30px auto 0 auto;
  display: block;
}

@media (max-width: 900px) {
  .analyzer-main-flex, #analyzer-main-content {
    flex-direction: column;
    padding: 18px 4vw;
    gap: 18px;
  }
  .analyzer-left-pane, .analyzer-right-pane {
    max-width: 98vw;
    min-width: unset;
  }
  #analyzer-video-feed {
    max-width: 95vw;
    height: 32vw;
    min-height: 100px;
  }
}
.analyzer-text-output, #analyzer-text-output {
  overflow-y: auto;
  max-height: 260px;
}
.kai-gif-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  transition: transform 0.09s;
}
.kai-gif-btn:hover,
.kai-gif-btn:focus {
  transform: scale(1.06);
}
.kai-gif {
  height: auto;
  display: block;
}


#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

#draw-lines-game-view .images-row {
    order: 1;
}

#draw-lines-game-view .words-row {
    order: 2;
}

#draw-lines-game-view .image-item, 
#draw-lines-game-view .word-item {
    position: relative;
    background: white;
    border: 3px solid #EADDC7;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    flex-shrink: 0;
    margin: 5px;
}

#draw-lines-game-view .image-item {
    padding: 15px; /* Add padding back for proper spacing */
    overflow: visible; /* Allow normal overflow */
    min-width: 130px; /* Ensure cards are wide enough for images + padding */
    min-height: 130px; /* Ensure cards are tall enough for images + padding */
}

#draw-lines-game-view .word-item {
    padding: 15px; /* Keep padding for word cards */
}

#draw-lines-game-view .image-item:hover, 
#draw-lines-game-view .word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #FF6B35;
}

#draw-lines-game-view .image-item img {
    width: 100px;  /* Fixed size that fits inside cards */
    height: 100px; /* Fixed size that fits inside cards */
    object-fit: contain; /* Fit image within bounds, maintain aspect ratio */
    border-radius: 10px;
    display: block; /* Remove any inline spacing */
}

#draw-lines-game-view .word-item {
    font-size: 1.4em;  /* Increased from 1.2em */
    font-weight: bold;
    color: #4A4A4A;
    min-height: 100px; /* Increased from 80px to match image height */
    display: flex;
    align-items: center;
    justify-content: center;
}

#draw-lines-game-view .image-item.connected, 
#draw-lines-game-view .word-item.connected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

#draw-lines-game-view .image-item.incorrect, 
#draw-lines-game-view .word-item.incorrect {
    border-color: #F44336;
    background: rgba(244, 67, 54, 0.1);
}

#draw-lines-game-view .image-item.selected, 
#draw-lines-game-view .word-item.selected {
    border-color: #FF6B35;
    background: rgba(255, 107, 53, 0.2);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
    transition: all 0.2s ease;
}

.draw-lines-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.draw-lines-controls .game-button {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8E53 100%);
    border: none;
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.draw-lines-controls .game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.draw-lines-controls .game-button:active {
    transform: translateY(0);
}

/* Canvas for drawing lines */
.draw-lines-game-area {
    position: relative;
}

.draw-lines-game-area canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.image-item, .word-item {
    position: relative;
    z-index: 2;
}

/* Responsive design for draw lines game */
@media (max-width: 768px) {
    .draw-lines-game-area {
        flex-direction: column;
        gap: 20px;
    }
    
    .images-row, .words-row {
        width: 100%;
    }
    
    .image-item, .word-item {
        min-width: 100px;
    }
    
    .draw-lines-controls {
        flex-direction: column;
        align-items: center;
    }
}

/* Force horizontal layout for draw lines game */
#draw-lines-game-view .draw-lines-game-area {
    display: flex !important;
    flex-direction: column !important;
    gap: 40px;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 400px; /* Ensure enough height for two rows */
}

#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
    min-height: 120px; /* Ensure consistent height */
}

#draw-lines-game-view .images-row {
    order: 1;
    background: rgba(255, 0, 0, 0.1); /* Debug: red tint for images row */
}

#draw-lines-game-view .words-row {
    order: 2;
    background: rgba(0, 255, 0, 0.1); /* Debug: green tint for words row */
}

/* Override any conflicting flexbox styles */
#draw-lines-game-view .images-row *,
#draw-lines-game-view .words-row * {
    flex-direction: row !important;
}

#draw-lines-game-view .images-container,
#draw-lines-game-view .words-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

/* Profile/Account Styling */
/* Note: Profile button styling moved to sticky-profile-button above */

/* Profile View Styling */
#profile-view {
    padding: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.profile-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    border: 2px solid #f0f0f0;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.profile-header h1 {
    color: #333;
    margin: 0;
    font-size: 2.2em;
}

.profile-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.profile-avatar-section {
    text-align: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #FF6B35;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-section h2 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 1.8em;
}

.profile-avatar-section p {
    color: #666;
    margin: 0;
    font-size: 1.2em;
}

.profile-form-section h3 {
    color: #333;
    margin: 0 0 20px 0;
    font-size: 1.5em;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
    font-size: 1.1em;
}

.profile-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.profile-input:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.profile-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.profile-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.cancel-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.profile-feedback {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    display: none;
}

.profile-feedback.success {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    border: 2px solid #4CAF50;
}

.profile-feedback.error {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
    border: 2px solid #f44336;
}

/* Responsive Design for Profile */
@media (max-width: 768px) {
    .profile-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .profile-container {
        padding: 20px;
        margin: 20px;
    }
    
    .profile-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .profile-actions {
        flex-direction: column;
    }
}

/* Profile Display on Homepage and Profile Creation */
.profile-display {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.profile-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #FF6B35;
}

.avatar-small {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#homescreen-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.1em;
}

/* Profile Creation Page Profile Display */
.profile-display-top {
    margin-bottom: 30px;
    text-align: center;
}

.profile-info-display {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.profile-avatar-display {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #FF6B35;
}

.avatar-display {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#profile-creation-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.2em;
}

/* Match Word Game View */
#match-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
}

#match-word-game-view h1#match-word-title {
    color: #333;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    font-size: 3em;
}

.match-word-image-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#match-word-item-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border: 3px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.match-word-choices-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    min-width: 250px;
}

/* Write Word Game View */
#write-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
    position: relative;
}

.write-word-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 140px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.write-word-koala:hover {
    transform: scale(1.05);
}

#write-word-game-view h1#write-word-title {
    color: #333; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 30px; 
    font-size: clamp(2em, 6vw, 3em);
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    max-width: 100%;
}

#write-word-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#write-word-prompt-text {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 10px;
}
#write-word-prompt-text strong {
    font-size: 1.5em; /* Make the word to write bigger */
    color: #185a9d; /* Blue for the word */
    display: block; /* Put word on new line if desired */
    margin-top: 5px;
    letter-spacing: 2px; /* Space out letters */
}

#write-word-input-text {
    font-size: 1.5em;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #ccc;
    text-align: center;
    width: 80%;
    max-width: 300px;
}
#write-word-input-text:focus {
    outline: none;
    border-color: #4A90E2; /* Blue focus */
}

#write-word-submit-btn {
    font-size: 1.2em;
    padding: 12px 25px;
    background-color: #A1C96C; /* Green button */
    color: white;
    /* Inherits general button styles for hover etc. if you have a common .button class */
}
/* Image Analyzer View */
#image-analyzer-view {
    padding: 20px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

#image-analyzer-view h1 {
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.27);
  font-size: 2.4em;
  margin-bottom: 32px;
}

.analyzer-main-flex, #analyzer-main-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 48px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 24px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.07);
  padding: 38px 40px;
}

.analyzer-left-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  max-width: 420px;
  min-width: 260px;
}

.analyzer-right-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 0;
  max-width: 550px;
  min-width: 300px;
  justify-content: flex-start;
}
#analyzer-video-feed {
  width: 100%;
  max-width: 340px;
  height: 300px;
  background: #222;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
}

.analyzer-btn-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: auto;
}

.analyzer-btn {
  font-size: 1.1em;
  padding: 12px 26px;
  border: none;
  border-radius: 20px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}
.analyzer-btn-blue { background: #8D6ECF; }
.analyzer-btn-blue:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-green { background: #8D6ECF; }
.analyzer-btn-green:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-purple { background: #8D6ECF; }
.analyzer-btn-purple:hover { background: #7a5bb8; transform: translateY(-2px); }

.analyzer-status {
  min-height: 1.4em;
  margin-top: 8px;
  color: #2678b5;
  font-size: 1em;
  text-align: center;
}

.analyzer-output-wrapper {
  background: #fff;
  border-radius: 18px;
  border: 2px solid #dadada;
  padding: 24px 18px 16px 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.07);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 340px;
}

.analyzer-output-wrapper h2 {
  font-family: inherit;
  color: #1c3456;
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 14px;
  text-align: left;
  letter-spacing: 0.5px;
}

.analyzer-text-output, #analyzer-text-output {
  font-family: var(--font-primary);
  font-size: 1.12em;
  min-height: 245px;
  border: none;
  background: #f8f8fa;
  color: #303050;
  border-radius: 10px;
  resize: none;
  padding: 14px 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  margin-bottom: 0;
  outline: none;
  white-space: pre-line;
}

.back-to-games-btn {
  margin: 30px auto 0 auto;
  display: block;
}

@media (max-width: 900px) {
  .analyzer-main-flex, #analyzer-main-content {
    flex-direction: column;
    padding: 18px 4vw;
    gap: 18px;
  }
  .analyzer-left-pane, .analyzer-right-pane {
    max-width: 98vw;
    min-width: unset;
  }
  #analyzer-video-feed {
    max-width: 95vw;
    height: 32vw;
    min-height: 100px;
  }
}
.analyzer-text-output, #analyzer-text-output {
  overflow-y: auto;
  max-height: 260px;
}
.kai-gif-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  transition: transform 0.09s;
}
.kai-gif-btn:hover,
.kai-gif-btn:focus {
  transform: scale(1.06);
}
.kai-gif {
  height: auto;
  display: block;
}


#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

#draw-lines-game-view .images-row {
    order: 1;
}

#draw-lines-game-view .words-row {
    order: 2;
}

#draw-lines-game-view .image-item, 
#draw-lines-game-view .word-item {
    position: relative;
    background: white;
    border: 3px solid #EADDC7;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    flex-shrink: 0;
    margin: 5px;
}

#draw-lines-game-view .image-item {
    padding: 15px; /* Add padding back for proper spacing */
    overflow: visible; /* Allow normal overflow */
    min-width: 130px; /* Ensure cards are wide enough for images + padding */
    min-height: 130px; /* Ensure cards are tall enough for images + padding */
}

#draw-lines-game-view .word-item {
    padding: 15px; /* Keep padding for word cards */
}

#draw-lines-game-view .image-item:hover, 
#draw-lines-game-view .word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #FF6B35;
}

#draw-lines-game-view .image-item img {
    width: 100px;  /* Fixed size that fits inside cards */
    height: 100px; /* Fixed size that fits inside cards */
    object-fit: contain; /* Fit image within bounds, maintain aspect ratio */
    border-radius: 10px;
    display: block; /* Remove any inline spacing */
}

#draw-lines-game-view .word-item {
    font-size: 1.4em;  /* Increased from 1.2em */
    font-weight: bold;
    color: #4A4A4A;
    min-height: 100px; /* Increased from 80px to match image height */
    display: flex;
    align-items: center;
    justify-content: center;
}

#draw-lines-game-view .image-item.connected, 
#draw-lines-game-view .word-item.connected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

#draw-lines-game-view .image-item.incorrect, 
#draw-lines-game-view .word-item.incorrect {
    border-color: #F44336;
    background: rgba(244, 67, 54, 0.1);
}

#draw-lines-game-view .image-item.selected, 
#draw-lines-game-view .word-item.selected {
    border-color: #FF6B35;
    background: rgba(255, 107, 53, 0.2);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
    transition: all 0.2s ease;
}

.draw-lines-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.draw-lines-controls .game-button {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8E53 100%);
    border: none;
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.draw-lines-controls .game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.draw-lines-controls .game-button:active {
    transform: translateY(0);
}

/* Canvas for drawing lines */
.draw-lines-game-area {
    position: relative;
}

.draw-lines-game-area canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.image-item, .word-item {
    position: relative;
    z-index: 2;
}

/* Responsive design for draw lines game */
@media (max-width: 768px) {
    .draw-lines-game-area {
        flex-direction: column;
        gap: 20px;
    }
    
    .images-row, .words-row {
        width: 100%;
    }
    
    .image-item, .word-item {
        min-width: 100px;
    }
    
    .draw-lines-controls {
        flex-direction: column;
        align-items: center;
    }
}

/* Force horizontal layout for draw lines game */
#draw-lines-game-view .draw-lines-game-area {
    display: flex !important;
    flex-direction: column !important;
    gap: 40px;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 400px; /* Ensure enough height for two rows */
}

#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
    min-height: 120px; /* Ensure consistent height */
}

#draw-lines-game-view .images-row {
    order: 1;
    background: rgba(255, 0, 0, 0.1); /* Debug: red tint for images row */
}

#draw-lines-game-view .words-row {
    order: 2;
    background: rgba(0, 255, 0, 0.1); /* Debug: green tint for words row */
}

/* Override any conflicting flexbox styles */
#draw-lines-game-view .images-row *,
#draw-lines-game-view .words-row * {
    flex-direction: row !important;
}

#draw-lines-game-view .images-container,
#draw-lines-game-view .words-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

/* Profile/Account Styling */
/* Note: Profile button styling moved to sticky-profile-button above */

/* Profile View Styling */
#profile-view {
    padding: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.profile-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    border: 2px solid #f0f0f0;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.profile-header h1 {
    color: #333;
    margin: 0;
    font-size: 2.2em;
}

.profile-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.profile-avatar-section {
    text-align: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #FF6B35;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-section h2 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 1.8em;
}

.profile-avatar-section p {
    color: #666;
    margin: 0;
    font-size: 1.2em;
}

.profile-form-section h3 {
    color: #333;
    margin: 0 0 20px 0;
    font-size: 1.5em;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
    font-size: 1.1em;
}

.profile-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.profile-input:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.profile-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.profile-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.cancel-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.profile-feedback {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    display: none;
}

.profile-feedback.success {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    border: 2px solid #4CAF50;
}

.profile-feedback.error {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
    border: 2px solid #f44336;
}

/* Responsive Design for Profile */
@media (max-width: 768px) {
    .profile-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .profile-container {
        padding: 20px;
        margin: 20px;
    }
    
    .profile-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .profile-actions {
        flex-direction: column;
    }
}

/* Profile Display on Homepage and Profile Creation */
.profile-display {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.profile-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #FF6B35;
}

.avatar-small {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#homescreen-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.1em;
}

/* Profile Creation Page Profile Display */
.profile-display-top {
    margin-bottom: 30px;
    text-align: center;
}

.profile-info-display {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.profile-avatar-display {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #FF6B35;
}

.avatar-display {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#profile-creation-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.2em;
}

/* Match Word Game View */
#match-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
}

#match-word-game-view h1#match-word-title {
    color: #333;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    font-size: 3em;
}

.match-word-image-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#match-word-item-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border: 3px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.match-word-choices-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    min-width: 250px;
}

/* Write Word Game View */
#write-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
    position: relative;
}

.write-word-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 140px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.write-word-koala:hover {
    transform: scale(1.05);
}

#write-word-game-view h1#write-word-title {
    color: #333; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 30px; 
    font-size: clamp(2em, 6vw, 3em);
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    max-width: 100%;
}

#write-word-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#write-word-prompt-text {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 10px;
}
#write-word-prompt-text strong {
    font-size: 1.5em; /* Make the word to write bigger */
    color: #185a9d; /* Blue for the word */
    display: block; /* Put word on new line if desired */
    margin-top: 5px;
    letter-spacing: 2px; /* Space out letters */
}

#write-word-input-text {
    font-size: 1.5em;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #ccc;
    text-align: center;
    width: 80%;
    max-width: 300px;
}
#write-word-input-text:focus {
    outline: none;
    border-color: #4A90E2; /* Blue focus */
}

#write-word-submit-btn {
    font-size: 1.2em;
    padding: 12px 25px;
    background-color: #A1C96C; /* Green button */
    color: white;
    /* Inherits general button styles for hover etc. if you have a common .button class */
}
/* Image Analyzer View */
#image-analyzer-view {
    padding: 20px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

#image-analyzer-view h1 {
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.27);
  font-size: 2.4em;
  margin-bottom: 32px;
}

.analyzer-main-flex, #analyzer-main-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 48px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 24px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.07);
  padding: 38px 40px;
}

.analyzer-left-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  max-width: 420px;
  min-width: 260px;
}
.analyzer-right-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 0;
  max-width: 550px;
  min-width: 300px;
  justify-content: flex-start;
}

#analyzer-video-feed {
  width: 100%;
  max-width: 340px;
  height: 300px;
  background: #222;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
}

.analyzer-btn-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: auto;
}

.analyzer-btn {
  font-size: 1.1em;
  padding: 12px 26px;
  border: none;
  border-radius: 20px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}
.analyzer-btn-blue { background: #8D6ECF; }
.analyzer-btn-blue:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-green { background: #8D6ECF; }
.analyzer-btn-green:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-purple { background: #8D6ECF; }
.analyzer-btn-purple:hover { background: #7a5bb8; transform: translateY(-2px); }

.analyzer-status {
  min-height: 1.4em;
  margin-top: 8px;
  color: #2678b5;
  font-size: 1em;
  text-align: center;
}

.analyzer-output-wrapper {
  background: #fff;
  border-radius: 18px;
  border: 2px solid #dadada;
  padding: 24px 18px 16px 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.07);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 340px;
}

.analyzer-output-wrapper h2 {
  font-family: inherit;
  color: #1c3456;
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 14px;
  text-align: left;
  letter-spacing: 0.5px;
}

.analyzer-text-output, #analyzer-text-output {
  font-family: var(--font-primary);
  font-size: 1.12em;
  min-height: 245px;
  border: none;
  background: #f8f8fa;
  color: #303050;
  border-radius: 10px;
  resize: none;
  padding: 14px 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  margin-bottom: 0;
  outline: none;
  white-space: pre-line;
}

.back-to-games-btn {
  margin: 30px auto 0 auto;
  display: block;
}

@media (max-width: 900px) {
  .analyzer-main-flex, #analyzer-main-content {
    flex-direction: column;
    padding: 18px 4vw;
    gap: 18px;
  }
  .analyzer-left-pane, .analyzer-right-pane {
    max-width: 98vw;
    min-width: unset;
  }
  #analyzer-video-feed {
    max-width: 95vw;
    height: 32vw;
    min-height: 100px;
  }
}
.analyzer-text-output, #analyzer-text-output {
  overflow-y: auto;
  max-height: 260px;
}
.kai-gif-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  transition: transform 0.09s;
}
.kai-gif-btn:hover,
.kai-gif-btn:focus {
  transform: scale(1.06);
}
.kai-gif {
  height: auto;
  display: block;
}


#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

#draw-lines-game-view .images-row {
    order: 1;
}

#draw-lines-game-view .words-row {
    order: 2;
}

#draw-lines-game-view .image-item, 
#draw-lines-game-view .word-item {
    position: relative;
    background: white;
    border: 3px solid #EADDC7;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    flex-shrink: 0;
    margin: 5px;
}

#draw-lines-game-view .image-item {
    padding: 15px; /* Add padding back for proper spacing */
    overflow: visible; /* Allow normal overflow */
    min-width: 130px; /* Ensure cards are wide enough for images + padding */
    min-height: 130px; /* Ensure cards are tall enough for images + padding */
}

#draw-lines-game-view .word-item {
    padding: 15px; /* Keep padding for word cards */
}

#draw-lines-game-view .image-item:hover, 
#draw-lines-game-view .word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #FF6B35;
}

#draw-lines-game-view .image-item img {
    width: 100px;  /* Fixed size that fits inside cards */
    height: 100px; /* Fixed size that fits inside cards */
    object-fit: contain; /* Fit image within bounds, maintain aspect ratio */
    border-radius: 10px;
    display: block; /* Remove any inline spacing */
}

#draw-lines-game-view .word-item {
    font-size: 1.4em;  /* Increased from 1.2em */
    font-weight: bold;
    color: #4A4A4A;
    min-height: 100px; /* Increased from 80px to match image height */
    display: flex;
    align-items: center;
    justify-content: center;
}

#draw-lines-game-view .image-item.connected, 
#draw-lines-game-view .word-item.connected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

#draw-lines-game-view .image-item.incorrect, 
#draw-lines-game-view .word-item.incorrect {
    border-color: #F44336;
    background: rgba(244, 67, 54, 0.1);
}

#draw-lines-game-view .image-item.selected, 
#draw-lines-game-view .word-item.selected {
    border-color: #FF6B35;
    background: rgba(255, 107, 53, 0.2);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
    transition: all 0.2s ease;
}

.draw-lines-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.draw-lines-controls .game-button {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8E53 100%);
    border: none;
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.draw-lines-controls .game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.draw-lines-controls .game-button:active {
    transform: translateY(0);
}

/* Canvas for drawing lines */
.draw-lines-game-area {
    position: relative;
}

.draw-lines-game-area canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.image-item, .word-item {
    position: relative;
    z-index: 2;
}

/* Responsive design for draw lines game */
@media (max-width: 768px) {
    .draw-lines-game-area {
        flex-direction: column;
        gap: 20px;
    }
    
    .images-row, .words-row {
        width: 100%;
    }
    
    .image-item, .word-item {
        min-width: 100px;
    }
    
    .draw-lines-controls {
        flex-direction: column;
        align-items: center;
    }
}

/* Force horizontal layout for draw lines game */
#draw-lines-game-view .draw-lines-game-area {
    display: flex !important;
    flex-direction: column !important;
    gap: 40px;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 400px; /* Ensure enough height for two rows */
}

#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
    min-height: 120px; /* Ensure consistent height */
}

#draw-lines-game-view .images-row {
    order: 1;
    background: rgba(255, 0, 0, 0.1); /* Debug: red tint for images row */
}

#draw-lines-game-view .words-row {
    order: 2;
    background: rgba(0, 255, 0, 0.1); /* Debug: green tint for words row */
}

/* Override any conflicting flexbox styles */
#draw-lines-game-view .images-row *,
#draw-lines-game-view .words-row * {
    flex-direction: row !important;
}

#draw-lines-game-view .images-container,
#draw-lines-game-view .words-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

/* Profile/Account Styling */
/* Note: Profile button styling moved to sticky-profile-button above */

/* Profile View Styling */
#profile-view {
    padding: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.profile-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    border: 2px solid #f0f0f0;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.profile-header h1 {
    color: #333;
    margin: 0;
    font-size: 2.2em;
}

.profile-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.profile-avatar-section {
    text-align: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #FF6B35;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-section h2 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 1.8em;
}

.profile-avatar-section p {
    color: #666;
    margin: 0;
    font-size: 1.2em;
}

.profile-form-section h3 {
    color: #333;
    margin: 0 0 20px 0;
    font-size: 1.5em;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
    font-size: 1.1em;
}

.profile-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.profile-input:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.profile-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.profile-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.cancel-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.profile-feedback {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    display: none;
}

.profile-feedback.success {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    border: 2px solid #4CAF50;
}

.profile-feedback.error {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
    border: 2px solid #f44336;
}

/* Responsive Design for Profile */
@media (max-width: 768px) {
    .profile-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .profile-container {
        padding: 20px;
        margin: 20px;
    }
    
    .profile-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .profile-actions {
        flex-direction: column;
    }
}

/* Profile Display on Homepage and Profile Creation */
.profile-display {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.profile-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #FF6B35;
}

.avatar-small {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#homescreen-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.1em;
}

/* Profile Creation Page Profile Display */
.profile-display-top {
    margin-bottom: 30px;
    text-align: center;
}

.profile-info-display {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.profile-avatar-display {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #FF6B35;
}

.avatar-display {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#profile-creation-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.2em;
}

/* Match Word Game View */
#match-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
}

#match-word-game-view h1#match-word-title {
    color: #333;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    font-size: 3em;
}

.match-word-image-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#match-word-item-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border: 3px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.match-word-choices-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    min-width: 250px;
}

/* Write Word Game View */
#write-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
    position: relative;
}

.write-word-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 140px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.write-word-koala:hover {
    transform: scale(1.05);
}

#write-word-game-view h1#write-word-title {
    color: #333; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 30px; 
    font-size: clamp(2em, 6vw, 3em);
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    max-width: 100%;
}

#write-word-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#write-word-prompt-text {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 10px;
}
#write-word-prompt-text strong {
    font-size: 1.5em; /* Make the word to write bigger */
    color: #185a9d; /* Blue for the word */
    display: block; /* Put word on new line if desired */
    margin-top: 5px;
    letter-spacing: 2px; /* Space out letters */
}

#write-word-input-text {
    font-size: 1.5em;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #ccc;
    text-align: center;
    width: 80%;
    max-width: 300px;
}
#write-word-input-text:focus {
    outline: none;
    border-color: #4A90E2; /* Blue focus */
}

#write-word-submit-btn {
    font-size: 1.2em;
    padding: 12px 25px;
    background-color: #A1C96C; /* Green button */
    color: white;
    /* Inherits general button styles for hover etc. if you have a common .button class */
}
/* Image Analyzer View */
#image-analyzer-view {
    padding: 20px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

#image-analyzer-view h1 {
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.27);
  font-size: 2.4em;
  margin-bottom: 32px;
}

.analyzer-main-flex, #analyzer-main-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 48px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 24px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.07);
  padding: 38px 40px;
}
.analyzer-left-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  max-width: 420px;
  min-width: 260px;
}

.analyzer-right-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 0;
  max-width: 550px;
  min-width: 300px;
  justify-content: flex-start;
}

#analyzer-video-feed {
  width: 100%;
  max-width: 340px;
  height: 300px;
  background: #222;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
}

.analyzer-btn-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: auto;
}

.analyzer-btn {
  font-size: 1.1em;
  padding: 12px 26px;
  border: none;
  border-radius: 20px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}
.analyzer-btn-blue { background: #8D6ECF; }
.analyzer-btn-blue:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-green { background: #8D6ECF; }
.analyzer-btn-green:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-purple { background: #8D6ECF; }
.analyzer-btn-purple:hover { background: #7a5bb8; transform: translateY(-2px); }

.analyzer-status {
  min-height: 1.4em;
  margin-top: 8px;
  color: #2678b5;
  font-size: 1em;
  text-align: center;
}

.analyzer-output-wrapper {
  background: #fff;
  border-radius: 18px;
  border: 2px solid #dadada;
  padding: 24px 18px 16px 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.07);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 340px;
}

.analyzer-output-wrapper h2 {
  font-family: inherit;
  color: #1c3456;
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 14px;
  text-align: left;
  letter-spacing: 0.5px;
}

.analyzer-text-output, #analyzer-text-output {
  font-family: var(--font-primary);
  font-size: 1.12em;
  min-height: 245px;
  border: none;
  background: #f8f8fa;
  color: #303050;
  border-radius: 10px;
  resize: none;
  padding: 14px 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  margin-bottom: 0;
  outline: none;
  white-space: pre-line;
}

.back-to-games-btn {
  margin: 30px auto 0 auto;
  display: block;
}

@media (max-width: 900px) {
  .analyzer-main-flex, #analyzer-main-content {
    flex-direction: column;
    padding: 18px 4vw;
    gap: 18px;
  }
  .analyzer-left-pane, .analyzer-right-pane {
    max-width: 98vw;
    min-width: unset;
  }
  #analyzer-video-feed {
    max-width: 95vw;
    height: 32vw;
    min-height: 100px;
  }
}
.analyzer-text-output, #analyzer-text-output {
  overflow-y: auto;
  max-height: 260px;
}
.kai-gif-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  transition: transform 0.09s;
}
.kai-gif-btn:hover,
.kai-gif-btn:focus {
  transform: scale(1.06);
}
.kai-gif {
  height: auto;
  display: block;
}


#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

#draw-lines-game-view .images-row {
    order: 1;
}

#draw-lines-game-view .words-row {
    order: 2;
}

#draw-lines-game-view .image-item, 
#draw-lines-game-view .word-item {
    position: relative;
    background: white;
    border: 3px solid #EADDC7;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    flex-shrink: 0;
    margin: 5px;
}

#draw-lines-game-view .image-item {
    padding: 15px; /* Add padding back for proper spacing */
    overflow: visible; /* Allow normal overflow */
    min-width: 130px; /* Ensure cards are wide enough for images + padding */
    min-height: 130px; /* Ensure cards are tall enough for images + padding */
}

#draw-lines-game-view .word-item {
    padding: 15px; /* Keep padding for word cards */
}

#draw-lines-game-view .image-item:hover, 
#draw-lines-game-view .word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #FF6B35;
}

#draw-lines-game-view .image-item img {
    width: 100px;  /* Fixed size that fits inside cards */
    height: 100px; /* Fixed size that fits inside cards */
    object-fit: contain; /* Fit image within bounds, maintain aspect ratio */
    border-radius: 10px;
    display: block; /* Remove any inline spacing */
}

#draw-lines-game-view .word-item {
    font-size: 1.4em;  /* Increased from 1.2em */
    font-weight: bold;
    color: #4A4A4A;
    min-height: 100px; /* Increased from 80px to match image height */
    display: flex;
    align-items: center;
    justify-content: center;
}

#draw-lines-game-view .image-item.connected, 
#draw-lines-game-view .word-item.connected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

#draw-lines-game-view .image-item.incorrect, 
#draw-lines-game-view .word-item.incorrect {
    border-color: #F44336;
    background: rgba(244, 67, 54, 0.1);
}

#draw-lines-game-view .image-item.selected, 
#draw-lines-game-view .word-item.selected {
    border-color: #FF6B35;
    background: rgba(255, 107, 53, 0.2);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
    transition: all 0.2s ease;
}

.draw-lines-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.draw-lines-controls .game-button {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8E53 100%);
    border: none;
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.draw-lines-controls .game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.draw-lines-controls .game-button:active {
    transform: translateY(0);
}

/* Canvas for drawing lines */
.draw-lines-game-area {
    position: relative;
}

.draw-lines-game-area canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.image-item, .word-item {
    position: relative;
    z-index: 2;
}

/* Responsive design for draw lines game */
@media (max-width: 768px) {
    .draw-lines-game-area {
        flex-direction: column;
        gap: 20px;
    }
    
    .images-row, .words-row {
        width: 100%;
    }
    
    .image-item, .word-item {
        min-width: 100px;
    }
    
    .draw-lines-controls {
        flex-direction: column;
        align-items: center;
    }
}

/* Force horizontal layout for draw lines game */
#draw-lines-game-view .draw-lines-game-area {
    display: flex !important;
    flex-direction: column !important;
    gap: 40px;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 400px; /* Ensure enough height for two rows */
}

#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
    min-height: 120px; /* Ensure consistent height */
}

#draw-lines-game-view .images-row {
    order: 1;
    background: rgba(255, 0, 0, 0.1); /* Debug: red tint for images row */
}

#draw-lines-game-view .words-row {
    order: 2;
    background: rgba(0, 255, 0, 0.1); /* Debug: green tint for words row */
}

/* Override any conflicting flexbox styles */
#draw-lines-game-view .images-row *,
#draw-lines-game-view .words-row * {
    flex-direction: row !important;
}

#draw-lines-game-view .images-container,
#draw-lines-game-view .words-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

/* Profile/Account Styling */
/* Note: Profile button styling moved to sticky-profile-button above */

/* Profile View Styling */
#profile-view {
    padding: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.profile-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    border: 2px solid #f0f0f0;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.profile-header h1 {
    color: #333;
    margin: 0;
    font-size: 2.2em;
}

.profile-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.profile-avatar-section {
    text-align: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #FF6B35;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-section h2 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 1.8em;
}

.profile-avatar-section p {
    color: #666;
    margin: 0;
    font-size: 1.2em;
}

.profile-form-section h3 {
    color: #333;
    margin: 0 0 20px 0;
    font-size: 1.5em;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
    font-size: 1.1em;
}

.profile-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.profile-input:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.profile-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.profile-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.cancel-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.profile-feedback {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    display: none;
}

.profile-feedback.success {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    border: 2px solid #4CAF50;
}

.profile-feedback.error {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
    border: 2px solid #f44336;
}

/* Responsive Design for Profile */
@media (max-width: 768px) {
    .profile-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .profile-container {
        padding: 20px;
        margin: 20px;
    }
    
    .profile-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .profile-actions {
        flex-direction: column;
    }
}

/* Profile Display on Homepage and Profile Creation */
.profile-display {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.profile-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #FF6B35;
}

.avatar-small {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#homescreen-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.1em;
}

/* Profile Creation Page Profile Display */
.profile-display-top {
    margin-bottom: 30px;
    text-align: center;
}

.profile-info-display {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.profile-avatar-display {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #FF6B35;
}

.avatar-display {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#profile-creation-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.2em;
}

/* Match Word Game View */
#match-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
}

#match-word-game-view h1#match-word-title {
    color: #333;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    font-size: 3em;
}

.match-word-image-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#match-word-item-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border: 3px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.match-word-choices-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    min-width: 250px;
}

/* Write Word Game View */
#write-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
    position: relative;
}

.write-word-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 140px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.write-word-koala:hover {
    transform: scale(1.05);
}

#write-word-game-view h1#write-word-title {
    color: #333; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 30px; 
    font-size: clamp(2em, 6vw, 3em);
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    max-width: 100%;
}

#write-word-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#write-word-prompt-text {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 10px;
}
#write-word-prompt-text strong {
    font-size: 1.5em; /* Make the word to write bigger */
    color: #185a9d; /* Blue for the word */
    display: block; /* Put word on new line if desired */
    margin-top: 5px;
    letter-spacing: 2px; /* Space out letters */
}

#write-word-input-text {
    font-size: 1.5em;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #ccc;
    text-align: center;
    width: 80%;
    max-width: 300px;
}
#write-word-input-text:focus {
    outline: none;
    border-color: #4A90E2; /* Blue focus */
}

#write-word-submit-btn {
    font-size: 1.2em;
    padding: 12px 25px;
    background-color: #A1C96C; /* Green button */
    color: white;
    /* Inherits general button styles for hover etc. if you have a common .button class */
}
/* Image Analyzer View */
#image-analyzer-view {
    padding: 20px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

#image-analyzer-view h1 {
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.27);
  font-size: 2.4em;
  margin-bottom: 32px;
}
.analyzer-main-flex, #analyzer-main-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 48px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 24px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.07);
  padding: 38px 40px;
}

.analyzer-left-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  max-width: 420px;
  min-width: 260px;
}

.analyzer-right-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 0;
  max-width: 550px;
  min-width: 300px;
  justify-content: flex-start;
}

#analyzer-video-feed {
  width: 100%;
  max-width: 340px;
  height: 300px;
  background: #222;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
}

.analyzer-btn-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: auto;
}

.analyzer-btn {
  font-size: 1.1em;
  padding: 12px 26px;
  border: none;
  border-radius: 20px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}
.analyzer-btn-blue { background: #8D6ECF; }
.analyzer-btn-blue:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-green { background: #8D6ECF; }
.analyzer-btn-green:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-purple { background: #8D6ECF; }
.analyzer-btn-purple:hover { background: #7a5bb8; transform: translateY(-2px); }

.analyzer-status {
  min-height: 1.4em;
  margin-top: 8px;
  color: #2678b5;
  font-size: 1em;
  text-align: center;
}

.analyzer-output-wrapper {
  background: #fff;
  border-radius: 18px;
  border: 2px solid #dadada;
  padding: 24px 18px 16px 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.07);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 340px;
}

.analyzer-output-wrapper h2 {
  font-family: inherit;
  color: #1c3456;
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 14px;
  text-align: left;
  letter-spacing: 0.5px;
}

.analyzer-text-output, #analyzer-text-output {
  font-family: var(--font-primary);
  font-size: 1.12em;
  min-height: 245px;
  border: none;
  background: #f8f8fa;
  color: #303050;
  border-radius: 10px;
  resize: none;
  padding: 14px 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  margin-bottom: 0;
  outline: none;
  white-space: pre-line;
}

.back-to-games-btn {
  margin: 30px auto 0 auto;
  display: block;
}

@media (max-width: 900px) {
  .analyzer-main-flex, #analyzer-main-content {
    flex-direction: column;
    padding: 18px 4vw;
    gap: 18px;
  }
  .analyzer-left-pane, .analyzer-right-pane {
    max-width: 98vw;
    min-width: unset;
  }
  #analyzer-video-feed {
    max-width: 95vw;
    height: 32vw;
    min-height: 100px;
  }
}
.analyzer-text-output, #analyzer-text-output {
  overflow-y: auto;
  max-height: 260px;
}
.kai-gif-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  transition: transform 0.09s;
}
.kai-gif-btn:hover,
.kai-gif-btn:focus {
  transform: scale(1.06);
}
.kai-gif {
  height: auto;
  display: block;
}


#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

#draw-lines-game-view .images-row {
    order: 1;
}

#draw-lines-game-view .words-row {
    order: 2;
}

#draw-lines-game-view .image-item, 
#draw-lines-game-view .word-item {
    position: relative;
    background: white;
    border: 3px solid #EADDC7;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    flex-shrink: 0;
    margin: 5px;
}

#draw-lines-game-view .image-item {
    padding: 15px; /* Add padding back for proper spacing */
    overflow: visible; /* Allow normal overflow */
    min-width: 130px; /* Ensure cards are wide enough for images + padding */
    min-height: 130px; /* Ensure cards are tall enough for images + padding */
}

#draw-lines-game-view .word-item {
    padding: 15px; /* Keep padding for word cards */
}

#draw-lines-game-view .image-item:hover, 
#draw-lines-game-view .word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #FF6B35;
}

#draw-lines-game-view .image-item img {
    width: 100px;  /* Fixed size that fits inside cards */
    height: 100px; /* Fixed size that fits inside cards */
    object-fit: contain; /* Fit image within bounds, maintain aspect ratio */
    border-radius: 10px;
    display: block; /* Remove any inline spacing */
}

#draw-lines-game-view .word-item {
    font-size: 1.4em;  /* Increased from 1.2em */
    font-weight: bold;
    color: #4A4A4A;
    min-height: 100px; /* Increased from 80px to match image height */
    display: flex;
    align-items: center;
    justify-content: center;
}

#draw-lines-game-view .image-item.connected, 
#draw-lines-game-view .word-item.connected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

#draw-lines-game-view .image-item.incorrect, 
#draw-lines-game-view .word-item.incorrect {
    border-color: #F44336;
    background: rgba(244, 67, 54, 0.1);
}

#draw-lines-game-view .image-item.selected, 
#draw-lines-game-view .word-item.selected {
    border-color: #FF6B35;
    background: rgba(255, 107, 53, 0.2);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
    transition: all 0.2s ease;
}

.draw-lines-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.draw-lines-controls .game-button {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8E53 100%);
    border: none;
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.draw-lines-controls .game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.draw-lines-controls .game-button:active {
    transform: translateY(0);
}

/* Canvas for drawing lines */
.draw-lines-game-area {
    position: relative;
}

.draw-lines-game-area canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.image-item, .word-item {
    position: relative;
    z-index: 2;
}

/* Responsive design for draw lines game */
@media (max-width: 768px) {
    .draw-lines-game-area {
        flex-direction: column;
        gap: 20px;
    }
    
    .images-row, .words-row {
        width: 100%;
    }
    
    .image-item, .word-item {
        min-width: 100px;
    }
    
    .draw-lines-controls {
        flex-direction: column;
        align-items: center;
    }
}

/* Force horizontal layout for draw lines game */
#draw-lines-game-view .draw-lines-game-area {
    display: flex !important;
    flex-direction: column !important;
    gap: 40px;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 400px; /* Ensure enough height for two rows */
}

#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
    min-height: 120px; /* Ensure consistent height */
}

#draw-lines-game-view .images-row {
    order: 1;
    background: rgba(255, 0, 0, 0.1); /* Debug: red tint for images row */
}

#draw-lines-game-view .words-row {
    order: 2;
    background: rgba(0, 255, 0, 0.1); /* Debug: green tint for words row */
}

/* Override any conflicting flexbox styles */
#draw-lines-game-view .images-row *,
#draw-lines-game-view .words-row * {
    flex-direction: row !important;
}

#draw-lines-game-view .images-container,
#draw-lines-game-view .words-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

/* Profile/Account Styling */
/* Note: Profile button styling moved to sticky-profile-button above */

/* Profile View Styling */
#profile-view {
    padding: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.profile-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    border: 2px solid #f0f0f0;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.profile-header h1 {
    color: #333;
    margin: 0;
    font-size: 2.2em;
}

.profile-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.profile-avatar-section {
    text-align: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #FF6B35;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-section h2 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 1.8em;
}

.profile-avatar-section p {
    color: #666;
    margin: 0;
    font-size: 1.2em;
}

.profile-form-section h3 {
    color: #333;
    margin: 0 0 20px 0;
    font-size: 1.5em;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
    font-size: 1.1em;
}

.profile-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.profile-input:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.profile-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.profile-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.cancel-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.profile-feedback {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    display: none;
}

.profile-feedback.success {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    border: 2px solid #4CAF50;
}

.profile-feedback.error {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
    border: 2px solid #f44336;
}

/* Responsive Design for Profile */
@media (max-width: 768px) {
    .profile-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .profile-container {
        padding: 20px;
        margin: 20px;
    }
    
    .profile-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .profile-actions {
        flex-direction: column;
    }
}

/* Profile Display on Homepage and Profile Creation */
.profile-display {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.profile-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #FF6B35;
}

.avatar-small {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#homescreen-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.1em;
}

/* Profile Creation Page Profile Display */
.profile-display-top {
    margin-bottom: 30px;
    text-align: center;
}

.profile-info-display {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.profile-avatar-display {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #FF6B35;
}

.avatar-display {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#profile-creation-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.2em;
}

/* Match Word Game View */
#match-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
}

#match-word-game-view h1#match-word-title {
    color: #333;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    font-size: 3em;
}

.match-word-image-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#match-word-item-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border: 3px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.match-word-choices-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    min-width: 250px;
}

/* Write Word Game View */
#write-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
    position: relative;
}

.write-word-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 140px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.write-word-koala:hover {
    transform: scale(1.05);
}

#write-word-game-view h1#write-word-title {
    color: #333; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 30px; 
    font-size: clamp(2em, 6vw, 3em);
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    max-width: 100%;
}

#write-word-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#write-word-prompt-text {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 10px;
}
#write-word-prompt-text strong {
    font-size: 1.5em; /* Make the word to write bigger */
    color: #185a9d; /* Blue for the word */
    display: block; /* Put word on new line if desired */
    margin-top: 5px;
    letter-spacing: 2px; /* Space out letters */
}

#write-word-input-text {
    font-size: 1.5em;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #ccc;
    text-align: center;
    width: 80%;
    max-width: 300px;
}
#write-word-input-text:focus {
    outline: none;
    border-color: #4A90E2; /* Blue focus */
}

#write-word-submit-btn {
    font-size: 1.2em;
    padding: 12px 25px;
    background-color: #A1C96C; /* Green button */
    color: white;
    /* Inherits general button styles for hover etc. if you have a common .button class */
}
/* Image Analyzer View */
#image-analyzer-view {
    padding: 20px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}
#image-analyzer-view h1 {
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.27);
  font-size: 2.4em;
  margin-bottom: 32px;
}

.analyzer-main-flex, #analyzer-main-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 48px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 24px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.07);
  padding: 38px 40px;
}

.analyzer-left-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  max-width: 420px;
  min-width: 260px;
}

.analyzer-right-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 0;
  max-width: 550px;
  min-width: 300px;
  justify-content: flex-start;
}

#analyzer-video-feed {
  width: 100%;
  max-width: 340px;
  height: 300px;
  background: #222;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
}

.analyzer-btn-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: auto;
}

.analyzer-btn {
  font-size: 1.1em;
  padding: 12px 26px;
  border: none;
  border-radius: 20px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}
.analyzer-btn-blue { background: #8D6ECF; }
.analyzer-btn-blue:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-green { background: #8D6ECF; }
.analyzer-btn-green:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-purple { background: #8D6ECF; }
.analyzer-btn-purple:hover { background: #7a5bb8; transform: translateY(-2px); }

.analyzer-status {
  min-height: 1.4em;
  margin-top: 8px;
  color: #2678b5;
  font-size: 1em;
  text-align: center;
}

.analyzer-output-wrapper {
  background: #fff;
  border-radius: 18px;
  border: 2px solid #dadada;
  padding: 24px 18px 16px 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.07);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 340px;
}

.analyzer-output-wrapper h2 {
  font-family: inherit;
  color: #1c3456;
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 14px;
  text-align: left;
  letter-spacing: 0.5px;
}

.analyzer-text-output, #analyzer-text-output {
  font-family: var(--font-primary);
  font-size: 1.12em;
  min-height: 245px;
  border: none;
  background: #f8f8fa;
  color: #303050;
  border-radius: 10px;
  resize: none;
  padding: 14px 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  margin-bottom: 0;
  outline: none;
  white-space: pre-line;
}

.back-to-games-btn {
  margin: 30px auto 0 auto;
  display: block;
}

@media (max-width: 900px) {
  .analyzer-main-flex, #analyzer-main-content {
    flex-direction: column;
    padding: 18px 4vw;
    gap: 18px;
  }
  .analyzer-left-pane, .analyzer-right-pane {
    max-width: 98vw;
    min-width: unset;
  }
  #analyzer-video-feed {
    max-width: 95vw;
    height: 32vw;
    min-height: 100px;
  }
}
.analyzer-text-output, #analyzer-text-output {
  overflow-y: auto;
  max-height: 260px;
}
.kai-gif-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  transition: transform 0.09s;
}
.kai-gif-btn:hover,
.kai-gif-btn:focus {
  transform: scale(1.06);
}
.kai-gif {
  height: auto;
  display: block;
}


#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

#draw-lines-game-view .images-row {
    order: 1;
}

#draw-lines-game-view .words-row {
    order: 2;
}

#draw-lines-game-view .image-item, 
#draw-lines-game-view .word-item {
    position: relative;
    background: white;
    border: 3px solid #EADDC7;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    flex-shrink: 0;
    margin: 5px;
}

#draw-lines-game-view .image-item {
    padding: 15px; /* Add padding back for proper spacing */
    overflow: visible; /* Allow normal overflow */
    min-width: 130px; /* Ensure cards are wide enough for images + padding */
    min-height: 130px; /* Ensure cards are tall enough for images + padding */
}

#draw-lines-game-view .word-item {
    padding: 15px; /* Keep padding for word cards */
}

#draw-lines-game-view .image-item:hover, 
#draw-lines-game-view .word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #FF6B35;
}

#draw-lines-game-view .image-item img {
    width: 100px;  /* Fixed size that fits inside cards */
    height: 100px; /* Fixed size that fits inside cards */
    object-fit: contain; /* Fit image within bounds, maintain aspect ratio */
    border-radius: 10px;
    display: block; /* Remove any inline spacing */
}

#draw-lines-game-view .word-item {
    font-size: 1.4em;  /* Increased from 1.2em */
    font-weight: bold;
    color: #4A4A4A;
    min-height: 100px; /* Increased from 80px to match image height */
    display: flex;
    align-items: center;
    justify-content: center;
}

#draw-lines-game-view .image-item.connected, 
#draw-lines-game-view .word-item.connected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

#draw-lines-game-view .image-item.incorrect, 
#draw-lines-game-view .word-item.incorrect {
    border-color: #F44336;
    background: rgba(244, 67, 54, 0.1);
}

#draw-lines-game-view .image-item.selected, 
#draw-lines-game-view .word-item.selected {
    border-color: #FF6B35;
    background: rgba(255, 107, 53, 0.2);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
    transition: all 0.2s ease;
}

.draw-lines-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.draw-lines-controls .game-button {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8E53 100%);
    border: none;
    border-radius: 15px;
    padding: 15px 25px;
    font-size: 1.1em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.draw-lines-controls .game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.draw-lines-controls .game-button:active {
    transform: translateY(0);
}

/* Canvas for drawing lines */
.draw-lines-game-area {
    position: relative;
}

.draw-lines-game-area canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.image-item, .word-item {
    position: relative;
    z-index: 2;
}

/* Responsive design for draw lines game */
@media (max-width: 768px) {
    .draw-lines-game-area {
        flex-direction: column;
        gap: 20px;
    }
    
    .images-row, .words-row {
        width: 100%;
    }
    
    .image-item, .word-item {
        min-width: 100px;
    }
    
    .draw-lines-controls {
        flex-direction: column;
        align-items: center;
    }
}

/* Force horizontal layout for draw lines game */
#draw-lines-game-view .draw-lines-game-area {
    display: flex !important;
    flex-direction: column !important;
    gap: 40px;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    min-height: 400px; /* Ensure enough height for two rows */
}

#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
    min-height: 120px; /* Ensure consistent height */
}

#draw-lines-game-view .images-row {
    order: 1;
    background: rgba(255, 0, 0, 0.1); /* Debug: red tint for images row */
}

#draw-lines-game-view .words-row {
    order: 2;
    background: rgba(0, 255, 0, 0.1); /* Debug: green tint for words row */
}

/* Override any conflicting flexbox styles */
#draw-lines-game-view .images-row *,
#draw-lines-game-view .words-row * {
    flex-direction: row !important;
}

#draw-lines-game-view .images-container,
#draw-lines-game-view .words-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

/* Profile/Account Styling */
/* Note: Profile button styling moved to sticky-profile-button above */

/* Profile View Styling */
#profile-view {
    padding: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.profile-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 600px;
    border: 2px solid #f0f0f0;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.profile-header h1 {
    color: #333;
    margin: 0;
    font-size: 2.2em;
}

.profile-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.profile-avatar-section {
    text-align: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #FF6B35;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-section h2 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 1.8em;
}

.profile-avatar-section p {
    color: #666;
    margin: 0;
    font-size: 1.2em;
}

.profile-form-section h3 {
    color: #333;
    margin: 0 0 20px 0;
    font-size: 1.5em;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
    font-size: 1.1em;
}

.profile-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.1em;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.profile-input:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.profile-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.profile-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.cancel-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.profile-feedback {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    display: none;
}

.profile-feedback.success {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    border: 2px solid #4CAF50;
}

.profile-feedback.error {
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
    border: 2px solid #f44336;
}

/* Responsive Design for Profile */
@media (max-width: 768px) {
    .profile-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .profile-container {
        padding: 20px;
        margin: 20px;
    }
    
    .profile-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .profile-actions {
        flex-direction: column;
    }
}

/* Profile Display on Homepage and Profile Creation */
.profile-display {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.profile-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #FF6B35;
}

.avatar-small {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#homescreen-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.1em;
}

/* Profile Creation Page Profile Display */
.profile-display-top {
    margin-bottom: 30px;
    text-align: center;
}

.profile-info-display {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.profile-avatar-display {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #FF6B35;
}

.avatar-display {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#profile-creation-greeting {
    color: #333;
    font-weight: bold;
    font-size: 1.2em;
}

/* Match Word Game View */
#match-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
}

#match-word-game-view h1#match-word-title {
    color: #333;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    font-size: 3em;
}

.match-word-image-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#match-word-item-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border: 3px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.match-word-choices-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    min-width: 250px;
}

/* Write Word Game View */
#write-word-game-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 30px;
    min-height: 400px;
    position: relative;
}

.write-word-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 140px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.write-word-koala:hover {
    transform: scale(1.05);
}

#write-word-game-view h1#write-word-title {
    color: #333; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1); 
    margin-bottom: 30px; 
    font-size: clamp(2em, 6vw, 3em);
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    max-width: 100%;
}

#write-word-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#write-word-prompt-text {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 10px;
}
#write-word-prompt-text strong {
    font-size: 1.5em; /* Make the word to write bigger */
    color: #185a9d; /* Blue for the word */
    display: block; /* Put word on new line if desired */
    margin-top: 5px;
    letter-spacing: 2px; /* Space out letters */
}

#write-word-input-text {
    font-size: 1.5em;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #ccc;
    text-align: center;
    width: 80%;
    max-width: 300px;
}
#write-word-input-text:focus {
    outline: none;
    border-color: #4A90E2; /* Blue focus */
}

#write-word-submit-btn {
    font-size: 1.2em;
    padding: 12px 25px;
    background-color: #A1C96C; /* Green button */
    color: white;
    /* Inherits general button styles for hover etc. if you have a common .button class */
}
/* Image Analyzer View */
#image-analyzer-view {
    padding: 20px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

#image-analyzer-view h1 {
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.27);
  font-size: 2.4em;
  margin-bottom: 32px;
}

.analyzer-main-flex, #analyzer-main-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 48px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 24px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.07);
  padding: 38px 40px;
}

.analyzer-left-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  max-width: 420px;
  min-width: 260px;
}

.analyzer-right-pane {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 0;
  max-width: 550px;
  min-width: 300px;
  justify-content: flex-start;
}

#analyzer-video-feed {
  width: 100%;
  max-width: 340px;
  height: 300px;
  background: #222;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
}

.analyzer-btn-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: auto;
}

.analyzer-btn {
  font-size: 1.1em;
  padding: 12px 26px;
  border: none;
  border-radius: 20px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}
.analyzer-btn-blue { background: #8D6ECF; }
.analyzer-btn-blue:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-green { background: #8D6ECF; }
.analyzer-btn-green:hover { background: #7a5bb8; transform: translateY(-2px); }
.analyzer-btn-purple { background: #8D6ECF; }
.analyzer-btn-purple:hover { background: #7a5bb8; transform: translateY(-2px); }

.analyzer-status {
  min-height: 1.4em;
  margin-top: 8px;
  color: #2678b5;
  font-size: 1em;
  text-align: center;
}

.analyzer-output-wrapper {
  background: #fff;
  border-radius: 18px;
  border: 2px solid #dadada;
  padding: 24px 18px 16px 18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.07);
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 340px;
}

.analyzer-output-wrapper h2 {
  font-family: inherit;
  color: #1c3456;
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 14px;
  text-align: left;
  letter-spacing: 0.5px;
}

.analyzer-text-output, #analyzer-text-output {
  font-family: var(--font-primary);
  font-size: 1.12em;
  min-height: 245px;
  border: none;
  background: #f8f8fa;
  color: #303050;
  border-radius: 10px;
  resize: none;
  padding: 14px 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  margin-bottom: 0;
  outline: none;
  white-space: pre-line;
}

.back-to-games-btn {
  margin: 30px auto 0 auto;
  display: block;
}

@media (max-width: 900px) {
  .analyzer-main-flex, #analyzer-main-content {
    flex-direction: column;
    padding: 18px 4vw;
    gap: 18px;
  }
  .analyzer-left-pane, .analyzer-right-pane {
    max-width: 98vw;
    min-width: unset;
  }
  #analyzer-video-feed {
    max-width: 95vw;
    height: 32vw;
    min-height: 100px;
  }
}
.analyzer-text-output, #analyzer-text-output {
  overflow-y: auto;
  max-height: 260px;
}
.kai-gif-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  transition: transform 0.09s;
}
.kai-gif-btn:hover,
.kai-gif-btn:focus {
  transform: scale(1.06);
}
.kai-gif {
  height: auto;
  display: block;
}


#draw-lines-game-view .images-row, 
#draw-lines-game-view .words-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

#draw-lines-game-view .images-row {
    order: 1;
}

#draw-lines-game-view .words-row {
    order: 2;
}

#draw-lines-game-view .image-item, 
#draw-lines-game-view .word-item {
    position: relative;
    background: white;
    border: 3px solid #EADDC7;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
    flex-shrink: 0;
    margin: 5px;
}

#draw-lines-game-view .image-item {
    padding: 15px; /* Add padding back for proper spacing */
    overflow: visible; /* Allow normal overflow */
    min-width: 130px; /* Ensure cards are wide enough for images + padding */
    min-height: 130px; /* Ensure cards are tall enough for images + padding */
}

#draw-lines-game-view .word-item {
    padding: 15px; /* Keep padding for word cards */
}

#draw-lines-game-view .image-item:hover, 
#draw-lines-game-view .word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #FF6B35;
}

#draw-lines-game-view .image-item img {
    width: 100px;  /* Fixed size that fits inside cards */
    height: 100px; /* Fixed size that fits inside cards */
    object-fit: contain; /* Fit image within bounds, maintain aspect ratio */
    border-radius: 10px;
    display: block; /* Remove any inline spacing */
}

#draw-lines-game-view .word-item {
    font-size: 1.4em;  /* Increased from 1.2em */
    font-weight: bold;
    color: #4A4A4A;
    min-height: 100px; /* Increased from 80px to match image height */
    display: flex;
    align-items: center;
    justify-content: center;
}

#draw-lines-game-view .image-item.connected, 
#draw-lines-game-view .word-item.connected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

#draw-lines-game-view .image-item.incorrect, 
#draw-lines-game-view .word-item.incorrect {
    border-color: #F44336;
    background: rgba(244, 67, 54, 0.1);
}


/* Responsive Design for Write Word Game */
@media (max-width: 768px) {
    #write-word-game-view {
        padding: 20px;
        gap: 20px;
    }
    
    .write-word-koala {
        bottom: 15px;
        left: 15px;
        width: 120px;
    }
    
    #write-word-game-view h1#write-word-title {
        font-size: clamp(1.8em, 5vw, 2.5em);
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    #write-word-game-view {
        padding: 15px;
        gap: 15px;
    }
    
    .write-word-koala {
        bottom: 10px;
        left: 10px;
        width: 100px;
    }
    
    #write-word-game-view h1#write-word-title {
        font-size: clamp(1.5em, 4vw, 2em);
        margin-bottom: 15px;
    }
}

@media (max-width: 360px) {
    .write-word-koala {
        bottom: 8px;
        left: 8px;
        width: 80px;
    }
    
    #write-word-game-view h1#write-word-title {
        font-size: clamp(1.2em, 3.5vw, 1.8em);
    }
}


/* Match Word Game Koala */
.match-word-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 120px; /* Smaller than write-word-koala */
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.match-word-koala:hover {
    transform: scale(1.05);
}

/* Responsive Design for Match Word Koala */
@media (max-width: 768px) {
    .match-word-koala {
        bottom: 15px;
        left: 15px;
        width: 100px;
    }
}

@media (max-width: 480px) {
    .match-word-koala {
        bottom: 10px;
        left: 10px;
        width: 80px;
    }
}

@media (max-width: 360px) {
    .match-word-koala {
        bottom: 8px;
        left: 8px;
        width: 70px;
    }
}


/* Activities Game Koala */
.activities-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 120px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.activities-koala:hover {
    transform: scale(1.05);
}

/* Numbers Game Koala */
.numbers-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 120px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.numbers-koala:hover {
    transform: scale(1.05);
}

/* Image Analyzer Game Koala */
.analyzer-koala {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 120px;
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
    pointer-events: none;
}

.analyzer-koala:hover {
    transform: scale(1.05);
}

/* Responsive Design for All Game Koalas */
@media (max-width: 768px) {
    .activities-koala,
    .numbers-koala,
    .analyzer-koala {
        bottom: 15px;
        left: 15px;
        width: 100px;
    }
}

@media (max-width: 480px) {
    .activities-koala,
    .numbers-koala,
    .analyzer-koala {
        bottom: 10px;
        left: 10px;
        width: 80px;
    }
}

@media (max-width: 360px) {
    .activities-koala,
    .numbers-koala,
    .analyzer-koala {
        bottom: 8px;
        left: 8px;
        width: 70px;
    }
}

/* Smart Scan Game - New Design */
#smart-scan-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    position: relative;
}

#smart-scan-view h1 {
    font-family: var(--font-primary);
    font-size: 2.5rem;
    font-weight: 600;
    color: white;
    margin: 0;
    padding: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.scan-instruction {
    font-family: var(--font-primary);
    font-size: 1.2rem;
    color: white;
    margin: 0;
    padding: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.scan-btn-row {
    margin: 0;
    padding: 0;
    position: absolute;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.scan-btn {
    font-family: var(--font-primary);
    font-size: 1.4rem;
    font-weight: 600;
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.scan-btn-primary {
    background: #d6381a;
    color: white;
}

.scan-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.scan-btn-secondary {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
}

.scan-btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.main-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    position: absolute;
    top: 0;
    left: 0;
}

.smart-scan-background {
    /* Neutral, responsive stage – no background image */
    width: min(90vw, 1100px);
    height: min(62vh, 680px);
    margin: 0 auto;
    background: none !important;
    position: relative;
    filter: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chalkboard Overlay - positioned exactly over the chalkboard area - CORRECTED */
.chalkboard-overlay {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 70% !important;
    height: 55% !important;
    /* Invisible overlay - no background, no border */
    background: transparent !important;
    border: none !important;
    /* Ensure content is contained within the overlay */
    overflow: visible !important;
    /* Make sure it's above the background image */
    z-index: 10 !important;
}

.camera-video {
    position: absolute !important;
    inset: 0 !important; /* fill the stage */
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
}

/* Override any conflicting analyzer-video-feed rules for smartscan page */
#smart-scan-view #analyzer-video-feed {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scaleX(-1) !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    margin-bottom: 0 !important;
    /* Ensure video is visible and interactive */
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 20 !important;
    /* Ensure video can be captured */
    pointer-events: auto !important;
    display: block !important;
}

/* Hide video when in text mode */
#smart-scan-view #analyzer-video-feed.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Camera flip button styling */
.camera-flip-btn {
    position: relative;
    display: inline-block;
    margin-left: 10px;
    vertical-align: middle;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Camera flip button with custom icon */
.camera-flip-btn img {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1); /* Makes icon white */
}

.camera-flip-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.05);
}

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

/* Specific positioning for 1200x800 screens */
@media (max-width: 1200px) and (max-height: 800px) {
    #smart-scan-view #analyzer-video-feed {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) scaleX(-1) !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
        border: 2px solid rgba(255, 255, 255, 0.2) !important;
        margin-bottom: 0 !important;
        max-width: none !important;
        visibility: visible !important;
    }
    
    /* Story output area for 1200x800 screens */
    .story-output-area {
        top: 150px !important;
        right: 30px !important;
        width: 350px !important;
        height: 350px !important;
    }
    
    .story-output-wrapper h2 {
        font-size: 1.3em;
    }
    
    .analyzer-text-output {
        font-size: 0.95em;
    }
}

/* Ensure canvas is properly configured for image capture */
#analyzer-canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1 !important;
    /* Canvas should be hidden but functional */
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Story Output Area for SmartScan Stories */
.story-output-area {
    position: absolute !important;
    top: 200px !important;
    right: 50px !important;
    width: 400px !important;
    height: 400px !important;
    z-index: 15 !important;
    background: transparent !important;
    border: none !important;
    overflow: visible !important;
}

.story-output-wrapper {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.story-output-wrapper h2 {
    color: #333;
    font-family: var(--font-primary);
    font-size: 1.4em;
    margin: 0 0 15px 0;
    text-align: center;
    border-bottom: 2px solid #d6961a;
    padding-bottom: 10px;
}

.analyzer-text-output {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    font-family: 'Pangolin', cursive;
    font-size: 1em;
    line-height: 1.5;
    color: #333;
    border: 1px solid #e0e0e0;
    overflow-y: auto;
    resize: none;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.analyzer-status {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    color: white;
    background: rgba(0, 0, 0, 0.8);
    padding: 6px 12px;
    border-radius: 15px;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Scanned text container removed - no longer needed */

/* Scanned text styles removed - no longer needed */

/* Typewriter Animation */
.typewriter {
    overflow: hidden;
    border-right: 3px solid white;
    white-space: nowrap;
    animation: typing 0.1s steps(1, end), blink-caret 1s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: white; }
}
/* Responsive Design */
@media (max-width: 768px) {
    .smart-scan-background {
        width: 95vw;
        height: 95vh;
    }
    
    .chalkboard-overlay {
        /* Scale the overlay proportionally for smaller screens */
        top: 20%;
        left: 50%;
        transform: translateX(-50%);
        width: 70%;
        height: 50%;
    }
    
    .camera-video {
        /* Scale camera preview for smaller screens */
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 80%;
        max-width: 400px;
        height: 60%;
        max-height: 250px;
    }
    
    #smart-scan-view #analyzer-video-feed {
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) scaleX(-1) !important;
        width: 90% !important;
        max-width: 600px !important;
        height: 51% !important;
        max-height: 338px !important;
    }
    
    /* Story output area responsive */
    .story-output-area {
        top: 15px !important;
        right: 15px !important;
        width: 300px !important;
        height: 300px !important;
    }
    
    .story-output-wrapper h2 {
        font-size: 1.2em;
    }
    
    .analyzer-text-output {
        font-size: 0.9em;
        padding: 12px;
    }
    
    /* Scanned text container removed - no longer needed */
    
    #smart-scan-view h1 {
        font-size: 2rem;
    }
    
    .scan-instruction {
        font-size: 1rem;
    }
    
    .scan-btn {
        font-size: 1.2rem;
        padding: 12px 24px;
    }
    
    /* Scanned text styles removed - no longer needed */
    
    .analyzer-status {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
}

@media (max-width: 480px) {
    .smart-scan-background {
        width: 95vw;
        height: 95vh;
    }
    
    .chalkboard-overlay {
        /* Scale the overlay proportionally for smaller screens */
        top: 18%;
        left: 50%;
        transform: translateX(-50%);
        width: 76%;
        height: 55%;
    }
    
    .camera-video {
        /* Scale camera preview for smaller screens */
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 85%;
        max-width: 350px;
        height: 55%;
        max-height: 200px;
    }
    
    #smart-scan-view #analyzer-video-feed {
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) scaleX(-1) !important;
        width: 90% !important;
        max-width: 400px !important;
        height: 56% !important;
        max-height: 225px !important;
    }
    
    /* Story output area responsive for small screens */
    .story-output-area {
        top: 10px !important;
        right: 10px !important;
        width: 250px !important;
        height: 250px !important;
    }
    
    .story-output-wrapper h2 {
        font-size: 1.1em;
    }
    
    .analyzer-text-output {
        font-size: 0.8em;
        padding: 10px;
    }
    
    /* Scanned text container removed - no longer needed */
    
    #smart-scan-view h1 {
        font-size: 1.8rem;
    }
    
    .scan-instruction {
        font-size: 0.9rem;
    }
    
    .scan-btn {
        font-size: 1.1rem;
        padding: 10px 20px;
    }
    
    /* Scanned text styles removed - no longer needed */
    
    .analyzer-status {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
}

/* ===== SMARTSCAN ENHANCEMENTS ===== */


/* Loading overlay styles */
.scan-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-family: var(--font-primary);
    font-size: 1.2rem;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Global profile avatar reset */
.profile-avatar {
    border: none !important;
    box-shadow: none !important;
}