/* ==========================================================================
   JACK WILDS: fx.css. The play layer, loaded last on every page.
   Pad glyph hints, P1 banner, the pause menu, CRT mode, the cursor ring.
   Everything is scoped .fx- (plus the html.input-* / html.fx-crt mode hooks).
   ========================================================================== */

/* ── Controller glyphs ─────────────────────────────────────────────────────
   Opt in anywhere with data-pad-hint="A|B|X|Y|LB|RB|START"; the badge only
   shows while a controller is the last thing used. */
.fx-glyph,
html.input-pad [data-pad-hint]::after {
  --gl: var(--bone-2);
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  min-width: 21px;
  height: 21px;
  padding: 1px 5px 0;
  border-radius: 999px;
  border: 1.5px solid var(--gl);
  color: var(--gl);
  background: rgba(12, 10, 8, .55);
  font-family: var(--f-pixel);
  font-size: 11px;
  font-weight: 400;
  font-style: normal;
  line-height: 1;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-shadow: none;
  vertical-align: middle;
  flex: none;
}
html.input-pad [data-pad-hint]::after {
  content: attr(data-pad-hint);
  position: relative;
  inset: auto;
  width: auto;
  transform: none;
  opacity: 1;
  margin: 0 0 0 .65em;
  box-shadow: none;
  animation: fxGlyphIn .35s var(--ease-back) both;
}
/* A reads on ink, seal and gold alike: a cream disc with a seal-red letter */
.fx-glyph--a,
html.input-pad [data-pad-hint="A"]::after { --gl: var(--seal-deep); background: #fff7ee; border-color: #fff7ee; }
html.input-pad [data-pad-hint="X"]::after,
html.input-pad [data-pad-hint="Y"]::after { --gl: var(--gold); }
.fx-glyph--pill,
html.input-pad [data-pad-hint="LB"]::after,
html.input-pad [data-pad-hint="RB"]::after,
html.input-pad [data-pad-hint="START"]::after { border-radius: 6px; padding-inline: 6px; font-size: 10px; letter-spacing: .12em; }
@keyframes fxGlyphIn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }

/* keyboard caps for the pause-menu footer */
.fx-key {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 21px;
  padding: 1px 6px 0;
  border: 1.5px solid var(--line-2);
  border-bottom-width: 3px;
  color: var(--bone-2);
  font-family: var(--f-pixel);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .08em;
  line-height: 1;
  vertical-align: middle;
}

/* a controller moves focus programmatically: always show where it is */
html.input-pad :focus:not(:focus-visible) { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ── P1 banner ─────────────────────────────────────────────────────────── */
.fx-p1 {
  position: fixed;
  z-index: 1550;
  top: calc(var(--nav-h) + var(--safe-t) + 14px);
  left: 50%;
  display: flex;
  align-items: stretch;
  max-width: calc(100% - 32px);
  background: var(--ink-2);
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 0 2px var(--ink-2), inset 0 0 0 3px rgba(242, 177, 62, .28), var(--shadow-hard);
  transform: translateX(-50%);
  pointer-events: none;
  animation: fxP1In .55s var(--ease-back) both;
}
.fx-p1.is-leaving { animation: fxP1Out .45s var(--ease-io) both; }
.fx-p1.is-off { border-color: var(--fog-2); box-shadow: var(--shadow-hard); }
.fx-p1-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 58px;
  background: var(--gold);
  color: #1a1206;
}
.fx-p1.is-off .fx-p1-icon { background: var(--ink-4); color: var(--fog); }
.fx-p1-icon .ic { width: 30px; height: 30px; animation: fxPadWiggle 1.1s steps(2) 3; }
.fx-p1-copy { display: grid; gap: 7px; padding: 11px 20px 12px 16px; min-width: 0; }
.fx-p1-title {
  font-family: var(--f-pixel);
  font-size: 19px;
  line-height: 1.1;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
  clip-path: inset(0 100% 0 0);
  animation: fxType .5s steps(12) .18s both;
}
.fx-p1.is-off .fx-p1-title { color: var(--bone-2); animation: none; clip-path: none; }
.fx-p1-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: var(--f-pixel);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--bone-2);
}
.fx-p1-keys > span { display: inline-flex; align-items: center; gap: 6px; }
@keyframes fxP1In { from { opacity: 0; transform: translate(-50%, -18px) scale(.94); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes fxP1Out { to { opacity: 0; transform: translate(-50%, -12px); } }
@keyframes fxType { to { clip-path: inset(0 0 0 0); } }
@keyframes fxPadWiggle { 50% { transform: rotate(-8deg) translateY(-1px); } }
@media (max-width: 480px) {
  .fx-p1 { width: calc(100% - 32px); }
  .fx-p1-title { font-size: 16px; letter-spacing: .16em; }
  .fx-p1-icon { width: 50px; }
}

/* ── Pause menu ────────────────────────────────────────────────────────── */
.fx-pause {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: max(16px, var(--safe-t)) max(16px, env(safe-area-inset-right)) max(16px, var(--safe-b)) max(16px, env(safe-area-inset-left));
  border: 0;
  background: transparent;
  color: var(--bone);
  overflow: auto;
  overscroll-behavior: contain;
}
.fx-pause[open] { display: grid; place-items: center; }
.fx-pause::backdrop {
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, .28) 2px 3px),
    radial-gradient(ellipse at 50% 45%, rgba(46, 12, 8, .7), rgba(6, 5, 4, .92) 72%);
  animation: fxFade .28s var(--ease-out) both;
}
.fx-pause.is-closing::backdrop { animation: fxFadeOut .16s var(--ease-io) both; }
@keyframes fxFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fxFadeOut { to { opacity: 0; } }

/* A real JRPG window: a 2px bone line with pixel-rounded corners (a 9-slice
   border-image, so the corners are actually cut away), an ink band, then a
   faint inner hairline. */
.fx-pause-win {
  position: relative;
  width: min(100%, 740px);
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  grid-template-areas: "main status" "foot foot";
  background:
    linear-gradient(180deg, rgba(239, 230, 214, .035), rgba(239, 230, 214, 0) 38%),
    linear-gradient(180deg, #17120e, #0e0b08);
  background-clip: padding-box;
  border: 6px solid var(--bone);
  border-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' shape-rendering='crispEdges'><path fill='%23120e0b' d='M6 2h2v2h2v2h2v2h-2v2H8v2H6v-2H4V8H2V6h2V4h2z'/><path fill='%23efe6d6' d='M6 0h2v2H6zM6 12h2v2H6zM0 6h2v2H0zM12 6h2v2h-2zM2 2h4v2H4v2H2zM8 2h4v4h-2V4H8zM2 8h2v2h2v2H2zM10 8h2v4H8v-2h2z'/></svg>") 6 / 6px stretch;
  box-shadow:
    inset 0 0 0 1px rgba(239, 230, 214, .2),
    10px 10px 0 rgba(0, 0, 0, .62),
    0 40px 120px -30px rgba(0, 0, 0, .9);
  animation: fxWinOpen .36s var(--ease-out) backwards;
}
.fx-pause.is-closing .fx-pause-win { animation: fxWinClose .16s var(--ease-io) both; }
@keyframes fxWinOpen {
  0% { clip-path: inset(calc(50% - 1px) 50% calc(50% - 1px) 50%); opacity: .6; }
  34% { clip-path: inset(calc(50% - 1px) -12px calc(50% - 1px) -12px); opacity: 1; }
  100% { clip-path: inset(-160px -160px -160px -160px); opacity: 1; }
}
@keyframes fxWinClose {
  0% { clip-path: inset(-160px -160px -160px -160px); opacity: 1; }
  100% { clip-path: inset(calc(50% - 1px) -12px calc(50% - 1px) -12px); opacity: 0; }
}

.fx-pause-main { grid-area: main; padding: 26px 22px 18px 20px; min-width: 0; }
.fx-pause-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 0 4px 16px 14px;
  border-bottom: 1px solid var(--line);
}
.fx-pause-kicker {
  font-family: var(--f-pixel);
  font-size: 12px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--fog);
}
.fx-pause-kicker [lang="ja"] { color: var(--seal-hot); letter-spacing: .14em; margin-right: .4em; }
.fx-pause-title {
  margin-top: 8px;
  font-family: var(--f-pixel);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--bone);
}
.fx-pause-seal {
  width: 32px;
  height: 32px;
  flex: none;
  image-rendering: pixelated;
  transform: rotate(-5deg);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .55);
}

.fx-pause-menu { position: relative; margin-top: 12px; }
.fx-pause-list { list-style: none; display: grid; }
.fx-pause[open] .fx-pause-list > li { animation: fxItemIn .34s var(--ease-out) both; animation-delay: calc(90ms + var(--i, 0) * 26ms); }
@keyframes fxItemIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.fx-pause-sep { height: 1px; margin: 8px 12px 8px 40px; background: var(--line); }

.fx-pi {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px 9px 40px;
  font-family: var(--f-pixel);
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-align: left;
  color: var(--bone-2);
  -webkit-tap-highlight-color: transparent;
  transition: color .12s, background-color .12s;
}
.fx-pi:focus-visible,
html.input-pad .fx-pi:focus { outline: none; } /* the hand and the highlight bar are the focus indicator */
.fx-pi.is-cur {
  color: #fff7ee;
  background: linear-gradient(90deg, rgba(242, 177, 62, .17), rgba(242, 177, 62, .05) 62%, rgba(242, 177, 62, 0));
}
.fx-pi--gold { color: var(--gold); }
.fx-pi--gold.is-cur { color: var(--gold-hot); }
.fx-pi-label { min-width: 0; }
.fx-pi-tag {
  padding: 3px 6px 2px;
  border: 1px solid currentColor;
  font-size: 9.5px;
  letter-spacing: .2em;
  color: var(--gold);
  opacity: .85;
}
.fx-pi-jp {
  margin-left: auto;
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--fog-2);
  text-transform: none;
  transition: color .12s;
}
.fx-pi.is-cur .fx-pi-jp { color: var(--seal-hot); }
.fx-pi-val {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fog);
}
.fx-pi-val b { font-weight: 400; min-width: 3ch; text-align: center; }
.fx-pi-val.is-on { color: var(--gold); }
.fx-pi-arrow { font-size: 10px; opacity: 0; transition: opacity .12s; }
.fx-pi.is-cur .fx-pi-arrow { opacity: .7; }

/* the pointing cursor: one element, slides to whichever item has focus */
.fx-hand {
  position: absolute;
  left: 12px;
  top: 0;
  width: 14px;
  height: 24px;
  color: var(--gold);
  opacity: 0;
  pointer-events: none;
  transition: transform .17s var(--ease-snap), opacity .2s;
}
.fx-hand.is-on { opacity: 1; }
.fx-hand.is-instant { transition: none; }
.fx-hand svg { display: block; animation: fxBob .56s steps(2, jump-none) infinite; }
@keyframes fxBob { from { transform: translateX(0); } to { transform: translateX(3px); } }

/* status: location, stamps, time */
.fx-pause-status {
  grid-area: status;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 30px 26px 22px;
  border-left: 1px solid var(--line);
  min-width: 0;
}
.fx-pause-crest {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-family: var(--f-pixel);
  font-size: 10.5px;
  line-height: 1.7;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--fog-2);
}
.fx-pause-crest img { width: 54px; height: auto; flex: none; }
.fx-pause-status dl { display: grid; gap: 22px; }
.fx-pause-status dt {
  font-family: var(--f-pixel);
  font-size: 11px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--fog);
  margin-bottom: 7px;
}
.fx-loc {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 22px;
  line-height: 1.15;
  color: var(--bone);
  overflow-wrap: anywhere;
}
.fx-stamps { display: grid; gap: 9px; }
.fx-pips { display: grid; grid-template-columns: repeat(9, minmax(0, 22px)); gap: 4px; }
.fx-pip {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--line-2);
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 11.5px;
  line-height: 1;
  color: var(--fog-2);
}
.fx-pip.is-got {
  background: var(--seal);
  border-color: var(--seal);
  color: #fff4ea;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .5);
}
.fx-pip.is-got:nth-child(odd) { transform: rotate(-5deg); }
.fx-pip.is-got:nth-child(even) { transform: rotate(4deg); }
.fx-stamp-count, .fx-clock {
  font-family: var(--f-pixel);
  font-size: 17px;
  letter-spacing: .14em;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}
.fx-clock { color: var(--gold); }

.fx-pause-foot {
  grid-area: foot;
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 10px 22px 10px 34px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, .22);
  font-family: var(--f-pixel);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--fog);
}
.fx-hint { display: none; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.fx-hint > span { display: inline-flex; align-items: center; gap: 7px; }
.fx-hint--ptr { display: flex; }
html.input-pad .fx-hint--ptr, html.input-keyboard .fx-hint--ptr { display: none; }
html.input-pad .fx-hint--pad, html.input-keyboard .fx-hint--key { display: flex; }

@media (max-width: 640px) {
  .fx-pause { place-items: end center; padding-bottom: max(12px, var(--safe-b)); }
  .fx-pause[open] { place-items: end center; }
  .fx-pause-win { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "status" "foot"; }
  .fx-pause-main { padding: 20px 14px 10px 12px; }
  .fx-pause-head { padding-bottom: 12px; }
  .fx-pause-title { font-size: 26px; }
  .fx-pi { min-height: 48px; font-size: 16px; }
  .fx-pause-status { border-left: 0; border-top: 1px solid var(--line); padding: 16px 22px 16px 26px; }
  .fx-pause-crest { display: none; }
  .fx-pause-status dl { grid-template-columns: auto auto; gap: 14px 22px; }
  .fx-pause-status dl > div:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .fx-loc { font-size: 18px; }
  .fx-pause-foot { padding-left: 26px; }
}
/* landscape phones: tighten the chrome, never the tap targets (44px) */
@media (max-height: 560px) and (min-width: 641px) {
  .fx-pause { padding-block: max(10px, var(--safe-t)) max(10px, var(--safe-b)); }
  .fx-pi { min-height: 44px; padding-block: 8px 7px; font-size: 16px; }
  .fx-pause-main { padding-top: 14px; padding-bottom: 10px; }
  .fx-pause-head { padding-bottom: 8px; }
  .fx-pause-title { font-size: 22px; margin-top: 4px; }
  .fx-pause-menu { margin-top: 6px; }
  .fx-pause-sep { margin-block: 4px; }
  .fx-pause-status { padding-top: 18px; gap: 16px; }
  .fx-pause-status dl { gap: 16px; }
  .fx-pause-crest { display: none; }
  .fx-pause-foot { min-height: 40px; padding-block: 8px; }
}

/* ── CRT mode (Konami code) ────────────────────────────────────────────── */
.fx-crt-screen { display: none; }
html.fx-crt .fx-crt-screen {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 1400;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, .24) 2px 3px);
}
.fx-crt-glass {
  position: absolute;
  inset: 0;
  border-radius: 26px / 34px;
  background:
    radial-gradient(ellipse 115% 100% at 50% 50%, rgba(0, 0, 0, 0) 58%, rgba(0, 0, 0, .5) 100%),
    repeating-linear-gradient(90deg, rgba(255, 40, 50, .03) 0 1px, rgba(40, 255, 140, .022) 1px 2px, rgba(50, 120, 255, .03) 2px 3px);
  box-shadow:
    0 0 0 60px #040303,
    inset 5px 0 12px -6px rgba(255, 40, 70, .32),
    inset -5px 0 12px -6px rgba(0, 200, 255, .3),
    inset 0 0 90px rgba(0, 0, 0, .45);
}
.fx-crt-roll {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 26vh;
  background: linear-gradient(180deg, rgba(255, 236, 214, 0), rgba(255, 236, 214, .045) 55%, rgba(255, 236, 214, 0));
  transform: translate3d(0, -30vh, 0);
  animation: fxRoll 8s linear infinite;
  will-change: transform;
}
@keyframes fxRoll { to { transform: translate3d(0, 130vh, 0); } }
html.fx-crt body { text-shadow: .6px 0 rgba(255, 48, 60, .34), -.6px 0 rgba(50, 200, 255, .32); }

.fx-crt-flash {
  position: fixed;
  inset: 0;
  z-index: 1450;
  pointer-events: none;
  display: grid;
  place-items: center;
}
.fx-crt-flash::before {
  content: '';
  width: 100%;
  height: 2px;
  background: #fff7ee;
  box-shadow: 0 0 22px 6px rgba(255, 236, 214, .55);
}
.fx-crt-flash.is-on::before { animation: fxPowerOn .6s var(--ease-out) both; }
.fx-crt-flash.is-off::before { animation: fxPowerOff .55s var(--ease-io) both; }
@keyframes fxPowerOn {
  0% { transform: scale(0, 1); opacity: 1; }
  30% { transform: scale(1, 1); opacity: 1; }
  100% { transform: scale(1, 220); opacity: 0; }
}
@keyframes fxPowerOff {
  0% { transform: scale(1, 200); opacity: 0; }
  30% { transform: scale(1, 1); opacity: 1; }
  75% { transform: scale(.004, 1); opacity: 1; }
  100% { transform: scale(0, 1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  /* scanlines only */
  .fx-crt-glass, .fx-crt-roll, .fx-crt-flash { display: none; }
  html.fx-crt body { text-shadow: none; }
}

/* ── Cursor ring (fine pointers) ───────────────────────────────────────── */
.fx-cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1600;
  width: 0;
  height: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
  will-change: transform;
}
.fx-cursor.is-on { opacity: 1; }
.fx-cursor.is-away,
.fx-cursor.is-typing,
.fx-cursor.is-text,
.fx-cursor.is-hidden,
html.input-pad .fx-cursor,
html.input-keyboard .fx-cursor { opacity: 0; }
.fx-cursor-ring {
  position: absolute;
  left: -15px;
  top: -15px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid rgba(242, 177, 62, .55);
  box-shadow: 0 0 14px rgba(242, 177, 62, .16), inset 0 0 8px rgba(242, 177, 62, .07);
  transition: transform .4s var(--ease-out), background-color .3s, border-color .3s;
}
.fx-cursor.is-hover .fx-cursor-ring {
  transform: scale(1.55);
  border-color: rgba(242, 177, 62, .85);
  background: rgba(242, 177, 62, .06);
}
.fx-cursor.is-down .fx-cursor-ring { transform: scale(.78); transition-duration: .12s; }
.fx-cursor.is-hover.is-down .fx-cursor-ring { transform: scale(1.3); }
html.is-touch .fx-cursor { display: none; }
@media (hover: none), (pointer: coarse) { .fx-cursor { display: none; } }
