/* =====================================================================================================
   第零処理区 — base, title, HUD. Design tokens shared with css/ui.css (windows, cards, tabs).
   A cold night palette with one warm accent (amber = "what to do next"), teal = information,
   red = danger, green = safe / saved. Numbers in a monospace face so counters do not jump.
   ===================================================================================================== */
:root {
  --bg: #06080b;
  --panel: rgba(12, 16, 22, 0.84);
  --panel-solid: #0e131a;
  --panel-2: #141b24;
  --panel-3: #1b2430;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #e9edf1;
  --dim: #a3aebb;
  --faint: #6b7785;
  --accent: #ffb02e;
  --accent-ink: #1a1203;
  --info: #4fd1c5;
  --blue: #6aa8ff;
  --danger: #ff4f4f;
  --ok: #4ade80;
  --warn: #fb923c;
  --violet: #b394ff;
  --r: 12px;
  --r-sm: 8px;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.35), 0 12px 40px rgba(0, 0, 0, 0.45);
  --font: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  --serif: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --fs: 16px;
  --gut: 16px;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body.hc {
  --panel: rgba(0, 0, 0, 0.95);
  --dim: #d6dde4;
  --faint: #aab4be;
  --line: rgba(255, 255, 255, 0.3);
}
#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.hidden {
  display: none !important;
}
button {
  font: inherit;
  color: inherit;
}
kbd,
.key {
  display: inline-grid;
  place-items: center;
  min-width: 1.6em;
  height: 1.6em;
  padding: 0 0.4em;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  background: rgba(255, 255, 255, 0.06);
  font-family: var(--mono);
  font-size: 0.78em;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  vertical-align: 0.1em;
}
.btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.08s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover {
  background: var(--panel-3);
  border-color: rgba(255, 255, 255, 0.28);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.primary:hover {
  background: #ffc35c;
}
.btn.danger {
  background: rgba(255, 79, 79, 0.14);
  border-color: rgba(255, 79, 79, 0.5);
  color: #ffb4b4;
}
.btn.ok {
  background: rgba(74, 222, 128, 0.14);
  border-color: rgba(74, 222, 128, 0.45);
  color: #bdf5d0;
}
.btn.ghost {
  background: transparent;
}
.btn.big {
  font-size: 1.08em;
  padding: 12px 26px;
  min-height: 52px;
}
.btn.sm {
  padding: 6px 12px;
  min-height: 36px;
  font-size: 0.9em;
}
.btn .num {
  font-family: var(--mono);
  font-size: 0.78em;
  opacity: 0.7;
}

/* ---- fade / overlay -------------------------------------------------------------------------------- */
#fade {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s;
  z-index: 40;
}
#fade.on {
  opacity: 1;
}
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  background: #000 center/cover no-repeat;
}

/* ---- title ----------------------------------------------------------------------------------------- */
#title {
  background-color: #040506;
}
#title::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(120% 90% at 70% 30%, rgba(0, 0, 0, 0) 0%, rgba(3, 4, 6, 0.75) 60%, rgba(3, 4, 6, 0.96) 100%),
    linear-gradient(90deg, rgba(3, 4, 6, 0.95) 0%, rgba(3, 4, 6, 0.7) 45%, rgba(3, 4, 6, 0.15) 100%);
  pointer-events: none;
}
.title-wrap {
  position: relative;
  min-height: 100%;
  display: flex;
  align-items: center;
  padding: 32px var(--gut);
}
.title-box {
  max-width: 640px;
  width: 100%;
}
.kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.82em;
  letter-spacing: 0.12em;
  font-weight: 700;
}
.logo {
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.logo-k {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(44px, 9vw, 84px);
  letter-spacing: 0.08em;
  line-height: 1.05;
  text-shadow: 0 0 24px rgba(79, 209, 197, 0.18);
}
.logo-en {
  font-family: var(--mono);
  font-size: 0.9em;
  letter-spacing: 0.5em;
  color: var(--info);
}
.lead {
  color: #cfd6de;
  line-height: 1.85;
  margin: 0 0 18px;
}
.appeal {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.appeal li {
  background: rgba(14, 19, 26, 0.72);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  backdrop-filter: blur(4px);
}
.appeal b {
  display: block;
  font-size: 0.95em;
  margin-bottom: 2px;
}
.appeal span {
  color: var(--dim);
  font-size: 0.84em;
  line-height: 1.6;
}
.title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.hint {
  color: var(--dim);
  font-size: 0.84em;
  line-height: 1.7;
  margin: 8px 0;
}
.keys-hint {
  color: var(--faint);
  font-size: 0.78em;
}
.notice {
  color: var(--faint);
  font-size: 0.74em;
  line-height: 1.7;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 14px;
}

/* ---- HUD ------------------------------------------------------------------------------------------- */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  font-size: var(--fs);
}
.hud-hide #hud > :not(#sub):not(#fade) {
  opacity: 0 !important;
}
#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  --g: 7px;
}
#crosshair i {
  position: absolute;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.9);
  transition: transform 0.08s;
}
#crosshair i:nth-child(1),
#crosshair i:nth-child(2) {
  width: 2px;
  height: 7px;
  left: -1px;
}
#crosshair i:nth-child(1) {
  top: calc(-1 * var(--g) - 7px);
}
#crosshair i:nth-child(2) {
  top: var(--g);
}
#crosshair i:nth-child(3),
#crosshair i:nth-child(4) {
  height: 2px;
  width: 7px;
  top: -1px;
}
#crosshair i:nth-child(3) {
  left: calc(-1 * var(--g) - 7px);
}
#crosshair i:nth-child(4) {
  left: var(--g);
}
#crosshair.dot {
  --g: 0px;
}
#crosshair.dot i {
  width: 4px !important;
  height: 4px !important;
  border-radius: 50%;
  left: -2px !important;
  top: -2px !important;
  opacity: 0.8;
}
#crosshair.dot i:nth-child(n + 2) {
  display: none;
}
#crosshair.target i {
  background: var(--accent);
}
#crosshair.enemy i {
  background: var(--danger);
}
#hitmark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  opacity: 0;
  background:
    linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
  -webkit-mask: radial-gradient(circle, transparent 6px, #000 7px);
  mask: radial-gradient(circle, transparent 6px, #000 7px);
}
#hitmark.on {
  animation: hit 0.25s ease-out;
}
#hitmark.head {
  filter: drop-shadow(0 0 3px var(--danger)) sepia(1) saturate(8) hue-rotate(-20deg);
}
@keyframes hit {
  from {
    opacity: 1;
    transform: scale(1.3);
  }
  to {
    opacity: 0;
    transform: scale(1);
  }
}

#prompt {
  position: absolute;
  left: 50%;
  top: calc(50% + 34px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 6px 14px 6px 6px;
  font-size: 0.95em;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.12s;
}
#prompt.on {
  opacity: 1;
}
#prompt .key {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
#prompt .verb {
  color: var(--accent);
  font-weight: 700;
}
#prompt .what {
  color: var(--text);
}
#prompt .note {
  color: var(--faint);
  font-size: 0.85em;
}
#prompt.locked .key {
  background: var(--panel-3);
  color: var(--dim);
  border-color: var(--line-2);
}
#prompt.locked .verb {
  color: var(--dim);
}
#prompt .hold {
  width: 18px;
  height: 18px;
}

/* subtitles */
#sub {
  position: absolute;
  left: 50%;
  bottom: 150px;
  transform: translateX(-50%);
  width: min(680px, calc(100vw - 32px));
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
#sub .line {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(4, 6, 9, 0.82);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 1.02em;
  line-height: 1.6;
  text-align: left;
  border: 1px solid var(--line);
  animation: subin 0.25s ease-out;
}
#sub .line img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex: none;
  border: 1px solid var(--line-2);
}
#sub .who {
  color: var(--info);
  font-weight: 700;
  margin-right: 4px;
  white-space: nowrap;
}
#sub .line.radio {
  border-color: rgba(79, 209, 197, 0.35);
}
#sub .line.radio .who::before {
  content: "📻 ";
}
#sub .line.thought {
  color: #cdd5de;
  font-style: italic;
}
#sub .line.sfx {
  color: var(--dim);
  font-size: 0.88em;
}
#sub .line.sfx::before {
  content: "♪ ";
}
@keyframes subin {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* objective card (top right) */
#objective {
  position: absolute;
  right: var(--gut);
  top: var(--gut);
  width: min(360px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
#objective .ob-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78em;
  color: var(--dim);
  margin-bottom: 8px;
}
#objective .ch {
  font-family: var(--mono);
  font-weight: 700;
  background: rgba(79, 209, 197, 0.14);
  color: var(--info);
  border-radius: 6px;
  padding: 1px 7px;
}
#objective .chn {
  color: var(--text);
  font-weight: 700;
}
#objective .clock {
  margin-left: auto;
  font-family: var(--mono);
  color: var(--faint);
}
#objective .beats {
  display: flex;
  gap: 4px;
  margin-bottom: 9px;
}
#objective .beats i {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
}
#objective .beats i.done {
  background: var(--info);
}
#objective .beats i.cur {
  background: var(--accent);
  animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink {
  50% {
    opacity: 0.45;
  }
}
#objective .ob-main {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
#objective .ob-ico {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 0.85em;
}
#objective .ob-text {
  font-weight: 700;
  line-height: 1.45;
  font-size: 1em;
}
#objective .ob-sub {
  color: var(--dim);
  font-size: 0.84em;
  line-height: 1.55;
  margin-top: 3px;
}
#objective .ob-where {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74em;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.08);
  color: var(--dim);
  border: 1px solid var(--line);
}
.chip.accent {
  background: rgba(255, 176, 46, 0.14);
  color: var(--accent);
  border-color: rgba(255, 176, 46, 0.35);
}
.chip.info {
  background: rgba(79, 209, 197, 0.12);
  color: var(--info);
  border-color: rgba(79, 209, 197, 0.3);
}
.chip.danger {
  background: rgba(255, 79, 79, 0.16);
  color: #ff9a9a;
  border-color: rgba(255, 79, 79, 0.4);
}
.chip.ok {
  background: rgba(74, 222, 128, 0.12);
  color: var(--ok);
  border-color: rgba(74, 222, 128, 0.3);
}
.chip.warn {
  background: rgba(251, 146, 60, 0.14);
  color: var(--warn);
  border-color: rgba(251, 146, 60, 0.35);
}
.chip.fic {
  background: rgba(179, 148, 255, 0.12);
  color: var(--violet);
  border-color: rgba(179, 148, 255, 0.3);
}
#objective.pulse {
  animation: obpulse 1.2s ease-out;
}
@keyframes obpulse {
  0% {
    box-shadow:
      0 0 0 0 rgba(255, 176, 46, 0.7),
      var(--shadow);
  }
  100% {
    box-shadow:
      0 0 0 18px rgba(255, 176, 46, 0),
      var(--shadow);
  }
}

/* tutorial card (top left) */
#tutor {
  position: absolute;
  left: var(--gut);
  top: var(--gut);
  width: min(320px, calc(100vw - 32px));
}
#tutor .tcard {
  background: var(--panel);
  border: 1px solid rgba(79, 209, 197, 0.35);
  border-radius: var(--r);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  animation: subin 0.3s ease-out;
}
#tutor .tcard h4 {
  margin: 0 0 6px;
  font-size: 0.78em;
  color: var(--info);
  letter-spacing: 0.06em;
  display: flex;
  gap: 8px;
  align-items: center;
}
#tutor .tcard h4 .n {
  margin-left: auto;
  font-family: var(--mono);
  color: var(--faint);
}
#tutor .tcard .t {
  font-weight: 700;
  line-height: 1.5;
}
#tutor .tcard .d {
  color: var(--dim);
  font-size: 0.86em;
  line-height: 1.6;
  margin-top: 4px;
}
#tutor .tcard .bar {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  margin-top: 10px;
  overflow: hidden;
}
#tutor .tcard .bar i {
  display: block;
  height: 100%;
  background: var(--info);
  transition: width 0.3s;
}

/* vitals (bottom left) */
#vitals {
  position: absolute;
  left: var(--gut);
  bottom: var(--gut);
  width: min(300px, 44vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
  backdrop-filter: blur(8px);
}
#vitals .row {
  display: flex;
  align-items: center;
  gap: 8px;
}
#vitals .lab {
  font-size: 0.72em;
  color: var(--dim);
  font-weight: 700;
  width: 4.4em;
  white-space: nowrap;
}
#vitals .state {
  margin-left: auto;
  font-size: 0.74em;
  font-weight: 700;
}
#vitals .hpnum {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.15em;
}
#vitals .ecg {
  width: 100%;
  height: 26px;
  display: block;
  margin: 2px 0 4px;
}
#vitals .ecg path {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
}
#vitals .hpbar,
#vitals .stbar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  flex: 1;
}
#vitals .stbar {
  height: 4px;
}
#vitals .hpbar i,
#vitals .stbar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  transition: width 0.2s;
}
#vitals .stbar i {
  background: var(--blue);
}
#vitals .stbar i.low {
  background: var(--warn);
}
#vitals .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}
#vitals .chips:empty {
  display: none;
}

/* weapon (bottom right) */
#weapon {
  position: absolute;
  right: var(--gut);
  bottom: var(--gut);
  min-width: 210px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 14px;
  backdrop-filter: blur(8px);
  text-align: right;
}
#weapon .wname {
  font-size: 0.78em;
  color: var(--dim);
  font-weight: 700;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}
#weapon .ammo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 2em;
  line-height: 1.1;
  letter-spacing: 0.02em;
}
#weapon .ammo .res {
  font-size: 0.55em;
  color: var(--dim);
}
#weapon .ammo.low {
  color: var(--warn);
}
#weapon .ammo.empty {
  color: var(--danger);
}
#weapon .slots {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 6px;
}
#weapon .slots span {
  font-size: 0.7em;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--faint);
  white-space: nowrap;
}
#weapon .slots span.have {
  color: var(--dim);
  border-color: var(--line-2);
}
#weapon .slots span.on {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}
#weapon .reload {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
#weapon .reload i {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* compass */
#compass {
  position: absolute;
  left: 50%;
  bottom: var(--gut);
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 2 * 230px));
  min-width: 180px;
  height: 30px;
  overflow: hidden;
  -webkit-mask: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  mask: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}
#compass-strip {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 0.72em;
  color: var(--faint);
}
#compass-strip span {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
}
#compass-strip span.c {
  color: var(--text);
  font-weight: 700;
}
#compass-mark {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  color: var(--accent);
  font-size: 0.72em;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: 0 0 4px #000;
}
#compass-tick {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 2px;
  height: 8px;
  background: var(--text);
  transform: translateX(-50%);
}

/* toasts */
#toasts {
  position: absolute;
  right: var(--gut);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  width: min(320px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  border-radius: 10px;
  padding: 7px 12px 7px 8px;
  font-size: 0.88em;
  animation: toastin 0.25s ease-out;
  backdrop-filter: blur(6px);
  max-width: 100%;
}
.toast.item {
  border-left-color: var(--accent);
}
.toast.warn {
  border-left-color: var(--warn);
}
.toast.ok {
  border-left-color: var(--ok);
}
.toast .ti {
  width: 30px;
  height: 30px;
  flex: none;
}
.toast b {
  font-weight: 700;
}
.toast small {
  display: block;
  color: var(--dim);
  font-size: 0.85em;
}
.toast.out {
  animation: toastout 0.3s ease-in forwards;
}
@keyframes toastin {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
}
@keyframes toastout {
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* center-top alert */
#alert {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}
#alert .a {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  font-weight: 700;
  letter-spacing: 0.06em;
  animation: alertin 2.6s ease-out forwards;
}
#alert .a.chapter {
  background: none;
  border: none;
  font-family: var(--serif);
  font-size: clamp(22px, 4vw, 36px);
  text-shadow: 0 2px 12px #000;
  animation-duration: 4.5s;
}
#alert .a.chapter small {
  display: block;
  font-family: var(--mono);
  font-size: 0.45em;
  letter-spacing: 0.3em;
  color: var(--info);
}
#alert .a.danger {
  border-color: rgba(255, 79, 79, 0.5);
  color: #ffb4b4;
}
#alert .a.ok {
  border-color: rgba(74, 222, 128, 0.45);
  color: #bdf5d0;
}
@keyframes alertin {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }
  10%,
  80% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
  }
}

/* boss bar */
#bossbar {
  position: absolute;
  left: 50%;
  top: var(--gut);
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 32px - 380px));
  min-width: 240px;
  text-align: center;
}
#bossbar .bn {
  font-family: var(--serif);
  font-weight: 900;
  letter-spacing: 0.2em;
  font-size: 1em;
  text-shadow: 0 1px 6px #000;
}
#bossbar .bn small {
  font-family: var(--font);
  font-size: 0.7em;
  letter-spacing: 0;
  color: var(--dim);
  margin-left: 8px;
}
#bossbar .bb {
  height: 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--line-2);
  margin-top: 4px;
  overflow: hidden;
  position: relative;
}
#bossbar .bb i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #8c1d1d, var(--danger));
  transition: width 0.15s;
}
#bossbar .bb b {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
}
#bossbar .bs {
  font-size: 0.74em;
  color: var(--dim);
  margin-top: 3px;
}

#keys {
  position: absolute;
  left: 50%;
  bottom: 52px;
  transform: translateX(-50%);
  font-size: 0.72em;
  color: var(--faint);
  white-space: nowrap;
  display: flex;
  gap: 12px;
}
#debug {
  position: absolute;
  left: var(--gut);
  top: 50%;
  font-family: var(--mono);
  font-size: 11px;
  color: #9f9;
  white-space: pre;
  text-shadow: 0 0 2px #000;
}

/* ---- touch ----------------------------------------------------------------------------------------- */
#touch {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
}
#t-look {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 60%;
  pointer-events: auto;
}
#t-stick {
  position: absolute;
  left: 22px;
  bottom: 120px;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(10, 14, 20, 0.35);
  pointer-events: auto;
  touch-action: none;
}
#t-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
}
#t-right {
  position: absolute;
  right: 12px;
  bottom: 118px;
  display: grid;
  grid-template-columns: repeat(3, 56px);
  gap: 8px;
  pointer-events: auto;
}
#t-right button,
#t-top button {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 14, 20, 0.55);
  border-radius: 14px;
  min-height: 48px;
  font-size: 12px;
  font-weight: 700;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#t-right .t-fire {
  grid-column: 3;
  grid-row: 1 / span 2;
  border-radius: 50%;
  width: 56px;
  height: 104px;
  background: rgba(255, 79, 79, 0.3);
}
#t-right .t-aim {
  grid-column: 2;
  grid-row: 1;
}
#t-right .t-use {
  grid-column: 1;
  grid-row: 1;
  background: rgba(255, 176, 46, 0.3);
}
#t-right button.on {
  background: rgba(255, 176, 46, 0.55);
}
#t-top {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  pointer-events: auto;
}
#t-top button {
  min-height: 38px;
  min-width: 38px;
  padding: 0 8px;
}
body.touch #objective {
  top: 56px;
  width: min(300px, calc(100vw - 32px));
  font-size: 0.86em;
}
body.touch #tutor {
  top: 56px;
}
body.touch #keys,
body.touch #crosshair.dot {
  display: none;
}
body.touch #vitals {
  bottom: 8px;
  width: min(220px, 44vw);
  padding: 7px 9px;
}
body.touch #weapon {
  bottom: 8px;
  min-width: 140px;
  padding: 7px 10px;
}
body.touch #weapon .ammo {
  font-size: 1.4em;
}
body.touch #compass {
  bottom: 72px;
}
body.touch #sub {
  bottom: 250px;
}

/* ---- small screens --------------------------------------------------------------------------------- */
@media (max-width: 720px) {
  :root {
    --fs: 15px;
  }
  .appeal {
    grid-template-columns: 1fr;
  }
  #objective {
    width: min(300px, calc(100vw - 32px));
  }
  #objective .beats {
    display: none;
  }
  #compass {
    width: 46vw;
    min-width: 0;
    bottom: 100px;
  }
  #keys {
    display: none;
  }
  #bossbar {
    top: auto;
    bottom: 150px;
    width: calc(100vw - 32px);
  }
  #sub {
    bottom: 140px;
  }
  #tutor {
    top: auto;
    bottom: 200px;
  }
  body.touch #tutor {
    top: 150px;
    bottom: auto;
  }
}
@media (max-height: 520px) {
  #objective .ob-sub,
  #objective .beats {
    display: none;
  }
}

/* inside a locker: slits */
body.hiding #hud::before {
  content: "ロッカーの中 — E で出る";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.93) 0 30px, rgba(0, 0, 0, 0) 30px 40px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 190px;
  color: #cfd6de;
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* phones: keep the cards from overlapping */
@media (max-width: 720px) {
  .logo-en {
    letter-spacing: 0.22em;
  }
  body.touch #objective .ob-sub {
    display: none;
  }
  body.touch #tutor {
    top: 168px;
    bottom: auto;
    width: min(250px, calc(100vw - 32px));
  }
  body.touch #tutor .tcard {
    padding: 8px 10px;
  }
  body.touch #tutor .tcard .d {
    display: none;
  }
  body.touch #t-top button {
    min-width: 34px;
    padding: 0 6px;
    font-size: 11px;
  }
}
@media (max-width: 720px) {
  body.touch #t-top button {
    white-space: nowrap;
    font-size: 10.5px;
  }
  body.touch #compass {
    top: 52px;
    bottom: auto;
    width: 70vw;
  }
  body.touch #objective {
    top: 88px;
  }
  body.touch #tutor {
    top: 226px;
  }
  body.touch #weapon {
    min-width: 0;
    max-width: 44vw;
  }
  body.touch #weapon .slots span:not(:last-child) {
    display: none;
  }
  body.touch #vitals {
    width: 46vw;
  }
}

#tutor .tcard.teach {
  border-color: rgba(255, 176, 46, 0.55);
}
#tutor .tcard.teach h4 {
  color: var(--accent);
}
#tutor .tcard.teach.mon {
  border-color: rgba(255, 79, 79, 0.55);
}
#tutor .tcard.teach.mon h4 {
  color: #ff9a9a;
}

/* TODO list under the objective */
.todo-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0 4px;
  font-size: 0.72em;
  font-weight: 700;
  color: var(--dim);
  letter-spacing: 0.08em;
}
.todo-head b {
  font-family: var(--mono);
  color: var(--accent);
}
.todo {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.todo li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86em;
  line-height: 1.45;
  color: var(--text);
  padding: 3px 6px;
  border-radius: 6px;
}
.todo li .cb {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--line-2);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
}
.todo li.done {
  color: var(--faint);
  text-decoration: line-through;
}
.todo li.done .cb {
  background: var(--info);
  border-color: var(--info);
  color: #062420;
}
.todo li.cur {
  background: rgba(255, 176, 46, 0.1);
}
.todo li.cur .cb {
  border-color: var(--accent);
}
.todo.big {
  margin-top: 8px;
}
/* toasts sit above the weapon panel (the objective card on the right can be tall) */
#toasts {
  top: auto;
  bottom: 120px;
  transform: none;
}
body.touch #toasts {
  bottom: 330px;
  right: auto;
  left: var(--gut);
  align-items: flex-start;
}
/* readability pass: more solid panels, larger key text */
:root {
  --panel: rgba(10, 14, 20, 0.92);
  --dim: #b4bec9;
}
#objective .ob-text {
  font-size: 1.06em;
}
#prompt {
  font-size: 1.02em;
  padding: 8px 16px 8px 8px;
}
#sub .line {
  font-size: 1.08em;
  background: rgba(4, 6, 9, 0.9);
}
#keys {
  color: var(--dim);
  font-size: 0.76em;
}
#keys span {
  background: rgba(10, 14, 20, 0.7);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 8px;
}
#weapon .ammo {
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}
