/* Polish pass (owner, 8 Nov 2026: "yes build both, and also in light mode").
   The approved dark-mode trial (design-nov8/zikry-dark-polish.html, fourteen rules) and the seven rules of the
   redesign board's "3 · Polish pass", as one sheet loaded after every other one, with a matching light mode.
   Every rule below is written once and reads --pz-* tokens; only the token blocks differ by theme, in the app's
   usual three places (light :root, system dark, chosen dark). Shared tokens other modules read (--bg, --bg-elev,
   --label*, --gold*, --separator*) are not redefined here; only --seg-on-ring and the folio icon tokens
   (--icon-ground/--icon-ink/--icon-line) are retuned, which is what those tokens exist for.
   Specificity: a few rules use :not(#_) (the lantern.css idiom) to sit above design.css's id rules (#tsNow,
   #prayerPanelToday) and search.js's injected sheet without !important. */

/* ---------- Tokens: Lantern by day ---------- */
:root{
  /* Cards lit from above: warm ivory with a white top light, a hairline gold rim and a warm shadow. */
  --pz-card:var(--bg-elev);--pz-card-top:#FFFFFF;--pz-card-low:rgba(255,255,255,0);
  --pz-hi:rgba(255,255,255,.95);--pz-rim:rgba(176,134,62,.22);
  --pz-drop:0 18px 34px -22px rgba(90,60,20,.34),0 2px 6px -3px rgba(90,60,20,.12);
  /* The one hero card: matte-gold rim, a warm corner glow and a soft halo. */
  --pz-hero-glow:rgba(233,190,110,.30);--pz-hero-rim:#C9A55E;--pz-hero-hi:rgba(255,255,255,.9);
  --pz-hero-halo:0 0 44px -18px rgba(201,149,69,.55);
  /* Quiet prompts: no fill, an outline only. */
  --pz-quiet-line:rgba(150,110,45,.28);
  /* Icon chips: a gold tint with a --gold-ink glyph (4.7:1 on the chip's lightest-to-darkest ground). */
  --icon-ground:radial-gradient(120% 120% at 30% 20%,#FDF6E6,#F4E6C6);--icon-ink:var(--gold-ink);
  --icon-line:rgba(140,91,18,.30);
  /* The gold bead (hero icon) and the Library play bead. */
  --pz-bead:radial-gradient(circle at 35% 30%,#FFF1C4,#E8B54F 55%,#9A6512);--pz-on-bead:#2A1A04;--pz-bead-line:rgba(120,78,16,.55);
  --pz-play:var(--btn-gold);--pz-on-play:var(--on-btn-gold);--pz-play-rim:#9C7434;
  --pz-play-shadow:0 6px 14px -8px rgba(150,104,28,.6);
  /* Glass search over the page. */
  --pz-glass:rgba(255,252,246,.74);--pz-glass-line:rgba(150,110,45,.30);
  /* Progress grooves, the tab-bar fade, disabled buttons, stat dividers. */
  --pz-track:rgba(120,88,36,.16);--pz-fade:rgba(247,241,230,.94);
  --pz-off-bg:#EDE4D2;--pz-off-ink:#6B6453;
  /* Segmented controls: a neutral raised thumb, no gold ring (3.3:1 on the track, 3.9:1 on the thumb). */
  --seg-on-ring:#8E7E5E;--pz-thumb-lift:0 2px 6px -1px rgba(90,60,20,.22),0 1px 1px rgba(90,60,20,.08);
}

/* ---------- Tokens: Night (system dark and chosen dark) ---------- */
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --pz-card:#0D1532;--pz-card-top:rgba(140,160,255,.10);--pz-card-low:rgba(255,255,255,.015);
  --pz-hi:rgba(255,255,255,.12);--pz-rim:rgba(255,255,255,.05);
  --pz-drop:0 22px 40px -26px rgba(0,0,0,.95),0 2px 6px -2px rgba(0,0,0,.5);
  --pz-hero-glow:rgba(240,196,106,.26);--pz-hero-rim:rgba(240,196,106,.45);--pz-hero-hi:rgba(255,236,190,.18);
  --pz-hero-halo:0 0 50px -14px rgba(240,196,106,.45);
  --pz-quiet-line:rgba(255,255,255,.09);
  --icon-ground:radial-gradient(120% 120% at 30% 20%,rgba(240,196,106,.40),rgba(240,196,106,.14));--icon-ink:#FFE2A0;
  --icon-line:rgba(240,196,106,.35);
  --pz-bead:radial-gradient(circle at 35% 30%,#FFF1C4,#E8B54F 55%,#9A6512);--pz-on-bead:#2A1A04;--pz-bead-line:rgba(255,236,190,.35);
  --pz-play:linear-gradient(180deg,#F6DC9C,#E2B04F);--pz-on-play:#1A1204;--pz-play-rim:transparent;
  --pz-play-shadow:0 6px 14px -8px rgba(232,181,79,.8);
  --pz-glass:rgba(255,255,255,.06);--pz-glass-line:rgba(255,255,255,.10);
  --pz-track:rgba(255,255,255,.10);--pz-fade:rgba(6,10,26,.85);
  --pz-off-bg:rgba(255,255,255,.08);--pz-off-ink:#A6A39C;
  --seg-on-ring:#7D8AA6;--pz-thumb-lift:0 3px 8px rgba(0,0,0,.35),0 1px 1px rgba(0,0,0,.2);
  --pz-sky:radial-gradient(1px 1px at 12% 22%,rgba(255,255,255,.55),transparent 60%),radial-gradient(1px 1px at 78% 31%,rgba(255,255,255,.45),transparent 60%),
    radial-gradient(1px 1px at 41% 58%,rgba(255,255,255,.35),transparent 60%),radial-gradient(1px 1px at 88% 74%,rgba(255,255,255,.35),transparent 60%),
    radial-gradient(1.2px 1.2px at 24% 86%,rgba(255,255,255,.3),transparent 60%),radial-gradient(80% 45% at 85% 0%,rgba(90,114,230,.42),transparent 70%),
    radial-gradient(70% 40% at 10% 100%,rgba(120,90,200,.22),transparent 70%),radial-gradient(60% 30% at 0% 55%,rgba(60,70,160,.16),transparent 70%),
    linear-gradient(180deg,#0B1330 0%,#080E22 45%,#060A1A 100%) fixed;
}}
:root[data-theme="dark"]{
  --pz-card:#0D1532;--pz-card-top:rgba(140,160,255,.10);--pz-card-low:rgba(255,255,255,.015);
  --pz-hi:rgba(255,255,255,.12);--pz-rim:rgba(255,255,255,.05);
  --pz-drop:0 22px 40px -26px rgba(0,0,0,.95),0 2px 6px -2px rgba(0,0,0,.5);
  --pz-hero-glow:rgba(240,196,106,.26);--pz-hero-rim:rgba(240,196,106,.45);--pz-hero-hi:rgba(255,236,190,.18);
  --pz-hero-halo:0 0 50px -14px rgba(240,196,106,.45);
  --pz-quiet-line:rgba(255,255,255,.09);
  --icon-ground:radial-gradient(120% 120% at 30% 20%,rgba(240,196,106,.40),rgba(240,196,106,.14));--icon-ink:#FFE2A0;
  --icon-line:rgba(240,196,106,.35);
  --pz-bead:radial-gradient(circle at 35% 30%,#FFF1C4,#E8B54F 55%,#9A6512);--pz-on-bead:#2A1A04;--pz-bead-line:rgba(255,236,190,.35);
  --pz-play:linear-gradient(180deg,#F6DC9C,#E2B04F);--pz-on-play:#1A1204;--pz-play-rim:transparent;
  --pz-play-shadow:0 6px 14px -8px rgba(232,181,79,.8);
  --pz-glass:rgba(255,255,255,.06);--pz-glass-line:rgba(255,255,255,.10);
  --pz-track:rgba(255,255,255,.10);--pz-fade:rgba(6,10,26,.85);
  --pz-off-bg:rgba(255,255,255,.08);--pz-off-ink:#A6A39C;
  --seg-on-ring:#7D8AA6;--pz-thumb-lift:0 3px 8px rgba(0,0,0,.35),0 1px 1px rgba(0,0,0,.2);
  --pz-sky:radial-gradient(1px 1px at 12% 22%,rgba(255,255,255,.55),transparent 60%),radial-gradient(1px 1px at 78% 31%,rgba(255,255,255,.45),transparent 60%),
    radial-gradient(1px 1px at 41% 58%,rgba(255,255,255,.35),transparent 60%),radial-gradient(1px 1px at 88% 74%,rgba(255,255,255,.35),transparent 60%),
    radial-gradient(1.2px 1.2px at 24% 86%,rgba(255,255,255,.3),transparent 60%),radial-gradient(80% 45% at 85% 0%,rgba(90,114,230,.42),transparent 70%),
    radial-gradient(70% 40% at 10% 100%,rgba(120,90,200,.22),transparent 70%),radial-gradient(60% 30% at 0% 55%,rgba(60,70,160,.16),transparent 70%),
    linear-gradient(180deg,#0B1330 0%,#080E22 45%,#060A1A 100%) fixed;
}

/* ---------- Increase Contrast keeps a visible edge ---------- */
/* Lit cards drop the lantern frame, so the contrast setting's --control-line ring comes back through --pz-rim. */
/* The hero's matte-gold rim gives way to the same ring (#C9A55E is about 2.2:1 on the ivory page). */
@media (prefers-contrast:more){:root:not(#_){--pz-rim:var(--control-line);--pz-quiet-line:var(--control-line);--pz-glass-line:var(--control-line);--pz-hero-rim:var(--control-line)}}
:root.zk-contrast:not(#_){--pz-rim:var(--control-line);--pz-quiet-line:var(--control-line);--pz-glass-line:var(--control-line);--pz-hero-rim:var(--control-line)}

/* 1 · The sky continues (night only): a faint glow and five stars under the whole page. Pushed internal pages
   (Settings and its sub-pages, internal-pages.css html.ip-pushed) keep their solid page. */
@media (prefers-color-scheme:dark){html:not([data-theme="light"]):not(.ip-pushed) body{background:var(--pz-sky)}}
html[data-theme="dark"]:not(.ip-pushed) body{background:var(--pz-sky)}

/* 2 · Cards lit from above. Cards that paint their own sky or gold ground keep it. */
:root #main :is(.card,.zcard):not(#_):not(.today-summary,.adh-now,.an-card,.ch-invite,.ct-hello,.guide-offer,.invite-card,.pv-next,.rp-offer,.trad-ask,.ts-rpanel,.zkm-season,.chi-list,.dua-today,.lib-reading,.resume-card){
  background:linear-gradient(180deg,var(--pz-card-top),var(--pz-card-low) 55%),var(--pz-card);border:0;
  box-shadow:inset 0 1px 0 var(--pz-hi),inset 0 0 0 1px var(--pz-rim),var(--pz-drop)}

/* 3 · One hero card per screen: the Now card. */
:root #main .card.ts-nowcard:not(#_){
  background:radial-gradient(100% 140% at 0% 0%,var(--pz-hero-glow),transparent 55%),linear-gradient(180deg,var(--pz-card-top),var(--pz-card-low) 55%),var(--pz-card);
  box-shadow:inset 0 0 0 1px var(--pz-hero-rim),inset 0 1px 0 var(--pz-hero-hi),var(--pz-drop),var(--pz-hero-halo)}
/* Right to left the bead and the text start at the top right, so the glow does too. */
:root[dir="rtl"] #main .card.ts-nowcard:not(#_){
  background:radial-gradient(100% 140% at 100% 0%,var(--pz-hero-glow),transparent 55%),linear-gradient(180deg,var(--pz-card-top),var(--pz-card-low) 55%),var(--pz-card)}
/* Small text in the hero reads in --label-2, so it stays above 4.5:1 even where the corner glow reaches it. */
html #main .ts-nowcard .ts-nowcard-copy small{color:var(--label-2)}
/* 13 · Its icon is the matte gold bead (folio.css paints chips from these tokens). */
#main .ts-nowcard{--icon-ground:var(--pz-bead);--icon-ink:var(--pz-on-bead);--icon-line:var(--pz-bead-line)}

/* Two card radii: 16px for cards in a page, 28px for the hero and full sheets (Today mixed 12, 16, 18, 22 and 28).
   Bottom sheets already use --r-xl (design.css); the centred form sheet on wide screens joins them. */
:root #main :is(.card,.zcard,.resume-card,#prayerPanelToday,.ts-moment,.ts-teb,.today-completed>summary):not(#_):not(.ts-nowcard,.yv-card){border-radius:var(--r-m)}
:root #main :is(.card.ts-nowcard,.yv-card):not(#_){border-radius:var(--r-xl)}
@media (min-width:720px){:root .sheet-panel.form-panel{border-radius:var(--r-xl)}}

/* 4 · Quiet prompts step back: no fill, an outline. On a screen with a hero, their gold button becomes the quiet pill. */
:root #main .card:is(.feature-reminder,.zk-shelf):not(#_){background:transparent;box-shadow:inset 0 0 0 1px var(--pz-quiet-line)}
#main:has(.ts-nowcard) :is(.feature-reminder,.zk-shelf) .btn.primary:not(#_){background:var(--bg-sunk);color:var(--label);box-shadow:none}

/* One card depth: a card inside a card loses its own ground and shadow; it is rows in the outer card. */
:root #main :is(.card,.zcard) :is(.card,.zcard):not(#_){background:none;box-shadow:none;border:0}

/* 6 · Section titles in the serif, one voice with the page titles. */
html #main :is(.ts-head h2,h2.ts-h,.today-section-heading>h2){font-family:var(--serif);font-weight:500;letter-spacing:-.01em;font-size:var(--t-title2)}
:root[lang="ar"] #main :is(.ts-head h2,h2.ts-h,.today-section-heading>h2),:root[lang="fa"] #main :is(.ts-head h2,h2.ts-h,.today-section-heading>h2){letter-spacing:0}

/* 7 · Glass search: no strip behind it, one soft pill over the page. */
:root #main>.search-bar:not(#_){background:transparent;box-shadow:none}
:root #main .search-bar .search:not(#_),:root #main>.search:not(#_){background:var(--pz-glass);box-shadow:inset 0 0 0 1px var(--pz-glass-line);border:0;
  -webkit-backdrop-filter:blur(16px) saturate(1.2);backdrop-filter:blur(16px) saturate(1.2)}
/* Reduce Transparency: an opaque pill and no blur, as design.css does for .nav and .glass. */
@media (prefers-reduced-transparency:reduce){:root #main .search-bar .search:not(#_),:root #main>.search:not(#_){background:var(--bg-elev);-webkit-backdrop-filter:none;backdrop-filter:none}}
:root #main .search input:not(#_){background:transparent;box-shadow:none;border:0}

/* 8 · Library play: one filled gold bead per row instead of a gold ring; rows sit closer (12px to 8px apart, the
   rows and their 44px buttons keep their size). */
html #main .zlist.library-results{gap:8px}
:root #main .lib-card .lib-play:not(#_){background:var(--pz-play);color:var(--pz-on-play);border:0;box-shadow:inset 0 0 0 1px var(--pz-play-rim),var(--pz-play-shadow)}

/* 9 · Library doors: a round gold medallion with the eight-pointed star inside it, the glyph on top (owner, 8 Nov
   2026: the plain disc looked "so simple"; the polish board's After keeps the star). */
html #main .lib-dest .row-icon>.lf-oct{display:block;position:absolute;inset:0;transform:scale(.78);fill:currentColor;fill-opacity:.1;stroke:currentColor;stroke-opacity:.55;stroke-width:1.3}
html #main .lib-dest .row-icon{border-radius:50%;color:var(--icon-ink)}
html #main .lib-dest .row-icon::before{content:"";position:absolute;inset:0;border-radius:inherit;background:var(--icon-ground),var(--pz-card);box-shadow:inset 0 0 0 1px var(--icon-line)}

/* 10 · You: the stats sit on hairlines inside the hero, not as boxes in a box (the hero is sky in both themes). */
html #main .yv-stats>span{background:none;box-shadow:none;border-radius:0;border-inline-start:1px solid var(--sky-glass-edge)}
html #main .yv-stats>span:first-child{border-inline-start:0}

/* 11 · Counter: one helper line. "Saved in this browser" and "Tap anywhere above the line" go only while the hint
   ("Tap anywhere to count · saved on this phone") is on screen; when the hint is hidden (routine complete, small
   screens) they stay, so the "saved" line is never lost. */
#counter:not(.counter-dense):has(#cHint:not([hidden]):not(:empty)) :is(#fiSaved,#cFootHint){display:none}

/* 12 · Content fades out above the floating tab bar instead of running under it; the fade lives on the bar, so it
   shows and hides with it and never covers the counter or a sheet. */
.nav::before{content:"";position:absolute;inset-inline:0;bottom:0;z-index:-1;height:calc(100% + 28px);pointer-events:none;
  background:linear-gradient(180deg,transparent,var(--pz-fade) 72%)}

/* 14 · Progress grooves are visible. */
html #main :is(.ts-prog,.prog){background:var(--pz-track)}

/* ---------- Polish board rules ---------- */
/* Segmented controls: the selected part is a neutral raised thumb (ring from --seg-on-ring above, 3:1). */
.seg button[aria-pressed="true"]{box-shadow:inset 0 0 0 1px var(--seg-on-ring),var(--pz-thumb-lift)}
/* The Library's underline tabs have no track for a thumb: the selected tab is underlined in the label colour, not gold. */
html #main .lib-seg.seg button[aria-pressed="true"]:not(#_){box-shadow:inset 0 -2px 0 var(--label)}

/* A disabled button looks disabled: flat and grey, not a faded gold that still looks pressable. */
:root :is(.btn,.btn.primary):is(:disabled,[aria-disabled="true"]):not(#_){background:var(--pz-off-bg);color:var(--pz-off-ink);box-shadow:none;border-color:transparent;opacity:1;cursor:default;transform:none}

/* Long names: two lines, never a cut-off middle (prayer sources, friends, Library names; the place name itself
   wraps in prayer-pages.css). */
html #main :is(.lib-card.lf-card .zc-name,.pp-src>span,.ct-person-n){white-space:normal;text-overflow:clip;overflow:hidden;
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow-wrap:anywhere}

/* Reduced motion: nothing here animates; the glass blur is static. */
