:root {
    --bg: #faf8f5;
    --surface: #ffffff;
    --surface-muted: #f3f0ea;
    --surface-hover: color-mix(in srgb, var(--surface) 90%, var(--accent) 10%);
    --border: #e5e0d5;
    --border-strong: #cfc8b8;
    --text: #18221f;
    --text-secondary: #4e5d58;
    --text-muted: #84928d;
    --accent: #235347;
    --accent-hover: #193e35;
    --accent-soft: rgba(35, 83, 71, 0.09);
    --sys-accent: AccentColor;
    --gold: #9a6b26;
    --gold-soft: rgba(154, 107, 38, 0.11);
    --amber: #b45309;
    --danger: #b91c1c;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-xs: 0 1px 2px rgba(24, 34, 31, 0.04);
    --shadow-sm: 0 4px 16px rgba(24, 34, 31, 0.05);
    --shadow-md: 0 12px 32px rgba(24, 34, 31, 0.09);
}

[data-theme="dark"] {
    --bg: #0d1311;
    --surface: #141c19;
    --surface-muted: #1b2622;
    --surface-hover: color-mix(in srgb, var(--surface) 90%, var(--accent) 10%);
    --border: #263530;
    --border-strong: #354842;
    --text: #f2efe9;
    --text-secondary: #a3b1ac;
    --text-muted: #6c7c76;
    --accent: #3b8a77;
    --accent-hover: #2f7362;
    --accent-soft: rgba(59, 138, 119, 0.16);
    --gold: #d99b43;
    --gold-soft: rgba(217, 155, 67, 0.15);
    --amber: #e08b2c;
    --danger: #e15252;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

button,
a,
select,
label,
input[type="checkbox"],
.nav-tab,
.status-btn,
.sunnah-chip,
.tasbeeh-tap-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* ==========================================================================
   GLOBAL CUSTOM SELECT DROPDOWNS & CHECKBOX CONTROLS
   ========================================================================== */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2384928d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 13px;
    padding: 0.52rem 2.2rem 0.52rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s cubic-bezier(0.2, 0, 0, 1),
                box-shadow 0.2s cubic-bezier(0.2, 0, 0, 1),
                background-color 0.2s ease;
}

[dir="rtl"] select {
    background-position: left 0.85rem center;
    padding: 0.52rem 0.85rem 0.52rem 2.2rem;
}

select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

input[type="checkbox"]:not(.sunnah-chip input) {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-strong);
    border-radius: 5px;
    background: var(--surface);
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.2, 0, 0, 1);
    margin: 0;
}

input[type="checkbox"]:not(.sunnah-chip input):checked {
    background: var(--accent);
    border-color: var(--accent);
}

input[type="checkbox"]:not(.sunnah-chip input):checked::before {
    content: "";
    width: 9px;
    height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px);
}

input[type="checkbox"]:not(.sunnah-chip input):focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-soft);
}

/* ==========================================================================
   SITE-WIDE MICRO-MOTION & FLUID CHOREOGRAPHY
   ========================================================================== */
.btn,
.icon-btn,
.nav-tab,
.status-btn,
.sunnah-chip,
.tasbeeh-tap-btn {
    transition: transform 0.18s cubic-bezier(0.2, 0, 0, 1),
                background-color 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.2s ease,
                color 0.2s ease;
}

.btn:active,
.icon-btn:active,
.nav-tab:active,
.status-btn:active,
.sunnah-chip:active,
.tasbeeh-tap-btn:active {
    transform: scale(0.96);
}

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

.mizan-fade-in {
    animation: mizanEnter 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes statusPillPop {
    0% { transform: scale(0.94); }
    60% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

.status-btn.active {
    animation: statusPillPop 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}

img,
svg,
table,
.card,
.modal-dialog,
.qibla-grid,
.kpi-row,
.heatmap-grid,
.sunnah-chips-grid,
.timings-strip {
    max-width: 100%;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.container {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

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

/* ==========================================================================
   ACADEMIC / DEVELOPER CONTEXT BANNER
   ========================================================================== */
.academic-banner {
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border);
    padding: 0.32rem 0;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.academic-banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.academic-badge {
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.01em;
}

.academic-sub {
    opacity: 0.75;
}

/* ==========================================================================
   EDITORIAL HEADER
   ========================================================================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.brand {
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
    text-decoration: none;
    color: var(--text);
}

.brand-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    display: inline-block;
    align-self: center;
}

.brand-name {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 1.45rem;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.brand-arabic {
    font-family: 'Amiri', serif;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    background: var(--surface-muted);
    padding: 0.22rem;
    border-radius: 999px;
    border: 1px solid var(--border);
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.36rem 0.88rem;
    border-radius: 999px;
    font-size: 0.81rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
}

.nav-tab:hover {
    color: var(--text);
}

.nav-tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-xs);
}

.nav-badge {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 0.05rem 0.42rem;
    border-radius: 999px;
    font-size: 0.69rem;
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.icon-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    height: 34px;
    padding: 0 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
    text-decoration: none;
}

.icon-btn:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.lang-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 0 1.65rem 0 0.65rem;
    background-position: right 0.55rem center;
    background-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    outline: none;
}

[dir="rtl"] .lang-select {
    padding: 0 0.65rem 0 1.65rem;
    background-position: left 0.55rem center;
}

.lang-select:focus-visible {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

[dir="rtl"] .topbar-actions {
    margin-left: 0;
}

[dir="rtl"] .next-prayer-meta {
    text-align: left;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.58rem 1.05rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.84rem;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-sm {
    padding: 0.36rem 0.72rem;
    font-size: 0.77rem;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-outline {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--surface-muted);
    border-color: var(--border-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

/* ==========================================================================
   LANDING PURPOSE & METHODOLOGY CARD (NOORTRACKER.COM EDITORIAL STYLE)
   ========================================================================== */
.main-content {
    flex: 1;
    padding-top: 1.4rem;
    padding-bottom: 3rem;
}

.purpose-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.5rem;
    margin-bottom: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow-xs);
}

.purpose-content {
    flex: 1;
    min-width: 280px;
}

.purpose-eyebrow {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.purpose-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.purpose-collapse-btn {
    background: var(--surface-muted);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    font-family: inherit;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.purpose-collapse-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.purpose-card.is-collapsed {
    padding: 0.65rem 1.1rem;
    gap: 0.75rem;
}

.purpose-card.is-collapsed h1,
.purpose-card.is-collapsed .purpose-body-text {
    display: none;
}

.purpose-card.is-collapsed .purpose-top-row {
    margin-bottom: 0;
}

/* Network / Offline Status Pill */
.net-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    padding: 0.22rem 0.58rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.net-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
}

.net-badge.is-offline {
    background: var(--amber-soft);
    border-color: var(--amber);
    color: var(--amber);
}

.net-badge.is-offline .net-dot {
    background: var(--amber);
}

.purpose-content h1 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    font-size: 1.7rem;
    line-height: 1.15;
    margin-bottom: 0.4rem;
    color: var(--text);
}

.purpose-content p {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.purpose-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.purpose-status {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ==========================================================================
   OVERVIEW & TIMINGS STRIP
   ========================================================================== */
.overview-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.35rem;
    margin-bottom: 1.15rem;
    box-shadow: var(--shadow-xs);
}

.overview-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.date-stepper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-arrow {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.step-arrow:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.date-titles h2 {
    font-size: 0.98rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.hijri-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
}

.badge-today {
    font-size: 0.68rem;
    font-weight: 600;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 0.1rem 0.48rem;
    border-radius: 999px;
}

.next-prayer-inline {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.next-prayer-meta {
    text-align: right;
}

.next-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.next-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.adhan-preview-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.88rem;
    transition: all 0.18s ease;
    flex-shrink: 0;
}

.adhan-preview-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.adhan-preview-btn.is-playing {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.timings-strip {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.4rem;
    padding-top: 0.85rem;
}

.timing-slot {
    text-align: center;
    padding: 0.42rem 0.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
                background-color 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.2s ease;
}

.timing-slot.active-slot {
    background: var(--accent-soft);
    border-color: var(--accent);
    box-shadow: var(--shadow-xs);
    transform: translateY(-2px);
}

.timing-slot span {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.timing-slot strong {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 0.1rem;
    font-variant-numeric: tabular-nums;
}

.timing-slot.active-slot span,
.timing-slot.active-slot strong {
    color: var(--accent);
}

/* ==========================================================================
   TAB PANELS & CARDS
   ========================================================================== */
.tab-panel {
    display: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.tab-panel.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.tab-panel.active.tab-entering {
    opacity: 0;
    transform: translateY(8px);
}

.nav-tab {
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.18s ease,
                color 0.18s ease,
                box-shadow 0.18s ease;
}

.nav-tab:active {
    transform: scale(0.92);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.35rem;
    margin-bottom: 1.15rem;
    box-shadow: var(--shadow-xs);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}

.card-title-group h2 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    font-size: 1.3rem;
}

.card-title-group p {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.header-pills {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.stat-pill {
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.stat-pill strong {
    color: var(--text);
}

.progress-line {
    height: 4px;
    background: var(--surface-muted);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.85rem;
}

.progress-line-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.3s ease;
}

/* ==========================================================================
   FARD PRAYER ROWS
   ========================================================================== */
.fard-list {
    display: flex;
    flex-direction: column;
}

.prayer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.82rem 0.2rem;
    border-bottom: 1px solid var(--border);
}

.prayer-row:last-child {
    border-bottom: none;
    padding-bottom: 0.2rem;
}

.prayer-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 150px;
}

.prayer-check-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-strong);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

@keyframes statusPop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

.prayer-row.status-row-jamaah .prayer-check-dot {
    background: var(--gold);
    animation: statusPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.prayer-row.status-row-ontime .prayer-check-dot {
    background: var(--accent);
    animation: statusPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.prayer-row.status-row-late .prayer-check-dot {
    background: var(--amber);
    animation: statusPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.prayer-row.status-row-missed .prayer-check-dot {
    background: var(--danger);
}

.prayer-name-wrap {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
}

.prayer-name-wrap h3 {
    font-size: 0.93rem;
    font-weight: 600;
}

.prayer-arabic {
    font-family: 'Amiri', serif;
    font-size: 0.98rem;
    color: var(--text-muted);
}

.prayer-time-sub {
    display: block;
    font-size: 0.73rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.status-pills {
    display: inline-flex;
    background: var(--surface-muted);
    padding: 0.2rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    gap: 0.15rem;
}

.status-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.34rem 0.68rem;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, transform 0.14s ease;
}

.status-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.status-btn.active {
    box-shadow: var(--shadow-xs);
}

.status-btn.active[data-status="jamaah"] {
    background: var(--gold);
    color: #fff;
}

.status-btn.active[data-status="ontime"] {
    background: var(--accent);
    color: #fff;
}

.status-btn.active[data-status="late"] {
    background: var(--amber);
    color: #fff;
}

.status-btn.active[data-status="missed"] {
    background: var(--danger);
    color: #fff;
}

/* ==========================================================================
   SUNNAH CHIPS
   ========================================================================== */
.sunnah-chips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 0.55rem;
}

.sunnah-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-muted);
    cursor: pointer;
    user-select: none;
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
                border-color 0.18s ease,
                background-color 0.18s ease,
                box-shadow 0.18s ease;
}

.sunnah-chip:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-xs);
}

.sunnah-chip.sunnah-done {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.sunnah-chip input {
    display: none;
}

.sunnah-chip-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    display: block;
}

.sunnah-chip-sub {
    font-size: 0.71rem;
    color: var(--text-secondary);
}

.sunnah-chip-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--border-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    color: transparent;
    transition: all 0.15s;
}

.sunnah-chip.sunnah-done .sunnah-chip-check {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ==========================================================================
   QIBLA FINDER
   ========================================================================== */
.qibla-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 1rem;
}

.compass-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.4rem 0;
}

.qibla-readout strong {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 2rem;
    font-weight: 400;
    display: block;
    color: var(--text);
    line-height: 1.1;
}

.qibla-readout span {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

#compassDial,
.compass-outer-ring {
    position: relative;
    width: 205px;
    height: 205px;
    border-radius: 50%;
    background: radial-gradient(circle at center, var(--surface) 0%, var(--surface-muted) 100%);
    border: 1.5px solid var(--border-strong);
    box-shadow: inset 0 2px 8px rgba(24, 34, 31, 0.05), var(--shadow-xs);
    color: var(--text-secondary);
    margin: 0.75rem 0 0.85rem;
    transform: none !important;
}

.compass-ticks-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.cardinal-mark {
    position: absolute;
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.mark-n { top: 8px; left: 50%; transform: translateX(-50%); color: var(--accent); }
.mark-s { bottom: 8px; left: 50%; transform: translateX(-50%); }
.mark-e { right: 10px; top: 50%; transform: translateY(-50%); }
.mark-w { left: 10px; top: 50%; transform: translateY(-50%); }

.qibla-needle-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease-out;
    will-change: transform;
}

.qibla-needle-wrapper.qibla-aligned .qibla-kaaba-badge {
    animation: qiblaAlignedPulse 0.9s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 8px rgba(197, 160, 89, 0.85));
}

.qibla-needle-wrapper.qibla-aligned .qibla-arrow-head,
.qibla-needle-wrapper.qibla-aligned .qibla-arrow-shaft {
    filter: drop-shadow(0 0 6px rgba(35, 83, 71, 0.65));
}

@keyframes qiblaAlignedPulse {
    from { transform: scale(1); }
    to { transform: scale(1.22); }
}

.qibla-kaaba-badge {
    position: absolute;
    top: 18px;
    font-size: 1.1rem;
}

.qibla-arrow-head {
    width: 12px;
    height: 14px;
    background: var(--accent);
    clip-path: polygon(50% 0%, 0% 100%, 50% 78%, 100% 100%);
    transform: translateY(-46px);
}

.qibla-arrow-shaft {
    width: 4px;
    height: 52px;
    background: linear-gradient(180deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 70%, transparent) 100%);
    clip-path: polygon(25% 0%, 75% 0%, 100% 100%, 0% 100%);
    transform: translateY(-18px);
}

.qibla-arrow-tail {
    width: 3px;
    height: 34px;
    background: var(--border-strong);
    clip-path: polygon(0% 0%, 100% 0%, 65% 100%, 35% 100%);
    transform: translateY(14px);
}

.compass-center-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gold);
    border: 2.5px solid var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transform: translate(-50%, -50%);
}

.qibla-leaflet-map {
    width: 100%;
    height: 270px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    z-index: 1;
}

.qibla-controls-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.7rem;
    width: 100%;
}

.qibla-controls-row select {
    flex: 1;
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.8rem;
}

.math-disclosure {
    margin-top: 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    padding: 0.55rem 0.8rem;
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.math-disclosure summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    user-select: none;
    list-style-position: inside;
}

.math-disclosure-body {
    margin-top: 0.6rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.math-formula-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.72rem;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.42rem 0.6rem;
    border-radius: 6px;
    color: var(--accent);
    overflow-x: auto;
}

.math-params-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem 0.75rem;
}

.math-params-grid span {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.math-params-grid strong {
    font-size: 0.76rem;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   DAILY ADHKAR & REMEMBRANCE SECTION
   ========================================================================== */
.adhkar-filter-bar {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.45rem;
    margin-bottom: 1.15rem;
    padding-bottom: 0.15rem;
}

.adhkar-filter-bar::-webkit-scrollbar {
    display: none;
}

.adhkar-chip {
    flex: 0 0 auto;
    appearance: none;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.48rem 0.9rem;
    min-height: 38px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.16s ease;
}

.adhkar-chip:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.adhkar-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    box-shadow: var(--shadow-xs);
}

.adhkar-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.adhkar-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    animation: cardEnter 0.22s ease-out forwards;
}

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

@keyframes completeGlow {
    0% {
        transform: scale(0.99);
        box-shadow: 0 0 0 0 rgba(35, 83, 71, 0.28);
    }
    50% {
        transform: scale(1.01);
        box-shadow: 0 0 0 6px rgba(35, 83, 71, 0.12);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(35, 83, 71, 0);
    }
}

.adhkar-card.adhkar-completed,
.adhkar-card.is-complete {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface));
    animation: completeGlow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.adhkar-card.adhkar-featured-card {
    border: 1.5px solid var(--gold);
    background: var(--gold-soft);
}

.adhkar-card.adhkar-featured-card.adhkar-completed {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent-soft) 65%, var(--gold-soft));
}

.adhkar-card[hidden],
.adhkar-card.is-filtered-out {
    display: none !important;
}

.adhkar-featured-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.16rem 0.58rem;
    border-radius: 999px;
    background: var(--gold);
    color: #ffffff;
    letter-spacing: 0.01em;
}

.adhkar-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    background: var(--surface-muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
}

.adhkar-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.adhkar-title-wrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.adhkar-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.adhkar-cat-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.14rem 0.52rem;
    border-radius: 999px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.adhkar-done-pill {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.14rem 0.55rem;
    border-radius: 999px;
    background: var(--accent);
    color: #ffffff;
}

.adhkar-arabic {
    font-family: 'Amiri', serif;
    font-size: 1.42rem;
    line-height: 1.95;
    color: var(--text);
    direction: rtl;
    text-align: right;
    padding: 0.55rem 0.8rem;
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
    border-right: 3px solid var(--accent);
    margin: 0;
}

.adhkar-translit {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.45;
    margin: 0;
}

.adhkar-translation {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.adhkar-card-footer {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.15rem;
}

.adhkar-tap-btn {
    flex: 1;
    min-height: 48px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 700;
    padding: 0.6rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    transition: transform 0.1s ease, background-color 0.18s ease, color 0.18s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.adhkar-tap-btn:active {
    transform: scale(0.985);
}

.adhkar-card.adhkar-completed .adhkar-tap-btn {
    background: var(--accent);
    color: #ffffff;
}

.adhkar-count-fraction {
    font-variant-numeric: tabular-nums;
    font-size: 0.95rem;
}

.adhkar-item-reset-btn {
    min-width: 42px;
    min-height: 48px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.16s ease;
}

.adhkar-item-reset-btn:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

/* ==========================================================================
   THE NOBLE QURAN READER & 30-JUZ KHATMAH TRACKER
   ========================================================================== */
.quran-bookmark-pills {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.quran-bookmark-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.32rem 0.72rem;
    border-radius: 999px;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 600;
}

.quran-controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.8rem 0.95rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.quran-surah-picker-wrap {
    flex: 1 1 220px;
}

#quranSurahSelect,
.quran-surah-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 0.45rem 2.2rem 0.45rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.84rem;
    font-weight: 600;
    font-family: inherit;
    background-color: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2384928d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 11px;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

[dir="rtl"] #quranSurahSelect,
[dir="rtl"] .quran-surah-select {
    background-position: left 0.85rem center;
    padding: 0.45rem 0.85rem 0.45rem 2.2rem;
}

#quranSurahSelect:focus,
.quran-surah-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

.quran-mode-toggle {
    display: inline-flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.18rem;
    gap: 0.18rem;
}

.quran-mode-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0.38rem 0.78rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.16s ease;
}

.quran-mode-btn.active {
    background: var(--accent);
    color: #ffffff;
    box-shadow: var(--shadow-xs);
}

.custom-check-label,
.quran-trans-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.custom-check-label input[type="checkbox"],
.quran-trans-toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-strong);
    border-radius: 5px;
    background: var(--surface);
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    margin: 0;
}

.custom-check-label input[type="checkbox"]:checked,
.quran-trans-toggle input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.custom-check-label input[type="checkbox"]:checked::before,
.quran-trans-toggle input[type="checkbox"]:checked::before {
    content: "";
    width: 9px;
    height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px);
}

.custom-check-label input[type="checkbox"]:focus-visible,
.quran-trans-toggle input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.khatmah-tracker-card {
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 1.15rem;
}

.khatmah-summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    user-select: none;
}

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

.khatmah-summary-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text);
}

.khatmah-pct-badge {
    font-size: 0.74rem;
    font-weight: 700;
    padding: 0.18rem 0.6rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.khatmah-progress-track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.khatmah-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.khatmah-body {
    margin-top: 0.85rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
}

.khatmah-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 0.65rem;
}

.juz-tracker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    gap: 0.42rem;
}

.juz-cell-btn {
    min-height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    transition: all 0.15s ease;
}

.juz-cell-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

.juz-cell-btn.juz-completed {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    box-shadow: var(--shadow-xs);
}

.quran-reader-container {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.quran-loading-state {
    text-align: center;
    padding: 2.2rem 1rem;
    color: var(--text-secondary);
    font-size: 0.86rem;
    background: var(--surface-muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
}

.quran-bismillah-banner {
    font-family: 'Amiri', serif;
    font-size: clamp(1.35rem, 4.2vw, 1.75rem);
    text-align: center;
    direction: rtl;
    color: var(--accent);
    padding: 0.75rem 1rem;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.quran-ayah-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.05rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.quran-ayah-card.is-bookmarked {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface));
}

.quran-ayah-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.quran-ayah-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.18rem 0.58rem;
    border-radius: 999px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.quran-bookmark-btn {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.15s ease;
}

.quran-bookmark-btn:hover,
.quran-ayah-card.is-bookmarked .quran-bookmark-btn {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

.quran-arabic-text {
    font-family: 'Amiri', serif;
    font-size: clamp(1.25rem, 4vw, 1.65rem);
    line-height: 2.2;
    direction: rtl;
    text-align: right;
    color: var(--text);
    margin: 0;
}

.quran-verse-ornament {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Amiri', serif;
    font-size: 0.92em;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    border-radius: 999px;
    padding: 0.02rem 0.48rem;
    margin-inline: 0.32rem;
    line-height: 1.35;
    vertical-align: middle;
}

.quran-translation-text {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
    direction: ltr;
    text-align: left;
    margin: 0.4rem 0 0;
}

.quran-continuous-page {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.35rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quran-continuous-arabic {
    font-family: 'Amiri', serif;
    font-size: clamp(1.3rem, 4.2vw, 1.7rem);
    line-height: 2.35;
    direction: rtl;
    text-align: justify;
    color: var(--text);
}

.quran-continuous-ayah-span {
    cursor: pointer;
    border-radius: 6px;
    padding: 0.05rem 0.15rem;
    transition: background-color 0.16s ease;
}

.quran-continuous-ayah-span:hover,
.quran-continuous-ayah-span.is-bookmarked {
    background: var(--accent-soft);
}

/* ==========================================================================
   AMBIENT DESK CLOCK / FOCUS MODE OVERLAY
   ========================================================================== */
.desk-mode-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: 1000;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom));
    opacity: 1;
    transition: opacity 0.3s ease;
}

.desk-mode-overlay.is-fading-out {
    opacity: 0;
}

.desk-mode-overlay[hidden] {
    display: none !important;
}

.desk-exit-btn {
    position: absolute;
    top: calc(1.25rem + env(safe-area-inset-top));
    right: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
}

.desk-exit-btn:hover {
    border-color: var(--accent);
    color: var(--text);
    transform: scale(1.05);
}

.desk-mode-stage {
    width: 100%;
    max-width: 680px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.6rem;
}

.desk-primary-col,
.desk-secondary-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
    width: 100%;
}

@media (orientation: landscape) and (max-height: 500px) {
    .desk-mode-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: center;
        gap: 2rem;
        padding: 1rem 2rem;
        max-width: 900px;
        margin: 0 auto;
    }
    .desk-clock-main {
        font-size: clamp(2.5rem, 8vw, 5rem) !important;
    }
}

.desk-date-meta {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    font-weight: 600;
}

.desk-clock-display {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: clamp(4.2rem, 15vw, 8.5rem);
    line-height: 0.95;
    letter-spacing: -0.02em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.desk-next-prayer-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 1rem 1.75rem;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.desk-next-titles {
    display: inline-flex;
    align-items: baseline;
    gap: 0.55rem;
}

.desk-next-eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
}

.desk-next-name {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 1.65rem;
    color: var(--accent);
}

.desk-next-arabic {
    font-family: 'Amiri', serif;
    font-size: 1.35rem;
    color: var(--text-secondary);
}

.desk-countdown-value {
    font-size: clamp(1.6rem, 4.5vw, 2.35rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.desk-window-progress-wrap {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.desk-window-hairline {
    width: 100%;
    height: 4px;
    background: var(--surface-muted);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.desk-window-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.5s ease;
}

.desk-window-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ==========================================================================
   DIGITAL TASBEEH & INSIGHTS
   ========================================================================== */
.compact-num-input {
    width: 68px;
    padding: 0.36rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.8rem;
}

.tasbeeh-preset-select {
    padding: 0.38rem 0.7rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 500;
}

.tasbeeh-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.35rem 1rem 0.75rem;
    gap: 1.35rem;
}

.tasbeeh-phrase-box {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.18rem;
}

.tasbeeh-arabic {
    font-family: 'Amiri', serif;
    font-size: 1.85rem;
    color: var(--accent);
    line-height: 1.35;
}

.tasbeeh-translit {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.tasbeeh-meaning {
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.tasbeeh-tap-btn {
    position: relative;
    width: 216px;
    height: 216px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: radial-gradient(circle at 50% 35%, var(--surface) 0%, var(--surface-muted) 100%);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.15s ease, border-color 0.15s ease;
}

.tasbeeh-tap-btn:hover {
    border-color: var(--accent);
}

.tasbeeh-tap-btn:active,
.tasbeeh-tap-btn.tap-pulse {
    transform: scale(0.96);
    box-shadow: var(--shadow-xs);
}

.tasbeeh-ring-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}

.tasbeeh-ring-bg {
    stroke: var(--border);
    opacity: 0.55;
}

.tasbeeh-ring-fill {
    stroke: var(--accent);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.tasbeeh-count-num {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 3.6rem;
    line-height: 1;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.tasbeeh-count-target {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.tasbeeh-tap-hint {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-top: 0.45rem;
    font-weight: 600;
}

.tasbeeh-footer-bar {
    width: 100%;
    max-width: 420px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.tasbeeh-metrics {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.15rem;
}

.kpi-box {
    background: color-mix(in srgb, var(--surface) 96%, var(--accent) 4%);
    border: 1px solid color-mix(in srgb, var(--border) 82%, var(--accent) 18%);
    border-radius: 14px;
    padding: 0.95rem 1rem;
    box-shadow: var(--shadow-xs);
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.2s ease,
                border-color 0.2s ease;
}

.kpi-box:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
}

.kpi-box span {
    display: block;
    font-size: 0.73rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.01em;
}

.kpi-box strong {
    display: block;
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    font-size: 1.75rem;
    color: var(--text);
    margin-top: 0.15rem;
    line-height: 1.1;
}

#statCurrentStreak,
#statBestStreak {
    color: var(--accent);
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(14, 1fr);
    gap: 6px;
    padding: 0.5rem 0;
}

.hm-cell {
    aspect-ratio: 1;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: transform 0.15s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.15s ease;
    cursor: pointer;
}

.hm-cell:hover,
.hm-cell:focus-visible {
    transform: scale(1.2);
    z-index: 5;
}

/* Dynamic Green Levels */
.hm-lvl-0 { background: var(--surface-muted); opacity: 0.45; }
.hm-lvl-1 { background: #16382f; }
.hm-lvl-2 { background: #1d4d40; }
.hm-lvl-3 { background: #236353; }
.hm-lvl-4 { background: #2a7d69; }
.hm-lvl-5 {
    background: #34a388;
    box-shadow: 0 0 8px rgba(52, 163, 136, 0.35);
    border-color: rgba(52, 163, 136, 0.6);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 0.65rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
}

.heatmap-legend .hm-cell {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    cursor: default;
}

.heatmap-legend .hm-cell:hover {
    transform: none;
}

/* ==========================================================================
   MODAL & FORMS
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(24, 34, 31, 0.45);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-backdrop.open {
    display: flex;
    opacity: 1;
    animation: modalBackdropFade 0.2s ease forwards;
}

@keyframes modalBackdropFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.modal-dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    animation: modalDialogSlideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.15rem;
}

.modal-header h3 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    font-size: 1.35rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.form-group {
    margin-bottom: 0.85rem;
}

.form-group label {
    display: block;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.55rem 0.72rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* ==========================================================================
   LEGAL PAGES & FOOTER
   ========================================================================== */
.legal-container {
    max-width: 720px;
}

.legal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.legal-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
}

.legal-header h1 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    font-size: 2rem;
}

.legal-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.legal-content h2 {
    font-size: 0.98rem;
    margin: 1.35rem 0 0.4rem;
}

.legal-content p,
.legal-content li {
    font-size: 0.87rem;
    color: var(--text-secondary);
    margin-bottom: 0.65rem;
}

.legal-content ul {
    margin-left: 1.2rem;
    margin-bottom: 1rem;
}

.legal-content code {
    background: var(--surface-muted);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.82em;
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.25rem 0 calc(1.25rem + env(safe-area-inset-bottom));
    margin-top: auto;
    background: var(--surface-muted);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.77rem;
    color: var(--text-secondary);
}

.footer-disclaimer strong {
    display: block;
    color: var(--text);
}

.footer-links {
    display: flex;
    gap: 1rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--text);
}

.toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.toast {
    background: var(--text);
    color: var(--surface);
    padding: 0.58rem 0.95rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
}

/* Account Pill & Auth Modal */
.auth-pill-btn {
    padding-left: 0.45rem;
    padding-right: 0.78rem;
    gap: 0.42rem;
}

.user-avatar-dot {
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.auth-pill-btn.is-authenticated .user-avatar-dot {
    background: var(--accent);
    color: #ffffff;
}

.auth-modal-card {
    max-width: 440px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
    background: var(--surface-muted);
    padding: 0.24rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.auth-tab-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.48rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.auth-tab-btn.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-xs);
}

.security-notice-box {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.65rem 0.8rem;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.45;
    margin-bottom: 1rem;
}

.auth-error-box {
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    background: var(--danger-soft);
    border: 1px solid var(--danger);
    color: var(--danger);
    font-size: 0.78rem;
    font-weight: 500;
    margin-bottom: 0.9rem;
}

.auth-oauth-wrap {
    margin-bottom: 0.85rem;
}

.btn-google-auth {
    width: 100%;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.62rem;
    padding: 0.58rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: background-color 0.18s ease,
                border-color 0.18s ease,
                box-shadow 0.18s ease,
                transform 0.14s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn-google-auth:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.btn-google-auth:active:not(:disabled) {
    transform: scale(0.985);
}

.btn-google-auth:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.google-auth-icon {
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0 0.9rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.profile-active-box {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem;
    border-radius: var(--radius-md);
    background: var(--surface-muted);
    border: 1px solid var(--border);
    margin-bottom: 0.9rem;
}

.profile-avatar-lg {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--accent);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 1.35rem;
    flex-shrink: 0;
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.profile-details strong {
    font-size: 0.95rem;
    color: var(--text);
}

.profile-details span {
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.profile-badge {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 0.68rem !important;
    font-weight: 600;
    color: var(--accent) !important;
    background: var(--accent-soft);
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    width: fit-content;
}

@media (max-width: 680px) {
    /* Release fixed-position containing block so .main-nav anchors to the viewport */
    .topbar {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: var(--surface);
    }
    .topbar-inner {
        height: auto;
        padding-top: 0.55rem;
        padding-bottom: 0.55rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .brand {
        order: 1;
    }
    .topbar-actions {
        order: 2;
        margin-inline-start: auto;
        gap: 0.32rem;
    }
    .icon-btn {
        height: 32px;
        padding: 0 0.52rem;
        font-size: 0.73rem;
    }
    .net-badge {
        padding: 0.18rem 0.45rem;
        font-size: 0.66rem;
    }
    .main-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        margin: 0;
        border-radius: 0;
        border: none;
        border-top: 1px solid var(--border);
        background: color-mix(in srgb, var(--surface) 92%, transparent);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        display: flex;
        justify-content: space-around;
        align-items: center;
        gap: 0.2rem;
        padding: 0.5rem 0.4rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
        z-index: 900;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
    }
    .nav-tab {
        flex: 1 1 0;
        min-width: 0;
        min-height: 44px;
        justify-content: center;
        padding: 0.4rem 0.2rem;
        font-size: 0.75rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        border-radius: 12px;
    }
    main.main-content {
        padding-top: 0.85rem;
        padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
    }
    .site-footer {
        padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
    }
    /* Keep bottom-sheet modals & toasts above / clear of the 900-level nav */
    .modal-backdrop {
        z-index: 950;
    }
    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
        align-items: center;
    }
    .purpose-card {
        padding: 0.95rem 1rem;
        gap: 0.75rem;
    }
    .purpose-content {
        min-width: 100%;
    }
    .purpose-content h1 {
        font-size: 1.32rem;
    }
    .purpose-content p {
        font-size: 0.78rem;
    }
    .timings-strip {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.35rem;
    }
    .modal-backdrop {
        align-items: flex-end;
        padding: 0;
    }
    .modal-dialog {
        max-width: 100%;
        width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding: 1.25rem 1.1rem calc(1.4rem + env(safe-area-inset-bottom));
        max-height: 92vh;
        overflow-y: auto;
        overflow-x: hidden;
    }
    .auth-modal-actions {
        flex-direction: column-reverse;
    }
    .auth-modal-actions .btn {
        width: 100%;
        padding: 0.68rem 1rem;
    }
    .qibla-grid,
    .kpi-row,
    .form-row-2 {
        grid-template-columns: 1fr 1fr;
    }
    .qibla-grid {
        grid-template-columns: 1fr;
    }
    .purpose-actions {
        align-items: flex-start;
        width: 100%;
    }
    .prayer-row {
        flex-direction: column;
        align-items: stretch;
        padding: 0.68rem 0.15rem;
        gap: 0.5rem;
    }
    .prayer-info {
        width: 100%;
        justify-content: space-between;
    }
    .status-pills {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        width: 100%;
        padding: 0.18rem;
        gap: 0.18rem;
    }
    .status-btn {
        text-align: center;
        padding: 0.42rem 0.2rem;
        font-size: 0.72rem;
        white-space: nowrap;
    }
}

/* ==========================================================================
   ACCESSIBILITY: RESPECT REDUCED MOTION PREFERENCE
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .tab-panel,
    .tab-panel.active,
    .tab-panel.active.tab-entering,
    .modal-dialog,
    .adhkar-card {
        transform: none !important;
        opacity: 1 !important;
    }
}
