/* Shared by the website and retained Stage study. Uses the font and token sources.
   Borderless sprites keep their source aspect ratio; bordered sprites use the generated
   .s9-* rules from layouts.js. */

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--a-ground); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--a-ground); color: var(--a-ink); font: 400 var(--t-body)/1.7 var(--font-reading); }
img { max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--a-focus); outline-offset: 3px; box-shadow: 0 0 0 6px var(--a-focus-halo); }

.missing { max-width: 36em; margin: 15vh auto; padding-inline: max(16px, env(safe-area-inset-left, 0px)); color: var(--a-ink-2); }

/* Labels and controls set in the display faces. */
.label { font-family: var(--font-display); font-weight: 700; }
/* White label text with the game's dark outline. */
.outlined { color: #fff; -webkit-text-stroke: 4px var(--outline, var(--g-navy-deep)); paint-order: stroke fill; }

/* ---------- Borderless sprite controls: one uniform scale ---------- */

.sp { display: inline-grid; place-items: center; background: center / 100% 100% no-repeat; text-decoration: none; border: 0; padding: 0; cursor: pointer; }

/* Choice: adv_btn_choice_1, 656 x 70. */
.sp-choice {
  width: min(100%, var(--w, 492px)); aspect-ratio: 656 / 70;
  background-image: var(--spr-adv_btn_choice_1);
  color: var(--g-navy); font: 700 clamp(0.9375rem, 0.85rem + 0.4vw, 1.125rem)/1 var(--font-display);
  padding-inline: 8%;
}
.sp-choice:hover, .sp-choice:focus-visible { background-image: var(--spr-adv_btn_choice_2); }
.sp-choice:active { translate: 0 2px; }

/* Primary: common_btn_middle_main, 276 x 50. */
.sp-main {
  width: var(--w, 276px); max-width: 100%; aspect-ratio: 276 / 50;
  background-image: var(--spr-common_btn_middle_main);
  font: 700 1.0625rem/1 var(--font-display); color: #fff;
  -webkit-text-stroke: 4px var(--g-navy-deep); paint-order: stroke fill;
}
.sp-main:active { translate: 0 2px; }

/* Toggle: common_btn_s_sub_6, 180 x 42, with its selected sprite. */
.sp-toggle {
  width: var(--w, 180px); max-width: 100%; aspect-ratio: 180 / 42;
  background-image: var(--spr-common_btn_s_sub_6);
  font: 700 var(--t-meta)/1 var(--font-display); color: var(--g-navy);
  padding-bottom: 3px;
}
.sp-toggle[aria-pressed="true"], .sp-toggle[aria-current="page"] { background-image: var(--spr-common_btn_s_sub_6_selected); color: var(--g-brown); }

/* Search field: common_btn_middle_sub, 276 x 50, with the search icon. */
.sp-search { position: relative; display: inline-block; width: 276px; max-width: 100%; aspect-ratio: 276 / 50; background: var(--spr-common_btn_middle_sub) center / 100% 100% no-repeat; }
.sp-search::before { content: ""; position: absolute; left: 18px; top: 50%; translate: 0 -55%; width: 20px; height: 22px; background: var(--spr-common_icon_search) center / contain no-repeat; }
.sp-search input { position: absolute; inset: 4px 14px 8px 44px; width: auto; border: 0; background: transparent; color: var(--g-navy); font: 600 var(--t-body)/1 var(--font-reading); }
.sp-search input::placeholder { color: #6a7194; }
.sp-search input:focus-visible { outline: none; box-shadow: none; }
/* Focus glows in the frame's own gold instead of drawing a second border around it. */
.sp-search:focus-within { outline: none; filter: drop-shadow(0 0 3px rgb(215 185 138 / 0.9)); }

/* ---------- Bordered sprite frames ---------- */

/* Name plate: common_adv_bg_name, 280 x 35, drawn at 0.8. */
.plate {
  display: grid; place-items: center start; width: 224px; height: 28px; padding-inline: 26px 12px;
  background: var(--spr-common_adv_bg_name) center / 100% 100% no-repeat;
  font: 700 1rem/1 var(--font-display); letter-spacing: 0.04em;
  color: #fff; -webkit-text-stroke: 4px var(--g-pink-deep); paint-order: stroke fill;
}

/* Site dialogue: the game's message frame with name plate and completion arrow. */
.say { position: relative; --s9: 0.5; padding: 30px clamp(20px, 3vw, 40px) 26px; color: var(--g-ink); }
.say .plate { position: absolute; left: clamp(10px, 2vw, 24px); top: -16px; }
.say .line { margin: 0; max-width: 40em; font: 500 var(--t-site-dialogue)/1.75 var(--font-reading); white-space: pre-wrap; min-height: calc(2 * 1.75em); }
.say .line .ghost { visibility: hidden; }
.say .arrow { position: absolute; right: 22px; bottom: 12px; width: 25px; height: 19px; opacity: 0; background: var(--spr-common_icon_arrow_speech_down) center / contain no-repeat; }
.say.is-done .arrow { opacity: 1; animation: bob var(--dur-arrow) linear infinite alternate; }
@keyframes bob { to { translate: 0 10px; } }

/* Status chips: common_texticon_* pills at their native 26 px height. */
.chip { display: inline-grid; place-items: center; height: 26px; padding-inline: 14px; font: 700 0.8125rem/1 var(--font-display); letter-spacing: 0.02em; white-space: nowrap; }
.chip.read { color: #fff; -webkit-text-stroke: 3px #2f6fb0; paint-order: stroke fill; }
.chip.new { color: #fff; -webkit-text-stroke: 3px var(--g-pink-deep); paint-order: stroke fill; }
.chip.progress { color: var(--g-navy); }

/* 4 px progress line. */
.bar { position: relative; height: 4px; border-radius: 2px; background: var(--a-rule); overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); background: var(--a-progress); }

.dotted { border-bottom: var(--rule-dotted); }
.num { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) .say.is-done .arrow { animation: none; }
}
