/* ===== AaruJr AI — Extended Styles ===== */

/* TOOLBAR (ScratchJr-style) */
.play-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    gap: 6px;
    align-items: center
}

.tool-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--card);
    border: 2px solid var(--border);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition)
}

.tool-btn:hover {
    transform: scale(1.1);
    border-color: var(--purple-light)
}

.tool-btn:active {
    transform: scale(.9)
}

.tool-btn.active {
    border-color: var(--purple);
    background: rgba(124, 58, 237, .15)
}

.tool-flag {
    background: rgba(16, 185, 129, .15);
    border-color: var(--green);
    font-size: 1.5rem
}

.tool-flag:hover {
    box-shadow: var(--glow-green)
}

.tool-flag.running {
    animation: pulseGlow 1s ease infinite
}

.tool-stop-all {
    background: rgba(239, 68, 68, .15);
    border-color: var(--red)
}

.tool-present {
    background: rgba(59, 130, 246, .15);
    border-color: var(--blue)
}

.tool-ai {
    background: linear-gradient(135deg, rgba(124, 58, 237, .2), rgba(236, 72, 153, .2));
    border-color: var(--purple);
    font-size: 1rem
}

/* EDITOR MAIN */
.editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden
}

.stage-wrapper {
    display: flex;
    flex-shrink: 0;
    border-bottom: 2px solid var(--border);
    height: 45%
}

.chars-sidebar {
    width: 60px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    gap: 6px;
    overflow-y: auto
}

.char-thumb {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--card);
    border: 3px solid transparent;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    cursor: pointer;
    flex-shrink: 0
}

.char-thumb.active {
    border-color: var(--purple);
    box-shadow: var(--glow-purple);
    background: var(--card-hover)
}

.char-thumb:hover {
    transform: scale(1.08)
}

.char-add-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 2px dashed var(--dim);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0
}

.char-add-btn:hover {
    border-color: var(--green);
    transform: scale(1.1)
}

.stage-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg2);
    position: relative;
    padding: 8px
}

#stage {
    max-width: 480px;
    max-height: 360px;
    width: 100%;
    height: 100%;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: #1a1a3e
}

.bg-sidebar {
    width: 50px;
    background: var(--bg2);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    gap: 6px
}

.bg-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--card);
    border: 2px solid var(--border);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition)
}

.bg-btn:hover {
    border-color: var(--purple)
}

.bg-btn.active {
    border-color: var(--green)
}

/* SCRIPTING AREA */
.scripting-area {
    flex: 1;
    display: flex;
    overflow: hidden;
    border-top: 1px solid var(--border)
}

.scripts-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: var(--bg)
}

.scripts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border)
}

.scripts-char-icon {
    font-size: 1.5rem
}

.scripts-actions {
    display: flex;
    gap: 6px
}

.sa-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition)
}

.sa-btn:hover {
    transform: scale(1.1);
    border-color: var(--purple)
}

.scripts-canvas {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding: 8px
}

.scripts-canvas.drag-over {
    background: rgba(124, 58, 237, .06);
    outline: 3px dashed var(--purple);
    outline-offset: -4px
}

.scripts-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 8px;
    color: var(--dim);
    pointer-events: none
}

.scripts-empty.hidden {
    display: none
}

/* PAGES BAR */
.pages-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto
}

.pages-list {
    display: flex;
    gap: 6px;
    flex: 1;
    overflow-x: auto
}

.page-thumb {
    width: 48px;
    height: 36px;
    border-radius: 8px;
    border: 2px solid var(--border);
    font-size: .8rem;
    font-weight: 700;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0
}

.page-thumb.active {
    border-color: var(--purple);
    color: var(--white);
    box-shadow: var(--glow-purple)
}

.page-thumb:hover {
    border-color: var(--purple-light);
    transform: scale(1.05)
}

.page-add-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 2px dashed var(--dim);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0
}

/* AI Bar Buttons */
.ai-btn-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--card);
    border: 2px solid var(--border);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    cursor: pointer
}

.ai-btn-sm:hover {
    transform: scale(1.1);
    border-color: var(--purple)
}

/* CHAR LIBRARY */
.lib-container {
    padding: 20px;
    overflow-y: auto;
    height: 100%;
    background: radial-gradient(circle at 50% 20%, #1E1B4B, var(--bg))
}

.lib-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px
}

.lib-back,
.lib-paint-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--card);
    border: 2px solid var(--border);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    cursor: pointer
}

.lib-back:hover,
.lib-paint-btn:hover {
    border-color: var(--purple);
    transform: scale(1.1)
}

.lib-title {
    font-size: 2.5rem
}

.lib-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 600px;
    margin: 0 auto
}

.lib-section {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.lib-cat-title {
    font-size: 2rem;
    text-align: center
}

.lib-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center
}

.lib-char {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--card);
    border: 3px solid var(--border);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition)
}

.lib-char:hover {
    transform: scale(1.15);
    border-color: var(--purple);
    box-shadow: var(--glow-purple)
}

/* PAINT EDITOR */
.paint-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg)
}

.paint-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border)
}

.paint-back,
.paint-done {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--card);
    border: 2px solid var(--border);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition)
}

.paint-back:hover {
    border-color: var(--red)
}

.paint-done:hover {
    border-color: var(--green)
}

.paint-title {
    font-size: 2rem
}

.paint-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px
}

.paint-tools {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center
}

.paint-tool {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--card);
    border: 2px solid var(--border);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition)
}

.paint-tool:hover {
    border-color: var(--purple);
    transform: scale(1.1)
}

.paint-tool.active {
    border-color: var(--purple);
    background: rgba(124, 58, 237, .2);
    box-shadow: var(--glow-purple)
}

#paint-canvas {
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: #fff;
    max-width: 100%;
    touch-action: none;
    cursor: crosshair
}

.paint-colors {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 400px
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: var(--transition)
}

.color-swatch:hover {
    transform: scale(1.2)
}

.color-swatch.active {
    border-color: var(--white);
    box-shadow: 0 0 10px rgba(255, 255, 255, .3)
}

.paint-sizes {
    display: flex;
    gap: 10px;
    align-items: center
}

.size-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition)
}

.size-btn.active {
    border-color: var(--purple)
}

.size-dot {
    border-radius: 50%;
    background: var(--white)
}

.s-sm {
    width: 4px;
    height: 4px
}

.s-md {
    width: 8px;
    height: 8px
}

.s-lg {
    width: 16px;
    height: 16px
}

.s-xl {
    width: 24px;
    height: 24px
}

/* PRESENTATION MODE */
.present-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center
}

#present-canvas {
    width: 100%;
    height: 100%
}

.present-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .6);
    border: 2px solid rgba(255, 255, 255, .3);
    color: white;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10
}

.present-close:hover {
    background: var(--red);
    border-color: var(--red)
}

/* PROJECTS HOME */
.home-projects {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px
}

.project-card {
    width: 80px;
    height: 60px;
    border-radius: var(--radius-sm);
    background: var(--card);
    border: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0
}

.project-card:hover {
    border-color: var(--purple);
    transform: scale(1.05)
}

.project-new {
    border-style: dashed;
    border-color: var(--dim)
}

.proj-label {
    font-size: .7rem
}

/* Palette cats (horizontal for scripting area) */
.palette-cats {
    display: flex;
    gap: 4px;
    padding: 6px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    flex-shrink: 0
}

.cat-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--card);
    border: 3px solid var(--border);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0
}

.cat-btn.active {
    border-color: var(--cat-color, var(--purple));
    background: rgba(255, 255, 255, .05)
}

.cat-btn:hover {
    transform: scale(1.1)
}

.palette-blocks-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 6px
}

/* PLAYGROUND (kept for compat) */
.play-layout {
    display: flex;
    flex-direction: column;
    height: 100%
}

.play-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 8px
}

.topbar-characters {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px
}

.topbar-characters::-webkit-scrollbar {
    display: none
}

.char-btn {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--card);
    border: 3px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    transition: var(--transition);
    flex-shrink: 0
}

.char-btn.active {
    border-color: var(--purple);
    box-shadow: var(--glow-purple);
    background: var(--card-hover)
}

.char-btn:hover {
    transform: scale(1.1)
}

.char-btn.add-char {
    border: 3px dashed var(--dim);
    font-size: 1.4rem;
    background: transparent
}

.topbar-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0
}

.action-btn {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    transition: var(--transition);
    background: var(--card)
}

.action-btn:hover {
    transform: scale(1.1)
}

.action-btn:active {
    transform: scale(.9)
}

.action-play {
    background: rgba(16, 185, 129, .2);
    border: 2px solid var(--green)
}

.action-play:hover {
    box-shadow: var(--glow-green)
}

.action-stop {
    background: rgba(239, 68, 68, .2);
    border: 2px solid var(--red)
}

.action-ai-gen {
    background: linear-gradient(135deg, rgba(124, 58, 237, .2), rgba(236, 72, 153, .2));
    border: 2px solid var(--purple);
    font-size: 1.2rem
}

.action-ai-gen:hover {
    box-shadow: var(--glow-purple)
}

.action-play.running {
    animation: pulseGlow 1s ease infinite
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(16, 185, 129, .3)
    }

    50% {
        box-shadow: 0 0 25px rgba(16, 185, 129, .7)
    }
}

.play-main {
    flex: 1;
    display: grid;
    grid-template-columns: 140px 1fr 1fr;
    overflow: hidden
}

/* Palette */
.block-palette {
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative
}

.palette-tabs {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    border-bottom: 1px solid var(--border)
}

.palette-tab {
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.3rem;
    transition: var(--transition);
    background: transparent
}

.palette-tab:hover {
    background: rgba(255, 255, 255, .05)
}

.palette-tab.active {
    background: rgba(255, 255, 255, .08)
}

.tab-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%
}

.palette-blocks {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--dim) transparent
}

.p-block {
    padding: 16px 14px;
    border-radius: var(--radius-sm);
    font-size: 1.6rem;
    text-align: center;
    cursor: grab;
    transition: var(--transition);
    border-left: 5px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    position: relative
}

.p-block:hover {
    transform: scale(1.08);
    filter: brightness(1.3);
    z-index: 2
}

.p-block:active {
    cursor: grabbing;
    transform: scale(.95);
    opacity: .7
}

.p-block.dragging {
    opacity: .3
}

.palette-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none
}

.hint-hand {
    font-size: 2rem;
    animation: hintBounce 1.5s ease-in-out infinite;
    display: block
}

@keyframes hintBounce {

    0%,
    100% {
        transform: translateY(0)
    }

    50% {
        transform: translateY(-12px)
    }
}

/* Code Zone */
.code-zone {
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: background .3s
}

.code-zone.drag-over {
    background: rgba(124, 58, 237, .06);
    outline: 3px dashed var(--purple);
    outline-offset: -4px
}

.code-zone-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--dim);
    pointer-events: none
}

.code-zone-empty.hidden {
    display: none
}

.drop-arrow {
    font-size: 2.5rem;
    animation: bounceDown 1.5s ease-in-out infinite
}

.drop-icon {
    font-size: 3rem;
    opacity: .5
}

.drop-hint-hand {
    font-size: 1.8rem;
    opacity: .4;
    animation: hintBounce 2s ease-in-out infinite
}

@keyframes bounceDown {

    0%,
    100% {
        transform: translateY(0)
    }

    50% {
        transform: translateY(10px)
    }
}

.code-blocks-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px
}

.code-block {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 1.5rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    cursor: grab;
    transition: var(--transition);
    border-left: 5px solid transparent;
    min-height: 52px
}

.code-block:hover {
    transform: scale(1.03);
    filter: brightness(1.15)
}

.code-block.active-exec {
    outline: 3px solid var(--yellow);
    box-shadow: 0 0 20px rgba(245, 158, 11, .4);
    animation: execPulse .5s ease
}

@keyframes execPulse {
    0% {
        transform: scale(1)
    }

    50% {
        transform: scale(1.06)
    }

    100% {
        transform: scale(1)
    }
}

.code-block .del-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(239, 68, 68, .25);
    color: var(--red);
    font-size: .9rem;
    display: none;
    align-items: center;
    justify-content: center;
    transition: var(--transition)
}

.code-block:hover .del-btn {
    display: flex
}

.code-block.dragging {
    opacity: .3
}

.code-block.drop-target {
    outline: 2px dashed var(--yellow)
}

.drag-grip {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: .8rem;
    opacity: 0;
    transition: opacity .2s;
    color: var(--muted)
}

.code-block:hover .drag-grip {
    opacity: .6
}

/* AI Ghost Block */
.ai-ghost-block {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    background: rgba(124, 58, 237, .1);
    border: 2px dashed var(--purple-light);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0;
    font-size: 1.3rem
}

.ai-ghost-block:hover {
    background: rgba(124, 58, 237, .2);
    transform: translateX(-50%) scale(1.05)
}

.ghost-label {
    font-size: .9rem;
    opacity: .7
}

/* Stage */
.stage-area {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg2);
    position: relative;
    padding: 10px
}

#stage {
    width: 100%;
    height: 100%;
    max-width: 400px;
    max-height: 360px;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    background: #1a1a3e
}

.ai-art-canvas {
    position: absolute;
    inset: 10px;
    border-radius: var(--radius);
    pointer-events: none;
    opacity: .3
}

.stage-overlay {
    position: absolute;
    inset: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    opacity: .15;
    pointer-events: none;
    border-radius: var(--radius)
}

.stage-overlay.hidden {
    opacity: 0
}

/* AI Bar */
.ai-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    flex-shrink: 0
}

.ai-face-animated {
    animation: aiFaceBob 3s ease-in-out infinite
}

@keyframes aiFaceBob {

    0%,
    100% {
        transform: translateY(0)
    }

    50% {
        transform: translateY(-2px)
    }
}

.ai-bar .ai-face {
    font-size: 1.4rem
}

.ai-tip {
    font-size: 1.1rem;
    letter-spacing: 3px;
    flex: 1
}

.ai-confidence {
    width: 60px;
    height: 6px;
    background: var(--bg3);
    border-radius: 3px;
    overflow: hidden
}

.ai-conf-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--purple), var(--green));
    border-radius: 3px;
    transition: width .5s ease;
    width: 50%
}

.ai-hint-btn,
.ai-voice-btn,
.ai-analyze-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition)
}

.ai-hint-btn {
    background: rgba(245, 158, 11, .15);
    border: 2px solid var(--yellow)
}

.ai-voice-btn {
    background: rgba(59, 130, 246, .15);
    border: 2px solid var(--blue)
}

.ai-analyze-btn {
    background: rgba(124, 58, 237, .15);
    border: 2px solid var(--purple)
}

.ai-hint-btn:hover,
.ai-voice-btn:hover,
.ai-analyze-btn:hover {
    transform: scale(1.1)
}

/* CHALLENGES */
#screen-challenges {
    padding: 20px;
    overflow-y: auto;
    background: radial-gradient(circle at 50% 0%, #1E1B4B, var(--bg))
}

.challenges-header {
    text-align: center;
    margin-bottom: 12px
}

.challenges-icon {
    font-size: 3rem
}

.ai-challenge-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 20px;
    background: linear-gradient(135deg, rgba(124, 58, 237, .15), rgba(236, 72, 153, .15));
    border: 1px solid var(--purple);
    border-radius: var(--radius-full);
    max-width: 400px;
    margin: 0 auto 16px;
    font-size: 1.2rem
}

.ai-gen-challenge-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--purple);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition)
}

.ai-gen-challenge-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--glow-purple)
}

.challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    max-width: 700px;
    margin: 0 auto
}

.challenge-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative
}

.challenge-card:hover {
    transform: translateY(-4px);
    border-color: var(--purple-light);
    box-shadow: var(--glow-purple)
}

.challenge-card.completed {
    border-color: var(--green);
    opacity: .7
}

.challenge-card.locked {
    opacity: .35;
    pointer-events: none
}

.challenge-card.ai-generated {
    border-color: var(--cyan);
    background: linear-gradient(135deg, var(--card), rgba(6, 182, 212, .1))
}

.challenge-emoji {
    font-size: 2.5rem
}

.challenge-stars {
    font-size: 1rem;
    letter-spacing: 2px
}

.challenge-stars .empty {
    opacity: .2
}

.ai-badge-mini {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: .7rem;
    padding: 2px 6px;
    background: var(--purple);
    border-radius: var(--radius-full)
}

/* STORIES */
#screen-stories {
    padding: 20px;
    overflow-y: auto;
    background: radial-gradient(circle at 50% 30%, #1E1B4B, var(--bg))
}

.stories-container {
    max-width: 600px;
    margin: 0 auto;
    width: 100%
}

.stories-header {
    text-align: center;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px
}

.stories-icon {
    font-size: 3rem
}

.stories-ai {
    font-size: 2rem;
    animation: pulse 2s ease-in-out infinite
}

.stories-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px;
    scrollbar-width: none;
    margin-bottom: 20px
}

.stories-carousel::-webkit-scrollbar {
    display: none
}

.story-card {
    min-width: 120px;
    padding: 20px 16px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    flex-shrink: 0
}

.story-card:hover {
    transform: scale(1.05);
    border-color: var(--purple-light);
    box-shadow: var(--glow-purple)
}

.story-card.ai-fresh {
    border-color: var(--cyan);
    animation: aiGlow 2s ease-in-out infinite
}

@keyframes aiGlow {

    0%,
    100% {
        box-shadow: none
    }

    50% {
        box-shadow: 0 0 20px rgba(6, 182, 212, .4)
    }
}

.story-card-icon {
    font-size: 1.8rem;
    display: block
}

.story-active-area {
    display: flex;
    flex-direction: column;
    gap: 16px
}

.story-scene {
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--border)
}

#story-canvas {
    width: 100%;
    height: auto;
    display: block
}

.story-narration {
    padding: 12px 20px;
    background: var(--card);
    border-radius: var(--radius);
    text-align: center
}

.story-emoji-text {
    font-size: 2rem;
    letter-spacing: 6px
}

.story-challenge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(124, 58, 237, .1);
    border: 2px dashed var(--purple);
    border-radius: var(--radius);
    font-size: 1.5rem
}

.story-try-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--green);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition)
}

.story-try-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--glow-green)
}

/* AI CHAT */
#screen-aiChat {
    background: radial-gradient(circle at 50% 80%, #1E1B4B, var(--bg))
}

.ai-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 600px;
    margin: 0 auto;
    width: 100%
}

.ai-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border)
}

.ai-chat-avatar {
    position: relative;
    font-size: 2.5rem
}

.ai-chat-face {
    display: block
}

.ai-chat-status {
    position: absolute;
    bottom: 0;
    right: -4px;
    font-size: .6rem
}

.ai-chat-name {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 3px
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px
}

.chat-msg {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 80%;
    animation: fadeUp .3s ease
}

.chat-ai {
    align-self: flex-start
}

.chat-kid {
    align-self: flex-end;
    flex-direction: row-reverse
}

.chat-avatar {
    font-size: 1.5rem;
    flex-shrink: 0
}

.chat-text {
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 1.3rem;
    letter-spacing: 3px
}

.chat-ai .chat-text {
    background: var(--card);
    border: 1px solid var(--border)
}

.chat-kid .chat-text {
    background: rgba(124, 58, 237, .2);
    border: 1px solid var(--purple)
}

.ai-chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border);
    background: var(--bg2)
}

.ai-chat-emoji-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
    padding: 4px
}

.ai-chat-emoji-bar::-webkit-scrollbar {
    display: none
}

.chat-emoji-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--card);
    border: 2px solid transparent;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0
}

.chat-emoji-btn:hover {
    transform: scale(1.1);
    border-color: var(--purple-light)
}

.chat-emoji-btn.selected {
    border-color: var(--purple);
    background: rgba(124, 58, 237, .2);
    box-shadow: var(--glow-purple)
}

.ai-chat-send {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--purple);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0
}

.ai-chat-send:hover {
    transform: scale(1.1);
    box-shadow: var(--glow-purple)
}

/* ANALYTICS */
#screen-analytics {
    padding: 20px;
    overflow-y: auto;
    background: radial-gradient(circle at 50% 20%, #1E1B4B, var(--bg))
}

.analytics-container {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px
}

.analytics-header {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px
}

.analytics-icon {
    font-size: 3rem
}

.analytics-ai {
    font-size: 1.5rem;
    letter-spacing: 3px
}

.ai-insights {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px
}

.insight-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px
}

.insight-emoji {
    font-size: 1.5rem
}

.insight-value {
    font-size: 2rem
}

.skill-radar-wrap {
    display: flex;
    justify-content: center
}

#skill-radar {
    max-width: 300px
}

.activity-heatmap {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border)
}

.heatmap-title {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 12px;
    letter-spacing: 4px
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    background: var(--bg3)
}

.heatmap-cell.level-1 {
    background: rgba(16, 185, 129, .2)
}

.heatmap-cell.level-2 {
    background: rgba(16, 185, 129, .4)
}

.heatmap-cell.level-3 {
    background: rgba(16, 185, 129, .6)
}

.heatmap-cell.level-4 {
    background: rgba(16, 185, 129, .9)
}

.ai-prediction {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px
}

.pred-icon {
    font-size: 2rem
}

.pred-text {
    font-size: 1.1rem;
    letter-spacing: 3px;
    flex: 1
}

.pred-bar {
    width: 80px;
    height: 8px;
    background: var(--bg3);
    border-radius: 4px;
    overflow: hidden
}

.pred-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--purple), var(--pink));
    border-radius: 4px;
    transition: width 1s ease
}

/* PROGRESS */
#screen-progress {
    padding: 24px;
    overflow-y: auto;
    background: radial-gradient(circle at 50% 20%, #1E1B4B, var(--bg));
    align-items: center
}

.progress-content {
    max-width: 500px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px
}

.progress-avatar {
    position: relative;
    cursor: pointer
}

.avatar-ring {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: var(--transition)
}

.progress-avatar:hover .avatar-ring {
    transform: scale(1.1);
    box-shadow: var(--glow-purple)
}

.avatar-emoji {
    font-size: 3.5rem
}

.avatar-tap {
    position: absolute;
    bottom: -4px;
    right: -4px;
    font-size: 1rem;
    opacity: 0;
    transition: opacity .3s
}

.progress-avatar:hover .avatar-tap {
    opacity: 1
}

.progress-level-wrap {
    width: 100%;
    text-align: center
}

.progress-stars {
    font-size: 2rem;
    letter-spacing: 6px;
    margin-bottom: 12px
}

.progress-xp-bar {
    width: 100%;
    height: 16px;
    background: var(--bg3);
    border-radius: 8px;
    overflow: hidden
}

.xp-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--purple), var(--pink));
    border-radius: 8px;
    transition: width 1s ease
}

.skill-tree {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%
}

.skill-node {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    border: 2px solid var(--border);
    transition: var(--transition)
}

.skill-node.mastered {
    border-color: var(--green);
    box-shadow: var(--glow-green)
}

.skill-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 6px
}

.skill-bar {
    width: 100%;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px
}

.skill-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--green);
    transition: width .8s ease
}

.badge-wall {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    width: 100%
}

.badge-item {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: var(--card);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    transition: var(--transition)
}

.badge-item.earned {
    border-color: var(--yellow);
    box-shadow: var(--glow-yellow)
}

.badge-item.locked {
    opacity: .25;
    filter: grayscale(1)
}

.badge-item:hover {
    transform: scale(1.15)
}

.ai-learning-report {
    width: 100%;
    background: linear-gradient(135deg, rgba(124, 58, 237, .1), rgba(236, 72, 153, .1));
    border: 1px solid var(--purple);
    border-radius: var(--radius);
    padding: 16px
}

.report-header {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 12px;
    letter-spacing: 4px
}

.report-content {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.report-line {
    padding: 6px 12px;
    background: var(--card);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    letter-spacing: 2px
}

/* LEADERBOARD */
#screen-leaderboard {
    padding: 20px;
    overflow-y: auto;
    background: radial-gradient(circle at 50% 0%, #1E1B4B, var(--bg))
}

.lb-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
    position: relative
}

.lb-icon {
    font-size: 3rem
}

.lb-back {
    position: absolute;
    left: 0;
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--card);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition)
}

.lb-back:hover {
    background: var(--card-hover)
}

.lb-list {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px
}

.lb-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--card);
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    transition: var(--transition)
}

.lb-row.me {
    border-color: var(--purple);
    box-shadow: var(--glow-purple)
}

.lb-row.gold {
    border-color: var(--yellow)
}

.lb-rank {
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 30px;
    text-align: center;
    color: var(--muted)
}

.lb-row.gold .lb-rank {
    color: var(--yellow)
}

.lb-avatar {
    font-size: 1.8rem
}

.lb-name {
    font-size: .85rem;
    color: var(--muted);
    flex: 1
}

.lb-xp {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg3);
    border-radius: var(--radius-full);
    font-size: .8rem;
    font-weight: 600
}

.lb-stars {
    font-size: .9rem
}

/* BOTTOM NAV */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    padding: 6px 0 10px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    flex-shrink: 0
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative
}

.nav-btn:hover {
    background: rgba(255, 255, 255, .04)
}

.nav-icon {
    font-size: 1.6rem;
    transition: var(--transition)
}

.nav-btn.active .nav-icon {
    transform: scale(1.15)
}

.nav-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: transparent;
    transition: var(--transition)
}

.nav-btn.active .nav-dot {
    background: var(--purple-light)
}

.ai-pulse-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s ease-in-out infinite
}

/* PICKER */
.picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, .7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px
}

.picker-overlay.open {
    display: flex
}

.picker-box {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 420px;
    width: 100%;
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    position: relative
}

.picker-close {
    position: absolute;
    top: 12px;
    right: 14px;
    font-size: 1.3rem;
    color: var(--muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition)
}

.picker-close:hover {
    background: rgba(255, 255, 255, .1)
}

.picker-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 16px
}

.picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px
}

.picker-item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    background: var(--bg3);
    border: 3px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition)
}

.picker-item:hover {
    transform: scale(1.15);
    border-color: var(--purple);
    box-shadow: var(--glow-purple)
}

/* CELEBRATION */
.celebrate-overlay {
    position: fixed;
    inset: 0;
    z-index: 6000;
    background: rgba(0, 0, 0, .6);
    display: none;
    align-items: center;
    justify-content: center
}

.celebrate-overlay.show {
    display: flex
}

.celebrate-content {
    text-align: center;
    animation: celebratePop .6s ease;
    position: relative
}

.celebrate-emoji {
    font-size: 6rem;
    animation: celebrateSpin .8s ease
}

.celebrate-stars {
    font-size: 2rem;
    margin-top: 10px;
    letter-spacing: 8px
}

.confetti-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1
}

@keyframes celebratePop {
    0% {
        transform: scale(0);
        opacity: 0
    }

    60% {
        transform: scale(1.2)
    }

    100% {
        transform: scale(1);
        opacity: 1
    }
}

@keyframes celebrateSpin {
    0% {
        transform: rotate(-20deg) scale(0)
    }

    100% {
        transform: rotate(0deg) scale(1)
    }
}

/* AI MODAL */
.ai-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 7500;
    background: rgba(0, 0, 0, .8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px
}

.ai-modal-overlay.open {
    display: flex
}

.ai-modal {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 400px;
    width: 100%;
    border: 2px solid var(--purple);
    position: relative;
    text-align: center
}

.ai-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center
}

.ai-modal-face {
    font-size: 2.5rem;
    margin-bottom: 16px
}

.ai-modal-content {
    margin-bottom: 16px
}

.analysis-score {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px
}

.score-emoji {
    font-size: 2.5rem
}

.score-bar-wrap {
    flex: 1;
    height: 12px;
    background: var(--bg3);
    border-radius: 6px;
    overflow: hidden
}

.score-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--purple), var(--green));
    border-radius: 6px;
    transition: width 1s ease
}

.score-num {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--purple-light)
}

.analysis-tips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px
}

.tip-item {
    padding: 6px 12px;
    background: var(--bg3);
    border-radius: var(--radius-full);
    font-size: 1.1rem
}

.analysis-patterns {
    display: flex;
    gap: 8px;
    justify-content: center
}

.pattern-badge {
    padding: 6px 12px;
    background: rgba(16, 185, 129, .15);
    border: 1px solid var(--green);
    border-radius: var(--radius-full);
    font-size: 1.2rem
}

.ai-modal-ok {
    padding: 12px 32px;
    border-radius: var(--radius-full);
    background: var(--purple);
    font-size: 1.5rem;
    transition: var(--transition)
}

.ai-modal-ok:hover {
    transform: scale(1.1)
}

/* TOAST */
.toast-area {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 7500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center
}

.toast-msg {
    padding: 10px 20px;
    border-radius: var(--radius-full);
    background: var(--card);
    border: 1px solid var(--border);
    font-size: 1.2rem;
    letter-spacing: 3px;
    animation: toastSlide .3s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .4)
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateY(-20px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

/* AI COMPANION */
.ai-companion {
    position: fixed;
    bottom: 80px;
    right: 16px;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px
}

.ai-companion-face {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(124, 58, 237, .4);
    transition: var(--transition)
}

.ai-companion-face:hover {
    transform: scale(1.1)
}

.ai-companion-bubble {
    padding: 8px 16px;
    background: var(--card);
    border: 1px solid var(--purple);
    border-radius: var(--radius) var(--radius) 0 var(--radius);
    font-size: 1rem;
    letter-spacing: 2px;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
    pointer-events: none;
    white-space: nowrap
}

.ai-companion-bubble.show {
    opacity: 1;
    transform: translateY(0)
}

/* RESPONSIVE */
@media(max-width:900px) {
    .play-main {
        grid-template-columns: 110px 1fr 1fr
    }

    .p-block {
        font-size: 1.3rem;
        padding: 12px 10px;
        min-height: 48px
    }

    .ps-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr))
    }
}

@media(max-width:700px) {
    .play-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto
    }

    .block-palette {
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 100px
    }

    .palette-tabs {
        flex-direction: row;
        overflow-x: auto;
        padding: 4px
    }

    .palette-blocks {
        flex-direction: row;
        overflow-x: auto;
        flex-wrap: nowrap
    }

    .p-block {
        min-width: 56px;
        flex-shrink: 0
    }

    .code-zone {
        min-height: 150px
    }

    .challenges-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr))
    }

    .ps-grid {
        grid-template-columns: repeat(auto-fill, minmax(64px, 1fr))
    }

    .palette-hint {
        display: none
    }

    .ai-insights {
        grid-template-columns: 1fr
    }

    .nav-icon {
        font-size: 1.4rem
    }

    .home-ai-features {
        flex-wrap: wrap;
        justify-content: center
    }
}

@media(max-width:480px) {
    .home-mascot {
        font-size: 5rem
    }

    .home-play-btn {
        width: 80px;
        height: 80px
    }

    .play-icon {
        font-size: 2.2rem
    }

    .char-btn {
        width: 44px;
        height: 44px;
        font-size: 1.5rem
    }

    .action-btn {
        width: 44px;
        height: 44px;
        font-size: 1.3rem
    }

    .ps-slot {
        min-height: 64px
    }

    .ps-slot .slot-emoji {
        font-size: 1.6rem
    }

    .ai-companion {
        bottom: 70px;
        right: 8px
    }

    .ai-companion-face {
        width: 44px;
        height: 44px;
        font-size: 1.4rem
    }
}