/* ── Tehilim module — standalone styles ─────────────────────────────
   The module deliberately ships its own CSS so the URL /tehilim feels
   like its own little site (warm parchment palette + a serif body
   font that suits Hebrew religious texts). No dependency on
   homei.css. ────────────────────────────────────────────────────── */

:root {
  --th-bg:         #f6efde;
  --th-bg-card:    #fdf8e8;
  --th-bg-card-2:  #f9f0d4;
  --th-ink:        #2c2618;
  --th-ink-2:      #5a4f38;
  --th-ink-soft:   #897a58;
  --th-accent:     #6b4c1f;
  --th-accent-2:   #b8902f;
  --th-line:       #d8c89a;
  --th-danger:     #b03030;
  --th-success:    #2e7a4a;
  --th-claim:      #b3851e;
  --th-shadow:     0 4px 12px rgba(0,0,0,0.08);
  --th-radius:     12px;
  --th-radius-sm:  8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--th-bg);
  color: var(--th-ink);
  font-family: "Rubik", "Frank Ruhl Libre", "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: var(--th-accent);
  text-decoration: none;
  transition: color .15s ease;
}
a:hover { color: var(--th-ink); text-decoration: underline; }

/* ── Header ───────────────────────────────────────────────────── */

.tehilim-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--th-bg);
  border-bottom: 1px solid var(--th-line);
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
.tehilim-header-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.tehilim-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--th-ink);
  font-weight: 700;
  font-size: 18px;
}
.tehilim-brand:hover { text-decoration: none; color: var(--th-accent); }
.tehilim-brand-mark { font-size: 22px; }

.tehilim-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tehilim-nav a {
  padding: 8px 12px;
  border-radius: var(--th-radius-sm);
  color: var(--th-ink-2);
  font-size: 15px;
}
.tehilim-nav a:hover {
  background: var(--th-bg-card);
  text-decoration: none;
}
.tehilim-nav-user {
  padding: 8px 10px;
  color: var(--th-ink-soft);
  font-size: 14px;
}
.tehilim-nav-cta {
  background: var(--th-accent);
  color: #fff !important;
}
.tehilim-nav-cta:hover { background: var(--th-ink); color: #fff !important; }

/* Sub-nav row under the main header — buttons for the other Tehilim parts. */
.tehilim-subnav {
  background: var(--th-bg-card);
  border-top: 1px solid var(--th-line);
  padding: 8px 18px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 980px;
  margin: 0 auto;
}
.tehilim-subnav-link {
  padding: 6px 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--th-ink-2);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all .15s ease;
}
.tehilim-subnav-link:hover {
  text-decoration: none;
  background: var(--th-bg-card-2);
  color: var(--th-accent);
  border-color: var(--th-line);
}

/* ── Main + Hero ─────────────────────────────────────────────── */

.tehilim-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 18px 60px;
}

.tehilim-hero {
  background: var(--th-bg-card);
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  padding: 28px 24px;
  margin-bottom: 28px;
  text-align: center;
  box-shadow: var(--th-shadow);
}
.tehilim-hero-title {
  font-family: "Frank Ruhl Libre", "Times New Roman", serif;
  font-weight: 700;
  font-size: 30px;
  margin: 0 0 8px;
  color: var(--th-ink);
}
.tehilim-hero-sub {
  margin: 0 auto 18px;
  max-width: 640px;
  color: var(--th-ink-2);
}
.tehilim-hero-cta {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Buttons ─────────────────────────────────────────────────── */

.tehilim-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--th-radius-sm);
  border: 1px solid var(--th-line);
  background: var(--th-bg-card);
  color: var(--th-ink);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
}
.tehilim-btn:hover {
  text-decoration: none;
  border-color: var(--th-accent);
  background: var(--th-bg-card-2);
}
.tehilim-btn-primary {
  background: var(--th-accent);
  border-color: var(--th-accent);
  color: #fff;
}
.tehilim-btn-primary:hover {
  background: var(--th-ink);
  border-color: var(--th-ink);
  color: #fff;
}
.tehilim-btn-ghost {
  background: transparent;
}
.tehilim-btn-big {
  padding: 14px 28px;
  font-size: 17px;
  font-weight: 600;
}

/* ── Section + Chapter Grid ──────────────────────────────────── */

.tehilim-section-title {
  font-family: "Frank Ruhl Libre", "Times New Roman", serif;
  font-size: 20px;
  margin: 0 0 14px;
  color: var(--th-ink);
}

.tehilim-grid-section { margin-top: 8px; }

/* ── Tehilim Yomi ──────────────────────────────────────────── */

.tehilim-yomi-tabs {
  display: flex;
  gap: 6px;
  justify-content: center;
  max-width: 720px;
  margin: 0 auto 18px;
  flex-wrap: wrap;
}
.tehilim-yomi-tab {
  flex: 1 1 140px;
  text-align: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--th-line);
  background: var(--th-bg-card);
  color: var(--th-ink-2);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s ease;
}
.tehilim-yomi-tab:hover {
  text-decoration: none;
  border-color: var(--th-accent);
  color: var(--th-accent);
}
.tehilim-yomi-tab-active {
  background: var(--th-accent);
  color: #fff !important;
  border-color: var(--th-accent);
}
.tehilim-yomi-hero {
  text-align: center;
  margin-bottom: 18px;
}
.tehilim-yomi-title {
  font-family: "Noto Serif Hebrew", "Frank Ruhl Libre", serif;
  font-size: 26px;
  margin: 6px 0 4px;
  color: var(--th-ink);
}
.tehilim-yomi-subtitle {
  margin: 0 0 14px;
  color: var(--th-ink-2);
  font-size: 14px;
}
.tehilim-yomi-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 10px;
}
.tehilim-yomi-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--th-bg-card-2);
  border: 1px solid var(--th-line);
  color: var(--th-ink-2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s ease;
}
.tehilim-yomi-pill:hover {
  text-decoration: none;
  border-color: var(--th-accent);
  color: var(--th-accent);
}
.tehilim-yomi-pill-active {
  background: var(--th-accent);
  color: #fff !important;
  border-color: var(--th-accent);
}

/* Section cells (הסכמות / הקדמת המלקט) live in the same grid as
   chapter cells, with identical box dimensions, but show the section
   title text instead of a large gematria numeral. Spans two columns
   when there's room so the Hebrew title doesn't truncate. */
.tehilim-cell-section {
  grid-column: span 2;
}
.tehilim-cell-section-title {
  font-family: "Noto Serif Hebrew", "Frank Ruhl Libre", serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  color: var(--th-ink);
}
.tehilim-cell-section:hover .tehilim-cell-section-title {
  color: var(--th-accent);
}

/* "×N" badge stuck to the corner of a "read" cell to indicate how
   many times the chapter has been completed by the group. */
.tehilim-cell-badge {
  position: absolute;
  top: -6px;
  inset-inline-start: -6px;
  background: var(--th-danger);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  border: 2px solid var(--th-bg-card);
}
.tehilim-cell { position: relative; }
/* Multi-read cells get a deeper border to stand out from
   first-time-read cells. */
.tehilim-cell-multi {
  border-width: 2px !important;
  background: #fff !important;
}

.tehilim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.tehilim-cell-form {
  margin: 0;
  padding: 0;
  display: block;
}
.tehilim-cell {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  padding: 10px 4px;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius-sm);
  background: var(--th-bg-card);
  color: var(--th-ink);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: all .15s ease;
}
.tehilim-cell:hover {
  text-decoration: none;
  border-color: var(--th-accent);
  background: var(--th-bg-card-2);
  transform: translateY(-1px);
}
.tehilim-cell-num {
  font-family: "Frank Ruhl Libre", "Times New Roman", serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.tehilim-cell-tag {
  font-size: 11px;
  color: var(--th-ink-soft);
}

/* "claimed" — chapter being read by someone right now */
.tehilim-cell-claimed {
  background: #fbf4dc;
  border-color: var(--th-claim);
  color: var(--th-claim);
}
.tehilim-cell-claimed .tehilim-cell-tag { color: var(--th-claim); }

/* "read" — chapter already done. Red per spec. */
.tehilim-cell-read {
  background: #fff;
  border-color: var(--th-danger);
  color: var(--th-danger);
}
.tehilim-cell-read .tehilim-cell-num,
.tehilim-cell-read .tehilim-cell-tag {
  color: var(--th-danger);
}

/* ── Group landing ───────────────────────────────────────────── */

.tehilim-group-hero {
  background: var(--th-bg-card);
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  padding: 24px 22px;
  margin-bottom: 24px;
  text-align: center;
  box-shadow: var(--th-shadow);
}
.tehilim-group-hero h1 {
  font-family: "Frank Ruhl Libre", "Times New Roman", serif;
  margin: 0 0 6px;
  font-size: 28px;
  color: var(--th-ink);
}
.tehilim-dedication {
  font-family: "Noto Serif Hebrew", "Frank Ruhl Libre", "Times New Roman", serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--th-accent);
  background: #fff;
  border: 1px dashed var(--th-accent);
  border-radius: var(--th-radius-sm);
  padding: 14px 18px;
  margin-bottom: 14px;
  white-space: pre-wrap;
  line-height: 1.5;
  text-align: center;
}
.tehilim-dedication-mini {
  font-size: 16px;
  font-weight: 700;
  color: var(--th-accent);
  margin-top: 4px;
}
.tehilim-tzedaka {
  font-family: "Noto Serif Hebrew", "Frank Ruhl Libre", serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--th-accent);
  background: #fff;
  border: 2px solid var(--th-accent);
  border-radius: var(--th-radius-sm);
  padding: 12px 16px;
  margin: 14px auto;
  max-width: 720px;
  text-align: center;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.tehilim-tzedaka a {
  color: var(--th-accent);
  text-decoration: underline;
  font-weight: 800;
  white-space: nowrap;
}
.tehilim-tzedaka a:hover {
  color: var(--th-ink);
}
.tehilim-group-status {
  margin: 8px 0 16px;
  color: var(--th-ink-2);
  font-size: 15px;
}
.tehilim-group-cta { margin: 8px 0; }
.tehilim-group-hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--th-ink-soft);
}
.tehilim-group-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--th-bg-card);
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius-sm);
  font-size: 14px;
}

/* ── Banner ─────────────────────────────────────────────────── */

.tehilim-banner {
  border-radius: var(--th-radius-sm);
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 15px;
}
.tehilim-banner-success {
  background: #e7f3eb;
  border: 1px solid #b6dbc4;
  color: var(--th-success);
}

/* ── Reader ─────────────────────────────────────────────────── */

.tehilim-reader {
  background: var(--th-bg-card);
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  padding: 28px 26px 32px;
  box-shadow: var(--th-shadow);
}
.tehilim-chapter-head { text-align: center; margin-bottom: 22px; }
.tehilim-chapter-eyebrow {
  color: var(--th-ink-soft);
  font-size: 13px;
  letter-spacing: .03em;
  margin-bottom: 6px;
}
.tehilim-chapter-num {
  font-family: "Frank Ruhl Libre", "Times New Roman", serif;
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--th-ink);
}
.tehilim-chapter-progress {
  color: var(--th-ink-soft);
  font-size: 13px;
}

/* Read-aloud button + hidden audio player at the top of every
   chapter / section. The audio reveals itself only after a click,
   so the page doesn't pre-fetch ~MB of WAV per chapter. */
.tehilim-fontsize-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  background: var(--th-bg-card-2);
  border: 1px solid var(--th-line);
  border-radius: 999px;
  padding: 3px;
}
.tehilim-fontsize-btn {
  background: transparent;
  border: 0;
  color: var(--th-accent);
  font-family: inherit;
  font-weight: 700;
  min-width: 36px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
}
.tehilim-fontsize-btn:nth-child(1) { font-size: 13px; }
.tehilim-fontsize-btn:nth-child(2) { font-size: 15px; }
.tehilim-fontsize-btn:nth-child(3) { font-size: 18px; }
.tehilim-fontsize-btn:hover,
.tehilim-fontsize-btn:focus-visible {
  background: var(--th-accent);
  color: var(--th-bg-card-2);
  outline: none;
}

.tehilim-tts-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.tehilim-tts-btn {
  background: var(--th-bg-card-2);
  border: 1px solid var(--th-accent);
  color: var(--th-accent);
  padding: 8px 18px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.tehilim-tts-btn:hover:not(:disabled) {
  background: var(--th-accent);
  color: #fff;
}
.tehilim-tts-btn:disabled { opacity: .6; cursor: progress; }
.tehilim-tts-alt {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--th-line);
  background: transparent;
  color: var(--th-ink-2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s ease;
}
.tehilim-tts-alt:hover {
  text-decoration: none;
  border-color: var(--th-accent);
  color: var(--th-accent);
  background: var(--th-bg-card-2);
}
.tehilim-tts-player {
  width: min(420px, 100%);
}
.tehilim-tts-hint {
  font-size: 12px;
  color: var(--th-ink-soft);
}
html { --th-font-step: 0; }
html[data-tn-no-motion] *, html[data-tn-no-motion] *::before,
html[data-tn-no-motion] *::after {
  animation-duration: 0s !important;
  transition-duration: 0s !important;
}
html[data-tn-contrast] {
  --th-bg:        #fff;
  --th-bg-card:   #fff;
  --th-bg-card-2: #fff;
  --th-ink:       #000;
  --th-ink-2:     #000;
  --th-ink-soft:  #222;
  --th-line:      #000;
  --th-accent:    #000;
}
html[data-tn-contrast] .tehilim-cell,
html[data-tn-contrast] .tehilim-form-card,
html[data-tn-contrast] .tehilim-reader { border-width: 2px; }
html[data-tn-underline] a,
html[data-tn-underline] .tehilim-nav a { text-decoration: underline; }

/* Universal focus indicator (WCAG 2.4.7). */
.tehilim-body *:focus-visible {
  outline: 3px solid var(--th-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Skip-to-content link, visible only on keyboard focus. */
.tehilim-skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  top: auto;
  background: var(--th-ink);
  color: #fff;
  padding: 8px 14px;
  border-radius: 0 0 6px 6px;
  z-index: 1000;
}
.tehilim-skip-link:focus {
  inset-inline-start: 12px;
  top: 6px;
}

/* Bump body text proportionally to the font-step preference. */
.tehilim-chapter-body {
  font-family: "Noto Serif Hebrew", "Frank Ruhl Libre",
               "SBL Hebrew", "Times New Roman", serif;
  font-size: calc(26px * (1 + var(--th-font-step, 0)));
  line-height: 2.05;
  color: var(--th-ink);
  max-width: 720px;
  margin: 0 auto;
  text-align: justify;
  font-weight: 800;
  letter-spacing: 0.005em;
}
.tehilim-chapter-body p {
  margin: 0 0 1.15em;
  text-indent: 1.6em;
}
.tehilim-chapter-body p:first-child { text-indent: 0; }
.tehilim-chapter-body p:first-child::first-letter {
  font-size: 1.35em;
  font-weight: 700;
  color: var(--th-accent);
  padding-inline-end: 2px;
}
.tehilim-chapter-body strong { font-weight: 700; color: var(--th-accent); }
.tehilim-chapter-body em { font-style: italic; color: var(--th-ink-2); }
.tehilim-chapter-body small { font-size: .78em; color: var(--th-ink-soft); }
.tehilim-chapter-body sup { font-size: .7em; color: var(--th-accent); }

.tehilim-chapter-controls {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.tehilim-prev-next {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.tehilim-done-form { margin: 0; }

/* ── Dialog (next-chapter prompt) ───────────────────────────── */

.tehilim-dialog {
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  padding: 22px 22px 18px;
  background: var(--th-bg-card);
  box-shadow: 0 12px 28px rgba(0,0,0,0.18);
  max-width: 360px;
  width: calc(100% - 32px);
  color: var(--th-ink);
}
.tehilim-dialog::backdrop {
  background: rgba(40, 30, 10, .35);
}
.tehilim-dialog h2 {
  font-family: "Frank Ruhl Libre", "Times New Roman", serif;
  margin: 0 0 6px;
  font-size: 22px;
}
.tehilim-dialog p { margin: 0 0 14px; color: var(--th-ink-2); }
.tehilim-dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ── Forms ─────────────────────────────────────────────────── */

.tehilim-form-card {
  background: var(--th-bg-card);
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  padding: 24px 22px;
  max-width: 560px;
  margin: 0 auto;
  box-shadow: var(--th-shadow);
}
.tehilim-form-card h1 {
  font-family: "Frank Ruhl Libre", "Times New Roman", serif;
  margin: 0 0 6px;
  font-size: 24px;
  color: var(--th-ink);
}
.tehilim-form-sub {
  margin: 0 0 16px;
  color: var(--th-ink-2);
  font-size: 14px;
}
.tehilim-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tehilim-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--th-ink-2);
}
.tehilim-form input,
.tehilim-form textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--th-ink);
  padding: 10px 12px;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius-sm);
  background: #fff;
  width: 100%;
}
.tehilim-readers-textarea {
  font-family: "Noto Serif Hebrew", "Frank Ruhl Libre", serif;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre;
}

.tehilim-yomi-ref {
  margin-top: 10px;
  font-family: "Noto Serif Hebrew", serif;
  font-size: 17px;
  color: var(--th-accent);
  font-weight: 600;
}

/* פשוט / מפורש toggle */
.tehilim-yomi-mode {
  display: inline-flex;
  background: var(--th-bg-card-2);
  border: 1px solid var(--th-line);
  border-radius: 999px;
  padding: 3px;
  margin: 14px auto 18px;
  gap: 0;
}
.tehilim-yomi-mode {
  display: flex;
  justify-content: center;
  max-width: 240px;
  margin-inline: auto;
}
.tehilim-mode-btn {
  background: transparent;
  border: 0;
  padding: 8px 18px;
  border-radius: 999px;
  color: var(--th-ink-2);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.tehilim-mode-btn:hover { color: var(--th-ink); }
.tehilim-mode-active {
  background: var(--th-accent);
  color: #fff;
}
.tehilim-mode-active:hover { color: #fff; }

.tehilim-yomi-explained {
  margin: 0 auto;
  max-width: 720px;
}
.tehilim-yomi-explained-note {
  font-size: 13px;
  color: var(--th-ink-soft);
  margin: 0 0 10px;
}
.tehilim-yomi-iframe {
  width: 100%;
  height: 70vh;
  min-height: 480px;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius-sm);
  background: #fff;
}
.tehilim-yomi-iframe-fallback {
  margin: 10px 0 0;
  text-align: center;
}

.tehilim-yomi-date-form {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}
.tehilim-yomi-date-form input[type="date"] {
  padding: 7px 10px;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius-sm);
  background: #fff;
  color: var(--th-ink);
  font-family: inherit;
  font-size: 14px;
}
.tehilim-profile-stats {
  margin: 4px 0 12px;
  color: var(--th-ink-2);
  font-size: 14px;
}
.tehilim-form input:focus,
.tehilim-form textarea:focus {
  outline: 2px solid var(--th-accent);
  outline-offset: 1px;
}
.tehilim-form small {
  color: var(--th-ink-soft);
  font-size: 12px;
}
.tehilim-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 480px) {
  .tehilim-form-row { grid-template-columns: 1fr; }
}
.tehilim-form-error {
  background: #fff0ed;
  border: 1px solid #f0bdb3;
  color: var(--th-danger);
  padding: 10px 12px;
  border-radius: var(--th-radius-sm);
  margin-bottom: 12px;
  font-size: 14px;
}
.tehilim-form-link {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--th-ink-2);
  text-align: center;
}
.tehilim-form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  justify-content: center;
}

/* ── Created group / Admin: link boxes ─────────────────────── */

.tehilim-link-box {
  background: #fff;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius);
  padding: 14px 16px;
  margin: 14px 0;
}
.tehilim-link-box-public {
  background: #fff;
  border: 2px solid var(--th-accent);
  box-shadow: 0 0 0 4px rgba(107, 76, 31, 0.08);
}
.tehilim-link-box-admin {
  background: #fbf4dc;
  border-color: var(--th-claim);
}
.tehilim-link-label {
  font-size: 14px;
  color: var(--th-ink);
  font-weight: 600;
  margin-bottom: 10px;
}
.tehilim-link-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.tehilim-link-row input {
  flex: 1;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius-sm);
  background: #fff;
  color: var(--th-ink);
  direction: ltr;
  text-align: left;
}
.tehilim-link-row input:focus {
  outline: 2px solid var(--th-accent);
  outline-offset: 1px;
}
.tehilim-link-row .tehilim-btn {
  padding-inline: 18px;
  white-space: nowrap;
}
.tehilim-link-hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--th-ink-soft);
}

.tehilim-share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.tehilim-btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.tehilim-created-card {
  max-width: 640px;
}

/* ── Toast ─────────────────────────────────────────────────── */

.tehilim-toast {
  position: fixed;
  bottom: 24px;
  inset-inline-start: 50%;
  transform: translateX(50%) translateY(20px);
  background: var(--th-ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
}
.tehilim-toast-show {
  opacity: 1;
  transform: translateX(50%) translateY(0);
}
[dir="rtl"] .tehilim-toast {
  transform: translateX(-50%) translateY(20px);
}
[dir="rtl"] .tehilim-toast-show {
  transform: translateX(-50%) translateY(0);
}

/* ── Utility row above the footer (נגישות / הורד כאפליקציה) ─── */

.tehilim-utility-row {
  max-width: 980px;
  margin: 24px auto 0;
  padding: 0 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--th-line);
  padding-top: 14px;
}
.tehilim-utility-link {
  background: transparent;
  border: 0;
  color: var(--th-accent);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: var(--th-radius-sm);
}
.tehilim-utility-link:hover {
  background: var(--th-bg-card);
  text-decoration: underline;
}
.tehilim-utility-install {
  background: var(--th-accent);
  color: #fff;
  padding: 10px 18px;
}
.tehilim-utility-install:hover {
  background: var(--th-ink);
  color: #fff;
  text-decoration: none;
}

/* ── Cookie consent banner ──────────────────────────────────── */

.tehilim-cookies {
  position: fixed;
  bottom: 12px;
  inset-inline: 12px;
  max-width: 720px;
  margin: 0 auto;
  background: var(--th-bg-card);
  border: 1px solid var(--th-accent);
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  padding: 14px 16px;
  border-radius: var(--th-radius);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  z-index: 90;
}
.tehilim-cookies[hidden] { display: none; }
.tehilim-cookies-text {
  margin: 0;
  font-size: 14px;
  color: var(--th-ink-2);
  flex: 1;
  min-width: 220px;
}

/* ── Accessibility dialog ───────────────────────────────────── */

.tehilim-a11y-panel {
  border: 1px solid var(--th-accent);
  border-radius: var(--th-radius);
  background: var(--th-bg-card);
  padding: 22px;
  width: calc(100% - 32px);
  max-width: 460px;
  color: var(--th-ink);
  box-shadow: 0 14px 36px rgba(0,0,0,0.25);
}
.tehilim-a11y-panel::backdrop { background: rgba(40,30,10,.45); }
.tehilim-a11y-form h2 {
  margin: 0 0 12px;
  font-family: "Noto Serif Hebrew", serif;
  font-size: 22px;
}
.tehilim-a11y-row { margin-bottom: 14px; }
.tehilim-a11y-row label { display: block; font-size: 14px; color: var(--th-ink-2); margin-bottom: 6px; }
.tehilim-a11y-fontctrl {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tehilim-a11y-fontctrl button {
  background: var(--th-bg-card-2);
  border: 1px solid var(--th-line);
  border-radius: var(--th-radius-sm);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  color: var(--th-ink);
}
.tehilim-a11y-fontctrl button:hover { border-color: var(--th-accent); }
.tehilim-a11y-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin-bottom: 0 !important;
  font-size: 15px;
  cursor: pointer;
}
.tehilim-a11y-check input { transform: scale(1.2); }
.tehilim-a11y-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  border-top: 1px solid var(--th-line);
  padding-top: 12px;
  margin-top: 6px;
}

/* ── Footer ─────────────────────────────────────────────────── */

.tehilim-footer {
  text-align: center;
  padding: 22px 18px 30px;
  color: var(--th-ink-soft);
  font-size: 13px;
  border-top: 1px solid var(--th-line);
  background: var(--th-bg);
}
.tehilim-footer-line a {
  color: var(--th-accent);
  font-weight: 500;
}
.tehilim-footer-dedication {
  margin-top: 6px;
  font-family: "Noto Serif Hebrew", "Frank Ruhl Libre", "Times New Roman", serif;
  color: var(--th-accent);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.5;
  max-width: 620px;
  margin-inline: auto;
}

/* ── Small screens ──────────────────────────────────────────── */

@media (max-width: 600px) {
  .tehilim-chapter-body { font-size: 23px; line-height: 1.95; font-weight: 600; }
  .tehilim-chapter-num { font-size: 30px; }
  .tehilim-hero-title { font-size: 24px; }
  .tehilim-reader { padding: 22px 16px 26px; }
  .tehilim-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
}
