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;
    }
}

/* ============================================================================
   GRAPHIC NOVEL & SAKRAL HISTORISK DESIGN SYSTEM (DEN KATOLSKE KIRKE)
   ============================================================================ */

:root {
    --c-brass: #8e7343;
    --c-brass-light: #c5a059;
    --c-gold: #d4af37;
    --c-gold-glow: rgba(212, 175, 55, 0.35);
    --c-panel-bg: rgba(14, 18, 15, 0.96);
    --c-panel-header: rgba(26, 32, 27, 0.95);
    --c-ink: #f5eedf;
    --c-ink-muted: #c9bea9;
}

/* 1. KINOMODUS VIGNETT (Framing som i en grafisk roman) */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at center, transparent 40%, rgba(5, 7, 6, 0.6) 80%, rgba(3, 4, 3, 0.92) 100%);
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.85);
    z-index: 10;
}

/* 2. FORANKRET DIALOGBOKS (VISUELL ROMAN / GRAPHIC NOVEL) */
#dialog-box {
    background: linear-gradient(180deg, rgba(20, 26, 22, 0.97) 0%, rgba(11, 15, 12, 0.98) 100%) !important;
    border: 2px solid var(--c-brass) !important;
    border-radius: 14px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 
                0 0 0 1px rgba(197, 160, 89, 0.3), 
                inset 0 0 30px rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(12px) !important;
    transition: all 0.3s ease;
}

#speaker-name {
    font-family: 'Cinzel', 'Outfit', serif, sans-serif !important;
    color: var(--c-gold) !important;
    letter-spacing: 0.12em !important;
    font-weight: 800 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

#speaker-title {
    color: var(--c-brass-light) !important;
    font-family: 'Roboto Mono', monospace !important;
    font-size: 0.7rem !important;
    letter-spacing: 0.05em;
}

#dialog-text {
    color: var(--c-ink) !important;
    line-height: 1.65 !important;
    font-size: 0.95rem !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

/* 3. VERTIKALE VALGKNAPPER (GRAPHIC NOVEL STIL) */
#choices-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
}

#choices-container button,
.dialog-choice-btn {
    width: 100% !important;
    background: linear-gradient(180deg, rgba(35, 28, 18, 0.92) 0%, rgba(20, 16, 10, 0.96) 100%) !important;
    border: 1.5px solid var(--c-brass) !important;
    border-radius: 10px !important;
    color: var(--c-ink) !important;
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    padding: 10px 16px !important;
    text-align: left !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

#choices-container button:hover,
.dialog-choice-btn:hover {
    background: linear-gradient(180deg, rgba(60, 48, 28, 0.96) 0%, rgba(32, 24, 14, 0.98) 100%) !important;
    border-color: var(--c-gold) !important;
    color: #ffffff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px var(--c-gold-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

#choices-container button:active,
.dialog-choice-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8) !important;
}

/* 4. WORKSTATION COCKPIT (MINISPILL-OVERLAY) */
#minigame-overlay {
    background: radial-gradient(circle at center, rgba(8, 10, 8, 0.88) 0%, rgba(4, 5, 4, 0.97) 100%) !important;
    backdrop-filter: blur(14px) !important;
}

#minigame-overlay > div {
    background: linear-gradient(180deg, rgba(22, 28, 23, 0.98) 0%, rgba(12, 16, 13, 0.99) 100%) !important;
    border: 2px solid var(--c-brass) !important;
    border-radius: 18px !important;
    box-shadow: 0 25px 65px rgba(0, 0, 0, 0.95), 
                0 0 0 1px rgba(197, 160, 89, 0.4), 
                inset 0 0 35px rgba(0, 0, 0, 0.85) !important;
    padding: 24px 28px !important;
    max-width: 820px !important;
    width: 95% !important;
}

/* Minigame inputfelter */
#minigame-content input[type="text"],
#minigame-content input[type="password"] {
    background: rgba(8, 10, 8, 0.9) !important;
    border: 2px solid var(--c-brass) !important;
    border-radius: 8px !important;
    color: var(--c-gold) !important;
    font-family: 'Roboto Mono', monospace !important;
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.18em !important;
    padding: 10px 16px !important;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.85) !important;
    outline: none !important;
    transition: all 0.2s ease !important;
}

#minigame-content input[type="text"]:focus,
#minigame-content input[type="password"]:focus {
    border-color: var(--c-gold) !important;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.9), 0 0 15px var(--c-gold-glow) !important;
}

/* Minigame Handlingsknapper / Lås opp */
#minigame-content button.bg-amber-500,
#minigame-content button[type="submit"],
.minigame-btn-submit {
    background: linear-gradient(180deg, #d4af37 0%, #aa8022 100%) !important;
    color: #120e06 !important;
    font-family: 'Outfit', sans-serif !important;
    font-size: 0.92rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.05em !important;
    border: 1px solid #ffe285 !important;
    border-radius: 10px !important;
    padding: 10px 24px !important;
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.35) !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    cursor: pointer !important;
}

#minigame-content button.bg-amber-500:hover,
#minigame-content button[type="submit"]:hover,
.minigame-btn-submit:hover {
    background: linear-gradient(180deg, #ecd168 0%, #be922c 100%) !important;
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.5) !important;
    transform: translateY(-1.5px) !important;
}

/* 5. TOPPBAR & HUD (Taktil glass & messing) */
#hud {
    background: linear-gradient(180deg, rgba(8, 10, 8, 0.94) 0%, rgba(8, 10, 8, 0.4) 75%, transparent 100%) !important;
    border-bottom: 1px solid rgba(142, 115, 67, 0.35) !important;
}

#hud-team-badge {
    background: rgba(30, 22, 12, 0.85) !important;
    border: 1px solid var(--c-brass) !important;
    color: var(--c-gold) !important;
}

#timer-container {
    background: rgba(14, 18, 14, 0.9) !important;
    border: 1.5px solid var(--c-brass) !important;
    color: var(--c-gold) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7) !important;
}

#btn-hint {
    background: rgba(45, 34, 18, 0.85) !important;
    border: 1px solid var(--c-brass-light) !important;
    color: var(--c-gold) !important;
}

#btn-hint:hover {
    background: rgba(70, 52, 25, 0.95) !important;
    border-color: var(--c-gold) !important;
}
