/*
 * Adhan Display
 * One stylesheet for the whole app.
 *
 * 1. Fonts          5. Layout and shell     9. Prayer page
 * 2. Tokens         6. Components          10. Quran
 * 3. Base           7. Home                11. Hadith, Islamic, Settings
 * 4. Typography     8. Timeline            12. Display mode, print, motion
 */

/* 1. Fonts (self-hosted, SIL Open Font License) -------------------------- */

@font-face {
    font-family: "Manrope";
    src: url("../fonts/manrope.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Marcellus";
    src: url("../fonts/marcellus.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Amiri Quran";
    src: url("../fonts/amiri-quran.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+25CC;
}

/* Cyrillic letters for Russian; only downloaded when the page uses them. */
@font-face {
    font-family: "Manrope";
    src: url("../fonts/manrope-cyrillic.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* 2. Tokens -------------------------------------------------------------- */

:root,
[data-theme="dark"] {
    color-scheme: dark;

    --bg: #14110d;
    --bg-glow: rgba(227, 191, 104, 0.07);
    --panel: #1c1813;
    --panel-2: #241f18;
    --panel-3: #2d271e;
    --line: rgba(231, 201, 133, 0.11);
    --line-strong: rgba(231, 201, 133, 0.22);

    --text: #f2ead9;
    --text-2: #cdbfa6;
    --muted: #9b8f79;

    --gold: #e3bf68;
    --gold-bright: #f6dc98;
    --gold-deep: #a87b2e;
    --gold-soft: rgba(227, 191, 104, 0.11);
    --gold-line: rgba(227, 191, 104, 0.45);
    --on-gold: #21180a;

    --sage: #9cc292;
    --sage-soft: rgba(156, 194, 146, 0.13);
    --danger: #ec9c88;
    --danger-soft: rgba(236, 156, 136, 0.12);

    --sky-night: #2a2419;
    --sky-dawn: #6a532f;
    --sky-day: #c9a252;

    --heat-0: #29231b;
    --heat-1: #4a3b22;
    --heat-2: #6b5227;
    --heat-3: #8e6c2c;
    --heat-4: #b88d39;
    --heat-5: #e3bf68;

    --shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.75);
    --overlay: rgba(8, 6, 4, 0.72);
    --topbar-bg: rgba(20, 17, 13, 0.82);
}

[data-theme="light"] {
    color-scheme: light;

    --bg: #ecebe7;
    --bg-glow: rgba(176, 132, 46, 0.08);
    --panel: #fbfaf8;
    --panel-2: #f2f0eb;
    --panel-3: #e7e3db;
    --line: rgba(66, 52, 28, 0.11);
    --line-strong: rgba(66, 52, 28, 0.2);

    --text: #1d1912;
    --text-2: #463e31;
    --muted: #6b604f;

    --gold: #855e17;
    --gold-bright: #b8862d;
    --gold-deep: #6e4c10;
    --gold-soft: rgba(160, 116, 30, 0.1);
    --gold-line: rgba(143, 101, 25, 0.45);
    --on-gold: #fffbf2;

    --sage: #3f7038;
    --sage-soft: rgba(63, 112, 56, 0.11);
    --danger: #b0442b;
    --danger-soft: rgba(176, 68, 43, 0.1);

    --sky-night: #d5d0c6;
    --sky-dawn: #e3c98f;
    --sky-day: #f1d998;

    --heat-0: #e3dfd6;
    --heat-1: #ecd9ae;
    --heat-2: #ddbe78;
    --heat-3: #c9a04b;
    --heat-4: #a87d2c;
    --heat-5: #7d5a17;

    --shadow: 0 20px 40px -28px rgba(60, 45, 20, 0.35);
    --overlay: rgba(30, 24, 16, 0.45);
    --topbar-bg: rgba(236, 235, 231, 0.85);
}

:root {
    --font-ui: "Manrope", "Amiri Quran", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "Marcellus", "Cormorant Garamond", Georgia, serif;
    --font-arabic: "Amiri Quran", "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", serif;

    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --page-width: 1180px;
    --gutter: clamp(16px, 4vw, 32px);
    --tabbar-height: 64px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

html[data-size="compact"] { font-size: 93.75%; }
html[data-size="large"] { font-size: 112.5%; }

/* 3. Base ---------------------------------------------------------------- */

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

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

body {
    margin: 0;
    overflow-x: clip;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--bg);
    background-image: radial-gradient(90% 60% at 50% -12%, var(--bg-glow), transparent 70%);
    background-repeat: no-repeat;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 1rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration-color: var(--gold-line);
    text-underline-offset: 3px;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.view:focus {
    outline: none;
}

[hidden] {
    display: none !important;
}

::selection {
    background: var(--gold-soft);
    color: var(--text);
}

mark {
    background: var(--gold-soft);
    color: var(--gold);
    border-radius: 3px;
    padding: 0 2px;
}

.icon {
    flex-shrink: 0;
}

.tnum {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

.ampm {
    margin-left: 0.2em;
    font-size: 0.55em;
    font-family: var(--font-ui);
    letter-spacing: 0.02em;
    vertical-align: 0.15em;
}

.muted { color: var(--muted); }

.num {
    font-family: var(--font-ui);
    font-weight: 300;
}
.small { font-size: 0.875rem; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* 4. Typography --------------------------------------------------------- */

/* Arabic text inside the page (Quran, du'a, prayer names). The html element
   itself can be lang="ar" for the Arabic interface, which uses --font-ui. */
:not(html)[lang="ar"] {
    font-family: var(--font-arabic);
    font-weight: 400;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 8px 0 24px;
}

.page-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
    line-height: 1.1;
    letter-spacing: 0.005em;
}

.page-lead {
    margin: 8px 0 0;
    max-width: 62ch;
    color: var(--text-2);
}

.page-actions {
    display: flex;
    gap: 8px;
}

.section {
    margin-top: 40px;
}

.section-title {
    margin: 0 0 14px;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.5rem;
}

.panel-title {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: 0.005em;
}

.panel-meta {
    color: var(--muted);
    font-size: 0.875rem;
}

.panel-note,
.field-hint {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.source {
    margin: 10px 0 0;
    color: var(--gold);
    font-size: 0.875rem;
    font-weight: 600;
}

.fine-print {
    margin: 28px 0 0;
    color: var(--muted);
    font-size: 0.8125rem;
    max-width: 70ch;
}

.quote {
    margin: 12px 0 0;
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--text);
}

/* 5. Layout and shell ---------------------------------------------------- */

#app {
    min-height: 100vh;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 100;
    padding: 10px 14px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--gold);
    color: var(--on-gold);
    font-weight: 700;
}

.skip-link:focus {
    top: 12px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px var(--gutter);
    padding-top: max(12px, env(safe-area-inset-top));
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--line);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    backdrop-filter: saturate(140%) blur(14px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.brand img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.topnav {
    display: none;
    gap: 4px;
    margin: 0 auto;
}

.topnav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s;
}

.topnav-link .icon {
    opacity: 0.7;
}

.topnav-link:hover {
    color: var(--text);
    background: var(--panel-2);
}

.topnav-link.is-active {
    color: var(--gold);
    background: var(--gold-soft);
}

.topnav-link.is-active .icon {
    opacity: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.place-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 210px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--text-2);
    font-size: 0.875rem;
    font-weight: 600;
}

.place-button span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.place-button:hover {
    border-color: var(--line-strong);
    color: var(--text);
}

.view {
    display: block;
    width: 100%;
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 20px var(--gutter) 48px;
}

.site-footer {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 24px var(--gutter) calc(var(--tabbar-height) + 40px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.8125rem;
}

.site-footer p {
    margin: 4px 0;
}

.site-footer a {
    margin-right: 14px;
    color: var(--text-2);
}

.tabbar {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--topbar-bg);
    border-top: 1px solid var(--line);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    backdrop-filter: saturate(140%) blur(14px);
}

.tab-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    text-decoration: none;
}

.tab-link.is-active {
    color: var(--gold);
}

.banner-slot:empty {
    display: none;
}

.banner {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: var(--page-width);
    margin: 12px auto 0;
    padding: 10px 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--panel-2);
    color: var(--text-2);
    font-size: 0.9375rem;
    width: calc(100% - 2 * var(--gutter));
}

.banner span {
    flex: 1;
}

.banner-adhan {
    border-color: var(--gold-line);
    background: var(--gold-soft);
    color: var(--text);
}

.banner-adhan .icon {
    color: var(--gold);
}

@media (min-width: 900px) {
    .topnav { display: flex; }
    .tabbar { display: none; }
    .site-footer { padding-bottom: 40px; }
}

@media (max-width: 520px) {
    .place-button span { display: none; }
    .place-button { width: 40px; padding: 0; justify-content: center; }
    .brand-name { font-size: 1.125rem; }
}

/* 6. Components ---------------------------------------------------------- */

.panel {
    position: relative;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
}

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

.panel-foot {
    display: inline-flex;
    margin-top: 14px;
    color: var(--gold);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
}

.panel-foot:hover {
    text-decoration: underline;
}

.stack {
    display: grid;
    gap: 16px;
    align-content: start;
}

.two-col {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

@media (min-width: 860px) {
    .two-col { grid-template-columns: 1.2fr 1fr; }
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    font-weight: 700;
    font-size: 0.9375rem;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.button:active:not(:disabled) {
    transform: translateY(1px);
}

.button:disabled {
    opacity: 0.45;
}

.button-primary {
    background: var(--gold);
    color: var(--on-gold);
}

.button-primary:hover:not(:disabled) {
    background: var(--gold-bright);
}

.button-ghost {
    border-color: var(--line-strong);
    color: var(--text);
}

.button-ghost:hover:not(:disabled) {
    border-color: var(--gold-line);
    background: var(--gold-soft);
}

.button-danger {
    background: var(--danger);
    color: var(--on-gold);
}

.button-danger-ghost {
    border-color: var(--danger-soft);
    color: var(--danger);
}

.button-danger-ghost:hover {
    background: var(--danger-soft);
}

.button-small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.875rem;
    border-color: var(--gold-line);
    color: var(--text);
}

.button-block {
    width: 100%;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text-2);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.icon-button:hover:not(:disabled) {
    background: var(--panel-2);
    color: var(--text);
}

.icon-button:disabled {
    opacity: 0.35;
}

.icon-button.is-on {
    color: var(--gold);
}

.link-button,
.text-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 2px;
    border: 0;
    background: none;
    color: var(--gold);
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
}

.link-button:hover,
.text-button:hover {
    text-decoration: underline;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--text-2);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.chip:hover {
    color: var(--text);
    border-color: var(--gold-line);
}

.chip.is-on {
    border-color: var(--gold-line);
    background: var(--gold-soft);
    color: var(--gold);
}

.chip-quiet {
    border-color: var(--line);
    color: var(--muted);
}

.chips-scroll {
    display: flex;
    gap: 8px;
    margin: 0 calc(-1 * var(--gutter)) 20px;
    padding: 2px var(--gutter) 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.chips-scroll::-webkit-scrollbar {
    display: none;
}

.badge {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--sage-soft);
    color: var(--sage);
    font-size: 0.8125rem;
    font-weight: 700;
}

.count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--panel-3);
    font-size: 0.8125rem;
}

.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-2);
}

.segment {
    min-height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-2);
    font-size: 0.9rem;
    font-weight: 600;
}

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

.segment.is-active {
    background: var(--panel);
    color: var(--gold);
    box-shadow: 0 0 0 1px var(--line-strong);
}

.tabs {
    display: flex;
    gap: 4px;
    margin: 0 0 24px;
    padding-bottom: 1px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
}

.tab {
    position: relative;
    padding: 10px 14px 12px;
    color: var(--muted);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

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

.tab.is-active {
    color: var(--text);
}

.tab.is-active::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -2px;
    height: 2px;
    border-radius: 2px;
    background: var(--gold);
}

/* Form controls */

.input,
.select,
.search-field input,
.filter-field input,
.goto input,
.search-bar input {
    height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--panel-2);
    color: var(--text);
}

.select {
    width: 100%;
    padding: 0 40px 0 14px;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 20px) 19px, calc(100% - 15px) 19px;
    background-size: 5px 5px;
    background-repeat: no-repeat;
}

.input {
    padding: 0 14px;
    font: inherit;
}

.input-time {
    width: auto;
    min-width: 140px;
    color-scheme: dark;
}

[data-theme="light"] .input-time {
    color-scheme: light;
}

.select:focus,
input:focus {
    border-color: var(--gold-line);
    outline: none;
    box-shadow: 0 0 0 3px var(--gold-soft);
}

.field {
    margin-top: 18px;
}

.field:first-of-type {
    margin-top: 6px;
}

.field-label {
    display: block;
    margin: 18px 0 8px;
    color: var(--text-2);
    font-size: 0.875rem;
    font-weight: 700;
}

.field > .field-label {
    margin-top: 0;
}

.field-error {
    margin: 10px 0 0;
    color: var(--danger);
    font-size: 0.875rem;
}

.search-field,
.filter-field {
    position: relative;
}

.search-field .icon,
.filter-field .icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.search-field input,
.filter-field input {
    width: 100%;
    padding: 0 14px 0 40px;
}

.filter-field {
    max-width: 420px;
    margin-bottom: 16px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    margin-bottom: 20px;
}

.search-bar > .icon {
    position: absolute;
    left: 14px;
    color: var(--muted);
    pointer-events: none;
}

.search-bar input {
    flex: 1;
    min-width: 0;
    padding: 0 14px 0 40px;
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    font-weight: 600;
    cursor: pointer;
}

.switch-row small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.45;
}

.switch {
    position: relative;
    flex-shrink: 0;
    width: 46px;
    height: 28px;
    margin: 0;
    border-radius: 999px;
    background: var(--panel-3);
    border: 1px solid var(--line-strong);
    appearance: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-2);
    transition: transform 0.2s var(--ease), background-color 0.2s;
}

.switch:checked {
    background: var(--gold);
    border-color: var(--gold);
}

.switch:checked::after {
    transform: translateX(18px);
    background: var(--on-gold);
}

.range {
    width: 100%;
    accent-color: var(--gold);
}

input[type="range"] {
    accent-color: var(--gold);
}

.check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
}

.check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--gold);
}

.check:has(input:checked) {
    border-color: var(--gold-line);
    background: var(--gold-soft);
}

.stepper {
    display: inline-grid;
    grid-template-columns: 1fr auto 48px auto;
    align-items: center;
    gap: 4px;
    padding: 4px 4px 4px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-2);
}

.stepper .icon-button {
    width: 34px;
    height: 34px;
}

.stepper-label {
    font-weight: 600;
    font-size: 0.9375rem;
}

.stepper-value {
    text-align: center;
    font-weight: 700;
}

.steppers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
}

.inline-controls {
    display: flex;
    gap: 8px;
}

.inline-controls .select {
    flex: 1;
}

.range-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.range-row input {
    flex: 1;
}

.range-small { font-size: 1rem; }
.range-large { font-size: 1.6rem; }

.note {
    display: flex;
    gap: 10px;
    margin: 18px 0 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--panel-2);
    color: var(--text-2);
    font-size: 0.875rem;
}

.note .icon {
    margin-top: 2px;
    color: var(--gold);
}

/* Dialog */

.dialog {
    width: min(480px, calc(100% - 24px));
    max-height: min(86vh, 760px);
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow);
}

.dialog-wide {
    width: min(760px, calc(100% - 24px));
}

.dialog-small {
    width: min(360px, calc(100% - 24px));
}

.dialog::backdrop {
    background: var(--overlay);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.dialog[open] {
    display: flex;
    flex-direction: column;
    animation: dialog-in 0.22s var(--ease);
}

@keyframes dialog-in {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
}

.dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 8px 22px;
}

.dialog-title {
    margin: 0;
    font-weight: 700;
    font-size: 1.1875rem;
}

.dialog-body {
    padding: 4px 22px 24px;
    overflow-y: auto;
}

.dialog-text {
    margin: 0 0 16px;
    color: var(--text-2);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.place-results {
    margin-top: 8px;
}

.place-list {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.place-list li {
    display: flex;
    align-items: center;
    gap: 4px;
}

.place-option {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-height: 52px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    text-align: left;
}

.place-option:hover {
    background: var(--panel-2);
    border-color: var(--line);
}

.place-option .icon {
    color: var(--gold);
}

.place-option small {
    display: block;
    color: var(--muted);
    font-size: 0.8125rem;
}

/* Toast */

.toast-region {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tabbar-height) + 16px + env(safe-area-inset-bottom));
    z-index: 60;
    width: min(520px, calc(100% - 24px));
    transform: translateX(-50%);
    pointer-events: none;
}

.has-player .toast-region {
    bottom: calc(var(--tabbar-height) + 96px + env(safe-area-inset-bottom));
}

.toast {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: var(--panel-3);
    color: var(--text);
    font-weight: 600;
    font-size: 0.9375rem;
    box-shadow: var(--shadow);
    pointer-events: auto;
    animation: toast-in 0.25s var(--ease);
}

.toast span {
    flex: 1;
}

.toast-action {
    border: 0;
    background: none;
    color: var(--gold);
    font-weight: 800;
}

.toast-actions {
    display: flex;
    flex: none;
    gap: 6px;
}

.toast .toast-actions {
    flex: none;
}

/* Two choices (for example "On time" / "Late"): small pill buttons. */
.toast-choice {
    flex-wrap: wrap;
    row-gap: 10px;
}

.toast-choice > span:first-child {
    min-width: 55%;
}

.toast-choice .toast-action {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--text);
    font-size: 0.875rem;
}

.toast-choice .toast-action.is-primary {
    border-color: var(--gold-line);
    background: var(--gold-soft);
    color: var(--gold);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
}

@media (min-width: 900px) {
    .toast-region { bottom: 24px; }
    .has-player .toast-region { bottom: 110px; }
}

/* Loading, empty */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 16px;
    color: var(--muted);
}

.spinner {
    width: 22px;
    height: 22px;
    border: 2px solid var(--line-strong);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-small {
    width: 16px;
    height: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    border-radius: 10px;
    background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2));
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-title { width: 50%; height: 48px; margin: 16px 0; }
.skeleton-time { width: 40%; height: 80px; }
.skeleton-row { height: 44px; margin-bottom: 8px; }
.skeleton-text { height: 18px; margin-top: 12px; }
.skeleton-text.short { width: 60%; }

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

.empty {
    padding: 32px 16px;
    text-align: center;
}

.empty-title {
    margin: 0;
    font-weight: 700;
    font-size: 1.0625rem;
}

.empty-text {
    margin: 8px auto 16px;
    max-width: 46ch;
    color: var(--muted);
}

/* Lists of facts */

.facts {
    display: grid;
    gap: 0;
    margin: 0;
}

.facts div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.facts div:first-child {
    border-top: 0;
}

.facts dt {
    color: var(--text-2);
}

.facts dd {
    margin: 0;
    font-weight: 700;
    text-align: right;
}

/* 7. Home ---------------------------------------------------------------- */

.setup {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding: 18px 20px;
    border: 1px solid var(--gold-line);
    border-radius: var(--radius-lg);
    background: var(--gold-soft);
}

.setup-title {
    margin: 0 0 2px;
    font-size: 1.0625rem;
}

.setup p {
    margin: 0;
    color: var(--text-2);
}

.home-top {
    display: grid;
    gap: 16px;
}

@media (min-width: 920px) {
    .home-top { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); }
}

.hero {
    position: relative;
    overflow: hidden;
    padding: clamp(22px, 4vw, 40px);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-xl);
    background: linear-gradient(170deg, var(--panel-2), var(--panel) 60%);
    isolation: isolate;
}

/* The backlit glow, echoing the logo. */
.hero::before {
    content: "";
    position: absolute;
    z-index: -1;
    width: 640px;
    height: 460px;
    left: -140px;
    top: 90px;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(246, 220, 152, 0.13), rgba(227, 191, 104, 0.05) 55%, transparent);
    pointer-events: none;
}

[data-theme="light"] .hero::before {
    background: radial-gradient(closest-side, rgba(214, 170, 76, 0.2), rgba(214, 170, 76, 0.06) 55%, transparent);
}

.hero-empty {
    min-height: 320px;
}

.hero-error {
    grid-column: 1 / -1;
    min-height: 0;
}

.hero-error-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
}

.hero-error .hero-note {
    max-width: 60ch;
    margin: 10px 0 20px;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    color: var(--text-2);
    font-size: 0.9375rem;
    font-weight: 600;
}

.hero-hijri {
    color: var(--gold);
}

.hero-local {
    color: var(--muted);
}

.hero-label {
    margin: 28px 0 4px;
    color: var(--muted);
    font-weight: 600;
}

.hero-name {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 18px;
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.5rem, 1.6rem + 3.6vw, 4rem);
    line-height: 1.05;
}

.hero-arabic {
    color: var(--gold);
    font-size: 0.62em;
    line-height: 1;
}

.hero-time {
    margin: 4px 0 0;
    font-weight: 300;
    font-size: clamp(4.25rem, 2.6rem + 7vw, 7.5rem);
    line-height: 1.02;
    letter-spacing: -0.035em;
    background: linear-gradient(180deg, var(--gold-bright) 10%, var(--gold) 50%, var(--gold-deep) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 28px rgba(227, 191, 104, 0.2));
}

.hero-time .ampm {
    color: var(--gold);
    -webkit-text-fill-color: currentColor;
}

[data-theme="light"] .hero-time {
    filter: none;
}

.hero-note {
    color: var(--text-2);
}

.hero-countdown {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 14px;
    margin: 14px 0 0;
    font-size: 1.1875rem;
    font-weight: 600;
}

.hero-countdown-exact {
    color: var(--muted);
    font-size: 1rem;
    font-weight: 500;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
}

.times-panel {
    display: flex;
    flex-direction: column;
}

.times {
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.time-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto 40px;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 6px 4px 6px 14px;
    border: 1px solid transparent;
    border-radius: 14px;
}

.time-name {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.time-label {
    font-weight: 700;
    font-size: 1.0625rem;
}

.time-arabic {
    color: var(--muted);
    font-size: 1.125rem;
    line-height: 1;
}

.time-value {
    font-size: 1.3125rem;
    font-weight: 600;
    text-align: right;
}

.time-flag,
.time-flag-space {
    min-width: 46px;
}

.time-flag {
    justify-self: end;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--gold);
    color: var(--on-gold);
    font-size: 0.75rem;
    font-weight: 800;
    text-align: center;
}

.time-flag-now {
    background: var(--panel-3);
    color: var(--text-2);
}

.time-row.is-next {
    border-color: var(--gold-line);
    background: var(--gold-soft);
}

.time-row.is-next .time-value {
    color: var(--gold);
}

.time-row.is-passed .time-label,
.time-row.is-passed .time-value {
    color: var(--muted);
}

.bell {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
}

.bell:hover {
    background: var(--panel-2);
}

.bell.is-on {
    color: var(--gold);
}

.bell-space {
    width: 40px;
}

.home-row {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

@media (min-width: 700px) {
    .home-row { grid-template-columns: 1fr 1fr; }
    .home-row .tracker-panel { grid-column: 1 / -1; }
}

@media (min-width: 1040px) {
    .home-row { grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr) minmax(0, 1.2fr); }
    .home-row .tracker-panel { grid-column: auto; }
}

.pray-chips {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.pray-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: var(--panel-2);
    color: var(--text-2);
    font-size: 0.8125rem;
    font-weight: 700;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.pray-check {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 1.5px solid var(--line-strong);
    border-radius: 50%;
    color: transparent;
    transition: inherit;
}

.pray-chip:hover:not(:disabled) {
    border-color: var(--gold-line);
}

.pray-chip.is-done {
    border-color: var(--sage);
    background: var(--sage-soft);
    color: var(--text);
}

.pray-chip.is-done .pray-check {
    border-color: var(--sage);
    background: var(--sage);
    color: var(--panel);
}

/* Press and hold opens the on time / late choice, so no text selection or callout. */
.pray-chip {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.pray-chip.is-held {
    transform: scale(0.96);
    border-color: var(--gold-line);
}

.chips-hint {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.8125rem;
    text-align: center;
}

.status-options {
    display: grid;
    gap: 8px;
}

.status-option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: var(--panel-2);
    color: var(--text);
    font-weight: 700;
    text-align: start;
}

.status-option.is-active {
    border-color: var(--gold-line);
    background: var(--gold-soft);
    color: var(--gold);
}

/* Prayed, but late: gold instead of green, with a clock. */
.pray-chip.is-late {
    border-color: var(--gold-line);
    background: var(--gold-soft);
}

.pray-chip.is-late .pray-check {
    border-color: var(--gold);
    background: var(--gold);
}

.pray-chip:disabled {
    opacity: 0.45;
}

.pray-chips-large .pray-chip {
    padding: 16px 4px 14px;
    font-size: 0.9375rem;
}

.pray-chips-large .pray-check {
    width: 32px;
    height: 32px;
}

.qibla-panel {
    display: flex;
    align-items: center;
    gap: 18px;
    text-decoration: none;
}

.qibla-panel:hover {
    border-color: var(--line-strong);
}

.qibla-panel .panel-title {
    display: block;
}

.qibla-distance {
    display: block;
    color: var(--muted);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.qibla-degrees {
    display: block;
    font-weight: 300;
    font-size: 2.25rem;
    line-height: 1.1;
    color: var(--gold);
}

.mini-compass {
    position: relative;
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    flex-shrink: 0;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: radial-gradient(circle, var(--panel-2) 55%, var(--panel) 100%);
}

.mini-compass-n {
    position: absolute;
    top: 4px;
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 800;
}

.mini-compass-needle {
    display: grid;
    place-items: center;
    color: var(--gold);
}

.insight-panel {
    display: grid;
    gap: 4px;
    padding: 12px;
}

.insight {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    text-decoration: none;
}

a.insight:hover {
    background: var(--panel-2);
}

.insight-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    background: var(--gold-soft);
    color: var(--gold);
}

.insight strong {
    display: block;
    font-size: 0.9375rem;
}

.insight-text {
    display: block;
    color: var(--muted);
    font-size: 0.875rem;
    line-height: 1.45;
}

.reading {
    display: grid;
    gap: 16px;
    margin-top: 16px;
    align-items: start;
}

@media (min-width: 900px) {
    .reading { grid-template-columns: 1.3fr 1fr; }
}

.ayah-panel .ayah-arabic {
    margin: 14px 0 0;
    font-size: 1.75rem;
    line-height: 2;
    text-align: right;
}

.ayah-panel .ayah-translation {
    margin: 8px 0 0;
    color: var(--text-2);
    font-size: 1.0625rem;
    line-height: 1.6;
}

.shahada {
    margin: 56px auto 8px;
    max-width: 760px;
    text-align: center;
}

.shahada-arabic {
    margin: 0;
    color: var(--gold);
    font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.4rem);
    line-height: 1.9;
}

.shahada-meaning {
    margin: 6px auto 0;
    max-width: 56ch;
    color: var(--muted);
    font-size: 0.9375rem;
}

/* 8. Timeline ------------------------------------------------------------ */

.timeline {
    position: relative;
    height: 58px;
    margin: 30px 2px 0;
}

.tl-track {
    position: absolute;
    left: 0;
    right: 0;
    top: 14px;
    height: 6px;
    border-radius: 6px;
    opacity: 0.9;
}

.tl-mark {
    position: absolute;
    top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
}

.tl-dot {
    width: 14px;
    height: 14px;
    border: 2px solid var(--panel);
    border-radius: 50%;
    background: var(--text-2);
}

.tl-mark.is-passed .tl-dot {
    background: var(--muted);
}

.tl-mark.is-next .tl-dot {
    background: var(--gold);
    box-shadow: 0 0 0 4px var(--gold-soft);
}

.tl-label {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 700;
    white-space: nowrap;
}

.tl-mark.is-low .tl-label {
    margin-top: 20px;
}

.tl-mark.is-next .tl-label {
    color: var(--gold);
}

.tl-now {
    position: absolute;
    top: 4px;
    width: 3px;
    height: 26px;
    margin-left: -1.5px;
    border-radius: 3px;
    background: var(--text);
    box-shadow: 0 0 12px var(--gold);
}

/* 9. Prayer page --------------------------------------------------------- */

.prayer-today {
    display: grid;
    gap: 16px;
    align-items: start;
}

@media (min-width: 900px) {
    .prayer-today { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
}

.month-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.month-title {
    margin: 0;
    min-width: 170px;
    font-weight: 700;
    font-size: 1.25rem;
    text-align: center;
}

.month-print {
    margin-left: auto;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
}

.month-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.month-table th,
.month-table td {
    padding: 10px 12px;
    text-align: right;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
}

.month-table thead th {
    position: sticky;
    top: 0;
    background: var(--panel-2);
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 700;
}

.month-table tbody th {
    position: sticky;
    left: 0;
    background: var(--panel);
    text-align: left;
    font-weight: 600;
}

.month-table th:first-child {
    text-align: left;
}

.month-table .col-hijri {
    color: var(--muted);
    text-align: left;
}

.month-table td {
    font-variant-numeric: tabular-nums;
}

.month-table tr.is-friday th {
    color: var(--gold);
}

.month-table tr.is-today th,
.month-table tr.is-today td {
    background: var(--gold-soft);
    color: var(--text);
    font-weight: 700;
}

.month-table tr.is-today th {
    box-shadow: inset 3px 0 0 var(--gold);
}

.month-table tbody tr:last-child th,
.month-table tbody tr:last-child td {
    border-bottom: 0;
}

.print-only {
    display: none;
}

/* Qibla */

.qibla {
    display: grid;
    gap: 28px;
    align-items: center;
    justify-items: center;
}

@media (min-width: 820px) {
    .qibla { grid-template-columns: auto minmax(0, 1fr); justify-items: start; }
}

.compass {
    position: relative;
    width: min(340px, 82vw);
    aspect-ratio: 1;
}

.dial {
    position: absolute;
    inset: 0;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: radial-gradient(circle, var(--panel-2) 0 58%, var(--panel) 100%);
    transition: transform 0.25s linear;
}

.dial-tick {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 50%;
    margin-left: -0.5px;
    transform-origin: 50% 100%;
}

.dial-tick::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 0;
    width: 1px;
    height: 6px;
    background: var(--line-strong);
}

.dial-tick.is-mid::before {
    height: 10px;
    background: var(--muted);
}

.dial-tick.is-major::before {
    height: 14px;
    width: 2px;
    left: -0.5px;
    background: var(--text-2);
}

.dial-letter {
    position: absolute;
    color: var(--text-2);
    font-weight: 800;
    font-size: 0.9375rem;
}

.dial-n { top: 28px; left: 50%; transform: translateX(-50%); color: var(--gold); }
.dial-s { bottom: 28px; left: 50%; transform: translateX(-50%); }
.dial-e { right: 30px; top: 50%; transform: translateY(-50%); }
.dial-w { left: 30px; top: 50%; transform: translateY(-50%); }

.qibla-pointer {
    position: absolute;
    left: 50%;
    top: 0;
    width: 0;
    height: 50%;
    transform-origin: 50% 100%;
}

.qibla-pointer-line {
    position: absolute;
    left: -1.5px;
    top: 52px;
    bottom: 0;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--gold), transparent);
}

.qibla-pointer-head {
    position: absolute;
    top: 18px;
    left: -17px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(227, 191, 104, 0.35);
}

.compass-top {
    position: absolute;
    left: 50%;
    top: -12px;
    width: 0;
    height: 0;
    margin-left: -8px;
    border: 8px solid transparent;
    border-top-color: var(--text-2);
    display: none;
}

.qibla.is-live .compass-top {
    display: block;
}

.qibla.is-aligned .dial {
    box-shadow: 0 0 0 3px var(--gold), 0 0 40px rgba(227, 191, 104, 0.35);
}

.qibla-info {
    max-width: 520px;
}

.qibla-bearing {
    margin: 0;
    font-weight: 300;
    letter-spacing: -0.03em;
    font-size: clamp(3.5rem, 2.5rem + 4vw, 5rem);
    line-height: 1;
    color: var(--gold);
}

.qibla-sub {
    margin: 6px 0 0;
    color: var(--text-2);
}

.qibla-status {
    margin: 16px 0 0;
    font-weight: 600;
}

/* Tracker */

.tracker {
    display: grid;
    gap: 16px;
    align-items: start;
}

@media (min-width: 980px) {
    .tracker { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
    .tracker > :first-child { grid-row: span 1; }
}

.day-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.day-title-wrap {
    flex: 1;
    text-align: center;
}

.day-title-wrap .panel-meta {
    display: block;
}

.extras {
    margin-top: 16px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.stat {
    padding: 12px 10px;
    border-radius: 14px;
    background: var(--panel-2);
    text-align: center;
}

.stat-value {
    display: block;
    font-weight: 300;
    font-size: 1.875rem;
    line-height: 1.1;
    color: var(--gold);
}

.stat-label {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
}

@media (max-width: 420px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.heatmap {
    display: grid;
    grid-template-columns: repeat(14, minmax(0, 1fr));
    gap: 4px;
    margin-top: 18px;
}

.heat {
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: var(--heat-0);
}

.heat-1 { background: var(--heat-1); }
.heat-2 { background: var(--heat-2); }
.heat-3 { background: var(--heat-3); }
.heat-4 { background: var(--heat-4); }
.heat-5 { background: var(--heat-5); }
.heat-x { background: repeating-linear-gradient(45deg, var(--heat-0) 0 3px, var(--panel-3) 3px 6px); }

button.heat:hover,
.heat.is-selected {
    outline: 2px solid var(--text-2);
    outline-offset: 1px;
}

.heat-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.75rem;
}

.heat-legend .heat {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.heat-legend span:first-child { margin-right: 4px; }
.heat-legend span:last-child { margin-left: 4px; }

.bars {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.bar-row {
    display: grid;
    grid-template-columns: 70px 1fr 44px;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    font-weight: 600;
}

.bar-row > :last-child {
    text-align: right;
    color: var(--muted);
}

.bar {
    height: 8px;
    border-radius: 8px;
    background: var(--panel-3);
    overflow: hidden;
}

.bar span {
    display: block;
    height: 100%;
    border-radius: 8px;
    background: var(--gold);
}

/* On time and late side by side in one bar. */
.bar-split {
    display: flex;
}

.bar-split > span {
    flex: none;
    border-radius: 0;
}

.bar-split > span:first-child {
    border-start-start-radius: 8px;
    border-end-start-radius: 8px;
}

.bar-split > span:last-child {
    border-start-end-radius: 8px;
    border-end-end-radius: 8px;
}

.bar-split > .bar-late {
    background: var(--gold);
    opacity: 0.35;
}

.ontime {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--panel-2);
}

.ontime-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 0.875rem;
    font-weight: 700;
}

.ontime-head strong {
    color: var(--gold);
    font-size: 1.5rem;
    font-weight: 300;
}

.ontime-note {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.8125rem;
}

.qada {
    display: grid;
    gap: 6px;
    margin: 14px 0 6px;
    padding: 0;
    list-style: none;
}

.qada li {
    display: grid;
    grid-template-columns: 1fr auto 48px auto;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.qada-count {
    text-align: center;
    font-size: 1.125rem;
}

/* 10. Quran -------------------------------------------------------------- */

.continue {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding: 16px 18px;
    border: 1px solid var(--gold-line);
    border-radius: var(--radius-lg);
    background: var(--gold-soft);
    text-decoration: none;
}

.continue > .icon:first-child {
    color: var(--gold);
}

.continue > span {
    flex: 1;
}

.continue-label {
    display: block;
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 700;
}

.continue strong {
    font-size: 1.0625rem;
}

.segmented + [data-browse-body] {
    margin-top: 16px;
}

.surah-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.surah-card {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
    padding: 12px 16px 12px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    text-decoration: none;
    transition: border-color 0.15s, background-color 0.15s;
}

.surah-card:hover {
    border-color: var(--gold-line);
    background: var(--panel-2);
}

.surah-number {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 1px solid var(--gold-line);
    border-radius: 50%;
    color: var(--gold);
    font-size: 0.875rem;
    font-weight: 800;
}

.surah-names {
    flex: 1;
    min-width: 0;
}

.surah-names strong {
    display: block;
}

.surah-names small {
    display: block;
    color: var(--muted);
    font-size: 0.8125rem;
}

.surah-arabic {
    color: var(--gold);
    font-size: 1.5rem;
    line-height: 1.2;
}

.juz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.juz-card {
    display: grid;
    gap: 2px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    text-align: center;
    text-decoration: none;
}

.juz-card span {
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 700;
}

.juz-card strong {
    font-size: 1.625rem;
    font-weight: 300;
    color: var(--gold);
}

.juz-card:hover {
    border-color: var(--gold-line);
}

.bookmark-list,
.result-list,
.event-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bookmark {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
}

.bookmark a {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 6px;
    text-decoration: none;
}

.bookmark-arabic {
    font-size: 1.375rem;
    line-height: 1.8;
    text-align: right;
}

.bookmark-text {
    color: var(--text-2);
    font-size: 0.9375rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-results {
    margin-bottom: 20px;
}

.result {
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    color: var(--text);
    text-align: left;
    text-decoration: none;
}

.result:hover {
    border-color: var(--gold-line);
}

.result strong {
    color: var(--gold);
    font-size: 0.875rem;
}

.result span {
    color: var(--text-2);
    line-height: 1.55;
}

.result-arabic {
    font-size: 1.25rem;
    text-align: right;
}

/* Reader */

.reader {
    max-width: 860px;
    margin: 0 auto;
}

.reader-bar {
    position: sticky;
    top: calc(53px + max(12px, env(safe-area-inset-top)));
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: -20px calc(50% - 50vw) 0;
    padding: 6px max(var(--gutter), calc(50vw - 430px));
    border-bottom: 1px solid var(--line);
    background: var(--topbar-bg);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.reader-bar-title {
    flex: 1;
    overflow: hidden;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.surah-head {
    margin: 32px 0 8px;
    text-align: center;
}

.surah-arabic-name {
    margin: 0;
    color: var(--gold);
    font-size: 2.5rem;
    line-height: 1.6;
}

.surah-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 2rem;
}

.surah-meta {
    margin: 4px 0 0;
    color: var(--muted);
}

.basmala {
    margin: 24px 0 8px;
    color: var(--text);
    font-size: 2rem;
    line-height: 1.8;
    text-align: center;
}

.ayahs {
    --quran-scale: 1;
}

.juz-surah {
    margin: 40px 0 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gold-line);
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.5rem;
    color: var(--gold);
}

.ayah {
    padding: 22px 0 14px;
    border-bottom: 1px solid var(--line);
    scroll-margin-top: 140px;
    transition: background-color 0.4s;
}

.ayah-arabic {
    margin: 0;
    font-size: calc(1.875rem * var(--quran-scale));
    line-height: 2.15;
    text-align: right;
    word-spacing: 0.06em;
}

.ayah-end {
    margin-right: 0.2em;
    color: var(--gold);
    font-size: 0.95em;
}

.ayah-translation {
    margin: 10px 0 0;
    color: var(--text-2);
    font-size: 1.0625rem;
    line-height: 1.7;
    max-width: 70ch;
}

.ayah-ref {
    color: var(--gold);
    font-size: 0.8125rem;
    font-weight: 800;
    margin-right: 6px;
}

.ayah-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 8px;
}

.ayah-actions .icon-button {
    width: 36px;
    height: 36px;
    color: var(--muted);
}

.ayah-actions .icon-button.is-on {
    color: var(--gold);
}

.ayah-actions .text-button {
    padding: 4px 10px;
    font-size: 0.875rem;
    color: var(--muted);
}

.ayah-actions .text-button:hover {
    color: var(--gold);
}

.ayah.is-playing,
.ayah.is-target {
    margin: 0 -14px;
    padding-left: 14px;
    padding-right: 14px;
    border-radius: 14px;
    background: var(--gold-soft);
}

.ayah.is-playing .ayah-actions [data-ayah-play] {
    color: var(--gold);
}

.reader-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 32px 0 0;
}

.dialog-arabic {
    font-size: 1.625rem;
    line-height: 2;
    text-align: right;
}

.tafsir {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--text-2);
    line-height: 1.7;
}

.tafsir h2,
.tafsir h3,
.tafsir h4 {
    color: var(--text);
    font-size: 1.0625rem;
}

/* Player */

.player-slot:empty {
    display: none;
}

.player {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tabbar-height) + 10px + env(safe-area-inset-bottom));
    z-index: 35;
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(720px, calc(100% - 16px));
    padding: 10px 10px 10px 16px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: var(--panel-3);
    box-shadow: var(--shadow);
    transform: translateX(-50%);
}

.player-progress {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: var(--line);
}

.player-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--gold);
    transition: width 0.25s linear;
}

.player-info {
    flex: 1;
    min-width: 0;
    text-decoration: none;
}

.player-info strong,
.player-info small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-info small {
    color: var(--muted);
    font-size: 0.8125rem;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 2px;
}

.player-play {
    background: var(--gold);
    color: var(--on-gold);
    border-radius: 50%;
}

.player-play:hover:not(:disabled) {
    background: var(--gold-bright);
    color: var(--on-gold);
}

@media (max-width: 480px) {
    .player-controls [data-player="repeat"] { display: none; }
}

@media (min-width: 900px) {
    .player { bottom: 18px; }
}

.has-player .site-footer {
    padding-bottom: calc(var(--tabbar-height) + 120px + env(safe-area-inset-bottom));
}

/* 11. Hadith ------------------------------------------------------------- */

.hadith-body {
    display: grid;
    gap: 16px;
    max-width: 860px;
}

.hadith-card {
    padding: clamp(20px, 4vw, 32px);
}

.hadith-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.hadith-collection {
    margin: 0;
    color: var(--gold);
    font-weight: 700;
}

.hadith-number {
    margin: 2px 0 0;
    font-weight: 700;
    font-size: 1.5rem;
}

.hadith-tools {
    display: flex;
    gap: 4px;
}

.hadith-narrator {
    margin: 18px 0 0;
    color: var(--text-2);
    font-weight: 600;
}

.hadith-arabic {
    margin: 18px 0 0;
    font-size: 1.5rem;
    line-height: 2.1;
    text-align: right;
}

.hadith-english {
    margin: 18px 0 0;
    font-size: 1.125rem;
    line-height: 1.75;
    max-width: 68ch;
}

.hadith-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
}

.hadith-meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.875rem;
}

.hadith-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.hadith-nav .button {
    flex: 1;
}

.goto {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
}

.goto input {
    width: 120px;
    padding: 0 12px;
}

/* Islamic */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
}

.back-link:hover {
    color: var(--gold);
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

@media (min-width: 820px) {
    .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.tool-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
    text-decoration: none;
    transition: border-color 0.15s, background-color 0.15s;
}

.tool-card:hover {
    border-color: var(--gold-line);
    background: var(--panel-2);
}

.tool-icon,
.link-card-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--gold-soft);
    color: var(--gold);
}

.tool-card strong,
.link-card strong {
    display: block;
}

.tool-card small,
.link-card small {
    display: block;
    color: var(--muted);
    font-size: 0.875rem;
}

.dua-arabic {
    margin: 16px 0 0;
    font-size: 1.75rem;
    line-height: 2;
    text-align: right;
}

.dua-transliteration {
    margin: 8px 0 0;
    color: var(--text-2);
    font-style: italic;
}

.dua-meaning {
    margin: 8px 0 0;
    font-size: 1.0625rem;
}

.event {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.event:first-child {
    border-top: 0;
}

.event-when {
    min-width: 84px;
    color: var(--gold);
    font-weight: 800;
    font-size: 0.9375rem;
}

.event strong {
    display: block;
}

.event small {
    display: block;
    color: var(--muted);
    font-size: 0.875rem;
}

.event.is-today .event-when {
    color: var(--sage);
}

.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}

.link-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
    text-decoration: none;
}

.link-card > span:nth-child(2) {
    flex: 1;
}

.link-card-arrow {
    color: var(--muted);
}

.link-card:hover {
    border-color: var(--gold-line);
}

.tool-page {
    max-width: 900px;
}

.adhkar {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dhikr.is-done {
    border-color: var(--sage);
}

.dhikr-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.dhikr-title {
    margin: 0;
    font-size: 1.0625rem;
}

.dhikr-times {
    color: var(--gold);
    font-size: 0.875rem;
    font-weight: 700;
}

.dhikr-arabic {
    margin: 14px 0 0;
    font-size: 1.625rem;
    line-height: 2.1;
    text-align: right;
}

.dhikr-transliteration {
    margin: 8px 0 0;
    color: var(--text-2);
    font-style: italic;
}

.dhikr-meaning {
    margin: 8px 0 0;
}

.dhikr-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.dhikr-foot .source {
    margin: 0;
    flex: 1;
}

.counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 96px;
    min-height: 44px;
    justify-content: center;
    padding: 0 16px;
    border: 1px solid var(--gold-line);
    border-radius: 999px;
    background: var(--gold-soft);
    color: var(--gold);
    font-weight: 800;
}

.counter.is-done {
    border-color: var(--sage);
    background: var(--sage-soft);
    color: var(--sage);
}

/* Tasbih */

.tasbih {
    display: grid;
    justify-items: center;
    gap: 22px;
    margin-top: 12px;
    text-align: center;
}

.tasbih-phrase {
    margin: 0;
    color: var(--gold);
    font-size: 2.25rem;
    line-height: 1.7;
}

.tasbih-button {
    position: relative;
    display: grid;
    place-items: center;
    align-content: center;
    width: min(300px, 76vw);
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, var(--panel-3), var(--panel) 70%);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    transition: transform 0.08s;
}

.tasbih-button:active {
    transform: scale(0.97);
}

.tasbih-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-track,
.ring-fill {
    fill: none;
    stroke-width: 2;
}

.ring-track {
    stroke: var(--line-strong);
}

.ring-fill {
    stroke: var(--gold);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.2s var(--ease);
}

.tasbih-count {
    font-weight: 200;
    letter-spacing: -0.03em;
    font-size: clamp(4rem, 3rem + 6vw, 6rem);
    line-height: 1;
}

.tasbih-sub {
    margin-top: 6px;
    color: var(--muted);
    font-weight: 600;
}

.tasbih.is-complete .tasbih-button {
    box-shadow: 0 0 0 4px var(--gold), 0 0 60px rgba(227, 191, 104, 0.4);
}

/* Names */

.names-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.name-card {
    display: grid;
    gap: 2px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
    text-align: center;
}

.name-number {
    justify-self: start;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
}

.name-arabic {
    color: var(--gold);
    font-size: 2rem;
    line-height: 1.6;
}

.name-tr {
    font-size: 1rem;
}

.name-en {
    color: var(--muted);
    font-size: 0.875rem;
}

/* Ramadan and calendar */

.ramadan-count,
.ramadan-now {
    text-align: center;
    padding: clamp(24px, 5vw, 40px);
}

.ramadan-lead {
    margin: 0;
    color: var(--text-2);
}

.ramadan-date {
    margin: 4px 0 24px;
    font-weight: 300;
    font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem);
    color: var(--gold);
}

.countdown {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    max-width: 520px;
    margin: 0 auto;
}

.countdown div {
    padding: 14px 6px;
    border-radius: 14px;
    background: var(--panel-2);
}

.countdown span {
    display: block;
    font-weight: 300;
    font-size: clamp(1.8rem, 1.2rem + 2.5vw, 2.6rem);
    line-height: 1.1;
}

.countdown small {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
}

.ramadan-day {
    margin: 0 0 20px;
    font-family: var(--font-display);
    font-size: 2rem;
}

.ramadan-day .tnum {
    font-family: var(--font-ui);
    font-weight: 300;
}

.fast-bar {
    height: 12px;
    border-radius: 12px;
    background: var(--panel-3);
    overflow: hidden;
}

.fast-bar span {
    display: block;
    height: 100%;
    border-radius: 12px;
    background: linear-gradient(90deg, var(--gold-deep), var(--gold));
}

.fast-times {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

.fast-times div {
    padding: 14px;
    border-radius: 14px;
    background: var(--panel-2);
    text-align: center;
}

.fast-times div > span {
    display: block;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
}

.fast-times strong {
    display: block;
    margin-top: 2px;
    font-size: 1.5rem;
}

.tool-page .panel + .panel {
    margin-top: 16px;
}

.hijri-today {
    display: flex;
    align-items: center;
    gap: 24px;
}

.hijri-day {
    margin: 0;
    font-weight: 200;
    letter-spacing: -0.03em;
    font-size: 5rem;
    line-height: 1;
    color: var(--gold);
}

.hijri-month {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.75rem;
}

.hijri-month-ar {
    margin: 0;
    text-align: left;
    color: var(--gold);
    font-size: 1.5rem;
}

.hijri-today .muted {
    margin: 4px 0 0;
}

/* Settings */

.settings-layout {
    display: grid;
    gap: 24px;
}

.settings-nav {
    display: none;
}

@media (min-width: 960px) {
    .settings-layout { grid-template-columns: 200px minmax(0, 1fr); align-items: start; }

    .settings-nav {
        position: sticky;
        top: 90px;
        display: grid;
        gap: 2px;
    }

    .settings-nav a {
        padding: 8px 12px;
        border-radius: 10px;
        color: var(--text-2);
        font-weight: 600;
        text-decoration: none;
    }

    .settings-nav a:hover {
        background: var(--panel-2);
        color: var(--text);
    }
}

.settings-body {
    display: grid;
    gap: 16px;
    max-width: 760px;
}

.settings-section {
    scroll-margin-top: 90px;
    padding: 22px;
}

.settings-section .panel-title {
    margin-bottom: 14px;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.375rem;
}

.settings-section > .switch-row:last-child {
    padding-bottom: 0;
}

.location-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
    background: var(--panel-2);
}

.location-card > .icon {
    color: var(--gold);
}

.location-card span {
    flex: 1;
    min-width: 0;
}

.location-card small {
    display: block;
    color: var(--muted);
    font-size: 0.8125rem;
}

.location-card + .switch-row {
    margin-top: 14px;
}

.about {
    display: flex;
    align-items: center;
    gap: 14px;
}

.about img {
    border-radius: 14px;
}

.about strong,
.about span {
    display: block;
}

.intro {
    padding: 24px 0;
}

.intro-list {
    margin: 20px 0 0;
    padding-left: 20px;
    color: var(--text-2);
    line-height: 1.9;
}

/* 12. Display mode ------------------------------------------------------- */

body[data-page="display"] .topbar,
body[data-page="display"] .tabbar,
body[data-page="display"] .site-footer,
body[data-page="display"] .player-slot {
    display: none;
}

body[data-page="display"] .view {
    max-width: none;
    padding: 0;
}

body[data-page="display"] .banner {
    position: fixed;
    top: 12px;
    left: 50%;
    z-index: 5;
    transform: translateX(-50%);
    margin: 0;
}

.display {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
    min-height: 100dvh;
    padding: clamp(16px, 3vw, 40px);
    padding-bottom: max(clamp(16px, 3vw, 40px), env(safe-area-inset-bottom));
    background: radial-gradient(70% 55% at 50% 30%, var(--bg-glow), transparent 75%), var(--bg);
}

.display {
    overflow: hidden;
}

.display.hide-cursor,
.display.hide-cursor * {
    cursor: none;
}

.display-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-weight: 600;
}

.display-place {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.display-actions {
    display: flex;
    gap: 4px;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.display.hide-cursor .display-actions {
    opacity: 0;
}

.display-main {
    min-width: 0;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
}

.display-date {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 20px;
    margin: 0;
    color: var(--text-2);
    font-size: clamp(1rem, 0.6rem + 1.4vw, 1.75rem);
    font-weight: 600;
}

.display-date span {
    color: var(--gold);
}

.display-clock {
    margin: 0.05em 0 0;
    font-weight: 250;
    font-size: clamp(3rem, 18vw, 16rem);
    line-height: 1;
    letter-spacing: -0.02em;
}

.display-clock.no-seconds {
    font-size: clamp(4rem, 25vw, 20rem);
}

.display-clock .ampm {
    font-size: 0.25em;
    font-weight: 500;
    color: var(--muted);
}

.display-status {
    margin: 0.4em 0 0;
    color: var(--text-2);
    font-size: clamp(1.1rem, 0.7rem + 1.6vw, 2.2rem);
}

.display-status strong {
    color: var(--gold);
    font-weight: 700;
}

.display-tiles {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: clamp(6px, 1vw, 16px);
}

.display-tile {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: clamp(10px, 1.6vw, 24px) 6px;
    border: 1px solid var(--line);
    border-radius: clamp(12px, 1.6vw, 22px);
    background: var(--panel);
    text-align: center;
}

.display-tile-name {
    color: var(--text-2);
    font-size: clamp(0.8rem, 0.5rem + 0.9vw, 1.4rem);
    font-weight: 700;
}

.display-tile-arabic {
    color: var(--muted);
    font-size: clamp(0.9rem, 0.6rem + 0.9vw, 1.5rem);
    line-height: 1.4;
}

.display-tile-time {
    font-weight: 400;
    letter-spacing: -0.02em;
    font-size: clamp(1.4rem, 0.8rem + 2.4vw, 3.6rem);
    line-height: 1.1;
}

.display-tile-iqamah {
    color: var(--muted);
    font-size: clamp(0.75rem, 0.45rem + 0.8vw, 1.25rem);
    font-weight: 600;
    white-space: nowrap;
}

.display-tile.is-next .display-tile-iqamah {
    color: var(--text-2);
}

.display-tile.is-next {
    border-color: var(--gold-line);
    background: var(--gold-soft);
    box-shadow: 0 0 40px -10px rgba(227, 191, 104, 0.35);
}

.display-tile.is-next .display-tile-time,
.display-tile.is-next .display-tile-name {
    color: var(--gold);
}

.display-tile.is-passed {
    opacity: 0.5;
}

.display-tile.is-current {
    opacity: 1;
    border-color: var(--line-strong);
}

.display-hint {
    margin: 12px 0 0;
    color: var(--muted);
    text-align: center;
}

.display-dim {
    position: fixed;
    inset: 0;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 2s;
}

.display.is-dim .display-dim {
    opacity: 0.55;
}

@media (max-width: 700px) {
    .display-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (orientation: portrait) and (min-width: 701px) {
    .display-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Small screens ---------------------------------------------------------- */

@media (max-width: 600px) {
    .view { padding-top: 14px; }
    .panel { padding: 16px; }
    .settings-section { padding: 18px 16px; }
    .settings-section .panel-title { font-size: 1.25rem; }
    .location-card { flex-wrap: wrap; }
    .location-card .button { width: 100%; }
    .time-row { padding-left: 10px; min-height: 52px; gap: 6px; }
    .time-arabic { display: none; }
    .time-flag, .time-flag-space { min-width: 0; }
    .pray-chip { font-size: 0.75rem; }
    .search-bar .button { padding: 0 14px; }
    .hijri-day { font-size: 3.75rem; }
    .month-title { flex: 1; min-width: 0; font-size: 1.125rem; }
    .month-print { padding: 0 12px; }
    .print-label { display: none; }
    .month-table .col-hijri { display: none; }
    .month-table { table-layout: fixed; font-size: 0.78rem; }
    .month-table thead th { font-size: 0.6875rem; }
    .month-table th,
    .month-table td { padding: 9px 2px; text-align: center; }
    .month-table th:first-child { width: 22%; padding-left: 10px; text-align: left; }
    .month-table td:last-child { padding-right: 8px; }
    .reader-bar { margin-top: -14px; }
}

@media (min-width: 601px) and (max-width: 919px) {
    .time-arabic { font-size: 1rem; }
}

/* Print: monthly timetable only ----------------------------------------- */

@media print {
    :root,
    [data-theme] {
        --bg: #fff;
        --panel: #fff;
        --panel-2: #f2f2f2;
        --text: #000;
        --text-2: #222;
        --muted: #555;
        --line: #ccc;
        --gold: #000;
        --gold-soft: #eee;
    }

    body {
        background: #fff;
    }

    .topbar,
    .tabbar,
    .site-footer,
    .banner-slot,
    .player-slot,
    .toast-region,
    .tabs,
    .page-head,
    .month-head .icon-button,
    .month-print {
        display: none !important;
    }

    .print-only {
        display: block;
        margin: 0 0 12px;
        font-weight: 700;
    }

    .table-wrap {
        overflow: visible;
        border: 0;
    }

    .month-table th,
    .month-table td {
        padding: 4px 8px;
    }

    .month-table thead th,
    .month-table tbody th {
        position: static;
    }
}

/* Motion ----------------------------------------------------------------- */

@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;
    }
}

/* 99. Languages and right-to-left --------------------------------------- */

/* Interface fonts per script. Manrope stays first for Latin letters and digits. */
html[lang="zh"] {
    --font-ui: "Manrope", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", sans-serif;
    --font-display: var(--font-ui);
}

html[lang="hi"] {
    --font-ui: "Manrope", "Noto Sans Devanagari", "Nirmala UI", "Kohinoor Devanagari", "Mangal", sans-serif;
    --font-display: var(--font-ui);
}

html[lang="bn"] {
    --font-ui: "Manrope", "Noto Sans Bengali", "Nirmala UI", "Kohinoor Bangla", "Vrinda", sans-serif;
    --font-display: var(--font-ui);
}

html[lang="ar"],
html[lang="ur"] {
    --font-ui: "Manrope", "Noto Sans Arabic", "Segoe UI", "SF Arabic", "Geeza Pro", Tahoma, sans-serif;
    --font-display: var(--font-ui);
}

/* Marcellus has no Cyrillic, so Russian headings use Manrope. */
html[lang="ru"] {
    --font-display: var(--font-ui);
}

/* Scripts without capitals or with tall marks read better without tracking and with more line height. */
html[lang="zh"] body,
html[lang="hi"] body,
html[lang="bn"] body,
html[lang="ar"] body,
html[lang="ur"] body {
    letter-spacing: 0;
    line-height: 1.65;
}

html[lang="zh"] *,
html[lang="hi"] *,
html[lang="bn"] *,
html[lang="ar"] *,
html[lang="ur"] * {
    letter-spacing: normal;
}

/* Right-to-left (Arabic, Urdu): mirror the few physical left/right rules. */
[dir="rtl"] .icon-left,
[dir="rtl"] .icon-right,
[dir="rtl"] .icon-prev,
[dir="rtl"] .icon-next {
    transform: scaleX(-1);
}

[dir="rtl"] .ampm { margin-left: 0; margin-right: 0.2em; }
[dir="rtl"] .skip-link { left: auto; right: 12px; }
[dir="rtl"] .topbar-actions { margin-left: 0; margin-right: auto; }
[dir="rtl"] .site-footer a { margin-right: 0; margin-left: 14px; }

[dir="rtl"] .search-field .icon,
[dir="rtl"] .filter-field .icon,
[dir="rtl"] .search-bar > .icon {
    left: auto;
    right: 14px;
}

[dir="rtl"] .search-field input,
[dir="rtl"] .filter-field input,
[dir="rtl"] .search-bar input {
    padding: 0 40px 0 14px;
}

[dir="rtl"] .switch::after { left: auto; right: 3px; }
[dir="rtl"] .switch:checked::after { transform: translateX(-18px); }

[dir="rtl"] .place-option,
[dir="rtl"] .result { text-align: right; }

[dir="rtl"] .facts dd,
[dir="rtl"] .time-value,
[dir="rtl"] .bar-row > :last-child,
[dir="rtl"] .month-table td { text-align: left; }

[dir="rtl"] .month-table tbody th,
[dir="rtl"] .month-table th:first-child,
[dir="rtl"] .month-table .col-hijri { text-align: right; }

[dir="rtl"] .month-print { margin-left: 0; margin-right: auto; }
[dir="rtl"] .heat-legend span:first-child { margin-right: 0; margin-left: 4px; }
[dir="rtl"] .heat-legend span:last-child { margin-left: 0; margin-right: 4px; }
[dir="rtl"] .ayah-ref { margin-right: 0; margin-left: 6px; }
[dir="rtl"] .intro-list { padding-left: 0; padding-right: 20px; }
[dir="rtl"] .time-row { padding: 6px 14px 6px 4px; }

@media (max-width: 600px) {
    [dir="rtl"] .time-row { padding-left: 4px; padding-right: 10px; }
    [dir="rtl"] .month-table th,
    [dir="rtl"] .month-table td { text-align: center; }
    [dir="rtl"] .month-table th:first-child { padding-left: 2px; padding-right: 10px; text-align: right; }
    [dir="rtl"] .month-table td:last-child { padding-right: 2px; padding-left: 8px; }
}

/* Clocks, countdowns and times stay left-to-right so digits keep their order. */
[dir="rtl"] .display-clock,
[dir="rtl"] .countdown,
[dir="rtl"] .stepper-value,
[dir="rtl"] .qibla-dial,
[dir="rtl"] .compass {
    direction: ltr;
}


/* Backup reminder on the home page */
.backup-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    border-color: var(--gold-line);
}

.backup-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gold-soft);
    color: var(--gold);
}

.backup-text .panel-title {
    margin: 0 0 4px;
}

.backup-text p {
    margin: 0;
    color: var(--text-2);
    font-size: 0.9375rem;
}

.backup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 700px) {
    .backup-card {
        grid-template-columns: auto 1fr;
    }

    .backup-actions {
        grid-column: 1 / -1;
    }

    .backup-actions .button {
        flex: 1;
    }
}

.panel-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}


/* Khatm goal (Quran page) */
.khatm-card {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.khatm-card:not([aria-labelledby]) {
    grid-template-columns: 1fr auto;
    align-items: center;
}

.khatm-card .panel-head {
    margin-bottom: 0;
}

.khatm-text .panel-title {
    margin: 0 0 4px;
}

.khatm-text p,
.khatm-status {
    margin: 0;
    color: var(--text-2);
    font-size: 0.9375rem;
}

.khatm-status.is-behind {
    color: var(--gold);
}

.khatm-portion strong {
    display: block;
    font-size: 1.0625rem;
}

.khatm-card .button-row {
    align-items: center;
}

.khatm-stop {
    margin-inline-start: auto;
    color: var(--muted);
}

.khatm-card.is-complete {
    border-color: var(--gold-line);
}

@media (max-width: 600px) {
    .khatm-card:not([aria-labelledby]) {
        grid-template-columns: 1fr;
    }
}

.status-option small {
    margin-inline-start: auto;
    font-weight: 600;
}

/* Memorise dialog */
.memo-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.memo-range .field-label {
    display: block;
    margin-bottom: 6px;
}

.dialog-body > .field-label {
    display: block;
    margin: 14px 0 6px;
}

.player-info small .icon {
    vertical-align: -2px;
}

/* Du'a collection */
.dua-section {
    margin-top: 28px;
}

.dua-section .section-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dua-section .section-title .icon {
    color: var(--gold);
}

.tool-page > .chips-scroll {
    margin-bottom: 4px;
}

/* English texts (hadith, meanings) and transliterations stay left-to-right in the Arabic and Urdu interface. */
[dir="rtl"] :not(html)[lang="en"],
[dir="rtl"] .dhikr-transliteration,
[dir="rtl"] .dua-transliteration,
[dir="rtl"] .hadith-transliteration {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
}

/* Live stream badge on the holy mosques cards */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-inline-start: 6px;
    padding: 1px 8px 1px 6px;
    border-radius: 999px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: 2px;
}

.live-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: live-pulse 1.6s ease-in-out infinite;
}

@keyframes live-pulse {
    50% { opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
    .live-badge::before { animation: none; }
}

/* Zakat calculator */
.zakat-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 16px;
    align-items: start;
}

.zakat-form {
    display: grid;
    gap: 10px;
}

.zakat-currency {
    margin: 0 0 6px;
}

.zakat-field {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(110px, 180px);
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-2);
}

.zakat-field:focus-within {
    border-color: var(--gold-line);
}

.zakat-field-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gold-soft);
    color: var(--gold);
}

.zakat-field.is-minus .zakat-field-icon {
    background: var(--danger-soft);
    color: var(--danger);
}

.zakat-field-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.zakat-field-label {
    font-weight: 700;
}

.zakat-field-text small {
    color: var(--muted);
    font-size: 0.8125rem;
}

.zakat-input {
    height: 44px;
    text-align: end;
    font-size: 1.0625rem;
}

.zakat-input:focus,
.zakat-price:focus {
    box-shadow: none;
}

.zakat-nisab {
    margin-top: 6px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.zakat-nisab summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--text-2);
}

.zakat-nisab .segmented {
    margin-top: 10px;
}

.zakat-price {
    max-width: 200px;
    height: 44px;
}

.zakat-clear {
    justify-self: start;
    margin-top: 4px;
    color: var(--muted);
}

.zakat-result {
    position: sticky;
    top: 84px;
    text-align: center;
}

.zakat-label {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.zakat-amount {
    margin: 6px 0 4px;
    color: var(--gold);
    font-weight: 300;
    font-size: clamp(2.25rem, 1.6rem + 2.4vw, 3.25rem);
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.zakat-status {
    margin: 0 0 16px;
    color: var(--text-2);
    font-size: 0.9375rem;
}

.zakat-status.is-due {
    color: var(--text);
}

.zakat-facts {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 0.875rem;
}

.zakat-facts div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.zakat-facts dt {
    color: var(--muted);
    text-align: start;
}

.zakat-facts dd {
    margin: 0;
    font-weight: 700;
}

@media (max-width: 860px) {
    .zakat-layout {
        grid-template-columns: 1fr;
    }

    /* On a phone the full result sits on top; a slim bar with the amount stays in view while filling in the form. */
    .zakat-result {
        position: static;
        order: -1;
    }

    .zakat-mini {
        position: sticky;
        bottom: calc(var(--tabbar-height) + 12px + env(safe-area-inset-bottom));
        z-index: 5;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-top: 4px;
        padding: 12px 16px;
        border: 1px solid var(--gold-line);
        border-radius: 14px;
        background: var(--panel-3);
        box-shadow: var(--shadow);
        font-weight: 700;
    }

    .zakat-mini strong {
        color: var(--gold);
        font-size: 1.25rem;
    }
}

.zakat-mini {
    display: none;
}

@media (max-width: 860px) {
    .zakat-mini {
        display: flex;
    }
}

@media (max-width: 480px) {
    .zakat-field {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .zakat-input {
        grid-column: 1 / -1;
    }
}

/* 13. Read switch and Tajweed --------------------------------------------- */

.read-switch {
    margin: 4px 0 0;
}

.read-switch .segment {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

/* The section is written left to right, also when the app is in Arabic or Urdu. */
[dir="rtl"] .tajweed-page .icon-left,
[dir="rtl"] .tajweed-page .icon-right {
    transform: none;
}

.tajweed-page {
    --tj-heavy: #e39a5f;
    --tj-light: #8fb8d8;
}

[data-theme="light"] .tajweed-page {
    --tj-heavy: #b45f1d;
    --tj-light: #2f6a96;
}

.tj-ar {
    font-family: var(--font-arabic);
    unicode-bidi: isolate;
    line-height: 1.9;
}

.tj-gold { color: var(--gold); }
.tj-muted { color: var(--muted); }
.tj-center { justify-content: center; }

.tj-stats {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tj-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--text-2);
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.tj-pill b { color: var(--gold); }

.tj-slow { border-color: var(--line); }
.tj-slow.is-on { background: var(--gold-soft); border-color: var(--gold-line); }

.tj-progress {
    flex: 1;
    height: 8px;
    border-radius: 999px;
    background: var(--panel-3);
    overflow: hidden;
}

.tj-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold-deep), var(--gold));
    transition: width 0.3s;
}

.tj-hero {
    position: relative;
    overflow: hidden;
    padding: 24px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--panel-2), var(--panel));
}

.tj-hero p {
    max-width: 52ch;
    margin: 8px 0 0;
    color: var(--text-2);
}

.tj-hero .tj-progress {
    margin-top: 20px;
    height: 6px;
}

.tj-hero-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.625rem;
}

.tj-hero-bg {
    position: absolute;
    left: -8px;
    bottom: -40px;
    font-family: var(--font-arabic);
    font-size: 8rem;
    color: var(--gold);
    opacity: 0.07;
    pointer-events: none;
}

.tj-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin: 32px 0 14px;
}

.tj-section-head .section-title { margin: 0; }
.tj-section-head span { color: var(--muted); font-size: 0.875rem; }

.tj-path {
    display: grid;
    gap: 10px;
}

@media (min-width: 820px) {
    .tj-path { grid-template-columns: 1fr 1fr; }
}

.tj-unit {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s;
}

.tj-unit:hover { border-color: var(--gold-line); }

.tj-unit.is-next {
    border-color: var(--gold-line);
    box-shadow: 0 0 0 3px var(--gold-soft);
}

.tj-unit-mark {
    display: grid;
    place-items: center;
    flex: none;
    width: 52px;
    height: 52px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: var(--panel-2);
    color: var(--gold);
    font-size: 1.5rem;
}

.tj-unit-mark .tj-ar { line-height: 1; }

.tj-unit.is-done .tj-unit-mark {
    border-color: var(--gold);
    background: var(--gold);
    color: var(--on-gold);
}

.tj-unit-text { min-width: 0; }
.tj-unit-text strong { display: block; }
.tj-unit-text small { color: var(--muted); font-size: 0.8125rem; }

.tj-unit-state {
    margin-left: auto;
    color: var(--gold);
    font-size: 0.8125rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Lesson flow */

.tajweed-flow {
    max-width: 760px;
    margin: 0 auto;
}

.tj-flow-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
}

.tj-card {
    animation: tj-in 0.25s ease;
}

@keyframes tj-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.tj-kicker {
    color: var(--gold);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.tj-card-title {
    margin: 6px 0 8px;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.5rem;
}

.tj-card-text {
    margin: 0 0 14px;
    color: var(--text-2);
}

.tj-card-text .tj-ar { font-size: 1.4em; }

.tj-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 14px 0 0;
    padding: 12px 14px;
    border: 1px solid var(--gold-line);
    border-radius: 12px;
    background: var(--gold-soft);
    font-size: 0.9375rem;
}

.tj-tip .icon { flex: none; margin-top: 2px; color: var(--gold); }
.tj-tip .tj-ar { font-size: 1.3em; }

.tj-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.8125rem;
}

.tj-foot {
    position: sticky;
    bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
    z-index: 4;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    padding: 12px 0;
    background: linear-gradient(transparent, var(--bg) 40%);
}

@media (min-width: 900px) {
    .tj-foot { bottom: 0; }
}

/* Examples, rules and tiles */

.tj-ex-list,
.tj-rules {
    display: grid;
    gap: 8px;
}

.tj-ex {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-2);
}

.tj-ex-ar {
    min-width: 92px;
    font-size: 1.75rem;
    text-align: center;
}

.tj-ex-text { flex: 1; min-width: 0; }
.tj-ex-text strong { display: block; font-size: 0.9375rem; }
.tj-ex-text small { color: var(--muted); font-size: 0.8125rem; }

.tj-play {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--gold-line);
    border-radius: 50%;
    background: var(--gold-soft);
    color: var(--gold);
    transition: background-color 0.15s, color 0.15s;
}

.tj-play:hover { background: var(--gold); color: var(--on-gold); }
.tj-play.is-small { width: 32px; height: 32px; }
.tj-play.is-large { width: 76px; height: 76px; }

.is-playing { animation: tj-pulse 0.5s; }

@keyframes tj-pulse {
    50% { transform: scale(1.08); }
}

.tj-rule,
.tj-pair {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-2);
    color: var(--text);
    text-decoration: none;
}

.tj-rule small { display: block; color: var(--muted); font-size: 0.8125rem; }
.tj-rule-text { color: var(--text-2); font-size: 0.875rem; }
.tj-rule-ex { display: flex; align-items: center; gap: 8px; }
.tj-rule-ex .tj-ar { font-size: 1.5rem; }
.tj-rule-link { grid-template-columns: 1fr auto; }
.tj-rule-link:hover { border-color: var(--gold-line); }
.tj-stars { color: var(--gold); }
.tj-stop { grid-template-columns: auto 1fr; }

.tj-stop-sign {
    min-width: 64px;
    font-family: var(--font-arabic);
    font-size: 1.75rem;
    line-height: 1.6;
    color: var(--gold);
    text-align: center;
}

.tj-pair { grid-template-columns: 1fr auto 1fr; }
.tj-pair-side { display: flex; align-items: center; gap: 10px; }
.tj-pair-side:first-child { justify-content: flex-end; }
.tj-pair .tj-ar { font-size: 2rem; }
.tj-ar.is-light { color: var(--tj-light); }
.tj-ar.is-heavy { color: var(--tj-heavy); }

.tj-badge {
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.tj-badge.is-h { background: color-mix(in srgb, var(--tj-heavy) 18%, transparent); color: var(--tj-heavy); }
.tj-badge.is-l { background: color-mix(in srgb, var(--tj-light) 18%, transparent); color: var(--tj-light); }
.tj-badge.is-vowel { background: var(--gold-soft); color: var(--gold); font-size: 0.9375rem; text-transform: none; }

.tj-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    gap: 8px;
}

.tj-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 82px;
    padding: 4px 2px 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-2);
    color: var(--text);
    transition: border-color 0.15s, transform 0.12s;
}

.tj-tile:hover { border-color: var(--gold-line); transform: translateY(-2px); }
.tj-tile .tj-ar { font-size: 1.875rem; line-height: 1.7; }
.tj-tile small { direction: ltr; color: var(--muted); font-size: 0.6875rem; }
.tj-tile.is-heavy .tj-ar { color: var(--tj-heavy); }
.tj-tile.is-gold .tj-ar,
.tj-tile.is-sun .tj-ar { color: var(--gold); }
.tj-tile.is-sun { border-color: var(--gold-line); }
.tj-tile.is-moon .tj-ar { color: var(--tj-light); }
.tj-tile.is-selected { border-color: var(--gold); background: var(--gold-soft); }

.tj-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
}

.tj-chip-ar {
    padding: 0 12px;
    font-size: 1.25rem;
}

.tj-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--text-2);
    font-size: 0.75rem;
    font-weight: 700;
}

.tj-tag.is-heavy { border-color: currentColor; color: var(--tj-heavy); }
.tj-tag.is-light { border-color: currentColor; color: var(--tj-light); }
.tj-tag.is-gold { border-color: var(--gold-line); color: var(--gold); }

.tj-form-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
}

.tj-form-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.tj-form-head span { color: var(--muted); font-size: 0.875rem; }
.tj-form-head .tj-play { margin-left: auto; }

.tj-forms {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.tj-forms > div {
    padding: 6px 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    text-align: center;
}

.tj-forms .tj-ar { display: block; font-size: 2.25rem; line-height: 1.6; }
.tj-forms small { display: block; direction: ltr; color: var(--muted); font-size: 0.6875rem; }

.tj-lab-out {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 4px 0 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
}

.tj-lab-out .tj-ar { font-size: 4.5rem; line-height: 1.5; color: var(--gold); }
.tj-lab-sound { min-width: 64px; font-size: 1.375rem; font-weight: 700; }

.tj-mods {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 6px;
}

.tj-mod {
    min-height: 40px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-2);
    color: var(--text-2);
    font-size: 0.8125rem;
    font-weight: 600;
}

.tj-mod.is-on { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); }

.tj-areas { display: grid; gap: 8px; }

.tj-area {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-2);
}

.tj-area summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
}

.tj-area summary::-webkit-details-marker { display: none; }
.tj-area summary small { display: block; color: var(--muted); font-size: 0.8125rem; }

.tj-area-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--gold-soft);
    color: var(--gold);
}

.tj-point {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 14px;
    padding: 8px 0;
    border-top: 1px solid var(--line);
    color: var(--text-2);
    font-size: 0.875rem;
}

.tj-point:last-child { margin-bottom: 6px; }
.tj-point-letters { display: flex; gap: 4px; }

.tj-point-letters button {
    min-width: 40px;
    padding: 0 6px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--gold);
    font-size: 1.5rem;
}

.tj-point-letters button:hover { background: var(--gold-soft); }

/* Quiz */

.tj-q-big {
    margin: 4px 0;
    font-family: var(--font-arabic);
    font-size: 3.25rem;
    line-height: 1.8;
    color: var(--gold);
    text-align: center;
}

.tj-q-listen {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

.tj-opts {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.tj-opts.is-grid { grid-template-columns: 1fr 1fr; }

.tj-opt {
    min-height: 48px;
    padding: 10px 14px;
    border: 1.5px solid var(--line-strong);
    border-radius: 12px;
    background: var(--panel-2);
    color: var(--text);
    font-weight: 600;
    text-align: left;
    transition: border-color 0.12s, background-color 0.12s;
}

.tj-opt:hover:not(:disabled) { border-color: var(--gold-line); }
.tj-opt.is-ar { font-family: var(--font-arabic); font-size: 1.75rem; text-align: center; }
.tj-opt.is-right { border-color: var(--sage); background: var(--sage-soft); color: var(--sage); }
.tj-opt.is-wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.tj-opt.is-dim { opacity: 0.5; }
.tj-opt:disabled { cursor: default; }

.tj-feedback {
    display: none;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.9375rem;
}

.tj-feedback.is-shown { display: grid; gap: 2px; }
.tj-feedback.is-right { border: 1px solid var(--sage); background: var(--sage-soft); }
.tj-feedback.is-wrong { border: 1px solid var(--danger); background: var(--danger-soft); }
.tj-feedback.is-right strong { color: var(--sage); }
.tj-feedback.is-wrong strong { color: var(--danger); }

.tj-result { padding: 32px 20px; text-align: center; }

.tj-result-stars {
    color: var(--gold);
    font-size: 3.5rem;
    line-height: 1;
}

.tj-result-stars span { opacity: 0.25; }
.tj-result p { color: var(--text-2); }

.tj-xp-gain {
    display: inline-block;
    margin: 4px 0 8px;
    padding: 6px 14px;
    border: 1px solid var(--gold-line);
    border-radius: 999px;
    background: var(--gold-soft);
    color: var(--gold);
    font-weight: 800;
}

.tj-confetti {
    position: fixed;
    inset: 0;
    z-index: 80;
    pointer-events: none;
}

/* Letters, games and progress */

.tj-detail { margin-bottom: 16px; scroll-margin-top: 90px; }

.tj-detail-top {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 20px;
}

.tj-big {
    min-width: 120px;
    font-family: var(--font-arabic);
    font-size: 6.5rem;
    line-height: 1.3;
    color: var(--gold);
    text-align: center;
}

.tj-detail-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.5rem;
}

.tj-detail-title .tj-ar { font-size: 1.25rem; }
.tj-detail-hint { margin: 4px 0 10px; color: var(--text-2); }
.tj-detail .button .tj-ar { font-size: 1.25rem; line-height: 1; }
.tj-detail .button-row { margin-top: 12px; }

@media (max-width: 520px) {
    .tj-detail-top { grid-template-columns: 1fr; gap: 4px; }
    .tj-ex-ar { min-width: 72px; font-size: 1.5rem; }
    .tj-hero-title { font-size: 1.375rem; }
    .tj-stats .tj-pill:first-child { display: none; }
}

.tj-games {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
}

.tj-game {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s;
}

.tj-game:hover { border-color: var(--gold-line); }
.tj-game small { color: var(--muted); font-size: 0.8125rem; }
.tj-game-ar { font-size: 2rem; color: var(--gold); line-height: 1.5; }
.tj-best { color: var(--gold); font-size: 0.75rem; font-weight: 700; }

.tj-flip {
    position: relative;
    display: block;
    width: 100%;
    height: 300px;
    margin: 0 0 14px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text);
    perspective: 1000px;
}

.tj-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    background: var(--panel);
    backface-visibility: hidden;
    transition: transform 0.5s;
}

.tj-face.is-back { transform: rotateY(180deg); }
.tj-flip.is-flipped .tj-face:not(.is-back) { transform: rotateY(-180deg); }
.tj-flip.is-flipped .tj-face.is-back { transform: rotateY(0); }
.tj-face small { max-width: 36ch; color: var(--muted); }
.tj-face strong { font-family: var(--font-display); font-size: 1.75rem; font-weight: 400; }
.tj-face .tj-ar { font-size: 1.75rem; }
.tj-face .tj-face-ar { font-size: 7rem; line-height: 1.3; color: var(--gold); }

.tj-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.tj-kpi {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    text-align: center;
}

.tj-kpi b {
    display: block;
    color: var(--gold);
    font-size: 1.625rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.tj-kpi span { color: var(--muted); font-size: 0.75rem; }

.tajweed-page .field { display: grid; gap: 6px; margin-bottom: 12px; }

.tj-cert {
    position: relative;
    padding: 28px 22px;
    border: 2px solid var(--gold-line);
    border-radius: var(--radius-lg);
    background: linear-gradient(160deg, var(--panel-2), var(--panel));
    text-align: center;
}

.tj-cert::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    pointer-events: none;
}

.tj-cert h3 {
    margin: 6px 0 0;
    color: var(--gold);
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.5rem;
}

.tj-cert p { margin: 6px 0; }

.tj-cert-name {
    display: inline-block;
    min-width: 200px;
    margin: 8px 0;
    padding: 0 20px 4px;
    border-bottom: 1px solid var(--gold-line);
    font-family: var(--font-display);
    font-size: 1.75rem;
}

.tj-cert ul {
    max-width: 380px;
    margin: 14px auto;
    padding: 0;
    color: var(--text-2);
    font-size: 0.875rem;
    text-align: left;
    list-style: none;
}

.tj-cert li::before { content: "✓ "; color: var(--gold); font-weight: 700; }
.tj-cert.is-locked { opacity: 0.6; filter: grayscale(0.6); }

@media (prefers-reduced-motion: reduce) {
    .tj-card,
    .is-playing,
    .tj-face,
    .tj-progress i { animation: none; transition: none; }
}
