/* The Overworld. Opt-in only: FitTracker and its foundations stay untouched. */
html[data-world][data-world="overworld"] {
  color-scheme: dark;
  --font-pixel: "Press Start 2P", "Courier New", monospace;
  --world-bg: #0c1922;
  --world-surface: #10222c;
  --world-raised: #182f39;
  --world-text: #f3ead5;
  --world-muted: #b9c8c9;
  --world-accent: #a6d9c0;
  --world-border: #506b70;
  --world-gold: #efd394;
  --world-ink: #122a2e;
  --world-focus: #ffe5a2;
  --world-shadow: #071219;
  --world-scene-current: var(--world-scene-night);
  --world-scene-mobile-current: var(--world-scene-mobile-night);
  --bg: var(--world-bg); --bg-deep: var(--world-bg);
  --bg-raised: var(--world-raised); --surface: var(--world-surface); --surface-2: var(--world-raised);
  --text: var(--world-text); --text-muted: var(--world-muted); --text-dim: var(--world-muted);
  --text-faint: var(--world-muted); --accent: var(--world-accent); --on-accent: var(--world-ink);
  --accent-soft: var(--world-raised); --rule: var(--world-border); --rule-bright: var(--world-border);
  --px-gold: var(--world-gold); --spot: var(--world-gold); --px-shadow: var(--world-shadow);
  --px-edge-light: var(--world-border); --shadow-md: 4px 4px 0 var(--world-shadow);
  --fs-base: 1.125rem; --lh-norm: 1.65;
  scroll-padding-top: 104px;
  background: var(--world-bg);
}
html[data-world="overworld"][data-theme="light"] {
  color-scheme: light;
  --world-bg: #e9e5d6; --world-surface: #f9f4e5; --world-raised: #e4e9db;
  --world-text: #173337; --world-muted: #466061; --world-accent: #225e50;
  --world-border: #859589; --world-gold: #79541d; --world-ink: #fcf7e8;
  --world-focus: #245d51; --world-shadow: #c5c4af;
  --world-scene-current: var(--world-scene-day);
  --world-scene-mobile-current: var(--world-scene-mobile-day);
}
@media (prefers-color-scheme: light) {
  html[data-world="overworld"]:not([data-theme]) {
    color-scheme: light;
    --world-bg: #e9e5d6; --world-surface: #f9f4e5; --world-raised: #e4e9db;
    --world-text: #173337; --world-muted: #466061; --world-accent: #225e50;
    --world-border: #859589; --world-gold: #79541d; --world-ink: #fcf7e8;
    --world-focus: #245d51; --world-shadow: #c5c4af;
    --world-scene-current: var(--world-scene-day);
    --world-scene-mobile-current: var(--world-scene-mobile-day);
  }
}
html[data-world="overworld"] body { background: var(--world-bg); color: var(--world-text); font-family: var(--font-sans); font-size: 18px; line-height: 1.65; }
html[data-world="overworld"] body::before,
html[data-world="overworld"] body::after { content: none !important; }
html[data-world="overworld"] :where(h1,h2,h3,h4) { color: var(--world-text); overflow-wrap: anywhere; }
html[data-world="overworld"] :where(p,li,td,th,figcaption) { overflow-wrap: break-word; }
html[data-world="overworld"] :where(img,svg,video,canvas) { max-width: 100%; }
html[data-world="overworld"] :where(input,button,textarea,select) { font: inherit; }
html[data-world="overworld"] :where(a,button,input,summary,select,textarea):focus-visible { outline: 3px solid var(--world-focus); outline-offset: 5px; }
html[data-world="overworld"] :where(section[id],h2[id],h3[id]) { scroll-margin-top: 110px; }
html[data-world="overworld"] [hidden] { display: none !important; }
html[data-world="overworld"] .skip-link { position: fixed; z-index: 9999; }
html[data-world="overworld"] .skip-link:focus { top: 12px; left: 12px; background: var(--world-surface); color: var(--world-text); padding: 12px 20px; }
/* Retired entrance/counter/boot effects cannot make content unavailable. */
html[data-world="overworld"] :is(.px-in,.fade-up,.typing,.typing__ink) { opacity: 1 !important; visibility: visible !important; transform: none !important; clip-path: none !important; }
html[data-world="overworld"] :is(.px-in,.px-bar__fill,.px-flow,.px-blink,.px-spin,.px-wave,.px-patrol,.px-type,.px-crt-type,.px-shake) { animation: none !important; transition: none !important; }
html[data-world="overworld"] :is(.typing__caret,.px-dialog__advance,.px-ground,.mascot-peek,.mascot-scrolltop) { display: none !important; }
html[data-world="overworld"] .px-bar__fill { width: var(--val,100%) !important; }
html[data-world="overworld"] :where(.px-panel,.card,.px-dialog) { background: var(--world-surface); }
html[data-world="overworld"] :where(.px-btn,.btn) { min-height: 46px; padding: 11px 20px; font-family: var(--font-sans); font-size: 16px; font-weight: 600; line-height: 1.4; text-transform: none; letter-spacing: 0; }
html[data-world="overworld"] .world-scene {
  position: relative; isolation: isolate; width: 100%; min-height: 180px; aspect-ratio: 16 / 5;
  overflow: hidden; background-color: #163036; background-position: center; background-size: cover;
  image-rendering: pixelated; contain: paint;
}
html[data-world="overworld"] .world-scene--hero,
html[data-world="overworld"] .world-scene[data-world-loaded="true"] { background-image: var(--world-scene-current); }
html[data-world="overworld"] .world-scene--hero { aspect-ratio: 3 / 2; min-height: 360px; }
html[data-world="overworld"] .world-scene::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px #f2d3921f; pointer-events: none; }
html[data-world="overworld"] .world-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
html[data-world="overworld"] [data-world-motion] {
  display: none; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 44px;
  padding: 9px 12px; border: 1px solid var(--world-border); color: var(--world-text);
  background: var(--world-surface); cursor: pointer; font-family: var(--font-sans); font-size: 14px; line-height: 1.25;
}
html[data-world="overworld"].world-ready [data-world-motion] { display: inline-flex; }
html[data-world="overworld"] [data-world-motion]:hover { background: var(--world-raised); border-color: var(--world-accent); }
html[data-world="overworld"] .world-motion-icon { width: 14px; height: 14px; flex: 0 0 14px; }
html[data-world="overworld"] [data-mascot] > img { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
html[data-world="overworld"] [data-mascot] > svg { width: 100%; height: 100%; display: block; }
html[data-world="overworld"] .world-fx {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none;
  z-index: 1; pointer-events: none; image-rendering: pixelated; shape-rendering: crispEdges;
  animation-play-state: paused !important;
}
html[data-world="overworld"][data-world-motion="running"] .world-fx[data-world-active="true"] { animation-play-state: running !important; }
html[data-world="overworld"] [data-world-scene="arrival"] .world-fx {
  left: auto; right: 0; width: auto; height: 100%; aspect-ratio: 3 / 2;
}
html[data-world="overworld"] .world-fx--motes {
  fill: #ffe4a1; opacity: .72;
  animation: world-motes 6s steps(12,end) infinite;
}
html[data-world="overworld"] .world-fx--water {
  fill: #d8f5ed; opacity: .6;
  animation: world-water 1.8s steps(6,end) infinite;
}
html[data-world="overworld"] .world-fx__fall { stroke: #e0f6ff; stroke-width: 2; fill: none; }
html[data-world="overworld"] .world-fx--smoke {
  fill: #d8dfdf; opacity: .32; animation: world-smoke 5s steps(10,end) infinite;
}
html[data-world="overworld"] .world-fx--lamplight { opacity: .6; animation: world-lamplight 4.6s steps(9,end) infinite; }
html[data-world="overworld"] .world-fx--hearth { fill: #ffd47a; opacity: .5; animation: world-hearth 1.7s steps(7,end) infinite; }
html[data-world="overworld"] .world-fx--crystal { fill: #8affdd; opacity: .4; animation: world-crystal 4s ease-in-out infinite; }
html[data-world="overworld"][data-theme="light"] .world-fx--motes { fill: #fff1b9; }
html[data-world="overworld"][data-theme="light"] .world-fx--water { fill: #f0ffff; }
html[data-world="overworld"][data-theme="light"] .world-fx--smoke { fill: #82949a; }
@keyframes world-motes {
  0%,100% { opacity: .2; transform: translate(0,0); }
  25% { opacity: .8; }
  75% { opacity: .6; }
  90% { opacity: .12; transform: translate(-12px,-18px); }
}
@keyframes world-water { 0%,100% { opacity:.18; transform:translate(0,0); } 55% { opacity:.7; transform:translate(6px,2px); } }
@keyframes world-smoke { 0%,100% { opacity: .05; transform:translate(0,0); } 30% { opacity: .4; } 90% { opacity: .05; transform:translate(-12px,-18px); } }
@keyframes world-lamplight { 0%,100% { opacity: .2; } 24% { opacity: .8; } 48% { opacity: .38; } 72% { opacity: .65; } }
@keyframes world-hearth { 0%,100% { opacity: .12; } 27% { opacity: .65; } 53% { opacity: .3; } 80% { opacity: .55; } }
@keyframes world-crystal { 0%,100% { opacity: .05; } 50% { opacity: .6; } }
@media (max-width: 600px) {
  html[data-world="overworld"] { --fs-base: 1rem; scroll-padding-top: 92px; }
  html[data-world="overworld"] body { font-size: 16px; }
  html[data-world="overworld"] .world-scene { min-height: 128px; aspect-ratio: 3 / 1; }
  html[data-world="overworld"] .world-scene--hero { min-height: 260px; aspect-ratio: 4 / 3; }
  html[data-world="overworld"] .world-scene--hero,
  html[data-world="overworld"] .world-scene[data-world-loaded="true"] { background-image: var(--world-scene-mobile-current); }
}
@media (prefers-reduced-motion: reduce) {
  html[data-world="overworld"] { scroll-behavior: auto !important; }
  html[data-world="overworld"] *, html[data-world="overworld"] *::before, html[data-world="overworld"] *::after {
    animation: none !important; transition: none !important; scroll-behavior: auto !important;
  }
  html[data-world="overworld"] .world-fx { display: none; }
}
@media print {
  html[data-world="overworld"] .world-scene,
  html[data-world="overworld"] [data-world-motion] { display: none !important; }
}
/* Resolve scene variables on the scene itself, after its theme and asset IDs. */
html[data-world="overworld"] .world-scene {
  --world-scene-current: var(--world-scene-night);
  --world-scene-mobile-current: var(--world-scene-mobile-night);
}
html[data-world="overworld"][data-theme="light"] .world-scene {
  --world-scene-current: var(--world-scene-day);
  --world-scene-mobile-current: var(--world-scene-mobile-day);
}
@media (prefers-color-scheme: light) {
  html[data-world="overworld"]:not([data-theme]) .world-scene {
    --world-scene-current: var(--world-scene-day);
    --world-scene-mobile-current: var(--world-scene-mobile-day);
  }
}

/* Registered scene sources. URL variables do not fetch until a scene is loaded. */
html[data-world="overworld"] [data-world-scene="arrival"] {
  --world-scene-night: url('../world/v1/scenes/arrival-twilight-desktop-v1.webp');
  --world-scene-day: url('../world/v1/scenes/arrival-day-desktop-v1.webp');
  --world-scene-mobile-night: url('../world/v1/scenes/arrival-twilight-mobile-v1.webp');
  --world-scene-mobile-day: url('../world/v1/scenes/arrival-day-mobile-v1.webp');
}
html[data-world="overworld"] [data-world-scene="workshop"] {
  --world-scene-night: url('../world/v1/scenes/workshop-twilight-desktop-v1.webp');
  --world-scene-day: url('../world/v1/scenes/workshop-day-desktop-v1.webp');
  --world-scene-mobile-night: url('../world/v1/scenes/workshop-twilight-mobile-v1.webp');
  --world-scene-mobile-day: url('../world/v1/scenes/workshop-day-mobile-v1.webp');
}
html[data-world="overworld"] [data-world-scene="study"] {
  --world-scene-night: url('../world/v1/scenes/study-twilight-desktop-v1.webp');
  --world-scene-day: url('../world/v1/scenes/study-day-desktop-v1.webp');
  --world-scene-mobile-night: url('../world/v1/scenes/study-twilight-mobile-v1.webp');
  --world-scene-mobile-day: url('../world/v1/scenes/study-day-mobile-v1.webp');
}
html[data-world="overworld"] [data-world-scene="archive"] {
  --world-scene-night: url('../world/v1/scenes/archive-twilight-desktop-v1.webp');
  --world-scene-day: url('../world/v1/scenes/archive-day-desktop-v1.webp');
  --world-scene-mobile-night: url('../world/v1/scenes/archive-twilight-mobile-v1.webp');
  --world-scene-mobile-day: url('../world/v1/scenes/archive-day-mobile-v1.webp');
}
html[data-world="overworld"] [data-world-scene="riverside"] {
  --world-scene-night: url('../world/v1/scenes/riverside-twilight-desktop-v1.webp');
  --world-scene-day: url('../world/v1/scenes/riverside-day-desktop-v1.webp');
  --world-scene-mobile-night: url('../world/v1/scenes/riverside-twilight-mobile-v1.webp');
  --world-scene-mobile-day: url('../world/v1/scenes/riverside-day-mobile-v1.webp');
}
html[data-world="overworld"] [data-world-scene="dossier"] {
  --world-scene-night: url('../world/v1/scenes/dossier-twilight-desktop-v1.webp');
  --world-scene-day: url('../world/v1/scenes/dossier-day-desktop-v1.webp');
  --world-scene-mobile-night: url('../world/v1/scenes/dossier-twilight-mobile-v1.webp');
  --world-scene-mobile-day: url('../world/v1/scenes/dossier-day-mobile-v1.webp');
}
html[data-world="overworld"] [data-world-scene="nursery"] {
  --world-scene-night: url('../world/v1/scenes/nursery-twilight-desktop-v1.webp');
  --world-scene-day: url('../world/v1/scenes/nursery-day-desktop-v1.webp');
  --world-scene-mobile-night: url('../world/v1/scenes/nursery-twilight-mobile-v1.webp');
  --world-scene-mobile-day: url('../world/v1/scenes/nursery-day-mobile-v1.webp');
}
html[data-world="overworld"] [data-world-scene="observatory"] {
  --world-scene-night: url('../world/v1/scenes/observatory-twilight-desktop-v1.webp');
  --world-scene-day: url('../world/v1/scenes/observatory-day-desktop-v1.webp');
  --world-scene-mobile-night: url('../world/v1/scenes/observatory-twilight-mobile-v1.webp');
  --world-scene-mobile-day: url('../world/v1/scenes/observatory-day-mobile-v1.webp');
}
html[data-world="overworld"] [data-world-scene="townhall"] {
  --world-scene-night: url('../world/v1/scenes/townhall-twilight-desktop-v1.webp');
  --world-scene-day: url('../world/v1/scenes/townhall-day-desktop-v1.webp');
  --world-scene-mobile-night: url('../world/v1/scenes/townhall-twilight-mobile-v1.webp');
  --world-scene-mobile-day: url('../world/v1/scenes/townhall-day-mobile-v1.webp');
}
html[data-world="overworld"] [data-world-scene="cottage"] {
  --world-scene-night: url('../world/v1/scenes/cottage-twilight-desktop-v1.webp');
  --world-scene-day: url('../world/v1/scenes/cottage-day-desktop-v1.webp');
  --world-scene-mobile-night: url('../world/v1/scenes/cottage-twilight-mobile-v1.webp');
  --world-scene-mobile-day: url('../world/v1/scenes/cottage-day-mobile-v1.webp');
}
html[data-world="overworld"] [data-world-scene="checkpoint"] {
  --world-scene-night: url('../world/v1/scenes/checkpoint-twilight-desktop-v1.webp');
  --world-scene-day: url('../world/v1/scenes/checkpoint-day-desktop-v1.webp');
  --world-scene-mobile-night: url('../world/v1/scenes/checkpoint-twilight-mobile-v1.webp');
  --world-scene-mobile-day: url('../world/v1/scenes/checkpoint-day-mobile-v1.webp');
}
html[data-world="overworld"] [data-world-scene="signpost"] {
  --world-scene-night: url('../world/v1/scenes/signpost-twilight-desktop-v1.webp');
  --world-scene-day: url('../world/v1/scenes/signpost-day-desktop-v1.webp');
  --world-scene-mobile-night: url('../world/v1/scenes/signpost-twilight-mobile-v1.webp');
  --world-scene-mobile-day: url('../world/v1/scenes/signpost-day-mobile-v1.webp');
}
