/* ==========================================================================
   DESIGN SYSTEM & GLOBAL VARIABLES
   ========================================================================== */
:root {
    --bg-dark: #0a0a0f;
    --bg-card: rgba(18, 18, 29, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --primary-glow: rgba(0, 242, 254, 0.5);
    --secondary-glow: rgba(224, 86, 253, 0.5);
    
    /* Disco Elysium Palette */
    --de-bg: #1c1a17;
    --de-border: #443c35;
    --de-text: #e5d7c3;
    --de-header: #ff8533;
    --de-inland: #8e62c9;       /* Inland Empire - Purple */
    --de-electro: #e04b7d;      /* Electrochemistry - Pink */
    --de-visual: #29b6f6;       /* Visual Calculus - Cyan */
    --de-volition: #2e7d32;     /* Volition - Green (corrected to matching tone) */
    
    /* Font stacks */
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --font-mono: 'Fira Mono', 'Courier New', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: #f0f0f5;
    font-family: var(--font-sans);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* Background starry canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* ==========================================================================
   SCROLL SNAPPING & LAYOUT
   ========================================================================== */
.slides-container {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
}

.slides-container::-webkit-scrollbar {
    display: none; /* Safari/Chrome */
}

.slide {
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
    padding: 2rem;
}

/* Background effects for slides */
#slide-1 {
    background: radial-gradient(circle at 50% 50%, #151525 0%, #08080f 100%);
}

#slide-2 {
    background: radial-gradient(circle at 30% 60%, #0d1527 0%, #05050a 100%);
    transition: background 1s ease;
}

#slide-3 {
    background: radial-gradient(circle at 70% 30%, #1a1020 0%, #060309 100%);
}

.stars-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px),
        radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 40px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
    opacity: 0.25;
    animation: backgroundMove 120s linear infinite;
    pointer-events: none;
}

@keyframes backgroundMove {
    from { background-position: 0 0, 40px 60px, 130px 270px; }
    to { background-position: 550px 550px, 390px 410px, 380px 820px; }
}

.slide-content {
    max-width: 1200px;
    width: 100%;
    height: 90%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

/* ==========================================================================
   NAVIGATION DOTS
   ========================================================================== */
.nav-dots {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 100;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background: #00f2fe;
    transform: scale(1.3);
    box-shadow: 0 0 10px #00f2fe;
}

.dot:hover {
    background: #e056fd;
}

/* Scroll Arrow Indicator */
.scroll-arrow {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
    animation: floatArrow 2s infinite ease-in-out;
}

.scroll-arrow:hover {
    color: #ffffff;
    text-shadow: 0 0 8px rgba(255,255,255,0.6);
}

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

/* ==========================================================================
   SLIDE 1: ANIMATED TITLE & 3D CUBE
   ========================================================================== */
.header-container {
    text-align: center;
    margin-top: 10px;
}

.birthday-title {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.birthday-title .letter {
    display: inline-block;
    background: linear-gradient(135deg, #00f2fe, #4facfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(0, 242, 254, 0.2);
    animation: floatLetters 3s ease-in-out infinite;
}

/* Stagger animation for title letters */
.birthday-title span:nth-child(1)  { animation-delay: 0.0s; }
.birthday-title span:nth-child(2)  { animation-delay: 0.1s; }
.birthday-title span:nth-child(3)  { animation-delay: 0.2s; }
.birthday-title span:nth-child(4)  { animation-delay: 0.3s; }
.birthday-title span:nth-child(5)  { animation-delay: 0.4s; }
.birthday-title span:nth-child(7)  { animation-delay: 0.5s; }
.birthday-title span:nth-child(8)  { animation-delay: 0.6s; }
.birthday-title span:nth-child(9)  { animation-delay: 0.7s; }
.birthday-title span:nth-child(10) { animation-delay: 0.8s; }
.birthday-title span:nth-child(11) { animation-delay: 0.9s; }
.birthday-title span:nth-child(12) { animation-delay: 1.0s; }
.birthday-title span:nth-child(13) { animation-delay: 1.1s; }
.birthday-title span:nth-child(14) { animation-delay: 1.2s; }

.birthday-title .name {
    background: linear-gradient(135deg, #ff0844, #ffb199);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: namePulse 1.5s ease-in-out infinite alternate;
}

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

@keyframes namePulse {
    from {
        transform: scale(1) translateY(0);
        filter: drop-shadow(0 0 2px rgba(255, 8, 68, 0.4));
    }
    to {
        transform: scale(1.05) translateY(-5px);
        filter: drop-shadow(0 0 15px rgba(255, 8, 68, 0.8));
    }
}

/* 3D Cube section */
.cube-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

.cube-container {
    width: 600px;
    height: 600px;
    perspective: 1800px; /* Adjusted perspective for larger size */
}

.cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(20deg);
    transition: transform 0.1s ease-out; /* Smooth follow-mouse */
}

.face {
    position: absolute;
    width: 600px;
    height: 600px;
    background: rgba(10, 10, 20, 0.8);
    border: 2px solid #00f2fe;
    box-shadow: inset 0 0 30px rgba(0, 242, 254, 0.3), 0 0 25px rgba(0, 242, 254, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 2rem; /* Larger font size for larger face text */
    backface-visibility: visible;
}

/* Position faces */
.front  { transform: rotateY(0deg) translateZ(300px); }
.back   { transform: rotateY(180deg) translateZ(300px); border-color: #e056fd; box-shadow: inset 0 0 30px rgba(224, 86, 253, 0.3), 0 0 25px rgba(224, 86, 253, 0.15); }
.left   { transform: rotateY(-90deg) translateZ(300px); }
.right  { transform: rotateY(90deg) translateZ(300px); }
.top    { transform: rotateX(90deg) translateZ(300px); }
.bottom { transform: rotateX(-90deg) translateZ(300px); }

/* Front face specific image styles */
.front {
    background-color: #121225;
    overflow: hidden;
}

.cube-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Fallback content for cube if cheb.png is missing */
.front:empty::before {
    content: "ИЛЬЯ";
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 2rem;
    letter-spacing: 3px;
    background: linear-gradient(to right, #ffffff, #00f2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(0,242,254,0.5);
}

.back::before   { content: "★ B-DAY ★"; color: #e056fd; text-shadow: 0 0 10px #e056fd;}
.left::before   { content: "BRO"; opacity: 0.5; }
.right::before  { content: "2026"; opacity: 0.5; }
.top::before    { content: "♕"; font-size: 2.5rem; color: #ffca28; }
.bottom::before { content: "♥"; font-size: 2.5rem; color: #f44336; }

.cube-hint {
    margin-top: 15px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Dialogue Box (Disco Elysium Style) */
.dialogue-wrapper {
    width: 100%;
    max-width: 850px;
    margin-bottom: 20px;
}

.dialogue-container {
    background-color: var(--de-bg);
    border: 3px solid var(--de-border);
    box-shadow: 0 15px 35px rgba(0,0,0,0.6), inset 0 0 20px rgba(0,0,0,0.8);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 250px;
    max-height: 350px;
}

.dialogue-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(229, 215, 195, 0.15);
    padding-bottom: 8px;
    margin-bottom: 12px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 2px;
}

.dialogue-title {
    color: var(--de-header);
    font-weight: bold;
}

.dialogue-status {
    color: #4caf50;
    position: relative;
    padding-left: 15px;
}

.dialogue-status::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #4caf50;
    box-shadow: 0 0 8px #4caf50;
}

.dialogue-log {
    flex-grow: 1;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.6;
    padding-right: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--de-border) transparent;
}

.dialogue-log::-webkit-scrollbar {
    width: 5px;
}
.dialogue-log::-webkit-scrollbar-thumb {
    background-color: var(--de-border);
    border-radius: 3px;
}

.dialogue-line {
    margin-bottom: 14px;
    opacity: 0;
    transform: translateY(10px);
    animation: showDialogueLine 0.4s forwards ease-out;
}

@keyframes showDialogueLine {
    to { opacity: 1; transform: translateY(0); }
}

.skill-tag {
    font-weight: 700;
    text-transform: uppercase;
}

/* Color codes for specific skills */
.skill-tag.inland-empire { color: var(--de-inland); }
.skill-tag.electrochemistry { color: var(--de-electro); }
.skill-tag.visual-calculus { color: var(--de-visual); }
.skill-tag.volition { color: var(--de-volition); }

.roll-tag {
    color: #8c857b;
    font-size: 0.85rem;
}

.result-tag {
    font-weight: bold;
}
.result-tag.success { color: #4caf50; }
.result-tag.crit { color: #ffd700; text-shadow: 0 0 10px rgba(255,215,0,0.5); }

.dialogue-text {
    color: var(--de-text);
    margin-left: 8px;
}

.dialogue-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
    border-top: 1px solid rgba(229, 215, 195, 0.1);
    padding-top: 12px;
}

.dialogue-next-btn {
    background: none;
    border: 1px solid var(--de-header);
    color: var(--de-header);
    padding: 8px 18px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dialogue-next-btn:hover {
    background: var(--de-header);
    color: #000;
    box-shadow: 0 0 12px rgba(255, 133, 51, 0.4);
}

.dialogue-next-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: var(--de-border);
    color: var(--de-border);
}


/* ==========================================================================
   SLIDE 2: VIDEO HALL & CINEMA MODE & PRANK BUTTON
   ========================================================================== */
.cinema-theater-outer {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding: 10px 0;
}

.slide2-header {
    text-align: center;
    margin-bottom: 10px;
}

.slide2-header h2 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: #fff;
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.slide2-header p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.95rem;
}

.media-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 2rem;
    margin: auto 0;
}

/* Cinema mode buttons */
.cinema-mode-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 20px 15px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.cinema-mode-btn i {
    font-size: 1.8rem;
    color: #00f2fe;
    transition: transform 0.4s ease;
}

.cinema-mode-btn:hover {
    transform: scale(1.1) rotate(5deg);
    border-color: #00f2fe;
    background: rgba(0, 242, 254, 0.08);
    box-shadow: 0 15px 30px rgba(0, 242, 254, 0.2);
}

.cinema-mode-btn:hover i {
    transform: rotate(360deg);
}

/* Cinema Stage wrapper */
.cinema-stage {
    flex-grow: 1;
    max-width: 680px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Video Player container */
.video-container {
    flex-grow: 1;
    max-width: 680px;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 20px rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 10;
}

.video-screen-frame {
    width: 100%;
    height: 100%;
    position: relative;
}

.video-screen-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Video Fallback Box (visible if video source not found/offline) */
.video-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #10101a 0%, #1e1e2f 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px;
    text-align: center;
    color: rgba(255,255,255,0.7);
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.5s ease;
}

.video-screen-frame video:playing + .video-fallback,
.video-screen-frame video[data-playing="true"] + .video-fallback {
    opacity: 0;
}

.play-fallback-icon {
    font-size: 3.5rem;
    color: #e056fd;
    text-shadow: 0 0 15px rgba(224, 86, 253, 0.5);
    animation: pulseGlow 2s infinite alternate;
}

@keyframes pulseGlow {
    from { transform: scale(1); opacity: 0.8; }
    to { transform: scale(1.1); opacity: 1; }
}

/* Huge Gift Button */
.gift-button-section {
    margin-top: 30px;
    z-index: 10;
}

.huge-gift-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px 45px;
    background: linear-gradient(135deg, #ff0844 0%, #ffb199 100%);
    border-radius: 50px;
    text-decoration: none;
    color: #fff;
    box-shadow: 0 15px 35px rgba(255, 8, 68, 0.4), 0 0 30px rgba(255, 8, 68, 0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    border: 2px solid rgba(255,255,255,0.2);
    text-align: center;
}

.huge-gift-btn .gift-btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    transform: scale(0);
    transition: transform 0.5s ease-out;
}

.huge-gift-btn:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 0 20px 45px rgba(255, 8, 68, 0.6), 0 0 40px rgba(255, 8, 68, 0.3);
}

.huge-gift-btn:hover .gift-btn-glow {
    transform: scale(1);
    animation: rotateGlow 3s linear infinite;
}

@keyframes rotateGlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.huge-gift-btn .gift-box-icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
    animation: wobbleGift 1.5s infinite ease-in-out;
}

@keyframes wobbleGift {
    0%, 100% { transform: rotate(0deg) scale(1); }
    15% { transform: rotate(-10deg) scale(1.1); }
    30% { transform: rotate(10deg) scale(1.1); }
    45% { transform: rotate(-10deg) scale(1.1); }
    60% { transform: rotate(10deg) scale(1.1); }
    75% { transform: rotate(-5deg) scale(1.05); }
    85% { transform: rotate(5deg) scale(1.05); }
}

.huge-gift-btn .btn-text {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.6rem;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.huge-gift-btn .btn-subtext {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.8;
    margin-top: 4px;
    letter-spacing: 1px;
}

/* Exit Cinema Button */
.exit-cinema-btn {
    position: fixed;
    top: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.exit-cinema-btn:hover {
    background: #ff0844;
    border-color: #ff0844;
    box-shadow: 0 0 15px rgba(255, 8, 68, 0.5);
}

/* ================= CINEMA MODE ENVIRONMENT ================= */
body.cinema-mode-active #slide-2 {
    background: #000;
}

body.cinema-mode-active .cinema-theater-outer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}

body.cinema-mode-active .nav-dots,
body.cinema-mode-active .slide2-header,
body.cinema-mode-active .cinema-mode-btn,
body.cinema-mode-active .gift-button-section,
body.cinema-mode-active .scroll-arrow {
    opacity: 0 !important;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

body.cinema-mode-active .exit-cinema-btn {
    display: flex;
    animation: fadeIn 0.5s forwards;
}

/* Background Stage mapping cinema_bg.png */
body.cinema-mode-active .cinema-stage {
    position: relative;
    max-width: none;
    width: min(98vw, 98vh);
    height: min(98vw, 98vh);
    aspect-ratio: 1 / 1;
    background: url('cinema_bg.png') no-repeat center center;
    background-size: contain;
    z-index: 10;
    box-shadow: 0 15px 60px rgba(0, 0, 0, 0.95);
    display: block; /* Absolute positioning relative to this is enabled */
    transition: all 0.8s cubic-bezier(0.075, 0.82, 0.165, 1);
}

/* Align video exactly on top of screen in background photo with a 1:1 aspect ratio */
body.cinema-mode-active .video-container {
    position: absolute;
    left: 50%;
    top: 44.4%; /* Center of the screen height (34.5% + 19.8%/2) */
    transform: translate(-50%, -50%);
    height: 19.8%;
    width: auto;
    aspect-ratio: 1 / 1;
    max-width: none;
    border-radius: 0px; /* Sharp corners for screen */
    border: none;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    z-index: 11;
    transition: all 0.8s cubic-bezier(0.075, 0.82, 0.165, 1);
}

/* Hide SVG silhouettes as seats are already inside cinema_bg.png */
body.cinema-mode-active .cinema-seats,
body.cinema-mode-active .projector-light {
    display: none;
    opacity: 0;
}

/* Volumetric ambient back-glow on screen area with 1:1 aspect ratio */
body.cinema-mode-active .cinema-screen-glow {
    position: absolute;
    left: 50%;
    top: 44.4%;
    transform: translate(-50%, -50%);
    height: 19.8%;
    aspect-ratio: 1 / 1;
    z-index: 12;
    opacity: 1;
    background: radial-gradient(circle at 50% 50%, rgba(0, 242, 254, 0.15) 0%, transparent 80%);
    mix-blend-mode: screen;
    pointer-events: none;
    animation: ambientFlicker 3s infinite alternate;
}

@keyframes ambientFlicker {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}


/* ==========================================================================
   SLIDE 3: GAMES & LINKS & EDITS
   ========================================================================== */
.slide3-layout {
    display: grid;
    grid-template-columns: 260px 1fr 260px;
    width: 100%;
    height: 100%;
    gap: 2rem;
    align-items: center;
}

/* Side Column Edits */
.side-edits {
    display: flex;
    flex-direction: column;
    gap: 20px;
    justify-content: center;
    height: 100%;
}

.left-edits { align-items: flex-start; }
.right-edits { align-items: flex-end; }

/* Fiery Frame Wrapper */
.fiery-wrapper {
    position: relative;
    width: 240px;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    padding: 6px;
    background: #000;
}

/* Burning fire boundary effect */
.fiery-border {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    overflow: hidden;
    background: #111;
    z-index: 2;
}

.fiery-border video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Fallback message for missing edit videos */
.edit-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    color: rgba(255, 69, 0, 0.8);
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: bold;
    background: linear-gradient(180deg, #150500, #050200);
}

.edit-fallback i {
    font-size: 2rem;
    color: #ff3c00;
    filter: drop-shadow(0 0 8px #ff4500);
    animation: flamePulse 1s infinite alternate;
}

@keyframes flamePulse {
    from { transform: scale(1); filter: drop-shadow(0 0 5px #ff4500); }
    to { transform: scale(1.15); filter: drop-shadow(0 0 15px #ff8800); }
}

/* Animated glow fire background behind borders */
.fiery-wrapper::before,
.fiery-wrapper::after,
.fire-glow {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 8px;
    background: linear-gradient(0deg, #ff0000, #ff5500, #ffcc00);
    z-index: 1;
    filter: url(#fire-filter) blur(3px); /* Uses custom SVG distortion! */
    animation: burnEffect 1.5s linear infinite;
}

.fiery-wrapper::after {
    filter: blur(8px);
    opacity: 0.7;
}

.fire-glow {
    background: radial-gradient(circle, rgba(255,69,0,0.4) 0%, transparent 70%);
    filter: blur(25px);
    z-index: 0;
}

@keyframes burnEffect {
    0% { background-position: 0% 0%; }
    50% { background-position: 50% 100%; }
    100% { background-position: 0% 0%; }
}

/* Center Panel Dashboard */
.center-games-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5), inset 0 0 30px rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    max-height: 580px;
}

.center-games-panel h2 {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 2.2rem;
    background: linear-gradient(135deg, #fff 30%, #a29bfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

.section-desc {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.buttons-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: auto;
}

/* Menu items/buttons */
.menu-game-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.menu-game-btn .btn-inner {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    gap: 15px;
}

.game-icon-container {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    color: #00f2fe;
    transition: all 0.3s ease;
}

.game-info {
    flex-grow: 1;
}

.game-info h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: bold;
    margin-bottom: 2px;
}

.game-info p {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.btn-badge {
    font-size: 0.65rem;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-badge.unwinnable {
    background: rgba(255, 8, 68, 0.15);
    border: 1px solid #ff0844;
    color: #ff0844;
}

.btn-badge.special {
    background: rgba(255, 202, 40, 0.15);
    border: 1px solid #ffca28;
    color: #ffca28;
}

.btn-badge.external {
    background: rgba(0, 242, 254, 0.15);
    border: 1px solid #00f2fe;
    color: #00f2fe;
}

/* Button Hover states */
.menu-game-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.menu-game-btn:active {
    transform: translateX(2px);
}

.flappy-btn:hover {
    border-color: #ff0844;
    box-shadow: 0 0 15px rgba(255, 8, 68, 0.15);
}
.flappy-btn:hover .game-icon-container {
    background: #ff0844;
    color: #fff;
    box-shadow: 0 0 10px rgba(255, 8, 68, 0.5);
}

.snake-btn:hover {
    border-color: #ffca28;
    box-shadow: 0 0 15px rgba(255, 202, 40, 0.15);
}
.snake-btn:hover .game-icon-container {
    background: #ffca28;
    color: #111;
    box-shadow: 0 0 10px rgba(255, 202, 40, 0.5);
}

.rambler-btn:hover {
    border-color: #00f2fe;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.15);
}
.rambler-btn:hover .game-icon-container {
    background: #00f2fe;
    color: #111;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
}

.panel-signature {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 25px;
    letter-spacing: 0.5px;
}


/* ==========================================================================
   GAME MODALS: RETRO CABINET STYLING
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(8px);
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.arcade-cabinet {
    background: #14141f;
    border: 4px solid #30304a;
    border-radius: 12px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.8), 0 0 30px rgba(0, 242, 254, 0.2);
    width: 95%;
    max-width: 650px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.arcade-header {
    background: #202030;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #30304a;
}

.arcade-title {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.9rem;
    color: #00f2fe;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-modal-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-modal-btn:hover {
    color: #ff0844;
}

.arcade-screen {
    position: relative;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    aspect-ratio: 4 / 3;
}

.arcade-screen canvas {
    display: block;
    background: #0d0d15;
    box-shadow: inset 0 0 40px rgba(0,0,0,1);
    max-width: 100%;
    height: auto;
}

/* Scanline effect overlays */
.arcade-screen::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 10;
    background-size: 100% 4px, 6px 100%;
    pointer-events: none;
}

.game-overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 10, 0.9);
    z-index: 20;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 20px;
    text-align: center;
}

.game-overlay-screen.hidden {
    display: none;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255,215,0,0.6), 0 5px 0 #b39200;
    letter-spacing: 2px;
    animation: floatLetters 2s infinite ease-in-out;
}

.instruction {
    font-family: var(--font-mono);
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

.difficulty-warning {
    color: #ff0844;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
}

.death-title {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 900;
    color: #ff0844;
    text-shadow: 0 0 20px rgba(255, 8, 68, 0.7);
}

.score-summary {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 10px;
}

.score-summary span {
    color: #00f2fe;
    font-weight: bold;
    font-size: 1.5rem;
}

.insult-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    max-width: 80%;
    margin-bottom: 10px;
}

.play-game-btn {
    background: #00f2fe;
    border: none;
    color: #000;
    padding: 12px 30px;
    font-family: var(--font-heading);
    font-weight: bold;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 6px 0 #009eb5, 0 10px 20px rgba(0, 242, 254, 0.4);
    transition: all 0.1s ease;
}

.play-game-btn:hover {
    background: #5ef6ff;
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #009eb5, 0 12px 22px rgba(0, 242, 254, 0.5);
}

.play-game-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #009eb5, 0 4px 10px rgba(0, 242, 254, 0.4);
}

#flappy-death-screen .play-game-btn {
    background: #ff0844;
    color: #fff;
    box-shadow: 0 6px 0 #b3002a, 0 10px 20px rgba(255, 8, 68, 0.4);
}
#flappy-death-screen .play-game-btn:hover {
    background: #ff3b68;
    box-shadow: 0 8px 0 #b3002a, 0 12px 22px rgba(255, 8, 68, 0.5);
}
#flappy-death-screen .play-game-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #b3002a, 0 4px 10px rgba(255, 8, 68, 0.4);
}

.arcade-controls-help {
    background: #14141f;
    padding: 10px 20px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
    text-align: center;
    border-top: 1px solid #30304a;
}

.arcade-controls-help strong {
    color: rgba(255,255,255,0.8);
}


/* ==========================================================================
   AD BANNER: PURE CHAOS & RUNAWAY BUTTON
   ========================================================================== */
.ad-banner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.ad-banner-overlay.visible {
    display: flex;
}

.ad-banner-box {
    position: relative;
    /* No explicit width/height — sized naturally by the image inside */
    max-width: 90vw;
    max-height: 85vh;
    background: #000;
    border: 5px solid #ff0055;
    box-shadow: 0 0 50px rgba(255, 0, 85, 0.6), 0 0 100px rgba(255, 0, 85, 0.3);
    border-radius: 12px;
    overflow: visible;
    /* inline-flex makes the box shrink-wrap its content without circular deps */
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

/* Close button - runaway element! */
.ad-close-btn {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ff0055;
    border: 3px solid #fff;
    color: #fff;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    z-index: 100000;
    transition: left 0.15s cubic-bezier(0.19, 1, 0.22, 1), top 0.15s cubic-bezier(0.19, 1, 0.22, 1), transform 0.2s ease;
}

.ad-close-btn:hover {
    transform: scale(1.1);
}

.ad-content {
    /* auto sizing — no more width/height:100% on fit-content parent */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    border-radius: 6px;
}

.ad-image-main {
    max-width: 85vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 6px;
}

/* Custom Styled Ads (Russian Web Prank Ads) */
.custom-ad-layout {
    width: 500px;
    height: 400px;
    max-width: 85vw;
    max-height: 80vh;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    background-size: cover;
    background-position: center;
    position: relative;
}

.custom-ad-layout::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1;
}

.ad-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #ffd700;
    color: #000;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 3px;
    z-index: 2;
}

.ad-headline {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    z-index: 2;
    margin-top: 25px;
}

.ad-subtitle {
    font-size: 0.95rem;
    color: #00f2fe;
    text-shadow: 0 1px 5px rgba(0,0,0,0.8);
    z-index: 2;
    font-weight: bold;
}

.ad-action-btn {
    background: #ff0055;
    color: #fff;
    border: none;
    padding: 10px 25px;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: bold;
    border-radius: 4px;
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(255, 0, 85, 0.4);
    z-index: 2;
    pointer-events: none; /* Just a picture, not clickable */
}

/* Specific theme styles for custom ads */
.ad-theme-mayo {
    background: radial-gradient(circle, #ffeaa7 0%, #d63031 100%);
}
.ad-theme-nail {
    background: radial-gradient(circle, #2d3436 0%, #0984e3 100%);
}
.ad-theme-ruler {
    background: radial-gradient(circle, #eccc68 0%, #2f3542 100%);
}


/* ==========================================================================
   UTILITY & HELPER CLASSES
   ========================================================================== */
.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}


/* ==========================================================================
   RESPONSIVE DESIGN (TABLETS & PHONES)
   ========================================================================== */
@media (max-width: 992px) {
    .slide3-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        gap: 1.5rem;
        overflow-y: auto;
    }
    
    .side-edits {
        flex-direction: row;
        width: 100%;
        justify-content: center;
        gap: 15px;
        height: auto;
    }
    
    .fiery-wrapper {
        width: 120px;
        aspect-ratio: 1 / 1;
    }
    
    .center-games-panel {
        padding: 1.5rem;
        max-height: none;
    }
    
    .media-row {
        gap: 1rem;
    }
    
    .cinema-mode-btn {
        width: 100px;
        height: 100px;
        padding: 10px;
        font-size: 0.65rem;
    }
    
    .cinema-mode-btn i {
        font-size: 1.4rem;
    }
    
    .birthday-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 768px) {
    .slide {
        padding: 1rem;
    }
    
    .media-row {
        flex-direction: column;
    }
    
    .cinema-mode-btn {
        display: none; /* Hide movie theater side triggers on very small screens */
    }
    
    .huge-gift-btn .btn-text {
        font-size: 1.1rem;
    }
    
    .dialogue-container {
        padding: 1rem;
        min-height: 200px;
        font-size: 0.8rem;
    }
    
    .cube-container {
        width: 150px;
        height: 150px;
    }
    
    .face {
        width: 150px;
        height: 150px;
    }
    
    .front  { transform: rotateY(0deg) translateZ(75px); }
    .back   { transform: rotateY(180deg) translateZ(75px); }
    .left   { transform: rotateY(-90deg) translateZ(75px); }
    .right  { transform: rotateY(90deg) translateZ(75px); }
    .top    { transform: rotateX(90deg) translateZ(75px); }
    .bottom { transform: rotateX(-90deg) translateZ(75px); }
}
