:root {
    --accent: #d4af37;
    --bg-dark: #0f172a;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: #f8fafc;
    margin: 0;
    overflow-x: hidden;
}

.serif {
    font-family: 'Playfair Display', serif;
}

.reader-bg {
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    min-height: 100vh;
}

@media (min-width: 768px) {
    .reader-bg {
        background-attachment: fixed;
    }
}

.reader-overlay {
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0.5), rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0.95));
    min-height: 100vh;
    width: 100%;
}

.reading-container {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    text-align: justify;
    overflow-x: hidden;   /* prevents content from being pushed offâ€‘screen */
}

#reader-content h1 {
    position: relative;
    display: inline-block;
    padding-bottom: 10px;
}

#reader-content h1::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 75%;
    height: 4px;
    background: var(--accent);
    border-radius: 3px;
}

.light-mode {
    background: rgba(255, 255, 255, 0.95);
    color: #111;
}

.light-mode .prose {
    color: #111;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Rating stars styling */
.rating-stars {
    display: flex;
    gap: 8px;
    cursor: pointer;
    font-size: 1.5rem;
}

.rating-stars i {
    transition: color 0.2s;
}

.rating-stars i:hover,
.rating-stars i.active {
    color: #fbbf24;
}

.rating-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.average-stars i {
    font-size: 1.2rem;
    margin-right: 2px;
}

#reader-content p {
    text-align: justify;
    text-indent: 5em;
    margin-bottom: 1em;
}

/* ===== Audio Player Styling ===== */
#story-audio-player {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 215, 0, 0.1);
    backdrop-filter: blur(4px);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#story-audio-player:hover {
    border-color: var(--accent);
    box-shadow: 0 12px 28px rgba(212, 175, 55, 0.2), inset 0 0 0 1px var(--accent);
}

#story-audio-player .fa-music {
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.8; text-shadow: 0 0 5px var(--accent); }
    50% { opacity: 1; text-shadow: 0 0 15px var(--accent); }
}

audio {
    width: 100%;
    height: 48px;
    border-radius: 40px;
    background: transparent;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

audio::-webkit-media-controls-panel {
    background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
    border-radius: 40px;
    padding: 0 8px;
}

audio::-webkit-media-controls-play-button {
    background-color: var(--accent);
    border-radius: 50%;
    transition: all 0.2s ease;
    filter: brightness(1);
}

audio::-webkit-media-controls-play-button:hover {
    background-color: #e6b800;
    transform: scale(1.1);
}

audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
    color: var(--accent);
    font-weight: 600;
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
    font-family: 'Inter', sans-serif;
}

audio::-webkit-media-controls-timeline {
    background-color: #334155;
    border-radius: 20px;
    padding: 0 4px;
    margin: 0 8px;
}

audio::-webkit-media-controls-timeline::-webkit-slider-thumb {
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    border: 2px solid white;
}

audio::-webkit-media-controls-volume-slider {
    background-color: #334155;
    border-radius: 20px;
}

audio::-webkit-media-controls-volume-slider::-webkit-slider-thumb {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

audio::-webkit-media-controls-mute-button {
    filter: brightness(0) invert(1);
    opacity: 0.8;
    transition: opacity 0.2s;
}

audio::-webkit-media-controls-mute-button:hover {
    opacity: 1;
    background-color: rgba(212, 175, 55, 0.2);
    border-radius: 50%;
}

.lyrics-link {
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
}

.lyrics-link:hover {
    transform: translateX(2px);
}

.lyrics-link i {
    font-size: 0.9rem;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.5); }
    70% { box-shadow: 0 0 0 15px rgba(212, 175, 55, 0); }
    100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); }
}

/* ===== HERO COVER IMAGE ===== */
.hero-cover-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

/* ===== INLINE IMAGES (embedded via [img:...] markup) ===== */
figure.inline-image {
    margin: 2rem 0;
    text-align: center;
}

figure.inline-image img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    border: 1px solid rgba(212, 175, 55, 0.2);
}

figure.inline-image figcaption {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-top: 0.5rem;
}

/* ===== MOBILE ADJUSTMENTS ===== */
@media (max-width: 640px) {
    .hero-cover-image {
        max-height: 60vh;
    }

    /* Fix the huge text-indent that can break layout on small screens */
    #reader-content p {
        text-indent: 1.5em;
        margin-bottom: 0.8em;
    }

    /* Slightly reduce inline image max-height so it doesn't overflow */
    figure.inline-image img {
        max-height: 60vh;
    }

    /* Increase readability on very narrow devices */
    .reading-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Eye icon inside password fields */
#loginModal .relative button,
#signupModal .relative button {
    background: transparent;
    border: none;
    padding: 0 8px;
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 5;
}

#loginModal .relative button:hover,
#signupModal .relative button:hover {
    color: #d4af37; /* gold on hover */
}