.game-screen { --prompt-top: calc(max(8px, env(safe-area-inset-top)) + 61px); --boss-top: calc(max(8px, env(safe-area-inset-top)) + 70px); background: #050713; touch-action: none; user-select: none; position: relative; }
#game-canvas { position: absolute; top: 0; left: 50%; display: block; width: auto; height: 100dvh; min-width: 100%; max-width: none; transform: translateX(-50%); background: #070a22; cursor: crosshair; }
.orientation-guard { display: none; }

@media (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
  .game-screen:not(.hidden) .orientation-guard {
    position: absolute;
    z-index: 30;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 8px;
    padding: max(24px, env(safe-area-inset-top)) 28px max(24px, env(safe-area-inset-bottom));
    background: radial-gradient(circle at 50% 42%, rgba(72, 43, 145, .96), rgba(4, 6, 24, .99) 64%);
    color: #fff;
    text-align: center;
    touch-action: none;
  }

  .orientation-guard > span { color: #ffe77a; font-size: 48px; line-height: 1; }
  .orientation-guard > strong { font-size: clamp(24px, 6vw, 34px); }
  .orientation-guard > small { max-width: 320px; color: #d9d2ee; font-size: 14px; line-height: 1.5; }
}
.scanlines { position: absolute; inset: 0; pointer-events: none; opacity: .09; background: repeating-linear-gradient(180deg, transparent 0 3px, rgba(255,255,255,.08) 3px 4px); mix-blend-mode: overlay; }
.damage-flash { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 80px 20px rgba(255,44,69,0); transition: .12s; }
.damage-flash.active { box-shadow: inset 0 0 80px 20px rgba(255,44,69,.65); }

.formal-countdown {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(circle at 50% 44%, rgba(61, 40, 143, .7), rgba(5, 7, 25, .88) 58%, rgba(4, 5, 18, .96));
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  text-align: center;
  pointer-events: none;
}
.formal-countdown small {
  color: var(--cyan-bright);
  font-size: clamp(16px, 4.6vw, 22px);
  font-weight: 900;
  letter-spacing: .12em;
  text-shadow: 0 0 16px rgba(85, 233, 255, .72);
}
.formal-countdown strong {
  max-width: 340px;
  color: #fff6ba;
  font-size: clamp(30px, 8.5vw, 44px);
  font-weight: 950;
  line-height: 1.18;
  text-shadow: 0 4px 0 #6f30a9, 0 0 28px rgba(255, 231, 122, .58), 0 8px 24px rgba(0, 0, 0, .72);
  animation: formalCountdownEnter .42s cubic-bezier(.16, 1, .3, 1) both;
}
.formal-countdown[data-phase="count"] strong {
  font-size: clamp(92px, 28vw, 132px);
  line-height: .9;
}
.formal-countdown[data-phase="go"] strong {
  color: #fff;
  font-size: clamp(54px, 16vw, 76px);
}
@keyframes formalCountdownEnter {
  from { opacity: 0; transform: scale(.76); filter: blur(5px); }
  to { opacity: 1; transform: scale(1); filter: blur(0); }
}

/* Dynamic HUD Tension Vignette & Fever Flame Border */
.game-screen[data-danger-state="critical"]::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  box-shadow: inset 0 0 48px 16px rgba(255, 30, 60, 0.38), inset 0 0 96px 28px rgba(255, 10, 40, 0.2);
  animation: dangerHeartbeat 1.1s ease-in-out infinite;
}

.game-screen[data-fever="1"]::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  border: 3px solid transparent;
  border-image: linear-gradient(135deg, #ffd700, #ff0077 30%, #8a2be2 65%, #00ffff 100%) 1;
  box-shadow: inset 0 0 35px rgba(255, 215, 0, 0.35), inset 0 0 65px rgba(186, 85, 211, 0.3), 0 0 25px rgba(255, 215, 0, 0.4);
  animation: feverFlameGlow 1.6s ease-in-out infinite alternate;
}

.game-hud { position: absolute; z-index: 5; left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.top-hud { top: max(8px, env(safe-area-inset-top)); left: 8px; right: 8px; gap: 4px; padding: 3px 6px; min-height: 50px; isolation: isolate; }
.top-hud::before, .top-hud::after { content: ""; position: absolute; pointer-events: none; z-index: -1; }
.top-hud::before {
  inset: 0;
  border: 1.5px solid rgba(255, 221, 91, 0.85);
  border-radius: 18px 22px 15px 20px;
  background: rgba(4, 6, 22, 0.94);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.58), 0 0 14px rgba(0, 240, 255, 0.12), inset 0 1px 0 rgba(255, 231, 122, 0.28), inset 0 -1px 0 rgba(85, 233, 255, 0.22);
  clip-path: polygon(0 9px, 9px 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 9px 100%, 0 calc(100% - 9px));
}
.top-hud::after {
  left: 10%;
  right: 10%;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 231, 122, 0.95), rgba(189, 118, 255, 0.9), rgba(0, 240, 255, 0.95), transparent);
  opacity: 0.85;
}
.boss-warning-hud {
  position: absolute;
  inset: 4px 6px;
  z-index: 3;
  display: none;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 3px 14px;
  border: 1.5px solid rgba(255, 83, 115, .94);
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(48, 6, 32, .98), rgba(91, 11, 41, .98), rgba(48, 6, 32, .98));
  box-shadow: 0 0 22px rgba(255, 41, 85, .38), inset 0 1px 0 rgba(255, 231, 122, .22);
  color: #ffe77a;
  text-align: center;
}
.boss-warning-hud span { justify-self: end; font-size: 13px; font-weight: 950; letter-spacing: .08em; }
.boss-warning-hud strong { min-width: 36px; color: #fff; font: 950 29px/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-shadow: 0 0 16px #ff2955; }
.boss-warning-hud small { justify-self: start; color: #ffd8e1; font-size: 10px; font-weight: 850; }
.game-screen[data-boss-warning] .boss-warning-hud { display: grid; }
.game-screen[data-boss-warning] .top-hud > .hud-chip { opacity: 0; }
.hud-chip {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 40px;
  display: grid;
  gap: 1px;
  padding: 3px 6px 4px;
  border: 1.25px solid rgba(131, 139, 255, 0.55);
  border-radius: 13px 16px 11px 15px;
  background: linear-gradient(145deg, rgba(13, 19, 65, 0.96), rgba(7, 9, 32, 0.94));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.13);
  overflow: hidden;
  clip-path: polygon(0 7px, 7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px));
}
.hud-chip::before { content: ""; position: absolute; top: 6px; right: 8px; width: 6px; height: 6px; border: 1px solid currentColor; border-radius: 50%; opacity: .55; }
.time-chip { flex: 0.86; border-color: rgba(255, 232, 83, 0.62); color: #ffe853; }
.score-chip { flex: 1; border-color: rgba(189, 118, 255, 0.82); color: #bd76ff; }
.combo-chip { flex: 1; border-color: rgba(0, 240, 255, 0.72); color: #00f0ff; }
.hud-chip::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: #5a54dc; opacity: .8; }
.time-chip::after { background: #ffe853; box-shadow: 0 0 6px #ffe853; }
.score-chip::after { background: #bd76ff; box-shadow: 0 0 6px #bd76ff; }
.combo-chip::after { background: #00f0ff; box-shadow: 0 0 6px #00f0ff; }
.hud-chip > span { color: #d1d5ef; font-size: 9px; font-weight: 850; line-height: 1; letter-spacing: .08em; }
.hud-chip strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; white-space: nowrap; text-shadow: 0 0 12px currentColor; }
.time-chip strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(19px, 5vw, 23px);
  line-height: 1;
  color: #ffe853;
  text-shadow: 0 0 10px rgba(255, 232, 83, 0.55), 0 2px 0 #000;
}
.time-chip strong.is-warning {
  color: #ff3366;
  text-shadow: 0 0 18px rgba(255, 51, 102, 0.95), 0 0 32px rgba(255, 51, 102, 0.6), 0 2px 0 #000;
  animation: timerWarningHeartbeat 0.6s cubic-bezier(0.25, 1, 0.5, 1) infinite alternate;
}
.score-chip strong {
  font-size: clamp(26px, 7vw, 32px);
  line-height: 1;
  color: #f3e8ff;
  letter-spacing: .04em;
  text-shadow: 0 0 16px rgba(189, 118, 255, 0.85), 0 2px 0 #000;
}
.combo-chip strong {
  font-size: clamp(18px, 5vw, 22px);
  line-height: 1;
  color: #00f0ff;
  text-shadow: 0 0 16px rgba(0, 240, 255, 0.85), 0 2px 0 #000;
}
.flow-value-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.flow-pips { display: flex; flex: 1; gap: 3px; min-width: 32px; }
.flow-pip { flex: 1; height: 4px; border: 1px solid rgba(85, 233, 255, .35); border-radius: 999px; background: rgba(255, 255, 255, .08); }
.flow-pip.is-filled { border-color: #55e9ff; background: #55e9ff; box-shadow: 0 0 7px rgba(85, 233, 255, .85); }
.combo-chip small { display: none; color: rgba(196, 232, 255, .82); font-size: 8px; font-weight: 750; line-height: 1; white-space: nowrap; }
.game-screen[data-flow-near="1"] .combo-chip small,
.game-screen[data-flow-tier="flow"] .combo-chip small,
.game-screen[data-flow-tier="burst"] .combo-chip small { display: block; }
.combo-chip small.ready { color: var(--paper); text-shadow: 0 0 9px rgba(255,231,122,.6); }
.game-screen[data-flow-near="1"] .combo-chip {
  animation: flowNearPulse 1.8s ease-in-out infinite alternate;
  box-shadow: 0 0 20px rgba(0, 240, 255, .25), inset 0 1px 0 rgba(255, 255, 255, .15);
}
@keyframes flowNearPulse {
  from { box-shadow: 0 0 14px rgba(0, 240, 255, .18), inset 0 1px 0 rgba(255, 255, 255, .15); }
  to { box-shadow: 0 0 26px rgba(0, 240, 255, .42), inset 0 1px 0 rgba(255, 255, 255, .15); }
}

.boss-hud { position: absolute; z-index: 6; left: 18px; right: 18px; top: var(--boss-top); padding: 6px 12px; min-height: 38px; border-radius: 12px; background: linear-gradient(145deg, rgba(70,8,56,.96), rgba(20,7,46,.94)); border: 2px solid rgba(255,91,126,.72); box-shadow: 0 0 25px rgba(255,48,103,.2), inset 0 1px 0 rgba(255,255,255,.08); }
.boss-hud::before, .boss-hud::after { content: ""; position: absolute; top: -2px; width: 34px; height: 9px; border-top: 2px solid #8d5cff; border-bottom: 1px solid rgba(85,233,255,.6); }
.boss-hud::before { left: 12px; transform: skewX(-24deg); }
.boss-hud::after { right: 12px; transform: skewX(24deg); }
.boss-title { display: flex; justify-content: space-between; font-size: 10px; color: #ffe3e9; letter-spacing: .04em; }
.boss-title strong { color: #ffe36e; }
.boss-bar { position: relative; height: 10px; margin-top: 5px; border: 1px solid rgba(255,119,142,.34); border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.25); }
.boss-bar::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent calc(33.333% - 1px), rgba(7,6,28,.9) calc(33.333% - 1px) calc(33.333% + 1px), transparent calc(33.333% + 1px) calc(66.666% - 1px), rgba(7,6,28,.9) calc(66.666% - 1px) calc(66.666% + 1px), transparent calc(66.666% + 1px)); pointer-events: none; }
.boss-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg,#ff3754,#c653ff,#55e9ff); transition: width .25s; box-shadow: 0 0 12px rgba(255,84,120,.72); }
.boss-hud.is-broken { border-color: #ffe36e; background: linear-gradient(145deg, rgba(86,35,7,.97), rgba(31,8,42,.96)); box-shadow: 0 0 30px rgba(255,211,77,.36), inset 0 1px 0 rgba(255,255,255,.14); }
.boss-hud.is-broken .boss-title strong { color: #fff3a8; text-shadow: 0 0 12px rgba(255,224,106,.85); }
.boss-hud.is-broken .boss-bar { border-color: rgba(255,227,110,.8); background: linear-gradient(110deg, transparent 0 8%, #ffe36e 9% 21%, transparent 22% 29%, #ff8c55 30% 43%, transparent 44% 55%, #ffe36e 56% 70%, transparent 71% 78%, #ff8c55 79% 92%, transparent 93%); animation: boss-bar-break .36s ease-out both; }
.boss-hud.is-broken .boss-bar i { width: 0 !important; box-shadow: none; }
@keyframes boss-bar-break { 0% { transform: scaleX(1); filter: brightness(2); } 55% { transform: scaleX(.92) rotate(-1deg); } 100% { transform: scaleX(1); filter: brightness(1); } }

/* Holo-Talisman Slate (天師題目符令) */
.prompt-card {
  position: absolute;
  z-index: 5;
  left: 14px;
  right: 14px;
  top: var(--prompt-top);
  text-align: center;
  border-radius: 16px;
  min-height: 96px;
  display: grid;
  align-content: center;
  padding: 10px 15px 11px;
  border: 1.5px solid rgba(85, 233, 255, .7);
  background: linear-gradient(155deg, rgba(6, 18, 48, .985) 0%, rgba(4, 10, 34, .995) 52%, rgba(16, 8, 42, .985) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .5), 0 0 24px rgba(85, 233, 255, .18), inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 0 18px rgba(56, 239, 189, .08);
  overflow: hidden;
  clip-path: polygon(0 10px, 10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px));
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}
.prompt-card > * { transition: opacity .1s ease, transform .1s ease; }
.prompt-card.is-outgoing { transform: translateY(-1px); }
.prompt-card.is-outgoing > * { opacity: .78; transform: translateY(-1px); }
.prompt-card.is-incoming { transform: none; }
.prompt-card.is-incoming > * { opacity: 0; transform: translateY(-2px); }
.prompt-card.is-arriving > * { animation: prompt-arrive .11s ease-out both; }
@keyframes prompt-arrive {
  from { opacity: .72; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

.prompt-card[data-purpose="baseline"] {
  border-color: rgba(85, 233, 255, .82);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .46), 0 0 26px rgba(85, 233, 255, .28), inset 0 1px 0 rgba(85, 233, 255, .32), inset 0 0 16px rgba(56, 239, 189, .1);
}

.prompt-card[data-purpose="confirmation"] {
  border-color: rgba(255, 231, 122, .9);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .46), 0 0 28px rgba(255, 220, 90, .32), inset 0 1px 0 rgba(255, 231, 122, .36), inset 0 0 16px rgba(255, 180, 50, .12);
}

.prompt-card[data-purpose="adaptive"] {
  border-color: rgba(189, 156, 255, .85);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .46), 0 0 28px rgba(189, 156, 255, .28), inset 0 1px 0 rgba(189, 156, 255, .32), inset 0 0 16px rgba(141, 92, 255, .12);
}

.prompt-card[data-purpose="boss"] {
  border-color: rgba(255, 83, 115, .95);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .52), 0 0 32px rgba(255, 48, 103, .38), inset 0 1px 0 rgba(255, 119, 142, .38), inset 0 0 20px rgba(255, 53, 84, .18);
}

.boss-hud:not(.hidden) ~ .prompt-card {
  top: calc(max(8px, env(safe-area-inset-top)) + 124px);
}

.prompt-card::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(56, 239, 189, .75), rgba(255, 231, 122, .9), rgba(189, 156, 255, .75), transparent);
  pointer-events: none;
}

.prompt-card::after {
  display: none;
  content: "";
  position: absolute;
  right: -16px;
  bottom: -20px;
  width: 62px;
  height: 62px;
  border: 1px solid rgba(255, 231, 122, .4);
  transform: rotate(45deg);
  opacity: .75;
  pointer-events: none;
}

.question-tag, .prompt-card small { display: none; }

.prompt-kicker {
  display: flex;
  justify-content: center;
  margin: 0 auto 4px;
}

.prompt-kicker span {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(85, 233, 255, .1);
  color: #9aeffc;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
}

.prompt-kicker span.is-story-cue {
  animation: story-cue .9s ease-out both;
}

.prompt-card.is-chain .question-tag { display: inline-flex; align-items: center; margin: 0 auto 5px; padding: 3px 9px; border-radius: 999px; background: rgba(85, 233, 255, .13); color: #8ef0ff; font-size: 10px; font-weight: 900; letter-spacing: .05em; }

.prompt-card.fever-mode {
  border-color: rgba(255, 225, 106, .98);
  box-shadow: 0 10px 32px rgba(0, 0, 0, .45), 0 0 34px rgba(255, 225, 106, .45), inset 0 1px 0 rgba(255, 255, 255, .3);
  animation: feverPromptPulse 0.8s ease-in-out infinite alternate;
}

@keyframes feverPromptPulse {
  from { box-shadow: 0 10px 32px rgba(0, 0, 0, .45), 0 0 20px rgba(255, 225, 106, .28); }
  to { box-shadow: 0 10px 36px rgba(0, 0, 0, .55), 0 0 38px rgba(255, 225, 106, .55); }
}

.prompt-card p {
  margin: 0 0 6px;
  color: #cbd4ea;
  font-size: clamp(13px, 3.5vw, 15px);
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: .02em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .7), 0 0 12px rgba(85, 233, 255, .25);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.prompt-card strong {
  display: block;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
  font-size: clamp(27px, 7.2vw, 33px);
  line-height: 1.18;
  text-wrap: pretty;
  letter-spacing: -.01em;
  color: #ffffff;
  text-shadow: 0 0 18px rgba(255, 231, 122, .38), 0 0 30px rgba(85, 233, 255, .24), 0 2px 4px rgba(0, 0, 0, .7);
}
.prompt-blank {
  display: inline-block;
  min-width: 2.8em;
  padding-inline: .08em;
  color: #ffe36e;
  border-bottom: 3px solid #ffe36e;
  line-height: .92;
  text-shadow: 0 0 14px rgba(255, 227, 110, .58), 0 2px 3px rgba(0, 0, 0, .72);
}

/* Cloze Pop-in Highlight */
.prompt-cloze-fill,
.cloze-pop-in {
  color: #ffe36e;
  text-shadow: 0 0 16px rgba(255, 227, 110, .7);
  display: inline-block;
  margin-inline: .12em;
  animation: clozePop .32s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes clozePop {
  0% {
    transform: scale(0.6) translateY(4px);
    opacity: 0;
    filter: brightness(1.8);
  }
  70% {
    transform: scale(1.15) translateY(-1px);
    opacity: 1;
    filter: brightness(1.3);
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
    filter: brightness(1);
  }
}

.feedback { position: absolute; z-index: 9; left: 50%; top: calc(max(8px, env(safe-area-inset-top)) + 218px); min-width: 154px; max-width: calc(100% - 44px); padding: 7px 15px 8px; transform: translateX(-50%); pointer-events: none; display: grid; justify-items: center; gap: 1px; border: 1px solid currentColor; border-radius: 999px; background: rgba(7, 8, 31, .88); box-shadow: 0 8px 24px rgba(0, 0, 0, .4), 0 0 20px color-mix(in srgb, currentColor 28%, transparent); text-align: center; opacity: 0; white-space: nowrap; isolation: isolate; }
.feedback strong { font-weight: 950; font-size: 19px; line-height: 1.05; text-shadow: 0 3px 12px #000, 0 0 16px currentColor; }
.feedback small { color: rgba(255,255,255,.9); font-size: 10px; font-weight: 850; letter-spacing: .02em; }
.feedback.show { animation: feedback var(--feedback-duration, 900ms) ease-out both; }
.feedback.correct { color: var(--green); }
.feedback.wrong { color: #ff7a86; }
.feedback[data-variant="answer-wrong"] { min-width: 210px; padding: 11px 22px 12px; border: 2px solid #ff5877; border-radius: 18px; color: #fff3f5; background: rgba(74, 9, 30, .96); box-shadow: 0 10px 30px rgba(0,0,0,.48), 0 0 30px rgba(255,49,92,.55), inset 0 0 18px rgba(255,88,119,.12); }
.feedback[data-variant="answer-wrong"] strong { font-size: 27px; letter-spacing: .06em; }
.feedback[data-variant="answer-wrong"] small { margin-top: 3px; color: #ffd5dc; font-size: 12px; }
.feedback[data-variant="boss-break"] { min-width: 200px; color: #ffe36e; border-width: 2px; background: rgba(58, 18, 29, .94); }
.feedback[data-variant="boss-break"] strong { font-size: 29px; letter-spacing: .08em; }
.feedback[data-variant="boss-hit"], .feedback[data-variant="boss-overkill"] { top: calc(max(8px, env(safe-area-inset-top)) + 188px); }
.feedback[data-variant="boss-taunt"] { color: #ff9ad3; border-width: 2px; background: rgba(38, 10, 54, .94); }
.feedback[data-variant="boss-taunt"] strong { font-size: 24px; }
.feedback[data-variant="minion-hit"] {
  left: 50%;
  right: auto;
  top: auto;
  bottom: max(10px, env(safe-area-inset-bottom));
  min-width: 0;
  max-width: min(180px, calc(100% - 32px));
  padding: 7px 13px 8px;
  transform: translateX(-50%);
  justify-items: center;
  border-radius: 999px;
  text-align: center;
  white-space: normal;
}
.game-audio-toggle {
  position: absolute;
  z-index: 18;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  min-width: 72px;
}
.feedback[data-variant="minion-hit"] { background: rgba(7, 39, 34, .9); }
.feedback[data-variant="minion-hit"] strong { font-size: 16px; }
.feedback[data-variant="minion-hit"] small { font-size: 9px; line-height: 1.15; }
#score-value.is-punch { animation: metric-punch .32s cubic-bezier(.2, 1.5, .45, 1); }
@keyframes metric-punch { 0% { transform: scale(1); filter: brightness(1); } 45% { transform: scale(1.28); filter: brightness(1.8); text-shadow: 0 0 22px currentColor; } 100% { transform: scale(1); filter: brightness(1); } }

/* Hold the final boss frame until the player explicitly opens the diagnosis. */
.boss-outro {
  position: absolute;
  z-index: 12;
  left: 18px;
  right: 18px;
  bottom: max(22px, env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 12px 14px 14px;
  border: 1.5px solid rgba(255, 231, 122, .82);
  border-radius: 18px;
  color: #fff;
  background: rgba(7, 8, 31, .94);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .62), 0 0 24px rgba(255, 215, 73, .24), inset 0 1px 0 rgba(255, 255, 255, .15);
  text-align: center;
  animation: boss-outro-rise .3s ease-out both;
}

.boss-outro > span {
  color: #8ef0ff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .16em;
}

.boss-outro > strong {
  color: #ffe77a;
  font-size: clamp(24px, 7vw, 32px);
  line-height: 1.12;
  text-shadow: 0 0 18px rgba(255, 231, 122, .45);
}

.boss-outro > small {
  color: #d9dcf5;
  font-size: 12px;
  font-weight: 750;
}

.boss-outro .primary-button {
  min-height: 48px;
  margin-top: 7px;
  font-size: 16px;
}

.game-screen[data-boss-outro] .top-hud,
.game-screen[data-boss-outro] .boss-hud,
.game-screen[data-boss-outro] .mission-hud,
.game-screen[data-boss-outro] .prompt-card,
.game-screen[data-boss-outro] .keyboard-hint {
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.game-screen[data-boss-outro="escaped"] .boss-outro {
  border-color: rgba(255, 119, 142, .8);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .62), 0 0 24px rgba(255, 82, 111, .24), inset 0 1px 0 rgba(255, 255, 255, .12);
}

.game-screen[data-boss-outro="escaped"] .boss-outro > strong { color: #ff9aad; text-shadow: 0 0 18px rgba(255, 82, 111, .42); }

@keyframes boss-outro-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.bottom-hud { position: absolute; min-height: 40px; height: 42px; bottom: max(14px, env(safe-area-inset-bottom)); pointer-events: none; align-items: stretch; padding: 3px; gap: 0; border: 0; border-radius: 13px 13px 9px 9px; background: transparent; box-shadow: none; overflow: visible; }
.bottom-hud::before, .bottom-hud::after { content: ""; position: absolute; pointer-events: none; z-index: 0; }
.bottom-hud::before { inset: 0; border: 1px solid rgba(151, 73, 92, .72); border-radius: inherit; background: linear-gradient(160deg, rgba(42, 17, 45, .96), rgba(9, 8, 27, .97) 72%); box-shadow: 0 12px 26px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 214, 143, .13), inset 0 0 24px rgba(112, 34, 85, .18); }
.bottom-hud::after { left: 8%; right: 8%; bottom: 2px; height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 196, 92, .7), rgba(184, 72, 104, .9), transparent); opacity: .8; }
.health-panel, .reload-button { position: relative; z-index: 1; isolation: isolate; overflow: hidden; }
.health-panel, .reload-button { border: 1px solid rgba(144, 70, 91, .72); border-radius: 11px 14px 9px 12px; background: linear-gradient(150deg, rgba(35, 15, 45, .95), rgba(10, 9, 29, .95) 80%); box-shadow: inset 0 1px 0 rgba(255, 226, 168, .1), inset 0 0 14px rgba(118, 38, 80, .16); clip-path: polygon(0 6px, 6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px)); }
.health-panel::before, .reload-button::before { content: ""; position: absolute; pointer-events: none; opacity: .75; }
.health-panel::before { left: 10px; right: 10px; top: 3px; height: 1px; background: linear-gradient(90deg, transparent, #d96856, transparent); }
.reload-button::before { left: 8px; right: 8px; bottom: 4px; height: 1px; background: linear-gradient(90deg, transparent, #7045a0, transparent); }
.health-panel > *, .reload-button > * { position: relative; z-index: 1; }
.health-panel { flex: .72; min-width: 76px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: auto 1fr; gap: 2px; align-items: center; justify-content: center; padding: 9px 9px 6px; }
.health-panel small { grid-column: 1 / -1; color: #c2a8c6; font-size: 8px; letter-spacing: .12em; text-align: left; }
.health-panel span { color: #ff5263; font-size: 22px; line-height: 1; text-shadow: 0 0 10px rgba(255,69,87,.45); text-align: center; }
.health-panel span.empty { color: #574455; text-shadow: none; }
.bottom-hud.v1-simple .health-panel { flex: 1; min-width: 0; display: flex; grid-template: none; gap: 5px; align-items: center; justify-content: center; padding: 4px 9px; }
.bottom-hud.v1-simple .health-panel small { grid-column: auto; font-size: 8px; text-align: center; }
.bottom-hud.v1-simple .health-panel strong { color: #ffe77a; font-size: 19px; line-height: 1; }
.bottom-hud.v1-simple .health-panel span { font-size:15px }

.game-screen[data-boss-phase="1"] .combo-chip,
.game-screen[data-boss-phase="1"] .bottom-hud,
.game-screen[data-boss-phase="1"] .keyboard-hint { display: none; }
.game-screen[data-boss-phase="1"] .time-chip,
.game-screen[data-boss-phase="1"] .score-chip { min-height: 54px; }
.game-screen[data-boss-phase="1"] .top-hud { gap: 8px; }
.reload-button { color: #fff; min-height: 64px; transition: transform .12s ease, filter .12s ease; }
.reload-button:active { transform: scale(0.97); }

.reload-button { flex: .92; min-width: 102px; padding: 8px 8px; display: grid; align-content: center; gap: 3px; }
.reload-button .reload-kicker { color: #c2b7df; font-size: 8px; letter-spacing: .13em; }
.reload-button span { font-size: 11px; color: var(--paper); letter-spacing: 2px; white-space: nowrap; text-shadow: 0 0 8px rgba(255,231,122,.3); }
.reload-button small { color: #9c91a8; font-size: 9px; }
.reload-button.jammed { border-color: rgba(255,82,99,.8); box-shadow: 0 0 18px rgba(255,50,92,.18); }

.bottom-hud[data-life-state="low"] .health-panel { border-color: rgba(255, 82, 99, .92); box-shadow: 0 0 15px rgba(255, 50, 92, .18), inset 0 0 14px rgba(255, 50, 92, .12); }
.bottom-hud[data-ammo-state="low"] .reload-button { border-color: rgba(255, 116, 83, .95); box-shadow: 0 0 16px rgba(255, 116, 83, .45), inset 0 0 14px rgba(255, 90, 50, .25); animation: lowAmmoPulse .72s ease-in-out infinite alternate; }
.bottom-hud[data-ammo-state="low"] .reload-button span { color: #ff9d82; text-shadow: 0 0 10px rgba(255, 116, 83, .65); }
.bottom-hud[data-ammo-state="low"] .reload-button #reload-label { color: #ffd6b8; font-weight: 700; }
.bottom-hud[data-ammo-state="empty"] .reload-button { border-color: rgba(255, 68, 92, .98); box-shadow: 0 0 20px rgba(255, 68, 92, .6), inset 0 0 16px rgba(255, 50, 70, .32); animation: emptyAmmoPulse .48s ease-in-out infinite alternate; }
.bottom-hud[data-ammo-state="empty"] .reload-button span { color: #ff6a80; text-shadow: 0 0 12px rgba(255, 68, 92, .8); }
.bottom-hud[data-ammo-state="empty"] .reload-button #reload-label { color: #ffaec0; font-weight: 800; }

/* Non-intrusive Tactical Reload Styling */
.bottom-hud[data-ammo-state="reloading"] .reload-button {
  border-color: rgba(162, 107, 208, .84);
  background: linear-gradient(150deg, rgba(48, 22, 68, .96), rgba(16, 12, 38, .96) 80%);
  box-shadow: 0 0 14px rgba(162, 107, 208, .3), inset 0 0 16px rgba(85, 233, 255, .12);
  animation: tacticalReloadPulse 0.9s ease-in-out infinite alternate;
}
.bottom-hud[data-ammo-state="reloading"] .reload-button span {
  color: #d8b8ff;
  text-shadow: 0 0 10px rgba(189, 118, 255, .7);
}
.bottom-hud[data-ammo-state="reloading"] .reload-button .reload-kicker {
  color: #79f2ff;
  text-shadow: 0 0 6px rgba(85, 233, 255, .5);
}

.reload-overlay { position: absolute; z-index: 10; inset: 0; display: grid; place-content: center; gap: 12px; justify-items: center; background: rgba(8,5,15,.28); pointer-events: none; }
.reload-ring { width: 58px; height: 58px; border-radius: 50%; border: 4px solid rgba(255,255,255,.16); border-top-color: var(--paper); animation: spin .75s linear infinite; }
.reload-overlay strong { font-size: 12px; letter-spacing: .16em; }
.keyboard-hint { position: absolute; z-index: 4; bottom: 60px; left: 0; right: 0; text-align: center; color: rgba(215,220,255,.46); font-size: 8px; pointer-events: none; }

@media (max-width: 1024px) {
  .keyboard-hint { display: none; }
}

@media (hover: none), (pointer: coarse) {
  #game-canvas { cursor: default; }
  .keyboard-hint { display: none; }
}

@keyframes charmPulse {
  from { transform: rotate(-5deg) scale(.96); }
  to { transform: rotate(5deg) scale(1.06); }
}

@keyframes timerWarningHeartbeat {
  0% {
    transform: scale(1);
    color: #ff3366;
    text-shadow: 0 0 14px rgba(255, 51, 102, 0.85), 0 2px 0 #000;
  }
  50% {
    transform: scale(1.08);
    color: #ff1744;
    text-shadow: 0 0 24px rgba(255, 23, 68, 1), 0 0 36px rgba(255, 51, 102, 0.9), 0 2px 0 #000;
  }
  100% {
    transform: scale(1.02);
    color: #ff3366;
    text-shadow: 0 0 18px rgba(255, 51, 102, 0.95), 0 2px 0 #000;
  }
}

@keyframes timerWarning {
  from { opacity: .78; }
  to { opacity: 1; }
}

@keyframes lowAmmoPulse {
  from {
    border-color: rgba(255, 116, 83, .65);
    box-shadow: 0 0 8px rgba(255, 116, 83, .22), inset 0 0 8px rgba(255, 90, 50, .14);
  }
  to {
    border-color: rgba(255, 140, 95, 1);
    box-shadow: 0 0 18px rgba(255, 116, 83, .6), inset 0 0 16px rgba(255, 90, 50, .35);
  }
}

@keyframes emptyAmmoPulse {
  from {
    border-color: rgba(255, 68, 92, .7);
    box-shadow: 0 0 10px rgba(255, 68, 92, .3), inset 0 0 10px rgba(255, 50, 70, .2);
  }
  to {
    border-color: rgba(255, 95, 118, 1);
    box-shadow: 0 0 24px rgba(255, 68, 92, .8), inset 0 0 20px rgba(255, 50, 70, .45);
  }
}

@keyframes tacticalReloadPulse {
  from {
    border-color: rgba(162, 107, 208, .6);
    box-shadow: 0 0 10px rgba(162, 107, 208, .2), inset 0 0 10px rgba(85, 233, 255, .08);
  }
  to {
    border-color: rgba(189, 118, 255, .95);
    box-shadow: 0 0 18px rgba(189, 118, 255, .45), inset 0 0 18px rgba(85, 233, 255, .2);
  }
}

@keyframes dangerHeartbeat {
  0% {
    box-shadow: inset 0 0 40px 16px rgba(255, 20, 50, 0.4), inset 0 0 80px 28px rgba(200, 10, 30, 0.2);
    opacity: 0.75;
  }
  25% {
    box-shadow: inset 0 0 80px 32px rgba(255, 35, 65, 0.85), inset 0 0 140px 55px rgba(255, 15, 45, 0.5);
    opacity: 1;
  }
  45% {
    box-shadow: inset 0 0 50px 20px rgba(255, 20, 50, 0.5), inset 0 0 95px 32px rgba(200, 10, 30, 0.25);
    opacity: 0.82;
  }
  65% {
    box-shadow: inset 0 0 90px 36px rgba(255, 40, 70, 0.9), inset 0 0 160px 60px rgba(255, 20, 50, 0.55);
    opacity: 1;
  }
  100% {
    box-shadow: inset 0 0 40px 16px rgba(255, 20, 50, 0.4), inset 0 0 80px 28px rgba(200, 10, 30, 0.2);
    opacity: 0.75;
  }
}

@keyframes feverFlameGlow {
  0% {
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.5)) hue-rotate(0deg);
    box-shadow: inset 0 0 25px rgba(255, 215, 0, 0.3), inset 0 0 50px rgba(186, 85, 211, 0.25);
  }
  50% {
    filter: drop-shadow(0 0 16px rgba(255, 60, 140, 0.7)) hue-rotate(15deg);
    box-shadow: inset 0 0 45px rgba(255, 220, 80, 0.5), inset 0 0 80px rgba(210, 60, 255, 0.45);
  }
  100% {
    filter: drop-shadow(0 0 12px rgba(138, 43, 226, 0.6)) hue-rotate(-15deg);
    box-shadow: inset 0 0 35px rgba(255, 200, 50, 0.35), inset 0 0 65px rgba(160, 40, 240, 0.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-screen[data-danger-state="critical"]::before,
  .game-screen[data-fever="1"]::after,
  .prompt-cloze-fill,
  .time-chip strong.is-warning,
  .bottom-hud[data-ammo-state="reloading"] .reload-button {
    animation: none;
  }
  .boss-outro { animation: none; }
}

@media (max-width: 380px) {
  .game-hud { left: 6px; right: 6px; gap: 4px; }
  .hud-chip { padding-inline: 6px; }
  .hud-chip span { font-size: 8px; }
  .time-chip strong { font-size: clamp(20px, 5.8vw, 26px); }
  .score-chip strong { font-size: clamp(18px, 5.2vw, 24px); }
  .combo-chip strong { font-size: clamp(17px, 4.8vw, 22px); }
  .prompt-card { left: 8px; right: 8px; min-height: 94px; padding: 9px 10px 10px; }
  .prompt-card p { font-size: 13px; margin-bottom: 5px; }
  .prompt-card strong { font-size: clamp(25px, 7.2vw, 30px); }
  .bottom-hud { gap: 3px; padding: 1px; }
  .health-panel { min-width: 70px; padding-inline: 6px; }
  .reload-button { min-width: 91px; padding-inline: 5px; }
  .reload-button span { font-size: 10px; letter-spacing: 1.5px; }
}

/* v1.3.18 — compact the combat header before shrinking readable content. */
@media (max-width: 480px) and (max-height: 760px) {
  .game-screen {
    --prompt-top: calc(max(6px, env(safe-area-inset-top)) + 52px);
    --boss-top: calc(max(6px, env(safe-area-inset-top)) + 54px);
  }

  .top-hud {
    top: max(6px, env(safe-area-inset-top));
    min-height: 44px;
    padding: 2px 5px;
  }

  .hud-chip { min-height: 40px; padding: 4px 7px; }
  .hud-chip strong { font-size: 17px; }

  .boss-hud {
    top: var(--boss-top);
    min-height: 34px;
    padding: 4px 10px;
  }

  .boss-hud:not(.hidden) ~ .prompt-card {
    top: calc(max(6px, env(safe-area-inset-top)) + 92px);
  }

  .prompt-card {
    left: 8px;
    right: 8px;
    min-height: 82px;
    padding: 7px 9px 8px;
  }

  .prompt-card p { margin-bottom: 4px; font-size: 14px; color: #e4e9f6; line-height: 1.28; font-weight: 800; }
  .prompt-card strong { font-size: clamp(27px, 7.4vw, 31px); line-height: 1.14; }
  .prompt-kicker span { min-height: 18px; font-size: 8px; }
  .game-screen[data-game-mode="onboarding"] .prompt-card { min-height: 94px; }
  .feedback { top: calc(max(6px, env(safe-area-inset-top)) + 176px); }
}
