/* ========================================
   MANIAM - Main Stylesheet
   گرم و صمیمی | کافه ایرانی
   ======================================== */

@font-face {
    /* یک فایل متغیر برای همه‌ی وزن‌ها (۱۰۰ تا ۹۰۰)؛ به‌جای ۹ فایل جدا */
    font-family: 'Vazirmatn';
    src: url("../fonts/Vazirmatn-Variable.f6d31671339d.woff2") format('woff2-variations'),
         url("../fonts/Vazirmatn-Variable.f6d31671339d.woff2") format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* همه‌ی متن‌ها با وزیرمتن، حتی اجزای بوت‌استرپ (آیکون‌ها با ::before جدا هستند و دست نمی‌خورند) */
* { font-family: 'Vazirmatn', sans-serif !important; }

:root {
    --bg-primary: #FDFBE8;
    --bg-secondary: #F7F4D4;
    --bg-card: #FFFEF5;
    --bg-card-hover: #FFFBE0;
    --bg-input: #FFFEF5;
    --accent: #C9882C;
    --accent-light: #E0A040;
    --accent-dark: #A06820;
    --accent-glow: rgba(201, 136, 44, 0.15);
    --accent-bg: rgba(201, 136, 44, 0.08);
    --text-primary: #2C1A0E;
    --text-secondary: #6B4C2A;
    --text-muted: #85623F;            /* کنتراست ۴٫۶ به بالا روی همه‌ی زمینه‌های روشن، حتی فوتر (WCAG AA) */
    --border: #E8DFB8;
    --border-accent: rgba(201, 136, 44, 0.35);
    --border-dark: #C8B87A;
    --red: #C0392B;
    --green: #4A7C3F;
    --font: 'Vazirmatn', sans-serif;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 4px 24px rgba(100, 60, 0, 0.10);
    --shadow-accent: 0 4px 20px rgba(201, 136, 44, 0.18);
    --shadow-card: 0 2px 12px rgba(100, 60, 0, 0.07);
    --player-height: 76px;
    --transition: all 0.2s ease;

    /* سطح‌ها و رنگ‌هایی که در حالت تاریک عوض می‌شوند (پایین‌تر: html[data-theme="dark"]) */
    --accent-ink: #8F5C18;                             /* متن و لینک به رنگ تأکید؛ کنتراست ≥ ۴٫۸ حتی روی فوتر */
    --accent-fill: #A06820;                            /* زمینه‌ی کهربایی زیر متن سفید (چیپ و تب فعال)؛ کنتراست ۴٫۷ */
    --accent-grad: linear-gradient(135deg, #A86E24, #8F5C18);   /* دکمه‌های اصلی با متن سفید */
    --on-accent: #FFFFFF;
    --surface: #FFFFFF;                                /* فیلد فعال، دکمه‌ی سفید */
    --nav-bg: rgba(253, 251, 232, 0.96);
    --nav-bg-solid: rgba(253, 251, 232, 0.98);
    --footer-bg: #F2EDCC;
    --player-bg: rgba(255, 254, 245, 0.97);
    --glass: rgba(255, 254, 245, 0.95);
    --hero-grad: linear-gradient(160deg, #FFF8D6 0%, #FDFBE8 60%, #F7F2CC 100%);
    --hero-grad-soft: linear-gradient(160deg, #FFF8D6 0%, #FDFBE8 100%);
    --paper: #FFFEF8;
    --paper-alt: #FFFEF0;
    --paper-line: rgba(160, 120, 80, 0.13);
    --paper-margin: rgba(201, 72, 44, 0.28);
    --warn-bg: #FFF4D6;
    --success-bg: #F0FAF0;
    --danger-bg: #FDF0F0;
    --success-ink: #2E7D32;
    --danger-ink: #C0392B;
    --danger-line: #D9534F;
    --ink-bg: #2C1A0E;                                 /* برچسب‌های تیره روی صفحه‌ی روشن */
    --ink-fg: #FFFFFF;
    --shadow-soft: 0 2px 12px rgba(100, 60, 0, 0.06);
    --shadow-up: 0 -4px 24px rgba(100, 60, 0, 0.10);
    --shadow-pop: 0 12px 32px rgba(60, 40, 20, 0.16);
    --shadow-float: 0 12px 36px rgba(60, 40, 20, 0.22);
    color-scheme: light;
}

/* ---- حالت تاریک: «کافه‌ی ایرانی در شب» ----
   قهوه‌ای تیره‌ی گرم به‌جای سیاه، متن کرمی، همان کهربایی سایت کمی روشن‌تر.
   تم را اسکریپت کوچک بالای templates/base.html پیش از نمایش صفحه روی <html> می‌گذارد. */
html[data-theme="dark"] {
    --bg-primary: #17110B;
    --bg-secondary: #221911;
    --bg-card: #1F170F;
    --bg-card-hover: #281E14;
    --bg-input: #1B140D;
    --accent: #D99A3E;
    --accent-light: #EBB25A;
    --accent-dark: #A86E24;
    --accent-ink: #EDB45C;
    --accent-fill: var(--accent);
    --accent-grad: linear-gradient(135deg, var(--accent), var(--accent-dark));
    --accent-glow: rgba(217, 154, 62, 0.24);
    --accent-bg: rgba(217, 154, 62, 0.12);
    --text-primary: #F3E9D2;
    --text-secondary: #D3BF9C;
    --text-muted: #A99272;
    --border: #3A2C1E;
    --border-accent: rgba(217, 154, 62, 0.42);
    --border-dark: #5C4731;
    --red: #E5675A;
    --green: #7DB46F;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --shadow-accent: 0 4px 20px rgba(217, 154, 62, 0.20);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.28);

    --surface: #2A2017;
    --nav-bg: rgba(23, 17, 11, 0.94);
    --nav-bg-solid: rgba(26, 19, 12, 0.98);
    --footer-bg: #120D08;
    --player-bg: rgba(31, 23, 15, 0.97);
    --glass: rgba(31, 23, 15, 0.92);
    --hero-grad: linear-gradient(160deg, #261B10 0%, #17110B 60%, #1D150D 100%);
    --hero-grad-soft: linear-gradient(160deg, #261B10 0%, #17110B 100%);
    --paper: #1E1710;
    --paper-alt: #1E1710;
    --paper-line: rgba(230, 200, 150, 0.09);
    --paper-margin: rgba(229, 103, 90, 0.32);
    --warn-bg: rgba(217, 154, 62, 0.12);
    --success-bg: rgba(125, 180, 111, 0.12);
    --danger-bg: rgba(229, 103, 90, 0.12);
    --success-ink: #8FCB85;
    --danger-ink: #F08A7E;
    --danger-line: #E5675A;
    --ink-bg: #F3E9D2;
    --ink-fg: #17110B;
    --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-up: 0 -4px 24px rgba(0, 0, 0, 0.35);
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.45);
    --shadow-float: 0 12px 36px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
}

/* ---- Base ---- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    direction: rtl;
}

/* لینک‌های متنی کمی تیره‌تر از --accent تا روی زمینه‌ی کرمی خوانا باشند (کنتراست) */
a { color: var(--accent-ink); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }
::selection { background: var(--accent); color: white; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---- Navbar Toggle Button ---- */
.navbar-toggler {
    border: 1.5px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    color: var(--accent);
    background: var(--accent-bg);
}
.navbar-toggler:focus { box-shadow: 0 0 0 3px var(--accent-glow); }
.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='%23C9882C' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ---- Navbar ---- */
.maniam-navbar {
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1.5px solid var(--border);
    padding: 12px 0;
    box-shadow: var(--shadow-soft);
}

.brand-icon {
    width: 38px; height: 38px;
    background: var(--accent-grad);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: white;
    box-shadow: var(--shadow-accent);
}

.brand-text {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.search-form { width: 340px; }
.search-input {
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
    padding: 8px 16px;
    font-size: 0.875rem;
}
.search-input:focus {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-input::placeholder { color: var(--text-muted); }
.search-btn {
    background: var(--accent);
    border: none;
    color: white;
    padding: 8px 14px;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
}
.search-btn:hover { background: var(--accent-dark); color: white; }

.navbar-nav .nav-link {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--accent-ink);
    background: var(--accent-bg);
}

.user-avatar-sm {
    width: 30px; height: 30px;
    background: var(--accent-grad);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    color: white;
}

.maniam-dropdown {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}
.maniam-dropdown .dropdown-item {
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.875rem;
    padding: 8px 16px;
    transition: var(--transition);
}
.maniam-dropdown .dropdown-item:hover { background: var(--accent-bg); color: var(--accent-ink); }
.maniam-dropdown .dropdown-divider { border-color: var(--border); }

/* ---- Buttons ---- */
.btn-primary {
    background: var(--accent-grad);
    border: none;
    color: white;
    font-family: var(--font);
    font-weight: 700;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-accent);
}

.btn-outline-primary {
    border: 1.5px solid var(--accent);
    color: var(--accent);
    font-family: var(--font);
    border-radius: var(--radius-sm);
    background: transparent;
}
.btn-outline-primary:hover { background: var(--accent-fill); color: var(--on-accent); }

.btn-download {
    background: var(--accent-grad);
    color: white;
    border: none;
    font-family: var(--font);
    font-weight: 700;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}
.btn-download:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(201, 136, 44, 0.3);
}

.btn-play {
    background: var(--surface);
    color: var(--text-primary);
    border: 1.5px solid var(--border);
    font-family: var(--font);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    cursor: pointer;
}
.btn-play:hover {
    background: var(--accent-bg);
    color: var(--accent-ink);
    border-color: var(--accent);
}

/* ---- Cards ---- */
.song-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    box-shadow: var(--shadow-card);
}
.song-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.song-card-cover {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-secondary);
}
.song-card-cover img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.song-card:hover .song-card-cover img { transform: scale(1.06); }

.song-card-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    font-size: 3rem;
    color: var(--border-dark);
    aspect-ratio: 1;
}

.song-card-overlay {
    position: absolute; inset: 0;
    background: rgba(44, 26, 14, 0.45);
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    gap: 12px;
}
.song-card:hover .song-card-overlay { opacity: 1; }

.card-play-btn, .card-download-btn {
    width: 46px; height: 46px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}
.card-play-btn { background: var(--accent-fill); color: var(--on-accent); }
.card-play-btn:hover { background: var(--accent-light); transform: scale(1.1); }
.card-download-btn { background: rgba(255,255,255,0.85); color: #2C1A0E; }   /* روی عکس؛ در هر دو تم یکسان */
.card-download-btn:hover { background: white; transform: scale(1.1); }

.song-card-body { padding: 14px; }
.song-card-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
.song-card-artist {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.song-card-meta {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.song-badge { font-size: 0.7rem; padding: 3px 8px; border-radius: 20px; font-weight: 500; }
.badge-genre {
    background: var(--accent-bg);
    color: var(--accent-ink);
    border: 1px solid var(--border-accent);
}
.song-stats { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--text-muted); }

/* ---- Hero ---- */
.hero-section {
    background: var(--hero-grad);
    border-bottom: 1.5px solid var(--border);
    padding: 28px 0;
    position: relative;
    overflow: hidden;
}
.hero-title-inline {
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.4;
}
.hero-title-inline .accent { color: var(--accent); }
.hero-sub { color: var(--text-muted); font-size: 0.9rem; margin: 0; }
.hero-row {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 16px;
}
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* نوار «امروز» بالای هیرو */
.today-strip {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    margin-bottom: 14px;
    font-size: 0.8rem;
}
.today-date, .today-occasion {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-accent);
    background: var(--bg-card);
    color: var(--text-secondary);
}
.today-date i, .today-occasion i { color: var(--accent); }
.today-occasion { background: var(--accent-bg); color: var(--accent-ink); font-weight: 700; }
.today-occasion-desc { font-weight: 400; color: var(--text-secondary); }
@media (max-width: 575px) { .today-occasion-desc { display: none; } }

/* ---- Section Headers ---- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1.5px solid var(--border);
}
.section-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}
.section-icon { color: var(--accent); }
.section-title .title-accent {
    width: 4px; height: 22px;
    background: linear-gradient(to bottom, var(--accent), var(--accent-dark));
    border-radius: 2px;
}
.section-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.85rem; color: var(--accent-ink); font-weight: 600;
    white-space: nowrap;
}
.section-link i { transition: transform 0.2s ease; }
.section-link:hover { color: var(--accent); }
.section-link:hover i { transform: translateX(-3px); }
.home-section { margin-bottom: 3rem; }

/* ---- Genre Cards ---- */
.genre-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 14px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: block;
    box-shadow: var(--shadow-card);
}
.genre-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-accent);
}
.genre-icon { font-size: 2rem; margin-bottom: 8px; display: block; color: var(--accent); }
.genre-name { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); display: block; margin-bottom: 4px; }
.genre-count { font-size: 0.78rem; color: var(--text-muted); }

/* ---- Artist Cards ---- */
.artist-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: var(--transition);
    text-decoration: none;
    display: block;
    box-shadow: var(--shadow-card);
}
.artist-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}
.artist-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 12px;
    border: 2px solid var(--border-accent);
}
.artist-avatar-placeholder {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--accent-grad);
    margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; font-weight: 900;
    color: white;
}
.artist-name { font-weight: 700; color: var(--text-primary); margin-bottom: 4px; font-size: 0.95rem; }
.artist-count { font-size: 0.78rem; color: var(--text-muted); }

/* ---- Song Detail ---- */
.song-detail-cover {
    width: 100%; aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow);
}
.song-detail-placeholder {
    width: 100%; aspect-ratio: 1;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 5rem; color: var(--border-dark);
    border: 1.5px solid var(--border);
}
.song-detail-title {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1.3;
}
.song-detail-artist { font-size: 1.1rem; color: var(--accent); font-weight: 600; }
.song-info-row { display: flex; flex-wrap: wrap; gap: 16px; margin: 16px 0; }
.song-info-item {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.875rem; color: var(--text-secondary);
}
.song-info-item i { color: var(--accent); }

/* ---- Star Rating ---- */
.star-rating {
    display: flex;
    flex-direction: row-reverse;
    gap: 4px;
    justify-content: flex-end;
}
.star-rating input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.star-rating label {
    font-size: 1.5rem;
    color: var(--border-dark);
    cursor: pointer;
    transition: var(--transition);
}
.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label { color: var(--accent); }

/* ---- Comments ---- */
.comment-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-card);
}
.comment-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--accent-grad);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem;
    color: white;
    flex-shrink: 0;
}
.comment-username { font-weight: 700; font-size: 0.875rem; color: var(--text-primary); }
.comment-date { font-size: 0.75rem; color: var(--text-muted); }
.comment-text { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.8; margin-top: 8px; }
.comment-form-box {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-card);
}

/* ---- Forms ---- */
.form-control, .form-select {
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}
.form-control:focus, .form-select:focus {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control::placeholder { color: var(--text-muted); }
.form-select option { background: var(--bg-card); }
.form-label { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 6px; font-weight: 500; }

/* ---- Auth ---- */
.auth-wrapper {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 40px 16px;
    background: var(--hero-grad-soft);
}
.auth-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}
.auth-title { font-size: 1.6rem; font-weight: 900; color: var(--text-primary); margin-bottom: 6px; }
.auth-subtitle { color: var(--text-muted); font-size: 0.9rem; }

/* ---- Filter Sidebar ---- */
.filter-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
    position: sticky;
    top: 80px;
    box-shadow: var(--shadow-card);
}
.filter-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}
.filter-item {
    display: block;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
}
.filter-item:hover, .filter-item.active { background: var(--accent-bg); color: var(--accent-ink); }
.filter-count {
    font-size: 0.72rem;
    background: var(--bg-secondary);
    padding: 1px 7px;
    border-radius: 20px;
    color: var(--text-muted);
    float: left;
}

/* ---- Pagination ---- */
.pagination .page-link {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-secondary);
    font-family: var(--font);
}
.pagination .page-link:hover { background: var(--accent-bg); color: var(--accent-ink); border-color: var(--border-accent); }
.pagination .page-item.active .page-link { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }


/* ---- Song Row ---- */
.song-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    transition: var(--transition);
    margin-bottom: 8px;
    box-shadow: var(--shadow-card);
}
.song-row:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    transform: translateX(-2px);
}
.song-row-cover { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.song-row-cover-placeholder {
    width: 44px; height: 44px; border-radius: 8px;
    background: var(--bg-secondary);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); flex-shrink: 0;
}
.song-row-info { flex: 1; min-width: 0; }
.song-row-title { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-row-artist { font-size: 0.78rem; color: var(--text-muted); }
.song-row-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.song-row-action-btn {
    background: none; border: none;
    color: var(--text-muted);
    font-size: 1rem; padding: 5px 8px;
    border-radius: 6px; cursor: pointer;
    transition: var(--transition);
}
.song-row-action-btn:hover { color: var(--accent-ink); background: var(--accent-bg); }

/* ---- Alerts ---- */
.maniam-alert {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font);
    border-radius: var(--radius-sm);
}
.alert-success { border-color: var(--green) !important; background: var(--success-bg) !important; }
.alert-danger { border-color: var(--red) !important; background: var(--danger-bg) !important; }

/* ---- Footer ---- */
.maniam-footer {
    background: var(--footer-bg);
    border-top: 1.5px solid var(--border);
    padding: 48px 0 24px;
}
.footer-brand {
    display: inline-flex; align-items: center; gap: 8px;
    margin-bottom: 14px;
}
.footer-logo {
    width: 32px; height: 32px;
    border-radius: 8px;
    object-fit: cover;
}
.footer-about {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 2;
    margin-bottom: 18px;
}
.footer-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 16px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-dark);
    color: var(--text-secondary);
    background: var(--bg-card);
    font-size: 0.85rem;
    font-weight: 600;
}
.footer-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.footer-btn-primary {
    background: var(--accent-grad);
    border-color: transparent;
    color: white;
    box-shadow: var(--shadow-accent);
}
.footer-btn-primary:hover { color: white; filter: brightness(1.05); }
.footer-heading { color: var(--text-primary); font-weight: 800; font-size: 0.9rem; margin-bottom: 16px; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: var(--text-muted); font-size: 0.875rem; transition: var(--transition); }
.footer-links a:hover { color: var(--accent-ink); }
.footer-divider { border-color: var(--border); margin: 32px 0 20px; }
.footer-bottom {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 8px 24px;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.footer-heart { color: var(--red); }
.footer-credit { font-weight: 700; color: var(--accent-ink); direction: ltr; unicode-bidi: isolate; }
.footer-github { color: var(--text-secondary); font-size: 1rem; margin-right: 4px; vertical-align: middle; }
.footer-github:hover { color: var(--text-primary); }

/* ---- Brand logo (header) ---- */
.brand-logo {
    width: 38px; height: 38px;
    border-radius: 10px;
    object-fit: cover;
}

/* ---- Page progress bar (HTMX navigation) ---- */
.page-progress {
    position: fixed; top: 0; right: 0;
    height: 3px; width: 0;
    background: linear-gradient(90deg, var(--accent-dark), var(--accent-light));
    box-shadow: 0 0 8px var(--accent-glow);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: width 0.25s ease, opacity 0.3s ease;
}
.page-progress.is-loading { opacity: 1; width: 70%; transition: width 4s cubic-bezier(.1,.7,.3,1), opacity 0.1s; }
.page-progress.is-done { opacity: 0; width: 100%; transition: width 0.2s ease, opacity 0.4s ease 0.2s; }
@media (prefers-reduced-motion: reduce) {
    .page-progress, .page-progress.is-loading, .page-progress.is-done { transition: opacity 0.2s; }
}

/* ---- Misc ---- */
.page-header {
    padding: 40px 0 24px;
    border-bottom: 1.5px solid var(--border);
    margin-bottom: 32px;
}
.page-title { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 900; color: var(--text-primary); margin-bottom: 4px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 4rem; display: block; margin-bottom: 16px; opacity: 0.3; }
.empty-state p { font-size: 1rem; }

.lyrics-box {
    background: var(--paper-alt);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    white-space: pre-line;
    line-height: 2.2;
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-height: 400px;
    overflow-y: auto;
    direction: rtl;
    text-align: center;
}

/* ---- Animations ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.4s ease forwards; }

/* ---- Responsive ---- */
@media (max-width: 991px) {
    #navMenu {
        background: var(--nav-bg-solid);
        border-top: 1.5px solid var(--border);
        border-radius: 0 0 var(--radius) var(--radius);
        padding: 12px 8px;
        margin-top: 8px;
        box-shadow: var(--shadow);
    }
    .search-form {
        width: 100% !important;
        margin-bottom: 8px;
    }
    .navbar-nav {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 2px !important;
        width: 100%;
    }
    .navbar-nav .nav-link {
        width: 100%;
        padding: 10px 16px;
        border-radius: var(--radius-sm);
        font-size: 1rem;
        border-bottom: 1px solid var(--border);
    }
    .navbar-nav .nav-link:last-child { border-bottom: none; }
    .navbar-nav .btn {
        width: 100%;
        text-align: center;
        margin-top: 4px;
        padding: 10px 16px !important;
        border-radius: var(--radius-sm) !important;
    }
    .navbar-nav .dropdown-menu {
        position: static !important;
        width: 100%;
        margin-top: 4px;
        box-shadow: none;
    }
    .navbar-nav li.nav-item { width: 100%; }
}
@media (hover: none), (max-width: 767px) {   /* صفحه‌ی لمسی: دکمه‌ی پخش همیشه پیدا (هاور ندارد) */
    .song-card-overlay { opacity: 1; background: rgba(44,26,14,0.3); }
}

/* ---- Notes ---- */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.note-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    overflow: hidden;
}

.note-card::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 16px;
    font-size: 6rem;
    color: var(--accent);
    opacity: 0.06;
    font-family: Georgia, serif;
    line-height: 1;
    pointer-events: none;
}

.note-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.note-tag-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    width: fit-content;
    background: var(--accent-bg);
    color: var(--accent-ink);
    border: 1px solid var(--border-accent);
    position: relative;
}
a.note-tag-label:hover { background: var(--accent-fill); color: var(--on-accent); border-color: var(--accent-fill); }
.note-tag-sm { font-size: 0.7rem; padding: 3px 10px; }

.note-tag-self { background: #FFF3E0; color: #E65100; border: 1px solid #FFCCBC; }
.note-tag-social { background: #E3F2FD; color: #1565C0; border: 1px solid #BBDEFB; }
.note-tag-poem { background: #F3E5F5; color: #6A1B9A; border: 1px solid #E1BEE7; }
.note-tag-music { background: var(--accent-bg); color: var(--accent-ink); border: 1px solid var(--border-accent); }
.note-tag-life { background: #E8F5E9; color: #2E7D32; border: 1px solid #C8E6C9; }
.note-tag-game { background: #E8EAF6; color: #283593; border: 1px solid #C5CAE9; }

.note-text {
    font-size: 1rem;
    line-height: 2;
    color: var(--text-primary);
    white-space: pre-line;
    flex: 1;
}

.note-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

/* دکمه‌های فیلتر تگ */
.note-tag-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    text-decoration: none;
    transition: var(--transition);
}
.note-tag-btn:hover,
.note-tag-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* نوشته تصادفی در صفحه اصلی */
.random-note-box {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 32px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.random-note-box::before {
    content: '"';
    position: absolute;
    top: -20px;
    left: 20px;
    font-size: 8rem;
    color: var(--accent);
    opacity: 0.07;
    font-family: Georgia, serif;
    line-height: 1;
    pointer-events: none;
}

.random-note-text {
    font-size: 1.05rem;
    line-height: 2.1;
    color: var(--text-primary);
    white-space: pre-line;
    position: relative;
}

.random-note-link { display: block; text-decoration: none; }
.random-note-link:hover { color: var(--accent-ink); }
.random-note-box.htmx-swapping { opacity: 0; transition: opacity 0.2s ease; }
.random-note-box.htmx-added { opacity: 0; }
.random-note-box { transition: opacity 0.25s ease; }
.random-note-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* ===== NOTEBOOK CARDS ===== */
.notebook-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-card);
    text-decoration: none;
}
.notebook-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}
.notebook-card-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
}
.notebook-card-cover-placeholder {
    width: 100%;
    height: 200px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-muted);
}
.notebook-card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.notebook-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.5;
}
.notebook-card-excerpt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.7;
    flex: 1;
    margin-bottom: 12px;
}
.notebook-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: auto;
}


/* ---- اجزای کوچک مشترک ---- */
.meta-text { font-size: 0.75rem; color: var(--text-muted); }
.btn-soft {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-soft:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-bg); }
.btn-soft.htmx-request i { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- اسلایدر عکس (gallery/partials/photo_slider.html) ---- */
.photo-slider-viewport { position: relative; }
.photo-slider-track {
    --gap: 12px;
    display: flex;
    gap: var(--gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    border-radius: var(--radius);
    outline: none;
}
.photo-slider-track::-webkit-scrollbar { display: none; }
.photo-slider-track:focus-visible { box-shadow: 0 0 0 3px var(--accent-glow); }
.photo-slide {
    flex: 0 0 calc((100% - 2 * var(--gap)) / 3);
    scroll-snap-align: start;
    position: relative;
    display: block;
    height: 260px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1.5px solid var(--border);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-card);
    cursor: zoom-in;
}
.photo-slide-img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.photo-slide:hover .photo-slide-img { transform: scale(1.05); }
.photo-slide:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.photo-slide-caption {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 36px 16px 14px;
    background: linear-gradient(to top, rgba(44,26,14,0.85), transparent);
    display: flex; flex-direction: column; gap: 2px;
}
.photo-slide-title { font-size: 0.95rem; font-weight: 700; color: white; }
.photo-slide-location { font-size: 0.78rem; color: rgba(255,255,255,0.85); }
.photo-slide-zoom {
    position: absolute; top: 10px; left: 10px;
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(44,26,14,0.45); color: white; font-size: 0.8rem;
    opacity: 0; transition: opacity 0.2s ease;
}
.photo-slide:hover .photo-slide-zoom, .photo-slide:focus-visible .photo-slide-zoom { opacity: 1; }

.photo-slider-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    z-index: 2;
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--glass);
    color: var(--text-primary);
    font-size: 1.05rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
}
.photo-slider-btn:hover { background: var(--surface); color: var(--accent-ink); border-color: var(--accent); }
.photo-slider-btn:focus-visible { outline: 3px solid var(--accent); }
.photo-slider-prev { right: 10px; }
.photo-slider-next { left: 10px; }

.photo-slider-dots { display: flex; justify-content: center; gap: 6px; margin-top: 14px; min-height: 8px; }
.photo-slider-dot {
    width: 8px; height: 8px;
    padding: 0; border: none; border-radius: 4px;
    background: var(--border-dark);
    cursor: pointer;
    transition: var(--transition);
}
.photo-slider-dot.active { background: var(--accent); width: 22px; }
.photo-slider.is-static .photo-slider-btn,
.photo-slider.is-static .photo-slider-dots { display: none; }

@media (max-width: 991px) {
    .photo-slide { flex-basis: calc((100% - var(--gap)) / 2); height: 220px; }
}
@media (max-width: 575px) {
    /* کمی از عکس بعدی پیداست تا معلوم باشد می‌شود کشید */
    .photo-slide { flex-basis: 86%; height: 220px; }
    .photo-slider-btn { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .photo-slide-img, .photo-slide:hover .photo-slide-img { transition: none; transform: none; }
}

/* ---- نمایشگر تمام‌صفحه‌ی عکس (static/js/gallery.js) ---- */
body.lightbox-open { overflow: hidden; }
.lightbox {
    position: fixed; inset: 0;
    z-index: 3000;
    background: rgba(20, 12, 4, 0.94);
    display: flex; align-items: center; justify-content: center;
    padding: 56px 72px;
}
.lightbox[hidden] { display: none; }
.lightbox-figure {
    margin: 0;
    width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px;
}
.lightbox-img {
    max-width: 100%;
    max-height: calc(100% - 64px);
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.lightbox-info {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    width: 100%; max-width: 900px;
    color: rgba(255,255,255,0.75);
    font-size: 0.85rem;
}
.lightbox-text { display: flex; flex-direction: column; gap: 2px; }
.lightbox-title { color: white; font-size: 1rem; }
.lightbox-counter { white-space: nowrap; }
.lightbox-btn {
    position: absolute;
    width: 46px; height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.lightbox-btn:hover { background: rgba(255,255,255,0.22); }
.lightbox-btn:focus-visible { outline: 3px solid var(--accent-light); }
.lightbox-close { top: 12px; left: 12px; }
.lightbox-prev { right: 14px; top: 50%; transform: translateY(-50%); }
.lightbox-next { left: 14px; top: 50%; transform: translateY(-50%); }
.lightbox.is-single .lightbox-prev, .lightbox.is-single .lightbox-next { display: none; }
@media (max-width: 575px) {
    .lightbox { padding: 60px 12px 24px; }
    /* در موبایل با کشیدن انگشت جابه‌جا می‌شود؛ دکمه‌ها پایین صفحه می‌آیند */
    .lightbox-prev, .lightbox-next { top: auto; bottom: 14px; transform: none; width: 40px; height: 40px; }
    .lightbox-info { padding: 0 48px; }
}

/* ===================================================================
   بخش آهنگ‌ها (فاز ۴)
   =================================================================== */
.page-subtitle { color: var(--text-muted); margin: 0; }
.page-breadcrumb { background: none; padding: 0; margin: 0; font-size: 0.875rem; }
.page-breadcrumb a { color: var(--text-muted); }
.page-breadcrumb a:hover { color: var(--accent-ink); }
.page-breadcrumb .active { color: var(--text-secondary); }
.results-note { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1rem; }
.results-note strong { color: var(--accent-ink); }
.section-count { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; }
.empty-state-sm { padding: 30px 20px; }
.empty-state-sm i { font-size: 2.5rem; margin-bottom: 8px; }

/* فیلترها */
.filter-toggle { position: relative; padding: 9px 16px; font-size: 0.875rem; }
.filter-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.filter-list { max-height: 240px; overflow-y: auto; }
@media (max-width: 991px) {
    #songFilters { margin-top: 12px; }
}

/* کارت و ردیف آهنگ */
a.song-card-title { display: block; }
a.song-card-title:hover { color: var(--accent-ink); }
.song-card-artist a { color: inherit; }
.song-card-artist a:hover { color: var(--accent-ink); }
.song-card-meta { gap: 8px; }
.song-stats i { margin-left: 2px; }
.song-featured-badge, .song-duration-badge {
    position: absolute;
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.68rem; font-weight: 700;
    padding: 3px 8px; border-radius: 20px;
    pointer-events: none;
}
.song-featured-badge { top: 8px; right: 8px; background: var(--accent-fill); color: var(--on-accent); }
.song-duration-badge { bottom: 8px; left: 8px; background: rgba(44,26,14,0.65); color: white; font-variant-numeric: tabular-nums; }
.song-row-num { color: var(--text-muted); font-size: 0.8rem; min-width: 20px; text-align: center; }
a.song-row-title { display: block; }
a.song-row-title:hover { color: var(--accent-ink); }
.song-row-artist a { color: inherit; }
.song-row-artist a:hover { color: var(--accent-ink); }
.song-row-duration { font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* آهنگی که الان در پلیر پخش می‌شود */
.song-card.is-current, .song-row.is-current { border-color: var(--accent); box-shadow: var(--shadow-accent); }

/* صفحه‌ی آهنگ */
.song-detail-stats {
    display: flex; flex-wrap: wrap; gap: 6px 16px;
    margin-top: 14px;
    font-size: 0.8rem; color: var(--text-muted);
}
.song-detail-stats i { margin-left: 4px; }
.rating-box {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-card);
}
.rating-box-title { font-size: 1rem; font-weight: 800; color: var(--text-primary); margin: 0; display: flex; align-items: center; gap: 8px; }
.rating-box-title i { color: var(--accent); }
.rating-summary { font-size: 1.2rem; font-weight: 900; color: var(--accent); }
.rating-of { font-size: 0.9rem; }
.rating-count { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; margin-right: 4px; }
.rating-hint { font-size: 0.8rem; color: var(--text-muted); margin: 8px 0 0; }
.star-rating label:focus-within, .star-rating input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 4px; }

/* ===================================================================
   پلیر کوچک (static/js/player.js)
   =================================================================== */
body.has-player { padding-bottom: calc(var(--player-height) + 16px); }
.mini-player {
    --progress: 0%;
    --volume: 80%;
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 1040;
    background: var(--player-bg);
    backdrop-filter: blur(16px);
    border-top: 1.5px solid var(--border);
    box-shadow: var(--shadow-up);
}
.mini-player[hidden] { display: none; }

/* نوار پیشرفت باریک بالای پلیر؛ ناحیه‌ی لمس بزرگ‌تر از ظاهرش است */
.mp-progress { position: absolute; top: -7px; left: 0; right: 0; height: 14px; }
.mp-seek {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 14px; margin: 0;
    background: transparent; cursor: pointer;
}
.mp-seek::-webkit-slider-runnable-track {
    height: 4px;
    background: linear-gradient(to right, var(--accent) var(--progress), var(--border) var(--progress));
}
.mp-seek::-moz-range-track {
    height: 4px;
    background: linear-gradient(to right, var(--accent) var(--progress), var(--border) var(--progress));
}
.mp-seek::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 14px; height: 14px; margin-top: -5px;
    border-radius: 50%; border: 2px solid white;
    background: var(--accent-dark);
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    transform: scale(0); transition: transform 0.15s ease;
}
.mp-seek::-moz-range-thumb {
    width: 12px; height: 12px;
    border-radius: 50%; border: 2px solid white;
    background: var(--accent-dark);
    transform: scale(0); transition: transform 0.15s ease;
}
.mp-progress:hover .mp-seek::-webkit-slider-thumb, .mp-seek:focus-visible::-webkit-slider-thumb, .mp-seek:active::-webkit-slider-thumb { transform: scale(1); }
.mp-progress:hover .mp-seek::-moz-range-thumb, .mp-seek:focus-visible::-moz-range-thumb { transform: scale(1); }
.mp-seek:focus-visible { outline: none; }
.mini-player.is-loading .mp-seek::-webkit-slider-runnable-track { animation: mp-pulse 1s ease-in-out infinite; }
@keyframes mp-pulse { 50% { opacity: 0.5; } }

.mp-inner {
    height: var(--player-height);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    padding: 0 20px;
    max-width: 1400px; margin: 0 auto;
}

.mp-info { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.mp-info:hover .mp-title { color: var(--accent-ink); }
.mp-cover-wrap { flex-shrink: 0; width: 48px; height: 48px; }
.mp-cover, .mp-cover-ph {
    width: 48px; height: 48px;
    border-radius: 10px;
    object-fit: cover;
    border: 1.5px solid var(--border);
}
.mp-cover-ph { display: flex; align-items: center; justify-content: center; background: var(--bg-secondary); color: var(--text-muted); }
.mp-cover-ph[hidden], .mp-cover[hidden] { display: none; }
.mp-text { display: flex; flex-direction: column; min-width: 0; }
.mp-title, .mp-artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-title { font-weight: 800; font-size: 0.9rem; color: var(--text-primary); transition: var(--transition); }
.mp-artist { font-size: 0.78rem; color: var(--text-muted); }

.mp-controls { display: flex; align-items: center; gap: 6px; }
.mp-btn {
    width: 38px; height: 38px;
    border: none; border-radius: 50%;
    background: none;
    color: var(--text-secondary);
    font-size: 1.15rem;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.mp-btn:hover { background: var(--accent-bg); color: var(--accent-ink); }
.mp-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mp-btn-toggle { font-size: 1rem; color: var(--text-muted); position: relative; }
.mp-btn-toggle[aria-pressed="true"] { color: var(--accent-ink); }
.mp-btn-toggle[aria-pressed="true"]::after {
    content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
    width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}
.mp-btn-main {
    width: 46px; height: 46px;
    background: var(--accent-grad);
    color: white; font-size: 1.4rem;
    box-shadow: var(--shadow-accent);
}
.mp-btn-main:hover { background: linear-gradient(135deg, var(--accent-light), var(--accent)); color: white; transform: scale(1.05); }
.mini-player.is-loading .mp-btn-main i { animation: mp-pulse 1s ease-in-out infinite; }

.mp-side { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.mp-time { font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mp-volume { display: flex; align-items: center; gap: 4px; }
.mp-volume-range {
    -webkit-appearance: none; appearance: none;
    width: 90px; height: 4px; border-radius: 2px;
    background: linear-gradient(to right, var(--accent) var(--volume), var(--border) var(--volume));
    cursor: pointer;
}
.mp-volume-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--accent-dark); border: 2px solid white;
}
.mp-volume-range::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-dark); border: 2px solid white; }
.mp-btn-close { width: 32px; height: 32px; font-size: 0.9rem; color: var(--text-muted); }

/* تبلت */
@media (max-width: 991px) {
    .mp-volume { display: none; }
}
/* موبایل: کاور و اسم، قبلی/پخش/بعدی و بستن */
@media (max-width: 575px) {
    :root { --player-height: 64px; }
    .mp-inner { grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; padding: 0 10px; }
    .mp-cover-wrap, .mp-cover, .mp-cover-ph { width: 42px; height: 42px; }
    .mp-btn-toggle, .mp-time { display: none; }
    .mp-btn { width: 36px; height: 36px; }
    .mp-btn-main { width: 42px; height: 42px; }
    /* روی صفحه‌ی لمسی، دستگیره‌ی نوار پیشرفت همیشه پیداست */
    .mp-seek::-webkit-slider-thumb { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .mini-player.is-loading .mp-seek::-webkit-slider-runnable-track,
    .mini-player.is-loading .mp-btn-main i { animation: none; }
}

/* ---- پیام‌های کوتاه (Toast) ---- */
.toast-stack {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--player-height) + 24px);
    z-index: 4000;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    pointer-events: none;
}
.maniam-toast {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1.5px solid var(--green);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 10px 22px;
    font-size: 0.875rem;
    opacity: 0; transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.maniam-toast-error { border-color: var(--red); }
.maniam-toast.is-visible { opacity: 1; transform: none; }

/* ===================================================================
   فاز ۴ب: در حال پخش، تایمر خواب، اشتراک‌گذاری و کارت متن
   =================================================================== */
/* اطلاعات آهنگ در پلیر کوچک حالا دکمه است (صفحه‌ی «در حال پخش» را باز می‌کند) */
button.mp-info { background: none; border: none; padding: 0; text-align: right; font-family: var(--font); cursor: pointer; }
button.mp-info:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 10px; }
.mp-sleep-badge {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 0.7rem; font-weight: 700;
    color: var(--accent-ink); background: var(--accent-bg);
    border-radius: 20px; padding: 2px 8px; flex-shrink: 0;
}
.mp-sleep-badge[hidden] { display: none; }

.btn-icon { padding: 10px 14px; flex: 0 0 auto; }
.start-at-note {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    margin-top: 14px; padding: 10px 14px;
    background: var(--accent-bg); border: 1px solid var(--border-accent);
    border-radius: var(--radius-sm);
    font-size: 0.85rem; color: var(--text-secondary);
}
.start-at-note > i { color: var(--accent-ink); font-size: 1.1rem; }
.start-at-note .btn-soft { margin-right: auto; }

/* ---- صفحه‌ی «در حال پخش» ---- */
body.np-open, body.sheet-open { overflow: hidden; }
.now-playing { position: fixed; inset: 0; z-index: 2500; display: flex; align-items: flex-end; justify-content: center; }
.now-playing[hidden] { display: none; }
.np-backdrop { position: absolute; inset: 0; background: rgba(20, 12, 4, 0.55); opacity: 0; transition: opacity 0.25s ease; }
.np-panel {
    position: relative;
    width: 100%; max-width: 560px;
    height: min(100%, 860px);
    display: flex; flex-direction: column; align-items: center;
    gap: 14px;
    padding: 14px 24px 28px;
    color: white;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.35);
    transform: translateY(100%);
    transition: transform 0.25s ease, background 0.6s ease;
    overflow: hidden;
}
.now-playing .np-panel { background: linear-gradient(180deg, var(--np-color, #6b4a1e) 0%, #1e1409 100%); }
.now-playing.is-open .np-backdrop { opacity: 1; }
.now-playing.is-open .np-panel { transform: none; }
@media (min-width: 768px) {
    .now-playing { align-items: center; }
    .np-panel { border-radius: 24px; height: min(92%, 820px); }
}
@media (prefers-reduced-motion: reduce) {
    .np-panel, .np-backdrop { transition: none; }
}
.np-head { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.np-head-title { font-size: 0.85rem; font-weight: 700; opacity: 0.85; }
.np-icon-btn {
    width: 40px; height: 40px; border-radius: 50%;
    border: none; background: rgba(255,255,255,0.1); color: inherit;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.1rem; cursor: pointer; transition: var(--transition);
}
.np-icon-btn:hover { background: rgba(255,255,255,0.2); }
.np-icon-btn:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }

.np-stage { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.np-art { width: min(100%, 360px); aspect-ratio: 1; max-height: 100%; }
.np-art[hidden] { display: none; }
.np-art img, .np-cover-ph {
    width: 100%; height: 100%;
    object-fit: cover;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.45);
}
.np-art img[hidden], .np-cover-ph[hidden] { display: none; }
.np-cover-ph { display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.08); font-size: 5rem; color: rgba(255,255,255,0.5); }
.np-lyrics {
    width: 100%; height: 100%;
    overflow-y: auto;
    white-space: pre-line;
    text-align: center;
    font-size: 1.15rem; line-height: 2.2; font-weight: 600;
    color: rgba(255,255,255,0.92);
    padding: 8px 4px;
    mask-image: linear-gradient(to bottom, transparent, black 8%, black 92%, transparent);
}
.np-lyrics:focus-visible { outline: 2px solid var(--accent-light); border-radius: 12px; }

.np-meta { width: 100%; display: flex; flex-direction: column; gap: 2px; text-align: center; }
.np-title { color: white; font-size: 1.35rem; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-title:hover { color: var(--accent-light); }
.np-artist { color: rgba(255,255,255,0.7); font-size: 0.95rem; }

.np-seek { width: 100%; }
.np-seek-range {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 18px; margin: 0; background: transparent; cursor: pointer;
}
.np-seek-range::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(to right, white var(--progress, 0%), rgba(255,255,255,0.25) var(--progress, 0%)); }
.np-seek-range::-moz-range-track { height: 5px; border-radius: 3px; background: linear-gradient(to right, white var(--progress, 0%), rgba(255,255,255,0.25) var(--progress, 0%)); }
.np-seek-range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -4.5px; border-radius: 50%; background: white; border: none; }
.np-seek-range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: white; border: none; }
.np-seek-range:focus-visible { outline: 2px solid var(--accent-light); border-radius: 4px; }
.np-times { display: flex; justify-content: space-between; font-size: 0.75rem; color: rgba(255,255,255,0.7); font-variant-numeric: tabular-nums; }

.np-controls { display: flex; align-items: center; justify-content: center; gap: 14px; }
.np-btn {
    width: 48px; height: 48px; border-radius: 50%;
    border: none; background: none; color: white;
    font-size: 1.6rem;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: var(--transition); position: relative;
}
.np-btn:hover { background: rgba(255,255,255,0.12); }
.np-btn:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.np-btn-toggle { font-size: 1.15rem; color: rgba(255,255,255,0.55); }
.np-btn-toggle[aria-pressed="true"] { color: var(--accent-light); }
.np-btn-toggle[aria-pressed="true"]::after { content: ''; position: absolute; bottom: 6px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent-light); }
.np-btn-main { width: 68px; height: 68px; background: white; color: #1e1409; font-size: 2rem; }
.np-btn-main:hover { background: white; transform: scale(1.05); }

.np-extras { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.np-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.08);
    color: white; font-family: var(--font); font-size: 0.8rem; font-weight: 600;
    cursor: pointer; transition: var(--transition);
}
.np-chip:hover { background: rgba(255,255,255,0.18); }
.np-chip[aria-pressed="true"] { background: white; color: #1e1409; border-color: white; }
.np-chip:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
.np-chip[hidden] { display: none; }
.np-sleep { position: relative; }
.np-sleep-menu {
    position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    min-width: 170px;
    display: flex; flex-direction: column;
    background: #2a1d0f; border: 1px solid rgba(255,255,255,0.15);
    border-radius: 14px; padding: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    z-index: 2;
}
.np-sleep-menu[hidden] { display: none; }
.np-sleep-menu button {
    background: none; border: none; color: white; text-align: right;
    padding: 9px 12px; border-radius: 8px;
    font-family: var(--font); font-size: 0.85rem; cursor: pointer;
}
.np-sleep-menu button:hover, .np-sleep-menu button:focus-visible { background: rgba(255,255,255,0.12); outline: none; }

/* ---- برگه‌ها (اشتراک‌گذاری، کارت متن) ---- */
.sheet {
    position: fixed; inset: 0; z-index: 2600;
    background: rgba(20, 12, 4, 0.5);
    display: flex; align-items: flex-end; justify-content: center;
}
.sheet[hidden] { display: none; }
.sheet-panel {
    width: 100%; max-width: 520px;
    max-height: 92vh; overflow-y: auto;
    background: var(--bg-card);
    border-radius: 22px 22px 0 0;
    padding: 18px 20px 24px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.25);
    transform: translateY(30px); opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.sheet.is-open .sheet-panel { transform: none; opacity: 1; }
.sheet-wide .sheet-panel { max-width: 920px; }
@media (min-width: 768px) {
    .sheet { align-items: center; }
    .sheet-panel { border-radius: 22px; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-title { font-size: 1.05rem; font-weight: 900; margin: 0; color: var(--text-primary); }
.sheet .np-icon-btn { background: var(--bg-secondary); color: var(--text-secondary); }
.sheet .np-icon-btn:hover { background: var(--accent-bg); color: var(--accent-ink); }

.share-preview { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius-sm); background: var(--bg-primary); border: 1px solid var(--border); }
.share-preview-cover, .share-preview-ph { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.share-preview-cover[hidden], .share-preview-ph[hidden] { display: none; }
.share-preview-ph { display: flex; align-items: center; justify-content: center; background: var(--bg-secondary); color: var(--text-muted); }
.share-preview-text { display: flex; flex-direction: column; min-width: 0; }
.share-preview-text strong { color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-preview-text span { font-size: 0.8rem; color: var(--text-muted); }
.share-start { display: flex; align-items: center; gap: 8px; margin: 12px 2px 0; font-size: 0.875rem; color: var(--text-secondary); cursor: pointer; }
.share-start[hidden] { display: none; }
.share-start input { width: 18px; height: 18px; accent-color: var(--accent); }
.share-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; margin-top: 16px; }
.share-action {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 12px 6px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-primary);
    color: var(--text-secondary); font-family: var(--font); font-size: 0.78rem; font-weight: 600;
    cursor: pointer; transition: var(--transition); text-decoration: none;
}
.share-action[hidden] { display: none; }
.share-action i { font-size: 1.35rem; color: var(--accent-ink); }
.share-action:hover { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-ink); }
.share-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- کارت متن آهنگ ---- */
.lyric-builder { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
@media (max-width: 767px) { .lyric-builder { grid-template-columns: 1fr; } }
.lyric-lines { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; padding-left: 4px; }
.lyric-line {
    text-align: right; padding: 9px 12px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--bg-primary); color: var(--text-secondary);
    font-family: var(--font); font-size: 0.9rem; line-height: 1.8; cursor: pointer;
    transition: var(--transition);
}
.lyric-line:hover { border-color: var(--accent); }
.lyric-line[aria-pressed="true"] { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.lyric-preview { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.lyric-format { display: flex; gap: 6px; justify-content: center; }
.lyric-format .np-chip { color: var(--text-secondary); border-color: var(--border); background: var(--bg-primary); }
.lyric-format .np-chip[aria-pressed="true"] { background: var(--accent-fill); color: var(--on-accent); border-color: var(--accent-fill); }
.lyric-canvas { width: 100%; max-height: 52vh; object-fit: contain; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-secondary); }

/* ===================================================================
   بخش خوانندگان (فاز ۵)
   =================================================================== */
.list-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 1.5rem;
}
.list-toolbar-search { max-width: 420px; flex: 1 1 260px; }
.list-toolbar-sort { display: flex; align-items: center; gap: 8px; }
.list-toolbar-sort .form-select { width: auto; min-width: 150px; }

.artist-hero {
    display: flex; align-items: center; gap: 28px;
    padding: 24px;
    margin-bottom: 2.5rem;
    background: linear-gradient(135deg, var(--bg-card), var(--accent-bg));
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}
.artist-hero-photo {
    width: 180px; height: 180px; flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent);
    box-shadow: var(--shadow-accent);
}
.artist-hero-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-grad);
    color: white; font-size: 4rem; font-weight: 900;
}
.artist-hero-body { min-width: 0; }
.artist-hero-label { font-size: 0.8rem; font-weight: 700; color: var(--accent-ink); }
.artist-hero-name { font-size: 2.2rem; font-weight: 900; color: var(--text-primary); margin: 2px 0 10px; }
.artist-stats {
    display: flex; flex-wrap: wrap; gap: 6px 18px;
    list-style: none; padding: 0; margin: 0 0 18px;
    font-size: 0.875rem; color: var(--text-secondary);
}
.artist-stats i { color: var(--accent); margin-left: 6px; }
.artist-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.artist-top-songs { display: flex; flex-direction: column; gap: 6px; max-width: 760px; }
.artist-bio {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    color: var(--text-secondary);
    line-height: 2.1;
}
.artist-bio p:last-child { margin-bottom: 0; }

@media (max-width: 767px) {
    .artist-hero { flex-direction: column; text-align: center; padding: 22px 16px; gap: 14px; }
    .artist-hero-photo { width: 140px; height: 140px; }
    .artist-hero-name { font-size: 1.7rem; }
    .artist-stats, .artist-actions { justify-content: center; }
    .artist-actions { flex-wrap: nowrap; width: 100%; }
    .artist-actions .btn-play:not(.btn-icon), .artist-actions .btn-download {
        flex: 1; justify-content: center; padding-inline: 10px; gap: 6px;
        white-space: nowrap; font-size: 0.85rem;
    }
    .list-toolbar-search { max-width: none; }
}

/* ===================================================================
   دفترچه (فاز ۶) — هر برگه مثل برگی از دفترچه
   =================================================================== */
.page-header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 14px; border-radius: 20px;
    border: 1.5px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); font-size: 0.8rem; font-weight: 600;
    transition: var(--transition);
}
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.chip.active { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }

.notebook-container { max-width: 880px; }
.preview-banner {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    padding: 10px 16px; margin-bottom: 18px;
    border-radius: var(--radius-sm);
    background: var(--warn-bg); border: 1.5px dashed var(--accent);
    color: var(--accent-ink); font-size: 0.875rem; font-weight: 600;
}

/* نوار پیشرفت مطالعه زیر هدر */
.read-progress { position: sticky; top: 0; height: 3px; z-index: 1020; margin-bottom: -3px; }
.read-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-dark), var(--accent-light)); transition: width 0.1s linear; }

/* کاغذ دفترچه: خط‌های کم‌رنگ و خط حاشیه‌ی سمت راست */
.notebook-page {
    --line: 2.15rem;
    position: relative;
    background-color: var(--paper);
    background-image:
        linear-gradient(to left, transparent 56px, var(--paper-margin) 56px, var(--paper-margin) 58px, transparent 58px),
        repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--line) - 1px), var(--paper-line) calc(var(--line) - 1px), var(--paper-line) var(--line));
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card), 6px 6px 0 -2px var(--bg-secondary);
    padding: 32px 84px 40px 40px;
}
.notebook-page-head {
    display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px;
    border-bottom: 1.5px dashed var(--border-dark); padding-bottom: 12px; margin-bottom: 18px;
}
.notebook-page-stamp { display: flex; align-items: baseline; gap: 8px; color: var(--text-secondary); font-size: 0.9rem; }
.notebook-page-stamp .page-no { font-weight: 900; color: var(--accent-ink); font-size: 1.05rem; }
.notebook-page-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; padding: 0; margin: 0; font-size: 0.78rem; color: var(--text-muted); }
.notebook-page-meta i { margin-left: 4px; color: var(--accent); }
.notebook-page-title { font-weight: 900; font-size: clamp(1.6rem, 4vw, 2.1rem); color: var(--text-primary); line-height: 1.5; margin: 6px 0 12px; }
.notebook-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.font-size-tools { display: flex; gap: 6px; }
.notebook-page-cover { width: 100%; max-height: 440px; object-fit: cover; border-radius: var(--radius); border: 1.5px solid var(--border); margin-bottom: 24px; }
.notebook-page-excerpt {
    border-right: 4px solid var(--accent); background: var(--accent-bg);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 12px 18px; margin-bottom: 24px;
    color: var(--text-secondary); line-height: 1.9;
}

.series-box { background: var(--bg-card); border: 1.5px solid var(--border-accent); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 18px; font-size: 0.875rem; }
.series-box-title { font-weight: 800; color: var(--text-primary); margin-bottom: 6px; }
.series-box-title i { color: var(--accent); margin-left: 6px; }
.series-box-list { margin: 0; padding-right: 22px; color: var(--text-secondary); }
.series-box-list strong { color: var(--accent-ink); }

.toc-box { background: var(--bg-card); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 16px; margin-bottom: 24px; }
.toc-box summary { cursor: pointer; font-weight: 800; color: var(--text-primary); display: flex; align-items: center; gap: 6px; }
.toc-box summary i { color: var(--accent); }
.toc-box ol { margin: 10px 0 2px; padding-right: 22px; }
.toc-box li { margin-bottom: 4px; font-size: 0.9rem; }
.toc-box .toc-level-3 { margin-right: 16px; list-style-type: circle; }
.toc-box a { color: var(--text-secondary); }
.toc-box a:hover { color: var(--accent-ink); }

/* متن برگه (پیش‌تر داخل قالب بود) */
.article-content { --fs: 1.05rem; color: var(--text-primary); line-height: 2.05; font-size: var(--fs); overflow-wrap: anywhere; }
.article-content h2, .article-content h3 { scroll-margin-top: 90px; }
.article-content h2 { font-size: 1.45em; font-weight: 800; margin: 2rem 0 1rem; border-bottom: 2px solid var(--accent); padding-bottom: 0.4rem; }
.article-content h3 { font-size: 1.18em; font-weight: 700; margin: 1.5rem 0 0.8rem; }
.article-content p { margin-bottom: 1.1rem; }
.article-content img { max-width: 100%; height: auto; border-radius: var(--radius); margin: 1.2rem 0; border: 1.5px solid var(--border); }
.article-content blockquote { border-right: 4px solid var(--accent); padding: 10px 18px; margin: 1.5rem 0; background: var(--bg-card); border-radius: 0 var(--radius) var(--radius) 0; color: var(--text-secondary); }
.article-content ul, .article-content ol { padding-right: 1.5rem; margin-bottom: 1.1rem; }
.article-content li { margin-bottom: 0.4rem; }
.article-content a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.article-content code { background: var(--bg-secondary); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 0.9em; direction: ltr; unicode-bidi: isolate; }
.article-content pre { background: var(--bg-secondary); padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; margin: 1.5rem 0; direction: ltr; text-align: left; }
.article-content pre code { background: none; padding: 0; }
.article-content hr { border-color: var(--border); margin: 2rem 0; }
.article-content .ql-align-center { text-align: center; }
.article-content .ql-align-left { text-align: left; }
.article-content .ql-align-justify { text-align: justify; }
.quote-hint { margin: 18px 0 0; }
.quote-hint i { margin-left: 4px; }

/* دکمه‌ی شناور «اشتراک این جمله» */
.quote-share-btn {
    position: absolute; z-index: 1030;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 20px; border: none;
    background: var(--ink-bg); color: var(--ink-fg);
    font-family: var(--font); font-size: 0.8rem; font-weight: 700;
    box-shadow: var(--shadow); cursor: pointer;
    transform: translate(50%, -100%);
}
.quote-share-btn[hidden] { display: none; }

/* پیشنهاد «ادامه‌ی مطالعه» */
.resume-reading {
    position: fixed; right: 50%; transform: translateX(50%);
    bottom: calc(var(--player-height) + 24px);
    z-index: 1035;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
    background: var(--bg-card); border: 1.5px solid var(--border-accent);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 10px 16px; font-size: 0.85rem; color: var(--text-secondary);
    max-width: calc(100% - 24px);
}
body:not(.has-player) .resume-reading { bottom: 24px; }

.page-turn { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; }
.page-turn-link {
    display: flex; flex-direction: column; gap: 4px;
    padding: 14px 18px; border-radius: var(--radius-sm);
    border: 1.5px solid var(--border); background: var(--bg-card);
    transition: var(--transition); min-width: 0;
}
.page-turn-link:hover { border-color: var(--accent); background: var(--accent-bg); }
.page-turn-link.next { text-align: left; grid-column: 2; }
.page-turn-label { font-size: 0.75rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.page-turn-link.next .page-turn-label { justify-content: flex-end; }
.page-turn-title { font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 767px) {
    .notebook-page { padding: 22px 38px 28px 16px; background-image:
        linear-gradient(to left, transparent 24px, var(--paper-margin) 24px, var(--paper-margin) 26px, transparent 26px),
        repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--line) - 1px), var(--paper-line) calc(var(--line) - 1px), var(--paper-line) var(--line)); }
    .page-turn { grid-template-columns: 1fr; }
    .page-turn-link.next { grid-column: 1; }
}

/* کارت جمله: فهرست خط‌ها لازم نیست */
.sheet.is-quote .lyric-pick { display: none; }
.sheet.is-quote .lyric-builder { grid-template-columns: minmax(0, 360px); justify-content: center; }

/* ===================================================================
   بخش نوشته‌ها (فاز ۷)
   =================================================================== */
/* چیدمان آبشاری (static/js/masonry.js): بدون JS یک شبکه‌ی معمولی است؛ با JS ارتفاع هر فرزند
   به ردیف‌های ۴ پیکسلی تبدیل می‌شود تا جای خالی نماند و ترتیب «جدیدترین اول» حفظ شود.
   تعداد ستون‌ها با --masonry-cols تعیین می‌شود. */
.masonry { --masonry-cols: 3; --masonry-gap: 20px; display: grid; grid-template-columns: repeat(var(--masonry-cols), minmax(0, 1fr)); column-gap: var(--masonry-gap); row-gap: var(--masonry-gap); align-items: start; }
.masonry.is-masonry { grid-auto-rows: 4px; row-gap: 0; }
.masonry.is-masonry > * { padding-bottom: var(--masonry-gap); }
.masonry-notes { --masonry-cols: 3; }
@media (max-width: 991px) { .masonry-notes { --masonry-cols: 2; --masonry-gap: 16px; } }
@media (max-width: 575px) { .masonry-notes { --masonry-cols: 1; } }

.note-card { padding: 24px 26px 18px; transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease; }
.note-card:hover { border-color: var(--border-accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.note-card-text { display: block; text-decoration: none; font-size: 1rem; line-height: 2; }
.note-card-text:hover { color: var(--accent-ink); }
.note-card-more { display: inline-flex; align-items: center; margin-top: 4px; font-size: 0.8rem; font-weight: 700; color: var(--accent-ink); text-decoration: none; }
.note-card-meta { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.note-card .random-note-footer { margin-top: 12px; }

/* قلب */
.heart-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 12px; border-radius: 20px;
    border: 1.5px solid var(--border); background: var(--bg-primary);
    color: var(--text-secondary); font-family: var(--font); font-size: 0.8rem; font-weight: 700;
    cursor: pointer; transition: var(--transition); line-height: 1.6;
}
.heart-btn:hover { border-color: var(--danger-line); color: var(--danger-ink); }
.heart-btn.is-liked { border-color: rgba(217, 83, 79, 0.45); background: rgba(217, 83, 79, 0.08); color: var(--danger-ink); }
.heart-btn i { font-size: 0.95rem; }
.heart-btn.pop i { animation: heart-pop 0.45s ease; }
@keyframes heart-pop { 0% { transform: scale(1); } 35% { transform: scale(1.45); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .heart-btn.pop i { animation: none; } }

/* صفحه‌ی نوشته */
.note-container { max-width: 800px; }
.note-full { padding: 36px 40px 22px; }
.note-full-text { font-size: 1.2rem; line-height: 2.2; }
.note-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 0; }
.note-actions .heart-btn, .note-actions .btn-soft { padding: 7px 16px; font-size: 0.85rem; }
.btn-telegram { margin-inline-start: auto; }
.btn-telegram i { color: #229ed9; }
@media (max-width: 575px) {
    .note-full { padding: 26px 20px 18px; }
    .note-full-text { font-size: 1.1rem; }
    .btn-telegram { margin-inline-start: 0; }
}

/* ===================================================================
   نگارخانه (فاز ۸)
   =================================================================== */
.masonry-photos { --masonry-cols: 4; --masonry-gap: 18px; }
@media (max-width: 991px) { .masonry-photos { --masonry-cols: 3; --masonry-gap: 14px; } }
@media (max-width: 575px) { .masonry-photos { --masonry-cols: 2; --masonry-gap: 10px; } }

.photo-card {
    margin: 0; background: var(--bg-card); border: 1.5px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.photo-card:hover { border-color: var(--border-accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.photo-card-media { position: relative; display: block; background: var(--bg-secondary); }
.photo-card-media img { display: block; width: 100%; height: auto; }
.photo-card-media:hover .photo-slide-zoom, .photo-card-media:focus-visible .photo-slide-zoom { opacity: 1; }
.photo-card-body { padding: 10px 12px 12px; }
.photo-card-title { display: block; font-weight: 700; font-size: 0.92rem; color: var(--text-primary); text-decoration: none; line-height: 1.6; }
.photo-card-title:hover { color: var(--accent-ink); }
.photo-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.photo-card-location { display: inline-flex; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--text-muted); margin: 0; min-width: 0; }
.photo-card-location i { color: var(--accent); flex-shrink: 0; }
@media (max-width: 575px) {
    .photo-card-body { padding: 8px 9px 10px; }
    .photo-card-title { font-size: 0.82rem; }
    .photo-card-meta { flex-wrap: wrap; }
    .photo-card .heart-btn { padding: 2px 9px; font-size: 0.74rem; }
}

/* نمایشگر: دکمه‌های صفحه‌ی عکس و اشتراک */
.lightbox-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.lightbox-actions[hidden] { display: none; }
.lightbox-action {
    display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.35); background: rgba(255,255,255,0.1);
    color: white; font-family: var(--font); font-size: 0.78rem; text-decoration: none; cursor: pointer;
}
.lightbox-action:hover { background: rgba(255,255,255,0.22); color: white; }

/* صفحه‌ی عکس */
.photo-page { max-width: 1100px; }
.photo-page-figure { margin: 0; border-radius: var(--radius); overflow: hidden; background: var(--bg-secondary); border: 1.5px solid var(--border); }
.photo-page-figure a { display: block; }
.photo-page-img { display: block; width: 100%; height: auto; max-height: 78vh; object-fit: contain; background: #1c140c; }
.photo-page-info { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-top: 18px; }
.photo-page-text { flex: 1 1 380px; min-width: 0; }
.photo-page-title { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); margin: 0 0 8px; }
.photo-page-meta { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 0.85rem; color: var(--text-secondary); }
.photo-page-meta li { display: inline-flex; align-items: center; gap: 5px; }
.photo-page-meta i { color: var(--accent); }
.photo-page-desc { margin: 14px 0 0; line-height: 2; color: var(--text-secondary); }
.photo-page-actions { margin-top: 0; }
.photo-turn { display: flex; align-items: center; gap: 12px; }
.photo-turn img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.photo-turn > span { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 575px) {
    .photo-page-title { font-size: 1.25rem; }
    .photo-page-img { max-height: 70vh; }
}

/* تصویر روز (صفحه‌ی اصلی) */
.photo-of-day {
    display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    background: var(--bg-card); border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.photo-of-day-media { display: block; min-height: 260px; background: var(--bg-secondary); }
.photo-of-day-media img { display: block; width: 100%; height: 100%; max-height: 420px; object-fit: cover; }
.photo-of-day-body { padding: 26px 28px; display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.photo-of-day-date { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--accent-ink); font-weight: 700; }
.photo-of-day-title { font-size: 1.35rem; font-weight: 800; margin: 0; }
.photo-of-day-title a { color: var(--text-primary); text-decoration: none; }
.photo-of-day-title a:hover { color: var(--accent-ink); }
.photo-of-day-desc { color: var(--text-secondary); line-height: 1.9; margin: 0; font-size: 0.92rem; }
@media (max-width: 767px) {
    .photo-of-day { grid-template-columns: minmax(0, 1fr); }
    .photo-of-day-media { min-height: 0; }
    .photo-of-day-media img { height: auto; aspect-ratio: 4 / 3; max-height: none; }
    .photo-of-day-body { padding: 18px 18px 20px; }
}

/* ===================================================================
   حساب‌های کاربری، پروفایل و جست‌وجو (فاز ۹)
   =================================================================== */
.auth-logo { width: 64px; height: 64px; border-radius: 16px; object-fit: cover; margin-bottom: 14px; box-shadow: var(--shadow-accent); }
.auth-card .form-field { margin-bottom: 16px; }
.field-error { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; font-size: 0.8rem; color: var(--danger-ink); line-height: 1.7; }
.field-help { margin-top: 5px; font-size: 0.75rem; color: var(--text-muted); line-height: 1.7; }
.form-field.has-error .form-control { border-color: var(--danger-line); box-shadow: 0 0 0 3px rgba(217, 83, 79, 0.12); }
.form-alert {
    background: rgba(217, 83, 79, 0.08); border: 1px solid rgba(217, 83, 79, 0.45); border-radius: 10px;
    padding: 12px 14px; margin-bottom: 16px; color: var(--danger-ink); font-size: 0.85rem; line-height: 1.8;
}
.form-alert i, .field-error i { flex-shrink: 0; margin-inline-end: 6px; }
.password-field { position: relative; }
.password-field .form-control { padding-inline-start: 46px; }
.password-toggle {
    position: absolute; inset-inline-start: 6px; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent;
    color: var(--text-muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.password-toggle:hover, .password-toggle:focus-visible { color: var(--accent-ink); background: var(--bg-secondary); }
.password-rules { margin: -4px 0 18px; padding-inline-start: 18px; font-size: 0.75rem; color: var(--text-muted); line-height: 1.9; }
.hp-field { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none; }
.auth-forgot { text-align: end; margin: -6px 0 16px; font-size: 0.82rem; }
.auth-switch { text-align: center; margin-top: 22px; font-size: 0.875rem; color: var(--text-muted); }
.btn-link-plain { background: none; border: 0; color: var(--accent-ink); font-family: var(--font); cursor: pointer; padding: 0; }
.btn-link-plain:hover { text-decoration: underline; }
.recovery-steps { padding-inline-start: 20px; margin: 0 0 20px; line-height: 2.1; color: var(--text-secondary); font-size: 0.92rem; }
.recovery-note { display: flex; align-items: center; gap: 6px; justify-content: center; margin: 14px 0 0; font-size: 0.78rem; color: var(--text-muted); }
@media (max-width: 575px) { .auth-card { padding: 28px 20px; } }

/* پروفایل */
.profile-head { display: flex; align-items: center; gap: 16px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1.5px solid var(--border); }
.profile-head .page-title { margin: 0; }
.profile-avatar {
    width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
    background: var(--accent-grad);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; font-weight: 900; color: var(--bg-primary);
}
.profile-tabs { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; }
.profile-tab {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 20px; white-space: nowrap;
    border: 1.5px solid var(--border); background: var(--bg-card); color: var(--text-secondary);
    font-size: 0.85rem; font-weight: 700; text-decoration: none; transition: var(--transition);
}
.profile-tab:hover { border-color: var(--border-accent); color: var(--accent-ink); }
.profile-tab.active { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.profile-tab-count { font-size: 0.75rem; opacity: 0.85; }
.activity-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.activity-item { background: var(--bg-card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.activity-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.activity-section { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 700; color: var(--accent-ink); background: var(--bg-secondary); padding: 2px 10px; border-radius: 12px; }
.activity-title { font-weight: 700; color: var(--text-primary); text-decoration: none; flex: 1 1 auto; min-width: 0; }
.activity-title:hover { color: var(--accent-ink); }
.activity-text { margin: 8px 0 6px; color: var(--text-secondary); font-size: 0.9rem; line-height: 1.9; white-space: pre-line; }
.activity-stars { display: inline-flex; gap: 2px; margin-top: 6px; color: var(--accent); font-size: 0.85rem; }
.activity-stars .bi-star { color: var(--text-muted); }
.status-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 700; padding: 2px 10px; border-radius: 12px; }
.status-pill.is-ok { color: var(--success-ink); background: rgba(46, 125, 50, 0.1); }
.status-pill.is-wait { color: var(--accent-ink); background: rgba(201, 136, 44, 0.12); }

/* جست‌وجو */
.search-page-form { max-width: 640px; margin-bottom: 2rem; }
.search-summary { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }
.search-summary strong { color: var(--accent-ink); }
.search-form { position: relative; }
.search-suggest {
    position: absolute; top: calc(100% + 6px); inset-inline: 0; z-index: 1050;
    background: var(--bg-card); border: 1.5px solid var(--border); border-radius: 14px;
    box-shadow: var(--shadow-pop); overflow: hidden; display: none;
    max-height: min(70vh, 520px); overflow-y: auto;
}
.search-suggest.is-open { display: block; }
.suggest-group { padding: 6px 0; border-bottom: 1px solid var(--border); }
.suggest-group-title { padding: 4px 14px; font-size: 0.7rem; font-weight: 800; color: var(--text-muted); }
.suggest-item, .suggest-all {
    display: flex; align-items: center; gap: 10px; padding: 7px 14px;
    color: var(--text-primary); text-decoration: none; font-size: 0.86rem; outline: none;
}
.suggest-item:hover, .suggest-item:focus, .suggest-all:hover, .suggest-all:focus { background: var(--bg-secondary); color: var(--accent-ink); }
.suggest-thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.suggest-thumb.is-round { border-radius: 50%; }
.suggest-icon { width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--bg-secondary); color: var(--accent); }
.suggest-text { display: flex; flex-direction: column; min-width: 0; }
.suggest-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-sub { font-size: 0.74rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-all { justify-content: center; font-weight: 700; color: var(--accent-ink); padding: 10px 14px; }
.suggest-empty { padding: 14px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }
/* دکمه‌ی پاک کردن کادرهای جست‌وجو (×) هم‌رنگ سایت، به‌جای آبی پیش‌فرض مرورگر */
input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none; appearance: none; width: 14px; height: 14px; cursor: pointer;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 3l10 10M13 3L3 13' stroke='%23A07850' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ===================================================================
   اپ نصب‌شدنی و آفلاین (فاز ۱۰)
   =================================================================== */
/* دکمه‌ی «ذخیره برای آفلاین» */
.btn-offline {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
    padding: 10px 16px; border-radius: 12px; border: 1.5px dashed var(--border-accent);
    background: transparent; color: var(--accent-ink); font-family: var(--font); font-weight: 700; font-size: 0.88rem;
    cursor: pointer; transition: var(--transition);
}
.btn-offline:hover { background: var(--bg-secondary); }
.btn-offline.is-saved, .btn-offline-soft.is-saved { border-style: solid; background: rgba(46, 125, 50, 0.08); border-color: rgba(46, 125, 50, 0.45); color: var(--success-ink); }
.btn-offline.is-busy, .btn-offline-soft.is-busy, [data-offline-save].is-busy { opacity: 0.65; cursor: progress; }
[data-offline-save].is-busy i { animation: offline-pulse 1s ease-in-out infinite; }
@keyframes offline-pulse { 50% { opacity: 0.3; } }
.np-head-actions { display: inline-flex; gap: 6px; }
.np-icon-btn.is-saved { color: #7fd18a; }
.footer-link-btn { background: none; border: 0; padding: 0; font-family: var(--font); color: var(--text-muted); font-size: 0.875rem; cursor: pointer; transition: var(--transition); }
.footer-link-btn:hover { color: var(--accent-ink); }

/* دعوت به نصب و نوار نسخه‌ی تازه: پایین صفحه، بالای پخش‌کننده‌ی کوچک */
.pwa-banner, .pwa-bar {
    position: fixed; z-index: 1045; inset-inline: 12px; bottom: 12px; margin-inline: auto; max-width: 440px;
    background: var(--bg-card); border: 1.5px solid var(--border-accent); border-radius: 16px;
    box-shadow: var(--shadow-float);
}
body.has-player .pwa-banner, body.has-player .pwa-bar { bottom: calc(var(--player-height) + 12px); }
.pwa-banner { padding: 16px 16px 14px; }
.pwa-banner-main { display: flex; gap: 12px; align-items: center; padding-inline-end: 24px; }
.pwa-banner-icon { width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0; box-shadow: var(--shadow); }
.pwa-banner-main strong { display: block; font-size: 0.95rem; color: var(--text-primary); }
.pwa-banner p { margin: 2px 0 0; font-size: 0.8rem; color: var(--text-secondary); line-height: 1.8; }
.pwa-banner-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.pwa-close { position: absolute; top: 8px; inset-inline-end: 8px; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); cursor: pointer; }
.pwa-close:hover { background: var(--bg-secondary); }
.pwa-ios-steps { list-style-type: persian; margin: 12px 0 0; padding: 10px 28px 10px 12px; background: var(--bg-secondary); border-radius: 12px; font-size: 0.82rem; line-height: 2; color: var(--text-secondary); }
.pwa-ios-steps i { color: #1a73e8; font-size: 1rem; }
.pwa-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; font-size: 0.86rem; font-weight: 700; color: var(--text-primary); }
.pwa-bar i { color: var(--accent); font-size: 1.1rem; }
.pwa-bar span { flex: 1; }

/* نشانگر آفلاین */
.offline-pill {
    position: fixed; z-index: 1035; top: 80px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 20px; white-space: nowrap;
    background: #3a2a18; color: #f7e9c6; font-size: 0.8rem; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.offline-pill a { color: #f3d58a; font-weight: 700; }
@media (max-width: 400px) { .offline-pill { font-size: 0.72rem; padding: 6px 12px; } }

/* صفحه‌ی آفلاین و «آفلاین من» */
.offline-hero { max-width: 560px; margin: 0 auto; text-align: center; }
.offline-hero-icon {
    width: 88px; height: 88px; margin: 0 auto 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--bg-secondary); color: var(--accent); font-size: 2.4rem;
}
.offline-meter { height: 6px; border-radius: 6px; background: var(--bg-secondary); overflow: hidden; margin: -8px 0 28px; }
.offline-meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-dark)); border-radius: 6px; transition: width 0.4s ease; }
.offline-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.offline-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px;
    background: var(--bg-card); border: 1.5px solid var(--border);
}
.offline-item.is-current { border-color: var(--accent); }
.offline-play {
    width: 40px; height: 40px; border-radius: 50%; border: 0; flex-shrink: 0; cursor: pointer;
    background: var(--accent); color: white; display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.offline-thumb { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.offline-thumb-ph { display: flex; align-items: center; justify-content: center; background: var(--bg-secondary); color: var(--accent); }
.offline-text { display: flex; flex-direction: column; min-width: 0; flex: 1; text-decoration: none; }
.offline-title { font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.offline-sub { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.offline-size { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.offline-remove { width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; flex-shrink: 0; }
.offline-remove:hover { background: rgba(217, 83, 79, 0.1); color: var(--danger-ink); }
.offline-note { display: flex; gap: 6px; align-items: flex-start; line-height: 1.9; margin-top: 8px; }
@media (max-width: 575px) {
    .offline-size { display: none; }
    .offline-item { gap: 10px; padding: 8px 10px; }
}

/* ========================================
   فاز ۱۱: صفحه‌های خطا، پرش به محتوا، تم، برگشت به بالا، میان‌بر جست‌وجو، چاپ
   ======================================== */

/* جابه‌جایی تم یک‌باره و بدون انیمیشن (static/js/ui.js) */
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after { transition: none !important; }

/* ---- صفحه‌های خطا (core/errors.py) ---- */
.error-code {
    margin: -6px 0 4px; font-size: clamp(2.6rem, 9vw, 3.6rem); font-weight: 900; line-height: 1.1;
    color: var(--accent); letter-spacing: 2px; opacity: 0.85;
}
.error-search { display: flex; gap: 8px; max-width: 420px; margin: 18px auto 4px; }
.error-search .form-control { flex: 1; min-width: 0; }
.error-search .btn { padding-inline: 16px; }

/* ---- پرش به محتوا: فقط با کیبورد دیده می‌شود ---- */
.skip-link {
    position: fixed; z-index: 3000; top: 10px; inset-inline-start: 10px;
    padding: 10px 18px; border-radius: 10px; font-weight: 700; font-size: 0.9rem;
    background: var(--ink-bg); color: var(--ink-fg); box-shadow: var(--shadow-float);
    transform: translateY(-160%); transition: transform 0.15s ease;
}
.skip-link:focus { transform: none; color: var(--ink-fg); outline: 3px solid var(--accent); outline-offset: 2px; }
#main-content:focus { outline: none; }

/* لینک‌های وسط متن فقط با رنگ از متن جدا نشوند (دسترس‌پذیری) */
p a:not([class]), .auth-switch a, .rating-hint a, .field-help a, .comment-login a {
    text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
}

/* ---- دکمه‌ی تم و منوی گوشی کنار هم ---- */
.nav-end { display: flex; align-items: center; gap: 6px; }
.theme-toggle {
    width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--border); background: var(--bg-secondary); color: var(--accent-ink);
    font-size: 1.05rem; cursor: pointer; transition: var(--transition);
}
.theme-toggle:hover { border-color: var(--accent); background: var(--accent-bg); }
.theme-toggle:focus-visible { outline: 3px solid var(--accent-glow); outline-offset: 1px; border-color: var(--accent); }
@media (min-width: 992px) { .nav-end { margin-inline-start: 10px; } }

/* ---- راهنمای میان‌بر «/» کنار جعبه‌ی جست‌وجو (فقط دسکتاپ) ---- */
.search-form .input-group { position: relative; }
.search-kbd {
    position: absolute; z-index: 5; top: 50%; transform: translateY(-50%); inset-inline-end: 52px;
    min-width: 22px; padding: 1px 6px; border-radius: 6px; text-align: center;
    font-family: var(--font); font-size: 0.75rem; line-height: 1.5; font-weight: 700;
    background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border-dark);
    box-shadow: 0 1px 0 var(--border-dark); pointer-events: none;
}
.search-input:focus ~ .search-kbd, .search-input:not(:placeholder-shown) ~ .search-kbd { display: none; }
@media (min-width: 992px) and (hover: hover) { .search-input { padding-inline-end: 40px; } }
@media (max-width: 991px), (hover: none) { .search-kbd { display: none; } }

/* ---- برگشت به بالا: گوشه‌ی پایین چپ، بالای پخش‌کننده و دعوت به نصب ---- */
.back-to-top {
    position: fixed; z-index: 1030; left: 16px; bottom: 18px;
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--border-accent); background: var(--bg-card); color: var(--accent-ink);
    font-size: 1.15rem; box-shadow: var(--shadow); cursor: pointer;
    animation: fadeInUp 0.25s ease;
}
.back-to-top[hidden] { display: none; }
.back-to-top:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.back-to-top:focus-visible { outline: 3px solid var(--accent-glow); outline-offset: 2px; }
body.has-player .back-to-top { bottom: calc(var(--player-height) + 24px); }
/* پیام‌های کوتاه بالای نوار «نسخه‌ی تازه» بیایند، نه رویش */
body.has-player:has(.pwa-bar:not([hidden])) .toast-stack { bottom: calc(var(--player-height) + 84px); }
body:has(.pwa-banner:not([hidden])) .back-to-top,
body:has(.pwa-bar:not([hidden])) .back-to-top { display: none; }

/* ---- حالت تاریک: چند جزء که رنگ ثابت دارند ---- */
/* دکمه‌ها و برچسب‌های کهربایی: متن تیره به‌جای سفید (سفید روی کهربایی روشنِ تم تاریک خوانا نیست) */
html[data-theme="dark"] { --on-accent: #1A120A; }
html[data-theme="dark"] :is(.btn-primary, .btn-primary:hover, .btn-download, .btn-download:hover, .search-btn, .search-btn:hover,
    .chip.active, .profile-tab.active, .pagination .page-item.active .page-link, .btn-outline-primary:hover,
    a.note-tag-label:hover, .footer-btn-primary, .footer-btn-primary:hover, .user-avatar-sm, .card-play-btn,
    .mp-btn-main, .mp-btn-main:hover, .lyric-format .np-chip[aria-pressed="true"], .song-featured-badge,
    .back-to-top:hover, .comment-avatar, .artist-avatar-placeholder, .artist-hero-placeholder, .profile-avatar, .offline-play) { color: var(--on-accent); }
html[data-theme="dark"] ::selection { color: var(--on-accent); }
html[data-theme="dark"] .note-tag-self   { background: rgba(255, 152, 0, 0.12);  color: #FFB866; border-color: rgba(255, 152, 0, 0.3); }
html[data-theme="dark"] .note-tag-social { background: rgba(66, 165, 245, 0.12); color: #8CC4F5; border-color: rgba(66, 165, 245, 0.3); }
html[data-theme="dark"] .note-tag-poem   { background: rgba(186, 104, 200, 0.14); color: #D6A6E0; border-color: rgba(186, 104, 200, 0.32); }
html[data-theme="dark"] .note-tag-life   { background: rgba(102, 187, 106, 0.12); color: #9ED6A1; border-color: rgba(102, 187, 106, 0.3); }
html[data-theme="dark"] .note-tag-game   { background: rgba(121, 134, 203, 0.14); color: #AEB8EC; border-color: rgba(121, 134, 203, 0.32); }
html[data-theme="dark"] .offline-pill { background: #2E2216; border: 1px solid var(--border-dark); }
html[data-theme="dark"] .pwa-ios-steps i { color: #6FA8F5; }
html[data-theme="dark"] .navbar-toggler-icon { filter: brightness(1.2); }
html[data-theme="dark"] img.brand-logo, html[data-theme="dark"] img.footer-logo { filter: drop-shadow(0 0 1px rgba(243, 233, 210, 0.35)); }

/* ---- چاپ: برگه‌ی دفترچه (و هر صفحه‌ی دیگر) تمیز روی کاغذ سفید ---- */
@media print {
    @page { margin: 16mm 14mm; }
    html, html[data-theme="dark"] {
        --bg-primary: #fff; --bg-card: #fff; --bg-secondary: #f4f4f4; --paper: #fff; --paper-alt: #fff;
        --text-primary: #111; --text-secondary: #333; --text-muted: #555; --border: #ccc; --accent: #8a5a16; --accent-ink: #8a5a16;
    }
    html { background: #fff !important; color-scheme: light !important; }
    body { background: #fff !important; color: #111 !important; padding: 0 !important; }
    .maniam-navbar, .maniam-footer, .mini-player, .now-playing, .sheet, .pwa-banner, .pwa-bar, .offline-pill,
    .back-to-top, .skip-link, .page-progress, .read-progress, .toast-stack, .quote-share-btn,
    .page-breadcrumb, .preview-banner, .notebook-tools, .quote-hint, .page-turn, .rating-box,
    .notebook-container > section, .comment-form-box, .btn, .btn-soft, .heart-btn, .lightbox { display: none !important; }
    .container { max-width: none !important; padding: 0 !important; }
    .notebook-page {
        background: #fff !important; border: 0 !important; box-shadow: none !important; padding: 0 !important;
        font-size: 12pt; line-height: 2;
    }
    .notebook-page-title { font-size: 20pt; }
    .article-content a { color: inherit; text-decoration: underline; }
    .article-content img, .notebook-page-cover { max-width: 100%; break-inside: avoid; }
    .article-content h2, .article-content h3 { break-after: avoid; }
    .toc-box { border: 1px solid #ccc !important; background: #fff !important; }
    .notebook-page[data-print-url]::after {
        content: "مانیَم · " attr(data-print-url);
        display: block; margin-top: 18pt; padding-top: 8pt; border-top: 1px solid #ccc;
        font-size: 9pt; color: #555; direction: ltr; text-align: left;
    }
}
