/* Maladh – stile.
   Un solo tema: verde profondo e oro, onirico e meditativo. Nessuna ombra: i pannelli si distinguono per il tono.
   Font, angoli asimmetrici dei pannelli e finestra dal basso riprendono Sakina. */

:root {
  --bg: #0A1C17;
  --bg2: #0F2A22;
  --surf: #123128;
  --surf2: #1A4135;
  --ink: #EFE8D4;
  --ink2: #A6B5A8;
  --line: #24493E;
  --gold: #D8B66A;
  --gold2: #F0D9A0;
  --on-gold: #14241D;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --arabic: "Geeza Pro", "Noto Naskh Arabic", "Amiri", "Traditional Arabic", "Segoe UI", serif;
  --header-h: 56px;
  --barra-h: 62px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

/* html con il fondo pieno: niente lampo bianco all'apertura */
html { background: var(--bg); color-scheme: dark; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.55;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}

/* due aloni molto tenui che respirano: oro in alto, verde in basso */
body::before, body::after { content: ""; position: fixed; left: 0; right: 0; z-index: -1; pointer-events: none; }
body::before {
  top: 0; height: 70vh;
  background: radial-gradient(60% 55% at 50% 0%, rgba(216,182,106,.13), rgba(216,182,106,0) 72%);
  animation: respiro 9s ease-in-out infinite;
}
body::after {
  bottom: 0; height: 75vh;
  background: radial-gradient(70% 60% at 50% 100%, rgba(52,140,108,.20), rgba(52,140,108,0) 72%);
  animation: respiro 8s ease-in-out infinite reverse;
}
@keyframes respiro {
  0%, 100% { opacity: .65; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.07); }
}

.ar, [lang="ar"] { font-family: var(--arabic); }
.ar { -webkit-user-select: text; user-select: text; direction: rtl; unicode-bidi: isolate; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.005em; line-height: 1.2; margin: 0; }
h1 { font-size: 2rem; margin: 0 0 .35rem; }
h2 { font-size: 1.35rem; margin: 0 0 .5rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 .4rem; }
p { margin: 0 0 .9rem; max-width: 36em; }
a { color: var(--gold); }
:focus-visible { outline: 3px solid var(--gold2); outline-offset: 3px; border-radius: 10px; }

.salta { position: absolute; left: -999px; top: 0; background: var(--gold); color: var(--on-gold); padding: 10px 14px; z-index: 100; border-radius: 0 0 10px 0; }
.salta:focus { left: 0; }

/* ---- intestazione fissa (scura: sull'iPhone le icone della barra di stato sono bianche) ---- */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) calc(14px + env(safe-area-inset-right)) 0 calc(18px + env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg); color: var(--ink);
  border-bottom: 1px solid rgba(36,73,62,.55);
}
.marchio { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; min-height: 44px; }
.marchio svg { color: var(--gold); }
.bottone-i {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: transparent; border: 1.5px solid var(--line); color: var(--gold); cursor: pointer; padding: 0;
}
.bottone-i:active { background: var(--surf); }

/* ---- contenuto ---- */
main {
  max-width: 600px; margin: 0 auto; outline: none;
  padding: calc(var(--header-h) + env(safe-area-inset-top) + 18px) calc(18px + env(safe-area-inset-right))
           calc(var(--barra-h) + env(safe-area-inset-bottom) + 30px) calc(18px + env(safe-area-inset-left));
}
body.con-lettore main { padding-bottom: calc(var(--barra-h) + env(safe-area-inset-bottom) + 120px); }
.vista { animation: entra .5s ease both; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.nota { color: var(--ink2); font-size: .95rem; }
.piccolo { color: var(--ink2); font-size: .9rem; }

/* ---- barra in basso ---- */
.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--barra-h) + env(safe-area-inset-bottom));
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg2); border-top: 1px solid var(--line);
}
.barra a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink2); text-decoration: none; font-size: .78rem; letter-spacing: .02em; min-height: 44px; min-width: 0;
}
.barra a[aria-current="page"] { color: var(--gold); }
.barra a:active { background: rgba(255,255,255,.04); }

/* ---- lettore audio fisso ---- */
.lettore {
  position: fixed; z-index: 29; left: 12px; right: 12px; max-width: 576px; margin: 0 auto;
  bottom: calc(var(--barra-h) + env(safe-area-inset-bottom) + 10px);
  display: flex; align-items: center; gap: 8px;
  background: var(--surf2); border: 1px solid var(--line); border-radius: 22px 22px 22px 8px; padding: 8px 8px 8px 10px;
}
.lt-play, .lt-chiudi {
  flex: none; display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
}
.lt-play { background: var(--gold); color: var(--on-gold); }
.lt-chiudi { background: transparent; color: var(--ink2); }
.lt-chiudi:active { background: rgba(255,255,255,.08); }
.lt-centro { flex: 1; min-width: 0; }
.lt-titolo { font-size: .98rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.lt-tempo { font-size: .8rem; color: var(--ink2); font-variant-numeric: tabular-nums; line-height: 1.2; }
.lt-pos {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 30px; margin: 0; padding: 0; background: transparent; cursor: pointer;
  --p: 0%;
}
.lt-pos::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--gold) var(--p), rgba(239,232,212,.24) var(--p)); }
.lt-pos::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(239,232,212,.24); }
.lt-pos::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--gold); }
.lt-pos::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--gold2); border: 3px solid var(--surf2); }
.lt-pos::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--gold2); border: 3px solid var(--surf2); }

/* ---- bottoni, pillole, chip ---- */
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: 1rem;
  background: var(--gold); color: var(--on-gold);
  padding: 12px 22px; min-height: 48px; border-radius: 999px;
  transition: transform .15s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn.secondario { background: transparent; color: var(--gold); box-shadow: inset 0 0 0 1.5px var(--gold); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn-testo {
  appearance: none; background: transparent; border: 0; color: var(--ink2); font: inherit; font-size: .95rem;
  min-height: 44px; padding: 0 16px; border-radius: 999px; cursor: pointer;
}
.btn-testo:active { background: var(--surf); }

.chip {
  appearance: none; font: inherit; font-size: .98rem; cursor: pointer; line-height: 1.3;
  background: var(--surf); color: var(--ink); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 8px 16px; min-height: 44px;
  transition: background-color .2s, border-color .2s, color .2s;
}
.chip[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.chip-ar { font-family: var(--arabic); font-size: 1.25rem; line-height: 1.7; padding-top: 4px; padding-bottom: 4px; }
.gruppo { margin: 1.5rem 0 0; }
.gruppo-etichetta { font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); margin: 0 0 .5rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- pannelli e righe ---- */
.scheda { background: var(--surf); border-radius: 22px 22px 22px 8px; padding: 20px; margin: 0 0 14px; }
.lista { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; max-width: none; }
.riga {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surf); color: var(--ink); text-decoration: none;
  border-radius: 18px 18px 18px 6px; padding: 14px 18px; min-height: 60px;
}
.riga:active { background: var(--surf2); }
.riga-testo { min-width: 0; }
.riga-titolo { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; line-height: 1.25; display: block; }
.riga-sotto { color: var(--ink2); font-size: .9rem; display: block; }
.freccia { flex: none; color: var(--gold); }
.sezione-titolo { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; margin: 1.8rem 0 .7rem; color: var(--ink2); }

/* ---- Adesso ---- */
.saluto { font-family: var(--serif); font-size: 2.1rem; line-height: 1.15; margin: .2rem 0 .3rem; font-weight: 600; max-width: none; }
.data { color: var(--ink2); margin: 0; font-size: 1rem; line-height: 1.45; }
.data + .data { margin-top: .05rem; }
.momento {
  position: relative; display: block; overflow: hidden; text-decoration: none; color: var(--ink);
  margin: 1.5rem 0 14px; padding: 26px 22px 24px;
  background: linear-gradient(160deg, var(--surf2), var(--surf));
  border: 1px solid var(--line);
  border-radius: 30px 30px 30px 10px;
}
.momento::before {
  content: ""; position: absolute; width: 130%; height: 140%; left: -15%; top: -55%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(216,182,106,.22), rgba(216,182,106,0));
  animation: respiro 8s ease-in-out infinite;
}
.momento > * { position: relative; }
.momento-etichetta { display: block; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-bottom: .55rem; }
.momento-titolo { font-family: var(--serif); font-size: 1.85rem; font-weight: 600; line-height: 1.15; margin: 0 0 .35rem; display: block; }
.momento-sotto { color: var(--ink2); display: block; }
.momento:active { transform: scale(.992); }

/* ---- Aya del giorno e Una parola: letture quiete, non inviti all'azione ---- */
.aya {
  min-width: 0; overflow-wrap: anywhere;
  margin: 1.5rem 0 0; padding: 22px 20px 12px;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 8px 22px 22px 22px;
}
.aya-etichetta { display: block; margin: 0 0 .7rem; font-family: var(--sans); font-size: .8rem; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; line-height: 1.55; color: var(--gold); }
.aya .ar { font-size: 1.55rem; line-height: 2.1; text-align: right; margin: 0; max-width: none; }
.aya-it { margin: .9rem 0 0; color: var(--ink); font-size: 1rem; line-height: 1.55; max-width: none; }
.aya-rif { margin: .5rem 0 0; color: var(--ink2); font-size: .88rem; letter-spacing: .02em; max-width: none; }
.aya-nota { margin: .9rem 0 0; padding-top: .8rem; border-top: 1px solid var(--line); color: var(--ink2); font-family: var(--serif); font-style: italic; font-size: 1rem; line-height: 1.5; max-width: none; }
.aya-link {
  display: inline-flex; align-items: center; min-height: 44px; margin: .3rem 0 0 -4px; padding: 0 4px;
  color: var(--gold); font-size: .95rem; text-underline-offset: 3px;
}
.aya-link:focus-visible { outline: 3px solid var(--gold2); outline-offset: 3px; border-radius: 10px; }

.parola { min-width: 0; overflow-wrap: anywhere; margin: 2.2rem 0 0; padding: 1.4rem 4px 0; border-top: 1px solid var(--line); text-align: center; }
.parola .ar { font-size: 1.25rem; line-height: 2; text-align: center; margin: 0; max-width: none; color: var(--ink2); }
.parola blockquote { margin: .6rem 0 0; font-family: var(--serif); font-size: 1.05rem; line-height: 1.55; color: var(--ink); }
.parola figcaption { margin: .6rem 0 0; color: var(--ink2); font-size: .85rem; letter-spacing: .02em; }

/* ---- Santuario interiore: «Come ti senti ora?» ---- */
.stati { margin: 1.7rem 0 0; }
.stati .sezione-titolo { margin: 0 0 .7rem; }
a.chip { display: inline-flex; align-items: center; text-decoration: none; }
a.chip:active { background: var(--surf2); }
.st-etichetta { margin: 0 0 .35rem; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); max-width: none; }
.st-nota { margin: 2rem 0 0; text-align: center; color: var(--ink2); font-size: .88rem; max-width: none; }

/* ---- Adhkar ---- */
.indietro {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: -6px 0 .6rem -6px; padding: 0 12px 0 6px;
  color: var(--gold); text-decoration: none; font-size: 1rem; border-radius: 999px;
}
.indietro:active { background: var(--surf); }
.intesta { margin-bottom: 1.2rem; }
.intesta .sotto { color: var(--ink2); margin: 0; }
.azioni-testa { margin: 0 0 1.1rem; }
.voce { background: var(--surf); border-radius: 22px 22px 22px 8px; padding: 22px 20px 16px; margin: 0 0 14px; }
.voce-titolo { margin: 0 0 .55rem; max-width: none; color: var(--gold); font-size: .88rem; letter-spacing: .02em; text-transform: none; line-height: 1.4; }
.voce .ar { font-size: 1.55rem; line-height: 2.05; text-align: right; margin: 0; max-width: none; }
.voce-it { margin: .9rem 0 0; color: var(--ink); font-size: 1rem; line-height: 1.55; max-width: none; }
.voce-note { margin: .9rem 0 0; padding-top: .8rem; border-top: 1px solid var(--line); }
.voce-note .ar { font-size: 1.15rem; line-height: 1.9; color: var(--ink2); }
.voce-piede { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: .9rem; min-height: 48px; flex-wrap: wrap; }
.pillola {
  appearance: none; font: inherit; font-size: 1rem; font-variant-numeric: tabular-nums; cursor: pointer;
  background: transparent; color: var(--ink2); border: 1.5px solid var(--line); border-radius: 999px;
  min-height: 44px; min-width: 96px; padding: 6px 20px;
  transition: background-color .2s, color .2s, border-color .2s;
}
.pillola.piena { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.btn-play {
  flex: none; display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  background: var(--surf2); color: var(--gold); border: 1.5px solid var(--line); cursor: pointer; padding: 0; margin-left: auto;
}
.btn-play[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.btn-tutto { display: inline-flex; align-items: center; gap: 8px; }
.fonte { color: var(--ink2); font-size: .88rem; margin: 1.6rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); max-width: none; }

/* ---- Awrad: raccolte e tracce ---- */
.rc-foto {
  display: block; position: relative; overflow: hidden; width: 100%; aspect-ratio: 16 / 9;
  background: linear-gradient(160deg, var(--surf2), var(--surf));
}
.rc-foto img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rc-foto.grande { border-radius: 22px 22px 22px 8px; margin: 0 0 1rem; }
.rc-scheda {
  display: block; overflow: hidden; text-decoration: none; color: var(--ink);
  background: var(--surf); border: 1px solid var(--line); border-radius: 22px 22px 22px 8px; margin: 0 0 14px;
}
.rc-scheda:active { background: var(--surf2); }
.rc-testo { display: block; padding: 14px 18px 16px; }
.rc-autore { display: block; color: var(--gold); font-size: .9rem; margin-top: .1rem; }
.rc-ar { font-size: 1.5rem; line-height: 1.8; margin: 0 0 .15rem; text-align: left; max-width: none; }
.rc-avviso { background: var(--surf); border-radius: 18px 18px 18px 6px; padding: 16px 18px 18px; margin: 0 0 14px; }
.rc-avviso .nota { margin: 0 0 .8rem; }
.tracce { margin-bottom: 1rem; }
.traccia {
  display: flex; align-items: center; gap: 12px; min-height: 64px;
  background: var(--surf); border-radius: 18px 18px 18px 6px; padding: 12px 14px 12px 18px;
}
.traccia-testo { flex: 1; min-width: 0; }
.traccia-ar { font-size: 1.35rem; line-height: 1.75; text-align: left; margin: 0; }

/* ---- Tasbih ---- */
.tb-testo { text-align: center; margin: .2rem 0 .4rem; }
.tb-ar { font-size: 2.1rem; line-height: 1.8; margin: 0; text-align: center; max-width: none; }
.tb-ar.lungo { font-size: 1.35rem; line-height: 1.95; max-height: 9.5em; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tb-it { color: var(--ink2); font-size: .95rem; margin: .1rem auto 0; max-width: 28em; min-height: 1.5em; }
.tb-zona { display: grid; place-items: center; margin: .6rem 0 .2rem; }
.tb-bottone {
  position: relative; display: block; width: min(86vw, 380px); aspect-ratio: 1; padding: 0; margin: 0;
  background: transparent; border: 0; border-radius: 50%; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.tb-bottone svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tb-bottone:focus-visible { outline: 3px solid var(--gold2); outline-offset: 6px; }
.tb-disco { fill: var(--surf); stroke: var(--line); stroke-width: 1; }
.tb-num { font-family: var(--serif); fill: var(--ink); font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.perla { fill: var(--surf2); stroke: var(--line); stroke-width: .7; transition: fill .25s, stroke .25s; }
.perla.on { fill: var(--gold); stroke: var(--gold2); }
.tb-bottone.batte .tb-disco, .tb-bottone.batte .tb-num { animation: batte .16s ease-out; transform-origin: 100px 100px; }
@keyframes batte { 0% { transform: scale(1); } 40% { transform: scale(.955); } 100% { transform: scale(1); } }
.tb-alone {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none; opacity: 0;
  border: 2px solid var(--gold2); box-shadow: 0 0 40px rgba(216,182,106,.35);
}
.tb-alone.va { animation: alone 1.4s ease-out; }
@keyframes alone { 0% { opacity: .85; transform: scale(.78); } 100% { opacity: 0; transform: scale(1.32); } }
.tb-stato { text-align: center; min-height: 1.9em; margin: .5rem 0 .1rem; color: var(--gold); font-family: var(--serif); font-size: 1.2rem; max-width: none; }
.tb-ricomincia { text-align: center; margin: 0; }

/* ---- finestra dal basso ---- */
.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(3,10,8,.65); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card {
  width: 100%; max-width: 600px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; background: var(--bg2);
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: 28px 28px 0 0; padding: 24px 22px calc(28px + env(safe-area-inset-bottom)); outline: none;
}
.sheet-card h2 { margin-top: 0; }
.sheet-azioni { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 1rem; }
.sheet-azioni + .nota { margin-top: 1rem; }
.spunta { display: flex; gap: 14px; align-items: center; min-height: 48px; margin: .6rem 0; cursor: pointer; }
.spunta input { width: 24px; height: 24px; accent-color: var(--gold); flex: none; }
.barra-carico { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: .4rem 0 .5rem; }
.barra-carico span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .25s; }
.versione { color: var(--ink2); font-size: .88rem; margin: 1.6rem 0 0; }

@media (min-width: 700px) { body { font-size: 19px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
