/* ==========================================================================
   صوت الجمهور — واجهة أسئلة المشاهدين والتصويت
   تصميم RTL أنيق واحترافي، Mobile-first مع نظام ألوان راقٍ.
   ========================================================================== */

:root {
    color-scheme: light;

    /* الأسطح والخلفيات */
    --page: #eef2f9;
    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --surface-sunken: #f1f4f9;

    /* الحدود */
    --line: #e6ebf3;
    --line-strong: #d5dfec;

    /* النصوص */
    --ink: #0f1b2d;
    --ink-soft: #33415c;
    --muted: #64748b;
    --faint: #94a3b8;

    /* الهوية: أزرق ملكي + لمسة ذهبية */
    --brand: #2b59e0;
    --brand-600: #2348bd;
    --brand-700: #1a357f;
    --brand-900: #152565;
    --brand-soft: #eef3ff;
    --brand-line: #d5e2ff;

    --gold: #c99a3f;
    --gold-soft: #fbf3e2;

    --green: #0f9d67;
    --green-soft: #e7f7ef;

    --danger: #d64550;
    --danger-soft: #fdf0f1;

    /* الظلال */
    --shadow-sm: 0 1px 3px rgba(15, 27, 45, 0.05);
    --shadow-md: 0 6px 18px -8px rgba(15, 27, 45, 0.16), 0 2px 6px rgba(15, 27, 45, 0.04);
    --shadow-lg: 0 24px 50px -26px rgba(15, 27, 45, 0.35);
    --shadow-brand: 0 16px 32px -16px rgba(43, 89, 224, 0.55);

    /* الأشكال */
    --radius-xl: 24px;
    --radius-lg: 20px;
    --radius: 14px;
    --radius-sm: 11px;
    --radius-pill: 999px;

    /* إيقاع المسافات الرأسية بين الأقسام */
    --space-section: 22px;
    --space-panel: 24px;

    --font: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Tahoma', sans-serif;

    --ring: 0 0 0 4px rgba(43, 89, 224, 0.16);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 90px;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    background:
        radial-gradient(900px 520px at 90% -10%, rgba(43, 89, 224, 0.14), transparent 62%),
        radial-gradient(760px 460px at -8% 4%, rgba(201, 154, 63, 0.10), transparent 58%),
        var(--page);
    background-attachment: fixed;
}

button,
input,
textarea {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: none;
    box-shadow: var(--ring);
    border-radius: 10px;
}

[hidden] {
    display: none !important;
}

/* ── الروابط المساعدة ───────────────────────────────────────────── */
.skip-link {
    position: absolute;
    inset-inline-start: 50%;
    top: -60px;
    z-index: 80;
    padding: 10px 18px;
    color: #fff;
    background: var(--brand-700);
    border-radius: 0 0 14px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transform: translateX(50%);
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* ── الهيكل العام ───────────────────────────────────────────────── */
.page-shell {
    width: min(100% - 32px, 820px);
    margin: 0 auto;
    padding: 0 0 64px;
}

.main-feed {
    display: flex;
    flex-direction: column;
    gap: var(--space-section);
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* ── الشريط العلوي ─────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 12px;
    z-index: 40;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 14px 0 22px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px -18px rgba(15, 27, 45, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.brand-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(150deg, #3f7bf0, var(--brand-700));
    border-radius: 12px;
    box-shadow: var(--shadow-brand);
    font-size: 1.05rem;
    line-height: 1;
}

.account-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    color: var(--ink-soft);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

.account-dot {
    width: 7px;
    height: 7px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--green-soft);
}

/* ── الواجهة الترحيبية ─────────────────────────────────────────── */
.hero {
    position: relative;
    overflow: hidden;
    margin: 0 0 22px;
    padding: 34px 32px 30px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-900) 0%, #2648b8 46%, #3070f2 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    box-shadow: 0 30px 60px -30px rgba(21, 37, 101, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.hero-copy {
    position: relative;
    z-index: 2;
    max-width: 560px;
}

.hero .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 12px;
    padding: 5px 12px;
    color: #ffe6bb;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-pill);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.hero .eyebrow::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--gold);
    border-radius: 50%;
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.6rem, 4.4vw, 2.15rem);
    font-weight: 700;
    line-height: 1.28;
    letter-spacing: -0.03em;
}

.hero-intro {
    max-width: 520px;
    margin: 10px 0 0;
    color: rgba(255, 255, 255, 0.84);
    font-size: 1rem;
    line-height: 1.65;
}

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
}

.hero-stats li {
    min-width: 132px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius);
    backdrop-filter: blur(6px);
}

.hero-stats strong {
    display: block;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.hero-stats span {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78rem;
}

.hero-art {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(6px);
}

.hero-orb--a {
    width: 260px;
    height: 260px;
    top: -110px;
    inset-inline-start: -70px;
    background: radial-gradient(circle at 30% 30%, rgba(255, 214, 140, 0.5), transparent 70%);
}

.hero-orb--b {
    width: 320px;
    height: 320px;
    bottom: -180px;
    inset-inline-end: -90px;
    background: radial-gradient(circle at 50% 50%, rgba(120, 170, 255, 0.45), transparent 70%);
}

/* ── بطاقة الحلقة القادمة ──────────────────────────────────────── */
.current-card {
    padding: 24px var(--space-panel) 26px;
    border-top: 3px solid var(--brand);
}

.episode-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.episode-tag {
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 700;
}

.episode-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
}

.episode-status-badge.is-open {
    color: #0b7a51;
    background: var(--green-soft);
}

.episode-status-badge.is-open::before {
    content: '';
    width: 7px;
    height: 7px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(15, 157, 103, 0.18);
    animation: pulse 1.8s ease-in-out infinite;
}

.episode-status-badge.is-closed {
    color: #6a7482;
    background: var(--surface-sunken);
}

.episode-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.episode-cover {
    margin: 0;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface-sunken);
    aspect-ratio: 16 / 8;
}

.episode-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.episode-copy {
    min-width: 0;
}

.episode-title {
    margin: 0;
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.02em;
}

.episode-date {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 0.84rem;
}

.episode-date::before {
    content: '🗓';
    font-size: 0.85rem;
}

.episode-description {
    margin: 10px 0 0;
    color: var(--ink-soft);
    font-size: 0.92rem;
    line-height: 1.7;
    white-space: pre-wrap;
}

.episode-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 14px;
    padding: 9px 15px;
    color: var(--brand-700);
    background: var(--brand-soft);
    border: 1px solid var(--brand-line);
    border-radius: var(--radius-pill);
    font-size: 0.83rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s, transform 0.15s;
}

.episode-link::before {
    content: '▶';
    font-size: 0.7rem;
}

.episode-link:hover {
    background: #e3ecff;
    transform: translateY(-1px);
}

/* ── نموذج طرح السؤال ─────────────────────────────────────────── */
.composer-panel {
    padding: 24px var(--space-panel) 22px;
}

.composer-head {
    margin-bottom: 16px;
}

.composer-head h2 {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.composer-head p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 0.83rem;
}

.composer {
    display: flex;
    align-items: flex-start;
    gap: 13px;
}

.composer-avatar,
.question-avatar {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 700;
}

.composer-avatar {
    width: 42px;
    height: 42px;
    color: var(--brand-700);
    background: var(--brand-soft);
    font-size: 0.9rem;
}

.composer-main {
    flex: 1;
    min-width: 0;
}

.composer-input {
    display: block;
    width: 100%;
    min-height: 84px;
    max-height: 260px;
    padding: 14px 16px;
    color: var(--ink);
    background: var(--surface-soft);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    resize: none;
    font-size: 0.98rem;
    line-height: 1.65;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.composer-input::placeholder {
    color: var(--faint);
}

.composer-input:hover:not(:disabled) {
    border-color: var(--line-strong);
}

.composer-input:focus {
    background: #fff;
    border-color: #86b0f5;
    box-shadow: var(--ring);
    outline: none;
}

.composer-input:disabled {
    color: var(--muted);
    background: var(--surface-sunken);
    cursor: not-allowed;
}

.name-option {
    margin-top: 10px;
}

.name-option summary {
    width: fit-content;
    padding: 4px 0;
    color: var(--muted);
    font-size: 0.81rem;
    cursor: pointer;
}

.name-option summary:hover {
    color: var(--brand);
}

.name-input {
    width: min(100%, 340px);
    margin-top: 9px;
    padding: 11px 13px;
    color: var(--ink);
    background: #fff;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-sm);
}

.name-input::placeholder {
    color: var(--faint);
}

.name-input:focus {
    border-color: #86b0f5;
    box-shadow: var(--ring);
    outline: none;
}

.composer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}

.composer-hint {
    color: var(--muted);
    font-size: 0.77rem;
}

.composer-submit-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.char-count {
    color: var(--faint);
    font-size: 0.74rem;
    direction: ltr;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.char-count.is-near-limit {
    color: var(--danger);
    font-weight: 700;
}

.btn-submit {
    min-height: 46px;
    padding: 0 24px;
    color: #fff;
    background: linear-gradient(140deg, #3f7bf0, var(--brand-600));
    border: 0;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-brand);
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s, background 0.15s;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 20px 36px -16px rgba(43, 89, 224, 0.62);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

.btn-submit:disabled {
    color: #8793a2;
    background: #e6eaf0;
    box-shadow: none;
    cursor: not-allowed;
}

/* ── قسم الأسئلة ───────────────────────────────────────────────── */
.feed-section {
    overflow: hidden;
    padding: 0 var(--space-panel) 20px;
}

.feed-heading,
.archive-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 24px 0 18px;
}

.feed-heading h2,
.archive-heading h2,
.composer-head h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.feed-heading h2::before,
.archive-heading h2::before,
.composer-head h2::before {
    content: '';
    flex: 0 0 auto;
    width: 4px;
    height: 1.05em;
    border-radius: 3px;
    background: linear-gradient(180deg, #6f9bf5, var(--brand));
}

.feed-heading h2,
.archive-heading h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.01em;
}

.feed-heading p,
.archive-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.83rem;
}

.questions-count-badge,
.archive-count {
    min-width: 36px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    padding: 0 11px;
    color: var(--brand-700);
    background: var(--brand-soft);
    border: 1px solid var(--brand-line);
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.feed-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--line);
}

.sort-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface-sunken);
    border-radius: var(--radius-sm);
}

.sort-tab {
    min-height: 36px;
    padding: 0 15px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.14s, color 0.14s, box-shadow 0.14s;
}

.sort-tab:hover {
    color: var(--ink-soft);
}

.sort-tab.active {
    color: var(--brand-700);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.search-box {
    min-width: min(100%, 230px);
    height: 40px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    color: var(--faint);
    background: var(--surface-soft);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s, background 0.15s;
}

.search-box:focus-within {
    background: #fff;
    border-color: #86b0f5;
}

.search-box > svg {
    flex: 0 0 auto;
}

.search-box input {
    width: 100%;
    min-width: 0;
    padding: 0;
    color: var(--ink);
    background: transparent;
    border: 0;
    outline: none;
    font-size: 0.82rem;
}

.search-box input::placeholder {
    color: var(--faint);
}

.search-clear {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    color: var(--muted);
    background: var(--surface-sunken);
    border: 0;
    border-radius: 50%;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.14s, color 0.14s;
}

.search-clear:hover {
    color: var(--ink);
    background: var(--line-strong);
}

.questions-container {
    display: flex;
    flex-direction: column;
}

/* ── بطاقة السؤال ──────────────────────────────────────────────── */
.question-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 4px;
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius);
    transition: background 0.16s;
    animation: appear 0.22s ease-out;
}

.question-card:last-child {
    border-bottom: 0;
}

.question-card:hover {
    background: linear-gradient(180deg, rgba(238, 243, 255, 0.55), rgba(238, 243, 255, 0));
}

.question-card.is-highlighted {
    background: linear-gradient(180deg, rgba(15, 157, 103, 0.1), rgba(15, 157, 103, 0));
    box-shadow: inset 0 0 0 1.5px rgba(15, 157, 103, 0.35);
    animation: flash 2.4s ease-out;
}

.question-avatar {
    width: 40px;
    height: 40px;
    color: var(--ink-soft);
    background: var(--surface-sunken);
    font-size: 0.84rem;
}

.question-main {
    flex: 1;
    min-width: 0;
}

.question-byline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--muted);
    font-size: 0.76rem;
}

.question-byline strong {
    color: var(--ink);
    font-size: 0.83rem;
}

.question-byline time {
    color: var(--faint);
}

.meta-dot {
    color: #c3ccd9;
}

.top-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    color: #8a6415;
    background: var(--gold-soft);
    border: 1px solid #f0e0be;
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 700;
}

.top-badge::before {
    content: '★';
    font-size: 0.66rem;
}

.question-text {
    margin: 8px 0 12px;
    color: var(--ink);
    font-size: 0.98rem;
    line-height: 1.75;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.question-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vote-button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    color: var(--ink-soft);
    background: var(--surface-soft);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-pill);
    font-size: 0.79rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.14s, border-color 0.14s, color 0.14s, transform 0.14s, box-shadow 0.14s;
}

.vote-button:hover {
    color: var(--brand-700);
    background: var(--brand-soft);
    border-color: var(--brand-line);
    transform: translateY(-1px);
}

.vote-button.is-voted {
    color: #fff;
    background: linear-gradient(140deg, #3f7bf0, var(--brand-600));
    border-color: transparent;
    box-shadow: var(--shadow-brand);
}

.vote-button:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

.vote-arrow {
    font-size: 0.7rem;
    transition: transform 0.16s;
}

.vote-button:hover .vote-arrow {
    transform: translateY(-2px);
}

.vote-number {
    min-width: 18px;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.vote-note {
    margin: 14px 0 0;
    color: var(--faint);
    font-size: 0.74rem;
}

/* ── الحالات الفارغة ───────────────────────────────────────────── */
.empty-feed {
    padding: 40px 16px 36px;
    text-align: center;
}

.empty-feed.compact {
    padding: 26px 16px;
}

.empty-icon {
    display: inline-grid;
    width: 52px;
    height: 52px;
    place-items: center;
    margin-bottom: 12px;
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 50%;
    font-size: 1.3rem;
}

.empty-feed h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.empty-feed p {
    max-width: 420px;
    margin: 6px auto 0;
    color: var(--muted);
    font-size: 0.83rem;
}

.text-action {
    margin-top: 14px;
    padding: 9px 16px;
    color: #fff;
    background: var(--brand);
    border: 0;
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
}

.text-action:hover {
    background: var(--brand-600);
    transform: translateY(-1px);
}

/* ── الأرشيف ───────────────────────────────────────────────────── */
.archive-section {
    padding: 0 var(--space-panel) 20px;
}

.archive-heading {
    padding-bottom: 16px;
}

.schedule-note {
    margin: 0 0 12px;
    padding: 11px 14px;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    line-height: 1.6;
}

.archive-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.archive-day {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.archive-day-title {
    margin: 0;
    padding: 11px 14px;
    color: var(--ink-soft);
    background: var(--surface-soft);
    border-bottom: 1px solid var(--line);
    font-size: 0.79rem;
    font-weight: 700;
}

.archive-day-title span {
    color: var(--faint);
    font-size: 0.7rem;
    font-weight: 500;
}

.archive-episode + .archive-episode {
    border-top: 1px solid var(--line);
}

.archive-episode-trigger {
    width: 100%;
    min-height: 66px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    color: var(--ink);
    text-align: right;
    background: #fff;
    border: 0;
    cursor: pointer;
    transition: background 0.14s;
}

.archive-episode-trigger:hover,
.archive-episode-trigger[aria-expanded='true'] {
    background: var(--brand-soft);
}

.archive-episode-number {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    color: var(--brand-700);
    background: var(--brand-soft);
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    font-weight: 700;
    direction: ltr;
    font-variant-numeric: tabular-nums;
}

.archive-episode-copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.archive-episode-copy strong {
    overflow: hidden;
    font-size: 0.85rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.archive-episode-copy small {
    color: var(--muted);
    font-size: 0.73rem;
}

.archive-chevron {
    color: var(--faint);
    font-size: 1.2rem;
    transition: transform 0.18s;
}

.archive-episode-trigger[aria-expanded='true'] .archive-chevron {
    transform: rotate(180deg);
}

.archive-questions {
    padding: 0 14px 12px;
    background: var(--surface-soft);
}

.archive-question-list {
    padding: 2px 0;
}

.archive-question-list .question-card {
    padding: 14px 0;
    animation: none;
}

.archive-question-list .question-card:hover {
    background: transparent;
}

.archive-question-list .question-text {
    margin-bottom: 6px;
    font-size: 0.88rem;
}

.vote-summary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    color: var(--faint);
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    font-size: 0.76rem;
}

.vote-summary strong {
    color: var(--ink-soft);
    font-variant-numeric: tabular-nums;
}

.vote-summary small {
    font-size: 0.7rem;
}

.archive-readonly-note,
.archive-no-questions,
.archive-empty {
    color: var(--muted);
    font-size: 0.78rem;
}

.archive-readonly-note {
    margin: 8px 0 0;
}

.archive-no-questions,
.archive-empty {
    padding: 18px 12px;
    text-align: center;
}

/* ── جدول الحلقات القادمة ─────────────────────────────────────── */
.upcoming-section {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.upcoming-summary {
    min-height: 78px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px 22px;
    cursor: pointer;
    list-style: none;
}

.upcoming-summary::-webkit-details-marker {
    display: none;
}

.upcoming-summary-copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.upcoming-summary-copy strong {
    font-size: 0.95rem;
}

.upcoming-summary-copy small {
    color: var(--muted);
    font-size: 0.75rem;
}

.upcoming-count {
    padding: 5px 11px;
    color: var(--ink-soft);
    background: var(--surface-sunken);
    border-radius: var(--radius-pill);
    font-size: 0.73rem;
    font-weight: 600;
    white-space: nowrap;
}

.upcoming-chevron {
    color: var(--faint);
    font-size: 1.2rem;
    transition: transform 0.18s;
}

.upcoming-details[open] .upcoming-chevron {
    transform: rotate(180deg);
}

.upcoming-body {
    padding: 0 18px 16px;
    border-top: 1px solid var(--line);
}

.upcoming-body .schedule-note {
    margin-top: 14px;
}

.upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upcoming-day {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.upcoming-day h3 {
    margin: 0;
    padding: 10px 14px;
    color: var(--muted);
    background: var(--surface-soft);
    border-bottom: 1px solid var(--line);
    font-size: 0.76rem;
}

.future-episode {
    min-height: 60px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 13px;
    background: #fff;
}

.future-episode + .future-episode {
    border-top: 1px solid var(--line);
}

.future-episode .archive-episode-number {
    width: 36px;
    height: 36px;
    color: var(--muted);
    background: var(--surface-sunken);
}

.future-episode .archive-episode-copy strong {
    font-size: 0.8rem;
}

.future-episode .archive-episode-copy small {
    font-size: 0.7rem;
}

.future-lock {
    color: #b3bcc8;
    font-size: 0.85rem;
}

/* ── التذييل ───────────────────────────────────────────────────── */
.page-footer {
    margin-top: 30px;
    padding: 28px 16px 20px;
    color: var(--muted);
    text-align: center;
    font-size: 0.76rem;
    border-top: 1px solid var(--line);
}

.page-footer p {
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.7;
}

.page-footer span {
    display: block;
    margin-top: 6px;
    color: var(--faint);
    font-size: 0.72rem;
}

/* ── التحميل والأخطاء ─────────────────────────────────────────── */
.loading-card,
.inline-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 90px;
    padding: 16px;
    color: var(--muted);
    font-size: 0.82rem;
}

.spinner {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    border: 2px solid var(--line-strong);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.skeleton-list {
    display: flex;
    flex-direction: column;
}

.skeleton-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 4px;
    border-bottom: 1px solid var(--line);
}

.skeleton-card:last-child {
    border-bottom: 0;
}

.skel-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 50%;
}

.skel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-top: 4px;
}

.skel-line {
    height: 11px;
    border-radius: 6px;
}

.skel-line.w-40 { width: 40%; }
.skel-line.w-90 { width: 90%; }
.skel-line.w-70 { width: 70%; }

.skel-avatar,
.skel-line {
    background: linear-gradient(90deg, #eef1f6 25%, #e3e9f2 37%, #eef1f6 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
}

.inline-error {
    justify-content: flex-start;
    color: #a44149;
    background: var(--danger-soft);
    border-radius: var(--radius-sm);
}

.inline-error > span {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--danger);
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
}

.inline-error p {
    margin: 0;
}

/* ── التنبيه العائم ───────────────────────────────────────────── */
.toast-popup {
    position: fixed;
    z-index: 60;
    inset-inline-start: 50%;
    bottom: 24px;
    max-width: min(560px, calc(100vw - 28px));
    padding: 12px 18px;
    color: #fff;
    background: #1e2b40;
    border-radius: var(--radius);
    box-shadow: 0 16px 36px -14px rgba(15, 27, 45, 0.55);
    font-size: 0.84rem;
    opacity: 0;
    pointer-events: none;
    transform: translate(50%, 16px);
    transition: opacity 0.2s, transform 0.2s;
}

.toast-popup.is-visible {
    opacity: 1;
    transform: translate(50%, 0);
}

.toast-popup.error {
    background: #b23a45;
}

.toast-popup.success {
    background: #0f7a52;
}

/* ── الزر العائم للهاتف ───────────────────────────────────────── */
.fab-ask {
    display: none;
    position: fixed;
    z-index: 50;
    inset-inline-start: 18px;
    bottom: 18px;
    align-items: center;
    gap: 8px;
    padding: 13px 20px;
    color: #fff;
    background: linear-gradient(140deg, #3f7bf0, var(--brand-600));
    border: 0;
    border-radius: var(--radius-pill);
    box-shadow: 0 18px 34px -14px rgba(43, 89, 224, 0.65);
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
}

.fab-ask svg {
    flex: 0 0 auto;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── الحركات ───────────────────────────────────────────────────── */
@keyframes spin {
    to { transform: rotate(360deg); }
}

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

@keyframes shimmer {
    from { background-position: 100% 0; }
    to { background-position: 0 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

@keyframes flash {
    0% { background-color: rgba(15, 157, 103, 0.2); }
    100% { background-color: transparent; }
}

/* ── الشاشات المتوسطة ─────────────────────────────────────────── */
@media (min-width: 700px) {
    .episode-body {
        flex-direction: row;
        align-items: flex-start;
        gap: 20px;
    }

    .episode-cover {
        flex: 0 0 250px;
        aspect-ratio: 16 / 10;
    }
}

/* ── الهاتف ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    :root {
        --space-section: 18px;
        --space-panel: 16px;
    }

    .page-shell {
        width: min(100% - 22px, 540px);
        padding-bottom: 96px;
    }

    .topbar {
        height: 58px;
        margin: 10px 0 18px;
        padding: 0 12px;
    }

    .brand-name {
        font-size: 0.92rem;
    }

    .brand-mark {
        width: 33px;
        height: 33px;
    }

    .account-note {
        padding: 6px 10px;
        font-size: 0.7rem;
    }

    .hero {
        margin-bottom: 18px;
        padding: 24px 20px 22px;
        border-radius: var(--radius-lg);
    }

    .hero-intro {
        font-size: 0.92rem;
    }

    .hero-stats li {
        flex: 1;
        min-width: 0;
        padding: 10px 12px;
    }

    .hero-stats strong {
        font-size: 1.25rem;
    }

    .current-card,
    .composer-panel,
    .feed-section,
    .archive-section {
        padding-inline: 16px;
        border-radius: var(--radius);
    }

    .current-card {
        padding-top: 22px;
        padding-bottom: 22px;
    }

    .feed-heading,
    .archive-heading {
        padding-top: 20px;
        padding-bottom: 16px;
    }

    .feed-heading h2,
    .archive-heading h2 {
        font-size: 1.04rem;
    }

    .feed-controls {
        align-items: stretch;
    }

    .sort-tabs {
        flex: 1 1 100%;
    }

    .sort-tab {
        flex: 1;
    }

    .search-box {
        width: 100%;
    }

    .question-card {
        gap: 10px;
        padding: 15px 0;
    }

    .question-avatar {
        width: 36px;
        height: 36px;
    }

    .question-text {
        font-size: 0.93rem;
    }

    .composer {
        gap: 10px;
    }

    .composer-avatar {
        width: 36px;
        height: 36px;
    }

    .composer-actions {
        align-items: flex-end;
    }

    .composer-hint {
        max-width: 150px;
        font-size: 0.71rem;
    }

    .composer-submit-wrap {
        gap: 8px;
    }

    .btn-submit {
        min-height: 44px;
        padding: 0 16px;
        font-size: 0.85rem;
    }

    .archive-day-title {
        font-size: 0.75rem;
    }

    .page-footer {
        padding-bottom: 8px;
    }

    .fab-ask {
        display: inline-flex;
    }
}

/* ── تقليل الحركة ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
