/* ═══════════════════════════════════════════════════
   KINDERGARTEN v5 — Duolingo-Style Vertical Scroll Map
   Clean gradient backgrounds, nodes zigzag vertically
   No background image alignment issues
   ═══════════════════════════════════════════════════ */

:root {
    --kg-node: 76px;
    --kg-node-sm: 56px;
    --kg-node-boss: 92px;
    --kg-path-width: 140px;
}

/* ══════════════ PAGE ══════════════ */
.kg-page { min-height: 100vh; position: relative; overflow: hidden; }

/* ══════════════ ZONE CAROUSEL ══════════════ */
.kg-carousel-scene {
    min-height: 100vh;
    background: linear-gradient(180deg, #87CEEB 0%, #b3e5fc 40%, #a8e6cf 80%, #7ec882 100%);
    position: relative; display: flex; flex-direction: column;
}
.kg-clouds { position: absolute; top: 0; left: 0; right: 0; height: 140px; pointer-events: none; z-index: 1; overflow: hidden; }
.kg-cloud {
    position: absolute; width: 180px; height: 55px;
    background: rgba(255,255,255,0.85); border-radius: 50px; filter: blur(0.5px);
}
.kg-cloud::before, .kg-cloud::after { content:''; position:absolute; background:inherit; border-radius:50%; }
.kg-cloud::before { width:80px; height:50px; top:-24px; left:28px; }
.kg-cloud::after  { width:55px; height:38px; top:-14px; right:22px; }
.kg-cloud:nth-child(1) { top:10px; left:5%; animation: kgDrift 28s linear infinite; }
.kg-cloud:nth-child(2) { top:45px; left:40%; animation: kgDrift 35s linear infinite 6s; }
.kg-cloud:nth-child(3) { top:8px; left:75%; animation: kgDrift 32s linear infinite 12s; }
@keyframes kgDrift { 0%{transform:translateX(0)} 100%{transform:translateX(-110vw)} }

/* Header */
.kg-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; position: relative; z-index: 10;
}
.kg-header-left { display: flex; align-items: center; gap: 10px; }
.kg-back-btn {
    width: 44px; height: 44px; border-radius: 50%; border: none;
    background: rgba(0,0,0,0.3); backdrop-filter: blur(6px);
    color: #fff; font-size: 1.3rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s; box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}
.kg-back-btn:hover { transform: scale(1.1); }
.kg-title { font-size: 1.3rem; font-weight: 800; color: #fff; text-shadow: 2px 2px 6px rgba(0,0,0,0.3); }
.kg-user-badge {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px; background: rgba(0,0,0,0.3);
    border-radius: 18px; color: #fff; font-weight: 700;
    font-size: 0.85rem; backdrop-filter: blur(6px);
}

/* Zone Cards */
.kg-carousel-wrap { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; z-index: 5; }
.kg-carousel {
    display: flex; gap: 20px; padding: 0 calc(50vw - 155px);
    overflow-x: auto; scroll-snap-type: x mandatory;
    scroll-behavior: smooth; scrollbar-width: none; align-items: center; height: 85%;
}
.kg-carousel::-webkit-scrollbar { display: none; }

.kg-zone-card {
    flex: 0 0 310px; height: 400px; border-radius: 24px;
    overflow: hidden; scroll-snap-align: center; cursor: pointer;
    transition: transform 0.35s cubic-bezier(.34,1.56,.64,1), box-shadow 0.3s;
    position: relative; display: flex; flex-direction: column;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2); border: 3px solid rgba(255,255,255,0.3);
}
.kg-zone-card:hover { transform: scale(1.08) translateY(-8px); box-shadow: 0 16px 50px rgba(0,0,0,0.3); }
.kg-zone-header {
    padding: 14px 18px; display: flex; align-items: center; gap: 10px;
    color: #fff; font-weight: 800; font-size: 1.15rem;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
}
.kg-zone-num {
    width: 34px; height: 34px; border-radius: 10px;
    background: rgba(255,255,255,0.25); display: flex;
    align-items: center; justify-content: center;
    font-size: 1rem; font-weight: 900;
}
.kg-zone-art { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.kg-zone-footer { padding: 14px 18px; background: rgba(0,0,0,0.5); backdrop-filter: blur(6px); }
.kg-zone-progress-bar { height: 10px; background: rgba(255,255,255,0.12); border-radius: 5px; overflow: hidden; margin-bottom: 6px; }
.kg-zone-progress-fill { height: 100%; background: linear-gradient(90deg, #4ade80, #22c55e); border-radius: 5px; transition: width 0.6s; box-shadow: 0 0 8px rgba(74,222,128,0.4); }
.kg-zone-progress-text { color: rgba(255,255,255,0.8); font-size: 0.85rem; font-weight: 600; text-align: right; }
.kg-deco-piece { position: fixed; bottom: 12px; font-size: 3rem; opacity: 0.6; z-index: 2; filter: drop-shadow(2px 2px 6px rgba(0,0,0,0.3)); animation: kgSway 4s ease-in-out infinite; }
.kg-deco-piece--left { left: 16px; }
.kg-deco-piece--right { right: 16px; animation-delay: 1.5s; }

/* ═══════════════════════════════════════════════════
   VERTICAL MAP — Duolingo Style
   ═══════════════════════════════════════════════════ */
.kg-map-page {
    position: fixed; inset: 0; z-index: 100;
    display: flex; flex-direction: column;
    overflow: hidden;
}

/* Sticky top bar */
.kg-map-top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; flex-shrink: 0;
    background: rgba(0,0,0,0.15); backdrop-filter: blur(8px);
    z-index: 30; position: relative;
}
.kg-map-title {
    font-size: 1.1rem; font-weight: 800; color: #fff;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
}
.kg-map-progress-mini {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.8rem; font-weight: 700; color: rgba(255,255,255,0.8);
}
.kg-map-progress-bar {
    width: 100px; height: 8px; background: rgba(255,255,255,0.15);
    border-radius: 4px; overflow: hidden;
}
.kg-map-progress-fill {
    height: 100%; background: #4ade80; border-radius: 4px;
    transition: width 0.5s ease;
}

/* Vertical scroll container */
.kg-map-scroll {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    position: relative;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}
.kg-map-scroll::-webkit-scrollbar { width: 0; }

/* Background images — tile vertically */
.kg-map-bg-layer {
    position: absolute; top: 0; left: 0; right: 0;
    z-index: 0; pointer-events: none;
}
.kg-map-bg-img {
    width: 100%; display: block;
    object-fit: cover;
    opacity: 0.35;
}

/* Inner track — fixed width, centered */
.kg-map-track {
    width: 100%; max-width: 420px; margin: 0 auto;
    padding: 30px 20px 80px;
    position: relative; z-index: 1;
}

/* ── VERTICAL PATH (SVG behind nodes) ── */
.kg-vpath {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 100%; height: 100%; pointer-events: none; z-index: 0;
}
.kg-vpath svg { width: 100%; height: 100%; overflow: visible; }

.kg-vpath-line {
    fill: none; stroke: rgba(255,255,255,0.18); stroke-width: 8;
    stroke-linecap: round; stroke-linejoin: round;
}
.kg-vpath-dash {
    fill: none; stroke: rgba(255,255,255,0.3); stroke-width: 3;
    stroke-linecap: round; stroke-dasharray: 6 10;
}

/* ── NODE ROW ── */
.kg-node-row {
    display: flex; align-items: center;
    padding: 4px 0; position: relative; z-index: 5;
    margin-bottom: 8px;
}
.kg-node-row--left  { justify-content: flex-start; padding-left: 10%; }
.kg-node-row--center { justify-content: center; }
.kg-node-row--right { justify-content: flex-end; padding-right: 10%; }

/* ── SECTION DIVIDER (every ~5 nodes) ── */
.kg-section-divider {
    display: flex; align-items: center; justify-content: center;
    padding: 16px 0; margin: 6px 0;
    position: relative; z-index: 5;
}
.kg-section-banner {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 20px; border-radius: 20px;
    background: rgba(255,255,255,0.12); backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 1.5rem; letter-spacing: 6px;
}

/* ═══════════════════════════════════════════════════
   NODES — Vibrant, Bold, Playful
   ═══════════════════════════════════════════════════ */
.kg-node {
    position: relative; cursor: pointer; z-index: 10;
    transition: transform 0.35s cubic-bezier(.34,1.56,.64,1);
    flex-shrink: 0;
}
.kg-node:hover {
    transform: scale(1.2);
    z-index: 20;
}
.kg-node:hover .kg-node-tip {
    opacity: 1; transform: translateX(-50%) translateY(-8px) scale(1);
}

/* ── MAIN NODE ── */
.kg-node-body {
    width: var(--kg-node); height: var(--kg-node);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; position: relative;
    border: 5px solid rgba(255,255,255,0.9);
    transition: box-shadow 0.3s;
}

/* Current — bright blue, bouncy glow */
.kg-node--current .kg-node-body {
    background: linear-gradient(145deg, #42a5f5, #1565c0);
    box-shadow:
        0 0 0 5px rgba(66,165,245,0.25),
        0 8px 24px rgba(21,101,192,0.5),
        inset 0 3px 8px rgba(255,255,255,0.35),
        inset 0 -3px 6px rgba(0,0,0,0.15);
    animation: kgPulse 2s ease-in-out infinite;
}

/* Completed — vibrant green */
.kg-node--completed .kg-node-body {
    background: linear-gradient(145deg, #66bb6a, #2e7d32);
    box-shadow:
        0 0 0 3px rgba(102,187,106,0.2),
        0 6px 18px rgba(46,125,50,0.4),
        inset 0 3px 6px rgba(255,255,255,0.3),
        inset 0 -3px 6px rgba(0,0,0,0.1);
}

/* Locked — soft purple (NEVER grey!) */
.kg-node--locked .kg-node-body {
    background: linear-gradient(145deg, #9575cd, #5c3d99);
    border-color: rgba(255,255,255,0.45);
    box-shadow:
        0 4px 14px rgba(92,61,153,0.35),
        inset 0 2px 4px rgba(255,255,255,0.12),
        inset 0 -3px 6px rgba(0,0,0,0.2);
    cursor: default;
}
.kg-node--locked:hover { transform: scale(1.06); }
.kg-node--locked .kg-node-icon { opacity: 0.65; }

/* Boss — large, red with gold ring */
.kg-node--boss .kg-node-body {
    width: var(--kg-node-boss); height: var(--kg-node-boss);
    background: linear-gradient(145deg, #ff5252, #b71c1c);
    border: 6px solid #ffd54f;
    box-shadow:
        0 0 0 5px rgba(255,82,82,0.25),
        0 0 20px rgba(183,28,28,0.35),
        0 8px 28px rgba(183,28,28,0.5),
        inset 0 3px 8px rgba(255,255,255,0.25),
        inset 0 -4px 8px rgba(0,0,0,0.2);
    font-size: 2.5rem;
}
.kg-node--boss.kg-node--current .kg-node-body { animation: kgBossPulse 1.8s ease-in-out infinite; }
.kg-node--boss.kg-node--completed .kg-node-body { background: linear-gradient(145deg, #66bb6a, #1b5e20); }
.kg-node--boss.kg-node--locked .kg-node-body { background: linear-gradient(145deg, #7e57c2, #4527a0); border-color: rgba(255,213,79,0.4); }

/* Branch / Bonus — star shape */
.kg-node--bonus .kg-node-body {
    width: var(--kg-node-sm); height: var(--kg-node-sm);
    border-radius: 0; border: none;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    box-shadow: none;
    filter: drop-shadow(0 5px 12px rgba(0,0,0,0.3));
    font-size: 1.3rem;
}
.kg-node--bonus.kg-node--completed .kg-node-body { background: linear-gradient(145deg, #ffd54f, #f57f17); }
.kg-node--bonus.kg-node--current .kg-node-body { background: linear-gradient(145deg, #ffca28, #ff8f00); animation: kgStarPulse 2s ease-in-out infinite; }
.kg-node--bonus.kg-node--locked .kg-node-body { background: linear-gradient(145deg, #b39ddb, #7e57c2); }

/* Node icon */
.kg-node-icon { position: relative; z-index: 2; line-height: 1; filter: drop-shadow(1px 2px 3px rgba(0,0,0,0.3)); }

/* Node number */
.kg-node-num {
    position: absolute; top: -3px; right: -3px;
    min-width: 22px; height: 22px; border-radius: 11px;
    background: #fff; color: #333; font-size: 0.6rem; font-weight: 900;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25); z-index: 3; padding: 0 4px;
}
.kg-node--boss .kg-node-num { min-width: 26px; height: 26px; font-size: 0.7rem; }
.kg-node--bonus .kg-node-num { min-width: 18px; height: 18px; font-size: 0.5rem; top: -2px; right: -2px; }

/* Stars under completed */
.kg-node-stars {
    display: flex; gap: 2px; justify-content: center;
    position: absolute; bottom: -16px; left: 50%;
    transform: translateX(-50%); white-space: nowrap;
}
.kg-node-star { font-size: 0.55rem; opacity: 0.2; filter: grayscale(1); }
.kg-node-star--earned { opacity: 1; filter: grayscale(0) drop-shadow(0 1px 3px rgba(255,215,0,0.5)); }

/* Tooltip */
.kg-node-tip {
    position: absolute; bottom: calc(100% + 14px); left: 50%;
    transform: translateX(-50%) translateY(0) scale(0.85);
    background: rgba(15,15,35,0.92); backdrop-filter: blur(10px);
    color: #fff; padding: 8px 16px; border-radius: 12px;
    font-size: 0.78rem; font-weight: 700; white-space: nowrap;
    opacity: 0; pointer-events: none;
    transition: all 0.25s cubic-bezier(.34,1.56,.64,1);
    z-index: 30; box-shadow: 0 6px 24px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
}
.kg-node-tip::after {
    content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    border: 7px solid transparent; border-top-color: rgba(15,15,35,0.92);
}

/* "START" label under current node */
.kg-start-label {
    display: flex; justify-content: center; margin-top: 6px;
}
.kg-start-badge {
    padding: 4px 16px; border-radius: 12px;
    background: linear-gradient(135deg, #42a5f5, #1565c0);
    color: #fff; font-weight: 800; font-size: 0.7rem;
    letter-spacing: 1.5px; text-transform: uppercase;
    box-shadow: 0 3px 10px rgba(21,101,192,0.4);
    animation: kgStartBounce 2s ease-in-out infinite;
}
@keyframes kgStartBounce {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* ── DECORATION ITEMS ── */
.kg-deco {
    position: absolute; pointer-events: none; z-index: 2;
    filter: drop-shadow(2px 3px 5px rgba(0,0,0,0.15));
}
.kg-deco--float { animation: kgFloat 4s ease-in-out infinite; }
.kg-deco--bounce { animation: kgBounce 2.5s ease-in-out infinite; }
.kg-deco--sway { animation: kgSway 3.5s ease-in-out infinite; }

/* ═══════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════ */
@keyframes kgPulse {
    0%,100% { box-shadow: 0 0 0 5px rgba(66,165,245,0.25), 0 8px 24px rgba(21,101,192,0.5), inset 0 3px 8px rgba(255,255,255,0.35), inset 0 -3px 6px rgba(0,0,0,0.15); transform: translateY(0); }
    50%     { box-shadow: 0 0 0 12px rgba(66,165,245,0), 0 12px 32px rgba(21,101,192,0.6), inset 0 3px 8px rgba(255,255,255,0.35), inset 0 -3px 6px rgba(0,0,0,0.15); transform: translateY(-4px); }
}
@keyframes kgBossPulse {
    0%,100% { box-shadow: 0 0 0 5px rgba(255,82,82,0.25), 0 0 20px rgba(183,28,28,0.35), 0 8px 28px rgba(183,28,28,0.5), inset 0 3px 8px rgba(255,255,255,0.25), inset 0 -4px 8px rgba(0,0,0,0.2); }
    50%     { box-shadow: 0 0 0 14px rgba(255,82,82,0), 0 0 30px rgba(183,28,28,0.5), 0 12px 36px rgba(183,28,28,0.6), inset 0 3px 8px rgba(255,255,255,0.25), inset 0 -4px 8px rgba(0,0,0,0.2); }
}
@keyframes kgStarPulse {
    0%,100% { filter: drop-shadow(0 5px 12px rgba(0,0,0,0.3)) drop-shadow(0 0 0 rgba(255,202,40,0.4)); transform: scale(1); }
    50%     { filter: drop-shadow(0 5px 12px rgba(0,0,0,0.3)) drop-shadow(0 0 14px rgba(255,202,40,0.6)); transform: scale(1.1); }
}
@keyframes kgFloat { 0%,100%{transform:translateY(0) rotate(0deg)} 50%{transform:translateY(-10px) rotate(4deg)} }
@keyframes kgBounce { 0%,100%{transform:translateY(0) scale(1)} 50%{transform:translateY(-6px) scale(1.08)} }
@keyframes kgSway { 0%,100%{transform:rotate(-6deg)} 50%{transform:rotate(6deg)} }

/* ═══════════════════════════════════════════════════
   MINI-GAME OVERLAY (kept from previous)
   ═══════════════════════════════════════════════════ */
.kg-game-overlay {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.3);
}
.kg-game-bg-left, .kg-game-bg-right { position: absolute; top: 0; bottom: 0; width: 25%; z-index: 0; background-size: cover; }
.kg-game-bg-left { left: 0; } .kg-game-bg-right { right: 0; }
.kg-game-center { position: relative; z-index: 1; width: min(480px, 50vw); height: min(480px, 85vh); }
.kg-game-close {
    position: absolute; top: 12px; left: 12px; width: 48px; height: 48px;
    border-radius: 50%; background: rgba(0,0,0,0.6); border: 2px solid rgba(255,255,255,0.2);
    color: #fff; font-size: 1.4rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 20; backdrop-filter: blur(6px); transition: transform 0.2s;
}
.kg-game-close:hover { transform: scale(1.1); }
.kg-game-score {
    position: absolute; top: 12px; right: 12px;
    padding: 10px 18px; border-radius: 14px;
    background: rgba(0,0,0,0.6); border: 2px solid rgba(255,255,255,0.15);
    color: #fff; font-size: 1.1rem; font-weight: 800; z-index: 20; backdrop-filter: blur(6px);
    display: flex; align-items: center; gap: 8px;
}
.kg-game-score-check { width: 22px; height: 22px; border-radius: 50%; background: #4ade80; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 900; }
.kg-game-actions { position: absolute; bottom: 14px; right: 14px; display: flex; flex-direction: column; gap: 10px; z-index: 20; }
.kg-game-action-btn {
    width: 48px; height: 48px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.6);
    color: #fff; font-size: 1.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(6px); transition: transform 0.2s;
}
.kg-game-action-btn:hover { transform: scale(1.1); }
.kg-game-settings { position: absolute; bottom: 14px; left: 14px; z-index: 20; }

/* Board */
.kg-board { width: 100%; height: 100%; display: flex; flex-direction: column; border-radius: 20px; overflow: hidden; border: 4px solid rgba(0,0,0,0.2); box-shadow: 0 12px 40px rgba(0,0,0,0.4); position: relative; }
.kg-board-grid { flex: 1; display: grid; grid-template-columns: repeat(5,1fr); grid-template-rows: repeat(5,1fr); }
.kg-cell { position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.15s; aspect-ratio: 1; }
.kg-cell--light { background: #f0f0e0; } .kg-cell--dark { background: #b0c4de; }
.kg-theme-candy .kg-cell--light { background: #fff5ee; } .kg-theme-candy .kg-cell--dark { background: #c8a2c8; }
.kg-theme-ocean .kg-cell--light { background: #e0f7fa; } .kg-theme-ocean .kg-cell--dark { background: #80cbc4; }
.kg-theme-castle .kg-cell--light { background: #f3e5f5; } .kg-theme-castle .kg-cell--dark { background: #ba68c8; }
.kg-theme-forest .kg-cell--light { background: #e8f5e9; } .kg-theme-forest .kg-cell--dark { background: #66bb6a; }
.kg-theme-space .kg-cell--light { background: #ede7f6; } .kg-theme-space .kg-cell--dark { background: #7e57c2; }
.kg-cell--highlight { box-shadow: inset 0 0 0 3px rgba(46,204,113,0.6); }
.kg-cell--selected { box-shadow: inset 0 0 0 3px rgba(52,152,219,0.8); background: rgba(52,152,219,0.15) !important; }

.kg-piece { font-size: 2.5rem; position: relative; z-index: 5; filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.3)); transition: transform 0.25s ease; line-height: 1; }
.kg-piece--moving { animation: kgPieceMove 0.3s ease-out; }
.kg-target { font-size: 2.2rem; position: relative; z-index: 4; filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.2)); animation: kgTargetBob 2s ease-in-out infinite; }
.kg-target--collected { animation: kgTargetCollect 0.4s ease-out forwards; }
.kg-obstacle { font-size: 2rem; position: relative; z-index: 4; filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.2)); }
.kg-trail-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: rgba(100,149,237,0.6); pointer-events: none; z-index: 3; animation: kgTrailFade 1.5s ease-out forwards; }
.kg-lightning { position: absolute; z-index: 10; pointer-events: none; animation: kgLightningFlash 0.6s ease-out forwards; }
.kg-lightning svg { width: 60px; height: 60px; }
.kg-timer-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 6px; background: rgba(0,0,0,0.2); z-index: 15; }
.kg-timer-fill { height: 100%; background: linear-gradient(90deg,#4ade80,#fbbf24,#ef4444); transition: width 1s linear; border-radius: 0 3px 3px 0; }

@keyframes kgPieceMove { 0%{transform:scale(1.2)} 100%{transform:scale(1)} }
@keyframes kgTargetBob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-4px)} }
@keyframes kgTargetCollect { 0%{transform:scale(1);opacity:1} 50%{transform:scale(1.4);opacity:.5} 100%{transform:scale(0);opacity:0} }
@keyframes kgTrailFade { 0%{transform:scale(1);opacity:.6} 100%{transform:scale(.2);opacity:0} }
@keyframes kgLightningFlash { 0%{opacity:1;transform:scale(.5)} 50%{opacity:1;transform:scale(1.2)} 100%{opacity:0;transform:scale(1)} }

/* Completion */
.kg-complete-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; animation: fadeIn 0.3s ease; }
.kg-complete-card { background: linear-gradient(135deg, #1a1a2e, #16213e); border-radius: 28px; padding: 36px; text-align: center; min-width: 300px; border: 2px solid rgba(255,255,255,0.08); box-shadow: 0 24px 70px rgba(0,0,0,0.5); }
.kg-complete-title { font-size: 1.8rem; font-weight: 900; color: #fff; margin-bottom: 14px; }
.kg-complete-stars { font-size: 2.5rem; margin-bottom: 16px; display: flex; justify-content: center; gap: 10px; }
.kg-complete-star { transition: transform 0.3s, opacity 0.3s; }
.kg-complete-star--empty { opacity: 0.15; }
.kg-complete-star--earned { animation: kgStarBurst 0.5s ease-out; }
.kg-complete-rewards { display: flex; gap: 16px; justify-content: center; margin-bottom: 20px; }
.kg-complete-reward { padding: 10px 18px; border-radius: 14px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); }
.kg-complete-reward-value { font-size: 1.2rem; font-weight: 800; color: #4ade80; }
.kg-complete-reward-label { font-size: 0.7rem; color: rgba(255,255,255,0.45); }
.kg-complete-btns { display: flex; gap: 12px; justify-content: center; }
.kg-complete-btn { padding: 12px 28px; border-radius: 14px; border: none; font-weight: 700; font-size: 0.9rem; cursor: pointer; transition: transform 0.2s; }
.kg-complete-btn:hover { transform: scale(1.05); }
.kg-complete-btn--primary { background: linear-gradient(135deg, #42a5f5, #1e88e5); color: #fff; box-shadow: 0 4px 12px rgba(30,136,229,0.3); }
.kg-complete-btn--secondary { background: rgba(255,255,255,0.08); color: #fff; border: 1px solid rgba(255,255,255,0.15); }
@keyframes kgStarBurst { 0%{transform:scale(0) rotate(-30deg);opacity:0} 60%{transform:scale(1.3) rotate(10deg);opacity:1} 100%{transform:scale(1) rotate(0);opacity:1} }

/* ══════════════ RESPONSIVE ══════════════ */
@media (max-width: 768px) {
    :root { --kg-node: 64px; --kg-node-sm: 46px; --kg-node-boss: 78px; }
    .kg-zone-card { flex: 0 0 260px; height: 360px; }
    .kg-carousel { padding: 0 calc(50vw - 130px); }
    .kg-map-track { max-width: 360px; padding: 24px 14px 70px; }
    .kg-game-center { width: min(380px, 65vw); height: min(380px, 70vh); }
    .kg-piece { font-size: 2rem; } .kg-target { font-size: 1.8rem; }
    .kg-game-bg-left, .kg-game-bg-right { width: 17.5%; }
}
@media (max-width: 480px) {
    :root { --kg-node: 56px; --kg-node-sm: 40px; --kg-node-boss: 68px; }
    .kg-zone-card { flex: 0 0 220px; height: 320px; }
    .kg-map-track { max-width: 320px; padding: 20px 10px 60px; }
    .kg-game-center { width: 85vw; height: min(85vw, 75vh); }
    .kg-game-bg-left, .kg-game-bg-right { display: none; }
}
