/* Rashikulab Fushimi walk — mobile web HUD. Colours / 9-slice textures follow spec_hud_flow.md (UE ui_layout.py).
   --k scales the whole HUD (set by hud.js from the viewport: 1 at 844x390, a typical phone held sideways). */
:root {
  --navy: #1B2A55; --navy-d: #131E40; --pink: #F5267E; --lime: #CDEB2C; --cyan: #2EC4F0; --grey: #C9CDD6;
  --pale-pink: #FFE1EE; --dim: rgba(14, 22, 48, .55); --k: 1;
  --font: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
}
/* M PLUS Rounded 1c (SIL OFL) comes from Google Fonts in index.html (subset per glyph range) */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0e1630; color: var(--navy);
  font-family: var(--font); font-weight: 700; -webkit-user-select: none; user-select: none; touch-action: none;
  overscroll-behavior: none; -webkit-touch-callout: none; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; outline: none; }
#ui { position: fixed; inset: 0; pointer-events: none; font-size: calc(14px * var(--k)); }
#ui .hit, #ui button { pointer-events: auto; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- 9-slice panels (border-image; outset = the texture's shadow margin p/2) */
.s-card { border: solid transparent; border-width: calc(14px * var(--k)); border-image: url(../assets/ui/T_UI_S_Card.png) 66 fill / calc(14px * var(--k)) / calc(6px * var(--k)); }
.s-navy { border: solid transparent; border-width: calc(12px * var(--k)); border-image: url(../assets/ui/T_UI_S_Navy.png) 58 fill / calc(12px * var(--k)) / calc(5px * var(--k)); }
.s-pill { border: solid transparent; border-width: calc(14px * var(--k)); border-image: url(../assets/ui/T_UI_S_NavyPill.png) 70 fill / calc(14px * var(--k)) / calc(4px * var(--k)); }
.s-solid { border: solid transparent; border-width: calc(9px * var(--k)); border-image: url(../assets/ui/T_UI_S_NavySolid.png) 46 fill / calc(9px * var(--k)) / 0; }
.s-pink { border: solid transparent; border-width: calc(11px * var(--k)); border-image: url(../assets/ui/T_UI_S_PinkPill.png) 54 fill / calc(11px * var(--k)) / calc(2px * var(--k)); }
.s-white { border: solid transparent; border-width: calc(16px * var(--k)); border-image: url(../assets/ui/T_UI_S_WhitePill.png) 90 fill / calc(16px * var(--k)) / calc(5px * var(--k)); }
.s-sel { border: solid transparent; border-width: calc(16px * var(--k)); border-image: url(../assets/ui/T_UI_S_SelPill.png) 98 fill / calc(16px * var(--k)) / calc(7px * var(--k)); }
.s-key { border: solid transparent; border-width: calc(7px * var(--k)); border-image: url(../assets/ui/T_UI_S_Key.png) 34 fill / calc(7px * var(--k)) / 1px; }

/* ---------- rotate + boot */
.rotate { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #2EC4F0, #1B2A55); color: #fff; text-align: center; }
.rotate-card { padding: 28px; font-size: 18px; }
.rotate-icon { width: 64px; height: 100px; margin: 0 auto 18px; border: 5px solid #fff; border-radius: 12px; animation: rot 2.2s ease-in-out infinite; }
@keyframes rot { 0%, 25% { transform: rotate(0); } 55%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (pointer: coarse) { .rotate { display: flex; } }
.boot { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #ffffff, #dff4fd 60%, #bfe6f7); gap: 12px; transition: opacity .5s; }
.boot.out { opacity: 0; pointer-events: none; }
.boot-logo { width: min(60vw, 420px); }
.boot-bar { width: min(60vw, 420px); height: 12px; border-radius: 6px; background: #DDE1EA; overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 0; background: var(--pink); border-radius: 6px; transition: width .2s; }
.boot p { margin: 0; color: var(--navy); font-size: 15px; }
.boot .boot-note { font-size: 12px; opacity: .7; }
.boot .err { color: #c0143c; max-width: 80vw; text-align: center; }

/* ---------- touch stick */
.stick { position: fixed; width: calc(130px * var(--k)); height: calc(130px * var(--k)); margin: calc(-65px * var(--k)) 0 0 calc(-65px * var(--k));
  border-radius: 50%; background: rgba(27, 42, 85, .22); border: 2px solid rgba(255, 255, 255, .55); display: none; pointer-events: none; }
.stick.on { display: block; }
.stick i { position: absolute; left: 50%; top: 50%; width: 46%; height: 46%; border-radius: 50%; background: rgba(255, 255, 255, .85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25); transform: translate(-50%, -50%); }
.stick-hint { position: absolute; left: calc(40px * var(--k) + var(--sl)); bottom: calc(34px * var(--k) + var(--sb)); width: calc(96px * var(--k)); height: calc(96px * var(--k));
  border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .6); display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .8em; text-shadow: 0 1px 3px #1B2A55; opacity: .8; }
#touch { position: absolute; inset: 0; pointer-events: auto; }

/* ---------- in-game HUD */
.hud { position: absolute; inset: 0; }
.hud-logo { position: absolute; left: calc(8px + var(--sl)); top: calc(4px + var(--st)); width: calc(150px * var(--k)); }
.obj { position: absolute; right: calc(150px * var(--k) + var(--sr)); top: calc(22px + var(--st)); min-width: calc(150px * var(--k)); padding: .9em .9em .3em .7em;
  line-height: 1.35; font-size: .95em; }
.obj .tab { position: absolute; left: -0.6em; top: -1.9em; padding: 0 .55em; color: #fff; font-weight: 900; font-size: .85em; display: flex; align-items: center; gap: .3em; }
.obj .tab img { width: 1.2em; }
.obj .pin { position: absolute; right: -0.4em; bottom: -0.2em; width: 1.7em; animation: bob 2.1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-3px); } }
.mini { position: absolute; right: calc(6px + var(--sr)); top: calc(4px + var(--st)); width: calc(138px * var(--k)); height: calc(138px * var(--k)); }
.mini canvas { position: absolute; inset: 8%; width: 84%; height: 84%; border-radius: 50%; }
.mini img { position: absolute; inset: 0; width: 100%; height: 100%; }
.dist { position: absolute; right: calc(14px + var(--sr)); top: calc(146px * var(--k) + var(--st)); color: #fff; padding: .1em .8em .1em .4em;
  display: flex; align-items: center; gap: .35em; font-size: .85em; white-space: nowrap; }
.dist img { width: 1.7em; }
.dist b { font-weight: 900; font-size: 1.6em; }
.stamps { position: absolute; left: calc(10px + var(--sl)); top: calc(56px * var(--k) + var(--st)); padding: .2em .5em .3em; }
.stamps .head { color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 0 .5em; font-weight: 900; font-size: .85em; gap: 1em; }
.stamps .slots { display: flex; gap: .2em; margin-top: .25em; }
.stamps .slots img { width: calc(22px * var(--k)); height: calc(22px * var(--k)); }
.battle { position: absolute; left: calc(10px + var(--sl)); top: calc(118px * var(--k) + var(--st)); color: #fff; padding: .1em .8em; display: flex; gap: .6em; align-items: center; font-size: .85em; }
.battle .b { color: var(--pink); font-weight: 900; }
.battle img { width: 1.1em; }
.battle img.off { filter: grayscale(1) brightness(1.6); opacity: .6; }
.fps { position: absolute; right: calc(8px + var(--sr)); bottom: calc(4px + var(--sb)); color: #fff; font-weight: 900; font-size: .75em;
  text-shadow: 0 0 2px var(--navy), 0 0 2px var(--navy); }

/* round buttons (photo / map / menu) under the minimap's left edge */
.rbtns { position: absolute; right: calc(150px * var(--k) + var(--sr)); top: calc(78px * var(--k) + var(--st)); display: flex; gap: calc(6px * var(--k)); }
.rbtn { width: calc(44px * var(--k)); height: calc(44px * var(--k)); background: url(../assets/ui/T_UI_RoundBtn.png) center / contain no-repeat;
  display: flex; align-items: center; justify-content: center; }
.rbtn img { width: 46%; }
/* action buttons bottom right */
.acts { position: absolute; right: calc(14px + var(--sr)); bottom: calc(14px + var(--sb)); width: calc(220px * var(--k)); height: calc(190px * var(--k)); }
.act { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .88); border: 3px solid var(--lime); color: var(--navy);
  box-shadow: 0 3px 10px rgba(14, 22, 48, .35); display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 900; font-size: .78em; line-height: 1.05; }
.act.on, .act:active { background: var(--pink); color: #fff; border-color: #fff; }
.act img { width: 44%; margin-bottom: 2px; }
.act.jump { right: 0; bottom: 0; width: calc(84px * var(--k)); height: calc(84px * var(--k)); font-size: .9em; }
.act.run { right: calc(94px * var(--k)); bottom: calc(-4px * var(--k)); width: calc(60px * var(--k)); height: calc(60px * var(--k)); }
.act.use { right: calc(10px * var(--k)); bottom: calc(96px * var(--k)); width: calc(74px * var(--k)); height: calc(74px * var(--k)); border-color: var(--pink); }
.act.gun { right: calc(160px * var(--k)); bottom: calc(-4px * var(--k)); width: calc(56px * var(--k)); height: calc(56px * var(--k)); }
.act.fire { right: calc(92px * var(--k)); bottom: calc(66px * var(--k)); width: calc(72px * var(--k)); height: calc(72px * var(--k)); border-color: var(--pink); }
.act.aim { right: calc(166px * var(--k)); bottom: calc(66px * var(--k)); width: calc(52px * var(--k)); height: calc(52px * var(--k)); }
.act.battleb { right: calc(220px * var(--k)); bottom: calc(-4px * var(--k)); width: calc(52px * var(--k)); height: calc(52px * var(--k)); font-size: .7em; }
.use.pulse { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(245, 38, 126, .25); } }
.cross { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(27, 42, 85, .6); }
.cross::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; background: var(--lime); border-radius: 50%; }

.prompt { position: absolute; left: 50%; bottom: calc(26% + var(--sb)); transform: translateX(-50%); color: #fff; padding: .15em 1em; white-space: nowrap;
  display: flex; align-items: center; gap: .5em; font-size: .95em; }
.prompt .key { color: var(--navy); font-weight: 900; padding: 0 .1em; font-size: .8em; }
.toast { position: absolute; left: 50%; top: calc(18% + var(--st)); transform: translateX(-50%); color: #fff; padding: .15em 1.1em; white-space: nowrap;
  font-size: .95em; transition: opacity .25s; }
.toast.off { opacity: 0; }
.dlg { position: absolute; left: calc(12px + var(--sl)); right: calc(250px * var(--k) + var(--sr)); bottom: calc(14px + var(--sb)); min-height: calc(78px * var(--k));
  padding: .5em .9em .6em calc(92px * var(--k)); line-height: 1.45; }
.dlg .face { position: absolute; left: calc(-6px * var(--k)); bottom: calc(-6px * var(--k)); width: calc(96px * var(--k)); }
.dlg .name { position: absolute; left: calc(88px * var(--k)); top: auto; bottom: 100%; margin-bottom: -.6em; padding: 0 .6em; color: #fff; font-weight: 900; font-size: .85em; }
.dlg .next { position: absolute; right: .6em; bottom: .2em; width: 1em; animation: bob 1s ease-in-out infinite; }
.photo-bar { position: absolute; left: 50%; bottom: calc(10px + var(--sb)); transform: translateX(-50%); display: flex; gap: .6em; align-items: center; }
.photo-bar .s-pill { color: #fff; padding: 0 .8em; white-space: nowrap; font-size: .85em; }
.shutter { width: calc(64px * var(--k)); height: calc(64px * var(--k)); border-radius: 50%; background: #fff; border: 5px solid var(--pink); }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; transition: opacity .35s; pointer-events: none; }
.flash.on { opacity: .9; transition: none; }
.shot-preview { position: absolute; right: calc(16px + var(--sr)); top: calc(16px + var(--st)); width: 28%; border: 4px solid #fff; border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4); background: #fff; }
.shot-preview img { width: 100%; display: block; }
.shot-preview .row { display: flex; gap: 4px; padding: 4px; }
.shot-preview .row button { flex: 1; background: var(--pink); color: #fff; border-radius: 99px; padding: .3em; font-weight: 900; font-size: .8em; }
.shot-preview .row button.sub { background: var(--navy); }

/* ---------- menus */
.screen { position: absolute; inset: 0; pointer-events: auto; display: flex; align-items: center; justify-content: center; }
.screen.dim { background: var(--dim); }
.title { background: #9fd8f3 url(../assets/ui/T_UI_TitleBG.jpg) center / cover no-repeat; justify-content: flex-start; }
.title .col { margin-left: calc(28px * var(--k) + var(--sl)); display: flex; flex-direction: column; gap: calc(7px * var(--k)); width: calc(250px * var(--k)); }
.title .logo { width: calc(250px * var(--k)); margin-bottom: calc(4px * var(--k)); filter: drop-shadow(0 2px 6px rgba(255, 255, 255, .7)); }
.title .credit { position: absolute; left: calc(10px + var(--sl)); bottom: calc(4px + var(--sb)); font-size: .58em; color: var(--navy); opacity: .85;
  max-width: 70%; text-shadow: 0 0 3px #fff; }
.mbtn { display: flex; align-items: center; gap: .55em; padding: .05em .5em; min-height: calc(40px * var(--k)); font-weight: 900; font-size: 1em; text-align: left; position: relative; }
.mbtn img { width: 1.4em; height: 1.4em; }
.mbtn.s-white img { filter: brightness(0) saturate(100%) invert(12%) sepia(30%) saturate(2700%) hue-rotate(205deg); }
.mbtn.s-sel { color: #fff; }
.mbtn.s-sel::after { content: "▶"; position: absolute; right: .6em; font-size: .7em; animation: nudge .9s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(4px); } }
.card { position: relative; padding: 1.1em 1.2em 1em; max-height: calc(100% - 40px); }
.card .tab { position: absolute; left: .4em; top: -1.15em; padding: 0 .6em; color: #fff; font-weight: 900; display: flex; align-items: center; gap: .35em; z-index: 1; }
.card .tab img { width: 1.25em; }
.pause .card { width: calc(290px * var(--k)); display: flex; flex-direction: column; gap: calc(6px * var(--k)); }
.hint { position: absolute; left: 50%; bottom: calc(6px + var(--sb)); transform: translateX(-50%); color: #fff; font-size: .8em; white-space: nowrap;
  text-shadow: 0 0 3px var(--navy), 0 0 3px var(--navy); }
.confirm .card { width: calc(330px * var(--k)); text-align: center; }
.confirm h2 { margin: .3em 0 .2em; font-size: 1.25em; font-weight: 900; }
.confirm p { margin: 0 0 .8em; font-size: .8em; }
.confirm .row { display: flex; gap: .8em; justify-content: center; }
.confirm .row .mbtn { flex: 1; justify-content: center; }
.settings .card, .howto .card { width: min(calc(560px * var(--k)), calc(100% - 30px)); height: calc(100% - 46px); padding-right: .6em; }
.scroll { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-right: .5em; overscroll-behavior: contain; }
.sec { display: flex; align-items: center; gap: .4em; color: var(--pink); font-weight: 900; margin: .55em 0 .2em; }
.sec img { width: 1.2em; filter: brightness(0) saturate(100%) invert(26%) sepia(92%) saturate(4000%) hue-rotate(320deg); }
.sec::after { content: ""; flex: 1; height: 2px; background: rgba(245, 38, 126, .35); }
.sec .muted { margin-left: auto; order: 3; background: var(--pink); color: #fff; border-radius: 99px; padding: 0 .7em; font-size: .75em; }
.row-set { display: flex; align-items: center; min-height: calc(36px * var(--k)); padding: 0 .4em; border-radius: 10px; gap: .5em; }
.row-set.sel { background: var(--pale-pink); box-shadow: inset 4px 0 0 var(--pink); }
.row-set .lbl { flex: 1; }
.row-set .ctl { display: flex; align-items: center; gap: .3em; }
.row-set .arr { width: calc(30px * var(--k)); height: calc(30px * var(--k)); border-radius: 50%; background: #fff; color: var(--pink); font-weight: 900; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.row-set .bar { width: calc(120px * var(--k)); height: 10px; border-radius: 5px; background: #DDE1EA; overflow: hidden; }
.row-set .bar i { display: block; height: 100%; background: var(--pink); }
.row-set .val { min-width: 4.4em; text-align: center; font-weight: 900; }
.row-set .num { min-width: 1.6em; text-align: right; font-weight: 900; }
.howto h3 { color: var(--pink); font-weight: 900; margin: .4em 0 .2em; font-size: 1.05em; }
.howto table { border-collapse: collapse; width: 100%; font-size: .88em; }
.howto td { padding: .18em .3em; vertical-align: middle; }
.howto td.k { width: 8.5em; }
.howto .kc { display: inline-block; padding: 0 .5em; font-weight: 900; font-size: .85em; min-width: 2em; text-align: center; color: var(--navy); }
.howto p { margin: .3em 0; font-size: .85em; line-height: 1.5; }
.howto .credits { color: #5A6380; font-size: .7em; line-height: 1.5; }
.bigmap .card { padding: 8px; height: calc(100% - 30px); aspect-ratio: 1; }
.bigmap canvas { width: 100%; height: 100%; border-radius: 10px; display: block; }
.bigmap .legend { position: absolute; right: 14px; bottom: 14px; background: rgba(255, 255, 255, .92); border-radius: 10px; padding: .2em .6em;
  display: flex; gap: .7em; align-items: center; font-size: .75em; }
.bigmap .legend img { width: 1.3em; vertical-align: middle; }
.close-x { position: absolute; right: calc(12px + var(--sr)); top: calc(10px + var(--st)); width: calc(44px * var(--k)); height: calc(44px * var(--k));
  border-radius: 50%; background: #fff; color: var(--navy); font-weight: 900; font-size: 1.3em; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); pointer-events: auto; z-index: 3; }

/* celebration */
.celeb { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); text-align: center; color: #fff; pointer-events: none; animation: pop .6s cubic-bezier(.2, 1.6, .4, 1); }
.celeb h1 { margin: 0; font-size: 2.3em; font-weight: 900; color: var(--pink); -webkit-text-stroke: 1px #fff;
  text-shadow: 0 0 0 #fff, 3px 3px 0 #fff, -3px 3px 0 #fff, 3px -3px 0 #fff, -3px -3px 0 #fff, 0 6px 14px rgba(27, 42, 85, .4); }
.celeb p { margin: .3em 0 0; display: inline-block; background: var(--navy); border-radius: 99px; padding: .2em 1.1em; font-size: .95em; }
@keyframes pop { from { transform: translateX(-50%) scale(.3); opacity: 0; } }
.confetti { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; pointer-events: none; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.ko { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(14, 22, 48, .45); color: #fff; font-size: 1.6em; font-weight: 900; }

/* ===================================================================== hud.js additions (keep the classes above) */
:root { --f-navy: brightness(0) saturate(100%) invert(12%) sepia(30%) saturate(2700%) hue-rotate(205deg);
  --f-pink: brightness(0) saturate(100%) invert(26%) sepia(92%) saturate(4000%) hue-rotate(320deg); }
/* touch vs keyboard variants (hud.js puts .touchmode or .pc on #ui) */
#ui.pc .t-only, #ui.touchmode .k-only { display: none !important; }
#ui.pc #touch { pointer-events: none; }            /* mouse goes to the canvas (pointer lock / wheel) */
.menus { position: absolute; inset: 0; pointer-events: none; }
.menus > * { pointer-events: auto; }
.fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; }
.hurt { position: absolute; inset: 0; background: rgba(255, 0, 89, .28); pointer-events: none; }

/* title */
.title { overflow: hidden; }
.title .title-bg { position: absolute; inset: 0; background: center / cover no-repeat; will-change: transform; }
.title .spk { position: absolute; width: 20px; height: 20px; transform: translate(-50%, -50%); pointer-events: none; }
.title .col { position: absolute; margin: 0; left: calc(28px * var(--k) + var(--sl)); bottom: calc(60px * var(--k) + var(--sb)); gap: calc(6px * var(--k)); }
.title .mbtn { min-height: calc(36px * var(--k)); }
.title .hint { left: calc(28px * var(--k) + var(--sl)); transform: none; bottom: calc(30px * var(--k) + var(--sb)); padding: 0 .8em; font-size: .7em; text-shadow: none; }
.gate { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: .3em;
  padding-bottom: calc(70px * var(--k) + var(--sb)); background: rgba(255, 255, 255, .12); pointer-events: auto; cursor: pointer; }
.gate p { margin: 0; background: var(--pink); color: #fff; border: 3px solid #fff; border-radius: 99px; padding: .3em 1.4em; font-weight: 900; font-size: 1.15em;
  box-shadow: 0 4px 14px rgba(27, 42, 85, .35); animation: blink 1.3s ease-in-out infinite; }
.gate small { color: var(--navy); font-size: .7em; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
@keyframes blink { 50% { transform: scale(1.06); } }

/* toast / caption / prompt */
.toast.at-title { top: auto; bottom: calc(64px * var(--k) + var(--sb)); }
.toast.at-pause { top: calc(4% + var(--st)); }
.caption { position: absolute; left: 50%; top: calc(30% + var(--st)); transform: translateX(-50%); color: #fff; padding: .1em 1em; font-size: .85em;
  white-space: nowrap; max-width: 72vw; overflow: hidden; text-overflow: ellipsis; }
.prompt:not(.press) .key { display: none; }

/* HUD pieces */
.mini canvas { inset: 12.4%; width: 75.2%; height: 75.2%; }
.mini .ring { will-change: transform; }
.dist .dt { display: flex; flex-direction: column; line-height: 1.05; }
.dist small { font-size: .78em; }
.dist em, .dist i { font-style: normal; font-size: .85em; }
.dist em { margin-right: .2em; }
.dist i { margin-left: .2em; }
.stamps .sicon { width: 1.7em; margin: -.5em 0 -.4em -.9em; }
.stamps .head .n { margin-left: auto; font-size: 1.15em; }
.stamps.bump { animation: bumpS .55s ease-out; }
@keyframes bumpS { 30% { transform: scale(1.12); } }
.battle .hearts { display: flex; gap: .12em; }
.battle .hearts img { width: 1.1em; filter: var(--f-pink); opacity: 1; }
.battle .hearts img.off { filter: brightness(0) invert(.82); opacity: .6; }
.guide { position: absolute; left: calc(10px + var(--sl)); top: calc(152px * var(--k) + var(--st)); color: #fff; padding: .25em .45em .4em; font-size: .74em; }
.guide .gh { display: flex; align-items: center; gap: .3em; padding: 0 .5em; font-weight: 900; color: #fff; }
.guide .gh img { width: 1.5em; }
.guide .gr { display: flex; align-items: center; gap: .5em; margin-top: .32em; white-space: nowrap; }
.guide .kc { color: var(--navy); font-weight: 900; font-size: .85em; min-width: 3.9em; text-align: center; padding: 0 .3em; }
.rbtn { position: relative; }
.rbtn span { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .62em; font-weight: 900; color: var(--navy);
  text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 2px #fff; display: flex; gap: .25em; align-items: center; margin-top: 1px; }
.rbtn kbd { font: inherit; font-size: .9em; padding: 0 .25em; text-shadow: none; }
.act img { filter: var(--f-navy); }
.act.on img, .act:active img { filter: none; }
.cross.aim { width: 14px; height: 14px; margin: -7px 0 0 -7px; }
#ui.touchmode .fps { right: auto; left: 50%; bottom: auto; top: calc(2px + var(--st)); transform: translateX(-50%); }

/* dialogue */
.dlg { pointer-events: auto; }
.dlg .ln { min-height: 1.45em; white-space: nowrap; }
.dlg .nx { position: absolute; right: .6em; bottom: .15em; display: flex; align-items: center; gap: .2em; font-size: .7em; font-weight: 900; }
.dlg .nx .next { position: static; width: 1.5em; filter: var(--f-navy); }

/* photo mode */
.photo-ui { position: absolute; inset: 0; }
.photo-ui .pshut { position: absolute; right: calc(30px * var(--k) + var(--sr)); top: 50%; margin-top: calc(-32px * var(--k)); box-shadow: 0 3px 12px rgba(0, 0, 0, .35); }
.photo-ui .pshut:active { transform: scale(.92); }
.zbtn { position: absolute; right: calc(40px * var(--k) + var(--sr)); width: calc(44px * var(--k)); height: calc(44px * var(--k)); border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: var(--navy); font-size: 1.4em; font-weight: 900; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.zbtn.zin { top: calc(50% - 92px * var(--k)); }
.zbtn.zout { top: calc(50% + 48px * var(--k)); }
.pback { position: absolute; left: calc(12px + var(--sl)); top: calc(10px + var(--st)); display: flex; gap: .3em; align-items: center; background: #fff;
  color: var(--navy); border-radius: 99px; padding: .3em .9em; font-weight: 900; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.pback img { width: 1.2em; filter: var(--f-navy); }

/* settings / how-to */
.row-set { cursor: pointer; }
.row-set.back img { width: 1.3em; vertical-align: middle; margin-right: .35em; filter: var(--f-navy); }
.howto .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2em; }
.howto .kc { white-space: nowrap; }
@media (max-width: 600px) { .howto .cols { grid-template-columns: 1fr; } }

/* celebration overlay (§11.3) */
.cel { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cel .confetti { animation-fill-mode: both; }
.cel-warm { position: absolute; inset: 0; background: rgba(255, 243, 214, .55); animation: celWarm .3s linear forwards; }
@keyframes celWarm { to { opacity: 0; } }
.cel-box { position: absolute; left: 50%; top: calc(5% + var(--st)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.cel-title { margin: 0; font-size: calc(46px * var(--k)); font-weight: 900; color: var(--pink); line-height: 1.1;
  text-shadow: 3px 3px 0 #fff, -3px 3px 0 #fff, 3px -3px 0 #fff, -3px -3px 0 #fff, 0 3px 0 #fff, 0 -3px 0 #fff, 0 7px 0 var(--navy), 0 8px 14px rgba(27, 42, 85, .4);
  animation: celPop .45s cubic-bezier(.2, 1.6, .4, 1) .15s both; }
.cel-card { position: relative; margin-top: .5em; width: calc(310px * var(--k)); text-align: center; padding: 1em .8em .5em;
  animation: celPop .35s cubic-bezier(.2, 1.5, .4, 1) .6s both; }
.cel-pill { position: absolute; left: 0; right: 0; margin: 0 auto; width: max-content; top: -1.2em; color: #fff; white-space: nowrap; padding: 0 .8em;
  display: flex; gap: .3em; align-items: center; font-weight: 900; font-size: .95em; animation: celFade .2s .95s both; }
.cel-pill img { width: 1.2em; }
.cel-slots { display: flex; justify-content: center; gap: .35em; margin-top: .45em; }
.cel-slots img { width: calc(30px * var(--k)); animation: celPop .25s cubic-bezier(.2, 1.8, .4, 1) both; }
.cel-time { display: flex; align-items: center; justify-content: center; gap: .5em; margin-top: .45em; animation: celFade .25s 1.9s both; }
.cel-time span { color: #fff; font-size: .85em; padding: 0 .6em; font-weight: 900; }
.cel-time b { font-size: 1.7em; font-weight: 900; color: var(--navy); }
.cel-msg { margin: .35em 0 0; color: var(--pink); font-weight: 900; font-size: .9em; animation: celFade .3s 2.4s both; }
@keyframes celPop { from { transform: scale(.3); opacity: 0; } }
@keyframes celFade { from { opacity: 0; transform: translateY(6px); } }
.ko span { font-size: .6em; opacity: .9; }

/* ---------- phone-height layout (landscape phones are ~340-430 px tall): compact HUD, no overlaps (integrator) */
@media (max-height: 520px) {
  .title .col { width: calc(210px * var(--k)); bottom: calc(34px * var(--k) + var(--sb)); gap: calc(4px * var(--k)); }
  .title .mbtn { min-height: calc(28px * var(--k)); font-size: .86em; border-width: calc(10px * var(--k)); border-image-width: calc(10px * var(--k)); }
  .stamps { transform: scale(.82); transform-origin: 0 0; top: calc(50px * var(--k) + var(--st)); }
  .guide { transform: scale(.8); transform-origin: 0 0; top: calc(118px * var(--k) + var(--st)); }
  .dlg { left: calc(12% + var(--sl)); right: calc(43% + var(--sr)); bottom: calc(8px + var(--sb)); min-height: 0;
    padding: .35em .7em .45em calc(70px * var(--k)); font-size: .92em; }
  .dlg .face { width: calc(72px * var(--k)); left: calc(-10px * var(--k)); }
  .dlg { padding-top: .5em; }
  .dlg .name { left: calc(62px * var(--k)); }
  .rbtns { top: calc(98px * var(--k) + var(--st)); }
  .obj { font-size: .85em; }
}
@media (pointer: coarse) { .title .hint { display: none; } }
/* while a dialogue is on screen the guide steps aside */
.hud.talking .guide { display: none; }

/* PWA install button + iOS tip (js/pwa.js) */
.install { position: fixed; z-index: 45; top: calc(10px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right));
  font: 900 14px "M PLUS Rounded 1c", system-ui, sans-serif; color: #fff; background: var(--pink); border: 3px solid #fff;
  border-radius: 999px; padding: .45em 1.1em; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); cursor: pointer; }
.install.hidden, .install-tip.hidden { display: none; }
.install-tip { position: fixed; z-index: 46; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(14, 22, 48, .6); }
.install-tip p { margin: 0 0 .8em; line-height: 1.6; }
.install-tip > * { font: 700 15px "M PLUS Rounded 1c", system-ui, sans-serif; }
.install-tip { flex-direction: column; }
.install-tip p, .install-tip button { background: #fff; color: var(--navy); }
.install-tip p { padding: 1em 1.4em; border-radius: 16px; border: 4px solid var(--lime); text-align: center; }
.install-tip button { border: 0; border-radius: 999px; padding: .4em 2em; background: var(--pink); color: #fff; font-weight: 900; }
