/* Gallery Hour — a museum at night.
   The wall takes the tone of the day's painting; the painting is never cropped;
   the words sit under it like a wall label. One deliberate look, dark only. */
:root {
  --gutter-l: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));
  --tabs-h: calc(64px + env(safe-area-inset-bottom, 0px));
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--wall-deep); }
html, body { margin: 0; min-height: 100%; color: var(--ink); }
/* body stays transparent so the fixed wall and the onboarding painting (z-index -1) show through */
body { font-family: var(--body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
img { max-width: 100%; display: block; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gilt); outline-offset: 3px; border-radius: 4px; }

#wall { position: fixed; inset: 0; background: var(--wall); transition: background-color 900ms ease; z-index: -1; }
#wall::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 70% at 50% 18%, var(--shade-01), transparent 60%), linear-gradient(to bottom, transparent 55%, var(--shade-02)); }

#app { min-height: 100dvh; padding: env(safe-area-inset-top, 0px) var(--gutter-r) calc(var(--tabs-h) + 24px) var(--gutter-l); max-width: 560px; margin: 0 auto; }
#app.no-tabs { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.boot { min-height: 80dvh; display: grid; place-items: center; }
.boot-mark { font-family: var(--display); font-size: 28px; font-style: italic; color: var(--ink-3); }

/* ---------- Top line ---------- */
.topline { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 0 6px; font-size: 13px; color: var(--ink-2); }
.topline b { color: var(--ink); font-weight: 600; }
.daypill { font-variant-numeric: tabular-nums; letter-spacing: .04em; }

/* ---------- The painting ---------- */
.stage { --h: min(50dvh, 480px, calc(min(100vw - 40px, 520px) / var(--ar, 1))); display: grid; place-items: center; height: var(--h); margin: 18px 0 22px; position: relative; }
.stage button { all: unset; cursor: zoom-in; display: grid; place-items: center; width: 100%; height: 100%; }
.painting { max-height: var(--h); max-width: 100%; width: auto; height: auto; object-fit: contain;
  box-shadow: 0 1px 0 var(--shade-03), 0 18px 40px var(--shade-04), 0 4px 10px var(--shade-02);
  opacity: 0; transform: translateY(6px) scale(.99); transition: opacity 700ms ease, transform 900ms cubic-bezier(.2, .7, .2, 1); }
.painting.in { opacity: 1; transform: none; }
.stage-hint { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- The words ---------- */
.words { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px 0; }
.iam { font-size: 12px; letter-spacing: .32em; text-transform: uppercase; color: var(--gilt); font-weight: 600; padding-left: .32em; }
.word { font-family: var(--display); font-style: italic; font-weight: 400; font-size: clamp(54px, 15vw, 76px); line-height: .98; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
.line { font-family: var(--display); font-size: clamp(21px, 5.6vw, 25px); line-height: 1.25; margin: 10px 0 0; max-width: 22ch; text-wrap: balance; color: var(--ink); }
.label-link { all: unset; cursor: pointer; margin-top: 14px; font-size: 13px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; max-width: 34ch; text-wrap: balance; }
.label-link i { font-style: italic; }

/* ---------- Your 2% ---------- */
.step { margin-top: 30px; background: var(--glass); border: 1px solid var(--line); border-radius: 18px; padding: 18px 18px 16px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: flex; flex-direction: column; gap: 12px; }
.step-k { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--gilt); font-weight: 600; }
.step-t { font-size: 18px; line-height: 1.4; margin: 0; }
.btn { appearance: none; border: 0; border-radius: 999px; min-height: 52px; padding: 0 22px; font-weight: 600; font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: transform 120ms ease, background-color 300ms ease, color 300ms ease; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-gilt { background: var(--gilt); color: var(--gilt-ink); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn-done { background: var(--shade-05); color: var(--gilt); }
.btn-done svg { width: 20px; height: 20px; }
.btn-done .tick { stroke-dasharray: 24; stroke-dashoffset: 24; animation: tick 500ms 80ms ease forwards; }
@keyframes tick { to { stroke-dashoffset: 0; } }
.dots { display: flex; justify-content: space-between; gap: 6px; padding: 2px 2px 0; }
.dot { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); }
.dot i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--ink-3); display: block; }
.dot.done i { background: var(--gilt); border-color: var(--gilt); }
.dot.today { color: var(--ink); }
.dot.today i { box-shadow: 0 0 0 3px var(--shade-06); }
.dot.future i { opacity: .4; }
.momentum-line { font-size: 14px; color: var(--ink-2); text-align: center; margin: 0; }

/* ---------- Small actions ---------- */
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.act { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 14px; font-size: 12.5px; color: var(--ink-2); text-align: center; }
.act:active { background: var(--shade-07); }
.act svg { width: 22px; height: 22px; stroke: var(--ink); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.act[aria-pressed="true"] svg { fill: var(--gilt); stroke: var(--gilt); }
.act[aria-pressed="true"] { color: var(--gilt); }

.tip { margin-top: 18px; display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 16px; }
.tip p { margin: 0; flex: 1; min-width: 0; }
.tip button { all: unset; cursor: pointer; color: var(--ink-3); font-size: 13px; padding: 2px 4px; }

/* ---------- Page headings ---------- */
.page-h { padding: 22px 0 6px; display: flex; flex-direction: column; gap: 4px; }
.page-h h1 { font-family: var(--display); font-weight: 400; font-size: 40px; line-height: 1.05; margin: 0; text-wrap: balance; }
.page-h p { margin: 0; color: var(--ink-2); font-size: 15px; }
.seg { display: inline-flex; background: var(--shade-03); border-radius: 999px; padding: 4px; margin: 14px 0 18px; }
.seg button { all: unset; cursor: pointer; padding: 8px 16px; border-radius: 999px; font-size: 14px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--shade-08); font-weight: 600; }

/* ---------- Gallery ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tile { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tile-frame { aspect-ratio: 4 / 5; border-radius: 6px; overflow: hidden; background: var(--shade-09); display: grid; place-items: center; position: relative; }
.tile-frame img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms ease; }
.tile:active .tile-frame img { transform: scale(.98); }
.tile.locked .tile-frame img { filter: blur(14px) saturate(.6) brightness(.6); transform: scale(1.15); }
.tile-lock { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-size: 12px; color: var(--ink); padding: 8px; line-height: 1.35; }
.tile-day { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.tile-word { font-family: var(--display); font-style: italic; font-size: 22px; line-height: 1.1; }
.tile-done { color: var(--gilt); font-size: 12px; margin-left: 6px; }
.empty { border: 1px dashed var(--line); border-radius: 16px; padding: 28px 20px; text-align: center; color: var(--ink-2); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty h2 { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 0; color: var(--ink); }
.empty p { margin: 0; max-width: 30ch; }

/* ---------- My week ---------- */
.big-num { display: flex; align-items: baseline; gap: 12px; margin: 14px 0 4px; }
.big-num b { font-family: var(--display); font-weight: 400; font-size: 84px; line-height: .9; font-variant-numeric: tabular-nums; }
.big-num span { color: var(--ink-2); font-size: 15px; max-width: 16ch; }
.panel { background: var(--glass); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 14px; margin-top: 18px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.panel h2 { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 0; line-height: 1.1; }
.panel .sub { margin: -6px 0 0; color: var(--ink-2); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--ink-2); }
.field textarea, .field input { width: 100%; background: var(--shade-10); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 16px; line-height: 1.4; resize: vertical; }
.field textarea { min-height: 76px; }
.field textarea:focus, .field input:focus { outline: none; border-color: var(--gilt); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { min-width: 0; }
.history { display: flex; flex-direction: column; gap: 8px; }
details.ci { border-top: 1px solid var(--line); padding-top: 10px; }
details.ci summary { cursor: pointer; font-size: 14px; color: var(--ink-2); list-style: none; }
details.ci summary::-webkit-details-marker { display: none; }
details.ci p { margin: 8px 0 0; font-size: 14px; }
details.ci p b { display: block; font-size: 12px; color: var(--ink-3); font-weight: 500; }
.settings { display: flex; flex-direction: column; gap: 0; }
.set { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 15px; }
.set:first-child { border-top: 0; }
.set > span { min-width: 0; }
.set small { display: block; color: var(--ink-3); font-size: 13px; }
.set input[type="time"], .set input[type="text"] { background: var(--shade-10); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 16px; max-width: 150px; }
.link-btn { all: unset; cursor: pointer; color: var(--gilt); font-weight: 600; font-size: 15px; white-space: nowrap; }
.danger { color: var(--shade-11); }

/* ---------- Tabs ---------- */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 8px var(--gutter-r) env(safe-area-inset-bottom, 0px) var(--gutter-l); height: var(--tabs-h);
  background: var(--shade-12); backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2); border-top: 1px solid var(--shade-03); }
#tabs a { display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; font-size: 11px; color: var(--ink-3); padding-top: 2px; }
#tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#tabs a[aria-current="page"] { color: var(--ink); }
#tabs a[aria-current="page"] svg { stroke: var(--gilt); }

/* ---------- Sheet (wall label, share) ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-scrim { position: absolute; inset: 0; background: var(--shade-04); animation: fade 200ms ease; }
.sheet-panel { position: relative; width: 100%; max-width: 560px; max-height: 88dvh; overflow: auto; background: var(--shade-13); color: var(--wall-sheet); border-radius: 22px 22px 0 0;
  padding: 26px var(--gutter-r) calc(26px + env(safe-area-inset-bottom, 0px)) var(--gutter-l); animation: up 260ms cubic-bezier(.2, .8, .2, 1); }
.sheet-x { all: unset; cursor: pointer; position: absolute; top: 12px; right: max(14px, env(safe-area-inset-right, 0px)); width: 36px; height: 36px; display: grid; place-items: center; font-size: 26px; color: var(--shade-14); border-radius: 50%; }
.wall-label { display: flex; flex-direction: column; gap: 6px; padding-inline-end: 30px; }
.s-h { padding-right: 36px; }
.wall-label .wl-artist { font-weight: 600; font-size: 15px; }
.wall-label .wl-artist small { font-weight: 400; color: var(--shade-14); }
.wall-label h2 { font-family: var(--display); font-style: italic; font-weight: 400; font-size: 30px; line-height: 1.1; margin: 0; }
.wall-label .wl-meta { font-size: 14px; color: var(--shade-15); margin: 0; }
.wall-label .wl-rights { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--shade-16); font-size: 13px; color: var(--shade-14); display: flex; flex-direction: column; gap: 4px; }
.wall-label a { color: var(--shade-17); font-weight: 600; }
.zoom { margin: 18px calc(-1 * var(--gutter-l)) 0; background: var(--shade-18); display: grid; place-items: center; padding: 12px; }
.zoom img { max-height: 60dvh; width: auto; }
.share-preview { display: grid; place-items: center; margin: 4px 0 16px; }
.share-preview img, .share-preview canvas { max-height: 52dvh; width: auto; border-radius: 10px; box-shadow: 0 10px 30px var(--shade-10); }
.sheet .btn-gilt { background: var(--wall-sheet); color: var(--shade-13); }
.sheet .btn-ghost { color: var(--wall-sheet); border-color: var(--shade-19); }
.sheet h2.s-h { font-family: var(--display); font-weight: 400; font-size: 28px; margin: 0 0 4px; }
.sheet p.s-p { margin: 0 0 14px; color: var(--shade-15); font-size: 15px; }

/* ---------- Onboarding ---------- */
.ob { min-height: 100dvh; display: flex; flex-direction: column; justify-content: flex-end; gap: 22px; padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
.ob-art { position: fixed; inset: 0; z-index: -1; }
.ob-art img { width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.ob-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, var(--shade-20) 0%, var(--shade-21) 40%, var(--shade-22) 72%, var(--shade-23) 100%); }
.ob h1 { font-family: var(--display); font-weight: 400; font-size: clamp(40px, 11vw, 56px); line-height: 1.02; margin: 0; text-wrap: balance; }
.ob h1 em { color: var(--gilt); }
.ob p { margin: 0; color: var(--ink-2); font-size: 17px; max-width: 32ch; }
.ob .field input { font-size: 20px; padding: 14px 16px; }
.ob-steps { display: flex; gap: 6px; }
.ob-steps i { height: 3px; flex: 1; border-radius: 3px; background: var(--line); }
.ob-steps i.on { background: var(--gilt); }
.ob-credit { font-size: 12px; color: var(--ink-3); }
.ob-skip { all: unset; cursor: pointer; text-align: center; color: var(--ink-2); font-size: 15px; padding: 6px; }

#toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 16px); transform: translateX(-50%); background: var(--ink); color: var(--shade-08); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; z-index: 50; box-shadow: 0 8px 24px var(--shade-02); max-width: calc(100% - 40px); text-align: center; animation: up 220ms ease; }

/* ---------- Voice ---------- */
.voice { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; min-height: 36px; }
.pill { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; color: var(--ink); }
.pill svg { width: 14px; height: 14px; fill: currentColor; stroke: currentColor; stroke-width: 1.4; }
.pill.pill-quiet { color: var(--ink-3); }
.pill.recording { border-color: var(--shade-11); color: var(--shade-11); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- Partner note (the Barre Blend card) ---------- */
.note { background: var(--shade-13); color: var(--wall-sheet); border-radius: 16px; padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 12px 30px var(--shade-02); }
.note-k { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--shade-17); font-weight: 600; }
.note p { margin: 0; color: var(--shade-24); font-size: 16px; }
.note-sign { font-family: var(--display); font-size: 19px !important; line-height: 1.3; }
.ob-lang { margin: 0 0 auto; align-self: flex-end; }
.ob .seg { margin-top: 0; }

/* ---------- Recap ---------- */
.mosaic { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 16px 0; }
.mosaic a { aspect-ratio: 1; overflow: hidden; border-radius: 4px; opacity: .32; filter: grayscale(.6); }
.mosaic a.on { opacity: 1; filter: none; box-shadow: 0 0 0 1.5px var(--gilt); }
.mosaic img { width: 100%; height: 100%; object-fit: cover; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stats div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stats b { font-family: var(--display); font-weight: 400; font-size: 52px; line-height: 1; font-variant-numeric: tabular-nums; }
.stats span { font-size: 13px; color: var(--ink-2); }
.recap-again, .recap-link { margin-top: 18px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.seg-sm { margin: 0; padding: 3px; }
.seg-sm button { padding: 6px 12px; font-size: 13px; }
.back { color: var(--ink-2) !important; font-weight: 500 !important; }

/* ---------- Decks ---------- */
.decks { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.deck { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; background: var(--glass); border: 1px solid var(--line); border-radius: 18px; padding: 14px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.deck.current { border-color: var(--shade-25); }
.deck img { width: 96px; height: 120px; object-fit: cover; border-radius: 6px; }
.deck-txt { display: flex; flex-direction: column; gap: 6px; min-width: 0; align-items: flex-start; }
.deck-k { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gilt); font-weight: 600; }
.deck h2 { font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.1; margin: 0; }
.deck p { margin: 0; font-size: 14px; color: var(--ink-2); }
.deck .btn { min-height: 42px; font-size: 14px; padding: 0 16px; margin-top: 4px; }
.small-note { color: var(--ink-3); font-size: 13px; margin: 18px 0 0; }
[lang="ar"] .deck-k { letter-spacing: 0; text-transform: none; font-size: 13px; }

/* ---------- Doors under today's card ---------- */
.doors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.doors a { text-align: center; padding: 10px 4px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; color: var(--ink-2); text-decoration: none; }
.doors a:active { background: var(--shade-07); }

/* ---------- Right now ---------- */
.moments { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.moments button { all: unset; cursor: pointer; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; color: var(--ink); }
.moments button[aria-pressed="true"] { background: var(--gilt); color: var(--gilt-ink); border-color: var(--gilt); font-weight: 600; }

/* ---------- Visit ---------- */
.museum { margin-top: 18px; }
.museum h2 { font-family: var(--display); font-weight: 400; font-size: 28px; margin: 0 0 2px; }
.walk { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.walk-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: center; text-decoration: none; color: var(--ink); padding: 8px; border-radius: 12px; border: 1px solid var(--line); }
.walk-row.kept { border-color: var(--shade-25); }
.walk-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.walk-txt { display: flex; flex-direction: column; min-width: 0; }
.walk-txt b { font-size: 13px; color: var(--gilt); font-weight: 600; letter-spacing: .02em; }
.walk-word { font-family: var(--display); font-size: 21px; line-height: 1.2; }
.walk-txt small { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-where { margin: 8px 0 0; font-size: 14px; color: var(--shade-24); }
.wl-where b { color: var(--shade-17); }
.wl-where small { color: var(--shade-14); }

/* ---------- Write your own ---------- */
.picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; max-height: 300px; overflow-y: auto; padding: 2px; }
.picker button { all: unset; cursor: pointer; aspect-ratio: 1; border-radius: 6px; overflow: hidden; outline: 2px solid transparent; }
.picker button[aria-checked="true"] { outline-color: var(--gilt); }
.picker img { width: 100%; height: 100%; object-fit: cover; }
.write-tile .tile-frame { display: grid; place-items: center; border: 1px dashed var(--line); font-size: 40px; color: var(--ink-3); }
.write-tile { text-decoration: none; color: var(--ink); }

/* ---------- Frame mode ---------- */
.frame-mode { position: fixed; inset: 0; background: var(--shade-26); cursor: pointer; z-index: 60; }
.fm-slide { position: absolute; inset: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; align-items: center; justify-items: center; padding: 4vh 4vw; gap: 2vh; opacity: 0; transition: opacity 3s ease; }
.fm-slide.on { opacity: 1; }
.fm-slide img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 30px 70px var(--shade-27); }
.fm-words { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.fm-words .word { font-family: var(--display); font-style: italic; font-size: clamp(40px, 6vw, 88px); line-height: 1; }
.fm-words .line { font-family: var(--display); font-size: clamp(18px, 2.4vw, 32px); }
.fm-words small { color: var(--ink-3); font-size: 13px; }
.fm-hint { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; color: var(--shade-28); font-size: 12px; margin: 0; }
@media (orientation: landscape) and (min-width: 700px) { .fm-slide { grid-template-rows: none; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); } }

/* ---------- Your story ---------- */
.story-pill { display: flex; align-items: center; gap: 12px; margin: 10px 0 0; padding: 10px 14px; border-radius: 16px; background: var(--glass); border: 1px solid var(--shade-29); text-decoration: none; color: var(--ink); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.story-pill .sp-play { width: 34px; height: 34px; border-radius: 50%; background: var(--gilt); color: var(--gilt-ink); display: grid; place-items: center; font-size: 13px; flex: none; }
.story-pill span { display: flex; flex-direction: column; min-width: 0; }
.story-pill b { font-weight: 600; } .story-pill small { color: var(--ink-2); font-size: 13px; }
.story-stage { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.story-stage img { width: 100%; height: 100%; object-fit: cover; opacity: .38; filter: saturate(.9); animation: drift 60s ease-in-out infinite alternate; }
.story-stage::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, var(--shade-30), var(--shade-31)); }
@keyframes drift { from { transform: scale(1.04) translate(0, 0); } to { transform: scale(1.14) translate(-2%, -2%); } }
.story { padding-top: 10px; }
.story-k { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--gilt); font-weight: 600; margin: 0 0 10px; }
.story-text { font-family: var(--display); font-size: clamp(22px, 5.6vw, 27px); line-height: 1.45; }
.story-text span { color: var(--ink-3); transition: color .5s ease; }
.story-text span.said { color: var(--ink-2); }
.story-text span.now { color: var(--ink); }
.story-controls { display: flex; align-items: center; gap: 16px; margin: 4px 0 20px; flex-wrap: wrap; }
.story-play { min-width: 140px; }
.story-sound { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.goal { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 0 0 12px; display: flex; flex-direction: column; gap: 10px; }
.goal legend { font-size: 13px; color: var(--ink-2); padding: 0 6px; }
.h-sub { font-family: var(--display); font-weight: 400; font-size: 28px; margin: 6px 0 0; }
[lang="ar"] .story-k { letter-spacing: 0; text-transform: none; font-size: 14px; }

/* ---------- Arabic ---------- */
:root[lang="ar"] { --display: "Noto Naskh Arabic", "Geeza Pro", serif; --body: "IBM Plex Sans Arabic", "Geeza Pro", system-ui, sans-serif; }
[lang="ar"] .word, [lang="ar"] .tile-word, [lang="ar"] .wall-label h2 { font-style: normal; font-weight: 600; }
[lang="ar"] .word { font-size: clamp(44px, 12vw, 60px); line-height: 1.3; }
[lang="ar"] .line { line-height: 1.6; font-size: clamp(20px, 5.4vw, 23px); }
[lang="ar"] .iam, [lang="ar"] .step-k, [lang="ar"] .tile-day, [lang="ar"] .note-k, [lang="ar"] .stage-hint { letter-spacing: 0; text-transform: none; padding-left: 0; font-size: 14px; }
[lang="ar"] .ob h1 { line-height: 1.35; }
[dir="rtl"] .sheet-x { right: auto; left: max(14px, env(safe-area-inset-left, 0px)); }
[dir="rtl"] .s-h { padding-left: 36px; }
[lang="ar"] .wall-label, [lang="ar"] .wall-label h2 { font-family: "Instrument Serif", Georgia, serif; }
[lang="ar"] .wall-label { font-family: "Figtree", system-ui, sans-serif; }

@keyframes up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
#toast { animation-name: toastin; }
@keyframes toastin { from { transform: translate(-50%, 10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
@media (min-width: 700px) {
  .stage { --h: min(54dvh, 560px, calc(520px / var(--ar, 1))); }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
