#game-root {
    --bas-accent: #10B981;
    --bas-accent-dark: #0c8d64;
    --bas-accent-light: #e3f9ef;
    --bas-accent-border: #a7f3d0;
    --bas-glass-bg: rgba(255, 255, 255, .62);
    --bas-glass-border: rgba(255, 255, 255, .45);
}

/*
 * The kwi-* modifier classes game.js passes to KidWorldIcons.svg() are only
 * ever *named* by the shared icon helper, never defined by it (its default
 * amber lives in a zero-specificity :where() rule so any single class wins),
 * so the tier/status colors are given real values here, scoped to this game.
 */
#game-root .kwi-accent { color: var(--bas-accent); }
#game-root .kwi-success { color: #10B981; }
#game-root .kwi-danger { color: #EF4444; }
#game-root .kwi-trophy { color: #F59E0B; }
#game-root .kwi-stars { color: #8B5CF6; }
#game-root .kwi-thumbsup { color: #10B981; }
#game-root .kwi-lightning { color: #3B82F6; }
#game-root .kwi-smile { color: #F472B6; }
#game-root .kwi-muted { color: #cbd5e1; }

.kwg-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
}

.bas-wrap {
    max-width: 620px;
    margin: 0 auto;
}

.bas-loading,
.bas-error {
    text-align: center;
    padding: 48px 16px;
}

.bas-loading-icon,
.bas-error-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.bas-loading-icon {
    animation: bas-pulse 1.2s ease-in-out infinite;
}

.bas-loading-text {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.bas-error-text {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: #EF4444;
    display: inline-block;
    padding: 6px 16px;
    border-radius: 999px;
}

/* ---------- Level picker ---------- */

.bas-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 18px;
}

.bas-header-icon {
    display: flex;
    font-size: 30px;
    line-height: 1;
}

.bas-header-icon img {
    display: block;
    height: 38px;
    width: auto;
}

.bas-header-title {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.bas-levels {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.bas-level-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bas-glass-border);
    border-radius: var(--kw-radius, 12px);
    background: var(--bas-glass-bg);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    transition: transform .15s ease, box-shadow .15s ease;
}

.bas-level-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 18px rgba(0, 0, 0, .14);
}

.bas-level-card:active {
    transform: translateY(-1px);
}

.bas-level-thumb {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 70px;
    font-size: 36px;
    background: linear-gradient(135deg, var(--bas-accent-light), var(--bas-accent-border));
    background-size: 88px 88px;
    background-repeat: no-repeat;
    background-position: center;
}

.bas-level-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 10px 16px;
}

.bas-level-name {
    font-size: 17px;
    font-weight: 800;
    color: var(--kw-text, #2D2A32);
    text-align: center;
}

.bas-level-age {
    font-size: 14px;
    font-weight: 700;
    color: var(--bas-accent-dark);
    background: var(--bas-accent-light);
    padding: 2px 10px;
    border-radius: 999px;
}

/* ---------- In-round chrome ---------- */

.bas-level-row {
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.bas-level-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bas-accent-light);
    color: var(--bas-accent-dark);
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 700;
    font-size: 12px;
}

.bas-level-pill-icon {
    display: inline-flex;
    line-height: 1;
}

.bas-level-pill-icon img {
    display: block;
    width: 14px;
    height: 14px;
    object-fit: cover;
    border-radius: 50%;
}

.bas-change-level-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--bas-glass-border);
    background: var(--bas-glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--bas-accent-dark);
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    padding: 6px 12px 6px 10px;
    transition: transform .1s ease, background .15s ease;
}

.bas-change-level-btn svg {
    width: 12px;
    height: 12px;
}

.bas-change-level-btn:hover {
    background: rgba(255, 255, 255, .8);
    transform: translateY(-1px);
}

.bas-change-level-btn:active {
    transform: translateY(0);
}

.bas-progress {
    height: 8px;
    border-radius: 999px;
    background: var(--bas-accent-light);
    overflow: hidden;
    margin-bottom: 12px;
}

.bas-progress-fill {
    height: 100%;
    width: 0;
    background: var(--bas-accent);
    border-radius: 999px;
    transition: width .3s ease;
}

.bas-stat-row {
    justify-content: center;
    margin-bottom: 14px;
}

.bas-stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bas-accent-light);
    color: var(--bas-accent-dark);
    border-radius: 999px;
    padding: 6px 14px;
    font-weight: 700;
    font-size: 14px;
}

.bas-hint-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: none;
    background: #FEF3C7;
    color: #92400E;
    border-radius: 999px;
    padding: 6px 14px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform .1s ease, background .15s ease;
}

.bas-hint-btn:hover:not(:disabled) {
    background: #FDE68A;
    transform: translateY(-1px);
}

.bas-hint-btn:disabled {
    opacity: .5;
    cursor: default;
}

/* ---------- Story head ---------- */

.bas-story-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 6px;
}

.bas-story-emoji {
    font-size: 32px;
    line-height: 1;
}

.bas-story-title {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

.bas-instruction {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #fff;
    opacity: .85;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .2);
    margin-bottom: 14px;
}

/* ---------- Story board (the story so far) ---------- */

.bas-board {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.bas-slot {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--kw-radius, 12px);
    border: 2px dashed var(--bas-glass-border);
    background: rgba(255, 255, 255, .35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background .2s ease, border-color .2s ease;
}

.bas-slot-filled {
    border-style: solid;
    border-color: var(--bas-accent-border);
    background: var(--bas-glass-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.bas-slot-just-placed {
    animation: bas-pop .28s ease;
}

.bas-slot-badge {
    flex: 0 0 auto;
    min-width: 34px;
    text-align: center;
    background: var(--bas-accent-light);
    color: var(--bas-accent-dark);
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 800;
}

.bas-slot-filled .bas-slot-badge {
    background: var(--bas-accent);
    color: #fff;
}

.bas-slot-text {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    color: var(--kw-text, #2D2A32);
}

.bas-slot-next {
    font-weight: 800;
    color: var(--bas-accent-dark);
}

.bas-slot-empty {
    color: #94a3b8;
    letter-spacing: .2em;
}

/* ---------- Part bank ---------- */

.bas-bank-label {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    opacity: .9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .2);
    margin-bottom: 10px;
}

.bas-bank {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bas-part {
    display: block;
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border: 2px solid var(--bas-glass-border);
    border-radius: var(--kw-radius, 12px);
    background: var(--bas-glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--kw-text, #2D2A32);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
    cursor: pointer;
    animation: bas-fade-in .25s ease;
    transition: transform .1s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}

.bas-part:hover {
    transform: translateY(-2px);
    border-color: var(--bas-accent-border);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .1);
}

.bas-part:active {
    transform: translateY(0);
}

.bas-part-hint {
    border-color: #F59E0B;
    background: #FEF3C7;
    animation: bas-glow 1.6s ease;
}

.bas-part-wrong {
    border-color: #EF4444;
    background: #FEE2E2;
    color: #b91c1c;
    animation: bas-shake .4s ease;
}

/* ---------- Round complete ---------- */

.bas-round-done {
    text-align: center;
    background: var(--bas-glass-bg);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid var(--bas-glass-border);
    border-radius: var(--kw-radius, 12px);
    padding: 20px 16px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .12);
    animation: bas-pop .3s ease;
}

.bas-round-done-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--bas-accent-dark);
    margin-bottom: 6px;
}

.bas-round-done-score {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 14px;
}

/* ---------- Final scoreboard ---------- */

.bas-done-card {
    text-align: center;
    background: var(--bas-glass-bg);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid var(--bas-glass-border);
    border-radius: var(--kw-radius, 12px);
    padding: 32px 20px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .12);
    animation: bas-pop .3s ease;
}

.bas-done-emoji {
    font-size: 56px;
    margin-bottom: 8px;
}

.bas-done-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--bas-accent-dark);
    margin-bottom: 6px;
}

.bas-done-score {
    font-size: 16px;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
}

.bas-done-stars {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    font-size: 24px;
}

.bas-done-share {
    justify-content: center;
    margin-top: 16px;
}

.bas-done-actions {
    justify-content: center;
    margin-top: 20px;
}

.bas-btn-primary,
.bas-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    transition: transform .1s ease;
}

.bas-btn-primary {
    background: var(--bas-accent);
    color: #fff;
    box-shadow: 0 3px 0 var(--bas-accent-dark);
}

.bas-btn-primary:hover {
    transform: translateY(-1px);
}

.bas-btn-secondary {
    background: var(--bas-accent-light);
    color: var(--bas-accent-dark);
}

.bas-btn-secondary:hover {
    background: var(--bas-accent-border);
}

@keyframes bas-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bas-pop {
    0% { transform: scale(.92); }
    100% { transform: scale(1); }
}

@keyframes bas-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

@keyframes bas-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
    50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, .35); }
}

@keyframes bas-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: .7; }
}

@media (max-width: 420px) {
    .bas-story-title {
        font-size: 17px;
    }

    .bas-slot-text,
    .bas-part {
        font-size: 14px;
    }

    .bas-part {
        padding: 12px 12px;
    }

    .bas-stat,
    .bas-hint-btn {
        font-size: 13px;
        padding: 5px 11px;
    }
}
