@font-face {
  font-family: 'Courier Prime';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/courier-prime.ttf') format('truetype');
}
@font-face {
  font-family: 'Fredoka One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/fredoka-one.ttf') format('truetype');
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background: radial-gradient(circle, #2a1147 0%, #0f071e 100%);
    height: 100vh;
    font-family: 'Fredoka One', cursive;
    overflow: hidden;
    user-select: none;
    transition: background 1s ease;
}

#game-container {
    position: relative;
    width: 1024px;
    height: 576px;
    transform-origin: top left;
    will-change: transform;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(255, 51, 136, 0.35), 0 0 20px rgba(56, 189, 248, 0.2);
    border: 4px solid #ff66aa;
    transition: border-color 0.5s, box-shadow 0.5s;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: auto;
    outline: none;
}

canvas:focus {
    outline: none;
}

#ui-overlay {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: #2e1065;
    font-size: 17px;
    font-family: 'Fredoka One', cursive;
    letter-spacing: 1px;
    pointer-events: none;
    z-index: 10;
    display: flex;
    gap: 25px;
    align-items: center;
    padding: 8px 26px;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #ff66aa;
    border-radius: 24px;
    box-shadow: 0 8px 25px rgba(255, 102, 170, 0.3);
    transition: all 0.5s;
}

#health-label {
    color: #db2777;
    font-family: 'Fredoka One', cursive;
}

.health-bar-container {
    width: 200px;
    height: 20px;
    background: rgba(28, 16, 32, 0.55);
    border-radius: 12px;
    border: 2.5px solid #ff3388;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.35), 0 0 12px rgba(255, 51, 136, 0.35);
    transition: border-color 0.4s, box-shadow 0.4s, background 0.4s;
    display: flex;
    align-items: center;
}

.health-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff2a85, #ff55a3, #ff007f);
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 0 12px rgba(255, 51, 136, 0.7);
    transition: width 0.3s ease-out, background 0.4s, box-shadow 0.4s;
}

.hp-counter-text {
    position: absolute;
    width: 100%;
    left: 0;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    font-family: 'Fredoka One', 'Courier Prime', monospace;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.85);
    pointer-events: none;
    letter-spacing: 0.5px;
    z-index: 2;
}

#score-display {
    font-size: 16px;
    color: #ca8a04;
    letter-spacing: 1px;
    font-family: 'Fredoka One', cursive;
    font-weight: normal;
    text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}

#level-display {
    color: #0284c7;
    font-family: 'Fredoka One', cursive;
    letter-spacing: 1px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.8);
    transition: all 0.5s;
}

#message {
    position: absolute;
    top: 45%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    color: #ffd700;
    font-size: 38px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 3px 3px 0 #ff3388;
    pointer-events: none;
    z-index: 130;
    text-align: center;
    padding: 20px 45px;
    opacity: 0;
    background: rgba(30, 15, 60, 0.96);
    border-radius: 26px;
    border: 4px solid #ffd700;
    font-family: 'Fredoka One', cursive;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.35);
}

#dialog-box {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.97);
    border: 4px solid #ff66aa;
    border-radius: 24px;
    padding: 16px 24px;
    display: flex;
    gap: 20px;
    align-items: center;
    z-index: 140;
    box-shadow: 0 12px 35px rgba(255, 102, 170, 0.35);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

#dialog-box.dialog-hidden {
    transform: translate(-50%, 120%);
    opacity: 0;
    pointer-events: none;
}

#dialog-portrait {
    font-size: 44px;
    width: 64px;
    height: 64px;
    background: #fce7f3;
    border: 2px solid #f472b6;
    border-radius: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    box-shadow: inset 0 2px 6px rgba(255, 102, 170, 0.2);
}

.dialog-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#dialog-speaker {
    font-family: 'Fredoka One', cursive;
    font-size: 19px;
    color: #db2777;
    letter-spacing: 1px;
}

#dialog-text {
    font-family: 'Fredoka One', cursive, sans-serif;
    font-size: 16px;
    color: #2e1065;
    line-height: 1.4;
    min-height: 44px;
}

#dialog-prompt {
    font-family: 'Fredoka One', cursive;
    font-size: 13px;
    color: #0284c7;
    align-self: flex-end;
    letter-spacing: 1px;
    animation: pulsePrompt 1.2s infinite;
}

@keyframes pulsePrompt {
    0%, 100% { opacity: 0.9; transform: translateX(0); }
    50% { opacity: 0.3; transform: translateX(4px); }
}

#blackout {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: black; z-index: 100; opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
}

#choice {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 8, 30, 0.92); z-index: 30;
    display: none; flex-direction: column;
    justify-content: center; align-items: center; gap: 30px;
    text-align: center;
}
#choice .choice-text {
    color: #ff3388; font-size: 32px;
    text-shadow: 0 0 20px rgba(255,51,136,0.5);
    letter-spacing: 1px; font-family: 'Fredoka One', cursive;
    max-width: 80%;
}
#choice .choice-buttons { display: flex; gap: 40px; margin-top: 10px; }
#choice button {
    font-family: 'Fredoka One', cursive; font-size: 26px; font-weight: normal;
    padding: 14px 40px; border: 3px solid #fff; cursor: pointer; border-radius: 18px;
    background: rgba(255,255,255,0.1); color: #fff; letter-spacing: 2px;
    transition: transform 0.2s, box-shadow 0.2s;
}
#choice #btnSi { background: #10b981; border-color: #34d399; }
#choice #btnNo { background: #f43f5e; border-color: #fb7185; }
#choice button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#choice .choice-sub { color: #cbd5e1; font-size: 15px; font-family: 'Fredoka One', cursive; }

#handOverlay {
    position: fixed; left: -120px; top: -120px; z-index: 120; font-size: 96px;
    line-height: 1; pointer-events: none; display: none;
    filter: drop-shadow(0 0 16px rgba(255,0,0,0.9));
    transform: translate(-50%, -50%);
}
#cursorOverlay {
    position: fixed; left: 0; top: 0; z-index: 200; font-size: 32px;
    line-height: 1; pointer-events: none; display: none;
    color: #fff;
    filter: drop-shadow(0 0 10px rgba(255,255,255,1));
    -webkit-text-stroke: 2px #000;
    transform: translate(-50%, -50%);
}
body.no-cursor, body.no-cursor * { cursor: none !important; }

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(19, 9, 36, 0.92);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: hidden;
}
.modal-overlay.active {
    display: flex;
    overflow: hidden;
    opacity: 1;
}

.modal-box {
    background: linear-gradient(145deg, #1e1b4b 0%, #31103f 100%);
    border: 3.5px solid #f472b6;
    border-radius: 24px;
    padding: 30px 36px;
    max-width: 580px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    color: #fff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(244, 114, 182, 0.25);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal-overlay.active .modal-box {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 2px solid rgba(255,255,255,0.1);
    padding-bottom: 12px;
}
.modal-header h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 26px;
    color: #fde047;
    letter-spacing: 1.5px;
    margin: 0;
}
.modal-badge {
    font-family: 'Fredoka One', cursive;
    font-size: 12px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1.5px solid #38bdf8;
    padding: 4px 12px;
    border-radius: 14px;
}

.controls-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}
.ctrl-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    transition: background 0.2s;
}
.ctrl-item:hover {
    background: rgba(255, 255, 255, 0.12);
}
.ctrl-keys {
    display: flex;
    align-items: center;
    gap: 6px;
}
.key-badge {
    font-family: 'Fredoka One', cursive;
    font-weight: normal;
    font-size: 14px;
    color: #fff;
    background: linear-gradient(135deg, #ff66aa 0%, #db2777 100%);
    border: 1.5px solid #f472b6;
    padding: 6px 14px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(219, 39, 119, 0.4);
}
.key-sub {
    font-size: 12px;
    color: #cbd5e1;
    margin-left: 4px;
    font-family: 'Fredoka One', cursive;
}
.ctrl-desc {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: 'Fredoka One', cursive;
}
.ctrl-desc strong {
    font-size: 15px;
    color: #f8fafc;
}
.ctrl-desc span {
    font-size: 12px;
    color: #cbd5e1;
    font-weight: normal;
}

.credits-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    font-family: 'Fredoka One', cursive;
}
.credits-section {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border-left: 4px solid #ff66aa;
}
.credits-section h3 {
    color: #fde047;
    font-family: 'Fredoka One', cursive;
    font-size: 19px;
    margin-bottom: 4px;
}
.credits-section h4 {
    color: #38bdf8;
    font-size: 15px;
    margin-bottom: 4px;
}
.credits-section p {
    font-size: 13px;
    color: #e2e8f0;
    line-height: 1.4;
    font-weight: normal;
}
.credits-sub {
    color: #cbd5e1 !important;
    font-size: 12px !important;
}
.credits-author {
    font-weight: bold;
    color: #fff !important;
}
.credits-note {
    font-size: 11px !important;
    color: #94a3b8 !important;
}

.victory-modal-box {
    text-align: center;
    border-color: #fde047;
    box-shadow: 0 0 50px rgba(253, 224, 71, 0.35);
}
.victory-icon {
    font-size: 64px;
    margin-bottom: 10px;
    animation: bounceIcon 1.5s infinite ease-in-out;
}
@keyframes bounceIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.victory-modal-box h2 {
    font-family: 'Fredoka One', cursive;
    color: #fde047;
    font-size: 30px;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}
.victory-desc {
    font-family: 'Fredoka One', cursive;
    color: #cbd5e1;
    font-size: 15px;
    margin-bottom: 24px;
    font-weight: normal;
}
.victory-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 24px;
}
.stat-card {
    flex: 1;
    background: rgba(253, 224, 71, 0.1);
    border: 2px solid rgba(253, 224, 71, 0.4);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stat-title {
    font-family: 'Fredoka One', cursive;
    font-size: 12px;
    color: #cbd5e1;
    letter-spacing: 1px;
    font-weight: normal;
}
.stat-val {
    font-family: 'Fredoka One', cursive;
    font-size: 24px;
    color: #fde047;
}

.modal-close-btn {
    font-family: 'Fredoka One', cursive;
    font-size: 17px;
    padding: 12px 28px;
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    color: #fff;
    border: 2px solid #7dd3fc;
    border-radius: 18px;
    cursor: pointer;
    width: 100%;
    transition: all 0.25s ease;
    letter-spacing: 1px;
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}
.modal-close-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 25px rgba(56, 189, 248, 0.6);
    border-color: #ffffff;
}
.modal-close-btn.primary-btn {
    background: linear-gradient(135deg, #ff3388 0%, #db2777 100%);
    color: #fff;
    border-color: #ff99cc;
    box-shadow: 0 6px 20px rgba(255, 51, 136, 0.4);
}
.modal-close-btn.primary-btn:hover {
    background: linear-gradient(135deg, #ff66aa 0%, #ff3388 100%);
    box-shadow: 0 8px 25px rgba(255, 51, 136, 0.6);
    border-color: #ffffff;
}

.gameover-modal-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: radial-gradient(circle at 50% 15%, #2a1022 0%, #180a1c 55%, #0d0611 100%);
    border: 2.5px solid #f43f5e;
    border-radius: 22px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 40px rgba(244, 63, 94, 0.35);
    max-width: 480px;
    width: 92%;
    padding: 20px 24px;
    box-sizing: border-box;
}
.gameover-icon {
    order: 1;
    font-size: 40px;
    line-height: 1;
    margin-bottom: 4px;
    animation: pulseIcon 1.5s infinite ease-in-out;
    filter: drop-shadow(0 0 12px rgba(244, 63, 94, 0.6));
}
@keyframes pulseIcon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}
.gameover-modal-box h2 {
    order: 2;
    font-family: 'Fredoka One', cursive;
    color: #ff4d6d;
    font-size: 26px;
    letter-spacing: 1.5px;
    margin: 0 0 4px 0;
    text-shadow: 0 0 20px rgba(255, 77, 109, 0.6), 2px 2px 0 rgba(0, 0, 0, 0.8);
}
.gameover-desc {
    order: 3;
    font-family: 'Fredoka One', cursive;
    color: #cbd5e1;
    font-size: 13.5px;
    margin: 0 0 12px 0;
    font-weight: normal;
    letter-spacing: 0.5px;
    line-height: 1.35;
}

.revive-ad-box {
    order: 4;
    text-align: center;
    width: 100%;
    margin: 0 0 10px 0;
}
.revive-ad-btn {
    font-family: 'Fredoka One', cursive;
    font-size: 14.5px;
    padding: 10px 16px;
    border-radius: 16px;
    border: 2px solid #fde047;
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 50%, #e11d48 100%);
    color: #fff;
    cursor: pointer;
    width: 100%;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 22px rgba(245, 158, 11, 0.5), 0 6px 18px rgba(225, 29, 72, 0.4);
    transition: all 0.2s ease;
    animation: revivePulse 1.1s infinite ease-in-out;
    box-sizing: border-box;
    letter-spacing: 0.4px;
}
.revive-ad-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 0 32px rgba(250, 204, 21, 0.85), 0 8px 24px rgba(244, 63, 94, 0.65);
    border-color: #ffffff;
}
.revive-ad-btn:active {
    transform: scale(0.97);
}
.revive-ad-btn:disabled {
    opacity: .5;
    cursor: default;
    animation: none;
}
.revive-ad-note {
    font-family: 'Courier Prime', monospace;
    color: #fde68a;
    font-size: 11px;
    margin-top: 4px;
    margin-bottom: 0;
    letter-spacing: 0.3px;
    opacity: 0.95;
}
@keyframes revivePulse {
    0%, 100% {
        box-shadow: 0 0 18px rgba(245, 158, 11, 0.45), 0 4px 14px rgba(225, 29, 72, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 30px rgba(253, 224, 71, 0.85), 0 6px 20px rgba(244, 63, 94, 0.65);
        transform: scale(1.02);
    }
}

.gameover-buttons {
    order: 5;
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
}
.gameover-buttons .modal-close-btn {
    flex: 1;
    margin-top: 0;
    padding: 10px 12px;
    font-size: 13.5px;
    border-radius: 14px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.25;
    box-sizing: border-box;
}
.gameover-buttons #gameover-retry-btn {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    border: 2px solid #38bdf8;
    color: #fff;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}
.gameover-buttons #gameover-retry-btn:hover {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.6);
    border-color: #ffffff;
}
.gameover-buttons #gameover-exit-btn {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border: 2px solid #64748b;
    color: #e2e8f0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.gameover-buttons #gameover-exit-btn:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    box-shadow: 0 6px 20px rgba(100, 116, 139, 0.6);
    border-color: #ffffff;
}

@media (max-height: 520px), (max-width: 680px) {
    #gameover-modal .gameover-modal-box {
        padding: 8px 16px !important;
        max-width: 470px !important;
        max-height: 96vh !important;
        border-radius: 16px !important;
        overflow-y: visible !important;
    }
    #gameover-modal .gameover-icon {
        font-size: 26px !important;
        margin-bottom: 2px !important;
    }
    #gameover-modal .gameover-modal-box h2 {
        font-size: 19px !important;
        margin-bottom: 2px !important;
        letter-spacing: 1px !important;
    }
    #gameover-modal .gameover-desc {
        font-size: 11px !important;
        margin-bottom: 6px !important;
        line-height: 1.2 !important;
    }
    #gameover-modal .revive-ad-box {
        margin: 0 0 6px 0 !important;
    }
    #gameover-modal .revive-ad-btn {
        font-size: 12.5px !important;
        padding: 6px 10px !important;
        border-radius: 11px !important;
        border-width: 1.5px !important;
        line-height: 1.25 !important;
    }
    #gameover-modal .revive-ad-note {
        font-size: 9.5px !important;
        margin-top: 2px !important;
    }
    #gameover-modal .gameover-buttons {
        gap: 8px !important;
    }
    #gameover-modal .gameover-buttons .modal-close-btn {
        font-size: 11.5px !important;
        padding: 6px 8px !important;
        border-radius: 11px !important;
        min-height: 34px !important;
        letter-spacing: 0.5px !important;
        margin-top: 0 !important;
    }
}

.defeat-overlay {
    background: rgba(0, 0, 0, 0.93);
    z-index: 70;
}
.defeat-box { text-align: center; padding: 30px; }
.defeat-title {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(52px, 11vw, 120px);
    color: #e11d2e;
    letter-spacing: 8px;
    margin: 0 0 45px;
    text-shadow: 0 0 35px rgba(225, 29, 46, 0.85), 5px 5px 0 #000;
    animation: defeatPulse 1.6s ease-in-out infinite;
}
@keyframes defeatPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.06); opacity: 0.85; }
}
.defeat-buttons {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
}
.modal-close-btn.secondary-btn {
    background: linear-gradient(135deg, #475569 0%, #1e293b 100%);
    color: #fff;
    border-color: #94a3b8;
    box-shadow: 0 6px 20px rgba(71, 85, 105, 0.4);
}
.modal-close-btn.secondary-btn:hover {
    background: linear-gradient(135deg, #64748b 0%, #334155 100%);
    box-shadow: 0 8px 25px rgba(100, 116, 139, 0.6);
    border-color: #ffffff;
}

.level-map-box.full-screen-map {
    width: 96vw;
    height: 92vh;
    max-width: 1200px;
    max-height: 720px;
    padding: 20px 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 30%, #1e1b4b 0%, #060913 100%);
    border: 3.5px solid #38bdf8;
    box-shadow: 0 0 60px rgba(56, 189, 248, 0.45), inset 0 0 50px rgba(0, 0, 0, 0.7);
    border-radius: 28px;
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    border-bottom: 2px solid rgba(56, 189, 248, 0.25);
    padding-bottom: 12px;
}

.map-title-group h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 28px;
    color: #fde047;
    text-shadow: 0 0 16px rgba(253, 224, 71, 0.6);
    margin: 0;
    letter-spacing: 1.5px;
}

.map-title-group p {
    font-family: 'Fredoka One', cursive;
    font-size: 13px;
    color: #cbd5e1;
    margin: 3px 0 0 0;
    font-weight: normal;
}

.map-back-btn {
    font-family: 'Fredoka One', cursive;
    font-size: 14px;
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    transition: all 0.25s ease;
}

.map-back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ffd700;
    transform: scale(1.05);
}

.world-map-viewport {
    position: relative;
    flex: 1;
    margin: 14px 0;
    border-radius: 20px;
    background: radial-gradient(circle at 40% 40%, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.9) 100%);
    border: 2px solid rgba(56, 189, 248, 0.2);
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

.map-grid-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    opacity: 0.4;
}

.map-path-svg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
}

.map-path-base {
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 8;
    stroke-dasharray: 10 10;
    fill: none;
}

.map-path-active {
    stroke: url(#pathGrad);
    stroke-width: 8;
    stroke-dasharray: 14 14;
    fill: none;
    filter: url(#pathGlow);
    animation: dashFlow 2s linear infinite;
}

@keyframes dashFlow {
    from { stroke-dashoffset: 56; }
    to { stroke-dashoffset: 0; }
}

.map-nodes-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 5;
}

.level-node {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
}

.node-ring {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #0f172a;
    border: 3.5px solid #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    transition: all 0.3s ease;
}

.node-icon {
    font-size: 32px;
    line-height: 1;
}

.level-card-lock {
    position: absolute;
    top: -6px; right: -6px;
    font-size: 18px;
    background: #1e293b;
    border: 2px solid #64748b;
    border-radius: 50%;
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
}

.node-info {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(15, 23, 42, 0.92);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 4px 12px;
    transition: all 0.3s ease;
}

.node-num {
    font-family: 'Fredoka One', cursive;
    font-size: 11px;
    color: #94a3b8;
    letter-spacing: 1px;
}

.node-name {
    font-family: 'Fredoka One', cursive;
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
}

.level-node.unlocked .node-ring {
    border-color: #38bdf8;
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.5);
}

.level-node.unlocked .level-card-lock {
    display: none;
}

.level-node.selected .node-ring {
    border-color: #ffd700;
    transform: scale(1.18);
    box-shadow: 0 0 35px rgba(255, 215, 0, 0.8), inset 0 0 15px rgba(255, 215, 0, 0.5);
    background: #1e1b4b;
}

.level-node.selected .node-info {
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.level-node.selected .node-name {
    color: #ffd700;
}

.level-node.locked {
    opacity: 0.5;
    filter: grayscale(0.85);
    cursor: not-allowed;
}

.level-node:hover.unlocked {
    transform: translate(-50%, -50%) scale(1.12);
}

.map-player-pin {
    position: absolute;
    z-index: 10;
    transform: translate(-50%, -100%);
    pointer-events: none;
    transition: left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), top 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pin-avatar {
    font-size: 36px;
    animation: pinFloat 1.2s infinite ease-in-out alternate;
    filter: drop-shadow(0 0 12px #ffd700);
}

.pin-pulse {
    width: 20px; height: 6px;
    background: rgba(255, 215, 0, 0.6);
    border-radius: 50%;
    margin: -6px auto 0 auto;
    box-shadow: 0 0 15px #ffd700;
    animation: pinShadow 1.2s infinite ease-in-out alternate;
}

@keyframes pinFloat {
    0% { transform: translateY(0); }
    100% { transform: translateY(-12px); }
}

@keyframes pinShadow {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(0.6); opacity: 0.3; }
}

.map-level-preview {
    background: rgba(15, 23, 42, 0.9);
    border: 2px solid #38bdf8;
    border-radius: 18px;
    padding: 12px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    z-index: 10;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
}

.preview-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.preview-badge-icon {
    font-size: 42px;
    line-height: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    padding: 8px;
}

.preview-text h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 20px;
    color: #ffd700;
    margin: 0 0 3px 0;
}

.preview-text p {
    font-family: 'Fredoka One', cursive;
    font-size: 13px;
    color: #cbd5e1;
    margin: 0 0 6px 0;
    font-weight: normal;
}

.preview-meta {
    display: flex;
    gap: 10px;
    align-items: center;
}

.status-tag {
    font-family: 'Fredoka One', cursive;
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 10px;
}

.status-tag.unlocked {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid #38bdf8;
}

.status-tag.completed {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid #22c55e;
}

.status-tag.locked {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid #ef4444;
}

.boss-tag {
    font-family: 'Fredoka One', cursive;
    font-size: 12px;
    color: #ff99cc;
}

.map-play-btn {
    font-family: 'Fredoka One', cursive;
    font-size: 20px;
    padding: 12px 32px;
    background: linear-gradient(135deg, #ff3388 0%, #db2777 100%);
    color: #fff;
    border: 2.5px solid #ff99cc;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 1px;
    box-shadow: 0 8px 25px rgba(255, 51, 136, 0.5);
    white-space: nowrap;
}

.map-play-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 12px 35px rgba(255, 51, 136, 0.7);
    border-color: #ffffff;
}

#btn-enter-door {
    position: absolute;
    right: 114px;
    bottom: 8px;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #047857);
    border: 3px solid #34d399;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 16px rgba(52, 211, 153, 0.6), inset 0 -4px 10px rgba(0, 0, 0, 0.3);
    font-size: 26px;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 10;
    cursor: pointer;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
}

#btn-enter-door .lbl {
    font-size: 11px;
    letter-spacing: 1.2px;
    opacity: 0.95;
    margin-top: 3px;
    font-family: 'Fredoka One', cursive;
}

#btn-enter-door.active {
    filter: brightness(1.3) contrast(1.1);
    transform: scale(0.92);
}

.inverted-hands #btn-enter-door {
    right: auto !important;
    left: 114px !important;
}

@media (max-height: 480px) {
    #hunt-action-zone {
        width: 110px;
        height: 110px;
        right: 16px;
        bottom: 16px;
    }
    #btn-slash-hunt {
        width: 100px;
        height: 100px;
        font-size: 30px;
    }
    #btn-slash-hunt .hunt-lbl {
        font-size: 11px;
        letter-spacing: 1px;
    }
}

body.low-perf #game-container {
    box-shadow: none !important;
    border-width: 2px !important;
}
body.low-perf #ui-overlay {
    box-shadow: none !important;
    backdrop-filter: none !important;
}
body.low-perf .ui-panel,
body.low-perf #dialog-box,
body.low-perf #message {
    box-shadow: none !important;
    text-shadow: none !important;
}
body.low-perf .health-bar-fill {
    box-shadow: none !important;
}
body.low-perf .life-icon {
    box-shadow: none !important;
}

