:root {
  color-scheme: dark;
  --night: #0d1020;
  --night-soft: #171b31;
  --indigo: #273469;
  --indigo-light: #43558f;
  --paper: #fff3d6;
  --paper-muted: #d7ceb9;
  --gold: #f4c542;
  --gold-deep: #b98724;
  --vermilion: #e94839;
  --jade: #39bda0;
  --violet: #8e5cf5;
  --glass: rgba(13, 16, 32, 0.78);
  font-family: "Yu Gothic UI", "Yu Gothic", "Hiragino Sans", Meiryo, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body,
#app,
#game {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--paper);
  background: var(--night);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 3px solid white;
  outline-offset: 4px;
}

#game,
#game canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

.screen-grain {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.1;
  background-image:
    linear-gradient(118deg, transparent 37%, rgba(255, 255, 255, 0.1) 38%, transparent 39%),
    radial-gradient(circle, rgba(255, 255, 255, 0.22) 0 1px, transparent 1.5px);
  background-size: 69px 69px, 19px 19px;
  mix-blend-mode: soft-light;
}

.damage-flash {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, transparent 28%, rgba(233, 72, 57, 0.68));
  transition: opacity 110ms ease-out;
}

.damage-flash.active {
  opacity: 1;
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.title-screen {
  padding: clamp(20px, 4vw, 58px);
  background:
    linear-gradient(90deg, rgba(7, 8, 18, 0.9) 0%, rgba(7, 8, 18, 0.53) 48%, rgba(7, 8, 18, 0.16) 76%),
    linear-gradient(0deg, rgba(7, 8, 18, 0.64), transparent 44%);
}

.title-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 72% 40%, transparent 5%, rgba(7, 8, 18, 0.12) 45%, rgba(7, 8, 18, 0.72) 100%);
}

.brand-line {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  color: rgba(255, 243, 214, 0.7);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.22em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 26px;
  color: var(--night);
  border-radius: 4px;
  background: var(--paper);
  letter-spacing: 0;
}

.title-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  width: min(620px, 58vw);
  height: calc(100% - 42px);
}

.eyebrow,
.hud-label {
  margin: 0;
  color: var(--gold);
  font-size: 0.67rem;
  font-weight: 1000;
  letter-spacing: 0.22em;
}

.title-copy h1 {
  margin: 8px 0 16px;
  font-size: clamp(3.1rem, 8vw, 7.4rem);
  line-height: 0.82;
  letter-spacing: -0.08em;
  text-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.title-copy h1 span,
.title-copy h1 strong {
  display: block;
}

.title-copy h1 span {
  color: var(--paper-muted);
  font-size: 0.48em;
  letter-spacing: 0.05em;
}

.title-copy h1 strong {
  color: var(--paper);
  font-weight: 1000;
}

.chapter-ribbon {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 14px 7px 8px;
  color: var(--paper);
  border: 1px solid rgba(244, 197, 66, 0.42);
  border-left: 0;
  background: linear-gradient(90deg, rgba(39, 52, 105, 0.88), rgba(39, 52, 105, 0.12));
  font-size: clamp(0.72rem, 1.4vw, 0.94rem);
  font-weight: 900;
  letter-spacing: 0.12em;
}

.chapter-ribbon span {
  padding: 4px 8px;
  color: var(--night);
  background: var(--gold);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
}

.title-lead {
  margin: 20px 0 22px;
  color: rgba(255, 243, 214, 0.82);
  font-size: clamp(0.82rem, 1.4vw, 1rem);
  font-weight: 700;
  line-height: 1.9;
  letter-spacing: 0.1em;
}

.title-actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.primary-button,
.secondary-button,
.voice-button,
.text-button,
.icon-button,
.skip-button {
  border: 0;
  cursor: pointer;
}

.primary-button {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  min-width: min(360px, 70vw);
  padding: 13px 52px 13px 18px;
  text-align: left;
  border: 2px solid var(--paper);
  border-radius: 9px;
  color: var(--night);
  background: linear-gradient(135deg, var(--gold), #ffe487);
  box-shadow: 6px 6px 0 var(--vermilion), 0 16px 38px rgba(0, 0, 0, 0.3);
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.primary-button:hover {
  transform: translate(-2px, -2px);
  filter: brightness(1.08);
  box-shadow: 9px 9px 0 var(--vermilion), 0 20px 44px rgba(0, 0, 0, 0.38);
}

.primary-button:active {
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 var(--vermilion);
}

.button-kicker {
  grid-column: 1;
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  opacity: 0.68;
}

.primary-button strong {
  grid-column: 1;
  font-size: 1rem;
  font-weight: 1000;
  letter-spacing: 0.05em;
}

.button-arrow {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-52%);
  font-size: 2.4rem;
  line-height: 1;
}

.primary-button.compact {
  display: block;
  min-width: 260px;
  padding: 14px 20px;
  text-align: center;
}

.voice-button {
  min-width: 126px;
  padding: 0 14px;
  border: 1px solid rgba(255, 243, 214, 0.32);
  border-radius: 9px;
  color: var(--paper);
  background: rgba(13, 16, 32, 0.74);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  backdrop-filter: blur(9px);
}

.voice-button[aria-pressed="false"] {
  color: rgba(255, 243, 214, 0.52);
}

.title-controls {
  margin: 18px 0 0;
  color: rgba(255, 243, 214, 0.5);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.title-note {
  position: absolute;
  right: clamp(20px, 4vw, 58px);
  bottom: clamp(20px, 4vw, 50px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 10px;
  border-left: 2px solid var(--gold);
  color: rgba(255, 243, 214, 0.75);
  background: rgba(13, 16, 32, 0.48);
  backdrop-filter: blur(8px);
}

.note-number {
  color: var(--gold);
  font-size: 2rem;
  font-weight: 1000;
}

.title-note p {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.55;
  letter-spacing: 0.08em;
}

.title-note strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.52rem;
  letter-spacing: 0.2em;
}

.cinematic {
  position: fixed;
  inset: 0;
  z-index: 18;
  pointer-events: none;
}

.letterbox {
  position: absolute;
  left: 0;
  width: 100%;
  height: clamp(42px, 8vh, 86px);
  background: #05060b;
  transition: transform 500ms ease;
}

.letterbox.top {
  top: 0;
}

.letterbox.bottom {
  bottom: 0;
}

.skip-button {
  position: absolute;
  top: clamp(12px, 2.5vh, 28px);
  right: 24px;
  z-index: 2;
  padding: 8px 11px;
  pointer-events: auto;
  color: rgba(255, 243, 214, 0.66);
  border: 1px solid rgba(255, 243, 214, 0.18);
  border-radius: 5px;
  background: rgba(13, 16, 32, 0.5);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.skip-button span {
  color: var(--gold);
}

.subtitle-box {
  position: absolute;
  left: 50%;
  bottom: clamp(54px, 10vh, 110px);
  width: min(780px, calc(100% - 34px));
  padding: 12px 22px 14px;
  transform: translateX(-50%);
  text-align: center;
  text-shadow: 0 3px 10px #000;
}

.subtitle-box span {
  display: block;
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 1000;
  letter-spacing: 0.16em;
}

.subtitle-box p {
  margin: 0;
  color: white;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  font-weight: 900;
  line-height: 1.6;
  letter-spacing: 0.05em;
}

.movie-chapter {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: min(760px, 88vw);
  transform: translate(-50%, -50%);
  text-align: center;
  text-shadow: 0 5px 24px #000;
}

.movie-chapter span {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 1000;
  letter-spacing: 0.36em;
}

.movie-chapter strong {
  padding: 10px 26px;
  border-top: 1px solid rgba(244, 197, 66, 0.58);
  border-bottom: 1px solid rgba(244, 197, 66, 0.58);
  font-size: clamp(1.6rem, 4.5vw, 3.4rem);
  letter-spacing: 0.12em;
}

.hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.glass-panel {
  border: 1px solid rgba(255, 243, 214, 0.18);
  background: linear-gradient(145deg, rgba(20, 24, 46, 0.9), rgba(13, 16, 32, 0.68));
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.22), inset 0 1px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(9px);
}

.mission-panel {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  min-width: min(360px, calc(100vw - 150px));
  padding: 8px 16px 8px 8px;
  border-radius: 10px;
}

.mission-index {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: 11px;
  color: var(--night);
  border-radius: 7px;
  background: var(--gold);
  font-family: Georgia, serif;
  font-size: 1.4rem;
  font-weight: 900;
}

.mission-panel strong {
  display: block;
  margin-top: 3px;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
}

.top-actions {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.fragment-panel,
.icon-button {
  height: 52px;
  border-radius: 10px;
}

.fragment-panel {
  display: flex;
  align-items: center;
  padding: 0 15px;
  font-weight: 1000;
}

.fragment-icon {
  margin-right: 7px;
  color: #9cecff;
  filter: drop-shadow(0 0 7px #5ad6f0);
}

.fragment-panel small {
  margin-left: 2px;
  color: rgba(255, 243, 214, 0.54);
}

.icon-button {
  width: 52px;
  color: var(--paper);
  font-size: 1.1rem;
}

.boss-hud {
  position: absolute;
  top: 20px;
  left: 50%;
  width: min(470px, 44vw);
  transform: translateX(-50%);
  text-align: center;
  text-shadow: 0 2px 8px #000;
}

.boss-hud > span {
  display: block;
  color: var(--vermilion);
  font-size: 0.58rem;
  font-weight: 1000;
  letter-spacing: 0.22em;
}

.boss-hud > strong {
  font-size: 1rem;
  letter-spacing: 0.15em;
}

.boss-bar {
  height: 9px;
  margin-top: 7px;
  overflow: hidden;
  border: 2px solid rgba(255, 243, 214, 0.78);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 3px 12px #000;
}

.boss-bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #7f2636, var(--vermilion), #ffb25e);
  transition: width 180ms ease;
}

.player-panel {
  position: absolute;
  left: 20px;
  bottom: 20px;
  display: flex;
  align-items: center;
  min-width: min(340px, calc(100vw - 40px));
}

.portrait-seal {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  color: var(--night);
  background: var(--gold);
  box-shadow: 4px 4px 0 var(--vermilion);
  font-size: 1.5rem;
  font-weight: 1000;
}

.player-bars {
  flex: 1;
  margin-left: -9px;
  padding: 8px 13px 8px 19px;
  border: 1px solid rgba(255, 243, 214, 0.2);
  border-radius: 0 10px 10px 0;
  background: rgba(13, 16, 32, 0.82);
  backdrop-filter: blur(8px);
}

.player-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
}

.player-line strong {
  font-size: 0.92rem;
  letter-spacing: 0.12em;
}

.player-line span {
  color: var(--gold);
  font-size: 0.58rem;
  font-weight: 1000;
}

.hp-track {
  position: relative;
  height: 13px;
  overflow: hidden;
  border: 2px solid rgba(255, 243, 214, 0.62);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.7);
}

.hp-track i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #cb3941, #f0694d);
  transition: width 180ms ease;
}

.hp-track b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: white;
  font-size: 0.52rem;
  text-shadow: 0 1px 2px #000;
  letter-spacing: 0.08em;
}

.control-hints {
  position: absolute;
  right: 20px;
  bottom: 20px;
  display: flex;
  gap: 12px;
  padding: 10px 13px;
  border-radius: 9px;
  color: rgba(255, 243, 214, 0.72);
  font-size: 0.63rem;
  font-weight: 900;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 25px;
  min-height: 23px;
  padding: 2px 5px;
  border: 1px solid rgba(255, 243, 214, 0.42);
  border-bottom-width: 3px;
  border-radius: 5px;
  color: var(--gold);
  background: rgba(255, 255, 255, 0.08);
  font: 900 0.62rem/1 monospace;
}

.interact-prompt {
  position: fixed;
  left: 50%;
  bottom: 20%;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 243, 214, 0.25);
  border-radius: 8px;
  background: rgba(13, 16, 32, 0.82);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.38);
  font-size: 0.72rem;
  font-weight: 900;
}

.toast {
  position: fixed;
  top: 23%;
  left: 50%;
  z-index: 14;
  max-width: min(580px, calc(100% - 36px));
  padding: 10px 20px;
  transform: translateX(-50%);
  border-left: 4px solid var(--gold);
  border-radius: 4px;
  color: var(--paper);
  background: rgba(13, 16, 32, 0.88);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.38);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-align: center;
}

.checkpoint-banner {
  position: fixed;
  top: 34%;
  left: 50%;
  z-index: 14;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 320px;
  padding: 12px 30px;
  transform: translateX(-50%);
  border-top: 1px solid rgba(244, 197, 66, 0.6);
  border-bottom: 1px solid rgba(244, 197, 66, 0.6);
  background: linear-gradient(90deg, transparent, rgba(13, 16, 32, 0.9), transparent);
  text-shadow: 0 3px 10px #000;
}

.checkpoint-banner small {
  color: var(--gold);
  font-size: 0.55rem;
  font-weight: 1000;
  letter-spacing: 0.28em;
}

.checkpoint-banner strong {
  margin-top: 3px;
  font-size: 1.2rem;
  letter-spacing: 0.12em;
}

.modal-screen {
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 8, 18, 0.76);
  backdrop-filter: blur(7px);
}

.modal-card,
.result-card {
  position: relative;
  width: min(520px, 100%);
  padding: clamp(28px, 5vw, 48px);
  overflow: hidden;
  border: 1px solid rgba(255, 243, 214, 0.28);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(27, 33, 63, 0.97), rgba(13, 16, 32, 0.98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55), inset 0 1px rgba(255, 255, 255, 0.08);
  text-align: center;
}

.modal-card::before,
.result-card::before {
  position: absolute;
  inset: -35% 65% 50% -20%;
  content: "";
  transform: rotate(-15deg);
  background: rgba(244, 197, 66, 0.08);
}

.modal-seal {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  color: var(--night);
  background: var(--gold);
  box-shadow: 4px 4px 0 var(--vermilion);
  font-size: 1.5rem;
  font-weight: 1000;
}

.danger-card .modal-seal {
  color: var(--paper);
  background: var(--vermilion);
  box-shadow: 4px 4px 0 #6f2130;
}

.modal-card h2 {
  position: relative;
  margin: 8px 0 12px;
  font-size: clamp(1.35rem, 4vw, 2rem);
}

.modal-card > p:not(.eyebrow) {
  position: relative;
  margin: 0 auto 24px;
  color: rgba(255, 243, 214, 0.67);
  font-size: 0.82rem;
  line-height: 1.75;
}

.modal-card button {
  position: relative;
  width: 100%;
  margin-top: 11px;
}

.secondary-button {
  padding: 12px 18px;
  border: 1px solid rgba(255, 243, 214, 0.27);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
  font-weight: 900;
}

.secondary-button:hover {
  border-color: var(--gold);
  background: rgba(244, 197, 66, 0.1);
}

.text-button {
  padding: 9px;
  color: rgba(255, 243, 214, 0.57);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.result-screen {
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 8, 18, 0.7);
  backdrop-filter: blur(5px);
}

.result-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(90, 214, 240, 0.24), transparent 32%),
    linear-gradient(135deg, transparent 42%, rgba(244, 197, 66, 0.08) 42% 44%, transparent 44%);
  pointer-events: none;
}

.result-card {
  width: min(700px, 100%);
  padding: clamp(28px, 5vw, 54px);
}

.clear-stamp {
  position: absolute;
  top: 26px;
  right: 28px;
  padding: 6px 9px;
  transform: rotate(6deg);
  border: 3px double var(--gold);
  color: var(--gold);
  font-size: 0.5rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.12em;
}

.clear-stamp strong {
  font-size: 0.86rem;
}

.result-card h2 {
  position: relative;
  margin: 10px 0 22px;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  letter-spacing: 0.05em;
}

.result-card blockquote {
  position: relative;
  margin: 0;
  padding: 16px 20px;
  border-left: 3px solid #79dff3;
  background: rgba(90, 214, 240, 0.08);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.75;
}

.result-card blockquote span {
  display: block;
  margin-bottom: 4px;
  color: #9cecff;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
}

.result-stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 22px 0 14px;
}

.result-stats div {
  padding: 12px 8px;
  border: 1px solid rgba(255, 243, 214, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.result-stats span {
  display: block;
  margin-bottom: 4px;
  color: rgba(255, 243, 214, 0.52);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.result-stats strong {
  color: var(--gold);
  font-size: 1.1rem;
}

.next-chapter {
  position: relative;
  margin: 0 0 20px;
  color: rgba(255, 243, 214, 0.46);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.result-actions {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 14px;
}

.result-actions button {
  width: auto;
  margin: 0;
}

.touch-controls {
  position: fixed;
  inset: auto 0 max(16px, env(safe-area-inset-bottom)) 0;
  z-index: 15;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  pointer-events: none;
}

.touch-dpad {
  position: relative;
  width: 148px;
  height: 148px;
}

.touch-key,
.touch-action {
  position: absolute;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 243, 214, 0.35);
  color: var(--paper);
  background: rgba(13, 16, 32, 0.62);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08), 0 4px 14px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  touch-action: none;
}

.touch-key {
  width: 51px;
  height: 51px;
  border-radius: 12px;
}

.touch-key.up { top: 0; left: 49px; }
.touch-key.left { top: 49px; left: 0; }
.touch-key.down { top: 98px; left: 49px; }
.touch-key.right { top: 49px; left: 98px; }
.touch-key.pressed { color: var(--night); background: var(--gold); }

.touch-actions {
  position: relative;
  width: 170px;
  height: 120px;
}

.touch-action {
  border-radius: 50%;
  font-weight: 1000;
}

.touch-action.attack {
  right: 0;
  bottom: 0;
  width: 82px;
  height: 82px;
  border: 2px solid var(--paper);
  background: rgba(233, 72, 57, 0.72);
  font-size: 1.45rem;
}

.touch-action.dodge {
  right: 88px;
  bottom: 18px;
  width: 62px;
  height: 62px;
  border-color: rgba(244, 197, 66, 0.7);
  color: var(--gold);
  font-size: 1rem;
}

.fatal-error {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  place-content: center;
  padding: 30px;
  text-align: center;
  background: var(--night);
}

.fatal-error h2 {
  color: var(--vermilion);
}

.debug-panel {
  position: fixed;
  top: 82px;
  right: 12px;
  z-index: 80;
  display: grid;
  width: 150px;
  gap: 5px;
  padding: 8px;
  border: 1px solid rgba(255, 243, 214, 0.3);
  border-radius: 8px;
  background: rgba(13, 16, 32, 0.88);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
}

.debug-panel strong {
  color: var(--gold);
  font: 900 0.6rem/1.2 monospace;
  letter-spacing: 0.18em;
}

.debug-panel button {
  padding: 5px 7px;
  border: 1px solid rgba(255, 243, 214, 0.18);
  border-radius: 5px;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.62rem;
  cursor: pointer;
}

@media (pointer: coarse), (max-width: 820px) {
  .touch-controls:not(.hidden) {
    display: flex;
  }

  .control-hints {
    display: none;
  }

  .player-panel {
    bottom: 170px;
  }

  .title-copy {
    width: min(660px, 86vw);
  }

  .title-note {
    display: none;
  }

  .title-screen {
    background: linear-gradient(90deg, rgba(7, 8, 18, 0.87), rgba(7, 8, 18, 0.34));
  }
}

@media (max-width: 620px) {
  .title-screen {
    padding: 18px;
  }

  .title-copy {
    width: 100%;
    justify-content: flex-end;
    padding-bottom: 34px;
  }

  .title-copy h1 {
    font-size: clamp(3.2rem, 20vw, 5.6rem);
  }

  .title-lead {
    margin: 15px 0;
  }

  .title-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .primary-button {
    flex: 1;
    min-width: 250px;
  }

  .voice-button {
    min-height: 45px;
  }

  .title-controls {
    display: none;
  }

  .mission-panel {
    top: 10px;
    left: 10px;
    min-width: 0;
    max-width: calc(100% - 137px);
  }

  .mission-index {
    width: 36px;
    height: 36px;
  }

  .mission-panel .hud-label {
    display: none;
  }

  .mission-panel strong {
    max-width: 46vw;
    overflow: hidden;
    font-size: 0.72rem;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .top-actions {
    top: 10px;
    right: 10px;
  }

  .fragment-panel,
  .icon-button {
    height: 46px;
  }

  .icon-button {
    width: 46px;
  }

  .fragment-panel {
    padding: 0 10px;
  }

  .boss-hud {
    top: 68px;
    width: calc(100% - 34px);
  }

  .player-panel {
    left: 12px;
    bottom: 168px;
    min-width: 225px;
    max-width: calc(100% - 24px);
  }

  .portrait-seal {
    width: 50px;
    height: 50px;
  }

  .result-stats {
    grid-template-columns: 1fr;
  }

  .result-stats div {
    padding: 8px;
  }

  .result-actions {
    flex-direction: column;
  }

  .result-actions button {
    width: 100%;
  }

  .clear-stamp {
    top: 16px;
    right: 16px;
  }
}

@media (max-height: 590px) and (orientation: landscape) {
  .title-copy {
    justify-content: flex-end;
  }

  .title-copy h1 {
    margin: 4px 0 8px;
    font-size: 3.2rem;
  }

  .title-lead,
  .title-controls,
  .title-note {
    display: none;
  }

  .chapter-ribbon {
    margin-bottom: 10px;
  }

  .touch-dpad {
    transform: scale(0.8);
    transform-origin: bottom left;
  }

  .touch-actions {
    transform: scale(0.82);
    transform-origin: bottom right;
  }

  .player-panel {
    bottom: 100px;
  }
}
