:root {
    --night: #3b3486;
    --night-dark: #2d2766;
    --moon: #ffc95c;
    --cream: #fdf8ef;
    --ink: #3a3341;
    --teal: #1f8a70;
}

body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--cream);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

/* ---------- Navbar ---------- */
.app-navbar {
    background: linear-gradient(135deg, var(--night) 0%, var(--night-dark) 100%);
    box-shadow: 0 2px 12px rgba(45, 39, 102, .35);
}

.app-navbar .navbar-brand {
    color: var(--moon);
    font-weight: 700;
    font-size: 1.35rem;
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff8e7;
    box-shadow: 0 0 0 2px rgba(255, 201, 92, .45);
}

.brand-logo-sm {
    width: 40px;
    height: 40px;
}

.hero-logo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff8e7;
    box-shadow: 0 10px 36px rgba(0, 0, 0, .28);
}

@media (min-width: 768px) {
    .hero-logo {
        width: 240px;
        height: 240px;
    }
}

.nav-badge {
    position: absolute;
    top: -.15rem;
    inset-inline-end: -.55rem;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 .3rem;
    border-radius: 999px;
    background: #e85d4c;
    color: #fff;
    font-size: .7rem;
    line-height: 1.15rem;
    text-align: center;
    font-weight: 700;
}

.nav-badge.static {
    position: static;
    display: inline-block;
    margin-inline-start: .35rem;
    vertical-align: middle;
}

.seo-intro {
    background: linear-gradient(135deg, #fff9ef, #f3eefc);
    border-radius: 1.25rem;
    padding: 1.5rem 1.75rem;
}

.site-page {
    max-width: 46rem;
}

.site-page p,
.site-page li {
    line-height: 1.9;
}

.site-page-goals {
    padding-inline-start: 1.25rem;
    margin-bottom: 0;
}

.site-page-goals li + li {
    margin-top: .55rem;
}

#faqAccordion .accordion-item {
    border-color: rgba(59, 52, 134, .12);
}

#faqAccordion .accordion-button:not(.collapsed) {
    background: #fff9ef;
    color: inherit;
    box-shadow: none;
}

#faqAccordion .accordion-button:focus {
    box-shadow: 0 0 0 .2rem rgba(232, 168, 74, .25);
}

.storyteller-card {
    transition: transform .15s ease, box-shadow .15s ease;
}

.storyteller-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(59, 52, 134, .16);
}

.storyteller-hero {
    background: linear-gradient(135deg, #fff9ef 0%, #efe9ff 100%);
}

.storyteller-avatar,
.storyteller-avatar-placeholder {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.storyteller-avatar-placeholder {
    background: #efe9ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.storyteller-avatar-lg,
.storyteller-avatar-lg-placeholder {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid #fff;
    box-shadow: 0 4px 16px rgba(59, 52, 134, .18);
}

.storyteller-avatar-lg-placeholder {
    background: #efe9ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
}

.comment-notify-unread {
    border: 1px solid rgba(232, 93, 76, .35);
    background: #fff8f6;
}

.comment-notify-card {
    border-radius: 1rem;
}

.app-navbar .nav-link {
    color: #efeafd;
    font-weight: 500;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
    color: var(--moon);
}

.app-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, .4);
}

.app-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--moon);
}

/* ---------- Hero (homepage) ---------- */
.hero {
    background: linear-gradient(160deg, var(--night) 0%, #5146a8 60%, #6a5cc9 100%);
    color: #fff;
    border-radius: 0 0 2rem 2rem;
    padding: 3.5rem 0 3rem;
}

.hero h1 {
    font-weight: 700;
    color: var(--moon);
}

/* ---------- Cards ---------- */
.card {
    border: none;
    border-radius: 1.25rem;
    box-shadow: 0 3px 14px rgba(59, 52, 134, .08);
}

.tale-card {
    transition: transform .15s ease, box-shadow .15s ease;
    overflow: hidden;
    height: 100%;
}

.tale-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 22px rgba(59, 52, 134, .18);
}

.tale-cover {
    height: 170px;
    object-fit: cover;
    width: 100%;
}

.tale-cover-placeholder {
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    background: linear-gradient(135deg, #efe9ff, #dcd2ff);
}

/* ---------- Buttons: large tap targets, friendly for children and elderly users ---------- */
.btn {
    border-radius: .9rem;
}

.btn-primary {
    background-color: var(--night);
    border-color: var(--night);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--night-dark);
    border-color: var(--night-dark);
}

.btn-warm {
    background-color: var(--moon);
    border-color: var(--moon);
    color: var(--night-dark);
    font-weight: 700;
}

.btn-warm:hover {
    background-color: #f0b73f;
    border-color: #f0b73f;
    color: var(--night-dark);
}

.btn-big {
    font-size: 1.25rem;
    padding: .85rem 2rem;
}

.auth-tabs .nav-link {
    color: var(--night);
    font-weight: 700;
}

.auth-tabs .nav-link.active {
    background: var(--night);
    color: #fff;
}

.form-control, .form-select {
    border-radius: .8rem;
    padding: .6rem .9rem;
}

.form-control-lg {
    font-size: 1.15rem;
}

.password-toggle {
    width: 3.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #dee2e6;
    color: #716a7a;
}

.input-group > .form-control + .password-toggle {
    margin-inline-start: -1px;
    border-start-start-radius: 0;
    border-end-start-radius: 0;
}

.input-group > .form-control:has(+ .password-toggle) {
    border-start-end-radius: 0;
    border-end-end-radius: 0;
}

.password-toggle:hover {
    background: #f4f1fb;
    border-color: #a49bc4;
    color: var(--night);
}

.password-toggle:focus-visible {
    color: var(--night);
    border-color: #8c82bc;
    box-shadow: 0 0 0 .25rem rgba(59, 52, 134, .18);
}

.password-toggle svg {
    width: 1.35rem;
    height: 1.35rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Category chips ---------- */
.category-chip {
    display: inline-block;
    background: #efe9ff;
    color: var(--night);
    border-radius: 2rem;
    padding: .35rem 1rem;
    margin: .15rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s;
}

.category-chip:hover, .category-chip.active {
    background: var(--night);
    color: #fff;
}

/* On the tale page the chips are the main way into a category, so give them weight */
.category-chip-lg {
    padding: .45rem 1.15rem;
    font-weight: 700;
    border: 1px solid rgba(59, 52, 134, .18);
}

/* ---------- Tale detail header ---------- */
.tale-rating {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

.tale-rating-score {
    background: var(--moon);
    color: var(--night-dark);
    font-weight: 700;
    font-size: 1.15rem;
    border-radius: .75rem;
    padding: .15rem .7rem;
}

.rating-stars {
    position: relative;
    display: inline-block;
    direction: ltr;
    line-height: 1;
    white-space: nowrap;
    font-size: 1.35rem;
}

.rating-stars-empty {
    color: #d8d2e8;
}

.rating-stars-filled {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    color: var(--moon);
    /* --rating is the 0-5 average, so a 4.5 average fills exactly nine half-stars */
    width: calc(var(--rating, 0) / 5 * 100%);
}

.tale-storyteller {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem .9rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, #fff9ef 0%, #efe9ff 100%);
    color: inherit;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease;
}

.tale-storyteller:hover {
    color: inherit;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(59, 52, 134, .16);
}

.tale-storyteller-text {
    line-height: 1.5;
}

.tale-storyteller-cta {
    margin-inline-start: auto;
    color: var(--night);
    font-weight: 700;
    font-size: .9rem;
    white-space: nowrap;
}

.tale-cover-sm {
    height: 120px;
}

/* ---------- Star rating ---------- */
.stars {
    direction: ltr;
    display: inline-flex;
    gap: .15rem;
    font-size: 1.6rem;
    line-height: 1;
}

.stars .star {
    color: #d8d2e8;
    cursor: default;
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
}

.stars .star.filled {
    color: var(--moon);
}

.stars.interactive .star {
    cursor: pointer;
    transition: transform .1s;
}

.stars.interactive .star:hover {
    transform: scale(1.2);
}

.stars-sm {
    font-size: 1.05rem;
}

/* ---------- Audio player ---------- */
audio {
    width: 100%;
}

/* ---------- Recorder ---------- */
.record-btn {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    border: none;
    background: #d9534f;
    color: #fff;
    font-size: 2.2rem;
    box-shadow: 0 4px 14px rgba(217, 83, 79, .4);
}

.record-btn.recording {
    animation: pulse 1.2s infinite;
    background: #b02a25;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(217, 83, 79, .5); }
    70% { box-shadow: 0 0 0 18px rgba(217, 83, 79, 0); }
    100% { box-shadow: 0 0 0 0 rgba(217, 83, 79, 0); }
}

/* ---------- Comments ---------- */
.comment {
    border-inline-start: 3px solid #e4ddf5;
    padding-inline-start: 1rem;
}

.comment-reply {
    margin-inline-start: 2.5rem;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #efe9ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* ---------- Status badges ---------- */
.badge {
    font-weight: 500;
}

/* ---------- Progress bars in dashboard ---------- */
.progress {
    height: .8rem;
    border-radius: 1rem;
}

.progress-bar {
    background-color: var(--teal);
}

/* ---------- Footer ---------- */
.app-footer {
    flex-shrink: 0;
    background: var(--night-dark);
    color: #cfc8ee;
    margin-top: 3rem;
}

.app-footer a {
    color: var(--moon);
    text-decoration: none;
}

/* ---------- Mobile bottom navigation ---------- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    inset-inline: 0;
    z-index: 1030;
    display: flex;
    background: var(--night-dark);
    box-shadow: 0 -2px 14px rgba(45, 39, 102, .35);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav a {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15rem;
    min-height: 3.4rem;
    padding: .45rem .25rem;
    color: #cfc8ee;
    text-decoration: none;
    font-size: .72rem;
    font-weight: 500;
    line-height: 1.2;
}

.bottom-nav .bottom-nav-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.bottom-nav a:hover,
.bottom-nav a.active {
    color: var(--moon);
}

/* The bar floats over the page, so give the content room to scroll clear of it */
@media (max-width: 991.98px) {
    body {
        padding-bottom: calc(3.4rem + env(safe-area-inset-bottom, 0px));
    }
}

/* ---------- Top-5 ribbon ---------- */
.top-rank {
    position: absolute;
    top: .6rem;
    inset-inline-start: .6rem;
    background: var(--moon);
    color: var(--night-dark);
    font-weight: 700;
    border-radius: 50%;
    width: 2.3rem;
    height: 2.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

.top-gifts-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .35rem .75rem;
    padding: .85rem 1.1rem;
    border-radius: .75rem;
    background: linear-gradient(120deg, rgba(255, 201, 92, .35) 0%, rgba(31, 138, 112, .12) 100%);
    border: 1px solid rgba(255, 201, 92, .55);
    color: var(--ink);
    font-size: .95rem;
    line-height: 1.7;
}

.top-gifts-banner strong {
    color: var(--night-dark);
    white-space: nowrap;
}

.milestone-100 {
    text-align: center;
}

.milestone-100-link {
    display: block;
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 10px 32px rgba(59, 52, 134, .2);
    transition: transform .2s ease, box-shadow .2s ease;
}

.milestone-100-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(59, 52, 134, .28);
}

.milestone-100-img {
    width: 100%;
    height: auto;
    display: block;
}

.milestone-100-count {
    margin-top: 1rem;
    color: var(--night);
    font-size: 1.05rem;
    line-height: 1.8;
}

.milestone-100-count strong {
    color: var(--night-dark);
}

.milestone-100-cta {
    margin-top: .85rem;
}

.profile-password {
    scroll-margin-top: 1.5rem;
}
