:root {
  --ink: #f3e9d2;
  --muted: #b8ab8e;
  --gold: #ffc65c;
  --silver: #b9d3ff;
  --crimson: #ff5a64;
  --bronze: #ff9a4a;
  --eden: #9fe38a;
  --glass: rgba(14, 12, 22, 0.72);
  --line: rgba(255, 207, 115, 0.22);
  --display: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  --ui: "Inter", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #03040a; color: var(--ink); font-family: var(--ui); }
canvas#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 230, 180, 0.06);
}

/* ---- Header ---------------------------------------------------------------- */
#top { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 18px; padding: 14px 18px; pointer-events: none; z-index: 5;
  background: linear-gradient(rgba(3, 4, 10, 0.7), transparent); }
#top > * { pointer-events: auto; }
.brand { font-family: var(--display); font-size: 24px; font-weight: 600; letter-spacing: 0.04em; color: #ffe2a8; text-shadow: 0 0 18px rgba(255, 190, 90, 0.5); white-space: nowrap; }
.brand .mark { color: var(--gold); }
#tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(10, 9, 18, 0.55); border: 1px solid var(--line); }
#tabs button { background: none; border: 0; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0.02em; transition: 0.25s; white-space: nowrap; }
#tabs button:hover { color: var(--ink); }
#tabs button.on { background: linear-gradient(180deg, rgba(255, 207, 115, 0.25), rgba(255, 207, 115, 0.08)); color: #ffe7b8; box-shadow: inset 0 0 0 1px rgba(255, 207, 115, 0.45); }
body[data-exhibit="hall"] #tabs button.on { background: linear-gradient(180deg, rgba(255, 90, 100, 0.28), rgba(255, 90, 100, 0.08)); box-shadow: inset 0 0 0 1px rgba(255, 90, 100, 0.5); color: #ffd6d6; }
body[data-exhibit="serpent"] #tabs button.on { background: linear-gradient(180deg, rgba(255, 154, 74, 0.28), rgba(255, 154, 74, 0.08)); box-shadow: inset 0 0 0 1px rgba(255, 154, 74, 0.5); color: #ffe0c4; }
.tools { margin-left: auto; display: flex; gap: 8px; }
.tools button { background: rgba(10, 9, 18, 0.55); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 13px; }
.tools button:hover { border-color: rgba(255, 207, 115, 0.6); }

/* ---- Filters -------------------------------------------------------------------- */
#filters { position: fixed; left: 18px; top: 70px; border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; z-index: 4; font-size: 12.5px; }
#filters label { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--muted); }
#filters input { display: none; }
#filters i { width: 22px; height: 3px; border-radius: 3px; background: currentColor; box-shadow: 0 0 8px currentColor; opacity: 0.25; transition: 0.2s; }
#filters input:checked + i { opacity: 1; }
#filters label:has(input:checked) { color: var(--ink); }
.k-prophecy { color: var(--gold); } .k-type { color: var(--silver); } .k-reversal { color: var(--crimson); } .k-small { color: #e8d9b5; } .k-bronze { color: var(--bronze); }
#filters label.k-prophecy i { color: var(--gold); } #filters label.k-type i { color: var(--silver); } #filters label.k-reversal i { color: var(--crimson); }
#filters label.k-small i { height: 1.5px; color: #e8d9b5; }

/* ---- Tour bar ------------------------------------------------------------------------ */
#tour { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 999px; z-index: 4; max-width: calc(100vw - 24px); }
#tour button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 207, 115, 0.08); color: #ffe2a8; font-size: 14px; flex: none; transition: 0.2s; }
#tour button:hover { background: rgba(255, 207, 115, 0.2); }
#tour-label { min-width: 250px; max-width: 360px; text-align: center; padding: 0 8px; line-height: 1.2; }
#tour-label b { display: block; font-family: var(--display); font-size: 20px; font-weight: 600; color: #ffeac0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tour-label span { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

/* ---- Card ------------------------------------------------------------------------------ */
#card { position: fixed; right: 18px; top: 70px; bottom: 90px; width: min(460px, calc(100vw - 36px)); border-radius: 18px; z-index: 6;
  transform: translateX(calc(100% + 40px)); opacity: 0; transition: transform 0.55s cubic-bezier(.2, .8, .2, 1), opacity 0.4s; display: flex; flex-direction: column; }
#card.open { transform: none; opacity: 1; }
#card-close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); z-index: 2; }
#card-body { overflow-y: auto; padding: 26px 26px 30px; scrollbar-width: thin; scrollbar-color: rgba(255, 207, 115, 0.3) transparent; }
#card h2 { font-family: var(--display); font-size: 32px; line-height: 1.08; font-weight: 600; margin: 6px 36px 12px 0; color: #fff1d6; }
.kicker { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600; color: var(--gold); }
.meta { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
.meta b { color: var(--ink); font-weight: 600; }
.date { color: #e9cf99; }
blockquote.verse { margin: 10px 0; padding: 12px 16px; border-left: 2px solid rgba(255, 207, 115, 0.6); background: linear-gradient(90deg, rgba(255, 207, 115, 0.07), transparent); border-radius: 0 10px 10px 0; }
blockquote.verse p { margin: 0; font-family: var(--display); font-size: 19px; line-height: 1.45; color: #f7eedb; }
blockquote.verse sup { font-family: var(--ui); font-size: 9.5px; color: var(--gold); margin-right: 3px; font-weight: 600; }
blockquote.verse cite { display: block; font-style: normal; font-size: 11.5px; letter-spacing: 0.06em; color: var(--gold); margin-top: 6px; font-weight: 600; }
.leg-head { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 18px 0 8px; }
.leg-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.leg.to .leg-head .dot { background: #fff; box-shadow: 0 0 12px #ffe7b0; }
.bridge { height: 26px; margin-left: 3px; border-left: 2px dashed rgba(255, 207, 115, 0.4); }
details.context { margin-top: 6px; font-size: 14px; color: var(--muted); }
details.context summary { cursor: pointer; color: #e9cf99; font-size: 12.5px; }
details.context p { line-height: 1.55; }
.note h4, .tradition h4, .landing h4 { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin: 22px 0 8px; font-weight: 600; }
.note p { font-size: 15px; line-height: 1.65; margin: 0; color: #eadfc6; }
.tradition { margin-top: 6px; padding: 4px 16px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.06); }
.father { margin: 10px 0 14px; }
.father .who { font-family: var(--display); font-size: 18px; font-weight: 600; color: #ffe7b8; }
.father .who span { font-family: var(--ui); font-size: 12px; font-weight: 400; color: var(--muted); }
.father p { font-size: 14px; line-height: 1.6; margin: 4px 0 0; color: #dccfb2; font-style: italic; }
.fine { font-size: 11px; color: #8a8070; margin: 8px 0 0; }
.muted { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.action { border: 1px solid rgba(255, 207, 115, 0.45); background: rgba(255, 207, 115, 0.08); color: #ffe7b8; padding: 9px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; transition: 0.2s; }
.action:hover { background: rgba(255, 207, 115, 0.2); }
.action[data-primary] { background: linear-gradient(180deg, #ffcf73, #d9973a); color: #1a1206; border-color: transparent; font-weight: 600; box-shadow: 0 0 22px rgba(255, 190, 90, 0.4); }
.lead { font-family: var(--display); font-size: 19px; color: #f0e3c4; margin: 20px 0 6px; }
.landing h4 span { opacity: 0.6; margin-left: 4px; }
.threadlist { list-style: none; margin: 0; padding: 0; }
.threadlist button { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); padding: 9px 4px; font-size: 14.5px; color: var(--ink); transition: 0.2s; }
.threadlist button:hover { background: rgba(255, 207, 115, 0.07); }
.threadlist small { width: 100%; padding-left: 18px; color: var(--muted); font-size: 12px; }
.threadlist .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; flex: none; }
.kicker.k-type { color: var(--silver); } .kicker.k-reversal { color: var(--crimson); } .kicker.k-bronze { color: var(--bronze); }

/* Mirror card */
.mirror .leg.eden .leg-head .dot { background: var(--eden); box-shadow: 0 0 10px var(--eden); }
.mirror .leg.passion .leg-head .dot { background: var(--crimson); box-shadow: 0 0 10px var(--crimson); }
.mirror .leg.eden blockquote { border-left-color: rgba(159, 227, 138, 0.7); background: linear-gradient(90deg, rgba(159, 227, 138, 0.07), transparent); }
.mirror .leg.eden blockquote cite, .mirror .leg.eden blockquote sup { color: var(--eden); }
.mirror .leg.passion blockquote { border-left-color: rgba(255, 90, 100, 0.7); background: linear-gradient(90deg, rgba(255, 90, 100, 0.08), transparent); }
.mirror .leg.passion blockquote cite, .mirror .leg.passion blockquote sup { color: #ff8a90; }
.mirror .line { font-family: var(--display); font-style: italic; font-size: 19px; color: #f3e5c8; margin: 0 0 6px; }
body[data-exhibit="serpent"] blockquote.verse { border-left-color: rgba(255, 154, 74, 0.7); background: linear-gradient(90deg, rgba(255, 154, 74, 0.08), transparent); }
body[data-exhibit="serpent"] blockquote.verse cite, body[data-exhibit="serpent"] blockquote.verse sup { color: var(--bronze); }

/* ---- Index ------------------------------------------------------------------------------ */
#index { position: fixed; left: 18px; top: 70px; bottom: 90px; width: min(360px, calc(100vw - 36px)); border-radius: 18px; z-index: 7; display: flex; flex-direction: column;
  transform: translateX(calc(-100% - 40px)); opacity: 0; transition: transform 0.5s cubic-bezier(.2, .8, .2, 1), opacity 0.4s; }
#index.open { transform: none; opacity: 1; }
.index-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.index-head h2 { font-family: var(--display); margin: 0; font-size: 26px; font-weight: 600; color: #fff1d6; }
.index-head button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: none; }
#index-list { overflow-y: auto; padding: 0 18px 20px; scrollbar-width: thin; scrollbar-color: rgba(255, 207, 115, 0.3) transparent; }
#index-list h3 { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; margin: 18px 0 6px; color: var(--gold); }
#index-list h3.k-type { color: var(--silver); } #index-list h3.k-reversal { color: var(--crimson); }
#index-list ul { list-style: none; margin: 0; padding: 0; }
#index-list button { width: 100%; text-align: left; background: none; border: 0; padding: 7px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 14px; display: flex; flex-direction: column; }
#index-list button:hover { background: rgba(255, 207, 115, 0.07); }
#index-list small { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* ---- Help ----------------------------------------------------------------------------------- */
#help { position: fixed; inset: 0; z-index: 20; display: none; place-items: center; }
#help.open { display: grid; }
#help .backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.help-box { position: relative; max-width: 560px; margin: 16px; border-radius: 18px; padding: 24px 28px; }
.help-box h2 { font-family: var(--display); font-weight: 600; font-size: 30px; margin: 0 0 10px; color: #fff1d6; }
.help-box ul { padding-left: 18px; line-height: 1.6; font-size: 14.5px; }
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; margin: 14px 0; }
.legend i { display: inline-block; width: 26px; height: 3px; border-radius: 3px; background: currentColor; box-shadow: 0 0 8px currentColor; margin-right: 10px; vertical-align: middle; }
.help-box > button { margin-top: 10px; border: 1px solid rgba(255, 207, 115, 0.45); background: rgba(255, 207, 115, 0.1); padding: 8px 18px; border-radius: 999px; }

/* ---- Tooltip ------------------------------------------------------------------------------------ */
#tooltip { position: fixed; left: 0; top: 0; z-index: 8; pointer-events: none; max-width: 300px; padding: 8px 12px; border-radius: 10px; background: rgba(12, 10, 20, 0.85); border: 1px solid var(--line); font-size: 13px; line-height: 1.35; }
#tooltip b { font-family: var(--display); font-size: 17px; font-weight: 600; color: #ffeac0; }
#tooltip span { color: var(--muted); font-size: 12px; }

/* ---- Intro ------------------------------------------------------------------------------------------ */
#intro { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; text-align: center; padding: 24px;
  background: radial-gradient(ellipse at 50% 60%, rgba(40, 25, 60, 0.35), rgba(2, 3, 8, 0.82) 70%); transition: opacity 1.6s, visibility 1.6s; }
#intro.gone { opacity: 0; visibility: hidden; }
.intro-inner { max-width: 640px; animation: rise 2.2s cubic-bezier(.2, .8, .2, 1) both; }
#intro h1 { font-family: var(--display); font-weight: 600; font-size: clamp(56px, 11vw, 112px); margin: 8px 0 18px; line-height: 0.95;
  background: linear-gradient(180deg, #fff4d6 10%, #ffc65c 60%, #b77a2a); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(255, 180, 80, 0.35)); }
.epigraph { font-family: var(--display); font-style: italic; font-size: clamp(19px, 2.6vw, 24px); line-height: 1.45; color: #efe2c4; margin: 0 auto 30px; max-width: 540px; }
.epigraph cite { display: block; font-style: normal; font-family: var(--ui); font-size: 12px; letter-spacing: 0.14em; color: var(--gold); margin-top: 10px; }
#enter { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: 0.12em; padding: 12px 44px; border-radius: 999px; border: 1px solid rgba(255, 207, 115, 0.7);
  background: rgba(255, 207, 115, 0.1); color: #ffe7b8; box-shadow: 0 0 40px rgba(255, 190, 90, 0.25), inset 0 0 20px rgba(255, 190, 90, 0.15); transition: 0.3s; }
#enter:hover { background: rgba(255, 207, 115, 0.22); box-shadow: 0 0 60px rgba(255, 190, 90, 0.45), inset 0 0 20px rgba(255, 190, 90, 0.25); }
.hint { font-size: 12px; color: #8a8070; margin-top: 22px; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

#fader { position: fixed; inset: 0; background: #03040a; z-index: 25; pointer-events: none; opacity: 0; transition: opacity 0.45s; }
#fader.on { opacity: 1; }
#loading { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: #03040a; transition: opacity 0.8s, visibility 0.8s; }
#loading span { font-size: 40px; color: var(--gold); animation: pulse 1.4s ease-in-out infinite; text-shadow: 0 0 30px var(--gold); }
#loading.done { opacity: 0; visibility: hidden; }
@keyframes pulse { 50% { opacity: 0.3; transform: scale(0.85); } }

/* ---- Small screens ---------------------------------------------------------------------------------- */
@media (max-width: 800px) {
  #top { flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; }
  .brand { font-size: 20px; }
  #tabs { order: 3; width: 100%; justify-content: space-between; }
  #tabs button { padding: 6px 8px; font-size: 12px; flex: 1; }
  .tools button span { display: none; }
  #filters { top: auto; bottom: 84px; left: 12px; flex-direction: row; flex-wrap: wrap; right: 12px; justify-content: center; padding: 8px 10px; gap: 6px 12px; font-size: 11.5px; }
  #tour { bottom: max(12px, env(safe-area-inset-bottom)); }
  #tour-label { min-width: 0; flex: 1; }
  #tour-label b { font-size: 17px; }
  #card { left: 0; right: 0; width: auto; top: auto; bottom: 0; height: 62vh; border-radius: 18px 18px 0 0; transform: translateY(105%); }
  #card-body { padding: 22px 18px 30px; }
  #card h2 { font-size: 27px; }
  #index { left: 0; right: 0; width: auto; top: 108px; bottom: 0; border-radius: 18px 18px 0 0; }
}

/* Toolbars stay hidden while the intro title is up */
#top, #filters, #tour { transition: opacity 1.2s 0.6s; }
body.intro #top, body.intro #filters, body.intro #tour { opacity: 0; pointer-events: none; }
#filters[hidden] { display: none; }

/* Problem notice */
#problem { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 50; max-width: min(460px, calc(100vw - 32px)); padding: 20px 22px; border-radius: 16px; text-align: center; }
#problem[hidden] { display: none; }
#problem p { font-family: var(--display); font-size: 21px; margin: 0 0 8px; color: #fff1d6; }
#problem code { display: block; font-size: 12px; color: var(--muted); margin-bottom: 14px; word-break: break-word; }
#problem button { margin: 0 4px; border: 1px solid rgba(255, 207, 115, 0.45); background: rgba(255, 207, 115, 0.1); padding: 8px 18px; border-radius: 999px; }
.filter-note { margin: 4px 0 0; max-width: 150px; font-size: 10.5px; line-height: 1.35; color: #8a8070; }
@media (max-width: 800px) { .filter-note { display: none; } }
.verse-note { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); font-style: italic; }
#lang-btn { font-weight: 600; letter-spacing: 0.03em; }

/* ---- The Table: three linked layers ---- */
.kicker.k-table { color: #f0c98a; }
.stream-title { text-shadow: 0 0 24px var(--c); }
.lead.pattern { font-style: italic; font-size: 21px; color: #fff0d4; }
.layers { position: relative; margin-top: 18px; padding-left: 20px; }
.layers::before { content: ""; position: absolute; left: 4px; top: 10px; bottom: 14px; width: 2px; border-radius: 2px;
  background: linear-gradient(#ffc65c, #b9d3ff 50%, #d9a8ff); opacity: 0.7; }
.layer { position: relative; margin-bottom: 16px; }
.layer-head { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; margin: 4px 0 8px; }
.layer-head small { text-transform: none; letter-spacing: 0.02em; font-weight: 400; color: var(--muted); font-size: 12px; }
.layer-head .dot { position: absolute; left: -20px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.l-scripture .layer-head { color: #ffc65c; } .l-fathers .layer-head { color: #b9d3ff; } .l-reading .layer-head { color: #d9a8ff; }
.l-fathers .father { margin: 6px 0 12px; }
.l-reading p { font-family: var(--display); font-size: 19px; line-height: 1.5; color: #f1e6f5; margin: 0; }
.facet { margin: 14px 0; padding: 10px 14px; border-left: 2px solid var(--c); background: linear-gradient(90deg, color-mix(in srgb, var(--c) 10%, transparent), transparent); border-radius: 0 10px 10px 0; }
.facet-name { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 21px; font-weight: 600; color: #fff1d6; }
.facet-name .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.facet-phrase { font-style: italic; color: var(--c); margin: 4px 0; font-family: var(--display); font-size: 18px; }
.facet p { font-size: 14.5px; line-height: 1.6; color: #eadfc6; margin: 4px 0 0; }
body[data-exhibit="table"] #tabs button.on { background: linear-gradient(180deg, rgba(240, 201, 138, 0.3), rgba(194, 58, 90, 0.12)); box-shadow: inset 0 0 0 1px rgba(240, 201, 138, 0.55); color: #fff0d8; }
#flash { position: fixed; inset: 0; z-index: 24; pointer-events: none; background: radial-gradient(circle, #fffaf0, #ffe2b0 60%, #f0c98a); opacity: 0; transition: opacity 0.7s; }
#flash.on { opacity: 1; transition: opacity 0.35s; }
#toast { position: fixed; left: 50%; top: 24%; transform: translateX(-50%); z-index: 9; font-family: var(--display); font-style: italic; font-size: clamp(22px, 3.2vw, 34px); color: #fff3dc; text-shadow: 0 0 30px rgba(255, 200, 120, 0.8); opacity: 0; transition: opacity 1.2s; pointer-events: none; text-align: center; width: min(90vw, 800px); }
#toast.on { opacity: 1; }
@media (max-width: 800px) {
  /* Four rooms don't fit side by side on a phone: let the tab bar scroll sideways. */
  #tabs { overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  #tabs::-webkit-scrollbar { display: none; }
  #tabs button { flex: 0 0 auto; padding: 6px 11px; }
}

/* The story you just came back from: a warm glow that fades, leaving a faint marker. */
.threadlist button.afterglow { background: rgba(255, 207, 115, 0.07); box-shadow: inset 3px 0 0 rgba(255, 207, 115, 0.55); animation: afterglow 2.6s ease-out; }
@keyframes afterglow {
  0% { background: rgba(255, 207, 115, 0.38); box-shadow: inset 3px 0 0 #ffcf73, 0 0 28px rgba(255, 190, 90, 0.55); }
  100% { background: rgba(255, 207, 115, 0.07); box-shadow: inset 3px 0 0 rgba(255, 207, 115, 0.55), 0 0 0 rgba(255, 190, 90, 0); }
}

/* Language choice on the title screen */
.intro-lang { position: absolute; top: max(18px, env(safe-area-inset-top)); right: 18px; display: flex; padding: 4px; border-radius: 999px;
  background: rgba(10, 9, 18, 0.55); border: 1px solid var(--line); animation: rise 2.2s cubic-bezier(.2, .8, .2, 1) both; }
.intro-lang button { background: none; border: 0; padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0.02em; transition: 0.25s; }
.intro-lang button:hover { color: var(--ink); }
.intro-lang button.on { background: linear-gradient(180deg, rgba(255, 207, 115, 0.25), rgba(255, 207, 115, 0.08)); color: #ffe7b8; box-shadow: inset 0 0 0 1px rgba(255, 207, 115, 0.45); cursor: default; }

/* Poster mode (?poster): the link-preview image */
body.poster .intro-lang, body.poster #enter, body.poster .hint, body.poster #top, body.poster #tour, body.poster #filters { display: none !important; }
body.poster #intro { background: radial-gradient(ellipse at 50% 50%, rgba(3, 4, 10, 0.55), rgba(3, 4, 10, 0.15) 70%); }
body.poster .intro-inner { max-width: 1100px; }
body.poster #intro h1 { font-size: 112px; margin: 6px 0 0; white-space: nowrap; }
body.poster .poster-sub { font-family: var(--display); font-style: italic; font-size: 44px; color: #f3dca8; margin: 2px 0 18px; text-shadow: 0 0 24px rgba(255, 180, 80, 0.45); }
body.poster .poster-line { text-wrap: balance; font-family: var(--display); font-size: 25px; color: #efe2c4; max-width: 760px; margin: 0 auto; line-height: 1.35; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8); }

/* ---- The four films on the title screen ------------------------------------------------------------ */
#intro { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; overflow-y: auto; overscroll-behavior: contain;
  padding: clamp(36px, 7vh, 84px) 20px 56px; scrollbar-width: thin; scrollbar-color: rgba(255, 207, 115, 0.3) transparent; }
#intro h1 { font-size: clamp(52px, 8.5vw, 100px); margin: 6px 0 14px; }
#intro .epigraph { margin-bottom: 8px; }
.films { width: min(1240px, 100%); margin-top: clamp(22px, 4vh, 40px); animation: rise 2.2s 0.35s cubic-bezier(.2, .8, .2, 1) both; }
.films-head { max-width: 640px; margin: 0 auto 22px; }
.films-head h2 { font-family: var(--display); font-weight: 600; font-size: clamp(28px, 3.4vw, 38px); margin: 6px 0 6px; color: #fff1d6; }
.films-head p { margin: 0; color: #d9ccb0; font-size: 15px; line-height: 1.55; text-wrap: balance; }
.films-head .films-lang { margin-top: 6px; font-size: 13px; color: var(--muted); }
.films-head .films-lang:empty { display: none; }
.film-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; text-align: left; }
.film { display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: rgba(12, 10, 20, 0.72);
  border: 1px solid color-mix(in srgb, var(--c) 32%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45); transition: transform 0.35s cubic-bezier(.2, .8, .2, 1), box-shadow 0.35s, border-color 0.35s; }
.film:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--c) 65%, transparent);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), 0 0 34px color-mix(in srgb, var(--c) 28%, transparent); }
.film-play { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0; background: #05040a; overflow: hidden; }
.film-play img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.8s cubic-bezier(.2, .8, .2, 1), filter 0.5s; filter: brightness(0.82); }
.film:hover .film-play img { transform: scale(1.05); filter: brightness(1); }
.film-play::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(5, 4, 10, 0.75)); }
.film-num { position: absolute; left: 12px; top: 9px; z-index: 1; font-family: var(--display); font-weight: 600; font-size: 22px; color: var(--c); text-shadow: 0 0 14px rgba(0, 0, 0, 0.9), 0 0 18px color-mix(in srgb, var(--c) 60%, transparent); }
.film-len { position: absolute; right: 10px; bottom: 9px; z-index: 1; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: #f3e9d2; padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.55); }
.film-icon { position: absolute; left: 50%; top: 50%; z-index: 1; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--c) 75%, transparent); background: rgba(8, 6, 14, 0.45); backdrop-filter: blur(4px);
  box-shadow: 0 0 26px color-mix(in srgb, var(--c) 40%, transparent); transition: transform 0.35s, background 0.35s; }
.film-icon::before { content: ""; position: absolute; left: 23px; top: 18px; border-style: solid; border-width: 11px 0 11px 17px; border-color: transparent transparent transparent var(--c); }
.film:hover .film-icon { transform: scale(1.1); background: color-mix(in srgb, var(--c) 22%, rgba(8, 6, 14, 0.5)); }
.film-text { display: flex; flex-direction: column; flex: 1; padding: 14px 16px 16px; }
.film-text h3 { font-family: var(--display); font-weight: 600; font-size: 26px; margin: 0 0 6px; color: #fff1d6; }
.film-text p { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: #d6c9ad; flex: 1; }
.film-explore { align-self: flex-start; background: none; border: 0; padding: 4px 0; font-size: 13.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--c); }
.film-explore:hover { text-decoration: underline; text-underline-offset: 4px; }
.enter-own { margin: clamp(30px, 5vh, 48px) 0 0; animation: rise 2.2s 0.6s cubic-bezier(.2, .8, .2, 1) both; }
.enter-own > p:first-child { font-family: var(--display); font-style: italic; font-size: 20px; color: #efe2c4; margin: 0 0 14px; }
@media (max-width: 1100px) { .film-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .film-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; } .film-text h3 { font-size: 24px; } }
body.poster .films, body.poster .enter-own { display: none !important; }

/* The film player */
#player { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
#player[hidden] { display: none; }
#player .backdrop { position: absolute; inset: 0; background: rgba(2, 3, 8, 0.88); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.player-box { position: relative; width: min(1200px, 100%, calc((100vh - 170px) * 16 / 9)); animation: rise 0.7s cubic-bezier(.2, .8, .2, 1) both; }
.player-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.player-head .kicker { color: var(--c); }
.player-head h2 { font-family: var(--display); font-weight: 600; font-size: clamp(26px, 3.2vw, 36px); margin: 2px 0 0; color: #fff1d6; }
#player-close { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.35); }
#player-video { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; background: #000;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.7), 0 0 50px color-mix(in srgb, var(--c) 22%, transparent); }
.player-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.player-foot .fine { margin: 0; }
