:root {
  --ink: #f6fbff;
  --navy: #07172f;
  --navy-2: #0b2b55;
  --blue: #1f77ff;
  --cyan: #35d9ff;
  --pale: #e7f8ff;
  --gold: #ffd35a;
  --orange: #ff8a2a;
  --red: #ff355d;
  --green: #3af27c;
  --panel: rgba(6, 25, 55, 0.82);
  --panel-light: rgba(18, 76, 138, 0.78);
  --line: rgba(112, 222, 255, 0.72);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
  --glow: 0 0 22px rgba(53, 217, 255, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  color: var(--ink);
  background: #061225;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.audio-toggle {
  position: fixed;
  right: 14px;
  top: 14px;
  z-index: 20;
  min-width: 78px;
  height: 38px;
  border: 2px solid rgba(169, 236, 255, 0.88);
  border-radius: 999px;
  color: white;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(53, 217, 255, 0.04)),
    rgba(6, 25, 55, 0.86);
  box-shadow: var(--glow);
  font-weight: 950;
}

.audio-toggle.is-muted {
  color: #aeefff;
  opacity: 0.78;
}

.app,
.screen {
  min-height: 100vh;
}

.screen {
  position: relative;
  display: none;
  padding: 28px;
  overflow: hidden;
}

.screen.is-active {
  display: block;
}

.screen-backdrop {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(2, 14, 33, 0.28), rgba(2, 14, 33, 0.78)),
    url("assets/backgrounds/bg_pcroom.png") center / cover no-repeat;
  filter: saturate(1.15);
}

.screen-title .screen-backdrop {
  background:
    radial-gradient(circle at 50% 18%, rgba(70, 216, 255, 0.34), transparent 35%),
    linear-gradient(180deg, rgba(2, 14, 33, 0.15), rgba(2, 14, 33, 0.72)),
    url("assets/backgrounds/bg_classroom.png") center / cover no-repeat;
}

.screen-backdrop::after,
.battle-shade {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 19, 42, 0.55), rgba(5, 19, 42, 0.12), rgba(5, 19, 42, 0.58)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 5px);
}

.title-layout {
  width: min(1120px, 100%);
  min-height: calc(100vh - 56px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}

.game-logo {
  width: min(760px, 88vw);
  max-height: 42vh;
  object-fit: contain;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.48)) drop-shadow(0 0 22px rgba(54, 217, 255, 0.45));
}

.subtitle {
  padding: 8px 18px;
  border: 2px solid rgba(255, 211, 90, 0.86);
  border-radius: 999px;
  color: #fffbe8;
  background: rgba(7, 23, 47, 0.72);
  box-shadow: var(--glow);
  font-size: clamp(18px, 2.5vw, 28px);
  font-weight: 900;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}

.topic-navi {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: end;
  gap: 10px;
  min-width: 280px;
  max-width: 440px;
  padding: 10px 14px 10px 10px;
  border: 2px solid rgba(169, 236, 255, 0.86);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(53, 217, 255, 0.05)),
    rgba(6, 25, 55, 0.86);
  box-shadow: var(--shadow), var(--glow);
  backdrop-filter: blur(8px);
}

.topic-navi img {
  width: 84px;
  height: 92px;
  object-fit: contain;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.42));
}

.topic-navi span {
  display: block;
  width: fit-content;
  padding: 3px 9px;
  border-radius: 999px;
  color: #072244;
  background: linear-gradient(180deg, #f7fbff, #9eeeff);
  font-size: 13px;
  font-weight: 950;
}

.topic-navi p {
  margin: 7px 0 0;
  color: white;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.45;
  text-align: left;
}

.title-topic {
  margin-top: 2px;
}

.help-topic {
  max-width: none;
  margin-bottom: 4px;
}

.title-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
}

.game-button,
.icon-button {
  border: 0;
  color: var(--ink);
  font-weight: 950;
  letter-spacing: 0;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.24);
}

.game-button {
  min-width: 190px;
  min-height: 58px;
  padding: 0 28px;
  border-radius: 14px;
  border: 2px solid rgba(205, 246, 255, 0.9);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 42%),
    linear-gradient(180deg, #36c7ff, #1765e8);
  box-shadow:
    inset 0 -5px 0 rgba(0, 31, 85, 0.32),
    0 12px 26px rgba(0, 0, 0, 0.38),
    0 0 18px rgba(53, 217, 255, 0.46);
  font-size: 21px;
}

.game-button:hover,
.game-button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible {
  outline: 3px solid rgba(255, 211, 90, 0.68);
  transform: translateY(-1px);
}

.ghost-button {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(180deg, #1b5fae, #12335e);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: linear-gradient(180deg, #34c8ff, #174d98);
  box-shadow: var(--glow);
  font-size: 24px;
}

.best-records,
.result-stats {
  display: grid;
  gap: 10px;
  margin: 0;
}

.best-records {
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  width: min(560px, 100%);
  margin-top: 18px;
}

.best-records div,
.result-stats div,
.hud-item,
.score-chip,
.game-frame {
  border: 2px solid var(--line);
  background:
    linear-gradient(180deg, rgba(53, 217, 255, 0.16), rgba(255, 255, 255, 0.02)),
    var(--panel);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.best-records div {
  padding: 12px;
  border-radius: 14px;
}

dt,
dd {
  margin: 0;
}

dt,
.hud-item span,
.score-chip,
.panel-kicker {
  color: #aeefff;
  font-size: 13px;
  font-weight: 950;
}

dd,
.hud-item strong,
.score-chip strong {
  display: block;
  color: white;
  font-size: 25px;
  line-height: 1.1;
}

.screen-header {
  width: min(1180px, 100%);
  margin: 0 auto 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.screen-header h1 {
  margin: 0;
  color: white;
  font-size: clamp(28px, 4vw, 46px);
  text-shadow: 0 5px 0 rgba(0, 0, 0, 0.34), 0 0 18px rgba(53, 217, 255, 0.48);
}

.game-frame {
  border-radius: 18px;
  backdrop-filter: blur(8px);
}

.help-panel {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 30px;
  display: grid;
  gap: 16px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.7;
}

.character-select {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(320px, 420px);
  gap: 22px;
  align-items: stretch;
}

.character-stage {
  min-height: 470px;
  display: grid;
  place-items: end center;
  border-radius: 22px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background:
    radial-gradient(ellipse at center bottom, rgba(53, 217, 255, 0.32), transparent 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(7, 23, 47, 0.58));
  box-shadow: var(--shadow);
}

.character-spotlight {
  position: relative;
  width: min(430px, 90%);
  height: 440px;
  display: grid;
  place-items: end center;
}

.character-spotlight::before {
  content: "";
  position: absolute;
  bottom: 24px;
  width: 72%;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  filter: blur(12px);
}

.character-preview {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: end center;
  color: white;
  font-size: 96px;
  font-weight: 950;
}

.character-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.45));
}

.character-info {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 15px;
}

.character-info h2,
.result-panel h1 {
  margin: 0;
  font-size: clamp(38px, 5vw, 62px);
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
}

.character-type,
.result-rank {
  width: fit-content;
  padding: 7px 13px;
  border-radius: 999px;
  color: #09203f;
  background: linear-gradient(180deg, #fff4a6, #ffd35a);
  font-weight: 950;
}

.character-info p {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.55;
}

.character-roster {
  width: min(1180px, 100%);
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.character-token {
  min-height: 116px;
  padding: 10px;
  border: 2px solid rgba(112, 222, 255, 0.42);
  border-radius: 16px;
  color: white;
  background: linear-gradient(180deg, rgba(29, 93, 174, 0.88), rgba(7, 23, 47, 0.88));
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.28);
  font-weight: 950;
}

.character-token.is-selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 211, 90, 0.22), var(--glow);
}

.token-art {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 6px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  font-size: 28px;
}

.token-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stage-grid {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 18px;
}

.stage-card.oni-stage {
  grid-column: 1 / -1;
  min-height: 280px;
  border-color: rgba(255, 90, 210, 0.78);
  background: #200723;
}

.stage-card.oni-stage .stage-content {
  inset: auto 22px 18px;
  max-width: 720px;
}

.stage-card.oni-stage::after {
  background: linear-gradient(90deg, rgba(8, 3, 18, 0.94), rgba(30, 4, 44, 0.5), rgba(5, 10, 30, 0.36));
}

.stage-card.is-locked {
  filter: grayscale(0.72) brightness(0.68);
}

.stage-card.is-unlocked {
  box-shadow: 0 0 0 3px rgba(255, 90, 210, 0.2), 0 0 34px rgba(255, 45, 190, 0.45), var(--shadow);
}

.stage-status {
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  color: #061225;
  background: linear-gradient(180deg, #fff39c, #ffbd30);
  font-size: 13px;
  font-weight: 950;
}

.stage-card.is-cleared .stage-status {
  background: linear-gradient(180deg, #baffd3, #3af27c);
}

.stage-card {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 2px solid rgba(112, 222, 255, 0.58);
  border-radius: 20px;
  color: white;
  background: #0b2b55;
  box-shadow: var(--shadow);
  text-align: left;
}

.stage-card:hover,
.stage-card:focus-visible {
  outline: 3px solid rgba(255, 211, 90, 0.6);
  transform: translateY(-2px);
}

.stage-thumb {
  position: absolute;
  inset: 0;
  background: var(--thumb) center / cover no-repeat;
  transition: transform 200ms ease;
}

.stage-card:hover .stage-thumb {
  transform: scale(1.05);
}

.stage-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 15%, rgba(4, 16, 37, 0.18) 45%, rgba(4, 16, 37, 0.92));
}

.stage-content {
  position: absolute;
  inset: auto 14px 14px;
  z-index: 1;
  display: grid;
  gap: 8px;
}

.stage-plate {
  min-height: 76px;
  display: grid;
  place-items: center;
  padding: 10px 16px;
  background: url("assets/ui/ui_stage_plate.png") center / 100% 100% no-repeat;
  text-align: center;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.36));
}

.stage-plate h2 {
  margin: 0;
  color: white;
  font-size: 27px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.42);
}

.stage-content p {
  margin: 0;
  color: #dff8ff;
  font-weight: 850;
  line-height: 1.45;
}

.battle-screen {
  padding: 0;
}

.battle-field {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    var(--stage-image),
    var(--stage-bg, linear-gradient(135deg, #0b2b55, #07172f));
  background-size: cover, cover;
  background-position: center;
}

.battle-field[data-combo-tier="1"] {
  filter: saturate(1.08);
}

.battle-field[data-combo-tier="2"] {
  filter: saturate(1.18) brightness(1.03);
}

.battle-field[data-combo-tier="3"] {
  filter: saturate(1.28) brightness(1.06);
}

.battle-field.is-oni-hard {
  --line: rgba(255, 100, 225, 0.76);
}

.battle-field.is-oni-hard .battle-shade {
  background:
    linear-gradient(180deg, rgba(12, 2, 22, 0.68), rgba(16, 4, 32, 0.18) 42%, rgba(4, 4, 20, 0.82)),
    radial-gradient(circle at 50% 32%, transparent 0 24%, rgba(20, 2, 35, 0.52) 65%);
}

.battle-field.is-oni-hard .hud-item {
  border-color: rgba(255, 100, 225, 0.78);
  background:
    linear-gradient(180deg, rgba(255, 55, 190, 0.2), rgba(255, 255, 255, 0.02)),
    rgba(26, 6, 50, 0.88);
}

.battle-field[data-combo-tier="2"] .typing-panel,
.battle-field[data-combo-tier="3"] .typing-panel {
  animation: combo-pulse-panel 900ms ease-in-out infinite alternate;
}

.battle-field::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
}

.battle-field.is-attack-flash::after {
  animation: field-attack-flash 280ms ease-out;
  background: radial-gradient(circle at 52% 38%, rgba(255, 232, 92, 0.34), transparent 34%);
}

.battle-field.is-special-flash::after {
  animation: field-special-flash 620ms ease-out;
  background:
    radial-gradient(circle at 52% 38%, rgba(255, 246, 150, 0.5), transparent 30%),
    linear-gradient(120deg, transparent, rgba(53, 217, 255, 0.25), transparent);
}

.battle-field.is-miss-flash::after {
  animation: field-miss-flash 320ms ease-out;
  background: radial-gradient(circle at 20% 72%, rgba(255, 53, 93, 0.42), transparent 36%);
}

.battle-field.is-defeat-flash::after {
  animation: field-defeat-flash 520ms ease-out;
  background: radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.58), transparent 38%);
}

.battle-shade {
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(2, 10, 24, 0.54), rgba(2, 10, 24, 0.2) 42%, rgba(2, 10, 24, 0.7)),
    radial-gradient(circle at 50% 34%, transparent 0 28%, rgba(2, 10, 24, 0.38) 60%);
}

.battle-hud {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(210px, 1.2fr) repeat(5, minmax(120px, 1fr));
  gap: 10px;
  padding: 14px 16px 8px;
}

.hud-logo {
  min-height: 78px;
  display: grid;
  align-items: center;
  padding: 4px 10px;
}

.hud-logo img {
  max-width: 100%;
  max-height: 74px;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(53, 217, 255, 0.6));
}

.hud-item {
  min-height: 76px;
  padding: 10px 14px;
  border-radius: 18px 18px 8px 8px;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  text-align: center;
}

.enemy-party {
  position: relative;
  z-index: 2;
  width: min(900px, calc(100% - 520px));
  min-width: 520px;
  margin: 2px auto 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 14px;
  pointer-events: none;
}

.enemy-card {
  display: grid;
  justify-items: center;
  gap: 4px;
  opacity: 0.72;
  transform: scale(0.88);
}

.enemy-card.is-active {
  opacity: 1;
  transform: scale(1);
}

.battle-field.is-oni-hard .enemy-party {
  position: absolute;
  left: 50%;
  top: clamp(92px, 12vh, 132px);
  transform: translateX(-50%);
  z-index: 5;
  width: min(920px, 80vw);
  min-width: min(620px, 96vw);
  height: 190px;
  margin: 0;
  align-items: end;
  gap: clamp(12px, 2vw, 26px);
}

.battle-field.is-oni-hard .enemy-card {
  position: relative;
  height: 190px;
  grid-template-rows: 26px 132px 20px;
  align-items: end;
  opacity: 0.52;
  transform: scale(0.88);
  filter: brightness(0.68) saturate(0.76);
  transition: transform 220ms ease, filter 220ms ease, opacity 220ms ease;
}

.battle-field.is-oni-hard .enemy-card.is-active {
  opacity: 1;
  transform: scale(1.04) translateY(-4px);
  filter: brightness(1.12) saturate(1.08)
    drop-shadow(0 0 20px rgba(255, 225, 78, 0.7));
}

.battle-field.is-oni-hard .enemy-card.is-active::before {
  content: "▼ TARGET";
  position: absolute;
  left: 50%;
  top: -24px;
  transform: translateX(-50%);
  color: #fff171;
  font-size: 14px;
  font-weight: 950;
  text-shadow: 0 0 10px #ff3dba, 0 2px 0 #3b071e;
  animation: oni-target-arrow 700ms ease-in-out infinite alternate;
}

.battle-field.is-oni-hard .enemy-card.is-defeated {
  opacity: 0.16;
  filter: grayscale(1) brightness(0.45);
  transform: scale(0.82);
}

.battle-field.is-oni-hard .enemy-card-art {
  width: 100%;
  height: 132px;
  align-items: end;
}

.battle-field.is-oni-hard .enemy-card-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.battle-field.is-oni-hard .enemy-card strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.battle-field.is-oni-hard .enemy-card-hp {
  width: 100%;
}

.enemy-card strong {
  padding: 2px 9px;
  border-radius: 999px;
  color: white;
  background: rgba(6, 25, 55, 0.78);
  font-size: 17px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.42);
}

.enemy-card-art {
  width: min(170px, 14vw);
  height: min(150px, 12vw);
  display: grid;
  place-items: center;
  font-size: 54px;
  font-weight: 950;
  filter: drop-shadow(0 18px 16px rgba(0, 0, 0, 0.48));
}

.enemy-card-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.enemy-card-hp {
  position: relative;
  width: min(190px, 100%);
  height: 18px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
}

.enemy-card-hp i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--orange), var(--gold));
  transition: width 360ms ease;
}

.enemy-card-hp span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: white;
  font-size: 12px;
  font-weight: 950;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
}

.enemy-zone {
  position: relative;
  z-index: 1;
  width: min(520px, 90vw);
  margin: -14px auto 0;
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.battle-field.is-oni-hard .enemy-zone {
  position: absolute;
  left: 50%;
  top: clamp(300px, 40vh, 380px);
  transform: translate(-50%, -50%);
  z-index: 6;
  width: min(380px, 30vw);
  margin: 0;
  gap: 6px;
  opacity: 1;
  pointer-events: none;
  isolation: isolate;
}

.battle-field.is-oni-hard .monster-sprite {
  width: min(380px, 30vw);
  height: min(300px, 33vh);
  display: grid;
  align-items: flex-end;
  justify-items: center;
  border-radius: 0;
  background: transparent;
  opacity: 1;
  filter:
    brightness(1.12)
    saturate(1.14)
    contrast(1.08)
    drop-shadow(0 28px 24px rgba(0, 0, 0, 0.68))
    drop-shadow(0 0 34px rgba(255, 75, 220, 0.48));
}

.battle-field.is-oni-hard .monster-sprite img {
  display: block;
  grid-area: 1 / 1;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  object-position: center bottom;
  opacity: 1;
}

.battle-field.is-oni-hard .monster-focus-base {
  filter: contrast(1.22) saturate(1.16) brightness(1.04);
}

.battle-field.is-oni-hard .monster-focus-main {
  position: relative;
}

.battle-field.is-oni-hard .enemy-zone h2 {
  font-size: 20px;
  padding: 2px 12px;
  border-radius: 999px;
  background: rgba(12, 2, 28, 0.72);
}

.battle-field.is-oni-hard .enemy-meter {
  display: none;
}

.monster-sprite {
  width: clamp(210px, 20vw, 300px);
  height: clamp(200px, 19vw, 280px);
  display: grid;
  place-items: center;
  color: white;
  border-radius: 24px;
  background: rgba(4, 16, 37, 0.18);
  font-size: 92px;
  font-weight: 950;
  filter: drop-shadow(0 20px 20px rgba(0, 0, 0, 0.42));
}

.monster-sprite img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.monster-sprite.is-hit {
  animation: hit 260ms linear;
}

.enemy-zone.is-attacking {
  animation: enemy-attack 360ms ease-out;
}

.monster-sprite.is-defeated {
  animation: enemy-defeat 620ms ease-in forwards;
}

@keyframes hit {
  0% { transform: translateX(0) scale(1); filter: brightness(1) drop-shadow(0 20px 20px rgba(0, 0, 0, 0.42)); }
  25% { transform: translateX(-18px) rotate(-4deg) scale(1.08); filter: brightness(2.2) drop-shadow(0 0 34px rgba(255, 211, 90, 0.88)); }
  60% { transform: translateX(16px) rotate(3deg) scale(1.04); }
  100% { transform: translateX(0) scale(1); filter: brightness(1) drop-shadow(0 20px 20px rgba(0, 0, 0, 0.42)); }
}

@keyframes enemy-attack {
  0% { transform: translateY(0) scale(1); }
  38% { transform: translateY(28px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes enemy-defeat {
  0% { opacity: 1; transform: scale(1) rotate(0); filter: brightness(1.4); }
  18% { opacity: 1; transform: scale(1.18) rotate(-3deg); filter: brightness(2.8) saturate(1.6); }
  55% { opacity: 0.72; transform: scale(0.82) rotate(8deg); filter: contrast(1.8) hue-rotate(90deg); }
  100% { opacity: 0; transform: scale(0.08) rotate(24deg); filter: blur(10px) brightness(3); }
}

.enemy-zone h2 {
  margin: 0;
  padding: 5px 16px;
  border-radius: 999px;
  background: rgba(7, 23, 47, 0.72);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

.meter {
  width: 100%;
  display: grid;
  gap: 5px;
}

.enemy-meter {
  width: min(420px, 90vw);
  padding: 9px 12px;
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-radius: 14px;
  background: rgba(6, 25, 55, 0.72);
}

.meter-track {
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(233, 244, 255, 0.2);
}

.meter-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  transition: width 360ms cubic-bezier(.2, .8, .2, 1);
}

.player-fill {
  background: linear-gradient(90deg, var(--green), #caff65);
}

.enemy-fill {
  background: linear-gradient(90deg, var(--red), var(--orange));
}

.player-zone {
  position: absolute;
  left: 42px;
  bottom: 178px;
  z-index: 2;
  display: flex;
  align-items: end;
  gap: 12px;
}

.player-zone.is-attacking {
  animation: player-lunge 360ms ease-out;
}

.player-zone.is-damaged {
  animation: player-damaged 430ms ease-out;
}

.avatar {
  width: 156px;
  height: 210px;
  display: grid;
  place-items: end center;
  color: white;
  border-radius: 18px;
  background: rgba(4, 16, 37, 0.1);
  font-size: 64px;
  font-weight: 950;
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.44));
}

.avatar.is-awake {
  animation: awaken-aura 1500ms ease-out;
}

.avatar img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.player-nameplate {
  width: 270px;
  padding: 13px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: rgba(6, 25, 55, 0.82);
  box-shadow: var(--glow);
}

.player-nameplate strong {
  display: block;
  font-size: 25px;
}

.player-nameplate span {
  display: block;
  margin-bottom: 8px;
  color: #c9f6ff;
  font-weight: 850;
}

.player-nameplate small {
  display: block;
  margin-bottom: 6px;
  color: white;
  font-size: 14px;
  font-weight: 950;
}

.ally-party {
  position: absolute;
  left: 20px;
  bottom: 92px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, 112px);
  gap: 8px;
}

.battle-field.is-oni-hard .ally-party {
  grid-template-columns: repeat(3, 118px);
  align-items: end;
}

.battle-field.is-oni-hard .ally-card:nth-child(1) {
  transform: translateY(-4px) scale(1.08);
}

.battle-field.is-oni-hard .ally-card:nth-child(2) {
  transform: translateY(2px);
}

.battle-field.is-oni-hard .ally-card:nth-child(3) {
  transform: translateY(8px) scale(0.96);
}

.battle-field.is-oni-hard .player-zone,
.battle-field.is-oni-hard .skill-gauge {
  display: none;
}

.battle-field.is-oni-hard .typing-panel {
  z-index: 10;
  border-color: rgba(255, 135, 230, 0.94);
  background:
    linear-gradient(180deg, rgba(255, 55, 190, 0.18), rgba(255, 255, 255, 0.03)),
    rgba(17, 5, 38, 0.94);
  box-shadow: var(--shadow), 0 0 26px rgba(255, 55, 190, 0.48);
}

.battle-field.is-oni-hard .battle-topic {
  border-color: rgba(255, 120, 225, 0.86);
  background:
    linear-gradient(180deg, rgba(255, 65, 190, 0.18), rgba(53, 217, 255, 0.04)),
    rgba(20, 5, 42, 0.9);
}

.battle-field.is-onisen-arrival::after {
  animation: oni-pressure-flash 1400ms ease-out;
  background: radial-gradient(circle at 50% 34%, rgba(255, 40, 80, 0.65), rgba(45, 0, 55, 0.45) 45%, transparent 72%);
}

.battle-field.is-final-wave::after {
  animation: oni-final-flash 1800ms ease-out;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 236, 125, 0.72), transparent 26%),
    linear-gradient(120deg, rgba(90, 0, 120, 0.4), rgba(255, 25, 165, 0.32), rgba(0, 35, 90, 0.42));
}

.ally-card {
  min-height: 128px;
  padding: 8px;
  border: 2px solid rgba(112, 222, 255, 0.8);
  border-radius: 16px 16px 8px 8px;
  background:
    linear-gradient(180deg, rgba(53, 217, 255, 0.2), rgba(255, 255, 255, 0.03)),
    rgba(6, 25, 55, 0.82);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.34), var(--glow);
}

.ally-card.is-leader {
  border-color: var(--gold);
}

.ally-art {
  display: grid;
  place-items: end center;
  height: 58px;
  font-size: 28px;
  font-weight: 950;
}

.ally-art img {
  max-width: 88px;
  max-height: 70px;
  object-fit: contain;
  filter: drop-shadow(0 8px 9px rgba(0, 0, 0, 0.42));
}

.ally-card strong,
.ally-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ally-card strong {
  margin-top: 3px;
  font-size: 18px;
}

.ally-card span {
  color: #bff4ff;
  font-size: 12px;
  font-weight: 950;
}

.ally-hp {
  height: 10px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(233, 244, 255, 0.2);
}

.ally-hp i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #e6ff71);
}

.combo-emblem {
  position: absolute;
  right: 38px;
  top: 94px;
  z-index: 3;
  display: grid;
  justify-items: center;
  color: #fff6c9;
  text-shadow:
    0 4px 0 #763400,
    0 0 18px rgba(255, 181, 35, 0.9),
    0 0 36px rgba(255, 77, 24, 0.72);
  pointer-events: none;
}

.combo-emblem strong {
  display: block;
  color: white;
  font-size: clamp(54px, 7vw, 104px);
  line-height: 0.86;
}

.combo-emblem span {
  color: #ffe866;
  font-size: clamp(22px, 3vw, 42px);
  font-weight: 950;
}

.score-chip {
  position: absolute;
  right: 22px;
  bottom: 250px;
  z-index: 2;
  min-width: 170px;
  padding: 11px 14px;
  border-radius: 15px;
  text-align: center;
}

.mission-panel,
.skill-gauge {
  position: absolute;
  z-index: 2;
  min-width: 240px;
  padding: 10px 13px;
  border: 2px solid var(--line);
  border-radius: 15px;
  background:
    linear-gradient(180deg, rgba(53, 217, 255, 0.16), rgba(255, 255, 255, 0.02)),
    rgba(6, 25, 55, 0.82);
  box-shadow: var(--shadow), var(--glow);
}

.mission-panel {
  right: 22px;
  bottom: 24px;
  top: auto;
  min-width: 330px;
}

.skill-gauge {
  left: 22px;
  bottom: 24px;
  top: auto;
  min-width: 330px;
}

.mission-panel span,
.skill-gauge span {
  display: block;
  color: #aeefff;
  font-size: 12px;
  font-weight: 950;
}

.mission-panel strong,
.skill-gauge strong {
  display: block;
  color: white;
  font-size: 17px;
  line-height: 1.25;
}

.mini-meter {
  height: 10px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(233, 244, 255, 0.2);
}

.mini-meter div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  transition: width 300ms ease;
}

.typing-panel {
  position: absolute;
  left: 50%;
  bottom: 10px;
  z-index: 3;
  width: min(600px, calc(100% - 760px));
  min-width: 440px;
  transform: translateX(-50%);
  padding: 10px 16px 9px;
  display: grid;
  grid-template-rows: auto 48px auto;
  gap: 8px;
  border: 3px solid rgba(185, 239, 255, 0.92);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(53, 217, 255, 0.2), rgba(255, 255, 255, 0.03)),
    rgba(6, 25, 55, 0.9);
  box-shadow: var(--shadow), var(--glow);
}

.battle-topic {
  position: absolute;
  right: 22px;
  bottom: 126px;
  z-index: 3;
  width: 350px;
}

.word-display {
  display: grid;
  gap: 3px;
  min-height: 84px;
  align-content: center;
}

.word-label {
  margin: 0;
  color: #9eeeff;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  text-align: center;
}

.jp-word,
.roma-word {
  margin: 0;
  text-align: center;
  font-weight: 950;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  overflow-wrap: anywhere;
}

.jp-word {
  color: #dcfbff;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.08;
}

.roma-word {
  color: white;
  font-size: clamp(25px, 3.4vw, 39px);
  line-height: 1.06;
}

.typed {
  color: var(--gold);
}

.remaining {
  color: white;
}

.typing-input {
  width: 100%;
  height: 48px;
  margin-top: 0;
  padding: 0 18px;
  border: 3px solid var(--cyan);
  border-radius: 16px;
  color: #061225;
  background: linear-gradient(180deg, #ffffff, #dff8ff);
  box-shadow: inset 0 4px 10px rgba(0, 63, 130, 0.18);
  font-size: 22px;
  font-weight: 950;
  text-align: center;
}

.typing-input:focus {
  outline: 4px solid rgba(255, 211, 90, 0.52);
}

.message-line {
  min-height: 20px;
  margin: 0;
  color: #c9f6ff;
  font-weight: 950;
  text-align: center;
}

.message-line.is-good {
  color: var(--gold);
}

.message-line.is-bad {
  color: #ff9db0;
}

.burst-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.burst {
  position: absolute;
  left: 50%;
  top: 36%;
  width: min(430px, 42vw);
  transform: translate(-50%, -50%);
  animation: burst-pop 900ms cubic-bezier(.16, 1.2, .32, 1) forwards;
  filter:
    drop-shadow(0 22px 24px rgba(0, 0, 0, 0.52))
    drop-shadow(0 0 26px rgba(255, 224, 75, 0.75))
    drop-shadow(0 0 48px rgba(255, 72, 41, 0.48));
}

.burst.combo {
  left: 72%;
  top: 47%;
  width: min(330px, 32vw);
  animation-name: combo-pop;
  filter:
    drop-shadow(0 18px 20px rgba(0, 0, 0, 0.48))
    drop-shadow(0 0 28px rgba(255, 238, 94, 0.82))
    drop-shadow(0 0 42px rgba(53, 217, 255, 0.48));
}

.burst.miss {
  left: 50%;
  top: 42%;
  width: min(380px, 38vw);
  animation-name: miss-pop;
  filter:
    drop-shadow(0 20px 22px rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 28px rgba(255, 53, 93, 0.88))
    drop-shadow(0 0 45px rgba(255, 255, 255, 0.25));
}

.burst-shockwave {
  position: absolute;
  left: 50%;
  top: 38%;
  width: 70px;
  height: 70px;
  border: 4px solid rgba(255, 236, 120, 0.88);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: shockwave 680ms ease-out forwards;
  box-shadow: 0 0 22px rgba(255, 211, 90, 0.85), inset 0 0 18px rgba(255, 255, 255, 0.45);
}

.burst-shockwave.miss {
  top: 42%;
  border-color: rgba(255, 53, 93, 0.88);
  box-shadow: 0 0 28px rgba(255, 53, 93, 0.85), inset 0 0 18px rgba(255, 255, 255, 0.32);
}

.burst-shockwave.combo {
  left: 72%;
  top: 48%;
  border-color: rgba(53, 217, 255, 0.9);
  box-shadow: 0 0 28px rgba(53, 217, 255, 0.8), inset 0 0 18px rgba(255, 255, 255, 0.32);
}

.burst-spark {
  position: absolute;
  left: 50%;
  top: 38%;
  width: 12px;
  height: 42px;
  border-radius: 999px;
  background: linear-gradient(180deg, white, var(--gold), transparent);
  transform-origin: center 120px;
  transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-20px);
  animation: spark-fly 620ms ease-out var(--delay) forwards;
  box-shadow: 0 0 14px rgba(255, 211, 90, 0.9);
}

.effect-image {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  object-fit: contain;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.45));
}

.effect-image.attack {
  left: 51%;
  top: 37%;
  width: min(520px, 48vw);
  transform: translate(-50%, -50%);
  animation: effect-attack 620ms ease-out forwards;
  filter:
    drop-shadow(0 18px 22px rgba(0, 0, 0, 0.45))
    drop-shadow(0 0 34px rgba(255, 235, 100, 0.76));
}

.effect-image.attack.special {
  width: min(680px, 62vw);
  animation: effect-special-attack 950ms ease-out forwards;
  filter:
    drop-shadow(0 20px 26px rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 44px rgba(53, 217, 255, 0.9))
    drop-shadow(0 0 70px rgba(255, 211, 90, 0.72));
}

.effect-image.awaken {
  left: 120px;
  bottom: 185px;
  width: min(360px, 32vw);
  animation: effect-awaken 1450ms ease-out forwards;
  mix-blend-mode: screen;
  filter: drop-shadow(0 0 38px rgba(53, 217, 255, 0.88));
}

.effect-image.enemy-attack-asset {
  left: 24%;
  top: 60%;
  width: min(420px, 42vw);
  transform: translate(-50%, -50%);
  animation: effect-enemy-attack 720ms ease-out forwards;
  filter:
    drop-shadow(0 18px 24px rgba(0, 0, 0, 0.46))
    drop-shadow(0 0 34px rgba(255, 53, 93, 0.74));
}

.effect-image.bug-break,
.effect-image.defeat-pixel {
  left: 50%;
  top: 37%;
  width: min(520px, 48vw);
  transform: translate(-50%, -50%);
  mix-blend-mode: screen;
}

.effect-image.bug-break {
  animation: effect-bug-break 760ms ease-out forwards;
  filter: drop-shadow(0 0 34px rgba(53, 217, 255, 0.8));
}

.effect-image.defeat-pixel {
  animation: effect-defeat-pixel 900ms ease-out forwards;
  filter: drop-shadow(0 0 30px rgba(255, 211, 90, 0.72));
}

.damage-number,
.enemy-attack-effect,
.reward-float,
.combo-callout,
.skill-banner,
.enemy-trait,
.mission-clear,
.title-unlock {
  position: absolute;
  z-index: 6;
  display: inline-grid;
  place-items: center;
  pointer-events: none;
  font-weight: 950;
  text-align: center;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.42), 0 0 22px currentColor;
}

.damage-number {
  left: 52%;
  top: 26%;
  min-width: 120px;
  color: #fff7b2;
  font-size: clamp(44px, 7vw, 84px);
  animation: damage-number 900ms ease-out forwards;
}

.damage-number.special {
  color: #ffffff;
  font-size: clamp(58px, 9vw, 112px);
  filter: drop-shadow(0 0 28px rgba(53, 217, 255, 0.95));
}

.enemy-attack-effect {
  left: 23%;
  top: 61%;
  color: #ff9db0;
  font-size: clamp(38px, 5vw, 70px);
  animation: enemy-attack-text 760ms ease-out forwards;
}

.reward-float {
  left: 50%;
  top: 39%;
  padding: 9px 18px;
  border: 2px solid rgba(255, 237, 140, 0.92);
  border-radius: 999px;
  color: #fff5ad;
  background: rgba(8, 30, 68, 0.82);
  font-size: clamp(20px, 3vw, 34px);
  animation: reward-float 1050ms ease-out forwards;
}

.combo-callout {
  right: 7%;
  top: 38%;
  color: var(--gold);
  font-size: clamp(28px, 5vw, 58px);
  animation: combo-callout 920ms ease-out forwards;
}

.skill-banner {
  left: 50%;
  top: 17%;
  min-width: min(680px, 86vw);
  padding: 13px 20px;
  border: 3px solid rgba(255, 246, 164, 0.92);
  border-radius: 18px;
  color: white;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.18), rgba(255, 211, 90, 0.36), rgba(37, 99, 235, 0.18)),
    rgba(7, 23, 47, 0.88);
  box-shadow: 0 0 30px rgba(255, 211, 90, 0.62), inset 0 0 18px rgba(255, 255, 255, 0.18);
  font-size: clamp(24px, 4vw, 44px);
  animation: skill-banner 1350ms ease-out forwards;
}

.enemy-trait {
  left: 50%;
  top: 15%;
  padding: 5px 12px;
  border-radius: 999px;
  color: #c9f6ff;
  background: rgba(7, 23, 47, 0.74);
  border: 1px solid rgba(112, 222, 255, 0.65);
  font-size: 16px;
  animation: trait-pop 1400ms ease-out forwards;
}

.mission-clear,
.title-unlock {
  left: 50%;
  top: 24%;
  padding: 10px 18px;
  border-radius: 999px;
  border: 2px solid rgba(255, 237, 140, 0.94);
  color: #fff6b5;
  background: rgba(7, 23, 47, 0.88);
  font-size: clamp(18px, 3vw, 34px);
  animation: reward-float 1300ms ease-out forwards;
}

.title-unlock {
  top: 30%;
  color: #dff8ff;
  border-color: rgba(112, 222, 255, 0.9);
}

@keyframes burst-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.25) rotate(-18deg); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.28) rotate(5deg); }
  34% { opacity: 1; transform: translate(-50%, -50%) scale(1.02) rotate(-2deg); }
  68% { opacity: 1; transform: translate(-50%, -62%) scale(1.08) rotate(1deg); }
  100% { opacity: 0; transform: translate(-50%, -86%) scale(0.72) rotate(9deg); }
}

@keyframes combo-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(14deg); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.18) rotate(-6deg); }
  70% { opacity: 1; transform: translate(-50%, -64%) scale(1.02) rotate(3deg); }
  100% { opacity: 0; transform: translate(-50%, -88%) scale(0.78) rotate(-10deg); }
}

@keyframes miss-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.35) rotate(-6deg); }
  18% { opacity: 1; transform: translate(-54%, -50%) scale(1.12) rotate(-8deg); }
  30% { transform: translate(-46%, -50%) scale(1.08) rotate(7deg); }
  44% { transform: translate(-52%, -50%) scale(1.05) rotate(-5deg); }
  72% { opacity: 1; transform: translate(-50%, -58%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(0.76); }
}

@keyframes shockwave {
  0% { opacity: 0.95; transform: translate(-50%, -50%) scale(0.4); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(7.4); }
}

@keyframes spark-fly {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-30px) scaleY(0.7); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-230px) scaleY(0.1); }
}

@keyframes player-lunge {
  0% { transform: translateX(0) scale(1); }
  38% { transform: translateX(66px) translateY(-12px) scale(1.05); }
  100% { transform: translateX(0) scale(1); }
}

@keyframes player-damaged {
  0% { transform: translateX(0); filter: brightness(1); }
  18% { transform: translateX(-18px); filter: brightness(1.8) saturate(1.4); }
  34% { transform: translateX(14px); }
  52% { transform: translateX(-10px); }
  100% { transform: translateX(0); filter: brightness(1); }
}

@keyframes awaken-aura {
  0% { filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.44)); transform: scale(1); }
  30% { filter: drop-shadow(0 0 28px rgba(53, 217, 255, 0.95)) drop-shadow(0 0 50px rgba(255, 211, 90, 0.72)); transform: scale(1.08); }
  100% { filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.44)); transform: scale(1); }
}

@keyframes field-attack-flash {
  0% { opacity: 0; }
  40% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes field-special-flash {
  0% { opacity: 0; transform: translateX(-8%); }
  24% { opacity: 1; }
  100% { opacity: 0; transform: translateX(8%); }
}

@keyframes field-miss-flash {
  0% { opacity: 0; }
  35% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes field-defeat-flash {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes damage-number {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.35) rotate(-8deg); }
  18% { opacity: 1; transform: translate(-50%, -30%) scale(1.2) rotate(3deg); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(0.88) rotate(-4deg); }
}

@keyframes enemy-attack-text {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.4); }
  24% { opacity: 1; transform: translate(-50%, -20%) scale(1.18); }
  100% { opacity: 0; transform: translate(-50%, -130%) scale(0.82); }
}

@keyframes reward-float {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.65); }
  20% { opacity: 1; transform: translate(-50%, -40%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -150%) scale(0.9); }
}

@keyframes combo-callout {
  0% { opacity: 0; transform: translateY(20px) scale(0.5) rotate(-10deg); }
  22% { opacity: 1; transform: translateY(0) scale(1.16) rotate(3deg); }
  100% { opacity: 0; transform: translateY(-90px) scale(0.82) rotate(-4deg); }
}

@keyframes skill-banner {
  0% { opacity: 0; transform: translate(-50%, -22px) scale(0.88); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1.04); }
  72% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -42px) scale(0.95); }
}

@keyframes trait-pop {
  0% { opacity: 0; transform: translate(-50%, -12px) scale(0.86); }
  20% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -36px) scale(0.96); }
}

@keyframes effect-attack {
  0% { opacity: 0; transform: translate(-66%, -50%) scale(0.72) rotate(-10deg); }
  16% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(2deg); }
  100% { opacity: 0; transform: translate(-28%, -58%) scale(0.96) rotate(8deg); }
}

@keyframes effect-special-attack {
  0% { opacity: 0; transform: translate(-68%, -50%) scale(0.52) rotate(-14deg); }
  18% { opacity: 1; transform: translate(-48%, -50%) scale(1.18) rotate(4deg); }
  58% { opacity: 1; transform: translate(-43%, -56%) scale(1.05) rotate(-2deg); }
  100% { opacity: 0; transform: translate(-18%, -66%) scale(0.84) rotate(12deg); }
}

@keyframes effect-awaken {
  0% { opacity: 0; transform: scale(0.6) rotate(-6deg); }
  18% { opacity: 0.9; transform: scale(1.1) rotate(3deg); }
  72% { opacity: 0.75; transform: scale(1.02) rotate(-2deg); }
  100% { opacity: 0; transform: scale(1.25) rotate(8deg); }
}

@keyframes effect-enemy-attack {
  0% { opacity: 0; transform: translate(10%, -68%) scale(0.55) rotate(12deg); }
  18% { opacity: 1; transform: translate(-42%, -50%) scale(1.05) rotate(-4deg); }
  100% { opacity: 0; transform: translate(-62%, -30%) scale(0.78) rotate(-14deg); }
}

@keyframes effect-bug-break {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6) rotate(-10deg); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(4deg); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(1.35) rotate(16deg); }
}

@keyframes effect-defeat-pixel {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  20% { opacity: 0.95; transform: translate(-50%, -50%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -78%) scale(1.18); }
}

.screen-result .screen-backdrop {
  background:
    linear-gradient(180deg, rgba(2, 14, 33, 0.25), rgba(2, 14, 33, 0.82)),
    var(--result-image, url("assets/backgrounds/bg_classroom.png")) center / cover no-repeat;
}

.result-panel {
  width: min(780px, 100%);
  min-height: calc(100vh - 56px);
  margin: 0 auto;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}

.rank-image {
  width: min(280px, 54vw);
  max-height: 240px;
  object-fit: contain;
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.36));
}

.unlocked-title {
  margin: 0;
  color: #dff8ff;
  font-weight: 950;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.32);
}

@keyframes combo-pulse-panel {
  0% { box-shadow: var(--shadow), 0 0 18px rgba(53, 217, 255, 0.45); }
  100% { box-shadow: var(--shadow), 0 0 34px rgba(255, 211, 90, 0.65); }
}

@keyframes oni-target-arrow {
  from { transform: translate(-50%, -2px); filter: brightness(0.9); }
  to { transform: translate(-50%, 5px); filter: brightness(1.35); }
}

@keyframes oni-pressure-flash {
  0% { opacity: 0; transform: scale(1); }
  18% { opacity: 1; transform: scale(1.04); }
  42% { opacity: 0.72; transform: scale(0.99); }
  100% { opacity: 0; transform: scale(1.08); }
}

@keyframes oni-final-flash {
  0% { opacity: 0; filter: brightness(1); }
  15% { opacity: 1; filter: brightness(1.8); }
  45% { opacity: 0.82; filter: brightness(1.25) contrast(1.35); }
  100% { opacity: 0; filter: brightness(1); }
}

.result-stats {
  grid-template-columns: repeat(5, 1fr);
  width: 100%;
}

.result-stats div {
  padding: 12px;
  border-radius: 15px;
}

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

  .character-select,
  .stage-grid,
  .battle-hud,
  .result-stats,
  .best-records {
    grid-template-columns: 1fr;
  }

  .character-roster {
    grid-template-columns: repeat(3, 1fr);
  }

  .stage-card {
    min-height: 230px;
  }

  .battle-field {
    min-height: 100vh;
  }

  .battle-hud {
    padding: 10px;
    gap: 6px;
  }

  .hud-logo {
    min-height: 58px;
  }

  .enemy-party,
  .ally-party,
  .combo-emblem {
    display: none;
  }

  .hud-item {
    min-height: auto;
    padding: 8px 10px;
  }

  .monster-sprite {
    width: min(270px, 64vw);
    height: min(270px, 64vw);
  }

  .player-zone {
    left: 12px;
    bottom: 190px;
    transform: scale(0.78);
    transform-origin: left bottom;
  }

  .score-chip {
    right: 12px;
    bottom: 205px;
  }

  .battle-topic {
    position: relative;
    right: auto;
    bottom: auto;
    width: auto;
    margin: 8px 10px 0;
  }

  .mission-panel,
  .skill-gauge {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    min-width: 0;
    margin: 8px 10px 0;
  }

  .typing-panel {
    bottom: 10px;
    width: calc(100% - 20px);
    min-width: 0;
    padding: 10px;
    grid-template-rows: auto 46px auto;
  }
}

@media (min-width: 901px) and (max-width: 1240px) {
  .battle-hud {
    grid-template-columns: 170px repeat(5, minmax(96px, 1fr));
  }

  .hud-item strong {
    font-size: 21px;
  }

  .enemy-party {
    width: min(720px, calc(100% - 420px));
    min-width: 460px;
  }

  .enemy-card-art {
    width: 130px;
    height: 112px;
  }

  .monster-sprite {
    width: 250px;
    height: 230px;
  }

  .battle-topic {
    width: 340px;
  }

  .topic-navi {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .topic-navi img {
    width: 68px;
    height: 76px;
  }
}
