/* Celeste: a quiet base camp beneath a midnight mountain.
 * Shared launcher variables are mapped here; game/runtime rules stay separate. */
:root {
  color-scheme: dark;
  --celeste-night: #0d1425;
  --celeste-dusk: #1c2846;
  --celeste-snow: #f3f3fa;
  --celeste-mist: #b2bfd5;
  --celeste-berry: #ff8292;
  --celeste-berry-rgb: 255, 130, 146;
  --celeste-dash: #a3dce9;
  --celeste-dash-rgb: 163, 220, 233;
  --surface: #172139;
  --surface-raised: #202e49;
  --surface-inset: #101a2e;
  --line: #34425d;
  --line-soft: #29364f;
  --success: #9ddcc5;
  --radius: 20px;
  --radius-control: 10px;
  --shadow: 0 24px 64px #050a1760;
  --space-panel: clamp(1.25rem, 3vw, 2rem);
  --demo-bg-a: var(--celeste-dusk);
  --demo-bg-b: var(--celeste-night);
  --demo-text: var(--celeste-snow);
  --demo-muted: var(--celeste-mist);
  --demo-accent: var(--celeste-berry);
  --demo-accent-rgb: var(--celeste-berry-rgb);
  --demo-accent2: var(--celeste-dash);
  --demo-accent2-rgb: var(--celeste-dash-rgb);
  --demo-panel-bg: var(--surface);
  --demo-panel-border: var(--line);
  --demo-panel-radius: var(--radius);
  --demo-panel-shadow: none;
  --demo-panel-blur: 0px;
  --demo-subpanel-bg: var(--surface-inset);
  --demo-subpanel-border: var(--line);
  --demo-subpanel-blur: 0px;
  --demo-subpanel-shadow: none;
  --demo-drop-bg: var(--surface-inset);
  --demo-drop-border: #51617f;
  --demo-drop-active-bg: #233b50;
  --demo-drop-active-border: var(--celeste-dash);
  --demo-drop-active-shadow: none;
  --demo-picker-bg: var(--surface-raised);
  --demo-picker-hover-bg: #2b3e5a;
  --demo-picker-border: #586b8c;
  --demo-picker-hover-border: var(--celeste-dash);
  --demo-picker-text: var(--celeste-snow);
  --demo-file-info-bg: var(--surface-inset);
  --demo-launch-bg: var(--celeste-berry);
  --demo-launch-text: #251626;
  --demo-accent-glow: none;
  --demo-esc-bg: #060b17d9;
  --demo-esc-card-bg: var(--surface);
  --demo-esc-text: var(--celeste-snow);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--celeste-night); scroll-behavior: smooth; }
body {
  margin: 0;
  width: 100%;
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 20% 35%, #24315280, transparent 65%), var(--celeste-night);
  color: var(--celeste-snow);
  font-family: var(--demo-font-sans, system-ui, sans-serif);
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: 0;
}
button, select, input { font: inherit; }
button, a, label.picker, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }
:where(button, a, input, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--celeste-dash);
  outline-offset: 4px;
}
button, a, .picker { transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 30; padding: .75rem 1rem; background: var(--celeste-snow); color: var(--celeste-night); border-radius: 8px; }
.skip-link:focus { top: 1rem; }

/* Navigation */
.summit-bar {
  display: flex;
  align-items: center;
  gap: 2rem;
  min-height: 88px;
  padding: 1rem max(1.5rem, calc((100% - 1320px) / 2));
  border-bottom: 1px solid var(--line-soft);
  background: #0d1425;
}
.brand { display: inline-flex; align-items: center; gap: .8rem; flex: none; text-decoration: none; color: var(--celeste-snow); }
.brand-mark { display: grid; place-items: center; width: 42px; height: 44px; color: var(--celeste-berry); }
.brand-mark svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.brand-copy { display: grid; gap: .1rem; }
.brand-copy strong { font-size: 1.1rem; letter-spacing: .2em; }
.brand-copy small { color: var(--celeste-mist); font: .625rem/1.5 var(--demo-font-mono, monospace); letter-spacing: .16em; }
.header-caption { border-left: 1px solid var(--line); padding-left: 2rem; color: var(--celeste-mist); font-size: .875rem; }
#header-auth { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: .65rem; margin-left: auto; }
.summit-bar button, .prefs button {
  min-height: 44px;
  padding: .65rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface-raised);
  color: var(--celeste-snow);
  font-weight: 600;
  line-height: 1.35;
}
.summit-bar button:hover:not(:disabled), .prefs button:hover:not(:disabled) { border-color: var(--celeste-dash); background: #293c58; }
.summit-bar .nav-button { background: transparent; border-color: transparent; color: var(--celeste-mist); }
.summit-bar button.icon-button { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; background: transparent; }
.icon-button svg { width: 21px; height: 21px; fill: currentColor; }

/* Desktop composition: scenery and a practical launch panel. */
.page-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr);
  align-items: center;
  column-gap: clamp(2rem, 5vw, 5rem);
  width: min(1320px, calc(100% - 4rem));
  min-height: calc(100dvh - 88px);
  margin: 0 auto;
  padding: clamp(2.5rem, 7vh, 5rem) 0 1.5rem;
}
.hero { position: relative; min-width: 0; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.hero-copy { position: relative; z-index: 1; padding-top: 1rem; }
.eyebrow, .dialog-kicker { margin: 0 0 1.25rem; color: var(--celeste-dash); font: 700 .6875rem/1.6 var(--demo-font-mono, monospace); letter-spacing: .16em; }
.eyebrow > span { color: var(--celeste-berry); margin-right: .5rem; }
.hero h1 { margin: 0; font-size: clamp(4rem, 7.9vw, 7.5rem); font-weight: 800; line-height: .95; letter-spacing: .035em; text-shadow: 0 5px 0 #a5b4d323; }
.hero h1 span { display: block; margin-top: 1.15rem; color: var(--celeste-berry); font-size: clamp(1.4rem, 2.5vw, 2rem); font-weight: 400; line-height: 1.25; letter-spacing: -.025em; text-shadow: none; }
.hero-description { margin: 1rem 0 0; color: var(--celeste-mist); font-size: 1.125rem; line-height: 1.7; }
.mountain-scene { position: relative; margin: -3.25rem -2.5rem 0; pointer-events: none; }
.mountain-scene svg { display: block; width: 100%; height: auto; mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.scene-caption { display: flex; justify-content: space-between; gap: 1rem; margin: -1rem 2.5rem 0; position: relative; color: #9eacc6; font: .625rem/1.6 var(--demo-font-mono, monospace); letter-spacing: .1em; }
.scene-caption > span { color: var(--celeste-dash); }
.scene-stars { animation: starlight 7s ease-in-out infinite alternate; }
@keyframes starlight { from { opacity: .5; } to { opacity: 1; } }
.play-layout { min-width: 0; padding-top: .5rem; }
.launch-card { overflow: hidden; border: 1px solid #3c4964; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.launch-heading { padding: var(--space-panel) var(--space-panel) 1.25rem; }
.launch-heading .eyebrow { margin-bottom: .75rem; color: var(--celeste-berry); }
.launch-heading h2 { margin: 0; font-size: clamp(1.7rem, 2.4vw, 2.15rem); letter-spacing: -.035em; line-height: 1.15; }
.launch-heading > p:last-child { margin: .8rem 0 0; color: var(--celeste-mist); font-size: 1rem; line-height: 1.6; }
.installation-summary { display: flex; align-items: flex-start; gap: .8rem; margin: 0 var(--space-panel); padding: 1rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.installation-summary h3 { margin: 0 0 .25rem; font-size: .875rem; font-weight: 600; }
.install-status { margin: 0; color: var(--celeste-mist); font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; }
.install-status:empty::after { content: 'Your game and progress stay on this device.'; }
.status-orbit { flex: none; width: 9px; height: 9px; margin: .4rem .15rem 0; border: 2px solid var(--celeste-dash); border-radius: 50%; }
.installation-summary.ready .status-orbit { border-color: var(--success); background: var(--success); box-shadow: 0 0 0 4px #9ddcc514; }
.installation-summary.bad .status-orbit { border-color: var(--celeste-berry); }
.install-status.bad { color: var(--celeste-berry); }
.play-layout > .launch-card > main { display: block; width: 100%; height: auto; min-height: 0; padding: 0; position: relative; z-index: auto; }
main:not(.running)::after { display: none; }
/* Specificity deliberately beats the shared components' injected styles. */
.launch-card form.launcher { width: 100%; gap: 1rem; margin: 0; padding: 1.5rem var(--space-panel) 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
.launcher .sdk, .launch-card form.launcher::before { display: none; }
.launcher .drop-grid { min-width: 0; }
.launcher .drop { padding: 1.35rem 1rem; border: 1px dashed var(--demo-drop-border); border-radius: 12px; background: var(--surface-inset); backdrop-filter: none; }
.launcher .drop::before { content: '↑'; display: grid; place-items: center; width: 38px; height: 38px; margin: 0 auto .85rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--celeste-dash); font-size: 1.5rem; }
.launcher .drop strong { margin-bottom: .4rem; font-size: 1.0625rem; line-height: 1.4; text-transform: none; letter-spacing: 0; }
.launcher .drop p { color: var(--celeste-mist); font-family: inherit; font-size: .875rem; line-height: 1.6; word-break: normal; overflow-wrap: anywhere; }
.launcher .drop.active, .launcher .drop.selected { border-color: var(--celeste-dash); background: #1c3044; }
.launcher .picker-actions { flex-wrap: wrap; justify-content: center; gap: .6rem; }
.launcher .picker, .launcher .remove-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .65rem 1rem; border-radius: var(--radius-control); font: 600 .9375rem/1.3 var(--demo-font-sans, sans-serif); letter-spacing: 0; text-transform: none; }
/* The shared component hides its file input; keep it in the tab sequence. */
.launcher .picker input { display: block; position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.launcher .picker:focus-within { outline: 3px solid var(--celeste-dash); outline-offset: 4px; }
.launcher .remove-btn { color: var(--celeste-berry); background: #332336; border-color: #694451; }
.launcher .remove-btn:hover { color: var(--celeste-snow); background: #603544; }
.launcher .launch-btn { display: flex; align-items: center; justify-content: center; gap: .75rem; min-height: 58px; border: 1px solid #ffa5af; border-radius: var(--radius-control); background: var(--celeste-berry); color: #251626; font: 800 1.125rem/1.4 var(--demo-font-sans, sans-serif); letter-spacing: .025em; text-transform: none; box-shadow: 0 4px 0 #a84e60; }
.launcher .launch-btn::before { content: ''; width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 9px solid currentColor; }
.launcher .launch-btn:hover:not(:disabled) { background: #ff9aa7; filter: none; transform: translateY(-2px); }
.launcher .launch-btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 #a84e60; }
.launcher .launch-btn:disabled { opacity: 1; background: #303e56; border-color: #4b5973; color: #b5c0d3; box-shadow: none; }
.launcher .status { min-height: 1.2em; color: var(--celeste-mist); font: .8125rem/1.5 var(--demo-font-sans, sans-serif); text-transform: none; letter-spacing: 0; opacity: 1; overflow-wrap: anywhere; text-align: center; }
.zip-help-line { margin: .9rem var(--space-panel) 1.25rem; text-align: center; }
.zip-help-trigger { min-height: 44px; padding: .5rem 0; border: 0; background: transparent; color: var(--celeste-dash); font-size: .875rem; text-decoration: underline; text-underline-offset: 4px; }
.zip-help-trigger:hover { color: var(--celeste-snow); }
.device-note { display: flex; justify-content: center; align-items: center; gap: .5rem; margin: 0; padding: 1rem; border-top: 1px solid var(--line-soft); background: #131e33; color: var(--celeste-mist); font-size: .8125rem; }
.device-note > span { color: var(--success); }
.save-shortcuts { display: grid; gap: .25rem; margin-top: 1rem; }
.save-shortcuts button { display: flex; align-items: center; gap: 1rem; width: 100%; padding: .85rem 1rem; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--celeste-mist); text-align: left; }
.save-shortcuts button:hover { background: var(--surface); border-color: var(--line); }
.shortcut-icon { display: grid; flex: none; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; color: var(--celeste-dash); font-size: 1.3rem; }
.save-shortcuts strong, .save-shortcuts small { display: block; }
.save-shortcuts strong { color: var(--celeste-snow); font-size: .9375rem; font-weight: 600; }
.save-shortcuts small { margin-top: .15rem; font-size: .8125rem; }
.save-shortcuts button > span:last-child { margin-left: auto; }

/* Shared modal system. Native dialogs own focus trapping and Escape. */
.prefs { width: min(620px, calc(100% - 2rem)); max-width: none; max-height: calc(100vh - 3rem); max-height: calc(100dvh - 3rem); margin: auto; padding: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #657696 var(--surface); border: 1px solid #50607c; border-radius: var(--radius); background: var(--surface); color: var(--celeste-snow); box-shadow: 0 32px 100px #030711b3; font-family: inherit; }
.prefs::backdrop { background: #050a16d9; backdrop-filter: blur(4px); }
.prefs[open] { animation: dialog-arrive 180ms ease-out; }
@keyframes dialog-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.prefs-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin: 0; padding: 1.75rem 2rem 1.5rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.dialog-kicker { display: block; margin-bottom: .5rem; color: var(--celeste-berry); font-size: .625rem; }
.prefs-head h2 { margin: 0; font-size: 2rem; letter-spacing: -.035em; line-height: 1.2; }
.prefs .dialog-close { display: grid; place-items: center; flex: none; min-height: 44px; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-inset); color: var(--celeste-mist); font-size: 1.5rem; }
.dialog-close svg { width: 20px; height: 20px; fill: currentColor; }
.dialog-lead { margin: .65rem 0 0; color: var(--celeste-mist); font-size: .9375rem; line-height: 1.6; }
.prefs-group { margin: 0 2rem; padding: 1.5rem 0; border-bottom: 1px solid var(--line); scroll-margin-top: 10rem; }
.category-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: 1rem; }
.prefs-group h3 { margin: 0 0 .8rem; font-size: 1.125rem; font-weight: 600; color: var(--celeste-snow); }
.category-heading h3 { display: flex; align-items: center; gap: .75rem; margin: 0; }
.category-heading h3 > span { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #415774; border-radius: 7px; color: var(--celeste-dash); font: .6875rem var(--demo-font-mono, monospace); }
.category-tag { color: var(--celeste-mist); font: .6875rem/1.6 var(--demo-font-mono, monospace); letter-spacing: .04em; }
.prefs-group p { margin: 0 0 1rem; color: var(--celeste-mist); font-size: .9375rem; line-height: 1.6; overflow-wrap: anywhere; }
.prefs-group p b { color: var(--celeste-snow); }
.prefs-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-bottom: 1rem; }
.prefs-actions:last-child { margin-bottom: 0; }
.prefs button { font-size: .9375rem; }
.prefs button:disabled { color: #a6b3c9; background: #1c273d; border-color: #35425c; opacity: 1; }
#cloud-sign-in, #cloud-save-now:not(:disabled) { background: #293e53; border-color: #54768e; color: #c7f0f5; }
#cloud-sign-in:hover:not(:disabled), #cloud-save-now:hover:not(:disabled) { background: #35536b; }
.cloud-version-label { display: block; margin-bottom: .5rem; color: var(--celeste-snow); font-size: .9375rem; }
#cloud-version-select { display: block; width: 100%; min-width: 0; min-height: 48px; margin: 0 0 1rem; padding: .65rem .85rem; border: 1px solid #576b8b; border-radius: var(--radius-control); background: var(--surface-inset); color: var(--celeste-snow); font-size: 1rem; text-overflow: ellipsis; }
#cloud-version-select:disabled { color: #a6b3c9; border-color: #35425c; background: #1c273d; }
.prefs-group #cloud-last-sync { margin: .5rem 0 1rem; font-size: .8125rem; }
.prefs-group .cloud-sync-indicator { display: flex; align-items: center; gap: .5rem; margin: 0; color: var(--celeste-dash); font-size: .8125rem; }
.cloud-sync-indicator::before { content: ''; width: 6px; height: 6px; flex: none; border-radius: 50%; background: currentColor; }
.cloud-sync-indicator.syncing::before { animation: starlight 850ms ease-in-out infinite alternate; }
.prefs-group .cloud-status, .auth-status, .prefs-status { margin: .85rem 0 0; padding: .85rem 1rem; border: 1px solid #415e64; border-radius: 10px; background: #172f3a; color: #c2e8df; font-size: .9375rem; line-height: 1.55; overflow-wrap: anywhere; }
.cloud-status:empty, .auth-status:empty, .prefs-status:empty { display: none; }
.prefs .bad { color: #ffc0c9; border-color: #825164; background: #382537; }
.prefs-status { position: sticky; bottom: 0; z-index: 2; margin: 0 2rem 1.5rem; box-shadow: 0 -8px 20px #172139b3; }
.prefs-group.danger-zone { margin: 1.5rem 2rem; padding: 1.25rem; border: 1px solid #704555; border-radius: 12px; background: #2a2032; }
.danger-zone .category-tag, .danger-zone h3 > span { color: #ffadba; }
.danger-zone h3 > span { border-color: #865164; }
.prefs button.danger { border-color: #986071; background: #3d293d; color: #ffc0cb; }
.prefs button.danger:hover:not(:disabled) { border-color: var(--celeste-berry); background: #593349; }
.prefs button.danger.armed { background: var(--celeste-berry); border-color: var(--celeste-berry); color: #251626; }
.auth-dialog { width: min(540px, calc(100% - 2rem)); }
.auth-form { display: grid; gap: 1rem; margin: 1.5rem 2rem; }
.auth-form .dialog-lead { margin: 0; }
.dialog-note { color: var(--celeste-mist); font-size: .9375rem; line-height: 1.6; }
.auth-status { margin: 0 2rem 1.5rem; }
.zip-tutorial .prefs-group:last-child { border: 0; }
.zip-tutorial ol { padding-left: 1.5rem; }
.zip-tutorial li { padding: .25rem 0; color: var(--celeste-mist); font-size: .9375rem; line-height: 1.6; }
.zip-tutorial code { color: var(--celeste-dash); overflow-wrap: anywhere; }
.zip-tutorial details { padding: .8rem 0; border-top: 1px solid var(--line); }
.zip-tutorial summary { color: var(--celeste-snow); font-weight: 600; cursor: pointer; }
.zip-tutorial details p { margin: .75rem 0 0; }

/* Bootstrap is fixed in height to avoid shifting the main action while loading. */
.launcher-loading { display: grid; grid-template-areas: 'phase' 'bar' 'speed' 'detail'; grid-template-rows: 1.4rem 6px 1.5rem 2.5rem; align-content: center; justify-items: center; gap: 1rem; height: 16rem; padding: 1.5rem var(--space-panel); color: var(--celeste-mist); text-align: center; }
.launcher-loading p { margin: 0; }
#bootstrap-phase { grid-area: phase; max-width: 100%; font-size: .9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.launcher-loading-bar { grid-area: bar; width: 100%; height: 6px; overflow: hidden; border-radius: 10px; background: var(--line); }
.launcher-loading-bar i { display: block; width: 38%; height: 100%; border-radius: inherit; background: var(--celeste-berry); }
.launcher-loading-bar.busy i { animation: hud-sweep 1.5s ease-in-out infinite; }
.launcher-speed { grid-area: speed; color: var(--celeste-dash); font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.launcher-loading-detail { grid-area: detail; font-size: .8125rem; line-height: 1.5; overflow-wrap: anywhere; }
/* --- the stage ------------------------------------------------------------ */

main {
  display: block;
  width: 100%;
  /* The canvas is absolutely positioned inside whatever the template mounts,
   * so the stage has to carry the height itself. */
  height: calc(100vh - 3.5rem);
}

/* The shared stylesheet pins the stage to 5:4, which is right for the arcade
 * cores it was written for and wrong for Celeste. `main .runtime` outranks it. */
main .runtime {
  position: relative;
  aspect-ratio: 16 / 9;
  width: min(100%, calc((100vh - 3.5rem) * 16 / 9));
  height: auto;
  max-height: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: #000;
}

/* The picture is always 16:9 — the browser build renders at a whole multiple of
 * 320×180 and nothing on the page can talk it out of that — so the canvas is
 * letterboxed inside the stage rather than stretched to it. The SDK writes the
 * exact pixel size inline on every resize; these are the same rules in CSS, for
 * the moment before it does and for hosts with no stylesheet of their own. */
main .runtime canvas {
  position: absolute;
  inset: 0;
  margin: auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  /* The SDK gives the canvas a tabindex so it can be focused programmatically;
   * the focus ring that comes with it would frame the picture in browser blue. */
  outline: none;
}

.stage-message {
  display: grid;
  place-content: center;
  height: 100%;
  margin: 0;
  padding: 2rem;
  text-align: center;
  color: var(--celeste-berry);
  font-size: 1rem;
  line-height: 1.6;
}

/* --- the game takes the page ---------------------------------------------- */

/* Once boot starts, the page *is* the game. The header would only take
 * viewport height away from a picture the game letterboxes itself, and every
 * message it used to carry is on the stage HUD from here on. It comes back if
 * the boot fails, because then there is something to act on again. */
body:has(main.running) .summit-bar {
  display: none;
}

body:has(main.running .stage-message),
body:has(main.running .stage-hud.bad) {
  overflow: auto;
}

body:has(main.running .stage-message) .summit-bar,
body:has(main.running .stage-hud.bad) .summit-bar {
  display: flex;
}

main.running {
  height: 100vh;
  height: 100dvh;
}

/* The SDK measures this box just before the game reads its settings and writes
 * the matching window scale into them, so this is what decides the resolution
 * Celeste boots at — the largest whole multiple of 320×180 that fits. It cannot
 * be changed after that, so resizing the window only rescales the picture
 * inside this box; the black around it is this element showing through. */
main.running .runtime {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  aspect-ratio: auto;
  max-height: none;
  margin: 0;
}

/* --- the loading screen --------------------------------------------------- */

/* Over the canvas, never in it: the canvas belongs to a worker from the moment
 * the runtime starts, so the page cannot paint into it. */
.stage-hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.85rem;
  padding: 2rem;
  text-align: center;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(var(--celeste-dash-rgb), 0.14), transparent 62%),
    linear-gradient(180deg, var(--celeste-dusk), var(--celeste-night) 70%);
  opacity: 1;
  transition: opacity 500ms ease;
}

/* Faded out rather than cut, so the first frame of the game arrives under it. */
.stage-hud.done {
  opacity: 0;
  pointer-events: none;
}

.stage-hud .hud-mark {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--celeste-snow);
  opacity: 0.75;
}

.stage-hud .hud-phase {
  max-width: 34rem;
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--celeste-snow);
  text-wrap: balance;
}

.stage-hud.bad .hud-phase {
  color: var(--celeste-berry);
}

.stage-hud .hud-detail {
  max-width: 34rem;
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--celeste-mist);
  text-wrap: balance;
}

.stage-hud .hud-bar {
  position: relative;
  width: min(26rem, 70vw);
  height: 6px;
  border-radius: 999px;
  background: rgba(244, 247, 255, 0.14);
  overflow: hidden;
}

.stage-hud .hud-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--celeste-dash), var(--celeste-berry));
  transition: width 220ms ease;
}

/* The long steps — the runtime download, MonoMod, Everest — report messages
 * rather than fractions, so the bar sweeps instead of filling. */
.stage-hud .hud-bar.busy i {
  width: 35%;
  transition: none;
  animation: hud-sweep 1.5s ease-in-out infinite;
}

@keyframes hud-sweep {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(286%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage-hud .hud-bar.busy i {
    width: 100%;
    animation: none;
    opacity: 0.5;
  }
}


/* Game mode retains the full viewport measured by the SDK. */
body:has(main.running) { overflow: hidden; }
body:has(main.running) .hero,
body:has(main.running) .launch-heading,
body:has(main.running) .installation-summary,
body:has(main.running) .zip-help-line,
body:has(main.running) .device-note,
body:has(main.running) .save-shortcuts,
body:has(main.running) .page-shell { display: block; width: 100%; min-height: 0; margin: 0; padding: 0; }
body:has(main.running) .play-layout { padding: 0; }
body:has(main.running) .launch-card { border: 0; border-radius: 0; box-shadow: none; }
.play-layout .launch-card > main.running { width: 100%; height: 100vh; height: 100dvh; min-height: 0; padding: 0; overflow: hidden; background: #000; }
.fullscreen-toggle { display: none; position: fixed; z-index: 20; top: 1rem; right: 1rem; width: 44px; height: 44px; place-items: center; border: 1px solid #697a96; border-radius: 10px; background: #101a2ee6; color: var(--celeste-snow); }
.fullscreen-toggle svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.fullscreen-toggle .fullscreen-exit, .fullscreen-toggle.active .fullscreen-enter { display: none; }
.fullscreen-toggle.active .fullscreen-exit { display: block; }
body:has(main.running) .fullscreen-toggle { display: grid; }
body:has(main.running .stage-message) .fullscreen-toggle,
body:has(main.running .stage-hud.bad) .fullscreen-toggle { display: none; }

@media (min-width: 1600px) {
  .page-shell { width: min(1480px, calc(100% - 8rem)); column-gap: 7rem; }
  .hero h1 { font-size: 8.5rem; }
}
@media (max-width: 1000px) {
  .header-caption { display: none; }
  .page-shell { width: calc(100% - 3rem); column-gap: 2rem; grid-template-columns: minmax(0, 1fr) minmax(340px, 1fr); }
  .hero h1 { font-size: 4.5rem; }
  .scene-caption { font-size: .625rem; }
  .scene-caption > span { display: none; }
}
@media (max-width: 760px) {
  .summit-bar { min-height: 76px; padding: .85rem 1rem; gap: .75rem; }
  .brand { gap: .4rem; }
  .brand-copy strong { font-size: .875rem; letter-spacing: .15em; }
  .brand-copy small { font-size: .5rem; }
  .header-actions { gap: .25rem; }
  .summit-bar button { padding: .6rem .75rem; font-size: .875rem; }
  .page-shell { display: block; width: min(540px, calc(100% - 2rem)); padding-top: 2.25rem; }
  .hero { min-height: 310px; justify-content: flex-start; margin-bottom: 1.5rem; }
  .hero-copy { padding: 0; }
  .hero .eyebrow { font-size: .625rem; margin-bottom: 1rem; }
  .hero h1 { font-size: clamp(3.65rem, 15vw, 5rem); }
  .hero h1 span { font-size: 1.5rem; margin-top: .75rem; }
  .hero-description { font-size: 1rem; }
  .mountain-scene { position: absolute; width: 72%; right: -1rem; bottom: -1rem; margin: 0; opacity: .6; z-index: 0; }
  .mountain-scene svg { mask-image: linear-gradient(90deg, transparent, #000 35%); }
  .scene-caption { display: none; }
  .play-layout { position: relative; padding: 0; }
  .launch-heading { padding-top: 1.5rem; }
  .launch-heading > p:last-child br { display: none; }
  .prefs-head { padding: 1.25rem; }
  .prefs-head h2 { font-size: 1.75rem; }
  .prefs-group { margin: 0 1.25rem; }
  .prefs-group.danger-zone { margin: 1.25rem; padding: 1rem; }
  .prefs-status, .auth-status { margin: 0 1.25rem 1.25rem; }
  .auth-form { margin: 1.25rem; }
  .prefs .dialog-lead { font-size: .875rem; }
  .category-tag { font-size: .625rem; }
}
@media (max-width: 390px) {
  .summit-bar { flex-wrap: wrap; gap: .5rem; }
  .header-actions { gap: .15rem; }
  .summit-bar button { padding-inline: .6rem; font-size: .8125rem; }
  .brand-mark { width: 26px; }
  .brand-mark svg { width: 26px; }
  .brand-copy strong { font-size: .75rem; }
  .brand-copy small { display: none; }
  .prefs-actions { flex-direction: column; }
  .prefs-actions button { width: 100%; }
  .category-heading { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .launcher-loading-bar.busy i { transform: translateX(80%); }
}
