#game-root {
    --bh-accent: #10B981;
    --bh-accent-dark: #0c8d64;
    --bh-accent-light: #e3f9ef;
    --bh-accent-border: #a7f3d0;
    --bh-glass-bg: rgba(255, 255, 255, .62);
    --bh-glass-border: rgba(255, 255, 255, .45);
    /* Hotbar/crafting chrome modeled on Minecraft's gray inventory UI. */
    --bh-slot-bg: #8b8b8b;
    --bh-slot-light: #ffffff;
    --bh-slot-dark: #373737;
    --bh-panel: #c6c6c6;
}

/*
 * The kwi-* modifier classes game.js passes to KidWorldIcons.svg() are only
 * ever *named* by the shared icon helper, never defined by it, so the
 * tier/status colors are given real values here, scoped to this game.
 */
#game-root .kwi-accent { color: var(--bh-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;
}

.bh-wrap {
    max-width: 860px;
    margin: 0 auto;
}

.bh-wrap-narrow {
    max-width: 480px;
}

/* Every texture is 16x16 pixel art scaled up - keep the pixels crisp. */
.bh-pixel {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

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

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

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

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

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

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

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

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

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

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

.bh-level-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bh-glass-border);
    border-radius: var(--kw-radius, 12px);
    background: var(--bh-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;
}

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

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

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

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

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

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

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

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

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

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

.bh-change-level-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--bh-glass-border);
    background: var(--bh-glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--bh-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;
}

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

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

/* ---- goal checklist ---- */

.bh-goals {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-bottom: 10px;
}

.bh-goal {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bh-glass-bg);
    border: 1px solid var(--bh-glass-border);
    color: var(--kw-text, #2D2A32);
    border-radius: 999px;
    padding: 4px 10px 4px 5px;
    font-size: 12px;
    font-weight: 700;
    transition: background .2s ease, color .2s ease;
}

.bh-goal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 15px;
    line-height: 1;
}

.bh-goal-icon img {
    width: 20px;
    height: 20px;
}

.bh-goal-met {
    background: var(--bh-accent);
    border-color: var(--bh-accent-dark);
    color: #fff;
    animation: bh-pop .3s ease;
}

.bh-goal-check {
    display: inline-flex;
}

.bh-goal-check svg {
    width: 13px;
    height: 13px;
}

/* ---- world stage ---- */

.bh-stage {
    position: relative;
    border-radius: var(--kw-radius, 12px);
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .2);
    background: #7cc8f5;
}

.bh-canvas {
    display: block;
    width: 100%;
    cursor: pointer;
    /* Vertical swipes still scroll the page; horizontal drags pan the world. */
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.bh-pan {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 56px;
    border: none;
    border-radius: 10px;
    background: rgba(0, 0, 0, .28);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s ease;
}

.bh-pan:hover {
    background: rgba(0, 0, 0, .45);
}

.bh-pan svg {
    width: 20px;
    height: 20px;
}

.bh-pan-left {
    left: 6px;
}

.bh-pan-right {
    right: 6px;
}

.bh-toast {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 100px);
    background: rgba(20, 20, 20, .78);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    padding: 7px 14px;
    border-radius: 10px;
    pointer-events: none;
}

.bh-toast-in {
    animation: bh-toast-in .25s ease;
}

/* ---- crafting panel (covers the world while open) ---- */

.bh-craft {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    background: var(--bh-panel);
    border: 3px solid;
    border-color: var(--bh-slot-light) var(--bh-slot-dark) var(--bh-slot-dark) var(--bh-slot-light);
    border-radius: var(--kw-radius, 12px);
    padding: 12px;
    box-sizing: border-box;
    animation: bh-fade-in .2s ease;
}

.bh-craft[hidden] {
    display: none;
}

.bh-craft-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.bh-craft-title {
    font-size: 18px;
    font-weight: 800;
    color: #3f3f3f;
}

.bh-craft-close {
    border: none;
    background: var(--bh-slot-bg);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.bh-craft-close svg {
    width: 16px;
    height: 16px;
}

.bh-craft-group {
    font-size: 13px;
    font-weight: 800;
    color: #555;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 12px 0 6px;
}

.bh-recipes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
}

.bh-recipe {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bh-slot-bg);
    border: 2px solid;
    border-color: var(--bh-slot-dark) var(--bh-slot-light) var(--bh-slot-light) var(--bh-slot-dark);
    border-radius: 6px;
    padding: 8px;
    color: #fff;
}

.bh-recipe-locked {
    opacity: .7;
}

.bh-recipe-out {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bh-recipe-out-img {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
}

.bh-recipe-name {
    font-size: 14px;
    font-weight: 800;
    text-shadow: 1px 1px 0 #3f3f3f;
}

.bh-recipe-ins {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.bh-ing {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(0, 0, 0, .22);
    border-radius: 999px;
    padding: 2px 8px 2px 3px;
    font-size: 12px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.bh-ing-img {
    width: 18px;
    height: 18px;
}

.bh-ing-missing {
    color: #fecaca;
    background: rgba(185, 28, 28, .45);
}

.bh-recipe-btn {
    border: none;
    background: var(--bh-accent);
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    border-radius: 6px;
    padding: 7px 10px;
    cursor: pointer;
    box-shadow: 0 2px 0 var(--bh-accent-dark);
    transition: transform .1s ease;
}

.bh-recipe-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.bh-recipe-btn:disabled {
    background: #6b6b6b;
    box-shadow: none;
    cursor: default;
}

/* ---- hotbar ---- */

.bh-hotbar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
    padding: 5px;
    background: var(--bh-panel);
    border: 3px solid;
    border-color: var(--bh-slot-light) var(--bh-slot-dark) var(--bh-slot-dark) var(--bh-slot-light);
    border-radius: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.bh-slot {
    position: relative;
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    padding: 0;
    background: var(--bh-slot-bg);
    border: 3px solid;
    border-color: var(--bh-slot-dark) var(--bh-slot-light) var(--bh-slot-light) var(--bh-slot-dark);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.bh-slot-active {
    border-color: #fff;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--bh-accent);
    background: #a3a3a3;
}

.bh-slot-craftonly {
    cursor: help;
}

.bh-slot-img {
    width: 32px;
    height: 32px;
}

.bh-slot-emoji {
    font-size: 26px;
    line-height: 1;
}

.bh-slot-count {
    position: absolute;
    right: 2px;
    bottom: 0;
    font-size: 13px;
    font-weight: 900;
    color: #fff;
    text-shadow: 1px 1px 0 #3f3f3f;
    font-variant-numeric: tabular-nums;
}

.bh-hotbar-empty {
    font-size: 12px;
    font-weight: 700;
    color: #555;
    padding: 0 8px;
}

/* ---- controls ---- */

.bh-control-row {
    justify-content: center;
    margin-top: 12px;
    margin-bottom: 0;
}

.bh-btn {
    border: none;
    background: var(--bh-accent-light);
    color: var(--bh-accent-dark);
    border-radius: 999px;
    padding: 9px 16px;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    transition: transform .1s ease, background .15s ease;
}

.bh-btn:hover:not(:disabled) {
    background: var(--bh-accent-border);
    transform: translateY(-1px);
}

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

.bh-btn-on {
    background: var(--bh-accent-border);
}

.bh-btn-craft,
.bh-btn-finish {
    background: var(--bh-accent);
    color: #fff;
    box-shadow: 0 3px 0 var(--bh-accent-dark);
}

.bh-btn-craft:hover:not(:disabled),
.bh-btn-finish:hover:not(:disabled) {
    background: var(--bh-accent);
}

.bh-btn-craft.bh-btn-on {
    background: var(--bh-accent-dark);
}

.bh-btn-finish.bh-btn-warn {
    background: #F59E0B;
    box-shadow: 0 3px 0 #b45309;
}

.bh-tip {
    min-height: 20px;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

/* ---- result screen ---- */

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

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

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

.bh-done-shot-wrap {
    margin: 0 auto 12px;
}

.bh-done-shot {
    display: block;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 8px;
    border: 3px solid #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .2);
    image-rendering: pixelated;
}

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

.bh-done-meta {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.bh-done-meta-item {
    background: var(--bh-accent-light);
    color: var(--bh-accent-dark);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
}

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

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

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

.bh-btn-primary,
.bh-btn-secondary {
    border: none;
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    transition: transform .1s ease;
}

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

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

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

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

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

@keyframes bh-toast-in {
    from { opacity: 0; transform: translate(-50%, -6px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

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

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

@media (max-width: 576px) {
    .bh-pan {
        width: 30px;
        height: 48px;
    }

    .bh-toast {
        max-width: calc(100% - 80px);
        font-size: 12px;
    }

    .bh-slot {
        width: 46px;
        height: 46px;
    }

    .bh-recipes {
        grid-template-columns: 1fr 1fr;
    }
}
