/* =========================================================
   BLOODMONEY! - Authentic 2D Comic Horror Aesthetic System
   Custom Vector Character & Cinematic Story Prologue
   ========================================================= */

:root {
    --purple-dark: #361163;
    --purple-line: #491a7d;
    --purple-mid: #6830a3;
    --lavender-bg: #dcd6f7;
    --lavender-card: #f3efff;
    --pink-hair: #ffb3c6;
    --pink-accent: #ff85a1;
    --coin-gold: #ffbe0b;
    --blood-red: #c9184a;
    --font-bubble: 'Fredoka', cursive, sans-serif;
    --font-comic: 'Comic Neue', cursive, sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
}

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

body {
    background-color: #240d42;
    background-image: radial-gradient(#3a1a63 20%, transparent 20%);
    background-size: 16px 16px;
    font-family: var(--font-bubble);
    color: var(--purple-dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Master Game Container (Maintains 16:9 Aspect Ratio) */
.game-wrapper {
    position: relative;
    width: 100vw;
    max-width: 1280px;
    height: 100vh;
    max-height: 720px;
    background: #e9e4fc;
    border: 6px solid var(--purple-line);
    border-radius: 18px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Top Overhead Booth Sign */
.booth-sign-container {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    pointer-events: none;
}

.booth-sign {
    background: #ffffff;
    border: 4px solid var(--purple-line);
    border-radius: 12px;
    padding: 8px 32px;
    font-family: var(--font-bubble);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--purple-line);
    letter-spacing: 2px;
    text-shadow: 2px 2px 0px rgba(104, 48, 163, 0.2);
    box-shadow: 0 4px 12px rgba(73, 26, 125, 0.25);
    background-image: radial-gradient(var(--lavender-bg) 18%, transparent 18%);
    background-size: 6px 6px;
}

/* Top Right Money Counter Badge */
.top-hud {
    position: absolute;
    top: 14px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    z-index: 25;
}

.money-counter-badge {
    background: #ffffff;
    border: 4px solid var(--purple-line);
    border-radius: 36px;
    padding: 6px 18px 6px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(59, 20, 102, 0.25);
}

.coin-icon {
    width: 38px;
    height: 38px;
    background: var(--purple-line);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 800;
}

.money-digits {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--purple-dark);
    letter-spacing: 1px;
}

.hud-buttons {
    display: flex;
    gap: 6px;
}

.hud-btn {
    background: #ffffff;
    border: 3px solid var(--purple-line);
    border-radius: 20px;
    padding: 5px 12px;
    font-family: var(--font-bubble);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--purple-line);
    cursor: pointer;
    transition: transform 0.1s, background 0.15s;
    box-shadow: 0 3px 6px rgba(59, 20, 102, 0.15);
}

.hud-btn:hover {
    transform: translateY(-2px);
    background: var(--lavender-card);
}

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

.hud-btn.btn-danger-pill {
    background: #ffe3ea;
    border-color: #c9184a;
    color: #c9184a;
}

/* Medical Debt Tracker (Top Left) */
.debt-hud-card {
    position: absolute;
    top: 14px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid var(--purple-line);
    border-radius: 14px;
    padding: 8px 14px;
    box-shadow: 0 4px 10px rgba(59, 20, 102, 0.18);
    z-index: 25;
    width: 250px;
}

.debt-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #5d259c;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.debt-progress-track {
    width: 100%;
    height: 12px;
    background: #ece7fb;
    border: 2px solid var(--purple-line);
    border-radius: 8px;
    overflow: hidden;
}

.debt-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #ff85a1, #70e000);
    transition: width 0.25s ease-out;
}

.debt-subtext {
    font-size: 0.72rem;
    color: #6a5382;
    margin-top: 4px;
    display: flex;
    justify-content: space-between;
}

/* Stage Container & Booth */
.stage-container {
    position: relative;
    flex: 1;
    width: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.booth-bg-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.fx-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
}

/* Central Harvey Character Anchor */
.harvey-character-anchor {
    position: absolute;
    bottom: 8%;
    left: 50%;
    transform: translateX(-50%);
    width: 460px;
    height: 460px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    cursor: pointer;
    z-index: 10;
}

/* The Live Dedicated Vector Character Canvas */
.character-canvas {
    width: 460px;
    height: 460px;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(54, 17, 99, 0.3));
    transition: transform 0.05s ease-out;
}

.harvey-character-anchor:active .character-canvas {
    transform: scale(0.96) translateY(5px);
}

/* Hit Flash */
.hit-flash-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.05s;
}

.hit-flash-overlay.active {
    opacity: 1;
}

/* Wooden Counter Rail */
.counter-rail {
    position: absolute;
    bottom: 0;
    width: 110%;
    height: 24px;
    background: transparent;
    pointer-events: none;
}

/* Bottom Comic Dialogue Bubble */
.dialogue-container {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 940px;
    z-index: 30;
}

.speech-bubble-box {
    position: relative;
    background: #ffffff;
    border: 5px solid var(--purple-line);
    border-radius: 38px;
    padding: 18px 30px;
    min-height: 94px;
    box-shadow: 0 8px 24px rgba(59, 20, 102, 0.28);
    cursor: pointer;
}

/* The Iconic Tilted "Harvey" Name Tag */
.speaker-tag-pill {
    position: absolute;
    top: -18px;
    left: 36px;
    background: var(--purple-line);
    color: #ffffff;
    border: 3px solid #ffffff;
    border-radius: 16px;
    padding: 4px 18px;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 1px;
    transform: rotate(-3deg);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.speech-text {
    font-family: var(--font-comic);
    font-size: 1.28rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--purple-dark);
}

.speech-arrow {
    position: absolute;
    bottom: 10px;
    right: 24px;
    color: var(--purple-mid);
    font-size: 1rem;
    animation: bounceArrow 0.8s infinite;
}

@keyframes bounceArrow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

/* Side Drawer (Toolbox Arsenal) */
.side-drawer {
    position: absolute;
    top: 0;
    right: -360px;
    width: 340px;
    height: 100%;
    background: #ffffff;
    border-left: 5px solid var(--purple-line);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.35);
    z-index: 60;
    display: flex;
    flex-direction: column;
    transition: right 0.28s cubic-bezier(0.25, 1, 0.5, 1);
}

.side-drawer.open {
    right: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--lavender-bg);
    border-bottom: 3px solid var(--purple-line);
}

.drawer-header h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--purple-dark);
}

.btn-close-drawer {
    background: var(--purple-line);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
}

.drawer-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drawer-section-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--purple-mid);
    border-bottom: 2px dashed #d5c8f2;
    padding-bottom: 4px;
}

.tools-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.tool-item-card {
    background: var(--lavender-card);
    border: 3px solid #c9bfe8;
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tool-item-card:hover:not(.locked):not(.equipped) {
    border-color: var(--purple-line);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(73, 26, 125, 0.15);
}

.tool-item-card.equipped {
    border-color: var(--purple-line);
    background: #eae1fc;
    box-shadow: inset 0 0 8px rgba(73, 26, 125, 0.2);
}

.tool-item-card.locked {
    opacity: 0.55;
    cursor: not-allowed;
    background: #f7f6fc;
}

.tool-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tool-card-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--purple-dark);
}

.tool-card-cost {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--purple-mid);
}

.tool-card-desc {
    font-family: var(--font-comic);
    font-size: 0.8rem;
    color: #654982;
}

/* Lore Buttons */
.lore-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.lore-card-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f9f8fe;
    border: 2px solid #c9bfe8;
    border-radius: 10px;
    padding: 8px 10px;
    font-family: var(--font-bubble);
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}

.lore-card-btn:hover {
    border-color: var(--purple-line);
    background: var(--lavender-card);
}

.lore-icon {
    font-size: 1.3rem;
}

/* Floating Comic Hits & Dollar Popups */
.floating-popup {
    position: absolute;
    pointer-events: none;
    font-family: var(--font-bubble);
    font-size: 2rem;
    font-weight: 800;
    color: var(--purple-line);
    text-shadow: 2px 2px 0px #ffffff, -2px -2px 0px #ffffff;
    z-index: 45;
    animation: comicFloat 0.75s forwards ease-out;
}

@keyframes comicFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, 0) scale(0.6) rotate(-8deg);
    }
    40% {
        transform: translate(-50%, -40px) scale(1.3) rotate(5deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -75px) scale(1) rotate(0deg);
    }
}

/* Screen Shake on Heavy Impact */
.screen-shake {
    animation: heavyShake 0.18s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes heavyShake {
    10%, 90% { transform: translate3d(-3px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-5px, 2px, 0); }
    40%, 60% { transform: translate3d(5px, -2px, 0); }
}

/* Horror Glitch Overlay */
.horror-glitch-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 70;
    opacity: 0;
    transition: opacity 0.5s;
    background: radial-gradient(circle, transparent 60%, rgba(59, 20, 102, 0.55) 100%);
}

.horror-glitch-layer.active {
    opacity: 1;
    animation: horrorGlitchFlicker 0.2s infinite;
}

@keyframes horrorGlitchFlicker {
    0% { opacity: 0.6; filter: hue-rotate(0deg); }
    50% { opacity: 0.85; filter: hue-rotate(90deg); }
    100% { opacity: 0.5; filter: hue-rotate(-45deg); }
}

/* Cinematic Story Prologue Modal */
.prologue-overlay {
    position: absolute;
    inset: 0;
    background: rgba(22, 7, 43, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(8px);
    padding: 12px;
}

.prologue-overlay.active {
    display: flex;
}

.prologue-card {
    position: relative;
    background: #ffffff;
    border: 5px solid var(--purple-line);
    border-radius: 22px;
    padding: 20px 28px;
    max-width: 650px;
    width: 100%;
    max-height: 90vh;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: prologueCardPop 0.25s ease-out;
}

.btn-skip-prologue {
    position: absolute;
    top: 14px;
    right: 18px;
    background: #f1ecfc;
    border: 2px solid var(--purple-line);
    color: var(--purple-dark);
    font-family: var(--font-bubble);
    font-weight: 800;
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-skip-prologue:hover {
    background: var(--purple-line);
    color: #ffffff;
}

.prologue-tabs-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.prologue-tab {
    background: #f1ecfc;
    color: #553377;
    border: 2px solid #c9bfe8;
    padding: 3px 12px;
    border-radius: 14px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
}

.prologue-tab.active {
    background: var(--purple-line);
    color: #ffffff;
    border-color: var(--purple-line);
}

.prologue-illustration-box {
    width: 100%;
    max-width: 440px;
    height: 125px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
    background: #fcfaff;
    border: 3px solid var(--purple-line);
    border-radius: 12px;
    box-shadow: inset 0 0 10px rgba(54, 17, 99, 0.08);
    overflow: hidden;
}

.prologue-svg {
    width: 100%;
    height: 100%;
}

.prologue-headline {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--purple-dark);
    margin-bottom: 6px;
}

.prologue-body {
    font-family: var(--font-comic);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    color: #4a2873;
    white-space: pre-line;
    margin-bottom: 8px;
    overflow-y: auto;
    max-height: 20vh;
    padding: 0 4px;
}

.prologue-bullets-box {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.prologue-bullet-item {
    background: #f7f3ff;
    border-left: 4px solid var(--purple-line);
    padding: 4px 10px;
    font-family: var(--font-bubble);
    font-size: 0.85rem;
    color: var(--purple-dark);
    text-align: left;
    border-radius: 0 6px 6px 0;
}

.prologue-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border-top: 3px solid var(--lavender-bg);
    padding-top: 12px;
    margin-top: auto;
}

.prologue-dots {
    display: flex;
    gap: 8px;
}

.prologue-dots .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d8ccee;
    transition: background 0.2s;
}

.prologue-dots .dot.active {
    background: var(--purple-line);
    transform: scale(1.2);
}

.btn-prologue-next {
    background: var(--purple-line);
    color: #ffffff;
    border: none;
    border-radius: 24px;
    padding: 9px 26px;
    font-family: var(--font-bubble);
    font-size: 1.15rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(54, 17, 99, 0.3);
    transition: transform 0.1s, background 0.15s;
    animation: pulseButton 1.5s infinite;
}

@keyframes pulseButton {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); box-shadow: 0 6px 16px rgba(104, 48, 163, 0.45); }
}

.btn-prologue-next:hover {
    background: #5d259c;
    transform: translateY(-2px);
}

/* Modals */
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(36, 13, 66, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(4px);
    padding: 20px;
}

.modal-backdrop.active {
    display: flex;
}

.modal-card {
    background: #ffffff;
    border: 5px solid var(--purple-line);
    border-radius: 24px;
    padding: 24px 28px;
    max-width: 580px;
    width: 100%;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5);
    animation: modalBounce 0.22s ease-out;
}

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

.modal-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--purple-line);
    border-bottom: 3px solid var(--lavender-bg);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.modal-body {
    font-family: var(--font-comic);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.5;
    color: #3b1466;
    white-space: pre-line;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.modal-btn {
    background: var(--purple-line);
    color: #ffffff;
    border: 3px solid var(--purple-line);
    border-radius: 20px;
    padding: 8px 18px;
    font-family: var(--font-bubble);
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.1s;
}

.modal-btn:hover {
    transform: translateY(-2px);
    background: #5d229e;
}

.modal-btn.modal-btn-danger {
    background: #c9184a;
    border-color: #c9184a;
}
