:root {
  color-scheme: dark;
  --ink: #071223;
  --paper: #ede4d2;
  --brass: #d5a75e;
  --muted: rgba(237, 228, 210, .64);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #030914;
  overscroll-behavior: none;
}

body {
  display: grid;
  place-items: center;
  font-family: "Kaiti SC", "STKaiti", "Songti SC", serif;
  color: var(--paper);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button { font: inherit; }
button:focus-visible { outline: 2px solid #f2c369; outline-offset: 3px; }
[hidden] { display: none !important; }

.game-shell {
  position: relative;
  width: min(100vw, calc(100dvh * 390 / 724));
  height: min(100dvh, calc(100vw * 724 / 390));
  overflow: hidden;
  background: var(--ink);
  isolation: isolate;
}

html[data-storage="fallback"] .game-shell::after {
  position: absolute;
  z-index: 90;
  right: 10px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  content: "本地存档";
  color: rgba(237, 228, 210, .56);
  font: 10px/1.4 Baskerville, "Iowan Old Style", serif;
  letter-spacing: .08em;
  pointer-events: none;
}

.loading-screen,
.title-screen,
.chapter-screen,
.game-screen,
.final-screen {
  position: absolute;
  inset: 0;
}

.loading-screen {
  z-index: 20;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  background: #06101e;
  color: var(--muted);
  letter-spacing: .18em;
  font-size: 12px;
}

.loading-screen img {
  width: 74px;
  animation: breathe 1.7s ease-in-out infinite;
}

.title-screen { background: #06101e; }

.title-backdrop,
.title-awakened,
.final-screen > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.title-backdrop { opacity: .78; filter: brightness(.64) saturate(.9); }
.title-awakened { opacity: .1; mix-blend-mode: screen; }
.title-screen::after {
  position: absolute;
  inset: 0;
  content: "";
  background: rgba(2, 8, 18, .24);
  pointer-events: none;
}

.title-copy {
  position: absolute;
  z-index: 2;
  top: 14%;
  left: 0;
  width: 100%;
  text-align: center;
  text-shadow: 0 4px 22px #000;
}

.title-copy p,
.title-copy span,
.chapter-screen header p,
.topbar p,
.result-panel p,
.final-screen > p {
  margin: 0;
  color: var(--brass);
  font: 11px/1.4 Baskerville, "Iowan Old Style", serif;
  letter-spacing: .35em;
}

.title-copy h1 {
  margin: 8px 0 2px;
  font-size: 47px;
  font-weight: 400;
  letter-spacing: .17em;
}

.title-copy span {
  display: block;
  max-width: 270px;
  margin-inline: auto;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .1em;
}
.title-progress {
  display: block;
  margin-top: 12px;
  color: var(--paper);
  font: 12px/1.4 Baskerville, "Iowan Old Style", serif;
  font-weight: 400;
  letter-spacing: .08em;
}

.title-actions {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: calc(7% + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transform: translateX(-50%);
}

.start-button {
  position: relative;
  display: grid;
  width: 126px;
  min-height: 126px;
  padding: 0;
  place-items: center;
  color: var(--paper);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.start-button > span:last-child {
  position: absolute;
  font-size: 15px;
  letter-spacing: .16em;
  text-shadow: 0 2px 8px #000;
}

.start-orbits,
.start-orbits img { position: absolute; inset: 0; width: 100%; height: 100%; }
.start-orbits img { object-fit: contain; }
.start-orbits img:nth-child(1) { animation: orbit 9s linear infinite; }
.start-orbits img:nth-child(2) { transform: scale(.76) rotate(25deg); animation: orbit-reverse 6s linear infinite; }
.start-orbits img:nth-child(3) { inset: 30%; width: 40%; height: 40%; animation: breathe 2.1s ease-in-out infinite; }

.quiet-button,
.result-panel button,
.final-screen button {
  min-width: 96px;
  min-height: 48px;
  padding: 0 18px;
  color: var(--paper);
  background: rgba(4, 13, 26, .62);
  border: 1px solid rgba(213, 167, 94, .34);
  letter-spacing: .14em;
}

.title-actions > .quiet-button {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}
.title-actions > .progress-reset-button { margin-top: -12px; color: rgba(237, 228, 210, .48); font-size: 11px; }

.title-sweep {
  position: absolute;
  z-index: 3;
  top: 51%;
  left: -45%;
  width: 190%;
  height: 22px;
  opacity: 0;
  object-fit: fill;
  mix-blend-mode: screen;
  pointer-events: none;
}

.title-screen.is-launching .title-sweep { animation: launch-sweep 1.35s cubic-bezier(.2,.72,.22,1) both; }
.title-screen.is-launching .title-awakened { animation: world-wake 1.35s ease-out both; }
.title-screen.is-launching .title-copy { animation: title-rise 1.35s ease-in both; }
.title-screen.is-launching .start-button { animation: dial-launch 1.35s cubic-bezier(.3,.74,.18,1) both; }

.chapter-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) 68px;
  padding: calc(18px + env(safe-area-inset-top)) 14px calc(20px + env(safe-area-inset-bottom));
  overflow: hidden;
  background: #071223 url("./assets/lightkeeper-v3/world-phase-starwell.png") center/cover no-repeat;
}

.chapter-screen::before {
  position: fixed;
  inset: 0;
  content: "";
  background: rgba(2, 8, 18, .18);
  pointer-events: none;
}

.chapter-screen > * { position: relative; z-index: 1; }
.chapter-header {
  display: flex;
  margin: 2px 6px 10px;
  align-items: center;
  justify-content: space-between;
  text-shadow: 0 3px 14px #000;
}
.chapter-header .quiet-button { min-width: 64px; padding-inline: 8px; background: transparent; border-color: transparent; }
.chapter-header-actions { display: flex; align-items: center; }
.chapter-header-actions .progress-reset-button { min-width: 78px; color: rgba(237, 228, 210, .56); font-size: 11px; }
.chapter-screen h2 { margin: 4px 0; font-size: 27px; font-weight: 400; letter-spacing: .13em; }
.chapter-scroll { min-height: 0; overflow-y: auto; scrollbar-width: none; }
.chapter-scroll::-webkit-scrollbar { display: none; }
.world-list { display: grid; gap: 7px; }

.world-map-scene {
  position: relative;
  height: 226px;
  overflow: hidden;
  text-shadow: 0 2px 9px #000, 0 0 16px #000;
}

.world-scene-background,
.world-scene-awakened {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.world-scene-background { filter: brightness(.54) saturate(.84); }
.world-scene-awakened { opacity: var(--world-wake, 0); mix-blend-mode: screen; }
.world-map-scene.is-awake .world-scene-background { filter: brightness(.69) saturate(1); }
.world-map-scene.is-awake .world-scene-awakened { opacity: .62; }
.world-map-scene.is-mastered .world-scene-awakened {
  opacity: .86;
  filter: saturate(1.14) brightness(1.08) drop-shadow(0 0 12px rgba(255, 211, 125, .24));
}
.world-map-scene.is-mastered .world-map-heading span { text-shadow: 0 0 10px rgba(255, 208, 115, .58); }

.world-map-heading {
  position: absolute;
  z-index: 3;
  top: 9px;
  left: 12px;
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  column-gap: 9px;
}

.world-map-heading h3 { margin: 0; font-size: 17px; font-weight: 400; letter-spacing: .13em; }
.world-map-heading small {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 3px;
  color: rgba(237, 228, 210, .72);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .09em;
}
.world-map-heading span { color: var(--brass); font: 12px/1 Baskerville, "Iowan Old Style", serif; letter-spacing: .08em; }
.world-levels { position: absolute; z-index: 2; inset: 0 0 40px; }
.level-stop { position: absolute; left: var(--node-x); top: var(--node-y); transform: translate(-50%, -50%); }

.level-node {
  position: relative;
  width: 76px;
  min-width: 76px;
  height: 88px;
  min-height: 88px;
  padding: 0;
  color: var(--paper);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.level-node-art,
.level-lock-art,
.level-complete-glow,
.level-current-ring {
  position: absolute;
  top: 1px;
  left: 50%;
  width: 58px;
  height: 58px;
  object-fit: contain;
  transform: translateX(-50%);
  pointer-events: none;
}

.level-complete-glow { top: -8px; width: 76px; height: 76px; opacity: 0; mix-blend-mode: screen; }
.level-current-ring { top: -6px; width: 72px; height: 72px; opacity: 0; mix-blend-mode: screen; }
.level-lock-art { top: 8px; width: 44px; height: 44px; opacity: 0; }
.level-node.is-complete .level-complete-glow { opacity: .82; }
.level-node.is-current:not(.is-selected) .level-current-ring { opacity: .2; animation: none; }
.level-node.is-selected .level-current-ring { opacity: 1; animation: map-ring-orbit 8s linear infinite; }
.level-node.is-locked .level-node-art { opacity: .18; }
.level-node.is-locked .level-lock-art { opacity: .88; }
.level-node b,
.level-node span { position: absolute; left: 50%; width: 108px; transform: translateX(-50%); }
.level-node b { bottom: 18px; color: var(--brass); font: 13px/1 Baskerville, serif; }
.level-node span { bottom: 1px; overflow: hidden; font-size: 11px; letter-spacing: .04em; text-overflow: ellipsis; white-space: nowrap; }
.level-node.is-locked { opacity: .3; filter: grayscale(.8); cursor: default; }
.level-node.is-locked.is-selected { opacity: .74; filter: grayscale(.35); }
.level-node:focus-visible { outline-offset: 1px; }

.level-best-marks {
  position: absolute;
  top: 2px;
  right: -5px;
  display: flex;
  gap: 0;
  pointer-events: none;
}

.level-best-marks img {
  width: 13px;
  height: 13px;
  object-fit: contain;
  opacity: .16;
  filter: grayscale(1) brightness(.7);
}

.level-best-marks img + img { margin-left: -3px; }
.level-best-marks img.is-earned {
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(255, 213, 119, .8));
}

.level-tutorial-mark {
  position: absolute;
  top: 2px;
  left: 5px;
  width: 18px;
  height: 18px;
  object-fit: contain;
  opacity: .82;
  filter: drop-shadow(0 0 5px rgba(255, 205, 108, .64));
  pointer-events: none;
}

.world-reliquary {
  position: absolute;
  z-index: 4;
  right: 10px;
  bottom: 4px;
  left: 10px;
  display: flex;
  height: 48px;
  align-items: center;
  justify-content: center;
  gap: 2px;
  filter: drop-shadow(0 3px 9px rgba(0, 0, 0, .82));
}

.world-reliquary-label {
  position: absolute;
  left: 4px;
  color: rgba(237, 228, 210, .74);
  font-size: 12px;
  letter-spacing: .08em;
  text-shadow: 0 2px 8px #000, 0 0 12px #000;
}

.world-relic {
  position: relative;
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  background: transparent;
  border: 0;
}

.world-relic img { position: absolute; inset: 7px; width: 34px; height: 34px; object-fit: contain; }
.world-relic-aureole { inset: 1px !important; width: 46px !important; height: 46px !important; opacity: 0; mix-blend-mode: screen; }
.world-relic-lock { inset: 13px !important; width: 22px !important; height: 22px !important; opacity: .52; }
.world-relic-art { opacity: .12; filter: grayscale(1) brightness(.6); }
.world-relic.is-collected .world-relic-art { opacity: 1; filter: drop-shadow(0 0 6px rgba(255, 204, 107, .38)); }
.world-relic.is-collected .world-relic-aureole { opacity: .54; }
.world-relic.is-collected .world-relic-lock { opacity: 0; }
.world-relic:disabled { opacity: 1; }
.world-relic:focus-visible { outline-offset: -3px; }
.world-seal { position: absolute; right: 2px; width: 54px; height: 54px; opacity: 0; }
.world-seal img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.world-seal img:last-child { inset: 31%; width: 38%; height: 38%; }
.world-reliquary.is-awakened .world-seal { opacity: 1; filter: drop-shadow(0 0 8px rgba(255, 211, 117, .72)); animation: breathe 3.4s ease-in-out infinite; }
.world-reliquary.is-awakened .world-reliquary-label { color: var(--brass); }

.chapter-detail {
  display: grid;
  min-height: 64px;
  padding: 7px 4px 0;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto 48px;
  gap: 4px;
  text-shadow: 0 2px 9px #000;
}
.chapter-detail > div { display: grid; min-width: 0; gap: 3px; }
.chapter-detail strong { overflow: hidden; font-size: 13px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.chapter-detail span { overflow: hidden; color: var(--brass); font-size: 11px; letter-spacing: .03em; text-overflow: ellipsis; white-space: nowrap; }
.chapter-detail .image-button { justify-self: end; }
.chapter-play-button {
  min-width: 58px;
  min-height: 48px;
  padding: 0 8px;
  color: var(--paper);
  background: transparent;
  border: 1px solid rgba(213, 167, 94, .34);
  letter-spacing: .08em;
}
.chapter-play-button:disabled { color: var(--muted); border-color: transparent; }


.game-screen canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.topbar {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  display: flex;
  width: 100%;
  min-height: 76px;
  padding: calc(12px + env(safe-area-inset-top)) 12px 8px 18px;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  text-shadow: 0 2px 10px #000;
}

.topbar > div:first-child { max-width: 118px; }
.topbar h1 { margin: 2px 0 0; overflow: hidden; font-size: 20px; font-weight: 400; letter-spacing: .09em; text-overflow: ellipsis; white-space: nowrap; }
.game-actions { display: flex; gap: 2px; pointer-events: auto; }
.image-button { width: 48px; height: 48px; padding: 7px; background: transparent; border: 0; }
.image-button img { width: 100%; height: 100%; object-fit: contain; }
.image-button.is-active img { filter: brightness(1.3) drop-shadow(0 0 9px #ffd17d); }

.objective-hud {
  position: absolute;
  z-index: 6;
  top: calc(76px + env(safe-area-inset-top));
  right: 12px;
  left: 12px;
  max-height: 114px;
  overflow: hidden;
  text-shadow: 0 2px 8px #000, 0 0 12px #000;
  transition: max-height .28s ease, opacity .28s ease;
}

.objective-hud > button {
  display: grid;
  width: 100%;
  min-height: 48px;
  padding: 0;
  align-items: center;
  grid-template-columns: 28px minmax(0, 1fr) 34px;
  color: var(--paper);
  background: transparent;
  border: 0;
  text-align: left;
}
.objective-hud > button img { width: 23px; height: 23px; object-fit: contain; }
.objective-hud > button strong { overflow: hidden; font-size: 14px; font-weight: 400; letter-spacing: .03em; text-overflow: ellipsis; white-space: nowrap; }
.objective-hud > button span { color: var(--brass); font: 12px/1 Baskerville, serif; text-align: right; }
.objective-hud ul { display: grid; margin: 0 0 0 28px; padding: 0; gap: 2px; list-style: none; }
.objective-hud li { display: grid; align-items: center; grid-template-columns: 16px 1fr; color: rgba(237, 228, 210, .56); font-size: 11px; letter-spacing: .03em; }
.objective-hud li img { width: 13px; height: 13px; object-fit: contain; opacity: .25; }
.objective-hud li.is-complete { color: #fff1c9; }
.objective-hud li.is-complete img { opacity: 1; filter: drop-shadow(0 0 5px #ffc35c); }
.objective-hud:not(.is-expanded) { max-height: 48px; }
.objective-hud:not(.is-expanded) #objectiveBody { visibility: hidden; }
.game-screen.is-tutorial-active .objective-hud {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
.context-help {
  position: absolute;
  z-index: 7;
  right: 16px;
  bottom: calc(58px + env(safe-area-inset-bottom));
  left: 16px;
  min-height: 18px;
  margin: 0;
  color: #fff0c4;
  font-size: 12px;
  letter-spacing: .07em;
  text-align: center;
  text-shadow: 0 2px 10px #000, 0 0 14px #000;
  pointer-events: none;
}
.context-help.is-spectrum-fold-above {
  bottom: calc(212px + env(safe-area-inset-bottom));
}
.context-help.is-event {
  color: #fff4cf;
  font-size: 13px;
  filter: drop-shadow(0 0 9px rgba(255, 191, 82, .7));
  animation: event-rise 1.7s ease-out both;
}
.game-screen.is-resolving canvas,
.game-screen.is-resolving .objective-hud { pointer-events: none; }
.game-screen.is-resolving .objective-hud,
.game-screen.is-resolving .context-help,
.game-screen.is-resolving .tutorial-layer { opacity: 0; }
.game-screen.is-resolving .topbar > div:first-child,
.game-screen.is-resolving #hintButton,
.game-screen.is-resolving #soundButton { display: none; }


.tutorial-layer { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.tutorial-meta {
  position: absolute;
  z-index: 3;
  top: calc(96px + env(safe-area-inset-top));
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 6px;
  transform: translateX(-50%);
  color: #ffe6aa;
  text-shadow: 0 2px 10px #000, 0 0 12px #000;
}
.tutorial-meta strong { font-size: 12px; font-weight: 400; letter-spacing: .13em; white-space: nowrap; }
.tutorial-progress { display: flex; min-height: 14px; gap: 5px; }
.tutorial-progress img { position: static; display: block; width: 12px; height: 12px; opacity: .2; object-fit: contain; }
.tutorial-progress img.is-current { opacity: 1; filter: drop-shadow(0 0 5px rgba(255, 205, 101, .9)); }
.tutorial-progress img.is-past { opacity: .56; }
.tutorial-layer img { position: absolute; display: none; object-fit: contain; mix-blend-mode: normal; }
.tutorial-layer .tutorial-progress img { position: static; display: block; }
.tutorial-layer.is-visible img { display: block; }
#tutorialGhost { width: 104px; height: 36px; opacity: .52; mix-blend-mode: screen; }
#tutorialTrail { width: 115px; height: 34px; opacity: .7; mix-blend-mode: screen; animation: drift 1.4s ease-in-out infinite alternate; }
#tutorialBeam { width: 112px; height: 20px; opacity: .62; mix-blend-mode: screen; animation: breathe 1.2s ease-in-out infinite; }
#tutorialRing { width: 84px; height: 84px; mix-blend-mode: screen; animation: breathe 1.4s ease-in-out infinite; }
.tutorial-preview { position: absolute; inset: 0; overflow: hidden; }
.tutorial-preview-item { opacity: var(--preview-opacity, 1); transform-origin: center; animation: preview-raster-in .16s ease-out both; }
#tutorialSector {
  --sector-center: 0rad;
  --sector-half-spread: 0rad;
  width: 52px;
  height: 52px;
  opacity: .7;
  mix-blend-mode: screen;
  transform: rotate(var(--sector-center));
}
#tutorialSector.is-sweeping { animation: sector-sweep 1.35s ease-in-out infinite alternate; }
.result-panel {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 36px 20px calc(28px + env(safe-area-inset-bottom));
  background: rgba(2, 8, 17, .7);
  text-shadow: 0 3px 14px #000;
  animation: reveal .35s ease-out;
}

.result-world-backdrop {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .32;
  object-fit: cover;
  mix-blend-mode: screen;
  animation: world-wake 1.1s ease-out both;
}
.result-panel > :not(.result-world-backdrop) { position: relative; z-index: 1; }

.result-panel h2 { margin: 7px 0 5px; font-size: 30px; font-weight: 400; letter-spacing: .14em; }
.result-outcome {
  margin: 3px 0 5px;
  color: #fff1c9;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: .12em;
  text-shadow: 0 0 16px rgba(255, 191, 82, .58);
}
.reward-art { position: relative; width: 96px; height: 96px; margin-top: 2px; animation: reward-rise .55s ease-out both; }
.reward-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.reward-art img:first-child { opacity: .86; mix-blend-mode: screen; animation: orbit 10s linear infinite; }
.reward-art img:last-child { inset: 22%; width: 56%; height: 56%; }
.result-panel.is-replay-clear .reward-art { width: 68px; height: 68px; opacity: .68; }
.result-panel.is-replay-clear .reward-art img:first-child { opacity: .42; animation: none; }
#resultCollection { margin-top: -3px; font-size: 15px; font-weight: 400; letter-spacing: .08em; }
.result-relics { display: flex; height: 38px; margin: 5px 0 0; gap: 4px; }
.result-relic { position: relative; width: 38px; height: 38px; opacity: .2; filter: grayscale(1); }
.result-relic img { position: absolute; inset: 6px; width: 26px; height: 26px; object-fit: contain; }
.result-relic img:first-child { inset: 0; width: 38px; height: 38px; opacity: 0; mix-blend-mode: screen; }
.result-relic.is-collected { opacity: .78; filter: none; }
.result-relic.is-collected img:first-child { opacity: .4; }
.result-relic.is-current { opacity: 1; transform: scale(1.12); }
.result-relic.is-current img:first-child { opacity: .95; animation: orbit 8s linear infinite; }
.result-panel.is-world-awakened .result-relic.is-collected { filter: drop-shadow(0 0 5px rgba(255, 215, 132, .6)); }
.result-world-seal { position: relative; width: 68px; height: 68px; margin: -4px 0 -5px; animation: reward-rise .55s ease-out both; }
.result-world-seal img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.result-world-seal img:last-child { inset: 31%; width: 38%; height: 38%; }
.result-marks { display: flex; height: 52px; margin: 5px 0 0; gap: 3px; }
.result-mark-slot { display: grid; width: 74px; justify-items: center; color: rgba(237, 228, 210, .38); }
.result-mark-slot img { width: 34px; height: 34px; object-fit: contain; opacity: .14; transform: scale(.72); filter: grayscale(1) brightness(.62); }
.result-mark-slot small { margin-top: -2px; font-size: 11px; letter-spacing: .04em; white-space: nowrap; }
.result-mark-slot.is-best:not(.is-current) img { opacity: .52; filter: drop-shadow(0 0 1px #f5c56f) drop-shadow(0 0 5px rgba(245, 197, 111, .4)); }
.result-mark-slot.is-best:not(.is-current) { color: rgba(245, 214, 154, .62); }
.result-mark-slot.is-current img { opacity: 1; filter: drop-shadow(0 0 7px rgba(255, 207, 105, .92)); animation: mark-awaken .32s ease-out both; }
.result-mark-slot.is-current { color: #f5d69a; }
.result-mark-slot:nth-child(2) img { animation-delay: .12s; }
.result-mark-slot:nth-child(3) img { animation-delay: .24s; }
.result-best { margin: 2px 0 0 !important; color: rgba(237, 228, 210, .72) !important; font-size: 11px !important; letter-spacing: .06em !important; }
.result-mastery { margin: 2px 0 3px; color: var(--brass); font-size: 12px; letter-spacing: .08em; }
#resultWorldProgress,
#resultNext { margin-top: 5px; color: var(--paper); font-family: inherit; font-size: 12px; letter-spacing: .06em; }
#resultNext { color: var(--brass); animation: delayed-reveal .9s both; }
.result-actions { display: flex; margin-top: 14px; gap: 8px; animation: delayed-reveal 1.05s both; }
.landscape-note { display: none; }

.final-screen {
  display: grid;
  place-content: center;
  justify-items: center;
  background: #050d19;
  text-shadow: 0 3px 14px #000;
}

.final-screen > img { opacity: .75; }
.final-screen > p,
.final-screen > h2,
.final-screen > div { position: relative; z-index: 1; }
.final-screen > h2 { margin: 10px 0 26px; font-size: 39px; font-weight: 400; letter-spacing: .16em; }
.final-screen > strong { position: relative; z-index: 1; margin: -15px 0 24px; color: var(--brass); font: 12px/1.4 Baskerville, serif; font-weight: 400; letter-spacing: .08em; }
.final-screen > div { display: flex; gap: 10px; }

.reset-progress-dialog {
  position: absolute;
  z-index: 200;
  inset: 0;
  display: grid;
  padding: calc(40px + env(safe-area-inset-top)) 28px calc(40px + env(safe-area-inset-bottom));
  place-content: center;
  justify-items: center;
  color: var(--paper);
  background: rgba(3, 9, 20, .94);
  text-align: center;
  text-shadow: 0 3px 14px #000;
}
.reset-progress-dialog > img { width: 104px; height: 104px; object-fit: contain; opacity: .72; mix-blend-mode: screen; }
.reset-progress-dialog h2 { margin: -4px 0 10px; font-size: 25px; font-weight: 400; letter-spacing: .1em; }
.reset-progress-dialog p { max-width: 286px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; letter-spacing: .04em; }
.reset-progress-dialog > div { display: flex; margin-top: 24px; gap: 12px; }
.reset-progress-dialog button { min-width: 112px; min-height: 52px; color: var(--paper); background: transparent; border: 1px solid rgba(213, 167, 94, .36); }
.reset-progress-dialog .quiet-button { color: var(--muted); border-color: transparent; }

@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes orbit-reverse { from { transform: scale(.76) rotate(385deg); } to { transform: scale(.76) rotate(25deg); } }
@keyframes map-ring-orbit { from { transform: translateX(-50%) rotate(0); } to { transform: translateX(-50%) rotate(360deg); } }
@keyframes sector-sweep {
  from { transform: rotate(calc(var(--sector-center) - var(--sector-half-spread))); }
  to { transform: rotate(calc(var(--sector-center) + var(--sector-half-spread))); }
}
@keyframes breathe { 50% { opacity: .62; transform: scale(1.07); } }
@keyframes drift { to { transform: translate(22px, -5px); } }
@keyframes reveal { from { opacity: 0; } }
@keyframes reward-rise { from { opacity: 0; transform: translateY(18px) scale(.82); } }
@keyframes mark-awaken { from { opacity: .12; transform: scale(.62); } to { opacity: 1; transform: scale(1); } }
@keyframes delayed-reveal { 0%, 62% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes event-rise { 0% { opacity: 0; transform: translateY(7px); } 14%, 74% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; } }
@keyframes preview-raster-in { from { opacity: 0; } to { opacity: var(--preview-opacity, 1); } }
@keyframes launch-sweep { 0%, 18% { opacity: 0; transform: translateY(110px) scaleY(.3); } 45% { opacity: .92; } 82%, 100% { opacity: 0; transform: translateY(-180px) scaleY(2.4); } }
@keyframes world-wake { 0%, 20% { opacity: .08; } 76%, 100% { opacity: .92; } }
@keyframes title-rise { 65%, 100% { opacity: 0; transform: translateY(-22px); } }
@keyframes dial-launch { 52% { transform: scale(1.2); filter: brightness(1.6); } 100% { transform: scale(2.4); opacity: 0; } }

@media (orientation: landscape) and (max-height: 520px) {
  .title-actions {
    bottom: calc(12px + env(safe-area-inset-bottom));
    gap: 12px;
  }

  .title-copy { top: 4%; }
  .title-copy h1 { margin-block: 3px 0; font-size: 36px; }
  .title-copy span { display: none; }

  .topbar {
    padding: calc(6px + env(safe-area-inset-top)) calc(5px + env(safe-area-inset-right)) 4px 5px;
    align-items: flex-start;
  }

  .topbar > div:first-child { display: none; }

  .game-actions {
    display: grid;
    grid-template-columns: repeat(2, 48px);
    margin-left: auto;
    gap: 0;
  }

  .chapter-screen { padding-inline: 10px; }

  .landscape-note {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    width: 100vw;
    height: 100dvh;
    margin: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    place-items: center;
    color: var(--paper);
    background: #030914 url("./assets/lightkeeper-v3/world-phase-starwell.png") center/cover no-repeat;
    font-size: 18px;
    letter-spacing: .24em;
    text-shadow: 0 3px 16px #000;
    pointer-events: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .result-panel { animation: reveal .3s ease-out both !important; }
  .title-screen.is-launching .title-awakened { animation-duration: .3s !important; }
  .level-node.is-current .level-current-ring { animation: none; }
  #tutorialSector.is-sweeping { animation: none; transform: rotate(var(--sector-center)); }
  .tutorial-preview-item { animation: preview-raster-in .12s linear both !important; }
  .context-help.is-event { opacity: 1; transform: none; animation: none !important; }
}
