/* Gate of Noor — visual system lifted from the TraceQuran Studio v1 prototype the owner
   approved (tokens and component rules copied verbatim from ~/tracequran-recovered/v1-index.html
   wherever the layout allows). Light study-desk look: white panels, cream ruled paper,
   teal/gold/rose accents. No dark theme, no audio anywhere. Mobile-first. */

:root {
  --ink: #102c2a;
  --muted: #58706b;
  --line: #d6c7a7;
  --paper: #fbf7ed;
  --paper-deep: #efe3c7;
  --panel: #ffffff;
  --teal: #0d514c;
  --teal-soft: #d7ebe6;
  --gold: #c69a37;
  --rose: #9a4f48;
  --shadow: 0 18px 45px rgba(22, 37, 34, .14);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(198, 154, 55, .16), transparent 30%),
    linear-gradient(135deg, #f6f1e6 0%, #eef6f3 50%, #fffaf0 100%);
}
img, canvas { max-width: 100%; }
button, select, input { font: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

*:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* ══════════════════════════════════════════════
   APP SHELL — sidebar + main workspace
═══════════════════════════════════════════════ */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.sidebar, .workspace, .bottom-panel, .journey-panel, .sheet {
  background: rgba(255, 255, 255, .86);
  border: 1px solid rgba(16, 44, 42, .1);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.sidebar {
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-self: start;
}
/* The sidebar itself only becomes a scroll container on a short viewport (laptop lid
   half-open, a landscape phone, etc) — everything above 760px tall fits without it, so
   Journey/Account/About and the Today+Routine block never depend on scrolling to be
   seen. Below 760px, the sidebar scrolls as a whole so the controls further down are
   still reachable without the page itself growing past the viewport. */
@media (max-height: 759.98px) {
  .sidebar {
    max-height: calc(100vh - 36px); /* 36px = .app's 18px padding, top + bottom */
    overflow-y: auto;
  }
}

.brand { display: flex; align-items: center; gap: 12px; }
.mark {
  width: 46px; height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: #f8dc80;
  font-family: 'Amiri', serif;
  font-size: 26px;
  font-weight: 800;
  flex-shrink: 0;
}
h1 { font-size: 1.35rem; line-height: 1.12; }
.subtitle { color: var(--muted); font-size: .92rem; line-height: 1.45; margin-top: 4px; }

.group { display: grid; gap: 10px; }
.group-title {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6c675b;
  font-weight: 800;
}

/* ── Today ayah list ── */
.ayah-list { display: grid; gap: 8px; max-height: 34vh; overflow-y: auto; }
.ayah-btn, .tool-btn, .chip {
  min-height: 44px;
  border: 1px solid rgba(13, 81, 76, .16);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}
.ayah-btn {
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  display: grid;
  gap: 4px;
}
.ayah-btn[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-soft); }
.ayah-name { font-weight: 800; font-size: .96rem; }
.ayah-meta { color: var(--muted); font-size: .82rem; }

/* ── generic outline button (also used standalone: Change surah, sheet close, etc) ── */
.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  font-weight: 750;
  width: 100%;
}
.tool-btn:hover { border-color: var(--teal); }
.tool-btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.tool-btn.primary:hover { background: #0a3f3b; }
.tool-btn.warn { color: var(--rose); border-color: rgba(154, 79, 72, .28); }
.tool-btn.warn:hover { background: rgba(154, 79, 72, .06); }
.tool-btn:disabled { opacity: .55; cursor: not-allowed; }
.field-btn { margin-top: 12px; }

.link-btn {
  display: block;
  width: 100%;
  min-height: 40px;
  background: none;
  border: none;
  color: var(--teal);
  font-weight: 700;
  font-size: .88rem;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 0;
}

/* ── Journey / Account / About — three small pills right under the brand block, always
   visible without scrolling (see the .sidebar media query above) ── */
.sidebar-pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sidebar-pills-4 { grid-template-columns: repeat(4, 1fr); }
.pill-btn {
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(13, 81, 76, .18);
  background: #fff;
  color: var(--teal);
  font-weight: 700;
  font-size: .82rem;
  cursor: pointer;
  touch-action: manipulation;
  padding: 0 6px;
  /* .pill-btn is also used on the <a> Museum link — same look as the <button> pills. */
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
}
.pill-btn:hover { border-color: var(--teal); background: var(--teal-soft); }

/* ── controls (ink / stroke / guide / writing mode) ── */
.controls { display: grid; gap: 12px; }
.control-row { display: grid; gap: 6px; }
label { font-size: .88rem; font-weight: 750; color: #405a56; }
select, input[type="range"] { width: 100%; }
select {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid rgba(13, 81, 76, .18);
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}
input[type="range"] { accent-color: var(--teal); }

.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chips.chips-2 { grid-template-columns: repeat(2, 1fr); }
.level-exhausted { display: grid; gap: 8px; margin-top: 4px; }
.chip { display: grid; place-items: center; padding: 8px; font-weight: 700; }
.chip[aria-pressed="true"] { background: var(--teal); color: #fff; border-color: var(--teal); }

.progress, .goal-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: #f6fbf9;
  border: 1px solid rgba(13, 81, 76, .12);
}
.meter { height: 10px; border-radius: 999px; background: #dce8e5; overflow: hidden; }
.meter span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width .25s ease;
}

/* ── one-year goal panel (sidebar, replaces the old Routine box) ── */
.goal-line { font-size: .88rem; color: var(--ink); line-height: 1.4; }
.goal-meter span { background: linear-gradient(90deg, var(--gold), var(--teal)); } /* gold -> teal, whole-Quran progress */
.goal-status { font-size: .84rem; font-weight: 750; margin-top: 2px !important; }
.goal-status.on-track { color: #1a8a72; } /* calm green-teal */
.goal-status.behind { color: var(--rose); }

/* Same four lines, reused atop the Journey screen for members. */
.journey-goal-lines { display: grid; gap: 4px; margin-bottom: 4px; font-size: .88rem; color: var(--ink); }
.journey-goal-status { font-weight: 750; margin-top: 2px; }
.journey-goal-status.on-track { color: #1a8a72; }
.journey-goal-status.behind { color: var(--rose); }

/* ══════════════════════════════════════════════
   MAIN WORKSPACE
═══════════════════════════════════════════════ */
.main {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 18px;
}

.workspace {
  position: relative;
  border-radius: 8px;
  padding: 16px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.topbar h2 { font-size: 1.05rem; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.actions .tool-btn { width: auto; padding: 0 14px; min-height: 44px; }

.zoom-group {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(13, 81, 76, .16);
  border-radius: 8px;
  overflow: hidden;
}
.zoom-group .zoom-btn {
  width: 40px;
  min-width: 40px;
  min-height: 44px;
  border: none;
  border-radius: 0;
  font-size: 1.1rem;
}
.zoom-value {
  min-width: 46px;
  text-align: center;
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
}

/* ── the writing paper ── */
/* ── paper + art plate: always stacked, paper then plate, full width, at every size —
   no side column, no sticky. A painting on every ayah, directly under the paper it
   belongs to. ── */
.paper-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}
.paper-row.no-plate .art-plate-frame { display: none; }

/* Paintings are NOT all one shape — many are wide/landscape, not the 1000x900 (10:9)
   most are. The frame hugs each painting's OWN real aspect ratio (app.js sets
   --plate-aspect from the loaded image's naturalWidth/naturalHeight) so object-fit:
   contain below fills it edge to edge with no crop AND no letterboxed cream bands.
   10/9 is only the fallback before an image has loaded once. Full width, no max-height
   cap — the frame's height is simply width / aspect, so the whole painting shows with
   nothing to letterbox against. */
.art-plate-frame {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--paper-deep);
  cursor: pointer;
  aspect-ratio: var(--plate-aspect, 1.111);
}
.art-plate-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* the WHOLE painting, never cropped */
  object-position: center;
  opacity: 0;
  transition: opacity 400ms ease;
}
.art-plate-img.active { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .art-plate-img { transition: none; }
}

.page {
  position: relative;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 0 48px, rgba(198, 154, 55, .22) 49px, transparent 50px),
    repeating-linear-gradient(0deg, transparent 0 66px, rgba(120, 101, 62, .19) 67px, transparent 68px),
    var(--paper);
  border: 1px solid var(--line);
  min-height: 38vh;
  /* No max-height, no inner scroll, at any size. app.js's positionTranslationChip grows
     #page's own min-height to fit the guide + glosses + translation chip (see that
     function's comment) — on a long ayah (2:255 is ~3.8x a viewport tall) that just
     makes a tall paper, and the ONE document scrollbar carries the reader through it,
     the art plate included, instead of a scrollbar nested inside the paper card. */
  overflow: visible;
}
@media (min-width: 700px) {
  .page { min-height: 45vh; }
}

.trace-text { position: absolute; inset: 0; pointer-events: none; }
.translation-chip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(720px, 88%);
  direction: ltr;
  text-align: center;
  color: rgba(16, 44, 42, .62);
  font-size: .98rem;
  line-height: 1.5;
  background: rgba(255, 255, 255, .8);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(16, 44, 42, .08);
}

#writerCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.rise-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  pointer-events: none;
  font-family: 'Amiri', 'Scheherazade New', serif;
  font-size: clamp(1.5rem, 5vw, 2.6rem);
  color: var(--gold);
  text-shadow: 0 0 18px rgba(198, 154, 55, .35);
  opacity: 0;
  background: rgba(251, 247, 237, .65);
}
.rise-overlay.rising { animation: riseFade 2.2s ease forwards; }
@keyframes riseFade {
  0%   { opacity: 0; transform: translateY(18px) scale(0.97); }
  16%  { opacity: 1; transform: translateY(0) scale(1); }
  72%  { opacity: 0.85; transform: translateY(-22px) scale(1.01); }
  100% { opacity: 0; transform: translateY(-70px) scale(1.02); }
}
@media (prefers-reduced-motion: reduce) {
  .rise-overlay.rising { animation: riseFadeReduced 0.6s ease forwards; }
}
@keyframes riseFadeReduced {
  0% { opacity: 0; }
  40% { opacity: 1; }
  100% { opacity: 0; }
}

/* ── art interlude — a painting between ayahs, illuminated-manuscript style ── */
.art-interlude {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 28px 24px;
  background: var(--paper);
  opacity: 0;
  transition: opacity 600ms ease;
  pointer-events: none;
}
.art-interlude.visible { opacity: 1; pointer-events: all; }
.art-frame {
  display: block;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper-deep);
  padding: 0;
  cursor: pointer;
}
.art-image { width: 100%; height: 100%; object-fit: contain; display: block; }
.art-continue { width: auto; padding: 0 24px; }
@media (prefers-reduced-motion: reduce) {
  .art-interlude { transition: none; }
}

/* ── stats row ── */
.bottom-panel {
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.stat { padding: 12px; border-radius: 8px; background: rgba(255, 255, 255, .74); border: 1px solid rgba(13, 81, 76, .1); }
.stat strong { display: block; font-size: 1.35rem; margin-bottom: 2px; }
.stat span { color: var(--muted); font-size: .86rem; }

@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; padding: 10px; }
  .sidebar { order: 2; }
  .journey-screen { order: 2; }
  .workspace { min-height: 66vh; }
  .bottom-panel { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar { align-items: stretch; flex-direction: column; }
  .actions { justify-content: stretch; }
  .actions .tool-btn { flex: 1 1 100px; }
}

/* ══════════════════════════════════════════════
   JOURNEY SCREEN
═══════════════════════════════════════════════ */
.journey-screen { min-width: 0; grid-column: 1 / -1; }
.journey-panel {
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.journey-header { display: flex; align-items: center; gap: 12px; }
.journey-header .tool-btn { width: auto; padding: 0 14px; }
.journey-title { font-size: 1.2rem; font-weight: 800; }

.journey-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: .88rem;
  color: var(--muted);
}
.journey-day { font-weight: 800; font-size: 1.05rem; color: var(--ink); flex-basis: 100%; }
.journey-streak { color: var(--teal); font-weight: 700; }

.journey-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}
.journey-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 44px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(16, 44, 42, .12);
  background-color: var(--paper-deep);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 8px;
  color: var(--ink);
  text-align: left;
  transition: border-color .2s, box-shadow .2s;
}
.journey-tile:hover { border-color: var(--teal); }
.journey-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(251, 247, 237, var(--tile-overlay, .88));
  transition: background .3s;
}
.journey-tile.is-complete { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(198, 154, 55, .35); }
.journey-tile-num, .journey-tile-name, .journey-tile-pct { position: relative; z-index: 1; }
.journey-tile-num { font-weight: 800; font-size: .72rem; color: var(--teal); }
.journey-tile-name { display: block; font-size: .7rem; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.journey-tile-pct { display: block; font-size: .62rem; color: var(--muted); margin-top: 2px; }

/* ══════════════════════════════════════════════
   SHEETS — surah picker / about / membership / account
═══════════════════════════════════════════════ */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(16, 44, 42, .35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  background: var(--panel);
  color: var(--ink);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
@media (min-width: 700px) {
  .sheet-overlay { align-items: center; }
  .sheet { border-radius: 8px; max-height: 70vh; }
}
.sheet-header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid rgba(16, 44, 42, .08); }
.sheet-header .tool-btn { width: 40px; min-height: 40px; padding: 0; flex-shrink: 0; }
.sheet-title { font-size: 1.1rem; font-weight: 800; flex: 1; }
.sheet-search {
  flex: 1;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid rgba(13, 81, 76, .18);
  font-size: .95rem;
  color: var(--ink);
  background: #fff;
}
.sheet-body { padding: 16px 20px 22px; font-size: .92rem; line-height: 1.65; color: var(--ink); overflow-y: auto; }
.sheet-body p { margin: 0 0 14px; }
.sheet-attribution { font-size: .78rem; color: var(--muted); }

.surah-list { overflow-y: auto; padding: 4px 10px 16px; }
.surah-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}
.surah-row:hover { background: var(--teal-soft); }
.surah-row-num {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: .8rem;
  flex-shrink: 0;
}
.surah-row-names { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.surah-row-en { font-weight: 800; font-size: .95rem; }
.surah-row-meaning { font-size: .78rem; color: var(--muted); }
.surah-row-ar { font-family: 'Amiri', serif; font-size: 1.05rem; color: var(--ink); flex-shrink: 0; }

/* ── membership / account forms ── */
.membership-price { font-weight: 700; }
.field-label { display: block; font-size: .8rem; color: var(--muted); margin: 14px 0 6px; }
.field-input { display: block; width: 100%; margin-bottom: 0; }
.signin-pane { margin-top: 10px; padding-top: 14px; border-top: 1px solid rgba(16, 44, 42, .08); }
.google-btn-container { margin: 10px 0; min-height: 40px; display: flex; justify-content: center; }
.code-entry-row { margin-top: 4px; }
.form-error { color: var(--rose); font-size: .82rem; margin-top: 10px !important; }
.form-status { color: var(--teal); font-size: .82rem; margin-top: 10px !important; }
.account-email { font-weight: 800; font-size: 1.02rem; margin-bottom: 2px !important; }
.account-status { color: var(--muted); font-size: .88rem; }
.account-delete-link { margin-top: 18px; color: var(--rose); }
.delete-account-confirm { margin-top: 12px; padding: 14px; border: 1px solid rgba(154, 79, 72, .28); border-radius: 8px; background: rgba(154, 79, 72, .05); }
.delete-account-confirm p { font-size: .82rem; line-height: 1.5; margin: 0 0 9px; }
.delete-account-check { display: flex; align-items: flex-start; gap: 8px; font-size: .82rem; line-height: 1.4; }
.delete-account-check input { margin-top: 2px; }

/* ══════════════════════════════════════════════
   WORD TOOLTIP — hover only (pen/mouse, never a press, never touch — see
   canvas-writer.js's pointermove handler). Two lines: pronunciation, then the
   English meaning. pointer-events: none so it can never itself intercept the
   press that's meant for the paper underneath it.
═══════════════════════════════════════════════ */
.word-tooltip {
  position: fixed;
  z-index: 300;
  background: var(--ink);
  border-radius: 8px;
  padding: 7px 12px;
  box-shadow: var(--shadow);
  max-width: 220px;
  text-align: center;
  pointer-events: none;
}
/* Recitation audio only: the tooltip becomes clickable so its own "Play" line can be
   tapped — see app.js's showWordTooltip. Only this state ever sets pointer-events:
   auto on the tooltip; the default (above) stays none for every other account. */
.word-tooltip.has-audio { pointer-events: auto; }
/* Literal --teal (#0d514c) is too dark to read on the tooltip's own dark --ink
   background, so the pronunciation line uses a lighter teal tint instead — same
   family, readable at this size. */
.word-tooltip-tl { font-style: italic; font-weight: 700; font-size: .88rem; color: #8fd9c9; }
.word-tooltip-en { font-size: .8rem; color: rgba(244, 239, 224, .72); margin-top: 2px; }
.word-tooltip-play {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 3px 0 0;
  border: none;
  border-top: 1px solid rgba(244, 239, 224, .18);
  background: none;
  color: var(--gold);
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
}
.word-tooltip-play:hover { color: #f4efe0; }

/* ══════════════════════════════════════════════
   ART PLATE LIGHTBOX — light background, tap anywhere to close, no caption
═══════════════════════════════════════════════ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(251, 247, 237, .96);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
.lightbox-image {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* ══════════════════════════════════════════════
   WELCOME — the full painting fills the viewport as the backdrop (object-fit: cover,
   centred, at every size); the title/subtitle/button sit in a compact white panel
   over its lower third, never as a small banner strip above the text.
═══════════════════════════════════════════════ */
.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  overflow: hidden;
  background: var(--paper-deep); /* shows for the instant before the painting decodes */
}
.welcome-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.welcome-card {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
}
.welcome-content {
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 26px 28px 30px;
  text-align: center;
}
.welcome-title {
  font-family: 'Amiri', 'Scheherazade New', serif;
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  color: var(--teal);
  margin: 0 0 4px;
}
.welcome-title-en { font-size: 1.3rem; font-weight: 800; margin: 0 0 14px; }
.welcome-line { color: var(--muted); font-size: .95rem; line-height: 1.55; margin: 0 0 22px; }
.welcome-content .tool-btn { min-height: 48px; }

/* Phone: the panel runs edge to edge along the bottom instead of floating as a
   centred card with side margins. */
@media (max-width: 700px) {
  .welcome-card { padding: 0; }
  .welcome-content { max-width: none; border-radius: 14px 14px 0 0; }
}

/* ══════════════════════════════════════════════
   SOUNDS — music playlist + ambience loops, sidebar panel (see js/sounds.js). Built
   entirely by JS into #soundsPanel; empty and invisible until playlist.json has
   content, so there is nothing here to hide/show by hand. Reuses .group /
   .group-title / .tool-btn / the global range-input styling above.
═══════════════════════════════════════════════ */
.sounds-subtitle { margin-top: -4px !important; }
.sound-music-row { display: flex; gap: 8px; }
.sound-music-row .sound-toggle { flex: 1; }
.sound-next-btn { flex: 0 0 auto; width: auto; padding: 0 14px; }
.sound-track-title {
  color: var(--muted);
  font-size: .82rem;
  margin-top: -4px !important;
  min-height: 1.2em; /* stable height whether or not a title is showing yet */
}
.sound-ambience-list { display: grid; gap: 8px; }
.sound-ambience-row { display: flex; align-items: center; gap: 10px; }
.sound-ambience-row .sound-toggle { flex: 0 0 auto; width: auto; padding: 0 12px; }
.sound-ambience-row input[type="range"] { flex: 1; }
.sound-icon { display: inline-flex; color: inherit; }
.tool-btn.sound-toggle[aria-pressed="true"] {
  background: var(--teal-soft);
  border-color: var(--teal);
  color: var(--teal);
}

/* ══════════════════════════════════════════════
   REDUCED MOTION
═══════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .journey-tile, .tool-btn, .meter span { transition: none; }
}
