/* ==========================================================================
   ROMANTIC 2D PLATFORMER + VISUAL NOVEL STYLES
   Pastel Pink, Purple, Soft White & Pixel-Art Aesthetic
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&family=Nunito:wght@600;800;900&display=swap');

:root {
    --primary-pink: #ff7597;
    --primary-pink-hover: #ff527b;
    --pastel-pink: #ffd6e0;
    --soft-blush: #ffeef2;
    --lavender: #c8b6ff;
    --dark-purple: #231942;
    --deep-bg: #130e24;
    --accent-gold: #ffbe0b;
    --text-dark: #3a2e39;
    --text-light: #ffffff;
    --shadow-soft: 0 8px 24px rgba(255, 117, 151, 0.25);
    --border-cute: 3px solid #ffb3c6;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background: radial-gradient(circle at 50% 20%, #2e1a47 0%, #160f29 70%, #0d091a 100%);
    font-family: 'Nunito', system-ui, -apple-system, sans-serif;
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    overflow-x: hidden;
}

.game-wrapper {
    width: min(980px, 100vw - 20px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

/* --- HUD TOP BAR --- */
.hud-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    background: rgba(35, 25, 66, 0.85);
    border: 2px solid var(--primary-pink);
    border-radius: 14px;
    padding: 8px 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
}

.hud-title {
    font-family: 'Fredoka', cursive;
    font-size: clamp(14px, 2vw, 18px);
    font-weight: 700;
    color: #ffc2d1;
    letter-spacing: 0.03em;
    text-shadow: 0 2px 8px rgba(255, 117, 151, 0.5);
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-counters {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hud-counter-badge {
    background: rgba(255, 117, 151, 0.2);
    border: 1.5px solid var(--primary-pink);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 14px;
    font-weight: 800;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(255, 117, 151, 0.2);
    animation: pulseGlow 2.5s infinite ease-in-out;
}

.hud-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-btn {
    background: linear-gradient(135deg, var(--primary-pink), #e05780);
    border: none;
    border-radius: 20px;
    color: white;
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 800;
    padding: 6px 14px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(224, 87, 128, 0.4);
    transition: all 0.18s ease;
}

.hud-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #ff8fa3, #ff527b);
    box-shadow: 0 5px 14px rgba(255, 82, 123, 0.5);
}

.hud-btn:active {
    transform: translateY(1px);
}

.hud-btn-mini {
    background: rgba(200, 182, 255, 0.2);
    border: 1px solid var(--lavender);
    color: var(--lavender);
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.hud-btn-mini:hover {
    background: rgba(200, 182, 255, 0.4);
    color: white;
}

/* --- CANVAS CONTAINER & FRAME --- */
.canvas-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 540px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 3px var(--primary-pink);
    background: #000000;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* --- OVERLAY Z-INDEX HIERARCHY --- */
.interaction-prompt {
    position: absolute;
    transform: translate(-50%, -100%);
    background: linear-gradient(135deg, #ff7597, #ff4d6d);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 800;
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 77, 109, 0.5);
    border: 2px solid #ffffff;
    animation: floatBob 1.2s infinite ease-in-out;
    z-index: 15;
    white-space: nowrap;
}

/* Background Scene Overlays (Sit under dialogue: z-index 25-35) */
.proposal-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 30%, #3a1c71 0%, #1d1135 60%, #0d061a 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 24px;
    z-index: 25;
}

.goodbye-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 40%, #1e1b2e 0%, #110e1c 70%, #07050d 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 30;
    animation: fadeIn 1s ease;
}

.level-complete-overlay {
    position: absolute;
    inset: 0;
    background: rgba(22, 14, 40, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 35;
}

/* Foreground UI Overlays: Dialogue (z-index 50), MCQ (z-index 60), Loading (100) */
.vn-dialogue-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 10, 25, 0.35);
    backdrop-filter: blur(1.5px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    z-index: 50;
    transition: opacity 0.25s ease;
}

.vn-dialogue-box {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.vn-portrait-wrap {
    width: 130px;
    height: 130px;
    min-width: 130px;
    background: radial-gradient(circle, #fff0f5 0%, #ffd6e0 80%);
    border: 3px solid #ff7597;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 16px rgba(255, 117, 151, 0.4);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#vn-portrait-canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}

.vn-content-wrap {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #ff7597;
    border-radius: 18px;
    padding: 16px 22px;
    position: relative;
    min-height: 110px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 117, 151, 0.25);
    cursor: pointer;
}

.vn-speaker-tag {
    position: absolute;
    top: -14px;
    left: 20px;
    background: linear-gradient(135deg, #ff7597, #ff4d6d);
    color: white;
    font-family: 'Fredoka', cursive;
    font-size: 15px;
    font-weight: 700;
    padding: 3px 18px;
    border-radius: 12px;
    border: 2px solid #ffffff;
    box-shadow: 0 3px 10px rgba(255, 77, 109, 0.4);
    letter-spacing: 0.05em;
}

.vn-speaker-tag[data-speaker="girl"] {
    background: linear-gradient(135deg, #c77dff, #9d4edd);
}

.vn-speaker-tag[data-speaker="boy"] {
    background: linear-gradient(135deg, #ff7597, #e05780);
}

.vn-text {
    color: var(--text-dark);
    font-size: clamp(16px, 2.1vw, 20px);
    font-weight: 700;
    line-height: 1.45;
    margin-top: 4px;
    min-height: 48px;
    word-break: break-word;
}

.vn-next-indicator {
    position: absolute;
    bottom: 12px;
    right: 18px;
    color: var(--primary-pink);
    font-size: 16px;
    animation: bounceDown 0.8s infinite alternate ease-in-out;
}

/* --- MCQ MODAL OVERLAY --- */
.mcq-overlay {
    position: absolute;
    inset: 0;
    background: rgba(18, 12, 32, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 60;
}

.mcq-card {
    background: linear-gradient(160deg, #fff5f8 0%, #ffe8ee 100%);
    border: 3px solid #ff7597;
    border-radius: 24px;
    padding: 24px 28px;
    width: min(540px, 92vw);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 117, 151, 0.35);
    text-align: center;
    animation: popIn 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mcq-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ff7597, #ff4d6d);
    color: white;
    font-family: 'Fredoka', cursive;
    font-size: 14px;
    font-weight: 700;
    padding: 4px 18px;
    border-radius: 14px;
    margin-bottom: 14px;
    box-shadow: 0 3px 10px rgba(255, 77, 109, 0.3);
}

.mcq-question-text {
    color: var(--text-dark);
    font-size: clamp(17px, 2.2vw, 21px);
    font-weight: 800;
    line-height: 1.4;
    margin-bottom: 20px;
}

.mcq-options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.mcq-choice-btn {
    background: #ffffff;
    border: 2px solid #ffccd5;
    border-radius: 14px;
    color: var(--text-dark);
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 800;
    padding: 12px 18px;
    cursor: pointer;
    transition: all 0.16s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
    text-align: left;
}

.mcq-choice-btn:hover {
    border-color: #ff7597;
    background: #fff0f3;
    transform: translateX(4px);
}

.mcq-choice-btn.correct {
    background: #d8f3dc;
    border-color: #52b788;
    color: #1b4332;
    transform: scale(1.02);
}

.mcq-choice-btn.wrong {
    background: #ffe5d9;
    border-color: #e63946;
    color: #9d0208;
    animation: shake 0.4s ease-in-out;
}

.mcq-feedback {
    min-height: 24px;
    font-size: 15px;
    font-weight: 800;
    transition: all 0.2s ease;
}

.correct-toast {
    color: #2d6a4f;
}

.wrong-toast {
    color: #d90429;
}

/* --- LEVEL COMPLETE OVERLAY --- */
.complete-card {
    background: linear-gradient(145deg, #ffffff, #fff0f3);
    border: 4px solid var(--primary-pink);
    border-radius: 28px;
    padding: 32px 36px;
    text-align: center;
    width: min(480px, 90vw);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 117, 151, 0.4);
    animation: popIn 0.3s ease;
}

.complete-title {
    font-family: 'Fredoka', cursive;
    font-size: 26px;
    color: #ff4d6d;
    margin-bottom: 10px;
}

.complete-msg {
    color: var(--text-dark);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 24px;
}

.btn-romantic-action {
    background: linear-gradient(135deg, #ff7597, #ff4d6d);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 12px 30px;
    font-family: 'Nunito', sans-serif;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 77, 109, 0.4);
    transition: all 0.18s ease;
}

.btn-romantic-action:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 25px rgba(255, 77, 109, 0.6);
}

/* --- SECTION 7 & 8: PROPOSAL & HAPPY ENDING SCENE --- */
.proposal-portraits-stage {
    display: flex;
    align-items: center;
    justify-content: space-around;
    width: 100%;
    max-width: 720px;
    margin: 20px auto 0;
}

.proposal-portrait-box {
    width: 130px;
    height: 130px;
    border-radius: 20px;
    background: radial-gradient(circle, #fff0f5 0%, #ffd6e0 90%);
    border: 3px solid #ff7597;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 117, 151, 0.4);
    overflow: hidden;
}

.proposal-heart-center {
    font-size: 42px;
    color: #ff4d6d;
    animation: heartPulse 1.2s infinite ease-in-out;
}

.proposal-choices-container {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-top: auto;
    margin-bottom: 20px;
    z-index: 55;
}

.btn-proposal-choice {
    background: linear-gradient(135deg, #ff7597, #ff4d6d);
    color: white;
    border: 3px solid #ffffff;
    border-radius: 24px;
    padding: 14px 28px;
    font-family: 'Fredoka', cursive;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255, 77, 109, 0.5);
    transition: all 0.2s ease;
}

.btn-proposal-choice:hover {
    transform: translateY(-4px) scale(1.05);
    background: linear-gradient(135deg, #ff8fa3, #ff2a55);
    box-shadow: 0 12px 30px rgba(255, 42, 85, 0.7);
}

.happy-ending-banner {
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #ff7597;
    border-radius: 24px;
    padding: 14px 28px;
    font-family: 'Fredoka', cursive;
    font-size: 22px;
    color: #ff4d6d;
    box-shadow: 0 12px 35px rgba(255, 77, 109, 0.5);
    animation: floatBob 2s infinite ease-in-out;
    white-space: nowrap;
    margin: 30px auto;
    z-index: 55;
}

/* --- SECTION 9: GOODBYE SCREEN --- */
.goodbye-portraits-stage {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}

.goodbye-banner {
    text-align: center;
    margin-bottom: 24px;
}

.goodbye-title {
    font-family: 'Fredoka', cursive;
    font-size: 38px;
    color: #ffccd5;
    margin-bottom: 8px;
    text-shadow: 0 4px 15px rgba(255, 204, 213, 0.3);
}

.goodbye-subtitle {
    font-size: 18px;
    color: #c8b6ff;
    font-weight: 700;
}

/* --- LOADING SCREEN --- */
.loading-screen {
    position: absolute;
    inset: 0;
    background: #1d1430;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 100;
}

.loading-heart {
    font-size: 48px;
    animation: heartPulse 0.9s infinite ease-in-out;
}

.loading-text {
    font-size: 16px;
    font-weight: 700;
    color: #ffb3c6;
}

/* --- UTILITIES & ANIMATIONS --- */
.hidden {
    display: none !important;
}

@keyframes popIn {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes floatBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes bounceDown {
    0% { transform: translateY(0); }
    100% { transform: translateY(5px); }
}

@keyframes heartPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 2px 8px rgba(255, 117, 151, 0.2); }
    50% { box-shadow: 0 2px 14px rgba(255, 117, 151, 0.5); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
