body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==========================================================================
   Visuell Roman & Escape Room Motor - Stilark og Animasjoner
   ========================================================================== */

/* Subtilt filmisk teksturoverlay */
body::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.75" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100" height="100" filter="url(%23noise)" opacity="0.04"/></svg>');
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: overlay;
}

/* --------------------------------------------------------------------------
   Skjermeffekter (Risting, Blits/Gassalarm)
   -------------------------------------------------------------------------- */
@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    15% { transform: translate(-8px, -6px) rotate(-0.4deg); }
    30% { transform: translate(7px, 5px) rotate(0.4deg); }
    45% { transform: translate(-6px, 4px); }
    60% { transform: translate(5px, -4px); }
    75% { transform: translate(-3px, 2px); }
    90% { transform: translate(2px, -1px); }
}
body.effect-shake #parallax-container,
body.effect-shake {
    animation: screenShake 0.65s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes screenFlash {
    0% { filter: brightness(2.8) contrast(1.4); }
    25% { filter: brightness(1.9) hue-rotate(50deg); }
    100% { filter: none; }
}
body.effect-flash {
    animation: screenFlash 0.85s ease-out both;
}

/* --------------------------------------------------------------------------
   Parallax Bakgrunn & Hotspots (Point & Click soner)
   -------------------------------------------------------------------------- */
#parallax-container {
    perspective: 1000px;
    background-color: #080808;
}

.parallax-layer {
    transition: transform 0.12s ease-out;
    width: 110%;
    height: 110%;
    left: -5%;
    top: -5%;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}

/* Klikkbare soner på bakgrunnsbildet (Hotspots / Point & Click) */
.bg-hotspot {
    position: absolute;
    cursor: pointer;
    border: none;
    background: transparent;
    border-radius: 16px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

/* Myk, organisk glød over gjenstanden ved hover (ingen harde firkanter eller stipla linjer) */
.bg-hotspot:hover {
    background: radial-gradient(ellipse at center, rgba(251, 191, 36, 0.16) 0%, rgba(251, 191, 36, 0.04) 55%, transparent 80%);
}

/* Elegant historisk point & click markør (gyllent segl med pulserende lysring) */
.hotspot-beacon {
    position: relative;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.bg-hotspot:hover .hotspot-beacon {
    transform: scale(1.18);
}

.beacon-pulse-ring {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px solid rgba(251, 191, 36, 0.75);
    animation: beaconPulse 2.2s cubic-bezier(0.15, 0.85, 0.35, 1) infinite;
    pointer-events: none;
}

.beacon-core {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #92400e 0%, #78350f 45%, #291205 100%);
    border: 2px solid #fbbf24;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.85), 0 0 16px rgba(251, 191, 36, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fef08a;
    font-size: 16px;
}

@keyframes beaconPulse {
    0% {
        transform: scale(0.7);
        opacity: 0.95;
    }
    100% {
        transform: scale(1.65);
        opacity: 0;
    }
}

.bg-hotspot-label {
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(28, 20, 8, 0.96), rgba(15, 10, 4, 0.98));
    border: 1.5px solid #fbbf24;
    color: #fef08a;
    font-size: 12px;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: 9999px;
    white-space: nowrap;
    pointer-events: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.85), 0 0 15px rgba(251, 191, 36, 0.5);
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.02em;
}

.bg-hotspot:hover .bg-hotspot-label {
    transform: translateX(-50%) translateY(2px) scale(1.06);
    border-color: #ffffff;
    color: #ffffff;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.95), 0 0 25px rgba(251, 191, 36, 0.85);
}

/* --------------------------------------------------------------------------
   Karakter-sprites & Animasjoner
   -------------------------------------------------------------------------- */
.char-enter-left {
    transform: translateX(-140%);
    opacity: 0;
}

.char-enter-right {
    transform: translateX(140%);
    opacity: 0;
}

.char-active {
    transform: translateX(0);
    opacity: 1;
}

.char-exit-left {
    transform: translateX(-140%) !important;
    opacity: 0 !important;
}

.char-exit-right {
    transform: translateX(140%) !important;
    opacity: 0 !important;
}

/* Idle & Flytende Animasjoner */
@keyframes breathing {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-4px) scale(1.006); }
}
.char-breathing {
    animation: breathing 3.8s ease-in-out infinite;
    transform-origin: bottom center;
}

@keyframes charFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-7px) rotate(0.4deg); }
    66% { transform: translateY(-3px) rotate(-0.4deg); }
}
.char-float {
    animation: charFloat 4.2s ease-in-out infinite;
    transform-origin: bottom center;
}

@keyframes sway {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(0.6deg) translateY(-2px); }
}
.char-sway {
    animation: sway 4.5s ease-in-out infinite;
    transform-origin: bottom center;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
    60% { transform: translateY(0); }
}
.char-bounce {
    animation: bounce 0.6s ease-out;
    transform-origin: bottom center;
}

/* Følelsesreaksjoner (Sinne, Risting, Nikk) */
@keyframes angrySnap {
    0% { transform: scale(1) translateY(0) rotate(0deg); }
    12% { transform: scale(1.05) translateY(-18px) rotate(-2deg); filter: brightness(1.1); }
    25% { transform: scale(1.09) translateY(8px) rotate(2.5deg); filter: brightness(1.15) contrast(1.05); }
    38% { transform: scale(1.06) translateY(-8px) rotate(-2deg); }
    52% { transform: scale(1.03) translateY(4px) rotate(1deg); }
    68% { transform: scale(1.01) translateY(-3px) rotate(-0.5deg); }
    84% { transform: scale(1.005) translateY(1px) rotate(0.2deg); }
    100% { transform: scale(1) translateY(0) rotate(0deg); filter: none; }
}
.char-angry {
    animation: angrySnap 0.85s cubic-bezier(0.25, 1, 0.5, 1) both;
    transform-origin: bottom center;
}

@keyframes trembleEffect {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-2px, -1px); }
    20% { transform: translate(2px, 1px); }
    30% { transform: translate(-2px, 2px); }
    40% { transform: translate(2px, -1px); }
    50% { transform: translate(-1px, 2px); }
    60% { transform: translate(2px, -2px); }
    70% { transform: translate(-2px, -1px); }
    80% { transform: translate(1px, 2px); }
    90% { transform: translate(-2px, 1px); }
}
.char-tremble {
    animation: trembleEffect 0.14s ease-in-out infinite;
    transform-origin: bottom center;
}

@keyframes nodEffect {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    35% { transform: translateY(10px) rotate(-1deg); }
    65% { transform: translateY(-4px) rotate(0.5deg); }
    85% { transform: translateY(2px) rotate(0deg); }
}
.char-nod {
    animation: nodEffect 0.8s ease-out both;
    transform-origin: bottom center;
}

.white-outline {
    filter: drop-shadow(0px 0px 5px rgba(255, 255, 255, 0.5));
}

/* --------------------------------------------------------------------------
   Skjerm- og VFX-effekter
   -------------------------------------------------------------------------- */
@keyframes screenShake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-2px, -3px) rotate(-1deg); }
    20% { transform: translate(-4px, 0px) rotate(1deg); }
    30% { transform: translate(4px, 3px) rotate(0deg); }
    40% { transform: translate(2px, -1px) rotate(1deg); }
    50% { transform: translate(-2px, 3px) rotate(-1deg); }
    60% { transform: translate(-4px, 1px) rotate(0deg); }
    70% { transform: translate(4px, 1px) rotate(-1deg); }
    80% { transform: translate(-2px, -2px) rotate(1deg); }
    90% { transform: translate(2px, 3px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(0deg); }
}
.effect-shake {
    animation: screenShake 0.45s ease-in-out 2;
}

@keyframes drunkWobble {
    0% { filter: blur(0px) contrast(1); transform: rotate(0deg) scale(1); }
    25% { filter: blur(2px) contrast(1.15) saturate(1.3); transform: rotate(0.8deg) scale(1.02); }
    50% { filter: blur(1px) contrast(0.9); transform: rotate(-0.8deg) scale(1.01); }
    75% { filter: blur(3px) contrast(1.2); transform: rotate(0.4deg) scale(1.03); }
    100% { filter: blur(0px) contrast(1); transform: rotate(0deg) scale(1); }
}
.effect-drunk {
    animation: drunkWobble 6s ease-in-out infinite;
}

@keyframes glitchAnim {
    0% { transform: translate(0); }
    20% { transform: translate(-3px, 3px); filter: invert(0.15) hue-rotate(90deg); }
    40% { transform: translate(-2px, -2px); filter: none; }
    60% { transform: translate(3px, 2px); filter: contrast(1.4); }
    80% { transform: translate(2px, -3px); filter: none; }
    100% { transform: translate(0); }
}
.effect-glitch {
    animation: glitchAnim 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) 2;
}

/* --------------------------------------------------------------------------
   Dialogboks og Valgknapper
   -------------------------------------------------------------------------- */
#dialog-box {
    border-top: 3px solid rgba(220, 38, 38, 0.8);
    transition: all 0.3s ease;
}

.speech-bubble-tail::before {
    content: '';
    position: absolute;
    bottom: 25px;
    left: -12px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 12px solid rgba(24, 24, 27, 0.9);
}

@media (max-width: 768px) {
    .speech-bubble-tail::before {
        display: none;
    }
}

.choice-btn {
    background: linear-gradient(135deg, rgba(38, 28, 14, 0.96), rgba(20, 15, 8, 0.98));
    border: 1.5px solid rgba(251, 191, 36, 0.55);
    border-left: 6px solid #fbbf24;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(251, 191, 36, 0.2);
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.choice-btn:hover:not(.locked) {
    background: linear-gradient(135deg, rgba(65, 48, 22, 0.98), rgba(35, 26, 15, 1));
    border-left: 6px solid #fef08a;
    border-color: rgba(254, 240, 138, 0.9);
    transform: translateX(-8px) scale(1.01);
    box-shadow: 0 8px 30px rgba(251, 191, 36, 0.45);
}

.choice-btn:active:not(.locked) {
    transform: translateX(-4px) scale(0.99);
}

.choice-btn.locked {
    opacity: 0.55;
    cursor: not-allowed;
    border-left: 5px solid #52525b;
    background: rgba(24, 24, 27, 0.8);
    border-color: rgba(75, 85, 99, 0.4);
}
.choice-btn.locked:hover {
    border-color: rgba(239, 68, 68, 0.5);
}

.continue-btn {
    background: linear-gradient(135deg, rgba(185, 28, 28, 0.95), rgba(127, 29, 29, 0.98));
    border: 1px solid rgba(252, 211, 77, 0.6);
    border-left: 6px solid #fbbf24;
    box-shadow: 0 10px 25px rgba(185, 28, 28, 0.45), 0 0 15px rgba(251, 191, 36, 0.2);
    transition: all 0.2s ease;
    cursor: pointer;
}

.continue-btn:hover {
    background: linear-gradient(135deg, rgba(220, 38, 38, 1), rgba(153, 27, 27, 1));
    border-color: #fbbf24;
    border-left: 6px solid #fff;
    transform: translateX(-6px) scale(1.02);
    box-shadow: 0 12px 30px rgba(220, 38, 38, 0.6), 0 0 20px rgba(251, 191, 36, 0.4);
}

@keyframes choiceHighlightPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(251, 191, 36, 0); }
    50% { transform: scale(1.04) translateX(-6px); box-shadow: 0 0 25px rgba(251, 191, 36, 0.8); border-color: #fbbf24; }
}
.choice-highlight-pulse {
    animation: choiceHighlightPulse 0.4s ease-in-out 2;
}

@keyframes hotspotFlash {
    0%, 100% { box-shadow: 0 0 0 rgba(251, 191, 36, 0); }
    50% { box-shadow: 0 0 45px rgba(251, 191, 36, 0.95); background: radial-gradient(ellipse at center, rgba(251, 191, 36, 0.3) 0%, transparent 80%); }
}
.hotspot-flash {
    animation: hotspotFlash 0.5s ease-in-out 2;
}

.btn-toggle-active {
    background-color: rgba(220, 38, 38, 0.4) !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5) !important;
}

@keyframes timerPulse {
    0%, 100% { color: #ef4444; transform: scale(1); }
    50% { color: #ff8888; transform: scale(1.08); }
}
.timer-urgent {
    animation: timerPulse 1s infinite ease-in-out;
    border-color: #ef4444 !important;
}

/* Utskrifts-stil for seiersdiplom */
@media print {
    body * {
        visibility: hidden;
    }
    #victory-modal, #victory-modal * {
        visibility: visible;
    }
    #victory-modal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white !important;
        color: black !important;
    }
}
