/* Haḍḍa — Fragments de mémoire — isolated experience styles.
   Palette "Schiste & Stuc". Local system font stacks only (no CDN, offline-safe). */

:root {
  --stuc: #f6f2e9; --card: #fcfaf4; --rule: #e2dbc9;
  --schist: #1b1e1a; --ink: #f2f3f0; --muted: #cfc7b4;
  --gold: #c19a49; --gold6: #a67c2e; --gold7: #8a6624; --terre: #9c4a2a;
  --page: #0b0c0a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --space: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
:lang(fa) { --serif: "Vazirmatn", "Noto Naskh Arabic", "Iowan Old Style", serif; }
:lang(zh-Hans), :lang(zh) { --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "Microsoft YaHei", serif; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page); color: var(--ink);
  font-family: var(--sans); overflow: hidden; overscroll-behavior: none;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
#hf-root { position: fixed; inset: 0; }
#hf-gl { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; display: block; }
#hf-fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }

button { font-family: inherit; }
a { color: var(--gold); }

/* ---------- buttons ---------- */
.hf-btn {
  font-family: var(--sans); font-size: .92rem; letter-spacing: .02em;
  color: var(--ink); background: rgba(255,255,255,.06); border: 1px solid rgba(226,219,201,.28);
  padding: .7rem 1.25rem; border-radius: 5px; cursor: pointer; min-height: 44px;
  transition: background .2s, border-color .2s, transform .1s; backdrop-filter: blur(3px);
}
.hf-btn:hover { background: rgba(255,255,255,.12); border-color: rgba(226,219,201,.5); }
.hf-btn:active { transform: translateY(1px); }
.hf-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.hf-btn-primary { background: linear-gradient(180deg, var(--gold6), var(--gold7)); border-color: transparent; color: #1a1508; font-weight: 600; }
.hf-btn-primary:hover { background: linear-gradient(180deg, var(--gold), var(--gold6)); }
.hf-btn-ghost { background: transparent; color: var(--muted); }

/* ---------- intro ---------- */
.hf-intro {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  padding: calc(2rem + env(safe-area-inset-top)) 2rem calc(2rem + env(safe-area-inset-bottom));
  background: radial-gradient(120% 90% at 50% 20%, rgba(11,12,10,.30), rgba(11,12,10,.72));
  transition: opacity .7s ease; opacity: 1;
}
.hf-intro.is-hiding { opacity: 0; pointer-events: none; }
.hf-intro[hidden] { display: none; }
.hf-intro-inner { max-width: min(46rem, 92vw); text-align: start; }
.hf-kicker { color: var(--gold); letter-spacing: .34em; text-transform: uppercase; font-size: .72rem; margin: 0 0 1.1rem; }
.hf-wordmark { display: flex; flex-direction: column; line-height: 1; margin-bottom: 1.2rem; }
.hf-brand { font-family: var(--serif); font-size: clamp(2.6rem, 9vw, 5rem); color: var(--gold); letter-spacing: .04em; }
.hf-sub { font-family: var(--serif); font-size: clamp(1rem, 3.4vw, 1.6rem); color: var(--ink); letter-spacing: .22em; text-transform: uppercase; margin-top: .5rem; opacity: .9; }
.hf-tagline { max-width: 30rem; color: var(--muted); font-size: clamp(.95rem, 2.6vw, 1.1rem); line-height: 1.6; margin: 0 0 1.6rem; }
.hf-verbs { list-style: none; margin: 0 0 1.8rem; padding: 0; display: grid; gap: .5rem; counter-reset: v; }
.hf-verbs li { counter-increment: v; color: var(--muted); font-size: .95rem; display: flex; gap: .7rem; align-items: baseline; }
.hf-verbs li::before { content: counter(v, decimal-leading-zero); color: var(--gold7); font-family: var(--serif); font-size: .85rem; min-width: 1.6em; }
.hf-verbs strong { color: var(--ink); font-weight: 600; }
.hf-intro-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1.4rem; }
.hf-scene-label { color: rgba(207,199,180,.6); font-size: .78rem; letter-spacing: .05em; margin: .8rem 0 0; }

.hf-langs { display: flex; flex-wrap: wrap; gap: .35rem; }
.hf-lang { background: transparent; border: 1px solid rgba(226,219,201,.2); color: var(--muted); border-radius: 4px; padding: .35rem .6rem; font-size: .82rem; cursor: pointer; min-height: 36px; }
.hf-lang.is-active { color: #1a1508; background: var(--gold); border-color: var(--gold); font-weight: 600; }
.hf-lang:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- HUD ---------- */
.hf-hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.hf-hud[hidden] { display: none; }
.hf-hud-top {
  position: absolute; top: calc(.9rem + env(safe-area-inset-top)); left: 1rem; right: 1rem;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
}
.hf-hud-prog { display: flex; align-items: center; gap: .6rem; background: rgba(11,12,10,.35); padding: .5rem .8rem; border-radius: 6px; backdrop-filter: blur(4px); }
.hf-mark { color: var(--gold); width: 26px; height: 26px; display: inline-block; }
.hf-mark svg { width: 100%; height: 100%; }
.hf-prog-body { display: flex; flex-direction: column; gap: .35rem; min-width: 150px; }
.hf-prog-count { font-size: .8rem; color: var(--ink); letter-spacing: .03em; }
.hf-prog-bar { height: 2px; background: rgba(226,219,201,.22); border-radius: 2px; overflow: hidden; }
.hf-prog-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold7), var(--gold)); transition: width .8s cubic-bezier(.2,.7,.2,1); }
.hf-hud-tools { display: flex; gap: .4rem; pointer-events: auto; }
.hf-icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 6px;
  background: rgba(11,12,10,.35); border: 1px solid rgba(226,219,201,.18); color: var(--muted);
  cursor: pointer; text-decoration: none; font-size: 1rem; backdrop-filter: blur(4px);
}
.hf-icon-btn:hover { color: var(--ink); border-color: rgba(226,219,201,.4); }
.hf-icon-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.hf-quote {
  position: absolute; left: 50%; bottom: 6.5rem; transform: translateX(-50%);
  font-family: var(--serif); font-style: italic; color: rgba(242,243,240,.66);
  font-size: clamp(.85rem, 2.4vw, 1.05rem); text-align: center; max-width: min(34rem, 88vw);
  margin: 0; opacity: 0; animation: hf-quote-fade 14s ease-in-out infinite;
}
@keyframes hf-quote-fade { 0%,100% { opacity: 0; } 12%,40% { opacity: .8; } 55% { opacity: 0; } }
.hf-strip {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(1rem + env(safe-area-inset-bottom));
  display: flex; gap: .3rem; background: rgba(11,12,10,.30); padding: .4rem; border-radius: 8px; backdrop-filter: blur(4px);
}
.hf-strip-cell { display: flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border-radius: 5px; opacity: .4; transition: opacity .5s, background .5s; }
.hf-strip-cell.is-active { opacity: 1; background: rgba(193,154,73,.14); }
.hf-strip-n { font-family: var(--serif); color: var(--gold); font-size: .8rem; }
.hf-strip-lab { font-size: .72rem; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
.hf-hint { position: absolute; left: 50%; bottom: 4.2rem; transform: translateX(-50%); font-size: .74rem; color: rgba(207,199,180,.55); text-align: center; margin: 0; max-width: 90vw; }

/* ---------- cartel ---------- */
.hf-cartel { position: fixed; inset: 0; z-index: 25; display: flex; justify-content: flex-end; align-items: stretch; pointer-events: auto; }
.hf-cartel[hidden] { display: none; }
.hf-cartel::before { content: ""; position: absolute; inset: 0; background: rgba(8,9,7,.28); opacity: 0; transition: opacity .35s; }
.hf-cartel.is-open::before { opacity: 1; }
.hf-cartel-card {
  position: relative; margin: auto 1.2rem; width: min(24rem, 92vw); max-height: min(88vh, 46rem);
  background: var(--card); color: var(--schist); border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4); overflow: auto; transform: translateX(20px); opacity: 0;
  transition: transform .38s cubic-bezier(.2,.8,.2,1), opacity .38s;
}
.hf-cartel.is-open .hf-cartel-card { transform: none; opacity: 1; }
.hf-cartel-close { position: absolute; top: .5rem; right: .6rem; width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(27,30,26,.06); color: var(--schist); cursor: pointer; font-size: .9rem; }
.hf-cartel-close:hover { background: rgba(27,30,26,.14); }
.hf-cartel-figure { background: linear-gradient(180deg, #efe9db, #e4dcc8); padding: 1.2rem 1.2rem .6rem; display: grid; place-items: center; }
.hf-cartel-img { max-width: 100%; max-height: 44vh; object-fit: contain; border-radius: 3px; box-shadow: 0 8px 22px rgba(0,0,0,.22); }
.hf-cartel-body { padding: 1rem 1.3rem 1.3rem; }
.hf-cartel-inv { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold7); font-weight: 600; margin-bottom: .3rem; }
.hf-cartel-title { font-family: var(--serif); font-size: 1.3rem; line-height: 1.25; margin: 0 0 .3rem; color: var(--schist); }
.hf-cartel-site { font-size: .8rem; color: var(--terre); margin-bottom: .8rem; }
.hf-cartel-desc { font-size: .9rem; line-height: 1.6; color: #34382f; max-height: 30vh; overflow: auto; }
.hf-cartel-dims { font-size: .78rem; color: #5a5647; margin-top: .6rem; }
.hf-cartel-credit { font-size: .72rem; color: #6b6656; margin-top: .5rem; font-style: italic; }
.hf-cartel-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1rem; }
.hf-cartel-link { font-size: .84rem; color: var(--gold7); font-weight: 600; text-decoration: none; }
.hf-cartel-link:hover { text-decoration: underline; }
.hf-cartel-next { margin-left: auto; }

/* ---------- settings ---------- */
.hf-settings {
  position: fixed; top: calc(3.5rem + env(safe-area-inset-top)); right: 1rem; z-index: 26; width: min(20rem, 92vw);
  background: rgba(20,22,20,.94); border: 1px solid rgba(226,219,201,.2); border-radius: 8px; padding: 1rem; backdrop-filter: blur(8px);
}
.hf-settings[hidden] { display: none; }
.hf-set-title { font-family: var(--serif); font-size: 1rem; margin: 0 0 .8rem; color: var(--ink); }
.hf-set-row { display: block; width: 100%; text-align: start; background: transparent; border: 1px solid rgba(226,219,201,.2); color: var(--ink); border-radius: 5px; padding: .6rem .8rem; margin-bottom: .5rem; cursor: pointer; font-size: .88rem; min-height: 44px; }
.hf-set-row:hover { background: rgba(255,255,255,.06); }
.hf-set-danger { color: var(--terre); border-color: rgba(156,74,42,.4); }
.hf-set-langwrap { margin: .5rem 0; }

/* ---------- finale ---------- */
.hf-finale { position: fixed; inset: 0; z-index: 30; display: grid; place-items: end center; pointer-events: none;
  padding: 2rem 2rem calc(2.2rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(8,9,7,.94) 3%, rgba(8,9,7,.80) 24%, rgba(8,9,7,0) 52%);
  opacity: 0; transition: opacity 1.4s ease; }
.hf-finale[hidden] { display: none; }
.hf-finale.is-open { opacity: 1; }
.hf-finale.is-hiding-text .hf-finale-inner { opacity: 0; visibility: hidden; pointer-events: none; }
.hf-finale-inner { text-align: center; max-width: min(38rem, 92vw); pointer-events: auto; transition: opacity 1s ease;
  text-shadow: 0 2px 22px rgba(0,0,0,.9), 0 1px 4px rgba(0,0,0,.7); }
.hf-finale-mark { color: var(--gold); width: 40px; height: 40px; margin: 0 auto .7rem; opacity: .9; }
/* the evocation disclaimer stays on screen while the reconstruction is being contemplated */
.hf-finale-disclaimer { position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(.7rem + env(safe-area-inset-bottom)); margin: 0; max-width: 90vw; text-align: center;
  font-size: .68rem; letter-spacing: .03em; color: rgba(207,199,180,.55);
  text-shadow: 0 1px 8px rgba(0,0,0,.9); pointer-events: none; opacity: 0; transition: opacity 1s ease; }
.hf-finale.is-hiding-text .hf-finale-disclaimer { opacity: 1; }
.hf-finale-reveal { font-family: var(--serif); color: var(--gold); font-weight: 500; font-size: clamp(1.6rem, 6vw, 2.8rem); letter-spacing: .04em; margin: 0 0 .8rem; }
.hf-finale-evoc { font-size: .76rem; color: rgba(207,199,180,.6); letter-spacing: .04em; margin: 0 0 1.4rem; }
.hf-finale-quote { font-family: var(--serif); font-style: italic; color: var(--ink); font-size: clamp(1rem, 3.2vw, 1.35rem); line-height: 1.5; margin: 0 0 1.2rem; }
.hf-finale-summary { color: var(--muted); font-size: .92rem; margin: 0 0 .4rem; }
.hf-finale-credits { color: rgba(207,199,180,.55); font-size: .76rem; margin: 0 0 1.6rem; }
.hf-finale-actions { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; }

/* ---------- journey (Xuanzang prologue) ---------- */
.hf-journey { position: fixed; inset: 0; z-index: 18; cursor: pointer; }
.hf-journey[hidden] { display: none; }

.hf-j-card {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  padding: 2rem; opacity: 0; transition: opacity 1.1s ease; pointer-events: none;
}
.hf-journey.is-card .hf-j-card { opacity: 1; }
.hf-j-when { color: var(--gold); letter-spacing: .28em; text-transform: uppercase; font-size: .74rem; margin: 0 0 1rem; }
.hf-j-title { font-family: var(--serif); font-size: clamp(2.2rem, 7vw, 4rem); color: var(--ink); margin: 0; font-weight: 500; letter-spacing: .03em; }
.hf-j-sub { color: rgba(207,199,180,.6); font-size: .8rem; max-width: 34rem; margin: 1.3rem auto 0; line-height: 1.6; }

.hf-j-caption {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(4.6rem + env(safe-area-inset-bottom)); width: min(44rem, 90vw); text-align: center;
  opacity: 0; transition: opacity 1.2s ease; pointer-events: none;
}
.hf-j-caption.is-show { opacity: 1; }
.hf-j-text { font-family: var(--serif); font-size: clamp(.98rem, 2.7vw, 1.22rem); line-height: 1.65; color: var(--ink);
  margin: 0 0 .55rem; text-shadow: 0 2px 18px rgba(0,0,0,.85), 0 1px 4px rgba(0,0,0,.7); }
.hf-j-source { font-size: .7rem; letter-spacing: .05em; color: rgba(207,199,180,.62); margin: 0; text-shadow: 0 1px 8px rgba(0,0,0,.9); }

/* relic card — a real find surfacing in the narrative (museum-label styling) */
.hf-j-relic {
  position: absolute; top: 15%; right: 5.5%; margin: 0;
  width: min(190px, 24vw);
  background: var(--card); border: 1px solid var(--rule); border-radius: 6px;
  padding: .5rem .5rem .6rem;
  box-shadow: 0 14px 38px rgba(0,0,0,.45);
  opacity: 0; transform: translateY(12px);
  transition: opacity 1.1s ease, transform 1.1s ease; pointer-events: none;
}
.hf-j-relic.is-show { opacity: 1; transform: none; }
.hf-j-relic-img { display: block; width: 100%; max-height: 34vh; object-fit: contain;
  border-radius: 3px; background: linear-gradient(180deg, #efe9db, #e4dcc8); }
.hf-j-relic figcaption { margin-top: .45rem; display: flex; flex-direction: column; gap: .18rem; }
.hf-j-relic-title { font-family: var(--serif); color: var(--schist); font-size: .85rem; line-height: 1.25; }
.hf-j-relic-meta { font-size: .62rem; color: #6b6656; letter-spacing: .03em; line-height: 1.35; }
.is-rtl .hf-j-relic { right: auto; left: 5.5%; }

/* epilogue: the excavation photograph and the finds bridging thirteen centuries */
.hf-j-epiphoto { max-height: 21vh; max-width: 82vw; width: auto; border-radius: 6px;
  box-shadow: 0 12px 34px rgba(0,0,0,.6); }
.hf-j-epiphotocap { font-size: .66rem; color: rgba(207,199,180,.6); margin: .4rem 0 .9rem; letter-spacing: .04em; }
.hf-j-epirow { display: flex; gap: .55rem; justify-content: center; align-items: flex-end; margin: 0 0 .45rem; }
.hf-j-epithumb { height: 64px; width: auto; border-radius: 4px; background: #efe9db;
  box-shadow: 0 8px 22px rgba(0,0,0,.55); }
.hf-j-epicredit { font-size: .62rem; color: rgba(207,199,180,.5); margin: 0 0 1.4rem; }

.hf-j-nav {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(1.1rem + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: .55rem;
}
.hf-j-dots { display: flex; gap: .5rem; align-items: center; }
.hf-j-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(226,219,201,.4);
  background: transparent; cursor: pointer; box-sizing: content-box; padding: 14px;
  background-clip: content-box; transition: background .4s, border-color .4s; }
.hf-j-dot.is-active { background: var(--gold); border-color: var(--gold); }
.hf-j-dot:focus-visible, .hf-j-arrow:focus-visible, .hf-j-skip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.hf-j-arrow { background: none; border: none; color: rgba(207,199,180,.7); font-size: 1.5rem; cursor: pointer;
  padding: .1rem .55rem; line-height: 1; min-height: 40px; }
.hf-j-arrow:hover { color: var(--ink); }

.hf-j-skip {
  position: absolute; top: calc(1rem + env(safe-area-inset-top)); right: 1.2rem;
  background: rgba(11,12,10,.35); border: 1px solid rgba(226,219,201,.22); color: var(--muted);
  border-radius: 5px; padding: .5rem .95rem; font-size: .78rem; cursor: pointer;
  backdrop-filter: blur(4px); min-height: 40px;
}
.hf-j-skip:hover { color: var(--ink); border-color: rgba(226,219,201,.45); }

.hf-j-epilogue {
  position: absolute; inset: 0; display: none; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 2rem;
  background: radial-gradient(100% 80% at 50% 45%, rgba(8,9,7,.18), rgba(8,9,7,.68));
}
.hf-journey.is-epilogue .hf-j-epilogue { display: flex; }
.hf-journey.is-epilogue .hf-j-nav, .hf-journey.is-epilogue .hf-j-skip,
.hf-journey.is-epilogue .hf-j-caption, .hf-journey.is-epilogue .hf-j-card { display: none; }
.hf-j-epilogue > * { max-width: min(40rem, 92vw); }
.hf-j-epilogue .hf-j-title { font-size: clamp(1.6rem, 5vw, 2.7rem); }
.hf-j-epitext { font-family: var(--serif); color: var(--ink); font-size: clamp(.92rem, 2.5vw, 1.12rem);
  line-height: 1.65; margin: 1rem 0 1.1rem; text-shadow: 0 2px 16px rgba(0,0,0,.8); }

.hf-j-disclaimer {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: .3rem; margin: 0;
  font-size: .62rem; color: rgba(207,199,180,.38); pointer-events: none; text-align: center; max-width: 92vw;
}

.is-rtl .hf-j-skip { right: auto; left: 1.2rem; }
.hf-journey.is-short .hf-j-nav { display: none; }

@media (max-width: 640px) {
  .hf-j-caption { bottom: calc(5.4rem + env(safe-area-inset-bottom)); }
  .hf-j-sub { font-size: .72rem; }
  /* the intro card already carries the disclaimer; the footer version collides with the dots */
  .hf-j-disclaimer { display: none; }
  .hf-j-relic { width: 33vw; top: 11%; }
  .hf-j-relic-title { font-size: .74rem; }
  .hf-j-epithumb { height: 46px; }
}

/* ---------- act II quiz ---------- */
.hf-quiz { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(7rem + env(safe-area-inset-bottom));
  z-index: 24; width: min(26rem, 92vw); background: rgba(20,22,20,.95); border: 1px solid rgba(226,219,201,.25);
  border-radius: 8px; padding: .9rem 1rem; opacity: 0; transition: opacity .3s; backdrop-filter: blur(6px); }
.hf-quiz.is-open { opacity: 1; }
.hf-quiz[hidden] { display: none; }
.hf-quiz-q { margin: 0 0 .6rem; font-family: var(--serif); color: var(--ink); font-size: 1rem; }
.hf-quiz-opts { display: flex; flex-wrap: wrap; gap: .5rem; }
.hf-quiz-opt.is-right { border-color: var(--gold); color: var(--gold); }
.hf-quiz-opt.is-wrong { border-color: rgba(156,74,42,.8); color: var(--terre); }
.hf-quiz-fb { margin: .55rem 0 0; font-size: .82rem; color: var(--muted); min-height: 1em; }

/* ---------- act interstitial ---------- */
.hf-act { position: fixed; inset: 0; z-index: 15; display: flex; flex-direction: column; align-items: center;
  justify-content: center; pointer-events: none; opacity: 0; transition: opacity .5s; text-align: center;
  background: radial-gradient(90% 70% at 50% 50%, rgba(8,9,7,.42), rgba(8,9,7,0)); }
.hf-act.is-show { opacity: 1; }
.hf-act[hidden] { display: none; }
.hf-act-kicker { color: var(--gold); letter-spacing: .3em; text-transform: uppercase; font-size: .66rem; margin: 0 0 .6rem; }
.hf-act-title { font-family: var(--serif); color: var(--ink); font-size: clamp(1.5rem, 5vw, 2.4rem); margin: 0;
  text-shadow: 0 2px 18px rgba(0,0,0,.8); }
.hf-act-sub { color: var(--muted); font-size: .9rem; margin: .55rem 0 0; text-shadow: 0 1px 10px rgba(0,0,0,.8); }

/* ---------- discreet demo link ---------- */
.hf-demo-link { margin-top: .9rem; background: none; border: none; color: rgba(207,199,180,.5);
  font-size: .74rem; cursor: pointer; text-decoration: underline; padding: .5rem 0; display: block; }
.hf-demo-link:hover { color: var(--muted); }
.hf-demo-link:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- WebGL-less gallery fallback ---------- */
.hf-gallery { position: fixed; inset: 0; z-index: 70; overflow: auto; background: var(--page);
  padding: 2.5rem 1.2rem 3rem; text-align: center; }
.hf-gal-title { font-family: var(--serif); color: var(--gold); margin: .3rem 0 .8rem; }
.hf-gal-note, .hf-gal-evoc { color: var(--muted); max-width: 38rem; margin: .3rem auto; font-size: .85rem; line-height: 1.55; }
.hf-gal-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.2rem;
  max-width: 68rem; margin: 1.6rem auto; text-align: start; }
.hf-gal-item { background: var(--card); color: var(--schist); border: 1px solid var(--rule); border-radius: 8px; padding: .8rem; }
.hf-gal-img { width: 100%; max-height: 260px; object-fit: contain; background: linear-gradient(180deg, #efe9db, #e4dcc8); border-radius: 4px; }
.hf-gal-h { font-family: var(--serif); font-size: 1.05rem; margin: .5rem 0 .2rem; }
.hf-gal-desc { font-size: .82rem; line-height: 1.5; color: #34382f; max-height: 9em; overflow: auto; }
.hf-gal-credits { color: rgba(207,199,180,.55); font-size: .74rem; margin: 1rem 0 1.2rem; }

/* ---------- touch targets ---------- */
@media (pointer: coarse) {
  .hf-lang { min-height: 44px; }
  .hf-icon-btn { width: 44px; height: 44px; }
}

/* ---------- toast / loading / error ---------- */
.hf-toast { position: fixed; left: 50%; bottom: calc(5.5rem + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(10px); z-index: 40;
  background: rgba(20,22,20,.92); color: var(--ink); border: 1px solid rgba(226,219,201,.22); padding: .6rem 1.1rem; border-radius: 6px; font-size: .85rem; opacity: 0; transition: opacity .35s, transform .35s; }
.hf-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hf-toast[hidden] { display: none; }
.hf-loading { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; gap: 1rem; background: var(--page); color: var(--muted); }
.hf-loading[hidden] { display: none; }
.hf-spinner { width: 26px; height: 26px; border: 2px solid rgba(226,219,201,.25); border-top-color: var(--gold); border-radius: 50%; animation: hf-spin 1s linear infinite; }
.hf-loading-txt { font-size: .85rem; letter-spacing: .05em; }
@keyframes hf-spin { to { transform: rotate(360deg); } }
.hf-error { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 2rem; background: var(--page); color: var(--muted); text-align: center; font-family: var(--serif); }
.hf-error p { max-width: 32rem; line-height: 1.6; }

/* ---------- a11y hotspots (keyboard only; do not block canvas) ---------- */
.hf-hotspots { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.hf-hotspot { position: absolute; width: 44px; height: 44px; transform: translate(-50%, -50%); background: transparent; border: none; border-radius: 50%; padding: 0; cursor: pointer; }
.hf-hotspot:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; background: rgba(193,154,73,.12); }

/* ---------- RTL ---------- */
.is-rtl .hf-intro-inner { text-align: start; }
.is-rtl .hf-cartel { justify-content: flex-start; }
.is-rtl .hf-cartel-card { transform: translateX(-20px); }
.is-rtl .hf-cartel.is-open .hf-cartel-card { transform: none; }
.is-rtl .hf-cartel-close { right: auto; left: .6rem; }
.is-rtl .hf-cartel-next { margin-left: 0; margin-right: auto; }
.is-rtl .hf-settings { right: auto; left: 1rem; }
.is-rtl .hf-prog-fill { background: linear-gradient(270deg, var(--gold7), var(--gold)); }

/* ---------- mobile: cartel becomes a bottom sheet ---------- */
@media (max-width: 640px) {
  .hf-cartel { align-items: flex-end; justify-content: center; }
  .hf-cartel-card { margin: 0; width: 100%; max-width: 100%; max-height: 86dvh; border-radius: 14px 14px 0 0; transform: translateY(24px); }
  .hf-cartel.is-open .hf-cartel-card { transform: none; }
  .is-rtl .hf-cartel-card { transform: translateY(24px); }
  .hf-cartel-figure { padding: 1rem 1rem .4rem; }
  .hf-cartel-img { max-height: 34dvh; }
  .hf-hud-top { flex-direction: column; }
  .hf-strip-lab { display: none; }
  .hf-quote { bottom: 8rem; }
}
@media (max-width: 400px) { .hf-verbs li { font-size: .88rem; } }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .hf-quote { animation: none; opacity: .7; }
  .hf-spinner { animation-duration: 2.4s; }
  * { transition-duration: .2s !important; }
}
