/* 1. Add minimal reset at the top */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root { 
    --bg-color: #002b36;
    --text-color: #fdf6e3;
    --accent-color: #2aa198;
    --button-bg: #073642;
    --tooltip-bg: rgba(0, 0, 0, 0.9);
    --button-transition: all 0.3s ease;
    --animation-fade: fadeInUp 0.5s ease-out forwards;
    --transition-hover: all 0.3s ease;
    --button-padding: 1rem 2rem;
    --button-margin: 1.5rem auto;
    --title-size: clamp(1.5rem, 5vw, 2.5rem);
    --text-size: clamp(0.9rem, 2vw, 1rem);
}

/* Core layout structure */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Consolidate body styles */
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Playfair Display', serif;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Remove duplicate container styles and combine them */
.container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 100px 20px 60px; /* Top: 100px, Sides: 20px, Bottom: 60px */
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 3;
    background: none;
    max-width: 100%;
}

/* Fix tree positioning */
.tree {
    position: fixed;
    bottom: 0;
    height: 90vh;
    width: 25vw;
    max-width: 300px;
    opacity: 0.6;
    z-index: 2;
    pointer-events: none;
    background-repeat: no-repeat;
    background-size: contain;
    background-position: bottom;
}

.tree-left {
    left: 0;
    background-image: url('../images/left-tree.webp');
    background-position: left bottom;
}

.tree-right {
    right: 0;
    background-image: url('../images/right-tree.webp');
    background-position: right bottom;
}

/* Adjust vertical spacing */
.title {
    font-size: var(--title-size);
    margin: 1rem 0; /* Reduced margin */
    text-align: center;
    width: 100%;
    background: transparent;
    position: relative;
    z-index: 1;
}

/* Responsive logo size */
.logo-image {
    max-width: min(300px, 50vw); /* Responsive logo size */
    height: auto;
    margin: 0 auto;
    display: block;
    background: transparent;
}

/* Remove duplicate intro-text and story-text styles and combine them */
.intro-text, .story-text {
    width: min(800px, 90%);
    margin: 3rem auto;  /* Increased margin for better spacing */
    padding: 3rem;      /* Increased padding */
    border-radius: 10px;
    box-sizing: border-box;
    text-align: justify;
    line-height: 1.8;
    letter-spacing: 0.02em;
    word-spacing: 0.1em;
    word-break: break-word;
    hyphens: auto;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 3;
    font-size: var(--text-size);
}

/* Unified text container styles for both intro and story */
.intro-text, .story-text {
    width: min(800px, 90%);
    margin: 3rem auto;  /* Increased margin for better spacing */
    padding: 3rem;      /* Increased padding */
    border-radius: 10px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 3;
}

.intro-text p, .story-text p, .witch-narration p {
    margin: 2rem auto;  /* More space between paragraphs */
    padding: 0 2rem;    /* More horizontal padding */
    font-size: 1rem;
    max-width: 65ch; /* Optimal line length for readability */
    margin-left: auto;
    margin-right: auto;
    text-align: justify; /* Ensure text is justified */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    text-indent: 0; /* Remove text indentation */
    word-spacing: 0.1em; /* Adjust word spacing to prevent single letters at the end of lines */
    word-break: break-word; /* Ensure long words break properly */
    hyphens: auto; /* Enable hyphenation for better text wrapping */
    position: relative;
    line-height: 1.8;
    overflow: visible; /* Change from hidden to visible */
    animation: var(--animation-fade);
}

/* Unified text styles for paragraphs in both intro and story */
.intro-text p, .story-text p {
    margin-bottom: 1.5em;
    font-size: 1rem;
    max-width: 65ch;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1.5rem;  /* Add horizontal padding to paragraphs */
    text-align: justify;
    line-height: 1.8;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    word-spacing: 0.1em;
    word-break: break-word;
    hyphens: auto;
    text-indent: 0; /* Ensure no text indentation */
}

/* Story container with dynamic height */
#story, .intro-text {
    width: min(800px, 90%);
    margin: 1rem auto;
    padding: 1.5rem;
    border-radius: 10px;
    box-sizing: border-box;
}

#story {
    display: none; /* Hide story initially */
    position: relative;
    line-height: 1.8;
    letter-spacing: 0.02em;
    z-index: 1;
    width: min(800px, 90%);
    margin: 2rem auto;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.3); /* Ensure only one background style */
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    border-radius: 10px;
    box-sizing: border-box;
    z-index: 3;
    background-clip: padding-box;
    -webkit-background-clip: padding-box;
}

#story.visible {
    display: block;
}

#story p {
    margin-bottom: 1.5em;
    font-size: 1rem;
    max-width: 65ch; /* Optimal line length for readability */
    margin-left: auto;
    margin-right: auto;
    text-indent: 0; /* Changed from 1em to 0 */
    text-align: justify;
    -webkit-hyphens: auto; /* Add this line for Safari on iOS 4.2+ */
    hyphens: auto;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

#choiceInfo {
    position: fixed;
    top: 95px; /* Increased spacing between elements */
    right: 10px;
    color: var(--text-color);
    background: var(--tooltip-bg);
    padding: 10px;
    border-radius: 5px;
    font-size: 0.875rem; /* 14px */
    z-index: 3;
    transition: opacity 0.3s ease;
    max-width: 200px; /* Ensure it doesn't stretch too wide */
    width: auto; /* Ensure width fits content */
    height: auto; /* Ensure height fits content */
}

/* Fix button styles */
.choice-button,
.return-button,
#resetButton {
    background-color: var(--button-bg);
    color: var(--text-color);
    border: 2px solid var(--accent-color);
    border-radius: 5px;
    cursor: pointer;
    transition: var(--button-transition);
    font-family: 'Playfair Display', serif;
    padding: var(--button-padding);
    margin: var(--button-margin);
    display: block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    will-change: transform;
    transition: transform 0.3s ease;
}

.choice-button:hover,
.return-button:hover,
#resetButton:hover {
    background-color: var(--accent-color);
    transform: translateY(-2px);
}

/* Trees restoration */
footer {
    color: var(--text-color);
    text-align: center;
    padding: 10px 0; /* Reduce padding */
    margin-top: 0; /* Remove top margin */
    padding-bottom: 10px;
    position: relative;
    z-index: 3;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.8rem; /* Smaller text size */
    bottom: 0;
    background: none;
    padding: 10px;
    flex-shrink: 0;
}

/* Adjust content spacing */
.intro-text {
    margin: 2rem auto;
    padding: 2rem;
    max-width: 800px;
    width: 90%;
    margin-bottom: 1rem; /* Reduce space before footer */
    line-height: 1.8;
    box-sizing: border-box;
}

/* Story and intro spacing */
.intro-text {
    margin-bottom: 1rem; /* Reduce space before footer */
}

#soundInfo {
    position: fixed;
    top: 50px;
    right: 10px;
    color: var(--text-color);
    background: var(--tooltip-bg);
    padding: 10px;
    border-radius: 5px;
    font-size: 0.875rem; /* 14px */
    z-index: 3;
    transition: opacity 0.3s ease;
    max-width: 200px; /* Ensure it doesn't stretch too wide */
    width: auto; /* Ensure width fits content */
    height: auto; /* Ensure height fits content */
}

/* Intro text styling */
.intro-text {
    line-height: 1.8;
    box-sizing: border-box;
    margin-bottom: 1rem; /* Reduce space before footer */
}

.intro-text p {
    text-indent: 0;
    margin-bottom: 1.5em;
    font-size: 1rem;
    max-width: 65ch;
    margin-left: auto;
    margin-right: auto;
    text-align: justify;
    -webkit-hyphens: auto; /* Add this line for Safari on iOS 4.2+ */
    hyphens: auto;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.copyright-text {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5em;
}

copyright-text ul {
    margin-bottom: 1.5em;
    padding-left: 2em;
}

copyright-text li {
    margin-bottom: 0.5em;
}

/* Add to existing styles */
copyright-notice {
    text-align: center;
    margin: 2rem 0;
    font-weight: bold;
}

.attribution {
    font-style: italic;
    margin: 2rem 0;
    padding: 1rem;
    border-left: 3px solid var(--accent-color);
    background: rgba(0, 0, 0, 0.2);
}

.signature {
    text-align: center;
    margin-top: 3rem;
    margin-bottom: 2rem;
    font-style: italic;
}

.signature p {
    margin: 0.5em 0;
}

#soundToggleButton {
    position: absolute !important;
    top: 20px !important;
    right: 20px;
    padding: 8px 16px;
    background-color: #444;
    color: var(--text-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    z-index: 1000;
    transition: background-color 0.3s;
    font-family: 'Playfair Display', serif;
    font-size: 0.9rem; /* Smaller font */
}

#soundToggleButton.on {
    background-color: #4CAF50;
}

#soundToggleButton.off {
    background-color: #f44336;
}

#soundToggleButton.on::after,
#soundToggleButton.off::after {
    content: '';
    display: none; /* Hide symbols by default */
}

@media (max-width: 450px) {
    #soundToggleButton {
        width: 40px;
        height: 40px;
        min-width: unset;
        border-radius: 50%;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        text-indent: -9999px;
        line-height: 0;
        overflow: hidden;
    }

    #soundToggleButton.on::after {
        content: '🔊';  /* Show speaker symbol when on */
        text-indent: 0;
        display: block;
        line-height: normal;
    }

    #soundToggleButton.off::after {
        content: '🔇';  /* Show mute symbol when off */
        text-indent: 0;
        display: block;
        line-height: normal.
    }
}

#soundToggleButton.on::after {
    content: '🔊';
    text-indent: 0;
    display: block;
    line-height: normal; /* Changed from '.' to 'normal' */
}

#soundToggleButton.off::after {
    content: '🔇';
    text-indent: 0;
    display: block;
    line-height: normal; /* Changed from '.' to 'normal' */
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0,0,0,0.4), rgba(0,0,0,0.8));
    pointer-events: none;
    z-index: 1;
    opacity: 0.7;
}

/* Container for buttons to keep them centered while text is left-aligned */
.button-container {
    text-align: center;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
    margin: 2rem auto;
    background: transparent;
    align-items: center; /* Center buttons horizontally */
    height: auto;
    /* Ensure it takes up space based on content */
    flex-grow: 0;
    height: auto; /* Ensure height is based on content */
    flex: 0 1 auto; /* Allow growth based on content */
    display: flex !important; /* Force display to flex */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: auto !important; /* Ensure height is based on content */
    flex: 0 1 auto !important; /* Allow growth based on content */
    opacity: 1 !important; /* Ensure opacity is fully visible */
    visibility: visible !important; /* Ensure visibility */
}

footer a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.8rem; /* Match footer text size */
    transition: color 0.3s ease;
}

.story-text {
    width: min(800px, 90%);
    margin: 3rem auto;
    padding: 4rem 3rem;    /* Increased padding, especially top/bottom */
    border-radius: 10px;
    box-sizing: border-box;
    position: relative;
    z-index: 3;
    line-height: 1.8;
    letter-spacing: normal;
    text-align: justify;
    font-size: var(--text-size);
    background: rgba(0, 0, 0, 0.3);
}

.story-text p:first-of-type {
    margin-top: 0;         /* Remove top margin for first paragraph */
    padding-top: 0;        /* Remove top padding for first paragraph */
}

.story-text p:last-of-type {
    margin-bottom: 0;      /* Remove bottom margin for last paragraph */
    padding-bottom: 0;     /* Remove bottom padding for last paragraph */
}

.text-container {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    line-height: 1.6;
    word-spacing: normal;
    text-align: justify;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .container {
        padding: 80px 15px 40px; /* Adjusted padding for mobile */
        padding-top: 60px; /* Slightly more padding on mobile */
    }

    .intro-text, #story, .story-text {
        width: 95%;
        padding: 2rem;        /* Slightly less padding on mobile */
        margin: 2rem auto;    /* Slightly less margin on mobile */
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }

    .intro-text p, .story-text p {
        font-size: 1rem;
        line-height: 1.6;
        padding: 0 1.5rem;  /* Reduced padding for mobile but maintain symmetry */
    }

    .story-text {
        padding: 3rem 2rem;    /* Slightly reduced padding on mobile */
        font-size: 0.95rem;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    #soundInfo {
        top: 45px; /* Adjusted to be below sound button */
        right: 10px;
    }

    #choiceInfo {
        top: 120px; /* Adjusted to be below sound info */
        right: 10px;
        left: auto;
        max-width: 200px;
        width: auto; /* Ensure width fits content */
        height: auto; /* Ensure height fits content */
    }

    .logo-image {
        max-width: 200px;
    }

    .story-text {
        max-width: 95%;
        padding: 0 1rem;
    }
    
    .text-container {
        font-size: clamp(0.9rem, 4vw, 1.1rem);
    }
    
    .button-container {
        max-width: 90%;
    }

    .intro-text, .story-text {
        padding: 1.5rem;
    }
    
    .intro-text p, .story-text p {
        padding: 0 1.5rem;
    }

    .tree {
        height: 70vh; /* Reduced height for mobile */
        width: 30vw;
        opacity: 0.4;
    }

    .tree-right {
        width: 30vw;
        right: 0;
    }

    footer {
        padding: 10px;
    }

    #story, .intro-text {
        margin: 0.5rem auto;
        padding: 1rem;
    }

    .title {
        margin: 0.5rem 0;
    }

    #resetButton, #soundToggleButton {
        position: absolute !important;
        top: 10px !important;
    }

    .container {
        padding-top: 60px; /* Add space at top for fixed buttons */
        position: relative; /* Add this to create a new stacking context */
        z-index: 1;
    }

    .content-wrapper {
        position: relative; /* Add this to ensure proper stacking */
        z-index: 1;
        margin-top: 40px; /* Add space for buttons */
    }

    #story, .intro-text {
        position: relative; /* Add this to ensure proper stacking */
        z-index: 1;
        margin-top: 20px;
    }

    #choiceInfo, #soundInfo {
        position: absolute;
        z-index: 99;
    }

    .fixed-buttons {
        display: none;
    }

    #resetButton, #soundToggleButton {
        transform: none !important; /* Prevent hover transform on mobile */
    }

    /* Adjust tooltip positions for mobile */
    #soundInfo {
        top: 60px;
    }

    #choiceInfo {
        top: 60px;
    }
}

/* Ensure consistent spacing on mobile */
@media screen and (max-width: 768px) {
    .intro-text, .story-text {
        padding: 1.5rem;
        width: 95%;
    }

    .intro-text p, .story-text p {
        padding: 0 1rem;  /* Slightly less padding on mobile */
    }
}

/* Larger screen adjustments */
@media screen and (min-width: 769px) {
    #soundInfo {
        top: 70px; /* Increased spacing on larger screens */
    }

    #choiceInfo {
        top: 150px; /* Increased spacing on larger screens */
    }

    .tree {
        height: 90vh;
        width: 25vw;
    }
}

/* Height-based media query */
@media screen and (max-height: 600px) {
    .container {
        min-height: 85vh; /* Even more compact for very small screens */
        padding: 20px 20px 0;
    }

    .logo-image {
        max-width: min(200px, 30vw);
    }

    #story, .intro-text {
        padding: 1rem;
        margin: 0.5rem auto;
    }
    
    footer {
        padding: 5px 0; /* Even smaller padding for very small screens */
    }
}

/* Media queries */
@media screen and (max-height: 600px) {
    .container {
        min-height: 100vh; /* Keep full height even on small screens */
        padding: 20px 20px 0;
    }
}

@media screen and (min-height: 1000px) {
    .container {
        min-height: 92vh; /* Can be taller on larger screens */
    }
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    scroll-behavior: smooth;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Remove duplicate button styles and combine them */
#resetButton, #soundToggleButton {
    position: absolute !important;
    top: 20px !important;
    z-index: 1000;
    padding: 8px 16px;
    background-color: var(--button-bg);
    color: var(--text-color);
    border: 2px solid var(--accent-color);
    border-radius: 5px;
    cursor: pointer;
    transition: var(--button-transition);
    font-family: 'Playfair Display', serif;
    font-size: 0.9rem;
    min-width: 100px;
}

/* Remove duplicate button hover states */
#resetButton:hover, #soundToggleButton:hover, .choice-button:hover {
    background-color: var(--accent-color);
    transform: translateY(-2px);
}

#resetButton {
    left: 10px !important;
}

#soundToggleButton {
    right: 10px !important;
}

#soundToggleButton.on {
    background-color: #4CAF50;
}

#soundToggleButton.off {
    background-color: #f44336;
}

#soundToggleButton.on::after {
    content: '🔊';
    text-indent: 0;
    display: block;
    line-height: normal; /* Changed from '.' to 'normal' */
}

#soundToggleButton.off::after {
    content: '🔇';
    text-indent: 0;
    display: block;
    line-height: normal; /* Changed from '.' to 'normal' */
}

/* Additional styles for copyright page */
.copyright-page .container {
    max-width: 800px;
    width: 90%;
    padding: 20px;
    margin: 2rem auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

copyright-page h2, .copyright-page h3 {
    text-align: center;
}

/* Link styles */
a {
    color: var(--accent-color); /* #2aa198 */
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #3cb0a6; /* Slightly lighter shade for hover effect */
}

/* Story container and text */
#story {
    max-width: 800px;
    width: 90%;
    margin: 2rem auto;
    padding: 3rem;
    background: rgba(0, 0, 0, 0.3); /* this stays */
    border-radius: 10px;
    box-sizing: border-box;
}

.story-text {
    width: 100%;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

.intro-text {
    max-width: 800px;
    width: 90%;
    margin: 2rem auto;
    padding: 3rem;
    background: rgba(0, 0, 0, 0.3); /* this stays*/
    border-radius: 10px;
    box-sizing: border-box;
}

/* Mobile adjustments */
@media screen and (max-width: 768px) {
    #story, .intro-text {
        width: 85%;
        padding: 1.5rem;
        margin: 1rem auto;
    }
    
    .story-text p, .intro-text p {
        padding: 0;
        margin: 1em 0;
    }
}

/* Mobile circular buttons */
@media screen and (max-width: 450px) {
    #resetButton, #soundToggleButton {
        width: 40px;
        height: 40px;
        min-width: unset;
        border-radius: 50%;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        text-indent: -9999px;
        line-height: 0;
        overflow: hidden;
    }

    #soundToggleButton::after {
        content: '🔇';  /* Start with mute symbol */
        text-indent: 0;
        display: block;
        line-height: normal;
    }

    #soundToggleButton.on::after {
        content: '🔊';  /* Change to speaker symbol when on */
    }

    #resetButton::after {
        content: '↺';
        text-indent: 0;
        display: block;
        line-height: normal;
    }

    #soundToggleButton {
        right: 10px;
    }

    #resetButton {
        left: 10px;
    }

    /* Adjust info boxes position */
    #soundInfo {
        top: 60px;
    }

    #choiceInfo {
        top: 60px;
    }

    #soundToggleButton.off::after {
        content: '🔇';
        text-indent: 0;
        display: block;
        line-height: normal;
    }

    #soundToggleButton.on::after {
        content: '🔊';
        text-indent: 0;
        display: block;
        line-height: normal.
    }

    #resetButton, #soundToggleButton {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        cursor: pointer;
        user-select: none;
    }
}

/* Remove duplicate tooltip styles and combine them */
.tooltip {
    position: absolute;
    padding: 8px 12px;
    background: var(--tooltip-bg);
    color: var(--text-color);
    border-radius: 4px;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1100;
    pointer-events: none;
}

@media (max-width: 450px) {
    .tooltip {
        width: max-content;
        font-size: 0.8rem;
        padding: 4px 8px;
    }
    
    .tooltip.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Sound button tooltip */
#soundToggleButton .tooltip-text {
    right: 0;
    top: 120%;
}

/* Reset button tooltip */
#resetButton .tooltip-text {
    left: 0;
    top: 120%;
}

/* Show tooltips on hover for desktop */
@media (hover: hover) {
    .tooltip:hover .tooltip-text {
        visibility: visible;
        opacity: 1;
    }
}

/* Mobile touch feedback */
@media (max-width: 450px) {
    .tooltip .tooltip-text {
        display: none;
    }
    
    .tooltip:active .tooltip-text {
        display: block;
        visibility: visible;
        opacity: 1;
    }
}

.button-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 9);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1100;
    width: max-content;
    max-width: 200px;
}

#soundTooltip {
    right: 0;
    top: 120%;
}

#resetTooltip {
    left: 0;
    top: 120%;
}

.button-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

/* Button positioning */
#resetButton, #soundToggleButton {
    position: absolute !important;
    top: 20px !important;
    z-index: 1000;
}

#resetButton {
    left: 10px !important;
}

#soundToggleButton {
    right: 10px !important;
}

/* Tooltip styling */
.tooltip-text {
    position: absolute;
    top: 120%;
    background: var(--tooltip-bg);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    white-space: nowrap;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tooltip-text.visible {
    visibility: visible;
    opacity: 1;
}

/* Position tooltips */
#resetButton .tooltip-text {
    left: 0;
}

#soundToggleButton .tooltip-text {
    right: 0;
}

/* Mobile adjustments */
@media (max-width: 450px) {
    #resetButton, #soundToggleButton {
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .tooltip-text {
        width: max-content;
        max-width: 200px;
        white-space: normal;
        text-align: center;
    }
}

/* Button and tooltip container */
.button-wrapper {
    position: relative;
    display: inline-block;
}

/* Tooltip styling */
.tooltip {
    position: absolute;
    top: calc(100% + 10px);
    padding: 8px 12px;
    background: var(--tooltip-bg);
    color: var(--text-color);
    border-radius: 4px;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1100;
    pointer-events: none;
}

/* Tooltip positioning */
#soundToggleButton .tooltip {
    right: 0;
    min-width: 200px;
    text-align: right;
}

#resetButton .tooltip {
    left: 0;
    min-width: 200px;
    text-align: left;
}

/* Show tooltip */
.tooltip.active {
    opacity: 1;
    visibility: visible;
}

/* Desktop hover */
@media (min-width: 451px) {
    .button-wrapper:hover .tooltip {
        opacity: 1;
        visibility: visible;
    }
}

.tooltip-text {
    position: absolute;
    top: 120%;
    background: var(--tooltip-bg);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1100;
}

.tooltip-text.visible {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 450px) {
    .tooltip-text {
        width: max-content;
        max-width: 200px;
        white-space: normal;
        text-align: center;
    }
}

/* Center content wrapper */
.content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1;
    background: none;
    position: relative;
    z-index: 3;
    margin-bottom: 0; /* Remove any bottom margin */
    flex: 1 1 auto; /* Allow content-wrapper to grow and shrink */
    margin-top: 40px; /* Add space for buttons */
    padding-top: 20px; /* Add padding to prevent content from being hidden under buttons */
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* Scene transitions and effects */
.scene-transition {
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.scene-transition.visible {
    opacity: 1;
}

.scene-description {
    font-style: italic;
    color: rgba(var(--text-color), 0.8);
    margin-bottom: 1.5em;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid var(--accent-color);
}

.witch-dialog {
    margin: 1.5rem 0;
    padding: 1rem 1rem 1rem 2.5rem; /* Increase left padding to accommodate cauldron */
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    position: relative;
}

.witch-dialog::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232aa198'%3E%3Cpath d='M4 14c0 3 4 4 8 4s8-1 8-4c0-1-.5-2-2-2.5.5-2.5-1-4.5-2-5.5h-8c-1 1-2.5 3-2 5.5C4.5 12 4 13 4 14z'/%3E%3Cpath d='M12 5V2M8 6L7 3M16 6l1-3' stroke='%232aa198' stroke-width='0.5'/%3E%3Ccircle cx='10' cy='13' r='0.5'%3E%3Canimate attributeName='r' values='0.5;1;0.5' dur='1s' repeatCount='indefinite'/%3E%3C/circle%3E%3Ccircle cx='14' cy='12' r='0.5'%3E%3Canimate attributeName='r' values='0.5;1;0.5' dur='1.3s' repeatCount='indefinite'/%3E%3C/circle%3E%3Ccircle cx='12' cy='14' r='0.5'%3E%3Canimate attributeName='r' values='0.5;1;0.5' dur='0.8s' repeatCount='indefinite'/%3E%3C/circle%3E%3Cpath class='steam' d='M8 5.5c0 0-1-2 1-3.5M12 4c0 0-1-2 1-3.5M16 5.5c0 0 1-2-1-3.5' stroke='%232aa198' stroke-width='0.5' opacity='0.6'%3E%3Canimate attributeName='opacity' values='0.6;0.2;0.6' dur='3s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 2px rgba(42, 161, 152, 0.5));
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232aa198'%3E%3Cpath d='M4 14c0 3 4 4 8 4s8-1 8-4c0-1-.5-2-2-2.5.5-2.5-1-4.5-2-5.5h-8c-1 1-2.5 3-2 5.5C4.5 12 4 13 4 14z'/%3E%3Cpath d='M12 5V2M8 6L7 3M16 6l1-3' stroke='%232aa198' stroke-width='0.5'/%3E%3Ccircle cx='10' cy='13' r='0.5'%3E%3Canimate attributeName='r' values='0.5;1;0.5' dur='1s' repeatCount='indefinite'/%3E%3C/circle%3E%3Ccircle cx='14' cy='12' r='0.5'%3E%3Canimate attributeName='r' values='0.5;1;0.5' dur='1.3s' repeatCount='indefinite'/%3E%3C/circle%3E%3Ccircle cx='12' cy='14' r='0.5'%3E%3Canimate attributeName='r' values='0.5;1;0.5' dur='0.8s' repeatCount='indefinite'/%3E%3C/circle%3E%3Cpath class='steam' d='M8 5.5c0 0-1-2 1-3.5M12 4c0 0-1-2 1-3.5M16 5.5c0 0 1-2-1-3.5' stroke='%232aa198' stroke-width='0.5' opacity='0.6'%3E%3Canimate attributeName='opacity' values='0.6;0.2;0.6' dur='3s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 2px rgba(42, 161, 152, 0.5));
}

/* Optional: Add floating animation */
.witch-dialog::before {
    animation: cauldronFloat 3s ease-in-out infinite;
}

@keyframes cauldronFloat {
    0%, 100% { transform: translateY(-50%); }
    50% { transform: translateY(-60%); }
}

.narrator-text {
    font-style: italic;
    text-align: center;
    margin: 2rem auto;
    max-width: 600px;
    line-height: 2;
}

.campfire-scene {
    position: relative;
    padding: 2rem;
    background: radial-gradient(circle at center, 
        rgba(255, 100, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.3) 70%);
    border-radius: 10px;
    margin: 2rem 0;
}

.prologue-text {
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1.5s ease-out forwards;
    margin-bottom: 2rem;
    font-style: italic;
    line-height: 1.8;
    color: var(--text-color);
    text-shadow: 0 0 10px rgba(42, 161, 152, 0.3);
}

.witch-narration {
    position: relative;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    margin: 2rem 0;
    border: 1px solid rgba(42, 161, 152, 0.2);
}

.witch-narration p {
    margin-bottom: 1.5em;
    text-align: justify;
    animation: var(--animation-fade);
}

@keyframes textFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure the first line of the paragraph aligns with the dropcap */
.intro-text p, .story-text p, .witch-narration p {
    position: relative;
    line-height: 1.8;
    text-align: justify;
    text-indent: 0;
    margin-bottom: 1.5em;
    font-size: 1rem;
    max-width: 65ch;
    margin-left: auto;
    margin-right: auto;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    word-spacing: 0.1em;
    word-break: break-word;
    hyphens: auto;
    overflow: visible;
}

/* Remove ALL previous drop cap and text styles first */

/* Clean, minimal drop cap and paragraph implementation */
.story-text p,
.witch-narration p,
.intro-text p {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    line-height: 1.8;
    margin: 1.5em auto;
    padding: 0;
    max-width: 65ch;
    text-align: justify;
    text-indent: 0;
}

.story-text p::first-letter,
.witch-narration p::first-letter,
.intro-text p::first-letter {
    float: left;
    font-size: 3.2em;
    font-weight: 700;
    color: rgb(159,13,26);
    margin: -0.1em 0.1em -0.1em 0; /* Precise margin control */
}

/* Mobile adjustments */
@media screen and (max-width: 768px) {
    .story-text p::first-letter,
    .witch-narration p::first-letter,
    .intro-text p::first-letter {
        font-size: 2.8em;
    }
}

/* Remove ALL previous drop cap styles */

/* Clean traditional drop cap implementation */
.story-text p::first-letter,
.witch-narration p::first-letter,
.intro-text p::first-letter {
    float: left;
    font-family: 'Playfair Display', serif;
    font-size: 3.2em;
    font-weight: 700;
    color: rgb(159,13,26);
    padding-right: 0.1em;
    line-height: 0.8;
    margin-top: 0.1em;
}

/* Base paragraph styling */
.story-text p,
.witch-narration p,
.intro-text p {
    position: relative;
    font-size: 1rem;
    line-height: 1.8;
    margin: 1.5em auto;
    padding: 0;
    max-width: 65ch;
    text-align: justify;
}

/* Mobile adjustments */
@media screen and (max-width: 768px) {
    .story-text p::first-letter,
    .witch-narration p::first-letter,
    .intro-text p::first-letter {
        font-size: 2.8em;
    }
}

.u-hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.fade-in {
    opacity: 0;
    animation: var(--animation-fade);
    animation-delay: var(--fade-delay, 0s);
}

/* Add new button container styles */
.fixed-buttons {
    display: none;
}

/* Unified text styling for all story content */
.witch-narration, .story-text {
    position: relative;
    padding: 4rem 3rem;    /* Consistent padding */
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    margin: 2rem 0;
    border: 1px solid rgba(42, 161, 152, 0.2);
}

.witch-narration p, .story-text p {
    margin: 2rem auto;     /* Consistent spacing */
    padding: 0 0.2rem;       /* Consistent padding */
    font-size: 1rem;
    max-width: 65ch;
    margin-left: auto;
    margin-right: auto;
    text-align: justify;
    line-height: 1.8;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    word-spacing: 0.1em;
    word-break: break-word;
    hyphens: auto;
    animation: var(--animation-fade);
}

/* First and last paragraph spacing */
.witch-narration p:first-of-type,
.story-text p:first-of-type {
    margin-top: 0;
}

.witch-narration p:last-of-type,
.story-text p:last-of-type {
    margin-bottom: 0;
}

/* Drop cap styling for intro-text */
.intro-text p::first-letter {
    font-size: 3rem;
    line-height: 1;
    padding-right: 0.1em;
    margin-right: 0;
    margin-left: 0;
    font-weight: bold;
    color: rgb(159,13,26);
    vertical-align: baseline;
    position: relative;
    bottom: -2.9em;
}

/* Drop cap styling for story-text - adjusted spacing */
.story-text p::first-letter {
    font-size: 3rem;
    line-height: 1;
    padding-right: 0;
    margin-right: 0;
    margin-left: 0;
    font-weight: bold;
    color: rgb(159,13,26);
    vertical-align: baseline;
    position: relative;
    bottom: -2.9em;
}

/* Reset any conflicting styles */
.intro-text p, .story-text p {
    position: relative;
    line-height: 1.8;
    text-indent: 0;
    letter-spacing: normal;
}

/* Drop cap styling for intro-text - slight spacing */
.intro-text p::first-letter {
    float: left;
    font-size: 3rem;
    line-height: 1;
    padding: 0;
    margin: 0 0.15em 0 0; /* Slightly increased right margin for readability */
    font-weight: bold;
    color: rgb(159,13,26);
    vertical-align: baseline;
}

/* Drop cap styling for story-text - tighter spacing */
.story-text p::first-letter {
    float: left;
    font-size: 3rem;
    line-height: 1;
    padding: 0;
    margin: 0 0.12em 0 0; /* Increased from 0.08em to 0.12em for slightly more breathing room */
    font-weight: bold;
    color: rgb(159,13,26);
    vertical-align: baseline;
    letter-spacing: -0.01em; /* Reduced negative letter-spacing to open up the space a bit */
}

/* Reset other styles and ensure proper text flow */
.intro-text p, .story-text p {
    position: relative;
    line-height: 1.8;
    text-indent: 0;
    letter-spacing: normal;
}

/* Reset all previous drop cap styles */
.story-text p::first-letter,
.witch-narration p::first-letter,
.intro-text p::first-letter {
    float: left;
    font-family: 'Playfair Display', serif;
    font-size: 3.2em;
    line-height: 0.01; /* Slightly adjusted line-height for better alignment */
    padding: 0.1em 0.12em 0 0; /* Top padding helps align with text */
    margin: 0;
    font-weight: 700;
    color: rgb(159,13,26);
    display: inline-block;
}

/* Container paragraph styling to prevent text overlap */
.story-text p,
.witch-narration p,
.intro-text p {
    overflow: hidden; /* Prevents text from flowing under the drop cap */
    text-indent: 0;
    margin: 1.5em auto;
    padding: 0;
    font-size: 1rem;
    line-height: 1.8;
    text-align: justify;
    min-height: 3em; /* Ensures enough space for drop cap */
}

/* Mobile adjustments */
@media screen and (max-width: 768px) {
    .story-text p::first-letter,
    .witch-narration p::first-letter,
    .intro-text p::first-letter {
        font-size: 2.8em;
        padding: -0.05em 0.1em 0 0;
    }
}

/* Clean drop cap implementation */
.story-text p,
.witch-narration p,
.intro-text p {
    position: relative;
    font-size: 1rem;
    line-height: 1.8;
    margin: 1.5em auto;
    padding: 0;
    max-width: 65ch;
    text-align: justify;
    overflow: visible;
}

.story-text p::first-letter,
.witch-narration p::first-letter,
.intro-text p::first-letter {
    float: left;
    font-family: 'Playfair Display', serif;
    font-size: 3.2em;
    font-weight: 700;
    color: rgb(159,13,26);
    margin: 0 -0.05em -0.1em 0;
    padding: 0;
}

/* Remove any additional drop cap or first-letter styles elsewhere in the file */

/* Reset and clean implementation of drop caps */
.story-text p::first-letter,
.witch-narration p::first-letter,
.intro-text p::first-letter {
    float: left;
    font-family: 'Playfair Display', serif;
    font-size: 3.2em;
    font-weight: 700;
    color: rgb(159,13,26);
    padding: -0.1em 0.1em -0.1em 0; /* Add top padding and right spacing - THAT MAKES THE POSITIONING OF THE DROPCAP*/
    margin: 0;
    vertical-align: text-top; /* Align with the top of the text */
}

/* Ensure proper text wrapping around drop cap */
.story-text p,
.witch-narration p,
.intro-text p {
    position: relative;
    font-size: 1rem;
    line-height: 1.8;
    margin: 1.5em auto;
    padding: 0;
    max-width: 65ch;
    text-align: justify;
    overflow: visible;
    text-indent: 0; /* Prevent any unwanted indentation */
    display: flow-root; /* Creates new block formatting context */
}

/* Mobile adjustments */
@media screen and (max-width: 768px) {
    .story-text p::first-letter,
    .witch-narration p::first-letter,
    .intro-text p::first-letter {
        font-size: 2.8em;
        padding: 0.08em 0.12em 0 0; /* Slightly reduced padding for mobile */
    }
}

