/* ============================================
   SproutMaths — Brand Styles
   Theme: Growth / Plants / Nature + Maths
   Palette: Greens, warm earth tones, pops of colour
   ============================================ */

:root {
    /* Creature theme — changes dynamically when creature is selected */
    --creature-bg:     #FBF6FF;
    --creature-accent: #D8B4FE;
    --creature-dark:   #8E5AD7;

    --brand: #B784F7;
    --brand-dark: #8E5AD7;
    --brand-light: #D8B4FE;
    --brand-pale: #F6EEFF;

    --leaf: #C084FC;
    --stem: #A78BFA;
    --soil: #7C5AA6;
    --sun: #F9A825;
    --berry: #EC4899;
    --sky: #7DD3FC;
    --petal: #C084FC;
    --bark: #8B5E83;

    --dark: #3F2E56;
    --mid: #7C6A97;
    --light: #F3E8FF;
    --white: #FFFFFF;
    --muted: #90A4AE;

    --radius: 20px;
    --radius-sm: 12px;
    --shadow: 0 8px 30px rgba(0,0,0,0.10);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.16);
    --font: 'Fredoka', sans-serif;
}

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

/* ============================================
   SPARKLE BACKGROUND
   ============================================ */
@keyframes twinkle {
    0%,100% { opacity:0; transform:scale(0.5) rotate(0deg); }
    50%      { opacity:1; transform:scale(1.2) rotate(180deg); }
}
@keyframes pulse-bg {
    from { opacity: 0.15; }
    to   { opacity: 0.35; }
}

body {
    font-family: var(--font);
    background: #EBD8FF;
    min-height: 100vh;
    color: var(--dark);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

/* Sparkle dot overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(circle, #B784F7 1.5px, transparent 1.5px),
        radial-gradient(circle, #F9A825 1.5px, transparent 1.5px),
        radial-gradient(circle, #D8B4FE 1.5px, transparent 1.5px),
        radial-gradient(circle, #7DD3FC 1.5px, transparent 1.5px),
        radial-gradient(circle, #EC4899 1px, transparent 1px);
    background-size: 180px 180px, 240px 240px, 200px 200px, 160px 160px, 220px 220px;
    background-position: 20px 40px, 80px 100px, 140px 20px, 60px 160px, 110px 70px;
    opacity: 0.22;
    animation: pulse-bg 6s ease-in-out infinite alternate;
}

#app { position: relative; z-index: 1; }

/* ============================================
   DARK MODE
   ============================================ */
body.dark {
    background: #1A2420 !important;
    color: #E8F5E9;
}
body.dark::before { opacity: 0.10; }
body.dark .card,
body.dark .hub-card,
body.dark .game-card   { background: #243028 !important; border-color: #2E4035 !important; }
body.dark .tab-btn     { color: #C8E6C9; opacity: 0.6; }
body.dark .tab-btn.active { background: var(--brand); color: white; opacity: 1; }
body.dark .hub-greeting { color: #E8F5E9 !important; }
body.dark .hub-stat    { background: rgba(255,255,255,0.10) !important; color: #C8E6C9 !important; }
body.dark .xp-bar-label,
body.dark .xp-bar-label * { color: #B0C4B1 !important; }
body.dark .xp-bar-track { background: rgba(255,255,255,0.12) !important; }
body.dark input, body.dark select { background: #2A3830 !important; color: #E8F5E9 !important; border-color: #3E5045 !important; }
body.dark .btn-secondary { background: #2A3830 !important; color: #90C4A0 !important; }
body.dark .btn-ghost   { color: #90C4A0 !important; }
body.dark .dressup-tab { background: #2A3830 !important; color: #90C4A0 !important; }
body.dark .dressup-tab.active { background: var(--brand) !important; color: white !important; }
body.dark .dressup-item-card  { background: #2A3830 !important; border-color: #3E5045 !important; }
body.dark .dressup-item-label { color: #B0C4B1 !important; }
body.dark .achievement-card { background: #243028 !important; border-color: #2E4035 !important; }
body.dark .achievement-name { color: #E8F5E9 !important; }
body.dark .achievement-desc { color: #90A4AE !important; }

#app {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---- Lucide Icons ---- */
.icon { display: inline-flex; vertical-align: middle; }
.icon svg { width: 1em; height: 1em; stroke-width: 2.5; }
.icon-sm svg { width: 0.85em; height: 0.85em; }
.icon-lg svg { width: 1.4em; height: 1.4em; }
.icon-xl svg { width: 2em; height: 2em; }

/* ---- Screens ---- */
.screen {
    width: 100%;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeIn 0.4s ease;
}

/* Hub must remain centred on desktop even after returning from full-screen games. */
.hub-screen {
    align-self: center;
    margin-left: auto !important;
    margin-right: auto !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes grow {
    0% { transform: scale(0) rotate(-10deg); opacity: 0; }
    60% { transform: scale(1.15) rotate(2deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

/* ---- Brand Logo ---- */
.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.brand-mark {
    width: 56px;
    height: 56px;
    background: var(--white);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    position: relative;
}

.brand-mark .leaf-icon {
    color: var(--brand);
}

.brand-mark .leaf-icon svg {
    width: 32px;
    height: 32px;
}

.brand-text {
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--white);
    text-shadow: 2px 2px 0 rgba(0,0,0,0.12);
    line-height: 1;
}

.brand-text span {
    color: var(--sun);
}

.welcome-subtitle {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.9);
    text-align: center;
    margin-bottom: 36px;
    font-weight: 500;
}

/* ---- Cards ---- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 32px;
    border: none;
    border-radius: 50px;
    font-family: var(--font);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
    text-decoration: none;
    user-select: none;
    -webkit-user-select: none;
}

.btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: var(--white);
}

.btn-secondary {
    background: var(--white);
    color: var(--brand-dark);
    border: 2px solid var(--brand-light);
}

.btn-warm {
    background: linear-gradient(135deg, var(--sun), #E67E22);
    color: var(--white);
}

.btn-sky {
    background: linear-gradient(135deg, var(--sky), #2E86C1);
    color: var(--white);
}

.btn-berry {
    background: linear-gradient(135deg, var(--berry), #C0392B);
    color: var(--white);
}

.btn-petal {
    background: linear-gradient(135deg, var(--petal), #8E44AD);
    color: var(--white);
}

.btn-ghost {
    background: rgba(255,255,255,0.15);
    color: var(--white);
    box-shadow: none;
}

.btn-full { width: 100%; }
.btn-lg { padding: 20px 40px; font-size: 1.2rem; }

/* ---- Avatar Creator ---- */
.avatar-preview {
    width: 180px;
    height: 180px;
    margin: 0 auto 20px;
    position: relative;
    animation: float 3s ease infinite;
}

.avatar-canvas { width: 100%; height: 100%; }

.avatar-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.option-label {
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 65px;
    color: var(--brand-dark);
}

.option-choices {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.option-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 3px solid var(--light);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: var(--white);
}

.option-btn:active,
.option-btn.active {
    border-color: var(--brand);
    transform: scale(1.1);
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.25);
}

.option-btn.avatar-locked {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    position: relative;
}

.option-btn.avatar-locked:active {
    transform: none;
    border-color: var(--light);
    box-shadow: none;
}

/* ---- Name Input ---- */
.name-input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid var(--light);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 16px;
    background: var(--brand-pale);
}

.name-input:focus {
    border-color: var(--brand);
    background: var(--white);
}

/* ---- Age Selector ---- */
.age-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.age-btn {
    padding: 12px 8px;
    border: 2px solid var(--light);
    border-radius: var(--radius-sm);
    background: var(--white);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.age-btn:active,
.age-btn.active {
    border-color: var(--brand);
    background: var(--brand-pale);
    transform: scale(1.05);
}

/* ---- Game Hub ---- */
.hub-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
    color: var(--dark);
}

.hub-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid var(--white);
    box-shadow: var(--shadow);
    background: var(--white);
    overflow: hidden;
    flex-shrink: 0;
}

.hub-avatar canvas { width: 100%; height: 100%; }

.hub-greeting {
    font-size: 1.4rem;
    font-weight: 700;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.1);
}

.hub-stats {
    font-size: 0.85rem;
    opacity: 0.9;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.hub-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(39,174,96,0.12);
    border: 1px solid rgba(39,174,96,0.20);
    color: var(--dark);
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
}

/* ---- XP Bar ---- */
.xp-bar-wrap {
    margin: 12px 0 20px;
    background: rgba(255,255,255,0.60);
    border-radius: 20px;
    padding: 10px 16px;
    color: var(--dark);
    border: 1px solid rgba(39,174,96,0.15);
}

.xp-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.xp-bar-track {
    height: 10px;
    background: rgba(0,0,0,0.10);
    border-radius: 10px;
    overflow: hidden;
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sun), #F39C12);
    border-radius: 10px;
    transition: width 0.6s ease;
}

/* ---- Game Grid ---- */
.game-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.game-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px 14px;
    text-align: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--dark);
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.game-card:active {
    transform: scale(0.96);
}

.game-card.playable:hover {
    border-color: var(--brand);
}

.game-card.locked {
    opacity: 0.55;
    cursor: default;
}

.game-card-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-card-icon svg {
    width: 26px;
    height: 26px;
    stroke-width: 2;
}

.game-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 3px;
}

.game-card-desc {
    font-size: 0.72rem;
    color: var(--muted);
}

.game-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.badge-play {
    background: var(--brand);
    color: white;
}

.badge-soon {
    background: var(--light);
    color: var(--muted);
}

.badge-locked {
    background: #FFF3E0;
    color: #E65100;
    font-weight: 700;
}

.locked-xp {
    opacity: 0.75;
    cursor: pointer;
}

.locked-xp:hover { opacity: 0.9; transform: scale(1.02); }

/* ===================================
   NUMBER ROCKET
   =================================== */
.nr-screen {
    background: linear-gradient(180deg, #0D1B2A 0%, #1A2E4A 50%, #0D1B2A 100%);
    padding: 0;
    gap: 0;
    position: relative;
    overflow: hidden;
}

/* Stars background */
.nr-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 10% 15%, white 0%, transparent 100%),
        radial-gradient(1px 1px at 25% 40%, rgba(255,255,255,0.7) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 40% 10%, white 0%, transparent 100%),
        radial-gradient(1px 1px at 55% 55%, rgba(255,255,255,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 70% 20%, white 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 80% 70%, rgba(255,255,255,0.8) 0%, transparent 100%),
        radial-gradient(1px 1px at 90% 35%, white 0%, transparent 100%),
        radial-gradient(1px 1px at 15% 75%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 60% 85%, rgba(255,255,255,0.7) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.nr-screen .game-topbar { position: relative; z-index: 2; }

.nr-topbar-mid {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
    font-weight: 700;
    color: white;
}

.nr-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 20px 8px;
    gap: 18px;
    position: relative;
    z-index: 1;
}

.nr-prompt {
    text-align: center;
}

.nr-prompt-main {
    font-size: 1.3rem;
    font-weight: 800;
    color: white;
}

.nr-prompt-sub {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    margin-top: 2px;
    font-weight: 600;
}

/* ---- Sequence ---- */
.nr-sequence {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    background: rgba(255,255,255,0.07);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 16px 18px;
    backdrop-filter: blur(4px);
    width: 100%;
    max-width: 380px;
}

.nr-seq-item {
    min-width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255,255,255,0.12);
    color: white;
    font-size: 1.25rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    padding: 0 6px;
}

.nr-blank {
    background: rgba(39,174,96,0.2);
    border: 2px dashed rgba(39,174,96,0.7);
    animation: nrPulse 1.5s ease infinite;
}

.nr-filled {
    background: rgba(39,174,96,0.35);
    border: 2px solid var(--brand);
    animation: popIn 0.4s ease;
    color: #7DFFB3;
}

.nr-seq-arrow {
    color: rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
}

@keyframes nrPulse {
    0%, 100% { border-color: rgba(39,174,96,0.7); background: rgba(39,174,96,0.15); }
    50%       { border-color: rgba(39,174,96,1);   background: rgba(39,174,96,0.3); }
}

/* ---- Choice Buttons ---- */
.nr-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 340px;
}

.nr-choice {
    height: 58px;
    border: none;
    border-radius: 18px;
    background: rgba(255,255,255,0.12);
    color: white;
    font-family: var(--font);
    font-size: 1.5rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
    border: 2px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(4px);
}

.nr-choice:active {
    transform: scale(0.94);
}

.nr-choice:hover:not(:disabled) {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

.nr-choice.nr-correct {
    background: rgba(39,174,96,0.5);
    border-color: var(--brand);
    color: #7DFFB3;
    animation: popIn 0.3s ease;
}

.nr-choice.nr-wrong {
    background: rgba(231,76,60,0.4);
    border-color: #E74C3C;
    color: #FFB3B3;
    animation: wrongBubble 0.4s ease;
}

.nr-choice.nr-hint {
    background: rgba(249,168,37,0.3);
    border-color: var(--sun);
    color: var(--sun);
}

.nr-choice:disabled { cursor: default; }

/* ---- Launch Pad ---- */
.nr-pad {
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    z-index: 1;
    padding-bottom: 0;
}

.nr-rocket-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform-origin: bottom center;
}

.nr-rocket-wrap.nr-launching {
    animation: rocketLaunch 0.8s cubic-bezier(0.2, 0, 0.8, 1) forwards;
}

@keyframes rocketLaunch {
    0%   { transform: translateY(0) scale(1); opacity: 1; }
    20%  { transform: translateY(4px) scale(0.98); }
    100% { transform: translateY(-500px) scale(0.5); opacity: 0; }
}

.nr-flame {
    width: 24px;
    height: 0;
    background: linear-gradient(180deg, #FF6B00, #FFD700);
    border-radius: 0 0 50% 50%;
    margin-top: -4px;
    transition: height 0.2s ease;
    filter: blur(2px);
}

.nr-flame.nr-flame-active {
    height: 40px;
    animation: flameFlicker 0.1s ease infinite alternate;
}

@keyframes flameFlicker {
    from { width: 20px; opacity: 0.9; }
    to   { width: 28px; opacity: 1; }
}

.nr-launchpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.nr-pad-legs {
    width: 90px;
    height: 12px;
    background: linear-gradient(180deg, #5D6D7E, #2C3E50);
    border-radius: 4px 4px 0 0;
    clip-path: polygon(5% 0%, 95% 0%, 100% 100%, 0% 100%);
}

.nr-launches {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    font-weight: 600;
}

/* ---- Bubble Pop Mode Switch ---- */
.bp-mode-switch {
    display: flex;
    background: rgba(0,0,0,0.12);
    border-radius: 50px;
    padding: 3px;
    gap: 2px;
}

.bp-mode-btn {
    border: none;
    border-radius: 50px;
    padding: 5px 12px;
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    color: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.bp-mode-btn.active {
    background: white;
    color: var(--brand-dark);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* ---- Bubble Pop Prompts ---- */
.bp-classic-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--brand, #27AE60);
    border-bottom: none;
    flex-shrink: 0;
    color: white;
}
.bp-classic-prompt span, .bp-classic-prompt div { color: white !important; }

.bp-quiz-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 16px;
    background: var(--brand, #27AE60);
    border-bottom: none;
    flex-shrink: 0;
    color: white;
}

.bp-question-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--brand);
    color: white;
    border-radius: 50px;
    padding: 8px 20px;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font);
    box-shadow: 0 4px 12px rgba(39,174,96,0.35);
    animation: popIn 0.4s ease;
}

/* ---- Creator Tabs ---- */
.creator-unlock-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--mid);
    margin-bottom: 14px;
}

.creator-tabs {
    display: flex;
    gap: 4px;
    background: var(--light);
    border-radius: 50px;
    padding: 4px;
    margin-bottom: 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.creator-tab {
    flex: 1;
    padding: 8px 6px;
    border: none;
    border-radius: 50px;
    background: transparent;
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

.creator-tab.active {
    background: var(--white);
    color: var(--brand-dark);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.creator-panel { min-height: 120px; }

/* ---- Species Grid ---- */
.species-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.species-btn {
    border: 2px solid var(--light);
    border-radius: var(--radius-sm);
    background: var(--brand-pale);
    cursor: pointer;
    padding: 8px 4px 6px;
    text-align: center;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.species-btn:active,
.species-btn.active {
    border-color: var(--brand);
    background: #D5F5E3;
    transform: scale(1.04);
}

.species-btn.avatar-locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.species-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--dark);
}

.species-xp {
    font-size: 0.65rem;
    color: var(--sun);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 2px;
}

/* ---- Mastery Pips ---- */
.mastery-pips {
    display: flex;
    gap: 3px;
    justify-content: center;
    margin-top: 6px;
}

.mastery-pip {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--light);
}

.mastery-pip.earned { background: var(--brand); }
.mastery-pip.earned.gold { background: var(--sun); }

/* ---- Game Screen ---- */
.game-screen {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
}


.game-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 0;
    color: var(--white);
    gap: 6px;
    flex-shrink: 0; /* never collapse */
    min-height: 52px;
    box-sizing: border-box;
}

.game-back {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}

.game-score {
    font-size: 1.1rem;
    font-weight: 700;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 6px;
}

.game-timer {
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(255,255,255,0.2);
    padding: 6px 14px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---- Mode Switch ---- */
.mode-switch {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.mode-btn {
    padding: 6px 16px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50px;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mode-btn.active {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
    color: var(--white);
}

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

/* ---- Bubble Pop Game ---- */
.bubble-area {
    position: relative;
    width: 100%;
    height: 60vh;
    min-height: 400px;
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius);
    overflow: hidden;
    touch-action: none;
}

.bubble-target {
    text-align: center;
    color: var(--white);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.bubble-target-num {
    display: inline-block;
    background: rgba(0,0,0,0.25);
    color: white;
    padding: 5px 20px;
    border-radius: 50px;
    font-size: 1.6rem;
    font-weight: 800;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font);
    font-weight: 700;
    color: var(--white);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
    box-shadow: inset -4px -4px 8px rgba(0,0,0,0.1), inset 4px 4px 8px rgba(255,255,255,0.3), 0 4px 15px rgba(0,0,0,0.08);
    transition: filter 0.2s, outline 0.2s;
}

.bubble::after {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 28%;
    height: 18%;
    background: rgba(255,255,255,0.35);
    border-radius: 50%;
    transform: rotate(-30deg);
}

.bubble:active { transform: scale(0.9); }

.bubble.popped {
    animation: popBubble 0.3s ease forwards !important;
}

.bubble.wrong {
    animation: wrongBubble 0.4s ease forwards !important;
}

@keyframes popBubble {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(0); opacity: 0; }
}

@keyframes wrongBubble {
    0% { transform: scale(1); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-5px); }
    100% { transform: scale(0.8); opacity: 0; }
}

/* ---- Floating Feedback ---- */
.combo-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--white);
    text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
    animation: comboFlash 0.8s ease forwards;
    pointer-events: none;
    z-index: 100;
}

@keyframes comboFlash {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
    100% { transform: translate(-50%, -60%) scale(1); opacity: 0; }
}

.float-points {
    position: absolute;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--sun);
    text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
    pointer-events: none;
    animation: floatUp 1s ease forwards;
    z-index: 50;
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-80px) scale(1.2); opacity: 0; }
}

/* ---- Game Over ---- */
.game-over { text-align: center; color: var(--white); }

.game-over-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.12);
    animation: grow 0.5s ease;
}

.game-over-stars {
    font-size: 1.8rem;
    margin-bottom: 24px;
    letter-spacing: 4px;
}

.game-over-xp {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--sun);
}

.game-over-stats {
    background: rgba(255,255,255,0.12);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 24px;
    text-align: left;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    font-size: 1rem;
}

.stat-row + .stat-row {
    border-top: 1px solid rgba(255,255,255,0.1);
}

.stat-icon { display: inline-flex; margin-right: 6px; }

.game-over-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ---- Profile List ---- */
.profile-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.profile-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--brand-pale);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.profile-item:active {
    transform: scale(0.97);
    border-color: var(--brand);
}

.profile-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.profile-item-avatar canvas { width: 100%; height: 100%; }

.profile-item-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.profile-item-meta {
    font-size: 0.8rem;
    color: var(--mid);
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ---- Shop / Achievements ---- */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.shop-item {
    background: var(--brand-pale);
    border-radius: var(--radius-sm);
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.shop-item:active { border-color: var(--brand); transform: scale(0.95); }
.shop-item.owned { border-color: var(--brand); opacity: 0.7; }
.shop-item.locked { opacity: 0.4; cursor: default; }

.shop-item-icon { font-size: 2rem; margin-bottom: 4px; }
.shop-item-cost {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sun);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.achievement-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.achievement {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--brand-pale);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--light);
}

.achievement.unlocked { border-left-color: var(--brand); }

.achievement-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.achievement.unlocked .achievement-icon { background: var(--brand-light); }

.achievement-text { flex: 1; }
.achievement-name { font-size: 0.9rem; font-weight: 600; }
.achievement-desc { font-size: 0.75rem; color: var(--muted); }
.achievement-xp { font-size: 0.75rem; font-weight: 600; color: var(--sun); }

/* ---- Tabs ---- */
.tab-bar {
    display: flex;
    background: rgba(0,0,0,0.08);
    border-radius: 50px;
    padding: 3px;
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    padding: 10px 8px;
    border: none;
    border-radius: 50px;
    background: transparent;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
    opacity: 0.55;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab-btn.active {
    background: var(--white);
    color: var(--brand-dark);
    opacity: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* ---- Responsive ---- */
@media (max-width: 400px) {
    .brand-text { font-size: 2rem; }
    .game-grid { grid-template-columns: 1fr; }
    .card { padding: 20px; }
    .age-grid { grid-template-columns: repeat(3, 1fr); }
    .shop-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
    .game-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---- Utilities ---- */
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ===================================
   CELEBRATION & ACHIEVEMENT OVERLAYS
   =================================== */
.celeb-banner {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    color: white;
    border-radius: 0 0 20px 20px;
    padding: 14px 20px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    animation: celebSlideDown 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.celeb-banner.celeb-out {
    animation: celebSlideUp 0.4s ease forwards;
}

.celeb-gold {
    background: linear-gradient(135deg, #B8860B, #FFD700) !important;
    color: #1A0A00 !important;
}

.celeb-stars {
    background: linear-gradient(135deg, #E91E63, #FF6B6B) !important;
}

.celeb-inner {
    display: flex;
    align-items: center;
    gap: 14px;
}

.celeb-icon-wrap {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.celeb-label {
    font-size: 0.7rem;
    opacity: 0.85;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.celeb-name {
    font-size: 1.1rem;
    font-weight: 800;
}

.celeb-desc {
    font-size: 0.75rem;
    opacity: 0.85;
}

/* ---- Full Screen Level Up ---- */
.celeb-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: celebFadeIn 0.4s ease;
}

.celeb-levelup { background: rgba(0,0,0,0.82); }
.celeb-perfect { background: rgba(20,0,40,0.88); }

.celeb-fullscreen.celeb-out {
    animation: celebFadeOut 0.5s ease forwards;
}

.celeb-center {
    text-align: center;
    position: relative;
    padding: 40px;
}

.levelup-badge {
    display: inline-block;
    padding: 10px 30px;
    border-radius: 50px;
    color: white;
    font-size: 1.6rem;
    font-weight: 900;
    margin-bottom: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.levelup-name {
    font-size: 2rem;
    font-weight: 900;
    color: white;
    margin-bottom: 8px;
}

.levelup-sub, .celeb-tap {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

.celeb-tap { margin-top: 20px; font-size: 0.8rem; }

/* ---- Streak Flash ---- */
.celeb-streak-flash {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    text-align: center;
    animation: streakFlash 1.2s ease forwards;
    pointer-events: none;
}

.streak-number {
    font-size: 5rem;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 0 0 30px rgba(249,168,37,0.8);
    line-height: 1;
}

.streak-label {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* ---- Perfect ---- */
.perfect-stars { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.perfect-stars svg { width: 48px; height: 48px; color: #FFD700; animation: popIn 0.5s ease both; }
.perfect-stars svg:nth-child(2) { animation-delay: 0.1s; }
.perfect-stars svg:nth-child(3) { animation-delay: 0.2s; }
.perfect-text { font-size: 3rem; font-weight: 900; color: #FFD700; text-shadow: 0 0 40px rgba(249,168,37,0.8); }
.perfect-sub { color: rgba(255,255,255,0.8); font-size: 1.1rem; margin-top: 8px; }

/* ---- Confetti ---- */
.celeb-burst {
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    pointer-events: none;
}

.confetti-p {
    position: absolute;
    transform-origin: center;
    animation: confettiFall linear both;
}

@keyframes confettiFall {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(300px) rotate(720deg); opacity: 0; }
}

@keyframes celebSlideDown {
    from { transform: translateX(-50%) translateY(-120%); }
    to   { transform: translateX(-50%) translateY(0); }
}

@keyframes celebSlideUp {
    from { transform: translateX(-50%) translateY(0); opacity: 1; }
    to   { transform: translateX(-50%) translateY(-120%); opacity: 0; }
}

@keyframes celebFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes celebFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes streakFlash {
    0%   { opacity: 0; transform: translate(-50%,-50%) scale(0.3); }
    20%  { opacity: 1; transform: translate(-50%,-50%) scale(1.2); }
    70%  { opacity: 1; transform: translate(-50%,-50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%,-50%) scale(0.8); }
}

/* ===================================
   LOADING SCREEN
   =================================== */
.loader-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--loader-bg, var(--brand-pale));
    padding: 40px 20px;
    gap: 0;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 360px;
    width: 100%;
}

.loader-icon {
    width: 90px;
    height: 90px;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.loader-icon svg { width: 48px; height: 48px; }

.loader-title {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--loader-color, var(--brand-dark));
    margin: 0;
    text-align: center;
}

.loader-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: white;
    border-radius: 16px;
    padding: 14px 16px;
    font-size: 0.9rem;
    color: var(--dark);
    line-height: 1.5;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-left: 4px solid var(--loader-color, var(--brand));
}

.loader-countdown {
    font-size: 5rem;
    font-weight: 900;
    color: var(--loader-color, var(--brand));
    line-height: 1;
    min-width: 80px;
    text-align: center;
}

.loader-dots {
    display: flex;
    gap: 8px;
}

.ld {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--loader-color, var(--brand));
    opacity: 0.4;
    animation: ldPulse 1s ease infinite;
}
.ld:nth-child(2) { animation-delay: 0.2s; }
.ld:nth-child(3) { animation-delay: 0.4s; }

@keyframes ldPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50%       { opacity: 1;   transform: scale(1.2); }
}

@keyframes loaderPop {
    0%   { transform: scale(0.5); opacity: 0.5; }
    70%  { transform: scale(1.2); }
    100% { transform: scale(1);   opacity: 1; }
}

.loader-skip {
    background: transparent;
    border: 2px solid rgba(0,0,0,0.15);
    border-radius: 50px;
    padding: 8px 20px;
    font-family: var(--font);
    font-size: 0.85rem;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.loader-skip:hover { background: rgba(0,0,0,0.05); }

/* ===================================
   SHAPE SORTER
   =================================== */
.ss-screen {
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    padding: 0; gap: 0;
}

.ss-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    gap: 16px;
    overflow: hidden;
}

.ss-prompt { text-align: center; }
.ss-question {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--brand-dark);
    background: white;
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.ss-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 360px;
}

.ss-choice {
    background: white;
    border: 3px solid transparent;
    border-radius: 16px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.ss-choice:active { transform: scale(0.94); }
.ss-choice:hover:not(:disabled) { border-color: var(--brand); transform: translateY(-2px); }

.ss-shape-svg { width: 80px; height: 80px; }
.ss-shape-label { font-size: 0.8rem; font-weight: 700; color: var(--dark); }

.ss-choice.ss-correct { border-color: var(--brand); background: #E8F5E9; animation: popIn 0.3s ease; }
.ss-choice.ss-wrong   { border-color: #E74C3C; background: #FFEBEE; animation: wrongBubble 0.4s ease; }
.ss-choice.ss-hint    { border-color: var(--sun); background: #FFFDE7; }

/* Sort It mode */
.ss-sort-prompt {
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand-dark);
    text-align: center;
}

.ss-sort-shape {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ss-shape-svg-lg { width: 130px; height: 130px; }
.ss-shape-name { font-size: 1rem; font-weight: 800; color: var(--dark); }

.ss-sort-bins {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 360px;
}

.ss-bin {
    flex: 1;
    padding: 16px;
    border: 3px solid var(--brand);
    border-radius: 16px;
    background: white;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--brand-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.ss-bin:hover { background: var(--brand-pale); transform: translateY(-2px); }
.ss-bin.ss-correct { background: #E8F5E9; }
.ss-bin.ss-wrong   { background: #FFEBEE; border-color: #E74C3C; }
.ss-bin.ss-hint    { background: #FFFDE7; border-color: var(--sun); }

/* ===================================
   TIMES TABLE TOWERS
   =================================== */
.tt-screen {
    background: linear-gradient(180deg, #1A0533, #2D0D5C 50%, #1A0533);
    padding: 0; gap: 0; overflow: hidden;
}

.tt-main {
    flex: 1;
    display: flex;
    gap: 0;
    overflow: hidden;
    position: relative;
}

.tt-tower-wrap {
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 0;
    flex-shrink: 0;
}

.tt-tower {
    display: flex;
    flex-direction: column-reverse;
    width: 64px;
    gap: 2px;
    overflow: hidden;
    max-height: calc(100vh - 160px);
}

.tt-block {
    height: 22px;
    border-radius: 4px;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    border-bottom: 3px solid rgba(0,0,0,0.2);
}

@keyframes blockDrop {
    from { transform: translateY(-30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.tt-ground {
    height: 12px;
    width: 80px;
    background: #5D6D7E;
    border-radius: 4px 4px 0 0;
    flex-shrink: 0;
}

.tt-floor-badge {
    position: absolute;
    left: 70px;
    bottom: 50%;
    background: #FFD700;
    color: #1A0A00;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 50px;
    animation: popIn 0.4s ease, fadeOut 0.5s ease 1.5s forwards;
    z-index: 10;
}

.tt-question-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px 16px;
    gap: 16px;
}

.tt-q-prompt {
    font-size: 2.2rem;
    font-weight: 900;
    color: white;
    text-align: center;
    text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.tt-multi {
    font-size: 0.85rem;
    font-weight: 700;
    color: #FFD700;
    background: rgba(255,215,0,0.15);
    padding: 4px 14px;
    border-radius: 50px;
}

.tt-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 300px;
}

.tt-choice {
    height: 56px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 16px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-family: var(--font);
    font-size: 1.4rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
    backdrop-filter: blur(4px);
}

.tt-choice:hover:not(:disabled) { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.5); transform: translateY(-2px); }
.tt-choice:active { transform: scale(0.93); }

.tt-height-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    font-weight: 600;
}

/* ===================================
   MONEY MATHS
   =================================== */
.mm-screen {
    background: linear-gradient(135deg, #1A237E, #283593);
    padding: 0; gap: 0;
}

.mm-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    gap: 16px;
    position: relative;
}

.mm-prompt {
    text-align: center;
    color: white;
    font-size: 1rem;
    font-weight: 700;
}

.mm-price-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

.mm-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 340px;
}

.mm-choice {
    height: 56px;
    border: 2px solid rgba(255,255,255,0.25);
    border-radius: 16px;
    background: rgba(255,255,255,0.12);
    color: white;
    font-family: var(--font);
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
}

.mm-choice:hover:not(:disabled) { background: rgba(255,255,255,0.25); transform: translateY(-2px); }

/* ===================================
   CLOCK CHALLENGE
   =================================== */
.cc-screen {
    background: linear-gradient(135deg, #B71C1C, #E53935);
    padding: 0; gap: 0;
}

.cc-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    gap: 16px;
    position: relative;
}

.cc-prompt {
    font-size: 1.1rem;
    font-weight: 800;
    color: white;
    text-align: center;
}

.cc-digital-time {
    font-size: 2rem;
    font-weight: 900;
    color: white;
    background: rgba(255,255,255,0.15);
    padding: 10px 24px;
    border-radius: 16px;
    font-family: monospace;
}

.cc-clock-center { display: flex; justify-content: center; }

.cc-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 340px;
}

.cc-choice {
    padding: 14px 8px;
    border: 2px solid rgba(255,255,255,0.25);
    border-radius: 16px;
    background: rgba(255,255,255,0.12);
    color: white;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.cc-choice:hover:not(:disabled) { background: rgba(255,255,255,0.25); }
.cc-choice.ss-correct { background: rgba(39,174,96,0.4); border-color: var(--brand); }
.cc-choice.ss-wrong   { background: rgba(231,76,60,0.4); border-color: #E74C3C; }
.cc-choice.ss-hint    { border-color: #FFD700; background: rgba(255,215,0,0.2); }

.cc-clock-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 280px;
}

.cc-clock-btn {
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 16px;
    background: rgba(255,255,255,0.1);
    padding: 8px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cc-clock-btn:hover:not(:disabled) { border-color: white; background: rgba(255,255,255,0.2); }
.cc-clock-btn.ss-correct { border-color: var(--brand); background: rgba(39,174,96,0.3); }
.cc-clock-btn.ss-wrong   { border-color: #E74C3C; }
.cc-clock-btn.ss-hint    { border-color: #FFD700; }

/* ===================================
   PLACE VALUE PALACE
   =================================== */
.pv-screen {
    background: linear-gradient(135deg, #004D40, #00796B);
    padding: 0; gap: 0;
}

.pv-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    gap: 14px;
    position: relative;
}

.pv-prompt {
    font-size: 1rem;
    font-weight: 800;
    color: white;
    text-align: center;
}

.pv-number-display {
    display: flex;
    gap: 4px;
    font-size: 3.5rem;
    font-weight: 900;
    font-family: monospace;
    background: rgba(255,255,255,0.1);
    padding: 12px 24px;
    border-radius: 16px;
}

.pv-digit { color: rgba(255,255,255,0.6); }
.pv-digit-highlight {
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255,215,0,0.6);
    animation: nrPulse 1s ease infinite;
    border-bottom: 4px solid #FFD700;
}

.pv-place-label {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    font-weight: 600;
}

.pv-columns {
    display: flex;
    gap: 8px;
    background: rgba(255,255,255,0.08);
    padding: 12px 20px;
    border-radius: 16px;
}

.pv-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 48px;
}

.pv-col-highlight { background: rgba(255,215,0,0.15); border-radius: 10px; padding: 4px; }
.pv-col-label { font-size: 0.75rem; color: rgba(255,255,255,0.6); font-weight: 700; }
.pv-col-digit { font-size: 1.8rem; font-weight: 900; }

.pv-breakdown {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.pv-component {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.1);
    padding: 10px 12px;
    border-radius: 12px;
    border: 2px solid var(--pv-color, white);
}

.pv-comp-blocks {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 80px;
}

.pv-block {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: var(--pv-color, #888);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.pv-comp-label { font-size: 0.8rem; font-weight: 700; color: var(--pv-color, white); }
.pv-comp-value { font-size: 0.7rem; color: rgba(255,255,255,0.6); }
.pv-plus { color: white; font-size: 1.2rem; font-weight: 700; }

.pv-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 320px;
}

.pv-choice {
    height: 54px;
    border: 2px solid rgba(255,255,255,0.25);
    border-radius: 14px;
    background: rgba(255,255,255,0.12);
    color: white;
    font-family: var(--font);
    font-size: 1.3rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
}

.pv-choice:hover:not(:disabled) { background: rgba(255,255,255,0.22); transform: translateY(-2px); }
.pv-choice.ss-correct { background: rgba(39,174,96,0.4); border-color: var(--brand); }
.pv-choice.ss-wrong   { background: rgba(231,76,60,0.4); border-color: #E74C3C; }
.pv-choice.ss-hint    { border-color: #FFD700; background: rgba(255,215,0,0.15); }

@keyframes fadeOut { to { opacity: 0; } }

/* ===================================
   GAME OVER MODAL
   =================================== */
.go-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    z-index: 8888;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: celebFadeIn 0.3s ease;
}

.go-modal-card {
    background: white;
    border-radius: 28px;
    padding: 28px 24px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.go-modal-title {
    font-size: 2rem;
    font-weight: 900;
    color: var(--brand-dark);
    text-align: center;
}

.go-modal-stars { line-height: 1; }

.go-modal-xp {
    background: var(--brand);
    color: white;
    font-size: 1.1rem;
    font-weight: 800;
    padding: 6px 20px;
    border-radius: 50px;
}

.go-modal-stats {
    width: 100%;
    background: var(--brand-pale);
    border-radius: 16px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.go-stat {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--dark);
}

.go-stat span { color: var(--mid); }
.go-stat strong { font-weight: 800; }
.go-new-best { color: var(--sun) !important; font-weight: 700; }
.go-new-best span, .go-new-best strong { color: var(--sun) !important; }

.go-modal-btns {
    display: flex;
    gap: 10px;
    width: 100%;
}

.go-modal-btns .btn { flex: 1; }

/* ===================================
   TIMES TABLE SELECT
   =================================== */
.tt-table-select {
    background: white;
    border: none;
    color: #333;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 10px;
    cursor: pointer;
    appearance: auto;
}

/* ===================================
   TUTORIAL OVERLAY
   =================================== */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: celebFadeIn 0.3s ease;
}

.tutorial-card {
    background: white;
    border-radius: 28px;
    padding: 32px 24px 24px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.4);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tutorial-step-dots {
    display: flex;
    gap: 6px;
}

.tutorial-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--light);
    transition: all 0.2s;
}

.tutorial-dot.active {
    background: var(--brand);
    width: 20px;
    border-radius: 4px;
}

.tutorial-icon {
    width: 72px;
    height: 72px;
    background: var(--brand-pale);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand);
}

.tutorial-icon svg { width: 36px; height: 36px; }

.tutorial-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--brand-dark);
}

.tutorial-body {
    font-size: 0.95rem;
    color: var(--mid);
    line-height: 1.55;
}

.tutorial-btns {
    display: flex;
    gap: 10px;
    width: 100%;
}

.btn-ghost {
    background: transparent;
    border: 2px solid var(--light);
    color: var(--muted);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.tutorial-skip {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: var(--font);
    text-decoration: underline;
    padding: 0;
}

/* ===================================
   PATTERN PLANET
   =================================== */
.pp-screen { min-height:100vh; background: linear-gradient(160deg,#F3E5F5 0%,#EDE7F6 100%); display:flex; flex-direction:column; }
.pp-area { flex:1; padding:12px 16px 20px; display:flex; flex-direction:column; align-items:center; gap:12px; }
.pp-prompt { font-size:1.05rem; font-weight:800; color:#4A148C; text-align:center; }
.pp-pattern-row { display:flex; align-items:center; gap:6px; flex-wrap:wrap; justify-content:center; }
.pp-blank { width:70px; height:70px; border:3px dashed #9C27B0; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:2rem; color:#9C27B0; font-weight:900; }
.pp-choices { display:grid; grid-template-columns:1fr 1fr; gap:10px; width:100%; max-width:320px; }
.pp-choice { background:white; border:2px solid #E1BEE7; border-radius:14px; padding:12px; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all 0.15s; }
.pp-choice:hover { border-color:#9C27B0; transform:scale(1.05); }
.pp-odd-row { display:flex; gap:10px; flex-wrap:wrap; justify-content:center; }
.pp-odd-btn { background:white; border:2px solid #E1BEE7; border-radius:14px; padding:12px; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all 0.15s; }
.pp-odd-btn:hover { border-color:#9C27B0; transform:scale(1.05); }
.combo-badge { background:#F9A825; color:white; padding:4px 14px; border-radius:50px; font-size:0.85rem; font-weight:800; }

/* ===================================
   NUMBER NINJA
   =================================== */
.nn-screen { min-height:100vh; background:linear-gradient(160deg,#EFEBE9 0%,#D7CCC8 100%); display:flex; flex-direction:column; }
.nn-area { flex:1; padding:20px 16px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:16px; }
.nn-question { font-size:2.8rem; font-weight:900; color:#3E2723; text-align:center; letter-spacing:-1px; }
.nn-choices { display:grid; grid-template-columns:1fr 1fr; gap:10px; width:100%; max-width:320px; }
.nn-choice { background:white; border:2px solid #D7CCC8; border-radius:14px; padding:18px 12px; font-size:1.4rem; font-weight:800; color:#3E2723; cursor:pointer; transition:all 0.15s; font-family:var(--font); }
.nn-choice:hover { border-color:#4E342E; transform:scale(1.04); background:#FFF8F5; }
.nn-target-bar { background:white; border-radius:12px; padding:10px 16px; font-size:0.85rem; color:#4E342E; text-align:center; width:100%; max-width:320px; }
.nn-combo { height:24px; text-align:center; }

/* ===================================
   FRACTION FRIENDS
   =================================== */
.ff-screen { min-height:100vh; background:linear-gradient(160deg,#FCE4EC 0%,#F8BBD0 100%); display:flex; flex-direction:column; }
.ff-area { flex:1; padding:12px 16px 20px; display:flex; flex-direction:column; align-items:center; gap:12px; }
.ff-visual { display:flex; justify-content:center; }
.ff-choices { display:grid; grid-template-columns:1fr 1fr; gap:10px; width:100%; max-width:340px; }
.ff-choice { background:white; border:2px solid #F8BBD0; border-radius:14px; padding:12px; cursor:pointer; text-align:center; transition:all 0.15s; }
.ff-choice:hover { border-color:#AD1457; transform:scale(1.03); }
.ff-fraction-label { display:block; font-size:1.8rem; font-weight:900; color:#AD1457; }
.ff-fraction-word { display:block; font-size:0.72rem; color:#888; margin-top:2px; }
.ff-share-row { display:flex; gap:12px; flex-wrap:wrap; justify-content:center; }
.ff-share-btn { background:white; border:2px solid #F8BBD0; border-radius:14px; padding:10px; cursor:pointer; display:flex; flex-direction:column; align-items:center; gap:4px; transition:all 0.15s; }
.ff-share-btn:hover { border-color:#AD1457; transform:scale(1.04); }
.ff-share-label { font-size:1.1rem; font-weight:800; color:#AD1457; }
.ff-big { font-size:2.2rem; color:#AD1457; }

/* ===================================
   DATA DETECTIVE
   =================================== */
.dd-screen { min-height:100vh; background:linear-gradient(160deg,#E8EAF6 0%,#C5CAE9 100%); display:flex; flex-direction:column; }
.dd-area { flex:1; padding:12px 16px 20px; display:flex; flex-direction:column; align-items:center; gap:10px; overflow-y:auto; }
.dd-chart-wrap { background:white; border-radius:16px; padding:16px; box-shadow:0 2px 12px rgba(0,0,0,0.08); max-width:340px; width:100%; }
.dd-pictogram { font-size:0.85rem; }
.dd-tally-objects { display:flex; flex-wrap:wrap; gap:6px; justify-content:center; padding:10px; background:white; border-radius:16px; max-width:340px; width:100%; }
.dd-obj { font-size:1.8rem; cursor:pointer; padding:4px; border-radius:6px; transition:all 0.15s; line-height:1; }
.dd-obj.dd-tapped { background:#FFF9C4; transform:scale(0.85); opacity:0.6; outline:2px solid #F9A825; }

/* ===================================
   MEASURE QUEST
   =================================== */
.mq-screen { min-height:100vh; background:linear-gradient(160deg,#E0F2F1 0%,#B2DFDB 100%); display:flex; flex-direction:column; }
.mq-area { flex:1; padding:12px 16px 20px; display:flex; flex-direction:column; align-items:center; gap:12px; }
.mq-objects { display:flex; align-items:center; gap:10px; justify-content:center; }
.mq-obj-card { background:white; border-radius:16px; padding:12px 10px 8px; display:flex; flex-direction:column; align-items:center; gap:4px; min-width:110px; box-shadow:0 2px 10px rgba(0,0,0,0.08); }
.mq-obj-name { font-size:0.8rem; font-weight:700; color:#004D40; }
.mq-vs { font-size:1.2rem; font-weight:900; color:#00796B; }
.mq-choices { display:flex; flex-direction:column; gap:8px; width:100%; max-width:300px; }

/* ===================================
   CREATURE AVATAR PICKER
   =================================== */
.creature-picker-screen {
    min-height: 100vh;
    background: linear-gradient(160deg, #FFF0F5 0%, #F0F8FF 100%);
    display: flex;
    flex-direction: column;
}

.creature-preview-area {
    background: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}

.creature-preview-img {
    animation: float 3s ease infinite;
}

.creature-preview-name {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--brand-dark);
}

.creature-preview-desc {
    font-size: 0.88rem;
    color: var(--mid);
    font-style: italic;
}

.palette-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.palette-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
}

.palette-swatches { display: flex; gap: 6px; }

.palette-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.palette-swatch:hover { transform: scale(1.2); }
.palette-swatch.active { border-color: var(--brand); transform: scale(1.15); box-shadow: 0 0 0 2px white, 0 0 0 4px var(--brand); }

.creature-grid-label {
    padding: 14px 16px 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
}

.creature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 12px 12px;
    overflow-y: auto;
    flex: 1;
}

.creature-card {
    background: white;
    border-radius: 16px;
    padding: 12px 6px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.creature-card.unlocked:hover { border-color: var(--brand); transform: scale(1.04); }
.creature-card.selected { border-color: var(--brand); background: var(--brand-pale); }
.creature-card.locked-creature { opacity: 0.55; cursor: pointer; }

.creature-card-name {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--brand-dark);
}

.creature-card-element {
    font-size: 0.65rem;
    color: var(--muted);
}

.creature-lock-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.creature-lock-badge svg { width: 8px; height: 8px; }

.creature-selected-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--brand);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.creature-selected-badge svg { width: 10px; height: 10px; }

.creature-avatar-wrap { position: relative; }
.creature-img { image-rendering: smooth; }

/* ============================================
   Dress-Up / Avatar Customiser
   ============================================ */

.dressup-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--creature-bg, #F5F0E8);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.dressup-preview {
    background: white;
    border-bottom: 2px solid var(--light);
}

/* Tab bar */
.dressup-tabs {
    display: flex;
    background: white;
    border-bottom: 2px solid var(--light);
    position: sticky;
    top: 52px;
    z-index: 9;
    gap: 0;
}

.dressup-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 4px 8px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    color: var(--muted);
    font-family: 'Fredoka', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    transition: all 0.2s;
}

.dressup-tab i { width: 18px; height: 18px; }

.dressup-tab.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

.dressup-tab:hover { background: var(--brand-pale); }

/* Item grid */
.dressup-content {
    flex: 1;
    padding-bottom: 8px;
    background: white;
}

.dressup-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 10px;
    padding: 12px 16px;
}

.dressup-item-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border-radius: 16px;
    cursor: pointer;
    border: 2.5px solid transparent;
    background: var(--light);
    transition: all 0.2s;
    position: relative;
}

.dressup-item-card:hover { transform: scale(1.04); background: var(--brand-pale); }
.dressup-item-card.selected {
    border-color: var(--brand);
    background: var(--brand-pale);
    box-shadow: 0 0 0 3px var(--brand-light);
}
.dressup-item-card.locked-item { opacity: 0.55; cursor: pointer; }

.dressup-item-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--dark);
    text-align: center;
    line-height: 1.2;
}

/* Lock / selected badges */
.item-lock-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: #888;
    color: white;
    border-radius: 20px;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 5px;
    display: flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
}

.item-sel-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--brand);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Accessory overlays on creature */
.acc-overlay {
    position: absolute;
    pointer-events: none;
    mix-blend-mode: multiply;
}

/* ============================================
   Dress-Up Fixes — white bg + mobile layout
   ============================================ */

/* Remove circle treatment on creature grid cards — show as clean square cards instead */
.dressup-item-card .creature-avatar-wrap {
    border-radius: 12px !important;
    width: 72px !important;
    height: 72px !important;
    overflow: hidden;
}

.dressup-item-card .creature-avatar-wrap img {
    width: 72px !important;
    height: 72px !important;
    object-fit: cover;
    border-radius: 10px;
    mix-blend-mode: multiply; /* makes white background transparent on coloured card */
}

/* Big preview — keep circle but clip image properly */
.dressup-preview .creature-avatar-wrap {
    overflow: hidden;
    border-radius: 50% !important;
}

.dressup-preview .creature-avatar-wrap img {
    mix-blend-mode: multiply;
}

/* Make the dressup screen fully scrollable on small/landscape screens */
.dressup-screen {
    min-height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.dressup-preview {
    min-height: unset;
}

/* Create screen: fix creature teaser overflow in landscape */
.screen .card {
    max-height: none;
    overflow: visible;
}

/* Creature teaser on create screen — proper circles, no overflow */
.creature-teaser-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: nowrap;
    overflow: hidden;
}

.creature-teaser-row img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    flex-shrink: 0;
    mix-blend-mode: multiply;
    background: #f0f0f0;
}

/* ============================================
   CONTRAST FIX — Light & Dark mode readable text
   ============================================ */

/* Bubble target number — was rgba(255,255,255,0.2) — invisible on white */
.bubble-target-num {
    background: var(--brand) !important;
    color: white !important;
    font-weight: 800 !important;
    font-size: 1.8rem !important;
    min-width: 56px;
    text-align: center;
}

/* Instruction cards — white bg, ensure all text is dark enough */
.bp-classic-prompt,
.bp-quiz-prompt {
    background: #FAFFFE !important;
    color: var(--dark) !important;
}
.bp-classic-prompt span,
.bp-classic-prompt div { color: var(--dark) !important; }

/* Dark mode: instruction card backgrounds */
body.dark .bp-classic-prompt,
body.dark .bp-quiz-prompt { background: #1E2D25 !important; color: #E8F5E9 !important; }
body.dark .bp-classic-prompt span,
body.dark .bp-classic-prompt div,
body.dark .bp-quiz-prompt span,
body.dark .bp-quiz-prompt div { color: #C8E6C9 !important; }

/* Game topbar dark mode text — base style sets white already */

body.dark .game-topbar { background: #1E2D25 !important; color: #E8F5E9 !important; }
body.dark .game-score, body.dark .game-timer { color: #C8E6C9 !important; }
body.dark .game-back { color: #90C4A0 !important; }

/* All game area white cards in dark mode */
body.dark .bubble-area { background: #111820 !important; }

/* Number Rocket */
body.dark .nr-track { background: #1E2D25 !important; }
body.dark .nr-question { background: #243028 !important; color: #E8F5E9 !important; }

/* Place Value */
body.dark .pv-card { background: #243028 !important; color: #E8F5E9 !important; }

/* Shape Sorter */
body.dark .ss-bin { background: #243028 !important; }
body.dark .ss-shape-label { color: #E8F5E9 !important; }

/* Money Maths */
body.dark .mm-total { background: #243028 !important; color: #E8F5E9 !important; }

/* Clock */
body.dark .clock-face { background: #2A3830 !important; }

/* Times Tables */
body.dark .tt-question { background: #243028 !important; color: #E8F5E9 !important; }

/* Game over modal */
body.dark .go-modal-card { background: #243028 !important; color: #E8F5E9 !important; }
body.dark .go-modal-card h2, body.dark .go-modal-card p { color: #E8F5E9 !important; }

/* Welcome / create screen on dark */
body.dark .card { background: #243028 !important; color: #E8F5E9 !important; }
body.dark .card h2, body.dark .card p, body.dark .card label { color: #E8F5E9 !important; }
body.dark .name-input { background: #1A2420 !important; color: #E8F5E9 !important; border-color: #3E5045 !important; }
body.dark .age-btn { background: #2A3830 !important; color: #C8E6C9 !important; }
body.dark .age-btn.selected { background: var(--brand) !important; color: white !important; }
body.dark .welcome-subtitle { color: #90C4A0 !important; }
body.dark .profile-item { background: #2A3830 !important; border-color: #3E5045 !important; }
body.dark .profile-item-name { color: #E8F5E9 !important; }
body.dark .profile-item-meta { color: #90C4A0 !important; }
body.dark .brand-text { color: #90C4A0 !important; }
body.dark .brand-text span { color: var(--brand) !important; }

/* Game grid cards */
body.dark .game-grid-card { background: #243028 !important; border-color: #3E5045 !important; }
body.dark .game-grid-card h3 { color: #E8F5E9 !important; }
body.dark .game-grid-card p  { color: #90C4A0 !important; }

/* XP/level pill */
body.dark .xp-level-badge { background: #2A3830 !important; color: #90C4A0 !important; }

/* Loader */
body.dark .loader-screen { background: #1A2420 !important; }
body.dark .loader-title  { color: #E8F5E9 !important; }
body.dark .loader-sub    { color: #90C4A0 !important; }

/* Tab bar */
body.dark .tab-bar { background: #1E2D25 !important; border-color: #2E4035 !important; }

/* ---- Game topbar score labels ---- */
/* Game topbar uses brand green background */
.game-topbar { background: var(--brand, #27AE60); color: white; }

.game-topbar [style*="rgba(255,255,255,0.7)"],
.game-topbar [style*="rgba(255,255,255, 0.7)"] {
    color: var(--muted) !important;
}

/* Game canvas / play area backgrounds */
.bubble-area, #bp-area {
    background: linear-gradient(160deg, #0D1B2A 0%, #1B2838 40%, #0A1628 100%) !important;
}

/* Ensure game instruction text always readable */
.bp-classic-prompt .instruction-text,
.bp-quiz-prompt .instruction-text {
    color: var(--dark) !important;
}

/* ---- Game Card Info Button ---- */
.game-card-info-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 26px;
    height: 26px;
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    color: var(--mid);
    transition: background 0.15s, color 0.15s;
    padding: 0;
}
.game-card-info-btn:hover { background: white; color: var(--brand); }
.game-card-info-btn i { width: 13px; height: 13px; }

/* Make game-card position:relative for the info button */
.game-card { position: relative; }

/* ---- Difficulty pill on game card ---- */
.game-diff-pill {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 4px;
    letter-spacing: 0.02em;
}

/* ---- Difficulty picker buttons in modal ---- */
.diff-pip {
    border: 2px solid;
    border-radius: 20px;
    padding: 4px 12px;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    transition: all 0.15s;
}
.diff-pip:hover { opacity: 0.8; }
.diff-pip.active { font-size: 0.85rem; }

/* Dark mode: game info modal */
body.dark .game-card-info-btn { background: rgba(0,0,0,0.3); color: #90C4A0; border-color: rgba(255,255,255,0.1); }

/* ============================================
   RESPONSIVE FULL-SCREEN LAYOUT
   Games and hub expand to fill available space
   ============================================ */

/* Hub screen — wider on tablet/desktop */
@media (min-width: 600px) {
    .screen { max-width: 680px; }
    #app { padding: 16px 24px; }
    .game-grid { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (min-width: 900px) {
    .screen { max-width: 860px; }
    .game-grid { grid-template-columns: repeat(4, 1fr) !important; }
}
@media (min-width: 1200px) {
    .screen { max-width: 1100px; }
    .game-grid { grid-template-columns: repeat(5, 1fr) !important; }
}

/* Full-screen game areas — always use all available viewport */
.bubble-game-container,
.nr-screen,
.pv-screen,
.ss-screen,
.mm-screen,
.cc-screen,
.tt-screen,
.fp-screen,
.ff-screen,
.nn-screen,
.dd-screen,
.mq-screen,
.pp-screen {
    width: 100vw !important;
    max-width: 100vw !important;
    min-height: 100vh !important;
    margin: 0 !important;
    left: 0 !important;
    position: relative !important;
}

/* Bubble play area — fill remaining height */
#bp-area, .bubble-area {
    flex: 1 1 0 !important;
    min-height: 300px !important;
    height: 0 !important; /* flex child needs height:0 so flex:1 takes over properly */
}

/* Game topbar — always full width */
.game-topbar {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

/* App container in game mode — handled in responsive section below */

/* Game over modal — sits over full screen */
.go-modal-backdrop {
    position: fixed !important;
    inset: 0 !important;
}

/* On tablet landscape — game grid two columns, more comfortable */
@media (min-width: 600px) and (max-width: 899px) {
    .game-grid { grid-template-columns: repeat(3, 1fr) !important; }
}

/* ---- Pause button in game topbar ---- */
.game-pause-btn {
    background: rgba(255,255,255,0.2);
    border: 1.5px solid rgba(255,255,255,0.4);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    margin-left: 4px;
    flex-shrink: 0;
    transition: background 0.15s;
}
.game-pause-btn:hover { background: rgba(255,255,255,0.35); }

/* ---- Progress tab ---- */
.prog-game-row { display: flex; flex-direction: column; gap: 10px; }

/* ============================================
   CHROME OVERLAY BUTTONS (fixed top-right)
   ============================================ */
.chrome-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1.5px solid rgba(0,0,0,0.15);
    background: rgba(255,255,255,0.75);
    color: var(--dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.chrome-btn:hover { background: rgba(255,255,255,0.95); border-color: rgba(0,0,0,0.25); }
.chrome-btn-active { background: #E8F8EE !important; border-color: var(--brand) !important; color: var(--brand) !important; }
body.dark .chrome-btn { background: rgba(30,45,37,0.85); border-color: rgba(255,255,255,0.15); color: #C8E6C9; }
body.dark .chrome-btn:hover { background: rgba(50,70,55,0.95); }
body.dark .chrome-btn-active { background: rgba(39,174,96,0.25) !important; border-color: #4CAF50 !important; color: #81C784 !important; }

/* ============================================
   RESPONSIVE SCREEN WIDTHS
   Phone: full width; Tablet/desktop: max constrained hub/menu
   Games always 100vw
   ============================================ */
/* Phone — full width, minimal padding */
@media (max-width: 599px) {
    .screen { max-width: 100% !important; }
    #app:not(.game-active) { padding: 12px !important; }
    .game-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
/* Tablet portrait */
@media (min-width: 600px) and (max-width: 1023px) {
    .screen { max-width: 640px; }
    #app:not(.game-active) { padding: 16px 24px; }
    .game-grid { grid-template-columns: repeat(3, 1fr) !important; }
}
/* Tablet landscape / desktop */
@media (min-width: 1024px) {
    .screen { max-width: 900px; }
    #app:not(.game-active) { padding: 20px 32px; }
    .game-grid { grid-template-columns: repeat(4, 1fr) !important; }
}

/* Normal screens — explicitly re-centre after leaving full-screen game mode. */
#app:not(.game-active) {
    align-items: center !important;
}

/* Game active — always zero padding, stretch full width */
#app.game-active {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
}
#app.game-active .game-screen {
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
}
#app.game-active .bubble-area,
#app.game-active #bp-area {
    border-radius: 0 !important;
}

/* ---- Hide chrome overlay during games ---- */
/* Settings gear remains visible during games — removed hide rule */

/* ---- BP mode label hides on very small screens ---- */
@media (max-width: 380px) {
    .bp-mode-label { display: none; }
    .bp-mode-btn { padding: 5px 10px !important; }
}

/* ---- Bubble area: bordered play zone (not full bleed) ---- */
#app.game-active .bubble-area,
#app.game-active #bp-area {
    border-radius: 16px !important;
    margin: 0 10px 10px 10px !important;
    width: calc(100% - 20px) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
}

/* ---- Always show Classic/Quiz labels ---- */
.bp-mode-label { display: inline !important; }

/* ============================================
   SETTINGS TAB
   ============================================ */
.settings-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 4px 0 20px;
}

.set-card {
    background: white;
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.set-card-player {
    background: var(--brand-pale);
    border: 1.5px solid rgba(39,174,96,0.2);
}

.set-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--mid);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.set-section-title svg { width: 13px; height: 13px; }

.set-player-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 2px;
}
.set-player-meta {
    font-size: 0.82rem;
    color: var(--mid);
    margin-bottom: 10px;
}
.set-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--brand-dark);
    background: rgba(39,174,96,0.12);
    border: none;
    border-radius: 20px;
    padding: 5px 12px;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.15s;
}
.set-edit-btn:hover { background: rgba(39,174,96,0.22); }
.set-edit-btn svg { width: 12px; height: 12px; }

/* Setting row: icon | label+sub | control */
.set-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
}
.set-row-icon {
    width: 32px;
    height: 32px;
    background: rgba(39,174,96,0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--brand-dark);
}
.set-row-icon svg { width: 15px; height: 15px; }
.set-row-text { flex: 1; min-width: 0; }
.set-row-label { font-size: 0.9rem; font-weight: 600; color: var(--dark); }
.set-row-sub   { font-size: 0.75rem; color: var(--mid); margin-top: 1px; }
.set-row-ctrl  { flex-shrink: 0; }

.set-divider {
    height: 1px;
    background: rgba(0,0,0,0.06);
    margin: 10px 0;
}

.set-link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-size: 0.88rem;
    color: var(--dark);
    font-weight: 500;
}
.set-link-row span { display: flex; align-items: center; gap: 8px; }
.set-link-row svg { width: 14px; height: 14px; color: var(--mid); }

.set-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    font-size: 0.88rem;
    color: var(--dark);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.set-info-row:last-child { border-bottom: none; }
.set-badge {
    font-size: 0.75rem;
    background: #f0f0f0;
    color: #666;
    padding: 2px 9px;
    border-radius: 10px;
    font-weight: 700;
}
.set-badge-green { background: #EAFAF1; color: #27AE60; }

/* Dark mode settings */
body.dark .set-card { background: #1E2D25; box-shadow: 0 2px 10px rgba(0,0,0,0.2); }
body.dark .set-card-player { background: #162010; border-color: rgba(39,174,96,0.3); }
body.dark .set-player-name,
body.dark .set-row-label,
body.dark .set-link-row,
body.dark .set-info-row { color: #E8F5E9; }
body.dark .set-player-meta,
body.dark .set-row-sub,
body.dark .set-section-title { color: #90C4A0; }
body.dark .set-row-icon { background: rgba(39,174,96,0.15); color: #81C784; }
body.dark .set-badge { background: #2A3830; color: #90C4A0; }
body.dark .set-badge-green { background: rgba(39,174,96,0.15); color: #81C784; }
body.dark .set-divider,
body.dark .set-link-row,
body.dark .set-info-row { border-color: rgba(255,255,255,0.07); }

/* ============================================
   SETTINGS PANEL (top-right dropdown)
   ============================================ */
.settings-panel {
    position: absolute;
    top: 46px;
    right: 0;
    width: 220px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.08);
    padding: 10px 0;
    z-index: 501;
    animation: sp-in 0.15s ease;
}

@keyframes sp-in {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.sp-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--mid);
    padding: 0 14px 8px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    margin-bottom: 4px;
}

.sp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.12s;
    gap: 8px;
    border: none;
    background: none;
    width: 100%;
    font-family: var(--font);
    text-decoration: none;
}
.sp-row:hover { background: rgba(0,0,0,0.04); }
.sp-row-link { color: var(--dark); }

.sp-row-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--dark);
}
.sp-row-left svg { color: var(--mid); flex-shrink: 0; }

.sp-toggle {
    width: 36px;
    height: 20px;
    background: #ddd;
    border-radius: 10px;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s;
}
.sp-toggle::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: left 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.sp-toggle-on { background: var(--brand); }
.sp-toggle-on::after { left: 19px; }

.sp-divider {
    height: 1px;
    background: rgba(0,0,0,0.06);
    margin: 4px 0;
}

/* Dark mode */
body.dark .settings-panel {
    background: #1E2D25;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
body.dark .sp-title { color: #90C4A0; border-color: rgba(255,255,255,0.08); }
body.dark .sp-row:hover { background: rgba(255,255,255,0.06); }
body.dark .sp-row-left { color: #E8F5E9; }
body.dark .sp-row-left svg { color: #90C4A0; }
body.dark .sp-row-link { color: #E8F5E9; }
body.dark .sp-toggle { background: #3A4A40; }
body.dark .sp-divider { background: rgba(255,255,255,0.08); }

/* ---- Question counter (replaces timer bar for untimed games) ---- */
.pp-q-counter {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--mid);
    padding: 6px 0 2px;
    letter-spacing: 0.03em;
}
body.dark .pp-q-counter { color: #90C4A0; }

/* ---- Data Detective: theme title above chart ---- */
.dd-theme-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--mid);
    text-align: center;
    margin-bottom: 6px;
    font-style: italic;
}
body.dark .dd-theme-title { color: #90C4A0; }

/* ---- Hide Timer mode (user setting) ---- */
body.hide-timer .game-timer-bar,
body.hide-timer .game-timer { display: none !important; }

/* ---- Topbar colour customisation ---- */
:root { --topbar-colour: #2c2646; }
.game-topbar { background: var(--topbar-colour) !important; color: var(--topbar-text, #ffffff) !important; }

/* Colour swatch input in settings panel */
.sp-colour-section { width: 100%; }
.sp-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 14px 14px;
}
.sp-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2.5px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}
.sp-swatch:hover { transform: scale(1.25); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.sp-swatch.sp-swatch-active { border-color: white; box-shadow: 0 0 0 2.5px rgba(0,0,0,0.5), 0 0 0 4.5px white; transform: scale(1.1); }
.sp-swatch-custom {
    background: conic-gradient(#E91E8C, #FF6B35, #FFB300, #43A047, #00ACC1, #5C6BC0, #E91E8C);
    color: white;
}
.sp-swatch-custom i { filter: drop-shadow(0 1px 1px rgba(0,0,0,0.6)); }

.sp-colour-input {
    width: 32px;
    height: 24px;
    border: 2px solid rgba(0,0,0,0.15);
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    background: none;
    flex-shrink: 0;
}
.sp-colour-input::-webkit-color-swatch-wrapper { padding: 0; }
.sp-colour-input::-webkit-color-swatch { border: none; border-radius: 4px; }

/* ---- Measure Quest: scale wrapper ---- */
.mq-scale-wrap {
    width: 100%;
    max-width: 360px;
    margin: 20px auto 8px;
    padding: 16px 12px 8px;
    background: rgba(255,255,255,0.7);
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
body.dark .mq-scale-wrap {
    background: rgba(255,255,255,0.1);
}

/* ---- Inline settings gear inside game topbar ---- */
.game-gear-inline {
    background: rgba(255,255,255,0.22);
    border: 1.5px solid rgba(255,255,255,0.4);
    border-radius: 50%;
    color: white;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: auto;
    transition: background 0.15s;
}
.game-gear-inline:hover { background: rgba(255,255,255,0.35); }

/* ---- Cloud Profiles (welcome screen) ---- */
.cloud-profile-item {
    cursor: pointer;
    transition: background 0.15s;
}
.cloud-profile-item:hover { background: rgba(39,174,96,0.08); }
/* Highlight unloaded profiles with a subtle left border */
.cloud-profile-item--new {
    border-left: 3px solid var(--brand);
    padding-left: 10px;
}

.cloud-badge {
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--brand);
    color: white;
    border-radius: 20px;
    padding: 3px 10px;
    flex-shrink: 0;
    white-space: nowrap;
}
.cloud-badge-load {
    background: var(--brand);
    color: white;
    animation: pulse-badge 2s ease-in-out infinite;
}
@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.cloud-badge-local {
    background: rgba(0,0,0,0.08);
    color: var(--mid);
    font-weight: 500;
}
body.dark .cloud-badge-local { background: rgba(255,255,255,0.1); color: #aaa; }

/* ---- Hub: prevent body background bleeding through grid gaps ---- */
.game-grid {
    background: transparent;
}
/* Wrap the game-grid in a section that covers the bg */
.hub-games-section {
    background: var(--creature-bg, #EAFAF1);
    border-radius: 20px;
    padding: 4px;
    margin: -4px;
}
