@charset "UTF-8";

@font-face {
  font-family: "Noto Serif JP";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("../fonts/noto-serif-jp/noto-serif-jp-japanese-700-normal.woff2") format("woff2");
  unicode-range:
    U+2E80-2EFF,
    U+2F00-2FDF,
    U+3000-303F,
    U+3040-309F,
    U+30A0-30FF,
    U+31F0-31FF,
    U+3400-4DBF,
    U+4E00-9FFF,
    U+F900-FAFF,
    U+FF00-FFEF;
}

@font-face {
  font-family: "Noto Serif JP";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url("../fonts/noto-serif-jp/noto-serif-jp-latin-700-normal.woff2") format("woff2");
  unicode-range:
    U+0000-024F,
    U+1E00-1EFF,
    U+2000-206F;
}

:root {
  color-scheme: dark;
  --ink: #f8f2e8;
  --ink-soft: #c9c0b7;
  --ink-muted: #93898c;
  --night-950: #050507;
  --night-900: #0b090d;
  --night-850: #100d12;
  --night-800: #161119;
  --panel: rgba(16, 12, 18, 0.9);
  --panel-solid: #151019;
  --line: rgba(255, 239, 220, 0.16);
  --line-strong: rgba(255, 239, 220, 0.3);
  --ember: #f03e2f;
  --ember-bright: #ff7250;
  --ember-deep: #871d22;
  --gold: #f5c465;
  --gold-pale: #ffe3a6;
  --light-orb: #bdeeff;
  --greed: #a24ad1;
  --greed-bright: #dc75ff;
  --danger: #e9544d;
  --success: #e8c875;
  --focus: #8de4ff;
  --shadow-deep: 0 1.25rem 4rem rgba(0, 0, 0, 0.72);
  --radius-sm: 0.55rem;
  --radius-md: 0.9rem;
  --radius-lg: 1.35rem;
  /* .game-shell の寸法。セーフエリアの計算と共有するためここで定義する。 */
  --shell-width: min(100vw, calc(100dvh * 0.5625), 45rem);
  --shell-height: min(100dvh, calc(100vw * 1.7778), 80rem);
  /*
   * シェルは .game-app のグリッドで上下左右中央に置かれ、スマートフォンでは
   * 縦にレターボックスされる。ノッチもホームインジケータもその余白に収まるため、
   * env() をそのまま内側の余白へ足すと二重に確保され、HUDが下がりすぎて
   * ボスの描画位置に重なる。シェルが実際に食い込んでいるぶんだけを足す。
   */
  --shell-gap-x: calc((100vw - var(--shell-width)) / 2);
  --shell-gap-y: calc((100dvh - var(--shell-height)) / 2);
  --safe-top: max(0.7rem, calc(env(safe-area-inset-top) - var(--shell-gap-y)));
  --safe-right: max(0.65rem, calc(env(safe-area-inset-right) - var(--shell-gap-x)));
  --safe-bottom: max(0.8rem, calc(env(safe-area-inset-bottom) - var(--shell-gap-y)));
  --safe-left: max(0.65rem, calc(env(safe-area-inset-left) - var(--shell-gap-x)));
  --font-mincho: "Noto Serif JP", "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-family: "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--night-950);
  -webkit-text-size-adjust: 100%;
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
  min-width: 0;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 22%, rgba(86, 29, 35, 0.2), transparent 32rem),
    radial-gradient(circle at 18% 78%, rgba(46, 31, 64, 0.26), transparent 30rem),
    #050507;
  -webkit-tap-highlight-color: transparent;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(90deg, transparent 49.8%, rgba(255, 255, 255, 0.025) 50%, transparent 50.2%),
    linear-gradient(0deg, transparent 49.8%, rgba(255, 255, 255, 0.018) 50%, transparent 50.2%);
  background-size: 5rem 5rem;
  content: "";
  mask-image: radial-gradient(circle, #000, transparent 72%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:not(:disabled) {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

[hidden],
.hidden,
.is-hidden {
  display: none !important;
}

:focus-visible {
  outline: none;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 999;
  padding: 0.7rem 1rem;
  color: #08070a;
  font-weight: 800;
  text-decoration: none;
  background: var(--focus);
  border-radius: 0.4rem;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.game-app {
  display: grid;
  width: 100%;
  height: 100dvh;
  min-height: 100%;
  place-items: center;
  isolation: isolate;
}

.game-shell {
  position: relative;
  width: var(--shell-width);
  max-width: 100%;
  height: var(--shell-height);
  max-height: 100dvh;
  overflow: hidden;
  background: #09080b;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    var(--shadow-deep),
    0 0 8rem rgba(152, 41, 36, 0.11);
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}

/*
 * iOS のアプリ内ブラウザでは、操作中のパンがブラウザ UI に渡ると
 * ツールバーの開閉に合わせて visual viewport ごと動いてしまう。
 * ゲーム中だけシェル全体をジェスチャー対象外にし、画面内スクロールが
 * 必要なタイトル／モーダルでは従来どおり pan-y を許可する。
 */
.game-app[data-state="playing"] .game-shell,
.game-app[data-state="boss"] .game-shell {
  overscroll-behavior: none;
  touch-action: none;
}

.game-stage,
#gameCanvas,
.stage-vignette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.game-stage {
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, #1b1720 0, #100e13 38%, #070609 100%);
}

#gameCanvas {
  z-index: 1;
  display: block;
  background: transparent;
  outline-offset: -0.3rem;
  touch-action: none;
}

.game-app[data-state="playing"] #gameCanvas,
.game-app[data-state="boss"] #gameCanvas {
  cursor: crosshair;
}

.game-app #gameCanvas.is-pointer-steering {
  cursor: grabbing;
}

.stage-vignette {
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.34), transparent 16%, transparent 77%, rgba(0, 0, 0, 0.34)),
    radial-gradient(ellipse at center, transparent 54%, rgba(1, 1, 3, 0.45) 100%);
  box-shadow: inset 0 0 4.5rem rgba(0, 0, 0, 0.58);
}

/* HUD */

.hud {
  position: absolute;
  inset: 0;
  z-index: 20;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  pointer-events: none;
}

.hud-top-row {
  display: grid;
  grid-template-columns: minmax(6.2rem, 1fr) auto minmax(3.2rem, auto) 2.8rem;
  gap: clamp(0.3rem, 1.5vw, 0.55rem);
  align-items: stretch;
}

.hud-card,
.greed-panel,
.boss-hud {
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), transparent 48%),
    rgba(10, 8, 12, 0.8);
  box-shadow: 0 0.35rem 1.2rem rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(0.35rem);
  -webkit-backdrop-filter: blur(0.35rem);
}

.hud-card {
  min-width: 0;
  min-height: 2.8rem;
  padding: 0.36rem 0.5rem;
  border-radius: var(--radius-sm);
}

.hud-card-heading,
.meter-heading,
.boss-hud-heading {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.hud-label {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: clamp(0.59rem, 2.3vw, 0.72rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-value,
.meter-number {
  color: var(--ink);
  font-size: clamp(0.58rem, 2.2vw, 0.72rem);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  white-space: nowrap;
}

.timer-card,
.level-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.timer-text {
  color: var(--gold-pale);
  font-size: clamp(1rem, 4vw, 1.3rem);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.05;
  text-shadow: 0 0 0.8rem rgba(255, 205, 108, 0.25);
}

.level-text {
  color: var(--ink);
  font-size: clamp(1rem, 4vw, 1.3rem);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1.05;
}

.meter {
  position: relative;
  height: 0.48rem;
  margin-top: 0.34rem;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  box-shadow: inset 0 0.08rem 0.2rem rgba(0, 0, 0, 0.9);
}

.meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--meter-value, 0%);
  min-width: 0;
  border-radius: inherit;
  transition: width 180ms ease-out;
}

.meter--hp .meter-fill {
  background: linear-gradient(90deg, #9e252d, #f34b3d 62%, #ff8761);
  box-shadow: 0 0 0.55rem rgba(255, 70, 55, 0.45);
}

.xp-meter-heading {
  display: flex;
  margin-top: 0.26rem;
  align-items: center;
  justify-content: space-between;
}

.xp-label,
.xp-value {
  color: #d9f8ff;
  font-size: clamp(0.5rem, 1.9vw, 0.62rem);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.xp-label {
  letter-spacing: 0.12em;
  text-shadow: 0 0 0.45rem rgba(155, 231, 255, 0.68);
}

.xp-value {
  color: #b9dce5;
}

.meter--xp {
  height: 0.34rem;
  margin-top: 0.16rem;
  border-color: rgba(198, 244, 255, 0.2);
}

.meter--xp .meter-fill {
  background: linear-gradient(90deg, #5398b3, #a6e8f7 65%, #efffff);
  box-shadow: 0 0 0.55rem rgba(151, 231, 255, 0.58);
}

.greed-panel {
  margin-top: 0.45rem;
  padding: 0.38rem 0.55rem 0.48rem;
  border-color: rgba(201, 100, 245, 0.25);
  border-radius: var(--radius-sm);
}

.greed-panel .meter-heading {
  justify-content: flex-start;
}

.greed-panel .meter-number {
  margin-left: auto;
  color: #edbdff;
}

.greed-mark {
  width: 0.62rem;
  height: 0.62rem;
  background: radial-gradient(circle at 42% 38%, #dd91ff, #64167f 68%);
  border: 1px solid rgba(246, 194, 255, 0.4);
  border-radius: 50%;
  box-shadow: 0 0 0.55rem rgba(190, 71, 236, 0.55);
}

.meter--greed {
  height: 0.6rem;
}

.meter--greed .meter-fill {
  background:
    repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.12) 0 0.4rem, transparent 0.4rem 0.8rem),
    linear-gradient(90deg, #4a145f, var(--greed) 64%, var(--greed-bright));
  box-shadow: 0 0 0.8rem rgba(188, 77, 233, 0.45);
}

.meter-threshold {
  position: absolute;
  top: -0.18rem;
  bottom: -0.18rem;
  width: 1px;
  background: rgba(255, 255, 255, 0.45);
}

.meter-threshold--25 { left: 25%; }
.meter-threshold--50 { left: 50%; }
.meter-threshold--75 { left: 75%; }

.boss-hud {
  width: min(88%, 31rem);
  margin: 0.5rem auto 0;
  padding: 0.42rem 0.65rem 0.55rem;
  border-color: rgba(226, 72, 65, 0.38);
  border-radius: var(--radius-sm);
  box-shadow:
    0 0.4rem 1.4rem rgba(0, 0, 0, 0.38),
    0 0 1.8rem rgba(147, 25, 32, 0.12);
}

.boss-hud-heading {
  color: #ffe2dc;
  font-size: clamp(0.66rem, 2.5vw, 0.82rem);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.meter--boss {
  height: 0.7rem;
}

.meter--boss .meter-fill {
  background: linear-gradient(90deg, #59121d, #bd2932 60%, #ee5a4c);
  box-shadow: 0 0 0.8rem rgba(237, 67, 57, 0.48);
}

.icon-button {
  position: relative;
  display: grid;
  width: 2.8rem;
  min-width: 2.8rem;
  height: 2.8rem;
  padding: 0;
  place-items: center;
  color: var(--ink-soft);
  background: rgba(10, 8, 12, 0.82);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

.icon-button:hover {
  color: #fff;
  border-color: var(--line-strong);
  background: rgba(35, 26, 37, 0.94);
}

.icon-button:active {
  transform: scale(0.94);
}

.pause-icon,
.pause-icon::after {
  width: 0.28rem;
  height: 1rem;
  background: currentColor;
  border-radius: 0.08rem;
}

.pause-icon {
  position: relative;
  display: block;
  transform: translateX(-0.27rem);
}

.pause-icon::after {
  position: absolute;
  left: 0.54rem;
  content: "";
}

/* Touch controls */

.game-controls {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 25;
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
  padding: 1rem var(--safe-right) var(--safe-bottom) var(--safe-left);
  pointer-events: none;
}

.joystick {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  align-items: center;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  pointer-events: auto;
  touch-action: none;
}

.joystick-ring {
  position: relative;
  display: grid;
  width: clamp(5.6rem, 25vw, 7.2rem);
  height: clamp(5.6rem, 25vw, 7.2rem);
  place-items: center;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.045) 0 32%, transparent 33%),
    rgba(4, 4, 6, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  box-shadow:
    inset 0 0 1.2rem rgba(0, 0, 0, 0.6),
    0 0.5rem 1.5rem rgba(0, 0, 0, 0.24);
}

.joystick-ring::before,
.joystick-ring::after {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  content: "";
}

.joystick-ring::before {
  width: 44%;
  height: 1px;
}

.joystick-ring::after {
  width: 1px;
  height: 44%;
}

.joystick-knob {
  position: relative;
  z-index: 1;
  width: 46%;
  height: 46%;
  background:
    radial-gradient(circle at 38% 32%, rgba(255, 255, 255, 0.26), transparent 38%),
    linear-gradient(145deg, rgba(124, 74, 78, 0.92), rgba(47, 30, 39, 0.95));
  border: 1px solid rgba(255, 225, 218, 0.35);
  border-radius: 50%;
  box-shadow:
    0 0.35rem 0.8rem rgba(0, 0, 0, 0.55),
    inset 0 0 0.5rem rgba(255, 255, 255, 0.08);
  will-change: transform;
}

.recall-button {
  position: relative;
  display: grid;
  min-width: clamp(7.4rem, 34vw, 9rem);
  min-height: 4.35rem;
  padding: 0.5rem 0.75rem;
  overflow: hidden;
  grid-template-columns: 2.1rem 1fr;
  gap: 0.45rem;
  align-items: center;
  color: #fff3ed;
  background:
    linear-gradient(145deg, rgba(94, 25, 31, 0.96), rgba(43, 14, 21, 0.98));
  border: 1px solid rgba(255, 116, 86, 0.58);
  border-radius: 999px;
  box-shadow:
    0 0.5rem 1.5rem rgba(0, 0, 0, 0.42),
    0 0 1.3rem rgba(236, 54, 43, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  pointer-events: auto;
  touch-action: none;
  isolation: isolate;
}

.recall-button-glow {
  position: absolute;
  inset: -40%;
  z-index: -1;
  background: conic-gradient(from 40deg, transparent, rgba(255, 100, 67, 0.22), transparent 32%);
  animation: recall-glow 4s linear infinite;
}

.recall-button:hover:not(:disabled),
.recall-button[data-ready="true"]:focus-visible {
  border-color: rgba(255, 155, 111, 0.92);
  box-shadow:
    0 0.5rem 1.5rem rgba(0, 0, 0, 0.42),
    0 0 1.65rem rgba(255, 64, 45, 0.36),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.recall-button:active:not(:disabled) {
  transform: scale(0.96);
}

.recall-button[data-ready="false"],
.recall-button.is-cooling-down {
  color: rgba(255, 244, 239, 0.62);
  filter: saturate(0.45);
}

.recall-icon {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: var(--ember-bright);
  font-size: 1.35rem;
  font-weight: 900;
  text-shadow: 0 0 0.75rem rgba(255, 78, 54, 0.75);
  transform: rotate(45deg);
}

.recall-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.recall-copy strong {
  font-size: clamp(0.72rem, 3.1vw, 0.88rem);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.recall-copy small {
  margin-top: 0.2rem;
  color: rgba(255, 225, 215, 0.68);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.recall-copy .dragon-hint {
  color: #ffba72;
  letter-spacing: 0.04em;
  text-transform: none;
}

.recall-button[data-dragon-ready="true"] {
  border-color: rgba(255, 174, 92, 0.72);
  box-shadow:
    0 0.5rem 1.5rem rgba(0, 0, 0, 0.42),
    0 0 1.6rem rgba(255, 116, 42, 0.28),
    inset 0 0 0 1px rgba(255, 227, 176, 0.08);
}

.recall-cooldown {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(to top, rgba(5, 4, 7, 0.72) var(--cooldown, 0%), transparent var(--cooldown, 0%));
  pointer-events: none;
}

.dragon-hold-progress {
  position: absolute;
  right: 12%;
  bottom: 0.32rem;
  left: 12%;
  z-index: 3;
  height: 0.2rem;
  background: linear-gradient(90deg, #ff6a35, #ffd06f);
  border-radius: 999px;
  box-shadow: 0 0 0.75rem rgba(255, 112, 52, 0.8);
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: left;
}

.recall-button.is-dragon-holding .dragon-hold-progress {
  animation: dragon-charge 0.7s linear forwards;
}

@keyframes recall-glow {
  to { transform: rotate(360deg); }
}

@keyframes dragon-charge {
  to { transform: scaleX(1); }
}

/* Shared screens */

.screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  overflow: auto;
  place-items: center;
  padding:
    calc(var(--safe-top) + 1rem)
    calc(var(--safe-right) + 0.85rem)
    calc(var(--safe-bottom) + 1rem)
    calc(var(--safe-left) + 0.85rem);
  text-align: center;
  touch-action: pan-y;
}

.title-screen {
  background:
    linear-gradient(to bottom, rgba(5, 4, 7, 0.3), rgba(5, 4, 7, 0.7)),
    radial-gradient(circle at 50% 43%, rgba(123, 31, 37, 0.25), transparent 28%),
    radial-gradient(ellipse at 50% 100%, rgba(76, 22, 39, 0.55), transparent 52%),
    #09080b;
}

.title-screen::before,
.title-screen::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
}

.title-screen::before {
  opacity: 0.24;
  background-image:
    linear-gradient(120deg, transparent 0 48%, rgba(238, 83, 58, 0.18) 49%, transparent 50%),
    linear-gradient(60deg, transparent 0 48%, rgba(238, 83, 58, 0.12) 49%, transparent 50%);
  background-position: center 72%;
  background-size: 6rem 8rem;
  mask-image: linear-gradient(to top, #000, transparent 66%);
}

.title-screen::after {
  background:
    linear-gradient(to right, rgba(0, 0, 0, 0.5), transparent 22% 78%, rgba(0, 0, 0, 0.5)),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.38), transparent 30%, transparent 76%, rgba(0, 0, 0, 0.6));
}

.title-content {
  position: relative;
  z-index: 3;
  display: flex;
  width: min(100%, 28rem);
  flex-direction: column;
  align-items: center;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--gold);
  font-size: clamp(0.65rem, 2.5vw, 0.78rem);
  font-weight: 800;
  letter-spacing: 0.2em;
  line-height: 1.5;
}

.game-title {
  margin: 0 0 2rem;
  line-height: 1;
  text-shadow:
    0 0.2rem 0.1rem #000,
    0 0 2.2rem rgba(234, 64, 43, 0.23);
}

.game-title-main,
.game-title-sub {
  display: block;
}

.game-title-main {
  width: min(100%, 17rem);
  height: auto;
  margin-inline: auto;
  filter: drop-shadow(0 0.2rem 0.1rem #000)
    drop-shadow(0 0 2.2rem rgba(234, 64, 43, 0.23));
}

.game-title-sub {
  margin-top: 0.5rem;
  color: #d9cdd5;
  font-family: var(--font-mincho);
  font-size: clamp(0.9rem, 4vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
}

.primary-button {
  position: relative;
  display: inline-flex;
  width: min(100%, 19rem);
  min-height: 3.35rem;
  padding: 0.75rem 1.1rem;
  overflow: hidden;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  color: #fff8f2;
  font-size: clamp(0.9rem, 3.5vw, 1rem);
  font-weight: 900;
  letter-spacing: 0.09em;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.08), transparent 38%),
    linear-gradient(135deg, #9d2b2c, #641c28);
  border: 1px solid rgba(255, 135, 103, 0.62);
  border-radius: 999px;
  box-shadow:
    0 0.55rem 1.6rem rgba(0, 0, 0, 0.42),
    0 0 1.5rem rgba(238, 57, 43, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 100ms ease;
}

.primary-button::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 18%, rgba(255, 255, 255, 0.15) 48%, transparent 68%);
  content: "";
  transform: translateX(-120%);
  transition: transform 450ms ease;
}

.primary-button:hover::before,
.primary-button:focus-visible::before {
  transform: translateX(120%);
}

.primary-button:hover {
  border-color: rgba(255, 185, 147, 0.9);
  box-shadow:
    0 0.55rem 1.6rem rgba(0, 0, 0, 0.42),
    0 0 2rem rgba(246, 65, 43, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.primary-button:active {
  transform: scale(0.97);
}

.button-arrow {
  color: #ffc1a8;
  font-size: 1.35em;
  line-height: 1;
}

.title-menu {
  display: grid;
  width: min(100%, 19rem);
  margin-top: 0.65rem;
  gap: 0.45rem;
}

.title-menu-button {
  display: inline-flex;
  width: 100%;
  min-height: 3.2rem;
  padding: 0.7rem 1.4rem;
  gap: 0.7rem;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: clamp(0.9rem, 3.5vw, 1rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 100ms ease;
}

.title-menu-button:hover,
.title-menu-button:focus-visible {
  color: #fff3e7;
  background-color: rgba(142, 59, 48, 0.18);
  border-color: rgba(255, 159, 113, 0.48);
}

.title-menu-button:active {
  transform: scale(0.97);
}

.title-menu-button--status {
  color: #ffe8cf;
  background: rgba(222, 139, 76, 0.2);
  border-color: rgba(255, 190, 132, 0.52);
}

.title-menu-button--status:hover,
.title-menu-button--status:focus-visible {
  color: #fff8ef;
  background-color: rgba(226, 145, 79, 0.3);
  border-color: rgba(255, 204, 155, 0.72);
}

.controls-help {
  width: min(100%, 21rem);
  margin-top: 0.7rem;
  padding-top: 0.85rem;
  color: var(--ink-soft);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-heading {
  margin: 0 0 0.48rem;
  color: var(--ink-muted);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.control-list {
  display: flex;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  gap: 0.36rem 0.7rem;
  justify-content: center;
  list-style: none;
  font-size: clamp(0.65rem, 2.5vw, 0.75rem);
}

.control-list li {
  display: flex;
  gap: 0.28rem;
  align-items: center;
}

/*
 * タッチではキャンバスのドラッグ移動もキーボードも効かないため、表記を分ける。
 * 既定をタッチ向けにして、PC向けは .joystick と同じ
 * (hover: hover) and (pointer: fine) の判定で出し分ける。
 * ポーズは常時見えているHUDのボタンなので、事前に説明する一覧からは省く。
 */
.control-list--pointer {
  display: none;
}

.control-list--touch {
  flex-direction: column;
  gap: 0.4rem;
}

.control-list--touch li {
  gap: 0.5rem;
  justify-content: center;
}

.control-where {
  color: var(--ink-muted);
}

kbd {
  display: inline-flex;
  min-width: 1.45rem;
  min-height: 1.35rem;
  padding: 0.12rem 0.34rem;
  align-items: center;
  justify-content: center;
  color: #ede6e3;
  font-family: inherit;
  font-size: 0.72em;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom-width: 0.16rem;
  border-radius: 0.3rem;
}

.touch-help {
  display: none;
  margin: 0.48rem 0 0;
  color: var(--ink-muted);
  font-size: clamp(0.6rem, 2.3vw, 0.7rem);
  line-height: 1.55;
}

.original-links {
  display: flex;
  margin-top: 0.6rem;
  flex-direction: column;
  gap: 0.55rem;
  align-items: center;
  font-size: clamp(0.6rem, 2.35vw, 0.7rem);
  line-height: 1.6;
}

.original-links a {
  padding-bottom: 0.08rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dotted rgba(220, 117, 255, 0.58);
  transition: color 160ms ease, border-color 160ms ease;
}

.original-links a:hover,
.original-links a:focus-visible {
  color: #fff3e7;
  border-color: var(--ember-bright);
}

.original-links a:active {
  color: var(--gold-pale);
}

.original-links--result {
  margin-top: 1rem;
}

/*
 * 以前は画面下端への absolute 配置だったが、本文が縦にはみ出す高さでは
 * 中央寄せされた .title-content と重なっていた。フロー内に置けば
 * どの画面サイズでも衝突しない。
 */
.prototype-note {
  margin: 0.55rem 0 0;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  white-space: nowrap;
}

/* Modal screens */

.modal-screen {
  z-index: 50;
  background:
    radial-gradient(circle at 50% 42%, rgba(103, 29, 38, 0.22), transparent 42%),
    rgba(3, 3, 5, 0.78);
  backdrop-filter: blur(0.35rem);
  -webkit-backdrop-filter: blur(0.35rem);
}

.end-fade {
  position: absolute;
  inset: 0;
  z-index: 90;
  background: #000;
  opacity: 0;
  pointer-events: auto;
  touch-action: none;
  cursor: wait;
}

.boss-death-flash {
  position: absolute;
  inset: 0;
  z-index: 45;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}

.boss-death-flash.is-active {
  animation: boss-death-sequence 4.35s linear both;
}

.boss-death-flash.is-holding {
  opacity: 1;
  mix-blend-mode: normal;
}

.boss-death-flash.is-revealing-result {
  z-index: 90;
  pointer-events: auto;
  cursor: wait;
  animation: end-fade-reveal var(--end-reveal-duration, 0.55s) ease-out both;
}

.boss-death-message {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.75rem, 3vw, 1.2rem);
  color: #0a0a0a;
  text-align: center;
}

.boss-death-survival,
.boss-death-congratulations {
  opacity: 0;
}

.boss-death-survival {
  display: block;
  width: clamp(10rem, 42vw, 14rem);
  aspect-ratio: 350 / 170;
  overflow: hidden;
}

.boss-death-survival img {
  display: block;
  width: 100%;
  height: auto;
  transform: translateY(-26%);
}

.boss-death-congratulations {
  font-family: inherit;
  font-size: clamp(0.72rem, 3vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-indent: 0.12em;
}

.boss-death-flash.show-survival .boss-death-survival,
.boss-death-flash.show-congratulations .boss-death-congratulations {
  animation: boss-death-message-in 600ms ease-out both;
}

.game-app[data-state="paused"] .boss-death-flash.is-active,
.game-app[data-state="levelup"] .boss-death-flash.is-active {
  animation-play-state: paused;
}

@keyframes boss-death-sequence {
  0% { opacity: 0.96; }
  5.52%, 34.47% { opacity: 0; }
  34.48% { opacity: 1; }
  40%, 57.47% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes boss-death-message-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.end-fade.is-white {
  background: #fff;
}

.end-fade.is-covering {
  opacity: 1;
}

.end-fade.is-fading-out {
  animation: end-fade-to-black var(--end-fade-duration, 1.45s) cubic-bezier(0.45, 0, 0.55, 1) both;
}

.end-fade.is-revealing {
  animation: end-fade-reveal var(--end-reveal-duration, 0.55s) ease-out both;
}

@keyframes end-fade-to-black {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes end-fade-reveal {
  from { opacity: 1; }
  to { opacity: 0; }
}

.modal-panel {
  width: min(100%, 34rem);
  padding: clamp(1.15rem, 5vw, 2rem);
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent 36%),
    rgba(17, 13, 19, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow:
    0 1rem 3.5rem rgba(0, 0, 0, 0.68),
    inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.modal-panel h2 {
  margin: 0;
  font-family: var(--font-mincho);
  font-size: clamp(1.55rem, 7vw, 2.35rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.25;
}

.modal-lead {
  margin: 0.5rem 0 1.1rem;
  color: var(--ink-muted);
  font-size: clamp(0.68rem, 2.6vw, 0.8rem);
}

.status-screen {
  align-items: start;
}

.status-panel {
  position: relative;
  width: min(100%, 32rem);
  margin-block: auto;
  text-align: left;
}

.status-panel:focus {
  outline: none;
}

.status-overview {
  display: grid;
  margin-bottom: 0.85rem;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: clamp(0.7rem, 3vw, 1.1rem);
  align-items: center;
}

.status-character {
  position: relative;
  display: grid;
  min-height: 178px;
  place-items: end center;
  isolation: isolate;
}

.status-character::before {
  position: absolute;
  inset: 18% -10% 2%;
  z-index: -1;
  background: radial-gradient(ellipse at 50% 70%, rgba(240, 62, 47, 0.2), transparent 68%);
  content: "";
  filter: blur(0.35rem);
}

.status-character::after {
  position: absolute;
  right: 4%;
  bottom: 0;
  left: 4%;
  z-index: -1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 166, 94, 0.48), transparent);
  box-shadow: 0 0 0.8rem rgba(255, 91, 45, 0.35);
  content: "";
}

.status-character img {
  display: block;
  width: 128px;
  height: 178px;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  filter:
    drop-shadow(0 0.35rem 0.16rem rgba(0, 0, 0, 0.8))
    drop-shadow(0 0 0.65rem rgba(180, 42, 32, 0.28));
}

.status-summary {
  min-width: 0;
}

.status-summary .eyebrow {
  margin-bottom: 0.3rem;
}

.status-summary h2 {
  font-size: clamp(1.3rem, 5.4vw, 1.8rem);
  letter-spacing: 0.06em;
}

.status-summary .modal-lead {
  margin: 0.35rem 0 0.75rem;
  line-height: 1.55;
}

.status-wallet {
  display: grid;
  min-height: 3.4rem;
  margin-bottom: 0;
  padding: 0.55rem 0.8rem;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  color: var(--ink-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: rgba(255, 132, 73, 0.055);
  border: 1px solid rgba(255, 166, 94, 0.2);
  border-radius: 0.7rem;
}

.status-wallet-mark {
  color: #ff9b58;
  font-size: 1rem;
  text-shadow: 0 0 0.8rem rgba(255, 91, 45, 0.65);
}

.status-wallet output {
  color: #fff0d4;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: 0;
}

.status-effect-list {
  display: grid;
  margin: 0;
  gap: 0.42rem;
}

.status-effect {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 3.8rem;
  padding: 0.58rem 0.68rem;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 0.75rem;
  align-items: center;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.65rem;
  transition: border-color 140ms ease, background-color 140ms ease, transform 100ms ease;
}

.status-effect.is-active {
  background: rgba(126, 50, 39, 0.1);
  border-color: rgba(255, 151, 100, 0.25);
}

.status-effect:not(:disabled):hover,
.status-effect:not(:disabled):focus-visible {
  background-color: rgba(148, 55, 42, 0.18);
  border-color: rgba(255, 142, 91, 0.62);
}

.status-effect:not(:disabled):active {
  transform: scale(0.99);
}

.status-effect-copy,
.status-effect-description,
.status-effect-progress,
.status-effect-purchase {
  min-width: 0;
}

.status-effect-copy,
.status-effect-progress,
.status-effect-purchase {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.status-effect-copy {
  grid-row: 1;
}

.status-effect-copy strong {
  color: #fff3e7;
  font-size: 0.76rem;
}

.status-effect-description {
  grid-row: 2;
  grid-column: 1 / -1;
  color: var(--ink-muted);
  font-size: 0.58rem;
  line-height: 1.45;
  white-space: normal;
}

.status-effect-progress,
.status-effect-purchase {
  grid-column: 2;
  align-items: flex-end;
  text-align: right;
}

.status-effect-progress {
  grid-row: 1;
}

.status-effect-rank > span,
.status-effect-purchase small {
  color: var(--ink-muted);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.status-effect-rank {
  display: inline-flex;
  height: 15px;
  gap: 0;
  align-items: center;
  white-space: nowrap;
}

.status-effect-rank > span {
  margin-right: 0.25rem;
}

.status-effect-rank img {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.status-effect-progress strong {
  color: var(--ink-muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

.status-effect.is-active .status-effect-progress strong {
  color: #ffbd87;
}

.status-effect-purchase {
  grid-row: 3;
  flex-direction: row;
  justify-content: flex-end;
  gap: 0.35rem;
}

.status-effect-purchase strong {
  color: #ffad72;
  font-size: 0.7rem;
  white-space: nowrap;
}

.status-effect:disabled {
  opacity: 1;
}

.status-effect:disabled .status-effect-purchase {
  opacity: 0.48;
}

.status-reset {
  display: grid;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  gap: 0.35rem;
  justify-items: end;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.status-reset p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.58rem;
  line-height: 1.5;
  text-align: right;
}

.status-reset .danger-button {
  min-width: 4.4rem;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.62rem;
}

.status-actions {
  display: flex;
  margin-top: 1rem;
  justify-content: center;
}

.status-actions .primary-button {
  min-height: 2.8rem;
}

.danger-button {
  min-width: 5.5rem;
  min-height: 2.45rem;
  padding: 0.5rem 0.9rem;
  flex: 0 0 auto;
  color: #ffaaa5;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  background: rgba(137, 26, 32, 0.16);
  border: 1px solid rgba(233, 84, 77, 0.42);
  border-radius: 999px;
}

.danger-button:hover,
.danger-button:focus-visible {
  color: #fff0ef;
  background-color: rgba(171, 35, 39, 0.3);
  border-color: rgba(255, 116, 108, 0.72);
}

.upgrade-panel {
  width: min(100%, 39rem);
  min-width: 0;
  margin-block: auto;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent 36%),
    rgba(17, 13, 19, 0.45);
}

.levelup-screen {
  place-items: start center;
  background:
    radial-gradient(circle at 50% 42%, rgba(103, 29, 38, 0.1), transparent 52%),
    rgba(3, 3, 5, 0.14);
  backdrop-filter: blur(0.05rem);
  -webkit-backdrop-filter: blur(0.05rem);
}

.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.48rem, 2vw, 0.75rem);
  margin-top: 1rem;
}

.upgrade-shuffle {
  display: flex;
  margin-top: 0.85rem;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  justify-content: center;
}

.upgrade-shuffle-wallet {
  display: inline-grid;
  min-height: 2.5rem;
  padding: 0.42rem 0.7rem;
  grid-template-columns: auto auto;
  gap: 0 0.4rem;
  align-items: center;
  color: #ff9b58;
  background: rgba(255, 132, 73, 0.055);
  border: 1px solid rgba(255, 166, 94, 0.2);
  border-radius: 999px;
}

.upgrade-shuffle-wallet output {
  color: #fff0d4;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.upgrade-shuffle-wallet small {
  grid-column: 1 / 3;
  color: var(--ink-muted);
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
}

.upgrade-shuffle-button {
  display: inline-flex;
  min-height: 2.5rem;
  padding: 0.5rem 0.85rem;
  gap: 0.42rem;
  align-items: center;
  color: #fff0d4;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  background: rgba(137, 52, 32, 0.2);
  border: 1px solid rgba(255, 151, 100, 0.42);
  border-radius: 999px;
  transition: border-color 140ms ease, background-color 140ms ease, transform 100ms ease;
}

.upgrade-shuffle-button strong {
  color: #ffad72;
  font-size: 0.65rem;
  white-space: nowrap;
}

.upgrade-shuffle-button:not(:disabled):hover,
.upgrade-shuffle-button:not(:disabled):focus-visible {
  background-color: rgba(171, 63, 39, 0.34);
  border-color: rgba(255, 166, 111, 0.76);
}

.upgrade-shuffle-button:not(:disabled):active {
  transform: scale(0.97);
}

.upgrade-card {
  position: relative;
  display: flex;
  max-width: 100%;
  min-width: 0;
  min-height: 11.5rem;
  padding: 0.85rem 0.7rem 0.72rem;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 20%, rgba(239, 75, 55, 0.12), transparent 40%),
    rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 1.4rem rgba(0, 0, 0, 0.18);
  transition: background-color 150ms ease, border-color 150ms ease, transform 120ms ease;
}

.upgrade-card:hover,
.upgrade-card:focus-visible,
.upgrade-card[data-selected] {
  background-color: rgba(132, 42, 44, 0.15);
  border-color: rgba(255, 132, 99, 0.68);
  transform: translateY(-0.18rem);
}

.upgrade-card:active {
  transform: scale(0.97);
}

.upgrade-card[data-category="muu"] { --upgrade-accent: #ff6651; }
.upgrade-card[data-category="collect"] { --upgrade-accent: #92d9ef; }
.upgrade-card[data-category="chris"] { --upgrade-accent: #eac871; }

.upgrade-category {
  display: inline-flex;
  max-width: 100%;
  min-height: 1.4rem;
  padding: 0.18rem 0.55rem;
  align-items: center;
  justify-content: center;
  color: var(--upgrade-accent, var(--ember-bright));
  font-size: clamp(0.55rem, 2.1vw, 0.66rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  background: color-mix(in srgb, var(--upgrade-accent, var(--ember)) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--upgrade-accent, var(--ember)) 40%, transparent);
  border-radius: 999px;
}

.upgrade-name {
  max-width: 100%;
  color: #fff5ed;
  font-family: var(--font-mincho);
  font-size: clamp(0.95rem, 4vw, 1.18rem);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.upgrade-stars {
  display: flex;
  min-height: 0.94rem;
  gap: 0.1rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.upgrade-stars img {
  width: 0.94rem;
  height: 0.94rem;
  object-fit: contain;
}

.upgrade-description {
  max-width: 100%;
  color: var(--ink-soft);
  font-size: clamp(0.62rem, 2.4vw, 0.75rem);
  line-height: 1.6;
}

.upgrade-select {
  display: inline-flex;
  width: min(4rem, 100%);
  min-width: 0;
  min-height: 1.8rem;
  margin-top: auto;
  padding: 0.2rem 0.6rem;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.upgrade-card:hover .upgrade-select,
.upgrade-card:focus-visible .upgrade-select,
.upgrade-card[data-selected] .upgrade-select {
  color: #fff;
  border-color: rgba(255, 134, 104, 0.55);
}

.upgrade-controls {
  display: flex;
  margin: 0 0 0.15rem;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  font-size: clamp(0.62rem, 2.4vw, 0.72rem);
}

.pause-panel {
  display: flex;
  max-width: 23rem;
  flex-direction: column;
  align-items: center;
}

.pause-emblem {
  position: relative;
  width: 3.1rem;
  height: 3.1rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

.pause-emblem::before,
.pause-emblem::after {
  position: absolute;
  top: 0.9rem;
  width: 0.3rem;
  height: 1.15rem;
  background: var(--gold-pale);
  border-radius: 0.1rem;
  content: "";
}

.pause-emblem::before { left: 1.05rem; }
.pause-emblem::after { right: 1.05rem; }

.pause-panel .primary-button {
  margin-top: 1.3rem;
}

.pause-help {
  display: flex;
  margin-top: 1.2rem;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--ink-muted);
  font-size: 0.7rem;
}

/* タッチでは Esc も マウスドラッグも効かないため、PC向けの行は出さない。 */
.pointer-pause-help {
  display: none;
}

/* Boss entrance */

.boss-intro {
  z-index: 60;
  overflow: hidden;
  pointer-events: none;
  background: #000;
  animation: boss-screen-in 7.59s both;
}

.boss-intro-shadow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(66vw, 23rem);
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 42% 40%, rgba(110, 72, 115, 0.24), transparent 10%),
    radial-gradient(circle at 50% 50%, #100d14 0 44%, #020203 68%);
  border: 1px solid rgba(168, 104, 175, 0.12);
  border-radius: 47% 53% 49% 51%;
  box-shadow:
    0 0 5rem rgba(95, 29, 104, 0.3),
    0 0 0 12rem rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translate(-50%, -50%);
  animation: boss-intro-content-in 3s ease-in-out both;
}

.boss-intro-portrait {
  position: absolute;
  top: 48%;
  left: 50%;
  width: clamp(8.5rem, 46%, 12rem);
  aspect-ratio: 57 / 77;
  filter: drop-shadow(0 0 1.6rem rgba(107, 49, 124, 0.72));
  transform: translate(-50%, -50%);
}

.boss-intro-face {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  object-fit: contain;
  opacity: 1;
  animation: boss-face-reveal 3s ease-out both;
}

.boss-intro-eyelid {
  position: absolute;
  top: 33.766%;
  z-index: 1;
  width: 31.579%;
  height: 19.481%;
}

.boss-intro-eyelid--right {
  left: 19.298%;
}

.boss-intro-eyelid--left {
  left: 54.386%;
}

.boss-intro-eyelid-frame {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  object-fit: contain;
  opacity: 0;
  animation-duration: 1.65s;
  animation-delay: 3s;
  animation-timing-function: steps(1, end);
  animation-fill-mode: both;
}

.boss-intro-eyelid-frame--1 {
  animation-name: boss-eyelid-frame-1;
}

.boss-intro-eyelid-frame--2 {
  animation-name: boss-eyelid-frame-2;
}

.boss-intro-eyelid-frame--3 {
  animation-name: boss-eyelid-frame-3;
}

.boss-intro-eyelid-frame--4 {
  animation-name: boss-eyelid-frame-4;
}

.boss-intro-double-blink {
  position: absolute;
  top: 33.766%;
  z-index: 2;
  width: 31.579%;
  height: 19.481%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  image-rendering: pixelated;
  opacity: 0;
  animation: boss-double-blink 0.6s 4.52s steps(1, end);
}

.boss-intro-double-blink--right {
  --blink-frame-1: url("../image/king_near_eyelid-r.png");
  --blink-frame-2: url("../image/king_near_eyelid-r2.png");
  --blink-frame-3: url("../image/king_near_eyelid-r3.png");
  --blink-frame-4: url("../image/king_near_eyelid-r4.png");
  left: 19.298%;
}

.boss-intro-double-blink--left {
  --blink-frame-1: url("../image/king_near_eyelid-l.png");
  --blink-frame-2: url("../image/king_near_eyelid-l2.png");
  --blink-frame-3: url("../image/king_near_eyelid-l3.png");
  --blink-frame-4: url("../image/king_near_eyelid-l4.png");
  left: 54.386%;
}

.boss-intro-copy {
  position: relative;
  z-index: 2;
  margin-top: 42vh;
  opacity: 0;
  text-shadow: 0 0.2rem 1.3rem #000;
  animation: boss-intro-content-in 3s ease-in-out both;
}

.boss-intro-copy p {
  margin: 0 0 0.6rem;
  color: #bd9ec3;
  font-size: clamp(0.7rem, 3vw, 0.86rem);
  font-weight: 800;
  letter-spacing: 0.2em;
}

.boss-intro-copy h2 {
  margin: 0;
  color: #f1e6ed;
  font-family: var(--font-mincho);
  font-size: clamp(2rem, 10vw, 3.7rem);
  font-weight: 700;
  letter-spacing: 0.17em;
  text-indent: 0.17em;
}

@keyframes boss-screen-in {
  0%, 93.41% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes boss-intro-content-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes boss-face-reveal {
  0% { transform: scale(0.94); }
  100% { transform: scale(1); }
}

@keyframes boss-eyelid-frame-1 {
  0%, 20.99% { opacity: 1; }
  21%, 100% { opacity: 0; }
}

@keyframes boss-eyelid-frame-2 {
  0%, 20.99% { opacity: 0; }
  21%, 41.99% { opacity: 1; }
  42%, 100% { opacity: 0; }
}

@keyframes boss-eyelid-frame-3 {
  0%, 41.99% { opacity: 0; }
  42%, 62.99% { opacity: 1; }
  63%, 100% { opacity: 0; }
}

@keyframes boss-eyelid-frame-4 {
  0%, 62.99% { opacity: 0; }
  63%, 83.99% { opacity: 1; }
  84%, 100% { opacity: 0; }
}

@keyframes boss-double-blink {
  0%, 4.99% {
    opacity: 1;
    background-image: var(--blink-frame-4);
  }
  5%, 9.99% { opacity: 1; background-image: var(--blink-frame-3); }
  10%, 14.99% { opacity: 1; background-image: var(--blink-frame-2); }
  15%, 24.99% { opacity: 1; background-image: var(--blink-frame-1); }
  25%, 29.99% { opacity: 1; background-image: var(--blink-frame-2); }
  30%, 34.99% { opacity: 1; background-image: var(--blink-frame-3); }
  35%, 39.99% { opacity: 1; background-image: var(--blink-frame-4); }
  40%, 54.99% {
    opacity: 0;
    background-image: none;
  }
  55%, 59.99% {
    opacity: 1;
    background-image: var(--blink-frame-4);
  }
  60%, 64.99% { opacity: 1; background-image: var(--blink-frame-3); }
  65%, 69.99% { opacity: 1; background-image: var(--blink-frame-2); }
  70%, 79.99% { opacity: 1; background-image: var(--blink-frame-1); }
  80%, 84.99% { opacity: 1; background-image: var(--blink-frame-2); }
  85%, 89.99% { opacity: 1; background-image: var(--blink-frame-3); }
  90%, 94.99% { opacity: 1; background-image: var(--blink-frame-4); }
  95%, 100% {
    opacity: 0;
    background-image: none;
  }
}

/* Level and result */

.level-flash {
  position: absolute;
  top: clamp(calc(var(--safe-top) + 6.8rem), 18vh, calc(var(--safe-top) + 9rem));
  left: 50%;
  z-index: 60;
  width: 100%;
  color: #fff0c5;
  font-family: var(--font-mincho);
  font-size: clamp(1.65rem, 8vw, 2.7rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  text-indent: 0.2em;
  text-shadow:
    0 0 0.8rem rgba(255, 191, 80, 0.72),
    0 0 2.5rem rgba(255, 92, 48, 0.44);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: level-flash 900ms ease-out both;
}

@keyframes level-flash {
  0% { opacity: 0; transform: translate(-50%, -45%) scale(0.68); }
  26% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  72% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(1); }
}

.boss-countdown {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  color: rgba(204, 30, 42, 0.7);
  font-family: var(--font-mincho);
  font-size: clamp(7rem, 38vw, 15rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
  text-shadow:
    0 0 0.55rem rgba(255, 35, 45, 0.52),
    0 0 2.2rem rgba(129, 0, 13, 0.62);
  pointer-events: none;
  transform-origin: center;
}

.boss-countdown.is-active {
  animation: boss-countdown-tick 950ms cubic-bezier(0.22, 0.64, 0.38, 1) both;
}

.game-app[data-state="paused"] .boss-countdown.is-active,
.game-app[data-state="levelup"] .boss-countdown.is-active {
  visibility: hidden;
  animation-play-state: paused;
}

@keyframes boss-countdown-tick {
  0% {
    opacity: 0.72;
    transform: scale(1.06);
  }
  100% {
    opacity: 0;
    transform: scale(0.78);
  }
}

.result-panel {
  width: min(100%, 32rem);
  max-width: 32rem;
  margin-block: auto;
}

.result-screen {
  align-items: start;
}

.result-panel[data-result="victory"] #resultTitle {
  color: var(--gold-pale);
  text-shadow: 0 0 1.5rem rgba(255, 196, 83, 0.3);
}

.result-panel[data-result="gameover"] #resultTitle,
.result-panel[data-result="defeat"] #resultTitle {
  color: #e99590;
  text-shadow: 0 0 1.5rem rgba(221, 52, 51, 0.24);
}

.result-message {
  margin: 0.65rem 0 1.2rem;
  color: var(--ink-soft);
  font-size: clamp(0.7rem, 2.8vw, 0.84rem);
  line-height: 1.65;
}

.result-score {
  margin: 0 0 0.85rem;
  overflow: hidden;
  text-align: left;
  background: rgba(7, 6, 10, 0.84);
  border: 1px solid rgba(255, 198, 102, 0.3);
  border-radius: var(--radius-md);
  box-shadow: 0 0 1.6rem rgba(196, 67, 42, 0.12);
}

.result-score-total {
  display: flex;
  min-height: 4.2rem;
  padding: 0.65rem 0.9rem;
  align-items: center;
  justify-content: space-between;
  background:
    radial-gradient(circle at 85% 30%, rgba(255, 181, 76, 0.14), transparent 48%),
    linear-gradient(135deg, rgba(113, 33, 28, 0.3), rgba(24, 13, 19, 0.72));
  border-bottom: 1px solid rgba(255, 198, 102, 0.18);
}

.result-score-total span {
  color: #e9bc79;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.22em;
}

.result-score-total output {
  color: #fff0b8;
  font-family: var(--font-mincho);
  font-size: clamp(2rem, 9vw, 2.75rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 1.1rem rgba(255, 167, 64, 0.32);
}

.result-score-breakdown {
  display: grid;
  margin: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.result-score-breakdown div {
  display: grid;
  min-width: 0;
  min-height: 3.4rem;
  padding: 0.48rem 0.6rem;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
  background: rgba(11, 9, 13, 0.94);
}

.result-score-breakdown dt,
.result-score-breakdown dd {
  min-width: 0;
  margin: 0;
}

.result-score-breakdown dt {
  color: var(--ink-soft);
  font-size: clamp(0.55rem, 2.15vw, 0.65rem);
  font-weight: 800;
  line-height: 1.35;
}

.result-score-breakdown dt small {
  display: block;
  margin-top: 0.12rem;
  color: var(--ink-muted);
  font-size: 0.48rem;
  font-weight: 700;
}

#scoreSpeedLabel strong {
  color: var(--gold);
  font: inherit;
}

#scoreBossFormula {
  white-space: pre-line;
}

.result-score-breakdown dd {
  font-size: clamp(0.78rem, 3vw, 0.95rem);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  white-space: nowrap;
}

.result-score-breakdown dd.is-positive {
  color: #ffd69c;
}

.result-score-breakdown dd.is-negative {
  color: #df8ea0;
}

.result-stats {
  display: grid;
  margin: 0 0 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
}

.result-stats div {
  display: flex;
  min-width: 0;
  min-height: 4.4rem;
  padding: 0.65rem 0.4rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(11, 9, 13, 0.88);
}

.result-stats dt {
  color: var(--ink-muted);
  font-size: clamp(0.58rem, 2.3vw, 0.68rem);
  line-height: 1.35;
}

.result-stats dd {
  margin: 0.15rem 0 0;
  color: var(--ink);
  font-size: clamp(1.2rem, 5vw, 1.55rem);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.result-embers {
  display: grid;
  margin: 0 0 1.15rem;
  padding: 0.8rem 0.95rem;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  text-align: left;
  background:
    radial-gradient(circle at 88% 0, rgba(245, 146, 67, 0.14), transparent 42%),
    rgba(7, 6, 9, 0.66);
  border: 1px solid rgba(255, 166, 94, 0.24);
  border-radius: var(--radius-md);
}

.result-embers small {
  color: var(--ink-muted);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.result-embers-earned p {
  display: flex;
  margin: 0.2rem 0 0;
  gap: 0.35rem;
  align-items: center;
  color: #ffb77b;
}

.result-embers-earned p > span:first-child {
  color: #ff9b58;
  font-size: 1rem;
  text-shadow: 0 0 0.8rem rgba(255, 91, 45, 0.65);
}

.result-embers-earned strong {
  color: #ffe1b4;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}

.result-embers-total {
  display: flex;
  min-width: 6.3rem;
  padding-left: 1rem;
  flex-direction: column;
  gap: 0.18rem;
  align-items: flex-end;
  text-align: right;
  border-left: 1px solid rgba(255, 166, 94, 0.18);
}

.result-embers-total output {
  color: #fff0d4;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1;
}

/* Result saving */

.result-save {
  margin: 0 0 1rem;
  padding: 0.85rem 0.95rem;
  text-align: left;
  background: rgba(7, 6, 9, 0.72);
  border: 1px solid rgba(255, 166, 94, 0.24);
  border-radius: var(--radius-md);
}

.result-save h3 {
  margin: 0 0 0.55rem;
  color: #ffe1b4;
  font-family: var(--font-mincho);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

.result-save label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--ink-muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.result-save-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
}

.player-name-input {
  min-width: 0;
  min-height: 2.85rem;
  padding: 0.65rem 0.75rem;
  color: #fff4e8;
  font: 700 0.88rem/1.2 var(--font-mincho);
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.55rem;
  outline: none;
}

.player-name-input::placeholder {
  color: rgba(224, 210, 216, 0.42);
}

.player-name-input:focus {
  border-color: rgba(255, 170, 105, 0.72);
  box-shadow: 0 0 0 0.16rem rgba(255, 118, 70, 0.13);
}

.player-name-input:disabled {
  opacity: 0.55;
}

.result-save-button {
  min-width: 5.2rem;
  min-height: 2.85rem;
  padding: 0.55rem 0.85rem;
  color: #fff4e8;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, #9d2b2c, #641c28);
  border: 1px solid rgba(255, 135, 103, 0.62);
  border-radius: 0.55rem;
}

.result-save-button:not(:disabled):hover,
.result-save-button:not(:disabled):focus-visible {
  border-color: rgba(255, 185, 147, 0.9);
  box-shadow: 0 0 1rem rgba(246, 65, 43, 0.26);
}

.result-save-button:disabled {
  opacity: 0.5;
}

.result-save-status {
  min-height: 1.2em;
  margin: 0.45rem 0 0;
  color: var(--ink-muted);
  font-size: 0.6rem;
  line-height: 1.45;
}

.result-save-status.is-success {
  color: #ffd69c;
}

.result-save-status.is-error {
  color: #ee9ea7;
}

.result-actions {
  display: grid;
  width: min(100%, 19rem);
  margin-inline: auto;
  gap: 0.55rem;
}

.result-actions .title-menu-button,
.result-actions .primary-button {
  width: 100%;
}

.result-upgrade-button {
  padding-inline: 1.35rem;
}

.result-upgrade-wallet {
  display: inline-flex;
  min-width: 4.2rem;
  padding: 0.32rem 0.65rem;
  gap: 0.32rem;
  align-items: center;
  justify-content: center;
  color: #ffb77b;
  font-size: 0.78rem;
  line-height: 1;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 211, 168, 0.2);
  border-radius: 999px;
}

.result-upgrade-wallet output {
  color: #fff0d4;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

/* Ranking */

.ranking-screen {
  align-items: start;
}

.ranking-panel {
  display: flex;
  width: min(100%, 38rem);
  height: min(44rem, 100%);
  min-height: 0;
  max-height: 100%;
  margin-block: auto;
  flex-direction: column;
}

.ranking-tabs {
  display: grid;
  margin: 0 0 0.65rem;
  padding: 0.2rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.2rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.7rem;
}

.ranking-tab {
  min-width: 0;
  min-height: 2.5rem;
  padding: 0.45rem 0.25rem;
  color: var(--ink-muted);
  font-size: clamp(0.58rem, 2.4vw, 0.7rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.52rem;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.ranking-tab:hover,
.ranking-tab:focus-visible {
  color: #fff3e7;
  border-color: rgba(255, 159, 113, 0.35);
}

.ranking-tab.is-active {
  color: #fff0d4;
  background: linear-gradient(135deg, rgba(157, 43, 44, 0.66), rgba(100, 28, 40, 0.72));
  border-color: rgba(255, 135, 103, 0.5);
  box-shadow: 0 0 0.9rem rgba(238, 57, 43, 0.12);
}

.ranking-table-heading,
.ranking-row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
}

.ranking-table-heading {
  padding: 0 0.65rem 0.35rem;
  color: var(--ink-muted);
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-align: left;
}

.ranking-table-heading span:last-child {
  text-align: right;
}

.ranking-list {
  flex: 1 1 auto;
  min-height: 12rem;
  margin-bottom: 1rem;
  overflow-y: auto;
  background: rgba(4, 4, 7, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  scrollbar-color: rgba(255, 145, 92, 0.55) rgba(0, 0, 0, 0.25);
}

.ranking-row {
  min-height: 4.25rem;
  padding: 0.55rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ranking-row:last-child {
  border-bottom: 0;
}

.ranking-rank {
  color: #e9bc79;
  font-family: var(--font-mincho);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: center;
}

.ranking-list[data-mode="ranking"] .ranking-row:nth-child(-n + 3) .ranking-rank {
  color: #fff0b8;
  font-size: 1.25rem;
  text-shadow: 0 0 0.8rem rgba(255, 167, 64, 0.35);
}

.ranking-main {
  min-width: 0;
}

.ranking-name {
  overflow: hidden;
  color: #fff3e7;
  font-family: var(--font-mincho);
  font-size: 0.75rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-details,
.ranking-date {
  margin-top: 0.15rem;
  color: var(--ink-muted);
  font-size: 0.52rem;
  line-height: 1.35;
}

.ranking-score {
  color: #ffd69c;
  font-size: clamp(0.88rem, 3.6vw, 1.1rem);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.ranking-message {
  display: grid;
  min-height: 12rem;
  margin: 0;
  padding: 1rem;
  place-items: center;
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.ranking-panel > .primary-button {
  margin: auto auto 0;
}

/* Debug */

.debug-panel {
  position: absolute;
  right: var(--safe-right);
  bottom: calc(var(--safe-bottom) + 5.5rem);
  z-index: 80;
  width: min(10.5rem, 45%);
  padding: 0.5rem 0.6rem;
  color: #c8ffc5;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.58rem;
  line-height: 1.35;
  background: rgba(0, 8, 2, 0.82);
  border: 1px solid rgba(131, 255, 129, 0.42);
  border-radius: 0.35rem;
  box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.debug-panel > p {
  display: flex;
  margin: 0 0 0.35rem;
  justify-content: space-between;
  color: #73ff70;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.debug-panel > p span {
  color: rgba(200, 255, 197, 0.55);
  font-size: 0.85em;
  font-weight: 400;
}

.debug-panel dl {
  display: grid;
  margin: 0;
  gap: 0.08rem;
}

.debug-panel dl div {
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
}

.debug-panel dt,
.debug-panel dd {
  margin: 0;
}

.debug-panel dd {
  overflow: hidden;
  color: #fff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.noscript-message {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 1000;
  margin: 0;
  padding: 1rem;
  color: #fff;
  text-align: center;
  background: #731d26;
  border: 1px solid #ff8c78;
  border-radius: 0.5rem;
}

/* Responsive refinements */

@media (hover: hover) and (pointer: fine) {
  .joystick {
    visibility: hidden;
  }

  .game-controls {
    justify-content: flex-end;
  }

  .control-list--touch,
  .touch-pause-help {
    display: none;
  }

  .control-list--pointer {
    display: flex;
  }

  .touch-help,
  .pointer-pause-help {
    display: block;
  }
}

@media (max-width: 27rem) {
  .control-list {
    flex-direction: column;
    align-items: center;
    gap: 0.32rem;
  }

  .hud-top-row {
    grid-template-columns: minmax(5.5rem, 1fr) auto 2.75rem 2.65rem;
  }

  .hud-card {
    padding-inline: 0.38rem;
  }

  .level-card .hud-label {
    font-size: 0.52rem;
    letter-spacing: 0.03em;
  }

  .icon-button {
    width: 2.65rem;
    min-width: 2.65rem;
    height: 2.65rem;
  }

  .ranking-table-heading,
  .ranking-row {
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    gap: 0.4rem;
  }

  .ranking-details {
    font-size: 0.48rem;
  }

}

/*
 * .game-shell の高さは幅で決まる(min(100dvh, 100vw * 1.7778, 80rem))ため、
 * スマートフォン幅ではタイトル本文がシェルに収まらず、末尾のバージョン表記が
 * 見切れる。中途半端に切れた文字を出すより隠すほうが崩れて見えない。
 * 実測(safe-area込み)では幅400px未満で収まらなくなる。
 */
@media (max-width: 27rem) {
  .prototype-note {
    display: none;
  }
}

@media (max-height: 43rem) {
  .title-content {
    transform: scale(0.9);
  }

  .controls-help {
    margin-top: 0.65rem;
    padding-top: 0.55rem;
  }

  .prototype-note {
    display: none;
  }

  .modal-panel {
    padding-block: 0.9rem;
  }
}

@media (orientation: landscape) and (max-height: 36rem) {
  .game-controls {
    padding-bottom: 0.45rem;
  }

  .joystick-ring {
    width: 4.8rem;
    height: 4.8rem;
  }

  .recall-button {
    min-height: 3.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .boss-countdown.is-active {
    opacity: 0.7;
    transform: none;
    animation: none !important;
  }

  .boss-intro {
    animation: none !important;
  }

  .boss-intro-shadow,
  .boss-intro-copy {
    opacity: 1;
    animation: none !important;
  }

  .boss-intro-face {
    opacity: 1;
    transform: none;
    animation: none !important;
  }

  .boss-intro-eyelid-frame {
    opacity: 0;
    animation: none !important;
  }

  .boss-intro-double-blink {
    opacity: 0;
    animation: none !important;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --ink-soft: #eee8e1;
    --ink-muted: #c4bbc0;
    --line: rgba(255, 255, 255, 0.4);
    --line-strong: rgba(255, 255, 255, 0.72);
  }

  .hud-card,
  .greed-panel,
  .boss-hud,
  .modal-panel {
    background-color: rgba(4, 3, 5, 0.96);
  }
}

@media (forced-colors: active) {
  .meter,
  .meter-fill,
  .greed-mark {
    forced-color-adjust: none;
  }

  .meter-fill {
    background: Highlight !important;
  }

  .hud-card,
  .greed-panel,
  .boss-hud,
  .modal-panel,
  .upgrade-card,
  .upgrade-shuffle-button,
  .primary-button,
  .title-menu-button,
  .danger-button,
  .recall-button,
  .icon-button {
    border: 1px solid CanvasText;
  }
}
