#game-root {
    --h-accent: #10B981;
    --h-accent-dark: #0e9c6f;
    --h-accent-light: #e3f9ef;
    --h-accent-border: #a7f3d0;
    --h-rod: #92653f;
    --h-base: #6b4423;
    border-radius: var(--kw-radius, 16px);
}

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

.h-wrap {
    max-width: 480px;
    margin: 0 auto;
}

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

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

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

.h-loading-text {
    font-size: 15px;
    color: #666;
}

.h-error-text {
    font-size: 15px;
    font-weight: 700;
    color: #EF4444;
}

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

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

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

.h-header-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--h-accent);
}

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

.h-level-card {
    display: flex;
    flex-direction: column;
    border: none;
    border-radius: var(--kw-radius, 16px);
    background: #fff;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    transition: transform .15s ease, box-shadow .15s ease;
}

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

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

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

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

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

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

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

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

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

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

.h-change-level-btn {
    border: none;
    background: none;
    color: var(--h-accent-dark);
    text-decoration: underline;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    padding: 4px;
}

.h-change-level-btn:hover {
    color: var(--h-accent);
}

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

.h-stat {
    background: var(--h-accent-light);
    color: var(--h-accent-dark);
    border-radius: 999px;
    padding: 6px 14px;
    font-weight: 700;
    font-size: 14px;
}

.h-board-wrap {
    position: relative;
    max-width: 480px;
    margin: 0 auto;
}

.h-board {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 6px;
    height: 270px;
    background: linear-gradient(180deg, #f4f9f7, #eef8f3);
    border-radius: var(--kw-radius, 16px);
    box-shadow: 0 3px 12px rgba(0, 0, 0, .07);
    padding: 30px 10px 0;
    animation: h-fade-in .25s ease;
}

.h-peg {
    position: relative;
    flex: 1 1 0;
    max-width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    touch-action: none;
    border-radius: var(--kw-radius, 16px);
    transition: box-shadow .12s ease;
}

.h-peg-drop-ok {
    box-shadow: inset 0 0 0 3px var(--h-accent);
}

.h-peg-drop-bad {
    box-shadow: inset 0 0 0 3px #EF4444;
}

.h-peg-rod {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: calc(100% - 16px);
    background: var(--h-rod);
    border-radius: 4px 4px 0 0;
    z-index: 1;
    transition: background .15s ease;
}

.h-peg-selected .h-peg-rod,
.h-peg-hint .h-peg-rod {
    background: var(--h-accent);
}

.h-peg-hint {
    animation: h-hint-glow 1s ease-in-out infinite;
}

.h-peg-stack {
    position: relative;
    z-index: 2;
    flex: 1 1 auto;
    width: 100%;
    max-width: 116px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}

.h-disk {
    height: 24px;
    margin-bottom: 3px;
    border-radius: 8px;
    box-shadow: 0 2px 3px rgba(0, 0, 0, .2), inset 0 -3px 0 rgba(0, 0, 0, .12), inset 0 2px 0 rgba(255, 255, 255, .3);
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 12px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
    user-select: none;
}

.h-disk-lifted {
    transform: translateY(-16px);
    box-shadow: 0 8px 10px rgba(0, 0, 0, .25), inset 0 -3px 0 rgba(0, 0, 0, .12), inset 0 2px 0 rgba(255, 255, 255, .3);
    cursor: grabbing;
}

.h-disk-dragging {
    opacity: .25;
}

.h-disk-ghost {
    position: fixed;
    top: 0;
    left: 0;
    margin-bottom: 0;
    pointer-events: none;
    cursor: grabbing;
    z-index: 2000;
    box-shadow: 0 10px 20px rgba(0, 0, 0, .35), inset 0 -3px 0 rgba(0, 0, 0, .12), inset 0 2px 0 rgba(255, 255, 255, .3);
    transition: none;
}

.h-peg-base {
    position: relative;
    z-index: 2;
    flex: 0 0 16px;
    width: 92%;
    max-width: 140px;
    background: var(--h-base);
    border-radius: 8px;
    margin-top: 1px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .18);
}

.h-peg-flag {
    position: absolute;
    top: -26px;
    font-size: 22px;
    line-height: 1;
}

.h-board.h-bump,
.h-peg.h-bump {
    animation: h-shake .2s ease;
}

.h-toast {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, .75);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    padding: 14px 22px;
    border-radius: 14px;
    animation: h-toast-pop .3s ease;
    pointer-events: none;
    white-space: nowrap;
    z-index: 3;
}

.h-hint-row {
    justify-content: center;
    margin-top: 18px;
    margin-bottom: 0;
}

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

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

.h-hint-btn:disabled {
    opacity: .45;
    cursor: default;
}

.h-done-card {
    text-align: center;
    background: #fff;
    border-radius: var(--kw-radius, 16px);
    padding: 32px 20px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .07);
    animation: h-pop .3s ease;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@keyframes h-toast-pop {
    0% { transform: translate(-50%, -50%) scale(.85); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes h-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-3px); }
}

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

@keyframes h-hint-glow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.35); }
}

@media (max-width: 380px) {
    .h-levels {
        grid-template-columns: 1fr;
    }

    .h-board {
        height: 190px;
    }

    .h-disk {
        height: 20px;
    }
}
