:root {
  --ink: #111014;
  --paper: #f3eee2;
  --red: #d42a33;
  --gold: #ffd34d;
  --jade: #9fe8d0;
  --blue: #9fd8ff;
  --px: 2;
  /* The game's own pixel fonts (fonts.css from tools/ui/web_font.py). One font pixel is 1/16 em, so sizes step by 8px. */
  --body: "CuuThien Body", system-ui, sans-serif;
  --title: "CuuThien Title", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

main { overflow-x: clip; }

body {
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  font-family: var(--body); font-size: 16px; font-weight: 400; font-synthesis: none;
  -webkit-font-smoothing: none;
  background:
    radial-gradient(circle, rgba(255, 255, 255, .035) 1px, transparent 1.4px) 0 0 / 7px 7px,
    #17141a;
}

img { image-rendering: pixelated; }

/* Reader chrome */

.progress { position: fixed; inset: 0 0 auto; height: 4px; z-index: 50; background: rgba(0, 0, 0, .4); }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--gold)); }

.reader {
  position: fixed; right: 14px; bottom: 14px; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 6px 6px 14px;
  background: var(--paper); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--title);
}
.chapter-now { font-size: 16px; }
.play {
  font: inherit; font-size: 16px; cursor: pointer;
  padding: 6px 12px; color: #fff; background: var(--red); border: 2px solid var(--ink);
}
.play::before { content: ""; display: inline-block; margin-right: 7px; border-left: 9px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.play[aria-pressed="true"] { background: var(--ink); }
.play[aria-pressed="true"]::before { width: 9px; height: 11px; border: 0; border-left: 3px solid; border-right: 3px solid; vertical-align: -1px; }

.flash { position: fixed; inset: 0; z-index: 40; pointer-events: none; background: #fff; opacity: 0; }
.flash.go { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .9; } 100% { opacity: 0; } }

/* Cover */

.cover { position: relative; height: 100vh; height: 100svh; min-height: 480px; overflow: hidden; background: #101a36; }
.cover-art { position: absolute; inset: 0; }
.cover-art .layer {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 100%; will-change: transform;
}
.cover-art .drift { animation: drift 40s linear infinite alternate; }
@keyframes drift { from { translate: -3% 0; } to { translate: 3% 0; } }

.crane {
  position: absolute; top: 22%; left: 0;
  width: calc(32px * var(--px)); height: calc(20px * var(--px));
  background: url(img/title_crane.png) 0 0 / calc(128px * var(--px)) 100%;
  image-rendering: pixelated;
  animation: flap .7s steps(4) infinite, cross 26s linear infinite;
}
@keyframes flap { to { background-position: calc(-128px * var(--px)) 0; } }
@keyframes cross { from { transform: translateX(-20vw) translateY(0); } 50% { transform: translateX(50vw) translateY(-3vh); } to { transform: translateX(120vw) translateY(1vh); } }

.cover-text {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 5vw 6vh; text-align: center; color: #fff;
}
.cover-text h1 { margin: 0; }
.logo { display: block; width: min(90vw, 760px); height: auto; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .6)); }
.tagline {
  margin: 4vh 0 0; font-family: var(--title); font-size: 48px;
}
.tagline span { display: inline-block; animation: rise .9s both; }
.tagline span + span { animation-delay: .7s; }
.sub {
  max-width: 34em; margin: 2vh 0 0; font-size: 32px;
  text-shadow: 2px 2px 0 var(--ink); animation: rise .9s 1.3s both;
}
.scroll-cue {
  margin-top: 5vh; padding: 8px 20px; color: var(--ink); text-decoration: none;
  font-family: var(--title); font-size: 32px;
  background: var(--paper); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  animation: rise .9s 1.8s both, bob 1.6s 2.7s ease-in-out infinite;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@keyframes bob { 50% { transform: translateY(6px); } }

.letterbox { position: absolute; left: 0; right: 0; height: 9vh; z-index: 3; background: #000; transition: height .2s; }
.letterbox.top { top: 0; }
.letterbox.bottom { bottom: 0; }

/* Page */

main { padding: 6vh 0 2vh; }

.page {
  position: relative;
  width: min(1000px, 94vw);
  margin: 0 auto 9vh;
  padding: clamp(14px, 3vw, 30px);
  background:
    radial-gradient(circle, rgba(0, 0, 0, .07) 1px, transparent 1.3px) 0 0 / 6px 6px,
    var(--paper);
  box-shadow: 0 0 0 1px #000, 10px 12px 0 rgba(0, 0, 0, .45);
}
.page.dark {
  color: #fff;
  background:
    radial-gradient(circle, rgba(255, 255, 255, .06) 1px, transparent 1.3px) 0 0 / 6px 6px,
    #0b0a0e;
}
.page.blood { background: radial-gradient(circle, rgba(255, 60, 60, .08) 1px, transparent 1.3px) 0 0 / 6px 6px, #12070a; }
.page.sky { background: radial-gradient(circle, rgba(40, 70, 140, .1) 1px, transparent 1.3px) 0 0 / 6px 6px, #e9eef6; }
.page.shake { animation: shake .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px); }
  20%, 80% { transform: translate(4px, -2px); }
  30%, 50%, 70% { transform: translate(-7px, 3px); }
  40%, 60% { transform: translate(7px, -3px); }
}

.chapter {
  display: flex; align-items: baseline; gap: 14px; margin: 0 0 clamp(12px, 2vw, 22px);
  font-family: var(--title); font-size: 48px; line-height: 1.25;
}
.chapter b {
  font-size: 32px;
  padding: 6px 10px 4px; color: var(--paper); background: var(--ink); transform: rotate(-3deg);
}
.dark .chapter b { color: var(--ink); background: var(--paper); }

.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: clamp(62px, 10.2vw, 104px);
  gap: clamp(8px, 1.4vw, 14px);
}
.c2 { grid-column: span 2; }
.c3 { grid-column: span 3; }
.c4 { grid-column: span 4; }
.c6 { grid-column: span 6; }
.r2 { grid-row: span 2; }
.r3 { grid-row: span 3; }
.r4 { grid-row: span 4; }

/* Panel */

.panel { --clip: polygon(0 0, 100% 0, 100% 100%, 0 100%); position: relative; margin: 0; }
.slant-r { --clip: polygon(0 0, 100% 0, 93% 100%, 0 100%); }
.slant-l { --clip: polygon(7% 0, 100% 0, 100% 100%, 0 100%); }

.frame { position: absolute; inset: 0; overflow: hidden; background: var(--ink); clip-path: var(--clip); }
.dark .frame { background: #f3eee2; }
.frame > img {
  position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px);
  object-fit: cover; clip-path: var(--clip);
  transition: filter 1.4s .35s, transform 6s ease-out;
}
.frame > img.pos-top { object-position: 50% 0; }
.frame > img.pos-low { object-position: 50% 85%; }
.frame > img.contain { object-fit: contain; background: #e7d9b6; }

.panel:not(.blank):not(.cutin) .frame::before {
  content: ""; position: absolute; inset: 4px; z-index: 2; pointer-events: none; clip-path: var(--clip);
  background: radial-gradient(circle, rgba(0, 0, 0, .5) 1px, transparent 1.7px) 0 0 / 5px 5px;
  transition: opacity 1.6s .4s;
}
.blank .frame::before, .cutin .frame::before {
  content: ""; position: absolute; inset: 4px; clip-path: var(--clip); background: var(--fill, #fff);
}
.frame::after {
  content: ""; position: absolute; inset: 0; z-index: 8; pointer-events: none;
  background: var(--wipe, var(--paper)); transform-origin: 100% 50%;
  transition: transform .7s cubic-bezier(.75, 0, .2, 1);
}
.dark .frame::after { --wipe: #0b0a0e; }
.blood .frame::after { --wipe: #12070a; }
.sky .frame::after { --wipe: #e9eef6; }
.panel:nth-child(even) .frame::after { transform-origin: 0 50%; }

/* Sprites as cut-ins */

.frame > img.sprite {
  inset: auto; left: 50%; top: 52%; width: auto; height: 72%; max-width: 92%;
  object-fit: contain; clip-path: none; z-index: 3;
  transform: translate(-50%, -50%);
  filter: drop-shadow(3px 0 0 var(--ink)) drop-shadow(-3px 0 0 var(--ink)) drop-shadow(0 3px 0 var(--ink)) drop-shadow(0 -3px 0 var(--ink));
}
.frame > img.sprite.big { height: 84%; }
.frame > img.sprite.boss { height: 62%; top: 44%; max-width: 88%; }

.cutin { --fill: #fff; }
.cutin.lines .frame::before, .cutin.burst .frame::before {
  background:
    radial-gradient(circle at 50% 52%, var(--core) 0 26%, transparent 58%),
    repeating-conic-gradient(from var(--spin, 0deg) at 50% 52%, var(--ink) 0deg 1.1deg, transparent 1.1deg 6.5deg),
    var(--core);
  animation: spin 18s linear infinite;
}
.cutin.lines { --core: #fff; }
.cutin.burst { --core: #fbf3d2; }
@property --spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes spin { to { --spin: 360deg; } }

.cutin.speed .frame::before {
  background:
    repeating-linear-gradient(172deg, transparent 0 9px, rgba(17, 16, 20, .85) 9px 11px, transparent 11px 23px, rgba(17, 16, 20, .4) 23px 24px),
    #fff;
  animation: streak .35s linear infinite;
}
@keyframes streak { to { background-position: -48px 0; } }

.cutin.flight .frame::before {
  background:
    repeating-linear-gradient(180deg, transparent 0 23px, rgba(255, 255, 255, .55) 23px 25px, transparent 25px 61px) 0 0 / 260px 100%,
    linear-gradient(#4f6cc0, #93a8e6 55%, #dcd8f2);
  animation: wind .5s linear infinite;
}
@keyframes wind { to { background-position: -260px 0, 0 0; } }
.cutin.flight .frame > img.bg {
  inset: auto auto 4px 4px; width: 200%; height: 44%; object-fit: cover; object-position: 50% 100%;
  clip-path: none; filter: none; z-index: 1; animation: clouds 14s ease-in-out infinite alternate;
}
.cutin.flight .frame > img.bg.front { z-index: 4; height: 16%; animation-duration: 8s; animation-direction: alternate-reverse; }
.cutin.flight .frame > img.sprite { z-index: 3; top: 46%; height: 64%; animation: hover 1.4s ease-in-out infinite; }
@keyframes clouds { to { transform: translateX(-50%); } }
@keyframes hover { 50% { transform: translate(-50%, calc(-50% - 8px)); } }
.cutin.flight .frame::after { z-index: 9; }

/* Boss rogue gallery */

.rogue .frame { background: radial-gradient(circle at 50% 42%, #5a121b 0 30%, #1a0609 75%); border: 4px solid #f3eee2; }
.panel.rogue .frame::before { display: none; }
.rogue .frame > img.sprite { filter: drop-shadow(0 0 10px rgba(255, 60, 60, .45)); }
.rogue:hover .frame > img.sprite { transform: translate(-50%, -50%) scale(1.06); }
.plate {
  position: absolute; left: 6px; right: 6px; bottom: 6px; z-index: 5; margin: 0;
  padding: 6px 8px 7px; text-align: center;
  font-family: var(--title); font-size: 24px; color: #fff;
  background: rgba(10, 4, 6, .85); border-top: 2px solid var(--red);
  opacity: 0; transform: translateY(8px); transition: .5s .55s;
}

/* Text: narration, bubbles, SFX */

.narr, .bubble, .sfx, .stamp { position: absolute; margin: 0; }
.narr, .bubble, .sfx {
  left: var(--x, 4%); right: var(--r, auto); top: var(--y, auto); bottom: var(--b, auto);
}

.narr {
  z-index: 5; max-width: 48%;
  padding: .45em .7em .5em;
  font-size: 24px;
  background: #fff; border: 2.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  opacity: 0; transform: translateY(8px); transition: opacity .5s .45s, transform .5s .45s;
}
.narr.small { max-width: 54%; }
.narr.big { font-family: var(--title); font-size: 32px; line-height: 1.25; }
.dark .narr { color: #fff; background: var(--ink); border-color: #fff; box-shadow: 3px 3px 0 #fff; }
.narr.center {
  left: 50%; right: auto; top: 50%; bottom: auto; max-width: 84%; padding: 0;
  text-align: center; background: none; border: 0; box-shadow: none;
  transform: translate(-50%, -40%);
}
.on .narr.center { transform: translate(-50%, -50%); }

.bubble {
  z-index: 6; max-width: 50%;
  padding: .85em 1.25em .9em;
  font-size: 24px; text-align: center;
  color: var(--ink); background: #fff; border: 2.5px solid var(--ink); border-radius: 50% / 46%;
  opacity: 0; transform: scale(.3); transform-origin: 30% 100%;
  transition: opacity .25s .75s, transform .45s .75s cubic-bezier(.3, 1.7, .5, 1);
}
.bubble em {
  display: block; margin-bottom: 2px; font-style: normal;
  font-family: var(--title); font-size: 16px; color: var(--red);
}
.bubble::before, .bubble::after { content: ""; position: absolute; }
.bubble.tail-b::before { left: 24%; bottom: -19px; width: 22px; height: 20px; background: var(--ink); clip-path: polygon(0 0, 100% 0, 10% 100%); }
.bubble.tail-b::after { left: calc(24% + 3px); bottom: -13px; width: 15px; height: 15px; background: #fff; clip-path: polygon(0 0, 100% 0, 8% 100%); }
.bubble.think { border-style: dashed; }
.bubble.tail-t::before { left: 46%; top: -20px; width: 12px; height: 12px; border: 2.5px solid var(--ink); border-radius: 50%; background: #fff; }
.bubble.tail-t::after { left: 52%; top: -34px; width: 8px; height: 8px; border: 2px solid var(--ink); border-radius: 50%; background: #fff; }
.bubble.shout {
  --star: polygon(50% 0, 60% 14%, 76% 4%, 77% 20%, 96% 16%, 88% 34%, 100% 46%, 87% 56%, 97% 74%, 78% 74%, 76% 94%, 61% 84%, 50% 100%, 39% 84%, 24% 94%, 22% 74%, 3% 74%, 13% 56%, 0 46%, 12% 34%, 4% 16%, 23% 20%, 24% 4%, 40% 14%);
  padding: 1.5em 2.2em; border: 0; border-radius: 0; background: none;
  font-family: var(--title); font-size: 32px;
}
.bubble.shout::before, .bubble.shout::after { width: auto; height: auto; clip-path: var(--star); z-index: -1; }
.bubble.shout::before { inset: 0; background: var(--ink); }
.bubble.shout::after { inset: 5px 7px; background: #fff; }

.sfx {
  z-index: 7; pointer-events: none; white-space: nowrap;
  font-family: var(--title); font-size: 64px; line-height: 1;
  color: #fff; --ring: var(--ink); --drop: var(--ink);
  opacity: 0; transform: rotate(var(--rot, 0deg)) scale(2.6);
  transition: opacity .2s .6s, transform .35s .6s cubic-bezier(.2, 1.6, .4, 1);
}
.sfx.huge { font-size: 96px; }
.sfx.red { color: var(--red); }
.sfx.gold { --hi: #fff0a0; --mid: #f0c43c; --lo: #c8961e; --ring: #4a3208; }
.sfx.blue { color: var(--blue); }
.sfx.dark { color: var(--ink); --ring: #fff; --drop: rgba(0, 0, 0, .6); }
.sfx.dull { color: #8b8e9c; font-size: 48px; }

.stamp {
  left: 50%; top: 52%; z-index: 6;
  padding: .18em .3em .12em; text-align: center;
  font-family: var(--title); font-size: 64px; line-height: 1.25;
  color: var(--red); border: 7px double var(--red); border-radius: 6px;
  background: rgba(212, 42, 51, .06); mix-blend-mode: multiply;
  opacity: 0; transform: translate(-50%, -50%) rotate(-12deg) scale(3);
}
.on .stamp { animation: stamp .32s .95s cubic-bezier(.5, 0, .8, .5) forwards; }
@keyframes stamp {
  80% { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(.92); }
  100% { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
}

/* Revealed state */

.js .panel { opacity: 0; transform: translateY(26px); transition: opacity .55s, transform .7s cubic-bezier(.2, .8, .2, 1); }
.js .panel.on { opacity: 1; transform: none; }
.js .frame > img { filter: grayscale(1) contrast(1.45) brightness(1.06); }
.js .frame > img.sprite { filter: grayscale(1) contrast(1.3) drop-shadow(3px 0 0 var(--ink)) drop-shadow(-3px 0 0 var(--ink)) drop-shadow(0 3px 0 var(--ink)) drop-shadow(0 -3px 0 var(--ink)); }
.js .rogue .frame > img.sprite { filter: grayscale(1) brightness(.5); }
.js .cutin.flight .frame > img.bg { filter: none; }
.on .frame > img { filter: none; transform: scale(1.04); }
.on .frame > img.sprite, .js .on .frame > img.sprite {
  transform: translate(-50%, -50%);
  filter: drop-shadow(3px 0 0 var(--ink)) drop-shadow(-3px 0 0 var(--ink)) drop-shadow(0 3px 0 var(--ink)) drop-shadow(0 -3px 0 var(--ink));
}
.js .rogue.on .frame > img.sprite { filter: drop-shadow(0 0 10px rgba(255, 60, 60, .45)); }
.on .frame::before { opacity: 1; }
.on:not(.blank):not(.cutin) .frame::before { opacity: 0; }
.on .frame::after { transform: scaleX(0); }
.on .narr { opacity: 1; transform: none; }
.on .bubble { opacity: 1; transform: none; }
.on .sfx { opacity: 1; transform: rotate(var(--rot, 0deg)) scale(1); }
.on .plate { opacity: 1; transform: none; }
html:not(.js) .narr, html:not(.js) .bubble, html:not(.js) .plate { opacity: 1; transform: none; }
html:not(.js) .sfx { opacity: 1; transform: rotate(var(--rot, 0deg)); }
html:not(.js) .stamp { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg); }
html:not(.js) .frame::after { transform: scaleX(0); }

/* Scenes drawn in CSS */

.night { --fill: linear-gradient(#0c1022 0 62%, #1b1712 62%); }
.night .monitor {
  position: absolute; right: 12%; bottom: 34%; width: 24%; aspect-ratio: 16 / 10; z-index: 2;
  background: linear-gradient(#cfe0ff, #8eb0f0); border: 7px solid #04050a; border-radius: 3px;
  box-shadow: 0 0 70px 26px rgba(120, 170, 255, .28);
  animation: flicker 3.2s steps(1) infinite;
}
.night .monitor::after { content: ""; position: absolute; left: 42%; top: 100%; width: 16%; height: 34%; background: #04050a; }
.night .clock {
  position: absolute; right: 13.5%; bottom: 52%; z-index: 3; font-family: var(--title); font-size: 32px;
  color: #e33; text-shadow: 0 0 10px rgba(255, 40, 40, .6);
}
.night .clock { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: .35; } }
@keyframes flicker { 0%, 100% { opacity: 1; } 47% { opacity: .82; } 48% { opacity: 1; } 71% { opacity: .9; } }

.ledger { --fill: #2a1a12; }
.ledger .book {
  position: absolute; left: 14%; right: 14%; top: 22%; bottom: 14%; z-index: 2; padding: 6% 8%;
  background: repeating-linear-gradient(transparent 0 15px, rgba(90, 50, 25, .35) 15px 16px), #ecdcb5;
  border: 4px solid #5b3a1e; box-shadow: inset -14px 0 0 rgba(90, 50, 25, .2);
  transform: rotate(2deg);
}
.ledger .book i { display: block; height: 5px; margin: 0 0 11px; background: #3e2a1a; border-radius: 3px; width: 70%; }
.ledger .book i:nth-child(2) { width: 52%; }
.ledger .book i:nth-child(3) { width: 80%; }
.ledger .book i:nth-child(4) { width: 44%; }
.ledger .book i:nth-child(5) { width: 66%; }
.ledger .book i:nth-child(6) { width: 30%; }

.void .soul, .soul {
  position: absolute; left: 46%; top: -30%; z-index: 3;
  width: calc(48px * 3); height: calc(48px * 3);
  background: url(img/intro_soul.png) 0 0 / calc(384px * 3) 100%;
  image-rendering: pixelated;
  animation: soul .8s steps(8) infinite, fall 3.6s cubic-bezier(.5, 0, .7, 1) infinite;
}
.soul.up { animation: soul .8s steps(8) infinite, fall 3.6s cubic-bezier(.3, 0, .5, 1) infinite reverse; scale: 1 -1; }
@keyframes soul { to { background-position: calc(-384px * 3) 0; } }
@keyframes fall { from { top: -30%; left: 58%; } to { top: 110%; left: 30%; } }

.motes { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.mote {
  position: absolute; width: 21px; height: 21px;
  background: url(img/intro_mote.png) 0 0 / 126px 21px; image-rendering: pixelated;
  animation: mote-f 1s steps(6) infinite, mote-up var(--d, 6s) linear infinite;
  animation-delay: 0s, var(--delay, 0s);
}
@keyframes mote-f { to { background-position: -126px 0; } }
@keyframes mote-up { from { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } to { transform: translateY(-260px); opacity: 0; } }

.whiteout { --fill: #fff; }
.gasp {
  position: absolute; left: 50%; top: 42%; z-index: 2; transform: translate(-50%, -50%) rotate(-6deg);
  font-family: var(--title); font-size: 128px; color: var(--ink);
}
.whiteout .frame::before {
  background: repeating-conic-gradient(from 0deg at 50% 42%, rgba(17, 16, 20, .9) 0deg .8deg, transparent .8deg 9deg), #fff;
  -webkit-mask: radial-gradient(circle at 50% 42%, transparent 30%, #000 70%);
  mask: radial-gradient(circle at 50% 42%, transparent 30%, #000 70%);
}
.whiteout .frame { background: var(--ink); }

.roots { --fill: radial-gradient(circle at 50% 70%, #fffdf3, #efe6cc); }
.elements {
  position: absolute; left: 0; right: 0; bottom: 12%; z-index: 2; margin: 0; padding: 0 4%;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; list-style: none;
}
.elements li {
  display: grid; place-items: center; min-width: 3.4em; height: 3.4em; padding: 0 .3em; border-radius: 50%;
  font-family: var(--title); font-size: 16px; color: #fff;
  border: 2.5px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); text-shadow: 1px 1px 0 var(--ink);
  opacity: 0; transform: scale(.4); transition: .35s cubic-bezier(.3, 1.7, .5, 1);
}
.elements .kim { background: #c9b979; }
.elements .moc { background: #3f9a4a; }
.elements .thuy { background: #2f7fe0; }
.elements .hoa { background: #e2482c; }
.elements .tho { background: #a2702f; }
.elements .hon {
  min-width: 6.4em; border-radius: 2em; line-height: 1.25; text-align: center;
  background: conic-gradient(#c9b979, #3f9a4a, #2f7fe0, #e2482c, #a2702f, #c9b979);
  animation: glow 1.8s ease-in-out infinite;
}
.elements .hon small { display: block; font-size: 16px; color: var(--gold); }
@keyframes glow { 50% { box-shadow: 2px 2px 0 var(--ink), 0 0 18px 4px rgba(255, 211, 77, .8); } }
.on .elements li { opacity: 1; transform: none; }
.elements li:nth-child(1) { transition-delay: .5s; }
.elements li:nth-child(2) { transition-delay: .6s; }
.elements li:nth-child(3) { transition-delay: .7s; }
.elements li:nth-child(4) { transition-delay: .8s; }
.elements li:nth-child(5) { transition-delay: .9s; }
.elements li:nth-child(6) { transition-delay: 1.25s; }

.thunder { --fill: radial-gradient(ellipse at 70% 0, #49406e, #14111f 70%); }
.thunder .frame::before { animation: storm 2.6s steps(1) infinite; }
@keyframes storm { 0%, 100% { filter: none; } 62% { filter: brightness(2.6); } 66% { filter: none; } 70% { filter: brightness(1.8); } }

.title-card { --fill: radial-gradient(ellipse at 50% 60%, #5a0d16, #0b0a0e 70%); }
.title-card .narr.center, .final .narr.center { color: #fff; text-shadow: 3px 3px 0 #000; }

.hourglass { --fill: linear-gradient(#1a0c10, #0c0608); }
.hourglass .sand {
  position: absolute; right: 16%; top: 8%; width: 5px; height: 66%; z-index: 2;
  background: repeating-linear-gradient(#e2b866 0 7px, transparent 7px 13px);
  animation: sand .6s linear infinite;
}
.hourglass .sand::after {
  content: ""; position: absolute; left: 50%; top: 100%; width: 120px; height: 34px; transform: translateX(-50%);
  background: #e2b866; clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
@keyframes sand { to { background-position: 0 13px; } }

.seal { --fill: radial-gradient(circle at 50% 45%, #5d0b14, #160407 72%); }
.blood-stamp { color: #ff4a52; border-color: #ff4a52; mix-blend-mode: screen; background: rgba(255, 50, 60, .08); text-shadow: 0 0 14px rgba(255, 40, 50, .6); top: 40%; }
.final { --fill: #000; }

/* Call to action */

.cta { position: relative; display: grid; place-items: center; min-height: 92vh; padding: 8vh 4vw; overflow: hidden; }
.cta-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 80%; filter: brightness(.55); }
.cta-card {
  position: relative; width: min(680px, 94vw); padding: clamp(18px, 4vw, 40px); text-align: center;
  background: radial-gradient(circle, rgba(0, 0, 0, .07) 1px, transparent 1.3px) 0 0 / 6px 6px, var(--paper);
  border: 4px solid var(--ink); box-shadow: 10px 10px 0 var(--ink);
}
.cta-card .logo { width: min(100%, 570px); margin: 0 auto 14px; filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, .35)); }
.cta-card p { margin: 0 0 22px; font-size: 24px; }
.btn {
  display: inline-block; padding: 14px 26px 11px;
  font-family: var(--title); font-size: 32px;
  color: #fff; background: var(--red); text-decoration: none;
  border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
  transition: transform .12s, box-shadow .12s;
}
.btn:hover, .btn:focus-visible { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: 2px 2px 0 var(--ink); }
.facts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin: 26px 0 0; padding: 0; list-style: none;
  text-align: left; font-size: 24px;
}
.facts li { padding-left: 18px; position: relative; }
.facts li::before { content: ""; position: absolute; left: 0; top: .45em; width: 8px; height: 8px; background: var(--red); transform: rotate(45deg); }

footer {
  display: flex; justify-content: center; gap: 18px; padding: 26px 4vw 80px;
  color: #a9a3b4; font-size: 16px;
}
footer p { margin: 0; }
footer a { color: var(--jade); }

/* The logo look (tools/ui/title_art.py logo): title font, a bronze ramp from light to dark down each line,
   a dark bronze ring of one logo pixel and a drop shadow under it. The ramp repeats per line of 19 font pixels
   (ascent 16, descent 3), so it lands on the same rows of every letter. */
.tagline span, .chapter span, .narr.center, .plate span, .sfx {
  --o: max(1px, round(calc(1em / 32), 1px));
  line-height: calc(19em / 16);
  filter:
    drop-shadow(var(--o) 0 0 var(--ring, #3a2a17)) drop-shadow(calc(var(--o) * -1) 0 0 var(--ring, #3a2a17))
    drop-shadow(0 var(--o) 0 var(--ring, #3a2a17)) drop-shadow(0 calc(var(--o) * -1) 0 var(--ring, #3a2a17))
    drop-shadow(var(--o) calc(var(--o) * 2) 0 var(--drop, rgba(15, 19, 32, .75)));
}
.tagline span, .chapter span, .narr.center, .plate span, .sfx.gold {
  color: transparent; -webkit-text-fill-color: transparent;
  background: linear-gradient(var(--hi, #f0d894) 0 calc(8em / 16), var(--mid, #d4ae62) 0 calc(15em / 16), var(--lo, #a07a3c) 0)
    0 0 / 100% calc(19em / 16) repeat-y content-box;
  -webkit-background-clip: text; background-clip: text;
}
.tagline span + span { --hi: #e6fff6; --mid: #9fe8d0; --lo: #5aa08c; --ring: #12302a; }

/* Phones */

@media (max-width: 720px) {
  .grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 27vw; }
  .c3, .c4, .c6 { grid-column: span 2; }
  .c2 { grid-column: span 2; }
  .rogue.c2 { grid-column: span 1; }
  .r4 { grid-row: span 3; }
  .rogue.r3 { grid-row: span 2; }
  .c6.r2, .c4.r2 { grid-row: span 2; }
  .narr { max-width: 70%; }
  .narr.small { max-width: 76%; }
  .bubble { max-width: 72%; }
  .c2 .bubble, .c2 .narr { max-width: 88%; }
  .chapter-now { display: none; }
  .night .sfx { --x: 6% !important; --y: 64% !important; }
  .facts { grid-template-columns: 1fr; }
  .soul, .void .soul { width: 96px; height: 96px; background-size: 768px 100%; }
  @keyframes soul { to { background-position: -768px 0; } }
  footer { flex-direction: column; align-items: center; text-align: center; }
  .tagline, .chapter { font-size: 32px; }
  .chapter b { font-size: 16px; }
  .sub, .narr.big, .bubble.shout, .btn, .scroll-cue { font-size: 24px; }
  .narr, .bubble, .plate, .cta-card p, .facts { font-size: 16px; }
  .sfx, .stamp { font-size: 40px; }
  .sfx.huge, .gasp { font-size: 64px; }
  .sfx.dull, .night .clock { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .panel, .narr, .bubble, .plate, .elements li { opacity: 1 !important; transform: none !important; }
  .narr.center { transform: translate(-50%, -50%) !important; }
  .sfx { opacity: 1 !important; transform: rotate(var(--rot, 0deg)) !important; }
  .stamp { opacity: 1 !important; transform: translate(-50%, -50%) rotate(-12deg) !important; }
  .frame::after { transform: scaleX(0) !important; }
  .js .frame > img { filter: none !important; }
  .soul { top: 30%; }
}

/* Language switch and no-flash guard */
html.i18n-wait body { visibility: hidden; }
.lang { display: none; }
.js .lang {
  position: fixed; top: 14px; right: 14px; z-index: 60;
  display: flex; font-family: var(--title); font-size: 16px; line-height: 1;
  background: var(--paper); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
}
.lang button {
  font: inherit; cursor: pointer; padding: 6px 10px 7px;
  color: var(--ink); background: transparent; border: 0;
}
.lang button + button { border-left: 2px solid var(--ink); }
.lang button[aria-pressed="true"] { color: #fff; background: var(--red); }
.lang button:not([aria-pressed="true"]):hover { background: var(--gold); }
.lang button:focus-visible { outline: 3px solid var(--blue); outline-offset: -3px; }
@media (max-width: 720px) {
  .js .lang { top: 10px; right: 10px; box-shadow: 3px 3px 0 var(--ink); }
}
.chapter b { white-space: nowrap; }
@media (max-width: 720px) {
  .sfx.clang { --x: auto !important; --r: 4% !important; --y: 40% !important; --b: auto !important; }
}
