/* ================== VARIABLES & PREMIUM COLORS ================== */
:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --accent-color: #ff4757;
    --accent-hover: #ff6b81;
    --primary-color: #0984e3;
    --primary-gradient: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    --accent-gradient: linear-gradient(135deg, #ff7675 0%, #d63031 100%);
    --category-bg: #fff3cd;
    --category-text: #d35400;
    --premium-color: #f1c40f;
    --locked-color: #95a5a6;
    --danger: #ee5253;
    --benefit-bg: #a29bfe;
    --streak-color: #ff9f43;
    /* Premium Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);
    --nav-bg: #ffffff;
    --shadow-light: 0 15px 35px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 25px 50px rgba(0, 0, 0, 0.08);
    --skeleton-base: #e2e8f0;
    --skeleton-shine: #f1f5f9;
}

[data-theme="dark"] {
    --bg-color: #09090b;
    --card-bg: #18181b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-color: #e84393;
    --accent-hover: #fd79a8;
    --primary-color: #0984e3;
    --category-bg: #d35400;
    --category-text: #ffeaa7;
    --benefit-bg: #6c5ce7;
    --glass-bg: rgba(24, 24, 27, 0.75);
    --glass-border: rgba(63, 63, 70, 0.4);
    --nav-bg: #18181b;
    --shadow-light: 0 15px 35px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 25px 50px rgba(0, 0, 0, 0.6);
    --skeleton-base: #27272a;
    --skeleton-shine: #3f3f46;
}

/* ================== RESET & BASE ================== */
body {
    font-family: 'Noto Sans Georgian', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    text-align: center;
    padding: 0;
    margin: 0;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

.content-wrapper {
    flex: 1;
    padding: 0 15px 50px 15px;
}

.kids-mode-active .top-bar,
.kids-mode-active .header-section,
.kids-mode-active .controls-container,
.kids-mode-active .filter-container,
.kids-mode-active .age-filter-container,
.kids-mode-active .benefits-section,
.kids-mode-active .site-footer,
.kids-mode-active .mobile-bottom-nav {
    display: none !important;
}

.kids-mode-active .content-wrapper {
    padding-top: 80px;
}

.exit-kids-btn {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--danger);
    color: white;
    padding: 16px 32px;
    border-radius: 35px;
    border: none;
    font-weight: 900;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 10px 25px rgba(238, 82, 83, 0.4);
    font-size: 1.1em;
    letter-spacing: 0.5px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.exit-kids-btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 15px 35px rgba(238, 82, 83, 0.5);
}

.kids-mode-active .exit-kids-btn {
    display: block;
    animation: fadeInDown 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ================== TOP BAR (ULTRA GLASSMORPHISM) ================== */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    max-width: 1250px;
    margin: 0 auto 30px auto;
    width: 100%;
    box-sizing: border-box;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    border-radius: 0 0 35px 35px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.03);
    transition: all 0.4s ease;
}

.nav-logo-link img {
    height: 130px;
    width: auto;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08));
}

.nav-logo-link img:hover {
    transform: scale(1.1) rotate(-3deg);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    font-size: 1.3em;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: var(--text-main);
}

.theme-toggle:hover {
    transform: rotate(25deg) scale(1.15);
    border-color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.2);
}

.auth-btn,
.user-profile-btn {
    padding: 12px 26px;
    border-radius: 30px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 0.95em;
    border: 2px solid transparent;
    letter-spacing: 0.5px;
}

.auth-btn {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 8px 25px rgba(255, 118, 117, 0.35);
}

.auth-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 30px rgba(255, 118, 117, 0.45);
}

.user-profile-btn {
    display: none;
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    gap: 10px;
    border: 1px solid var(--glass-border);
}

.user-profile-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(52, 152, 219, 0.15);
}

.logout-btn {
    background: rgba(238, 82, 83, 0.08);
    border: 1px solid transparent;
    padding: 12px 22px;
    border-radius: 30px;
    cursor: pointer;
    color: var(--danger);
    font-weight: 900;
    transition: all 0.3s ease;
    margin-left: 8px;
    font-size: 0.9em;
}

.logout-btn:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(238, 82, 83, 0.3);
}

.streak-display {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--streak-color);
    font-weight: 900;
    font-size: 1.2em;
    margin-right: 8px;
    cursor: help;
    background: var(--card-bg);
    padding: 10px 18px;
    border-radius: 30px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--glass-border);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.streak-display:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 159, 67, 0.25);
}

[data-theme="dark"] .streak-display {
    color: #feca57;
}

/* ================== HEADER & FILTERS ================== */
.header-section {
    margin-top: 30px;
    margin-bottom: 50px;
    animation: fadeInDown 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.main-title {
    color: var(--text-main);
    font-size: 4.5em;
    margin: 0 0 12px 0;
    font-weight: 900;
    letter-spacing: -2px;
}

.main-title span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 30px rgba(9, 132, 227, 0.2);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.4em;
    margin: 0 auto 25px auto;
    font-weight: 600;
    max-width: 680px;
    line-height: 1.6;
}

.controls-container {
    max-width: 950px;
    margin: 0 auto 30px auto;
    padding: 0 20px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.search-container {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 20px 30px 20px 65px;
    border-radius: 35px;
    border: 2px solid transparent;
    font-size: 1.15em;
    font-weight: 600;
    font-family: inherit;
    box-shadow: var(--shadow-light);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-sizing: border-box;
    color: var(--text-main);
    background: var(--card-bg);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 15px 40px rgba(52, 152, 219, 0.2);
    transform: translateY(-3px);
}

.search-icon {
    position: absolute;
    left: 25px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5em;
    color: var(--text-muted);
    opacity: 0.7;
}

.sort-select {
    padding: 18px 28px;
    border-radius: 35px;
    border: 2px solid transparent;
    font-size: 1.1em;
    font-family: inherit;
    font-weight: 800;
    color: var(--text-main);
    background: var(--card-bg);
    cursor: pointer;
    outline: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-light);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%237f8c8d%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1.8rem top 50%;
    background-size: 0.9rem auto;
    padding-right: 3.5rem;
}

.sort-select:focus,
.sort-select:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(52, 152, 219, 0.2);
}

.age-filter-container,
.filter-container {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin: 0 auto 35px auto;
    flex-wrap: wrap;
    max-width: 1050px;
    padding: 0 15px;
}

.age-btn,
.filter-btn {
    background: var(--card-bg);
    border: 2px solid transparent;
    color: var(--text-muted);
    padding: 14px 28px;
    border-radius: 35px;
    font-size: 1em;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-light);
    letter-spacing: 0.3px;
}

.age-btn:hover,
.filter-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.08);
    color: var(--text-main);
}

.age-btn.active,
.filter-btn.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 10px 30px rgba(52, 152, 219, 0.4);
    border-color: transparent;
}

.filter-btn.active {
    background: var(--accent-gradient);
    box-shadow: 0 10px 30px rgba(255, 118, 117, 0.4);
}

/* ================== SKELETON LOADERS ================== */
@keyframes shimmer {
    0% {
        background-position: -800px 0;
    }

    100% {
        background-position: 800px 0;
    }
}

.skeleton-card {
    background: var(--card-bg);
    border-radius: 35px;
    width: 310px;
    height: 440px;
    box-shadow: var(--shadow-light);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0.8;
}

.skeleton-img,
.skeleton-text {
    background: var(--skeleton-base);
    background-image: linear-gradient(to right, var(--skeleton-base) 8%, var(--skeleton-shine) 18%, var(--skeleton-base) 33%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite linear forwards;
}

.skeleton-img {
    height: 240px;
    width: 100%;
}

.skeleton-text {
    height: 22px;
    margin: 18px 25px;
    border-radius: 12px;
    width: 75%;
}

.skeleton-text.short {
    width: 45%;
    margin-top: 0;
}

.skeleton-btn {
    height: 50px;
    margin: auto 25px 25px 25px;
    border-radius: 20px;
}

/* ================== SMART RESUME BAR ================== */
.resume-bar {
    position: fixed;
    bottom: -100px;
    /* Hidden initially */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 450px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 999;
    transition: bottom 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.resume-bar.visible {
    bottom: 80px;
    /* Above mobile nav */
}

.resume-content {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    flex-grow: 1;
}

.resume-icon {
    background: var(--primary-gradient);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    box-shadow: 0 5px 15px rgba(9, 132, 227, 0.3);
    transition: transform 0.3s;
}

.resume-content:hover .resume-icon {
    transform: scale(1.1);
}

.resume-text {
    display: flex;
    flex-direction: column;
    color: var(--text-main);
    max-width: 280px;
}

.resume-text span {
    font-size: 0.75em;
    font-weight: 800;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.resume-text strong {
    font-size: 1.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.resume-close {
    background: rgba(255, 100, 100, 0.1);
    color: var(--danger);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    transition: background 0.3s, color 0.3s;
}

.resume-close:hover {
    background: var(--danger);
    color: white;
}

/* ================== MAIN PAGINATION ================== */
.main-pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 20px auto 60px auto;
    padding: 0 20px;
    flex-wrap: wrap;
}

.main-page-btn {
    background: var(--card-bg);
    border: 2px solid transparent;
    color: var(--text-main);
    padding: 12px 25px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 900;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 1.1em;
    box-shadow: var(--shadow-light);
}

.main-page-btn:hover:not(:disabled) {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(52, 152, 219, 0.4);
}

.main-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    border-color: var(--glass-border);
    color: var(--text-muted);
    background: transparent;
}

.main-page-info {
    font-weight: 900;
    color: var(--primary-color);
    font-size: 1.2em;
    background: rgba(52, 152, 219, 0.1);
    padding: 10px 20px;
    border-radius: 25px;
}

/* ================== PREMIUM STORY CARDS ================== */
.stories-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 35px;
    padding-bottom: 20px;
    /* შემცირდა პაგინაციის გამო */
    max-width: 1300px;
    margin: 0 auto;
}

.story-card {
    background: var(--card-bg);
    border-radius: 35px;
    padding: 0;
    width: 310px;
    box-shadow: var(--shadow-light);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    animation: fadeInUp 0.6s ease backwards;
}

.story-card:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: var(--shadow-hover);
}

.story-image-wrapper {
    position: relative;
    width: 100%;
    height: 240px;
    border-radius: 35px 35px 0 0;
    overflow: hidden;
    z-index: 1;
}

.story-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.story-card:hover .story-image {
    transform: scale(1.1);
}

/* ── Listening Progress Bar on Card ────────────────────────────────────── */
.card-progress-track {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255,255,255,0.25);
    z-index: 4;
}
.card-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0984e3, #6c5ce7);
    border-radius: 0 2px 2px 0;
    transition: width 0.3s ease;
}

/* ✨ Hover Play Overlay ✨ */
.overlay-play {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
    backdrop-filter: blur(2px);
}

/* --- STORY METADATA & TAGS --- */
.modal-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 20px;
    justify-content: center;
}

/* 📁 Horizontal Netflix-style Slider */
.fav-grid {
    display: flex;
    /* REMOVED !important SO JS TOGGLE WORKS */
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 15px;
    padding: 20px 20px 30px;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--card-bg);
}

.fav-grid::-webkit-scrollbar {
    height: 6px;
}

.fav-grid::-webkit-scrollbar-track {
    background: var(--card-bg);
    border-radius: 10px;
}

.fav-grid::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.fav-card {
    flex: 0 0 110px;
    width: 110px;
    scroll-snap-align: start;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fav-card:hover {
    transform: translateY(-8px) scale(1.05);
}

.fav-img {
    width: 110px;
    height: 110px;
    aspect-ratio: 1/1;
    border-radius: 24px;
    object-fit: cover;
    margin-bottom: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.fav-card:hover .fav-img {
    border-color: var(--primary-color);
    box-shadow: 0 15px 35px rgba(52, 152, 219, 0.3);
}

.fav-title {
    font-size: 0.8em;
    font-weight: 800;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ✨ Premium Modern Scrollbar */
.profile-scroll-area::-webkit-scrollbar,
.book-right::-webkit-scrollbar {
    width: 6px;
}

.profile-scroll-area::-webkit-scrollbar-track,
.book-right::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
}

.profile-scroll-area::-webkit-scrollbar-thumb,
.book-right::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
    opacity: 0.5;
}

[data-theme="dark"] .profile-scroll-area::-webkit-scrollbar-track,
[data-theme="dark"] .book-right::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

/* 📖 Magic Dictionary Premium Tooltip */
#dict-tooltip {
    display: none;
    position: fixed;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 18px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    max-width: 280px;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(10px) scale(0.95);
}

[data-theme="dark"] #dict-tooltip {
    background: rgba(30, 31, 35, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
}

#dict-title {
    color: var(--primary-color);
    font-size: 1.15em;
    font-weight: 900;
    display: block;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

#dict-desc {
    margin: 0;
    line-height: 1.5;
    color: var(--text-main);
    font-size: 0.95em;
    font-weight: 500;
}

.dict-word {
    position: relative;
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 2px dashed rgba(var(--primary-color-rgb, 108, 92, 231), 0.4);
    cursor: help;
    font-weight: 700;
    transition: 0.2s;
}

.dict-word:hover {
    color: var(--secondary-color);
    border-bottom-color: var(--secondary-color);
    background: rgba(var(--primary-color-rgb, 108, 92, 231), 0.05);
    border-radius: 4px;
}

[data-theme="dark"] .modal-metadata {
    background: rgba(255, 255, 255, 0.05);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
    font-weight: 800;
    color: var(--text-main);
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
    justify-content: center;
}

.tag-pill {
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 900;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: default;
}

.tag-pill:hover {
    transform: translateY(-2px) scale(1.05);
}

/* Dynamic Tag Colors */
.tag-pill:nth-child(5n+1) {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #444;
}

.tag-pill:nth-child(5n+2) {
    background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    color: #444;
}

.tag-pill:nth-child(5n+3) {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: #444;
}

.tag-pill:nth-child(5n+4) {
    background: linear-gradient(135deg, #fccb90 0%, #d57eeb 100%);
    color: #fff;
}

.tag-pill:nth-child(5n+5) {
    background: linear-gradient(135deg, #cfd9df 0%, #e2ebf0 100%);
    color: #444;
}

.overlay-play svg {
    width: 65px;
    height: 65px;
    fill: white;
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.4));
    transform: scale(0.5);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.story-card:hover .overlay-play {
    opacity: 1;
}

.story-card:hover .overlay-play svg {
    transform: scale(1);
}

.story-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    background: var(--card-bg);
    position: relative;
    z-index: 2;
}

.category-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background-color: var(--category-bg);
    color: var(--category-text);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 900;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    z-index: 3;
    letter-spacing: 0.5px;
    backdrop-filter: blur(5px);
}

.status-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 900;
    color: white;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    z-index: 3;
    letter-spacing: 0.5px;
}

.badge-premium {
    background-color: var(--premium-color);
}

.badge-locked {
    background-color: var(--locked-color);
}

.badge-new {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
    top: 50px;
}

/* ── Speed Popup ────────────────────────────────────────────────────────── */
.speed-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 9999;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    min-width: 90px;
}

.speed-option {
    background: none;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95em;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
    text-align: center;
}

.speed-option:hover { background: var(--primary-gradient); color: white; }
.speed-option.active { background: var(--primary-color); color: white; }

/* ── Search Autocomplete ─────────────────────────────────────────────────── */
.search-autocomplete {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    z-index: 9999;
    overflow: hidden;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 700;
    color: var(--text-main);
    transition: background 0.15s;
}

.autocomplete-item:hover { background: rgba(var(--primary-rgb, 52,152,219), 0.1); }
.autocomplete-item mark { background: none; color: var(--primary-color); font-weight: 900; }
.ac-emoji { font-size: 1.1em; flex-shrink: 0; }

.search-container { position: relative; }

.fav-btn {
    position: absolute;
    top: -25px;
    right: 25px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 4;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fav-btn:hover {
    transform: scale(1.2) rotate(15deg);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.fav-active {
    color: #ff4757;
}

.card-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    margin-top: 5px;
}

.card-rating {
    color: #f39c12;
    font-weight: 900;
    font-size: 1.05em;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-views {
    color: var(--text-muted);
    font-size: 0.9em;
    font-weight: 800;
    background: rgba(0, 0, 0, 0.03);
    padding: 6px 12px;
    border-radius: 15px;
}

[data-theme="dark"] .card-views {
    background: rgba(255, 255, 255, 0.05);
}

.story-title {
    color: var(--text-main);
    font-size: 1.45em;
    margin-bottom: 12px;
    font-weight: 900;
    text-align: left;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

.story-desc-short {
    display: none !important;
    /* დამალულია აღწერა, როგორც მოთხოვნილი იყო */
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 1em;
    margin-bottom: 25px;
    text-align: left;
    overflow: hidden;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.read-btn {
    background-color: var(--bg-color);
    color: var(--primary-color);
    border: none;
    padding: 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 100%;
    font-size: 1.1em;
    font-weight: 900;
    margin-top: auto;
}

.story-card:hover .read-btn {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
    transform: translateY(-2px);
}

/* ================== BOTTOM NAV (MOBILE PREMIUM) ================== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-top: 1px solid var(--glass-border);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.05);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Added for dynamic hide/show */
}

.mobile-bottom-nav.nav-hidden {
    transform: translateY(100%);
}

.nav-items-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 75px;
    padding: 0 10px;
    width: 100%;
    /* Fix for mobile layout issue */
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.6em;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex: 1;
    gap: 6px;
    position: relative;
}

.nav-item span {
    font-size: 0.45em;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    opacity: 0.8;
    transition: 0.3s;
}

.nav-item.active {
    color: var(--primary-color);
    transform: translateY(-4px);
}

.nav-item.active span {
    color: var(--primary-color);
    opacity: 1;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    width: 6px;
    height: 6px;
    background-color: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary-color);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ================== APP-LIKE MODALS ================== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
    /* Added specifically to disable background interactions */
    overscroll-behavior-y: none;
    /* iOS Safari fix */
    opacity: 0;
    transition: opacity 0.4s ease;
}

.modal.open {
    opacity: 1;
    display: block;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 50px;
    border-radius: 40px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
    text-align: left;
    position: relative;
    transform: translateY(50px) scale(0.95);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: var(--text-main);
    max-height: 85vh;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    /* iOS Safari fix for internal scroll */
    border: 1px solid var(--glass-border);
}

.modal.open .modal-content {
    transform: translateY(0) scale(1);
}

.close-btn {
    position: absolute;
    right: calc(20px + env(safe-area-inset-right));
    top: calc(20px + env(safe-area-inset-top));
    background: var(--bg-color);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
}

.close-btn:hover {
    background: var(--accent-color);
    color: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 15px rgba(255, 118, 117, 0.4);
}

.close-btn:active,
.close-btn:focus {
    background: #ff4757 !important;
    color: white !important;
    transform: scale(0.9);
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.6);
}

/* --- NEW: PREMIUM GLASSMORPHISM AUTH --- */
.auth-form {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(35px) saturate(200%);
    -webkit-backdrop-filter: blur(35px) saturate(200%);
    border: 1px solid var(--glass-border) !important;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.15) !important;
    text-align: center;
    padding: 40px !important;
}

[data-theme="dark"] .auth-form {
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6) !important;
}

.auth-icon-top {
    font-size: 3.5em;
    margin-bottom: 10px;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.1));
}

.auth-title {
    font-size: 2.2em;
    font-weight: 900;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-weight: 600;
    font-size: 1.05em;
}

.auth-input-group {
    position: relative;
    margin-bottom: 15px;
}

.auth-input {
    width: 100%;
    padding: 18px 20px;
    border-radius: 20px;
    border: 2px solid transparent;
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 1.05em;
    font-weight: 700;
    font-family: inherit;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-sizing: border-box;
}

.auth-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 8px 25px rgba(9, 132, 227, 0.15);
    transform: translateY(-2px);
}

.auth-submit-btn {
    width: 100%;
    padding: 18px;
    border-radius: 25px;
    background: var(--primary-gradient);
    color: white;
    font-size: 1.2em;
    font-weight: 900;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(9, 132, 227, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-top: 15px;
    letter-spacing: 0.5px;
}

.auth-submit-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 35px rgba(9, 132, 227, 0.5);
}

.auth-switch {
    color: var(--primary-color);
    margin-top: 25px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.3s;
    display: inline-block;
}

.auth-switch:hover {
    text-decoration: underline;
    transform: scale(1.05);
}

.google-divider {
    display: flex;
    align-items: center;
    margin: 25px 0;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.google-divider hr {
    flex: 1;
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: 0 15px;
}

/* --- NEW: iOS/SPOTIFY STYLE PROFILE --- */
.profile-modal-content {
    padding: 0 !important;
    /* Remove default modal padding */
    background: var(--bg-color) !important;
    /* iOS settings style bg */
    overflow: hidden !important;
    /* Prevent double scroll on iOS */
    display: flex;
    flex-direction: column;
}

.profile-header-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(200%);
    -webkit-backdrop-filter: blur(25px) saturate(200%);
    padding: 50px 20px 30px 20px;
    text-align: center;
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    z-index: 2;
}

.letter-avatar {
    width: 110px;
    height: 110px;
    font-size: 3.5em;
    margin: 0 auto 15px auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    border: 4px solid var(--card-bg);
}

.letter-avatar:hover {
    transform: scale(1.05) rotate(-5deg);
}

.stats-banner {
    display: flex;
    justify-content: space-around;
    background: var(--card-bg);
    padding: 20px 15px;
    border-radius: 30px;
    margin: -25px 20px 20px 20px;
    /* Overlap the header slightly */
    box-shadow: var(--shadow-hover);
    border: 1px solid var(--glass-border);
    position: relative;
    z-index: 3;
}

.stat-box {
    text-align: center;
    flex: 1;
}

.stat-box:first-child {
    border-right: 1px solid var(--glass-border);
}

.stat-box h4 {
    margin: 0 0 5px 0;
    font-size: 1.5em;
    font-weight: 900;
    color: var(--text-main);
}

.stat-box p {
    margin: 0;
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ios-list-group {
    background: var(--card-bg);
    border-radius: 25px;
    margin: 0 20px 25px 20px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.ios-list-group .collapsible-header {
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    border-bottom: 1px solid var(--glass-border);
    background: transparent;
    padding: 20px 25px;
}

.ios-list-group .collapsible-header:last-child,
.ios-list-group .collapsible-content:last-child {
    border-bottom: none;
}

.ios-list-group .collapsible-content {
    margin: 0;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--glass-border);
    box-shadow: inset 0 5px 15px rgba(0, 0, 0, 0.02);
    background: var(--bg-color);
}

[data-theme="dark"] .ios-list-group .collapsible-content {
    background: rgba(0, 0, 0, 0.3);
}

.profile-scroll-area {
    overflow-y: auto;
    flex: 1;
    padding-bottom: 30px;
    overscroll-behavior-y: contain;
    /* Scroll lock helper */
    -webkit-overflow-scrolling: touch;
}

/* ================== COMMENTS SECTION (NEW PREMIUM DESIGN) ================== */
.comments-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px dashed rgba(141, 110, 99, 0.15);
}

.comments-title {
    font-size: 1.8em;
    font-weight: 900;
    color: var(--text-main);
    margin-bottom: 25px;
    letter-spacing: -0.5px;
}

.add-comment-box {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    background: var(--bg-color);
    padding: 12px;
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
    overflow: visible !important;
    position: relative;
}

.add-comment-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(9, 132, 227, 0.15);
}

.comment-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 15px 20px;
    font-size: 1.05em;
    color: var(--text-main);
    font-family: inherit;
    font-weight: 600;
    outline: none;
}

.comment-submit-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 0 25px;
    border-radius: 25px;
    font-weight: 900;
    font-size: 1.05em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.3);
    will-change: transform;
}

.comment-submit-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 15px rgba(52, 152, 219, 0.4);
}

.comment-item {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 25px;
    margin-bottom: 15px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
    text-align: left;
}

.comment-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.comment-author {
    font-weight: 900;
    color: var(--primary-color);
    font-size: 1.1em;
}

.comment-date {
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: 700;
}

.comment-text {
    margin: 0;
    font-size: 1.05em;
    color: var(--text-main);
    line-height: 1.6;
}

/* 📖 წასაკითხი ფანჯრის დიზაინი დესკტოპზე */
.book-modal-content {
    background-color: var(--card-bg);
    margin: 3vh auto;
    padding: 40px;
    border-radius: 40px;
    width: 95%;
    max-width: 1200px;
    box-shadow: inset 30px 0 50px rgba(0, 0, 0, 0.02), 0 30px 80px rgba(0, 0, 0, 0.4);
    border-left: 20px solid var(--primary-color);
    position: relative;
    transform: translateY(50px);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    max-height: 94vh;
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal.open .book-modal-content {
    transform: translateY(0);
}

.book-modal-content .close-btn {
    right: calc(25px + env(safe-area-inset-right));
    top: calc(25px + env(safe-area-inset-top));
    background: var(--card-bg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 2px solid var(--glass-border);
    z-index: 100;
}

.book-modal-content .close-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: transparent;
    transform: rotate(90deg) scale(1.1);
}

.book-layout {
    display: flex;
    gap: 50px;
    flex: 1;
    min-height: 0;
}

.book-left {
    flex: 0.85;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 2px dashed rgba(141, 110, 99, 0.15);
    padding-right: 35px;
    overflow-y: auto;
    overflow-x: visible;
}

.book-left::-webkit-scrollbar {
    display: none;
}

.book-right {
    flex: 1.15;
    display: flex;
    flex-direction: column;
    text-align: left;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 15px;
    scroll-behavior: smooth;
}



.book-img {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    margin-bottom: 15px;
    border: 1px solid var(--glass-border);
}

.book-title {
    color: var(--text-main);
    font-size: 2.5em;
    text-align: center;
    margin: 5px 0 15px 0;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -1px;
}

.share-btn-aesthetic {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 0.9em;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.share-btn-aesthetic:hover {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.star-rating-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 30px;
    font-size: 2.2em;
    color: #cbd5e1;
}

.star-rating-container span {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.star-rating-container:hover span {
    color: #f59e0b;
    transform: scale(1.1);
}

.star-rating-container span:hover~span {
    color: #cbd5e1;
    transform: scale(1);
}

.star-rating-container span.active {
    color: #f59e0b !important;
    transform: scale(1.2);
    filter: drop-shadow(0 4px 10px rgba(245, 158, 11, 0.4));
}

/* Ensure stars remain lit after selection even on hover of other stars */
.star-rating-container span.active~span.active {
    color: #f59e0b !important;
}

.star-rating-container:not(:hover) span.active {
    color: #f59e0b !important;
}

/* 🎧 ფლეიერის დიზაინი */
.custom-player {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-color);
    padding: 25px;
    border-radius: 35px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.02), 0 10px 30px rgba(0, 0, 0, 0.05);
    width: 100%;
    box-sizing: border-box;
    margin-top: auto;
    border: 1px solid var(--glass-border);
}

.player-main-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    justify-content: center;
    margin-top: -28px; /* Pulls the play controls up, positioning the play button between the times */
    position: relative;
    z-index: 2;
}

.skip-time-btn {
    background: transparent;
    color: var(--primary-color);
    border: none;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s, color 0.3s;
    position: relative;
    z-index: 2;
}

.skip-time-btn:hover {
    background: rgba(52, 152, 219, 0.1);
    transform: scale(1.1);
    color: var(--accent-color);
}

[data-theme="dark"] .skip-time-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.player-extra-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    width: 100%;
}

.play-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    min-width: 65px;
    height: 65px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(52, 152, 219, 0.4);
    position: relative;
    z-index: 2;
}

.play-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
    transition: 0.3s;
}

.play-btn.playing svg {
    width: 24px;
    height: 24px;
}

.play-btn.playing {
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(52, 152, 219, 0.3);
}

.play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 35px rgba(52, 152, 219, 0.5);
}

.progress-container {
    flex-grow: 1;
    min-width: 120px;
    background: var(--card-bg);
    height: 12px;
    border-radius: 15px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

.progress-bar {
    background: var(--primary-gradient);
    height: 100%;
    width: 0%;
    border-radius: 15px;
    transition: width 0.1s linear;
}

#waveform-canvas {
    display: none;
}

/* 🔊 Volume Control Styling */
.volume-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 80%;
    max-width: 250px;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 10px 20px;
    border-radius: 25px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-light);
}

#volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--skeleton-base);
    border-radius: 10px;
    outline: none;
    cursor: pointer;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(9, 132, 227, 0.4);
    cursor: pointer;
    transition: 0.3s;
}

#volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 6px 15px rgba(9, 132, 227, 0.5);
}

#volume-icon {
    font-size: 1.2em;
    width: 25px;
    text-align: center;
}

.time-display {
    font-size: 0.9em;
    color: var(--text-muted);
    font-weight: 800;
    min-width: 65px;
    text-align: right;
}

.player-control-btn {
    background: var(--card-bg);
    border: 2px solid transparent;
    color: var(--text-muted);
    padding: 12px 18px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 800;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.player-control-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.15);
}

.player-control-btn.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
    border-color: transparent;
}

.btn-ambient.active {
    background: #10ac84;
    color: white;
    box-shadow: 0 8px 25px rgba(16, 172, 132, 0.4);
}

.btn-timer.active {
    background: #9b59b6;
    color: white;
    box-shadow: 0 8px 25px rgba(155, 89, 182, 0.4);
}

.btn-karaoke.active {
    background: #f39c12;
    color: white;
    box-shadow: 0 8px 25px rgba(243, 156, 18, 0.4);
}

.btn-queue:hover {
    background: #e84393;
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 25px rgba(232, 67, 147, 0.4);
}

.btn-download:hover {
    background: #e67e22;
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 25px rgba(230, 126, 34, 0.4);
}

.btn-magic:hover {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4);
}

.btn-magic-book:hover {
    background: linear-gradient(135deg, #ff7675 0%, #d63031 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 25px rgba(214, 48, 49, 0.4);
}

.btn-mic:hover {
    background: rgba(238, 82, 83, 0.1);
    color: var(--danger);
    border-color: var(--danger);
}

.btn-mic.recording {
    background: var(--danger);
    color: white;
    animation: pulse-red 1.5s infinite;
    border-color: transparent;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(238, 82, 83, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(238, 82, 83, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(238, 82, 83, 0);
    }
}

.book-text {
    font-size: 1.2em;
    line-height: 2;
    color: var(--text-main);
    text-align: justify;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    padding-bottom: 30px;
    letter-spacing: 0.2px;
}

.book-text::first-letter {
    font-size: 4.5em;
    font-weight: 900;
    color: var(--primary-color);
    float: left;
    margin-right: 15px;
    line-height: 0.9;
    margin-top: 5px;
    font-family: Georgia, serif;
    text-shadow: 2px 4px 8px rgba(52, 152, 219, 0.3);
}

.book-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 0;
    border-top: 2px dashed rgba(141, 110, 99, 0.15);
    border-bottom: 2px dashed rgba(141, 110, 99, 0.15);
    margin-bottom: 35px;
}

.page-btn {
    background: var(--bg-color);
    border: 2px solid transparent;
    color: var(--text-main);
    padding: 12px 30px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 900;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 1em;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.04);
}

.page-btn:hover {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(52, 152, 219, 0.4);
}

.page-btn:disabled {
    background: transparent;
    border-color: var(--glass-border);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: 0.5;
}

.page-num {
    font-weight: 900;
    color: var(--primary-color);
    font-size: 1.1em;
    background: rgba(52, 152, 219, 0.1);
    padding: 8px 20px;
    border-radius: 25px;
}

/* --- RELATED STORIES PREMIUM GRID --- */
.related-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px dashed rgba(141, 110, 99, 0.15);
}

.related-title {
    font-size: 1.5em;
    font-weight: 900;
    color: var(--text-main);
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.related-grid {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 15px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.related-grid::-webkit-scrollbar {
    height: 6px;
}

.related-grid::-webkit-scrollbar-thumb {
    background: rgba(141, 110, 99, 0.2);
    border-radius: 10px;
}

.related-card {
    flex: 0 0 140px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.related-card:hover {
    transform: translateY(-5px);
}

.related-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 20px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--glass-border);
}

.related-card-title {
    font-size: 0.9em;
    font-weight: 800;
    margin-top: 10px;
    color: var(--text-main);
    line-height: 1.3;
}

/* ================== OTHER SECTIONS ================== */
.benefits-section {
    background: rgba(0, 0, 0, 0.02);
    padding: 70px 20px;
    border-radius: 50px;
    max-width: 1150px;
    margin: 60px auto 40px auto;
    overflow-x: hidden;
}

[data-theme="dark"] .benefits-section {
    background: rgba(255, 255, 255, 0.02);
}

.benefits-title {
    color: var(--primary-color);
    font-size: 3em;
    margin: 0 0 15px 0;
    font-weight: 900;
    letter-spacing: -1.5px;
    text-align: center;
}

.benefits-subtitle {
    color: var(--text-muted);
    font-size: 1.3em;
    margin-bottom: 50px;
    font-weight: 600;
    text-align: center;
}

.benefits-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
}

.benefit-card-new {
    background: white;
    border-radius: 20px;
    padding: 20px 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: 0.3s;
    overflow: hidden;
    text-align: left;
}

[data-theme="dark"] .benefit-card-new {
    background: #222;
}

.benefit-card-new:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.benefit-card-new summary {
    font-weight: 900;
    font-size: 1.25em;
    color: var(--primary-color);
    list-style: none;
    /* remove default arrow */
    display: flex;
    justify-content: space-between;
    align-items: center;
    outline: none;
}

.benefit-card-new summary::-webkit-details-marker {
    display: none;
}

.benefit-card-new summary::after {
    content: '+';
    font-size: 1.5em;
    font-weight: 300;
    color: var(--text-muted);
    transition: 0.3s transform;
}

.benefit-card-new[open] summary::after {
    transform: rotate(45deg);
    color: var(--danger);
}

.benefit-card-new p {
    margin-top: 15px;
    color: var(--text-color);
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 0;
    font-weight: 500;
}

.parent-voice-block {
    background: linear-gradient(135deg, #ff9a9e, #fecfef);
    border-radius: 25px;
    padding: 35px;
    margin: 50px auto 0 auto;
    max-width: 800px;
    box-shadow: 0 20px 40px rgba(255, 154, 158, 0.3);
    text-align: left;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .parent-voice-block {
    background: linear-gradient(135deg, #4b1f41, #2b0b2e);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.parent-voice-block h3 {
    font-size: 2em;
    color: #333;
    margin-top: 0;
    font-weight: 900;
    margin-bottom: 15px;
}

[data-theme="dark"] .parent-voice-block h3 {
    color: #fff;
}

.parent-voice-block p {
    color: #444;
    font-size: 1.15em;
    line-height: 1.7;
}

[data-theme="dark"] .parent-voice-block p {
    color: #ccc;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 18px 25px;
    border-radius: 25px;
    margin-top: 15px;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 1.15em;
    font-weight: 800;
    color: var(--text-main);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-light);
}

.collapsible-header:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
    border-color: var(--primary-color);
}

.collapsible-header span:first-child {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary-gradient);
    border-radius: 50%;
    font-size: 0.78em;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: white;
    box-shadow: 0 4px 14px rgba(9, 132, 227, 0.35);
    flex-shrink: 0;
}

.toggle-arrow.open {
    transform: rotate(90deg);
    background: linear-gradient(135deg, #00cec9 0%, #00b894 100%);
    box-shadow: 0 4px 14px rgba(0, 184, 148, 0.4);
}

.collapsible-content {
    display: none;
    animation: fadeInDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 15px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 25px;
    border: 1px solid rgba(0, 0, 0, 0.02);
    box-shadow: inset 0 4px 15px rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

.collapsible-content.fav-grid {
    display: none; /* Forced override of any grid defaults */
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
}

.collapsible-content.fav-grid.open {
    display: grid !important;
}

.collapsible-content.open {
    display: block !important;
}

[data-theme="dark"] .collapsible-content {
    border-color: var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

/* Scroll To Top Button Fixed */
#scrollTopBtn {
    position: fixed;
    bottom: 90px;
    right: 30px;
    z-index: 999;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--primary-color);
    width: 55px;
    height: 55px;
    border-radius: 50%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 24px;
}

#scrollTopBtn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#scrollTopBtn:hover {
    background: var(--primary-gradient);
    color: white;
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 15px 30px rgba(52, 152, 219, 0.4);
}

.site-footer {
    background: var(--card-bg);
    padding: 50px 20px;
    border-top: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 1.05em;
    margin-top: auto;
    border-radius: 50px 50px 0 0;
    box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.03);
    font-weight: 600;
    text-align: center;
}

.footer-links {
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.footer-links a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 900;
    transition: 0.3s;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* QUIZ & SLEEP OVERLAYS */
#quiz-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 100;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-sizing: border-box;
}

[data-theme="dark"] #quiz-overlay {
    background: rgba(24, 24, 27, 0.95);
}

.quiz-title {
    color: var(--primary-color);
    font-size: 2.5em;
    font-weight: 900;
    margin-bottom: 40px;
    text-align: center;
    padding: 0 20px;
    line-height: 1.2;
    letter-spacing: -1px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 85%;
    max-width: 450px;
    margin: 0 auto;
}

.quiz-btn {
    background: var(--card-bg);
    border: 2px solid transparent;
    color: var(--text-main);
    font-size: 1.2em;
    padding: 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 900;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: inherit;
    box-shadow: var(--shadow-light);
}

.quiz-btn:hover {
    background: var(--primary-gradient);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 15px 35px rgba(52, 152, 219, 0.4);
}

.quiz-btn.correct {
    background: #2ecc71 !important;
    border-color: transparent !important;
    color: white !important;
    box-shadow: 0 15px 35px rgba(46, 204, 113, 0.5) !important;
}

.quiz-btn.neutral {
    background: #f39c12 !important;
    border-color: transparent !important;
    color: white !important;
    box-shadow: 0 15px 35px rgba(243, 156, 18, 0.5) !important;
}

.quiz-btn.wrong {
    background: var(--danger) !important;
    border-color: transparent !important;
    color: white !important;
    animation: shake 0.4s;
    box-shadow: 0 15px 35px rgba(238, 82, 83, 0.5) !important;
}

.quiz-btn.disabled {
    pointer-events: none;
    opacity: 0.7;
}

.quiz-btn.revealed-correct {
    background: #2ecc71 !important;
    border-color: transparent !important;
    color: white !important;
}

.quiz-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#sleep-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.98);
    z-index: 3000;
    cursor: pointer;
    color: white;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.pulsing-moon {
    font-size: 9em;
    animation: moon-pulse 4s infinite ease-in-out;
    filter: drop-shadow(0 0 50px rgba(255, 255, 255, 0.4));
}

@keyframes moon-pulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
        filter: drop-shadow(0 0 80px rgba(255, 255, 255, 0.7));
    }
}

/* ================== TOAST NOTIFICATION FIXED ================== */
.toast-notification {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    color: var(--text-main);
    border-left: 5px solid var(--primary-color);
    padding: 16px 30px;
    border-radius: 20px;
    font-weight: 800;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex !important;
}

.toast-notification.show {
    bottom: 40px;
    opacity: 1;
    visibility: visible;
}

/* ================== RESPONSIVE APP-LIKE UI (MOBILE & TABLET) ================== */
@media (max-width: 950px) {
    .book-layout {
        flex-direction: column;
        gap: 25px;
    }

    .book-left {
        border-right: none;
        border-bottom: 2px dashed rgba(141, 110, 99, 0.15);
        padding-right: 0;
        padding-bottom: 30px;
        overflow-y: visible;
    }

    .book-right {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .book-modal-content {
        border-left-width: 15px;
        padding: 40px 25px;
    }
}

@media (max-width: 600px) {
    body {
        padding-bottom: calc(85px + env(safe-area-inset-bottom));
    }

    .top-bar {
        position: absolute !important;
        top: 0;
        left: 0;
        right: 0;
        padding: 12px 20px;
        border-radius: 0 0 25px 25px;
        backdrop-filter: blur(25px) saturate(200%);
        z-index: 100;
    }

    .nav-logo-link img {
        height: 81px;
    }

    .header-section {
        margin-top: 100px !important; /* Move down to clear the absolute top-bar */
        margin-bottom: 30px !important;
    }

    .main-title {
        font-size: 3em;
    }

    .subtitle {
        font-size: 1.2em;
        padding: 0 10px;
    }

    .nav-actions .auth-btn,
    .nav-actions .user-profile-btn,
    .nav-actions .logout-btn {
        display: none !important;
    }

    .mobile-bottom-nav {
        display: block;
        width: 100%;
    }

    .modal-content,
    .book-modal-content {
        width: 100%;
        height: 96%;
        margin: 0;
        position: absolute;
        bottom: 0;
        border-radius: 40px 40px 0 0;
        border-left: none;
        padding: 40px 20px calc(30px + env(safe-area-inset-bottom)) 20px;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        transform: translateY(100%);
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
    }

    .profile-modal-content {
        padding: 0 !important;
        overflow-y: auto !important; /* Allow parent to scroll everything */
        display: block !important; /* Normal document flow for header + content */
        -webkit-overflow-scrolling: touch;
    }

    .profile-modal-content .profile-scroll-area {
        overflow-y: visible !important; /* Disable nested scrollbar */
        height: auto !important;
        display: block !important;
    }

    .modal.open .modal-content,
    .modal.open .book-modal-content {
        animation: slideUpBottomSheet 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    }

    /* Record Role Modal Override for Mobile */
    #record-role-modal .modal-content {
        max-width: 100% !important;
        border-radius: 40px 40px 0 0 !important;
        padding-bottom: calc(40px + env(safe-area-inset-bottom)) !important;
        height: auto;
    }

    @keyframes slideUpBottomSheet {
        0% {
            transform: translateY(100%);
        }

        70% {
            transform: translateY(-2%);
        }

        100% {
            transform: translateY(0);
        }
    }

    .book-modal-content::before,
    .modal-content::before {
        content: '';
        display: block;
        width: 50px;
        height: 6px;
        background: var(--text-muted);
        opacity: 0.3;
        border-radius: 10px;
        margin: -25px auto 30px auto;
        flex-shrink: 0;
    }

    .profile-modal-content::before {
        position: absolute;
        top: 15px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 10;
    }

    .book-modal-content .close-btn {
        top: calc(15px + env(safe-area-inset-top));
        right: calc(15px + env(safe-area-inset-right));
        background: var(--bg-color);
        border: none;
        z-index: 100;
    }

    .book-title {
        font-size: 2em;
        margin-bottom: 20px;
    }

    .book-img {
        max-height: 280px;
        border-width: 0;
        border-radius: 30px;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
        margin-bottom: 12px;
    }

    .custom-player {
        padding: 25px 10px;
        border-radius: 30px;
        background: transparent;
        box-shadow: none;
        border: none;
        margin-top: 5px;
    }

    /* Parent Voice Mobile Tweaks */
    #parent-voice-section {
        padding: 20px 15px !important;
        margin-top: 10px !important;
        background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%) !important;
        /* Ensure it stays visible */
        border-radius: 30px !important;
        box-shadow: 0 10px 25px rgba(108, 92, 231, 0.2) !important;
    }

    #mom-voice-row,
    #dad-voice-row {
        padding: 10px !important;
        gap: 10px !important;
    }

    #mom-voice-row>div:first-child,
    #dad-voice-row>div:first-child {
        font-size: 1.5em !important;
    }

    #play-btn-mom,
    #play-btn-dad {
        width: 35px !important;
        height: 35px !important;
        font-size: 14px !important;
    }

    [data-theme="dark"] .custom-player {
        background: transparent;
    }

    [data-theme="dark"] #parent-voice-section {
        background: linear-gradient(135deg, #8e44ad 0%, #9b59b6 100%) !important;
    }

    .player-extra-controls {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 15px;
        padding-top: 10px;
        gap: 15px;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .player-extra-controls::-webkit-scrollbar {
        display: none;
    }

    .player-control-btn {
        flex-direction: column;
        flex: 0 0 auto;
        width: 85px;
        height: 85px;
        justify-content: center;
        gap: 10px;
        border-radius: 25px;
        border: none;
        background: var(--card-bg);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
        scroll-snap-align: start;
        font-size: 1.8em;
    }

    .player-control-btn span {
        display: block !important;
        font-size: 0.45em;
        font-weight: 900;
        opacity: 0.8;
        text-transform: uppercase;
        letter-spacing: 0.8px;
    }

    .player-control-btn:active {
        transform: scale(0.9);
    }

    .play-btn {
        width: 75px;
        height: 75px;
        font-size: 28px;
        box-shadow: 0 15px 40px rgba(52, 152, 219, 0.5);
    }

    .progress-container {
        height: 14px;
        border-radius: 20px;
    }

    .progress-bar {
        border-radius: 20px;
    }

    .exit-kids-btn {
        top: auto;
        bottom: calc(95px + env(safe-area-inset-bottom));
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        padding: 20px;
        font-size: 1.2em;
        border-radius: 35px;
        box-shadow: 0 20px 40px rgba(238, 82, 83, 0.5);
        background: var(--danger);
        backdrop-filter: blur(15px);
        z-index: 99999;
    }

    .kids-mode-active .exit-kids-btn {
        animation: fadeInUpMobile 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .kids-mode-active .exit-kids-btn:hover {
        transform: translateX(-50%) scale(1.03);
    }
}

.story-card {
    width: 100%;
    max-width: 380px;
    border-radius: 40px;
}

.story-image-wrapper {
    height: 260px;
    border-radius: 40px 40px 0 0;
}

.overlay-play svg {
    width: 80px;
    height: 80px;
}

.auth-btn,
.user-profile-btn {
    padding: 10px 20px;
    font-size: 0.9em;
}

.add-comment-box {
    flex-direction: column;
    background: transparent;
    padding: 0;
    box-shadow: none;
    border: none;
}

.comment-input {
    background: var(--bg-color);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    margin-bottom: 10px;
}

.comment-submit-btn {
    padding: 16px;
    width: 100%;
    margin: 5px 0; /* Extra margin to prevent clipping our shadows */
}

    .nav-items-container {
        width: 100%;
    }

    #scrollTopBtn {
        bottom: 180px !important; /* Raise above Facebook icon */
        z-index: 1100 !important; /* Ensure it's above other floating elements */
    }
}

@keyframes fadeInUpMobile {
    from {
        opacity: 0;
        transform: translate(-50%, 60px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ===========================================================================
   Additions: CSS classes referenced by JS but absent from the original source
   =========================================================================== */

/* Mobile-only text size buttons in the player controls bar */
.mobile-player-only {
    display: none !important;
}

@media (max-width: 950px) {
    .mobile-player-only {
        display: flex !important;
    }
}

.resizer-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.resizer-btn {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 900;
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-light);
}

.resizer-btn:hover {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

/* ================== MINI PLAYER ================== */
#mini-player {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    z-index: 9998;
    background: var(--card-bg);
    border: 1.5px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.22);
    padding: 10px 14px;
    gap: 12px;
    align-items: center;
    width: min(380px, calc(100vw - 32px));
    transition: transform 0.35s cubic-bezier(0.175,0.885,0.32,1.275), opacity 0.35s ease;
    backdrop-filter: blur(12px);
}
#mini-player.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
#mini-player-img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
}
.mini-player-info {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}
.mini-player-title {
    font-weight: 800;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}
.mini-player-sub {
    font-size: 0.72em;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 2px;
}
.mini-player-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 1em;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s;
}
.mini-player-btn:hover { transform: scale(1.1); }
.mini-player-close-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--glass-border);
    font-size: 0.85em;
    font-weight: 900;
}
.mini-player-close-btn:hover { background: var(--accent-color); color: white; border-color: transparent; }

@media (max-width: 600px) {
    #mini-player { bottom: 70px; }
}

/* ================== CONTINUE SECTION ================== */
#continue-section {
    max-width: 950px;
    margin: 20px auto 6px;
    padding: 0 20px;
}
.rec-continue-bar {
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
}
.rec-continue-fill {
    height: 100%;
    background: linear-gradient(90deg, #00b894, #00cec9);
    border-radius: 2px;
}

/* ================== RECOMMENDED SECTION ================== */
#recommended-section {
    max-width: 950px;
    margin: 24px auto 18px;
    padding: 0 20px;
}
.rec-section-title {
    font-size: 1.05em;
    font-weight: 900;
    color: var(--text-main);
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
    gap: 7px;
}
.rec-scroll-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    /* negative margin so scroll extends past parent padding to screen edge */
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    scrollbar-width: none;
    cursor: grab;
}
.rec-scroll-row:active { cursor: grabbing; }
.rec-scroll-row::-webkit-scrollbar { display: none; }
.rec-card {
    flex: 0 0 140px;
    height: 140px;
    scroll-snap-align: start;
    cursor: pointer;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 22px rgba(0,0,0,0.13);
    transition: transform 0.25s cubic-bezier(0.175,0.885,0.32,1.275), box-shadow 0.25s ease;
    position: relative;
}
.rec-card:active { transform: scale(0.96); }
@media (hover: hover) {
    .rec-card:hover { transform: translateY(-6px) scale(1.03); box-shadow: 0 18px 38px rgba(0,0,0,0.18); }
}
.rec-card-img {
    width: 140px;
    height: 140px;
    object-fit: cover;
    display: block;
}
.rec-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 35%, rgba(0,0,0,0.85) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 10px 9px;
}
.rec-card-title {
    font-size: 0.78em;
    font-weight: 900;
    color: white;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    text-shadow: 0 1px 6px rgba(0,0,0,0.7);
}
.rec-card-rating {
    font-size: 0.68em;
    color: rgba(255,255,255,0.9);
    font-weight: 700;
    margin-top: 4px;
}

/* ================== ONBOARDING MODAL ================== */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.4s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.onboarding-card {
    background: var(--card-bg);
    border-radius: 32px;
    padding: 40px 32px 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 40px 100px rgba(0,0,0,0.35);
    animation: slideUpFadeIn 0.45s cubic-bezier(0.16,1,0.3,1);
    position: relative;
}
@keyframes slideUpFadeIn { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.onboarding-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg-color);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 1em;
    font-weight: 900;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.onboarding-close:hover { background: var(--danger); color: white; }
.onboarding-logo-wrap {
    text-align: center;
    margin: 0 auto 20px;
}
.onboarding-logo-text {
    font-size: 2.6em;
    font-weight: 900;
    letter-spacing: 0px;
    line-height: 1.15;
    display: inline-block;
    padding: 0 6px;
    background: linear-gradient(135deg, #0984e3 0%, #6c5ce7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.onboarding-title {
    font-size: 1.5em;
    font-weight: 900;
    color: var(--text-main);
    margin: 0 0 10px;
    line-height: 1.25;
}
.onboarding-desc {
    color: var(--text-muted);
    font-size: 0.92em;
    font-weight: 600;
    line-height: 1.6;
    margin: 0 0 22px;
}
.onboarding-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
    text-align: left;
}
.onboarding-feat {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-color);
    border-radius: 14px;
    padding: 12px 16px;
    border: 1.5px solid var(--glass-border);
}
.onboarding-feat span { font-size: 1.5em; flex-shrink: 0; line-height: 1; }
.onboarding-feat strong { font-weight: 900; color: var(--text-main); display: block; font-size: 0.95em; }
.onboarding-feat div { color: var(--text-muted); font-size: 0.82em; font-weight: 600; line-height: 1.4; }
.onboarding-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 16px 40px;
    font-size: 1.1em;
    font-weight: 900;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 8px 28px rgba(9,132,227,0.4);
    transition: transform 0.2s ease, box-shadow 0.2s;
    font-family: inherit;
    margin-bottom: 14px;
}
.onboarding-btn:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(9,132,227,0.5); }

@media (max-width: 768px) {
    .fb-login-btn { display: none !important; }
}
.onboarding-skip {
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: 600;
    margin: 0;
}

.book-text-container {
    flex: 1;
}

/* Book page flip animation */
@keyframes flipIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flip-anim {
    animation: flipIn 0.3s ease forwards;
}

/* Quiz wrong-answer shake */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-8px);
    }

    40%,
    80% {
        transform: translateX(8px);
    }
}

/* ===========================================================================
   Premium Facebook Integration
   =========================================================================== */
.facebook-floating-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: rgba(24, 119, 242, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(24, 119, 242, 0.3);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.facebook-floating-btn:hover {
    transform: translateY(-5px) scale(1.05);
    background: #1877F2;
    box-shadow: 0 15px 40px rgba(24, 119, 242, 0.5);
}

.facebook-floating-btn svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.fb-mobile-row {
    background: linear-gradient(135deg, #1877F2 0%, #155bb5 100%);
    color: white;
    padding: 15px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.1em;
    text-decoration: none;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(24, 119, 242, 0.3);
    transition: 0.3s;
}

.fb-mobile-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(24, 119, 242, 0.5);
}

@media (max-width: 768px) {
    .facebook-floating-btn .fb-text {
        display: none;
    }

    .facebook-floating-btn {
        padding: 12px;
        border-radius: 50%;
        bottom: 85px;
        right: 20px;
    }

    .desktop-only {
        display: none !important;
    }
}

/* ===========================================================================
   Hero Featured Section
   =========================================================================== */
#hero-section-container {
    width: 100%;
}

.hero-featured-section {
    width: calc(100% - 30px);
    max-width: 1050px;
    margin: 10px auto 35px auto;
    border-radius: 35px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    background: #000;
}

.hero-featured-section:hover {
    transform: translateY(-8px) scale(1.005);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.35);
}

.hero-featured-bg {
    width: 100%;
    height: 420px;
    object-fit: cover;
    display: block;
    transition: transform 0.8s ease;
}

.hero-featured-section:hover .hero-featured-bg {
    transform: scale(1.08);
}

.hero-featured-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.4) 40%, rgba(0, 0, 0, 0.9) 100%);
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    text-align: center;
}

.hero-badge {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.85em;
    font-weight: 900;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.hero-title {
    color: white;
    font-size: 3.2em;
    font-weight: 900;
    margin: 0 0 25px 0;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    line-height: 1.1;
    max-width: 800px;
}

.hero-btn {
    background: white;
    color: #1e293b;
    border: none;
    padding: 14px 40px;
    border-radius: 50px;
    font-weight: 900;
    font-size: 1.15em;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hero-btn:hover {
    transform: scale(1.05);
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 15px 35px rgba(108, 92, 231, 0.4);
}

@media (max-width: 768px) {
    .hero-featured-bg {
        height: 320px;
    }

    .hero-title {
        font-size: 2.2em;
    }

    .hero-featured-overlay {
        padding: 30px;
    }

    .hero-featured-section {
        border-radius: 25px;
    }
}

/* ===========================================================================
   Interactive Dictionary & Tooltip
   =========================================================================== */
.dict-word {
    text-decoration: underline dashed var(--accent-light);
    text-underline-offset: 4px;
    cursor: pointer;
    font-weight: 800;
    color: var(--accent-light);
    transition: color 0.3s, background 0.3s;
    border-radius: 4px;
    padding: 0 4px;
}

.dict-word:hover {
    background: rgba(255, 107, 107, 0.1);
}

.dict-tooltip {
    position: fixed;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: var(--text-main);
    padding: 12px 20px;
    border-radius: 15px;
    font-weight: 800;
    font-size: 1.1em;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.8);
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 300px;
    text-align: center;
}

.dict-tooltip.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ===========================================================================
   Mood Chips
   =========================================================================== */
.mood-chips-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 0 20px 30px 20px;
    margin: 0 auto;
    max-width: 1050px;
    width: 100%;
}

.mood-chip {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 10px 24px;
    border-radius: 50px;
    white-space: nowrap;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 1.05em;
}

.mood-chip:hover {
    background: var(--input-bg);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    border-color: var(--primary-color);
}

.mood-chip.active {
    background: linear-gradient(135deg, #a29bfe 0%, #9b59b6 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 20px rgba(155, 89, 182, 0.3);
}

/* ===========================================================================
   Parent's Choice Badge
   =========================================================================== */
.badge-parents-choice {
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 10px rgba(255, 140, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* ===========================================================================
   Mic Voice Animation
   =========================================================================== */
@keyframes mic-pulse {
    0% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }

    50% {
        transform: translateY(-50%) scale(1.3);
        opacity: 0.7;
        color: var(--danger);
        text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
    }

    100% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }
}

/* ===========================================================================
   Story Card & Modal Metadata (Author, Narrator, Tags)
   =========================================================================== */

.card-author-narrator {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 8px 0;
    font-size: 0.8em;
    color: var(--text-muted);
    font-weight: 700;
    justify-content: center;
}

.card-author-narrator span {
    background: rgba(0, 0, 0, 0.04);
    padding: 4px 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

[data-theme="dark"] .card-author-narrator span {
    background: rgba(255, 255, 255, 0.08);
}

.card-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    justify-content: center;
}

.card-tag {
    font-size: 0.75em;
    font-weight: 800;
    color: var(--primary-color);
    background: rgba(9, 132, 227, 0.1);
    padding: 4px 12px;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.card-tag:hover {
    background: var(--primary-color);
    color: white;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    justify-content: center;
}

.tag-pill {
    background: var(--card-bg);
    border: 2px solid var(--glass-border);
    color: var(--text-main);
    padding: 10px 22px;
    border-radius: 50px;
    font-size: 0.9em;
    font-weight: 800;
    box-shadow: var(--shadow-light);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tag-pill:hover {
    transform: translateY(-3px) scale(1.05);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 10px 20px rgba(9, 132, 227, 0.15);
}

[data-theme="dark"] .tag-pill {
    background: var(--card-bg);
}

/* ================================================================
   Profile Modal — compact layout for short desktop viewports
   Targets: 1440×900 MacBook Pro, MacBook Air M3, and similar.
   On mobile (≤768px) the existing bottom-sheet rules already apply.
   ================================================================ */
@media (min-width: 769px) and (max-height: 860px) {
    /* Definite height (not just max-height) is essential for flex-grow
       to work inside. Without it the scroll area collapses to 0. */
    .profile-modal-content {
        height: min(92vh, 820px) !important;
        max-height: min(92vh, 820px) !important;
        margin: max(1vh, 8px) auto !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    /* Compact profile header — biggest space saver */
    .profile-header-glass {
        padding: clamp(16px, 2.5vh, 30px) 20px clamp(10px, 1.5vh, 20px) 20px !important;
    }

    .letter-avatar {
        width: clamp(64px, 8vh, 90px) !important;
        height: clamp(64px, 8vh, 90px) !important;
        font-size: clamp(2em, 4.5vh, 3em) !important;
        margin-bottom: clamp(6px, 1vh, 12px) !important;
    }

    #profile-name-display {
        font-size: clamp(1.3em, 2.8vh, 1.9em) !important;
        margin-bottom: 2px !important;
    }

    #profile-role-display {
        font-size: clamp(0.78em, 1.1vh, 0.95em) !important;
        margin-bottom: 4px !important;
    }

    /* Stats row — smaller numbers and labels */
    .stats-banner {
        padding: clamp(8px, 1.2vh, 14px) 10px !important;
        margin: clamp(-18px, -2vh, -10px) 15px clamp(8px, 1.2vh, 16px) 15px !important;
    }

    .stat-box h4 {
        font-size: clamp(1em, 1.6vh, 1.3em) !important;
        margin-bottom: 2px !important;
    }

    .stat-box p {
        font-size: clamp(0.68em, 0.9vh, 0.78em) !important;
    }

    /* Action buttons row — less vertical padding */
    .profile-actions-row {
        margin-bottom: 12px !important;
    }

    .profile-actions-row a,
    .profile-actions-row button {
        padding-top: 9px !important;
        padding-bottom: 9px !important;
        font-size: 0.88em !important;
    }

    /* Collapsible list rows — tighter */
    .ios-list-group {
        margin: 0 15px clamp(10px, 1.5vh, 18px) 15px !important;
    }

    .ios-list-group .collapsible-header {
        padding: clamp(10px, 1.4vh, 16px) 20px !important;
        font-size: 0.9em !important;
    }

    /* Scroll area fills all remaining height and enables trackpad scrolling */
    .profile-scroll-area {
        flex: 1 1 0 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-bottom: 20px !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior-y: contain !important;
        scroll-behavior: smooth !important;
    }

    /* Facebook + logout — lighter touch */
    .fb-mobile-row {
        padding: 10px 18px !important;
        font-size: 0.9em !important;
        margin-bottom: 8px !important;
    }

    .logout-btn {
        padding: 12px !important;
        font-size: 0.95em !important;
    }
}

/* Extra compact: viewports under 720px tall (small laptops, 768p monitors) */
@media (min-width: 769px) and (max-height: 720px) {
    .profile-header-glass {
        padding: 12px 20px 8px 20px !important;
    }

    .letter-avatar {
        width: 56px !important;
        height: 56px !important;
        font-size: 1.8em !important;
        margin-bottom: 5px !important;
    }

    #profile-name-display {
        font-size: 1.2em !important;
    }

    #profile-role-display {
        font-size: 0.75em !important;
    }

    .stats-banner {
        padding: 8px 10px !important;
        margin: -12px 15px 8px 15px !important;
    }

    .stat-box h4 {
        font-size: 0.95em !important;
    }

    .ios-list-group .collapsible-header {
        padding: 9px 18px !important;
        font-size: 0.85em !important;
    }
}