/* ========================================
   MATHS ADVENTURE - COMPLETE STYLES
   Phase 4 with new games & hints
   ======================================== */

/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
    --gradient-start: #667eea;
    --gradient-end: #764ba2;

    --koji-primary: #ff9a56;
    --koji-secondary: #ffcd67;
    --koji-gradient: linear-gradient(135deg, #ff9a56, #ffcd67);

    --kieron-primary: #5cb8ff;
    --kieron-secondary: #64f4ac;
    --kieron-gradient: linear-gradient(135deg, #5cb8ff, #64f4ac);

    --white: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.92);
    --glass-border: rgba(255, 255, 255, 0.4);
    --text-dark: #2d3748;
    --text-muted: #718096;
    --success: #48bb78;
    --success-light: #c6f6d5;
    --error: #fc8181;
    --error-light: #fed7d7;
    --warning: #f6ad55;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 15px 40px rgba(0, 0, 0, 0.15);
    --shadow-glow-koji: 0 8px 30px rgba(255, 154, 86, 0.4);
    --shadow-glow-kieron: 0 8px 30px rgba(92, 184, 255, 0.4);

    --font-main: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;

    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-full: 50%;

    --min-touch: 80px;
}

/* ========================================
   RESET & BASE
   ======================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 18px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    overflow-x: hidden;
    color: var(--text-dark);
    line-height: 1.5;
}

.koji-page {
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 50%, #ee5a24 100%);
}

.kieron-page {
    background: linear-gradient(135deg, #5cb8ff 0%, #64f4ac 50%, #0abde3 100%);
}

.parents-page {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

/* ========================================
   ANIMATED BACKGROUND
   ======================================== */
.bg-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.3);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.2);
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

.shape-3 {
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.25);
    top: 50%;
    left: 50%;
    animation-delay: -10s;
}

@keyframes float {

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

    25% {
        transform: translate(30px, -30px) rotate(90deg);
    }

    50% {
        transform: translate(0, 20px) rotate(180deg);
    }

    75% {
        transform: translate(-30px, -10px) rotate(270deg);
    }
}

/* ========================================
   CONTAINER & LAYOUT
   ======================================== */
.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 500px;
    padding: 10px;
}

/* ========================================
   GAME HEADER
   ======================================== */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
}

.back-btn {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.05);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-avatar {
    font-size: 1.8rem;
}

.player-name {
    font-size: 1.2rem;
    font-weight: 800;
}

.stars-display {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--koji-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   GAME MENU
   ======================================== */
.game-menu {
    background: var(--glass-bg);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.menu-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 18px;
    color: var(--text-dark);
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.game-btn {
    position: relative;
    background: var(--white);
    border: 3px solid transparent;
    border-radius: var(--radius-md);
    padding: 15px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.game-btn:hover:not(.locked) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--koji-primary);
}

.game-btn.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.game-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.game-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.game-stars {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.level-badge {
    display: inline-block;
    background: var(--koji-gradient);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    margin-top: 5px;
}

.kieron-level {
    background: var(--kieron-gradient);
}

.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.hidden {
    display: none !important;
}

/* ========================================
   GAME AREA
   ======================================== */
.game-area {
    background: var(--glass-bg);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.game-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-weight: 600;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    margin: 0 12px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--koji-gradient);
    border-radius: 5px;
    transition: width 0.3s ease;
}

.kieron-fill {
    background: var(--kieron-gradient);
}

.game-content {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

/* ========================================
   HINTS SYSTEM
   ======================================== */
.hint-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: rgba(255, 193, 7, 0.1);
    border-radius: var(--radius-sm);
}

.hint-btn {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: var(--white);
    border: none;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.hint-btn:hover:not(:disabled) {
    transform: scale(1.03);
    box-shadow: var(--shadow-sm);
}

.hint-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc;
}

.hints-counter {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.hint-display {
    background: linear-gradient(135deg, #fff9e6, #fff3cd);
    border: 2px solid #ffc107;
    border-radius: var(--radius-md);
    padding: 15px;
    margin-bottom: 15px;
    text-align: center;
}

.hint-content {
    font-size: 1rem;
    color: #856404;
    font-weight: 600;
}

/* ========================================
   FEEDBACK AREA
   ======================================== */
.feedback-area {
    padding: 15px;
    border-radius: var(--radius-md);
    text-align: center;
    margin: 10px 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.feedback-area.success {
    background: var(--success-light);
    color: #276749;
}

.feedback-area.error {
    background: var(--error-light);
    color: #c53030;
}

/* ========================================
   NUMBER PAD
   ======================================== */
.number-pad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.num-btn {
    background: var(--koji-gradient);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    font-weight: 800;
    padding: 18px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    min-width: 60px;
    min-height: 60px;
}

.num-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

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

.kieron-btn {
    background: var(--kieron-gradient) !important;
}

/* ========================================
   MATH PROBLEMS
   ======================================== */
.math-problem {
    text-align: center;
}

.problem-text {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-dark);
}

/* ========================================
   COMPARE GAME
   ======================================== */
.compare-problem {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.compare-num {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-dark);
}

.compare-symbol {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-options {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.compare-btn {
    width: 80px;
    height: 80px;
    font-size: 2.5rem;
    font-weight: 800;
    border: 3px solid var(--kieron-primary);
    background: var(--white);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.compare-btn:hover {
    background: var(--kieron-primary);
    color: var(--white);
    transform: scale(1.05);
}

/* ========================================
   ANIMAL COUNTING
   ======================================== */
.counting-container {
    text-align: center;
}

.counting-question {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 20px;
}

.counting-animals {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 350px;
    margin: 0 auto 25px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    min-height: 120px;
}

.counting-animal {
    font-size: 3rem;
    display: inline-block;
    animation: popIn 0.3s ease-out forwards;
    opacity: 0;
}

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

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

/* ========================================
   NUMBER BONDS
   ======================================== */
.number-bond-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.bond-whole {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-full);
    background: #e74c3c;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    box-shadow: var(--shadow-md);
}

.bond-connector {
    width: 80px;
    height: 40px;
    border-left: 4px solid var(--text-dark);
    border-right: 4px solid var(--text-dark);
    border-bottom: 4px solid var(--text-dark);
    border-radius: 0 0 40px 40px;
}

.bond-parts {
    display: flex;
    gap: 60px;
}

.bond-part {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: #3498db;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    box-shadow: var(--shadow-md);
}

.bond-whole.unknown,
.bond-part.unknown {
    background: var(--text-muted);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* ========================================
   PATTERNS
   ======================================== */
.pattern-sequence {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.pattern-item {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.pattern-item.unknown {
    background: var(--text-muted);
    color: var(--white);
    font-weight: 800;
}

.pattern-options {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.pattern-option {
    width: 70px;
    height: 70px;
    font-size: 2.5rem;
    border: 3px solid transparent;
    background: var(--white);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pattern-option:hover {
    border-color: var(--koji-primary);
    transform: scale(1.1);
}

/* ========================================
   TEN FRAMES
   ======================================== */
.ten-frame-container {
    text-align: center;
}

.ten-frame-target {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.ten-frame {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    max-width: 280px;
    margin: 0 auto 15px;
}

.frame-cell {
    width: 50px;
    height: 50px;
    border: 3px solid var(--koji-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    background: var(--white);
    transition: all 0.2s ease;
}

.frame-cell.filled {
    background: var(--koji-secondary);
    color: var(--koji-primary);
}

.frame-counter {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.submit-btn {
    background: var(--success);
    color: var(--white);
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
}

/* ========================================
   BAR MODELS
   ======================================== */
.bar-model-container {
    text-align: center;
    width: 100%;
}

.bar-story {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 20px;
    color: var(--text-dark);
}

.bar-model {
    max-width: 300px;
    margin: 0 auto 20px;
}

.bar-whole {
    background: #e74c3c;
    color: var(--white);
    padding: 15px;
    font-size: 1.5rem;
    font-weight: 800;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.bar-parts {
    display: flex;
}

.bar-part {
    flex: 1;
    padding: 12px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--white);
}

.bar-part:first-child {
    background: #3498db;
    border-radius: 0 0 0 var(--radius-sm);
}

.bar-part:last-child {
    background: #2ecc71;
    border-radius: 0 0 var(--radius-sm) 0;
}

.bar-whole.unknown,
.bar-part.unknown {
    background: var(--text-muted);
}

/* ========================================
   SHAPE SORTING
   ======================================== */
.shape-sorting-container {
    text-align: center;
}

.shape-question {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.shape-display {
    font-size: 4rem;
    margin-bottom: 15px;
}

.shape-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.shape-option {
    width: 80px;
    height: 80px;
    font-size: 3rem;
    border: 3px solid transparent;
    background: var(--white);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.shape-option:hover {
    border-color: var(--koji-primary);
    transform: scale(1.1);
}

/* ========================================
   MORE OR LESS
   ======================================== */
.more-less-container {
    text-align: center;
}

.more-less-question {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.comparison-groups {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.comparison-group {
    background: var(--white);
    border: 3px solid transparent;
    border-radius: var(--radius-md);
    padding: 15px;
    min-width: 140px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.comparison-group:hover {
    border-color: var(--koji-primary);
    transform: scale(1.03);
}

.group-label {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.group-objects {
    font-size: 1.5rem;
    line-height: 1.8;
    min-height: 50px;
}

.group-count {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--koji-primary);
    margin-top: 10px;
}

.vs-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-muted);
}

/* ========================================
   MISSING NUMBERS
   ======================================== */
.missing-numbers-container {
    text-align: center;
}

.missing-question {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.number-sequence {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.sequence-number {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 800;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.sequence-number.unknown {
    background: var(--text-muted);
    color: var(--white);
}

/* ========================================
   PART-WHOLE MODELS
   ======================================== */
.part-whole-container {
    text-align: center;
}

.part-whole-model {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.pw-whole {
    width: 100px;
    height: 60px;
    background: #9b59b6;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    border-radius: var(--radius-sm);
}

.pw-connector {
    height: 30px;
    display: flex;
    justify-content: center;
}

.pw-line {
    width: 4px;
    height: 100%;
    background: var(--text-dark);
}

.pw-parts {
    display: flex;
    gap: 20px;
}

.pw-part {
    width: 80px;
    height: 50px;
    background: #3498db;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
}

.pw-whole.unknown,
.pw-part.unknown {
    background: var(--text-muted);
}

.pw-question {
    font-size: 1rem;
    color: var(--text-muted);
}

/* ========================================
   NUMBER BONDS TO 20
   ======================================== */
.number-bonds-20-container {
    text-align: center;
}

.nb20-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 2rem;
    font-weight: 800;
}

.nb20-target {
    width: 80px;
    height: 80px;
    background: #e74c3c;
    color: var(--white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nb20-equals,
.nb20-plus {
    color: var(--text-dark);
}

.nb20-part {
    width: 70px;
    height: 70px;
    background: #3498db;
    color: var(--white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nb20-part.unknown {
    background: var(--text-muted);
}

/* ========================================
   WORD PROBLEMS
   ======================================== */
.word-problem-container {
    text-align: center;
}

.word-problem-text {
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-dark);
    background: rgba(255, 255, 255, 0.5);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

/* ========================================
   END SCREEN
   ======================================== */
.end-screen {
    background: var(--glass-bg);
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.trophy {
    font-size: 5rem;
    margin-bottom: 10px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {

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

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

.end-content h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.end-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 25px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

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

.end-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-primary {
    background: var(--koji-gradient);
    color: var(--white);
    border: none;
    padding: 14px 28px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
}

.btn-secondary {
    background: transparent;
    color: var(--text-dark);
    border: 2px solid var(--text-dark);
    padding: 14px 28px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
}

/* ========================================
   SHAKE ANIMATION
   ======================================== */
@keyframes shake {

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

    20%,
    60% {
        transform: translateX(-8px);
    }

    40%,
    80% {
        transform: translateX(8px);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* ========================================
   HOME PAGE & PROFILE SELECTION
   ======================================== */
.home-page .container,
.home-page.container {
    max-width: 900px;
}

.home-container {
    text-align: center;
    padding: 20px;
}

.logo-section {
    margin-bottom: 30px;
}

.logo-icon {
    font-size: 4rem;
    animation: bounce 2s infinite;
}

.logo-section h1 {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--white);
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
    margin: 10px 0 5px;
}

.tagline {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

/* Dynamic Profile Selection - Horizontal on Desktop */
.profile-selection {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-bottom: 25px;
    justify-content: center;
    align-items: stretch;
}

.profile-card {
    flex: 1;
    max-width: 250px;
    background: var(--glass-bg);
    border: none;
    border-radius: var(--radius-lg);
    padding: 25px 20px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    position: relative;
}

.profile-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.profile-card.koji-card:hover {
    box-shadow: var(--shadow-glow-koji);
}

.profile-card.kieron-card:hover {
    box-shadow: var(--shadow-glow-kieron);
}

.profile-card.guest-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 240, 255, 0.95));
}

.profile-card.guest-card:hover {
    box-shadow: 0 10px 40px rgba(138, 43, 226, 0.3);
}

.profile-avatar {
    font-size: 3.5rem;
    margin-bottom: 10px;
}

.profile-name {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-dark);
}

.profile-age {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.profile-games {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.profile-lock {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 1.2rem;
    opacity: 0.6;
}

/* Mobile/Tablet - Vertical Layout */
@media (max-width: 900px) {
    .profile-selection {
        flex-direction: column;
        align-items: center;
    }

    .profile-card {
        width: 100%;
        max-width: 350px;
    }
}

/* Keep old child-card styles for backward compat */
.child-selection {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.child-card {
    background: var(--glass-bg);
    border: none;
    border-radius: var(--radius-lg);
    padding: 25px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.child-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.child-card.koji-card:hover {
    box-shadow: var(--shadow-glow-koji);
}

.child-card.kieron-card:hover {
    box-shadow: var(--shadow-glow-kieron);
}

.child-avatar {
    font-size: 4rem;
    margin-bottom: 10px;
}

.child-name {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-dark);
}

.child-age {
    font-size: 1rem;
    color: var(--text-muted);
}

.child-games {
    font-size: 1.4rem;
    margin-top: 8px;
}

.parents-link {
    display: inline-block;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
}

.parents-link:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ========================================
   PASSWORD MODAL
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 30px 35px;
    max-width: 320px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalAppear 0.3s ease;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }

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

.modal-header {
    margin-bottom: 25px;
}

.modal-avatar {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
}

.modal-content h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.password-input-container {
    margin-bottom: 20px;
}

.password-input {
    width: 100%;
    padding: 15px;
    font-size: 1.5rem;
    font-family: inherit;
    font-weight: 700;
    text-align: center;
    letter-spacing: 8px;
    border: 3px solid #e2e8f0;
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.2s ease;
}

.password-input:focus {
    border-color: var(--koji-primary);
}

.password-input.shake {
    animation: shake 0.5s ease;
}

.password-error {
    color: #e53e3e;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 10px;
}

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

.modal-buttons {
    display: flex;
    gap: 12px;
}

.modal-buttons .btn-secondary,
.modal-buttons .btn-primary {
    flex: 1;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-buttons .btn-secondary {
    background: #e2e8f0;
    color: var(--text-dark);
}

.modal-buttons .btn-secondary:hover {
    background: #cbd5e0;
}

.modal-buttons .btn-primary {
    background: linear-gradient(135deg, var(--koji-primary), var(--koji-secondary));
    color: var(--white);
}

.modal-buttons .btn-primary:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-glow-koji);
}

/* ========================================
   DASHBOARD STYLES
   ======================================== */
.dashboard-container {
    background: var(--glass-bg);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.dashboard-header {
    text-align: center;
    margin-bottom: 25px;
}

.dashboard-header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.filter-group {
    flex: 1;
    min-width: 120px;
}

.filter-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

.stats-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: var(--white);
    padding: 15px;
    border-radius: var(--radius-md);
    text-align: center;
}

.stats-card .value {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
}

.stats-card .label {
    font-size: 0.8rem;
    opacity: 0.9;
}

.stats-card.warning {
    background: linear-gradient(135deg, #f6ad55, #ed8936);
}

.charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.chart-container {
    background: var(--white);
    padding: 15px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.chart-container h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.logs-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
}

.logs-table th,
.logs-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

.logs-table th {
    background: #f7fafc;
    font-weight: 700;
}

.export-btn,
.import-btn {
    background: #1a202c;
    color: var(--white);
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    margin-right: 10px;
}

.import-btn {
    background: #2d3748;
}

.import-input {
    display: none;
}

/* ========================================
   SIDEBAR LAYOUT SYSTEM
   ======================================== */

/* App Wrapper - Full screen container */
.app-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
    min-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

/* App Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* View Toggle Button */
.view-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.4rem;
}

.view-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

/* Show/hide toggle icons based on mode */
.desktop-mode .view-toggle-btn .desktop-icon {
    display: none;
}

.desktop-mode .view-toggle-btn .mobile-icon {
    display: block;
}

.mobile-mode .view-toggle-btn .desktop-icon {
    display: block;
}

.mobile-mode .view-toggle-btn .mobile-icon {
    display: none;
}

/* Main Layout Container */
.app-layout {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--glass-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
}

.sidebar-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

/* Game List in Sidebar */
.game-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.game-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: var(--white);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
    box-shadow: var(--shadow-sm);
}

.game-item:hover {
    transform: translateX(5px);
    border-color: var(--koji-primary);
    box-shadow: var(--shadow-md);
}

.game-item.active {
    border-color: var(--koji-primary);
    background: linear-gradient(135deg, rgba(255, 154, 86, 0.1), rgba(255, 205, 103, 0.1));
}

.kieron-page .game-item:hover,
.kieron-page .game-item.active {
    border-color: var(--kieron-primary);
}

.kieron-page .game-item.active {
    background: linear-gradient(135deg, rgba(92, 184, 255, 0.1), rgba(100, 244, 172, 0.1));
}

.game-item .game-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.game-info .game-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
}

.game-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Main Content Area */
.main-content {
    flex: 1;
    background: var(--glass-bg);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
    max-height: calc(100vh - 130px);
}

/* Welcome Panel */
.welcome-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 40px 20px;
}

.welcome-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {

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

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

.welcome-panel h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.welcome-panel p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 400px;
}

/* Game Area in Main Content */
.main-content .game-area {
    margin: 0;
    padding: 0;
    box-shadow: none;
    background: transparent;
    border-radius: 0;
}

/* End Screen in Main Content */
.main-content .end-screen {
    position: relative;
    inset: auto;
    background: transparent;
}

/* ========================================
   MOBILE MODE STYLES
   ======================================== */
.mobile-mode .app-layout {
    flex-direction: column;
}

.mobile-mode .sidebar {
    width: 100%;
    max-height: none;
    overflow: visible;
}

.mobile-mode .sidebar-title {
    text-align: center;
}

.mobile-mode .game-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.mobile-mode .game-item {
    flex-direction: column;
    text-align: center;
    padding: 15px 10px;
}

.mobile-mode .game-item .game-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.mobile-mode .game-info {
    align-items: center;
}

.mobile-mode .game-item:hover {
    transform: translateY(-3px);
}

/* Hide sidebar in mobile when game is active */
.mobile-mode .sidebar.game-active,
.mobile-mode.game-playing .sidebar {
    display: none;
}

.mobile-mode .main-content {
    max-height: none;
}

/* Hide welcome panel in mobile mode to show games grid */
.mobile-mode .welcome-panel {
    min-height: auto;
    padding: 20px;
}

/* When game is playing, ensure main content takes full space */
.mobile-mode.game-playing .main-content,
.game-playing .main-content {
    flex: 1;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 900px) {

    /* Force mobile mode on smaller screens */
    .desktop-mode .app-layout {
        flex-direction: column;
    }

    .desktop-mode .sidebar {
        width: 100%;
        max-height: none;
        overflow: visible;
    }

    .desktop-mode .game-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .desktop-mode .game-item {
        flex-direction: column;
        text-align: center;
        padding: 15px 10px;
    }

    .desktop-mode .game-item .game-icon {
        font-size: 2.5rem;
        margin-bottom: 8px;
    }

    .desktop-mode .game-info {
        align-items: center;
    }

    .desktop-mode .game-item:hover {
        transform: translateY(-3px);
    }

    .desktop-mode .main-content {
        max-height: none;
    }

    .desktop-mode .welcome-panel {
        display: none;
    }

    /* Auto-hide sidebar when game is active on smaller screens */
    .sidebar.game-active {
        display: none;
    }
}

@media (max-width: 600px) {
    html {
        font-size: 16px;
    }

    .app-wrapper {
        padding: 8px;
    }

    .app-header {
        padding: 10px 12px;
    }

    .sidebar {
        padding: 15px;
    }

    .game-list,
    .mobile-mode .game-list,
    .desktop-mode .game-list {
        grid-template-columns: 1fr;
    }

    .number-pad {
        grid-template-columns: repeat(4, 1fr);
    }

    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .comparison-groups {
        flex-direction: column;
    }

    .vs-text {
        margin: 10px 0;
    }
}

/* ========================================
   GUEST PAGE STYLES
   ======================================== */
.guest-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

.guest-page .game-item:hover,
.guest-page .game-item.active {
    border-color: #8b5cf6;
}

.guest-page .game-item.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(240, 147, 251, 0.1));
}

.guest-btn {
    background: linear-gradient(135deg, #8b5cf6, #a855f7) !important;
    color: white !important;
}

.guest-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

/* Game Section Headers */
.game-section {
    margin-bottom: 20px;
}

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

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* ========================================
   DIFFICULTY SELECTION MODAL
   ======================================== */
.modal-overlay {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.difficulty-modal {
    max-width: 600px;
    width: 95%;
    background: white;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 4px solid var(--koji-primary);
    position: relative;
    overflow: hidden;
}

.difficulty-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background: linear-gradient(90deg, #48bb78, #ed8936, #e53e3e);
}

.difficulty-modal h2 {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.difficulty-game-name {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 30px;
    font-weight: 700;
}

.difficulty-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
}

@media (max-width: 600px) {
    .difficulty-buttons {
        flex-direction: column;
    }
}

.difficulty-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    border: 3px solid transparent;
    border-radius: 20px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.difficulty-btn:hover {
    transform: translateY(-8px);
}

/* EASY */
.difficulty-btn.easy {
    border-color: #48bb78;
    color: #276749;
}

.difficulty-btn.easy:hover {
    background: #f0fff4;
    box-shadow: 0 10px 25px rgba(72, 187, 120, 0.4);
}

.difficulty-btn.easy .difficulty-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 4px rgba(72, 187, 120, 0.3));
}

/* MEDIUM */
.difficulty-btn.medium {
    border-color: #ed8936;
    color: #9c4221;
}

.difficulty-btn.medium:hover {
    background: #fffaf0;
    box-shadow: 0 10px 25px rgba(237, 137, 54, 0.4);
}

.difficulty-btn.medium .difficulty-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 4px rgba(237, 137, 54, 0.3));
}

/* HARD */
.difficulty-btn.hard {
    border-color: #e53e3e;
    color: #9b2c2c;
}

.difficulty-btn.hard:hover {
    background: #fff5f5;
    box-shadow: 0 10px 25px rgba(229, 62, 62, 0.4);
}

.difficulty-btn.hard .difficulty-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 4px rgba(229, 62, 62, 0.3));
}

.difficulty-label {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.difficulty-desc {
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: 600;
}

.modal-close-btn {
    background: #edf2f7;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.modal-close-btn:hover {
    background: #e2e8f0;
    color: var(--text-dark);
    transform: translateY(-2px);
}

/* ========================================
   MATHS ADVENTURE - COMPLETE STYLES
   Phase 4 + KIERON 2026 UPGRADES
   ======================================== */

/* [YOUR ENTIRE ORIGINAL main.css CONTENT GOES HERE - keep everything from :root to the last } ] */

/* ========================================
   === NEW KIERON IMPROVEMENTS (Feb 2026) ===
   ======================================== */

.rocket-mascot {
    font-size: 5.5rem;
    text-align: center;
    margin: 15px 0 10px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    cursor: default;
}

.rocket-mascot.happy {
    transform: scale(1.25) rotate(12deg);
    animation: rocketJump 0.6s ease;
}

.rocket-mascot.sad {
    transform: scale(0.9) rotate(-8deg);
}

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

    40% {
        transform: scale(1.35) translateY(-25px);
    }

    70% {
        transform: scale(1.2) translateY(5px);
    }

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

.difficulty-badge {
    text-align: center;
    margin: 8px 0 15px;
    font-size: 1.1rem;
    font-weight: 800;
    padding: 8px 20px;
    border-radius: 30px;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.difficulty-badge.easy {
    background: #c6f6d5;
    color: #276749;
}

.difficulty-badge.medium {
    background: #fffaf0;
    color: #9c4221;
}

.difficulty-badge.hard {
    background: #fed7d7;
    color: #9b2c2c;
}

.read-btn {
    background: linear-gradient(135deg, #5cb8ff, #64f4ac);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 50px;
    margin: 15px auto;
    display: block;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(92, 184, 255, 0.4);
    transition: all 0.2s;
}

.read-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 25px rgba(92, 184, 255, 0.5);
}

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

/* Flying stars */
.flying-star {
    position: absolute;
    font-size: 2rem;
    pointer-events: none;
    z-index: 9999;
    animation: flyStar 1.8s forwards;
}

@keyframes flyStar {
    0% {
        opacity: 1;
        transform: scale(0.5) translate(0, 0);
    }

    100% {
        opacity: 0;
        transform: scale(1.5) translate(var(--x), var(--y));
    }
}

/* Bigger number pad for little fingers */
.number-pad {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 14px;
}

.num-btn {
    font-size: 1.8rem;
    min-height: 72px;
    padding: 20px;
}