#game-root {
    --jp-accent: #10B981;
    --jp-accent-dark: #0e9c6f;
    --jp-accent-light: #e3f9ef;
    --jp-accent-border: #a7f3d0;
    border-radius: var(--kw-radius, 16px);
}

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

.jp-wrap {
    max-width: 560px;
    margin: 0 auto;
}

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

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

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

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

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

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

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

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

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

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

.jp-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;
}

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

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

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

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

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

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

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

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

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

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

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

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

.jp-stat-row {
    justify-content: center;
    margin-bottom: 14px;
    text-align: center;
}

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

.jp-thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 18px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
    flex-shrink: 0;
}

.jp-board-wrap {
    background: #fff;
    border-radius: var(--kw-radius, 16px);
    padding: 10px;
    margin-bottom: 15px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .07);
    animation: jp-fade-in .25s ease;
}

.jp-board {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
    background: #faf9ff;
    border-radius: 12px;
}

.jp-target-outline {
    fill: rgba(0, 0, 0, .035);
    stroke: #c9c5db;
    stroke-width: 1.5;
    stroke-dasharray: 4, 4;
    pointer-events: none;
}

.jp-ghost-layer {
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}

.jp-ghost-layer.jp-ghost-visible {
    opacity: .22;
}

.jp-target-outline.hint-active {
    stroke: #EF4444;
    stroke-width: 3.5;
    fill: rgba(239, 68, 68, .22);
    animation: jp-hint-pulse-outline .7s ease-in-out infinite;
}

.jp-piece {
    cursor: grab;
}

.jp-piece-edge {
    fill: none;
    stroke: rgba(0, 0, 0, .3);
    stroke-width: 1.5;
    transition: stroke .15s ease;
}

.jp-piece.hint-active .jp-piece-edge {
    stroke: #EF4444;
    stroke-width: 4;
    animation: jp-hint-pulse-piece .7s ease-in-out infinite;
}

.jp-piece-highlight {
    fill: #EF4444;
    fill-opacity: 0;
    pointer-events: none;
    transition: fill-opacity .15s ease;
}

.jp-piece.hint-active .jp-piece-highlight {
    animation: jp-hint-pulse-fill .7s ease-in-out infinite;
}

.jp-piece:active {
    cursor: grabbing;
}

.jp-piece:hover .jp-piece-edge {
    stroke: #2D2A32;
    stroke-width: 2;
}

.jp-piece.placed {
    pointer-events: none;
}

.jp-piece.placed .jp-piece-edge {
    stroke: rgba(255, 255, 255, .85);
    stroke-width: 1;
}

.jp-controls {
    justify-content: center;
}

.jp-ctrl-btn {
    background: var(--jp-accent);
    color: #fff;
    border: none;
    padding: 9px 18px;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
}

.jp-ctrl-btn:hover:not(:disabled) {
    opacity: .9;
}

.jp-ctrl-btn:disabled {
    opacity: .45;
    cursor: default;
}

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

.jp-hint {
    text-align: center;
    font-size: 12px;
    color: #888;
    margin-top: 10px;
}

.jp-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: jp-pop .3s ease;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@keyframes jp-hint-pulse-outline {
    0%, 100% { stroke-opacity: 1; fill-opacity: 1; }
    50% { stroke-opacity: .35; fill-opacity: .35; }
}

@keyframes jp-hint-pulse-piece {
    0%, 100% { filter: drop-shadow(0 0 0 rgba(239, 68, 68, 0)); }
    50% { filter: drop-shadow(0 0 16px rgba(239, 68, 68, 1)); }
}

@keyframes jp-hint-pulse-fill {
    0%, 100% { fill-opacity: .18; }
    50% { fill-opacity: .6; }
}

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