:root {
  color-scheme: dark;
  font-family:
    "Pretendard",
    "Noto Sans KR",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #041f2a;
  color: #f4fbff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
}

body {
  min-height: 100dvh;
  background: #041f2a;
}

button {
  font: inherit;
}

.game-shell {
  --skill-tint: #75fff2;
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 100%;
  overflow: hidden;
  background: #041f2a;
  isolation: isolate;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.rider-layer {
  --rider-x: 92;
  --rider-y: 420;
  --rider-tilt: 0deg;
  --rider-opacity: 1;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: 0;
  height: 0;
  opacity: var(--rider-opacity);
  pointer-events: none;
  transform: translate3d(calc(var(--rider-x) * 1px), calc(var(--rider-y) * 1px), 0)
    rotate(var(--rider-tilt));
  transform-origin: center;
  transition: opacity 120ms ease;
  will-change: transform, opacity;
}

.rider-mount {
  position: relative;
  width: var(--rider-width, 158px);
  height: calc(var(--rider-width, 158px) * 0.86);
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
  animation: rider-bob 920ms cubic-bezier(0.45, 0, 0.25, 1) infinite;
  will-change: transform;
}

.rider-mount::before {
  position: absolute;
  left: 10%;
  right: 8%;
  bottom: 11%;
  height: 18%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 15, 22, 0.42), rgba(0, 15, 22, 0));
  filter: blur(5px);
  content: "";
  transform: translateZ(-1px);
}

.rider-image {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--rider-width, 158px);
  height: auto;
  object-fit: contain;
  object-position: center;
  filter:
    drop-shadow(0 11px 10px rgba(0, 12, 19, 0.38))
    drop-shadow(0 0 10px rgba(117, 255, 242, 0.22));
  transform: translate(-50%, -50%) rotate(-2deg);
  transform-origin: 50% 55%;
  animation: rider-sway 1.18s cubic-bezier(0.45, 0, 0.25, 1) infinite;
  will-change: transform, filter;
}

.game-shell.is-boosting .rider-image {
  animation-duration: 420ms;
  filter:
    drop-shadow(0 8px 8px rgba(0, 16, 24, 0.34))
    drop-shadow(0 0 18px rgba(255, 229, 127, 0.74));
}

.game-shell.is-casting .rider-mount {
  animation: rider-cast 620ms cubic-bezier(0.18, 0.86, 0.22, 1);
}

.game-shell.is-shielded .rider-mount::after {
  position: absolute;
  inset: 7% 4%;
  border: 2px solid rgba(148, 255, 245, 0.72);
  border-radius: 50%;
  box-shadow:
    0 0 22px rgba(91, 239, 230, 0.48),
    inset 0 0 16px rgba(91, 239, 230, 0.2);
  content: "";
  animation: shield-pulse 900ms ease-in-out infinite;
}

.screen-fx {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.screen-fx::before,
.screen-fx::after {
  position: absolute;
  inset: 0;
  opacity: 0;
  content: "";
}

.screen-fx::before {
  background:
    radial-gradient(circle at 34% 52%, var(--skill-tint), transparent 0 22%),
    radial-gradient(circle at 72% 48%, rgba(255, 240, 163, 0.82), transparent 0 18%);
  mix-blend-mode: screen;
}

.screen-fx::after {
  background:
    linear-gradient(105deg, transparent 0 34%, rgba(255, 255, 255, 0.72) 48%, transparent 62%),
    linear-gradient(90deg, transparent 0 8%, rgba(149, 255, 245, 0.26) 46%, transparent 86%);
  transform: translateX(-80%);
  mix-blend-mode: screen;
}

.game-shell.is-casting .screen-fx::before {
  animation: cast-wash 620ms ease-out;
}

.game-shell.is-casting .screen-fx::after {
  animation: cast-streak 620ms ease-out;
}

.hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  z-index: 7;
  display: grid;
  grid-template-columns: minmax(74px, auto) minmax(86px, 1fr) auto 44px 44px;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.game-shell:not(.is-playing) .score-board,
.game-shell:not(.is-playing) .weapon-board,
.game-shell:not(.is-playing) .life-board,
.game-shell:not(.is-playing) #pauseButton {
  opacity: 0;
  pointer-events: none;
}

.score-board,
.weapon-board,
.life-board,
.icon-button {
  min-height: 44px;
  border: 1px solid rgba(180, 245, 246, 0.28);
  background:
    linear-gradient(180deg, rgba(14, 70, 82, 0.72), rgba(3, 26, 38, 0.54)),
    rgba(3, 28, 38, 0.46);
  backdrop-filter: blur(14px) saturate(1.25);
  box-shadow:
    0 13px 30px rgba(1, 14, 22, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 -1px 0 rgba(0, 10, 16, 0.28);
}

.score-board {
  display: grid;
  align-items: center;
  min-width: 74px;
  padding: 5px 11px 6px;
  border-radius: 8px;
  box-shadow:
    0 13px 30px rgba(1, 14, 22, 0.34),
    inset 3px 0 0 rgba(255, 236, 142, 0.88),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.score-board span {
  color: rgba(216, 250, 255, 0.74);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.score-board strong {
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 2px 10px rgba(127, 255, 242, 0.32);
}

.weapon-board {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  padding: 0 9px;
  border-radius: 8px;
  color: rgba(228, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 900;
  text-shadow: 0 1px 8px rgba(116, 255, 244, 0.22);
  white-space: nowrap;
}

.life-board {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 76px;
  padding: 0 8px;
  border-radius: 8px;
}

.life {
  width: 16px;
  height: 16px;
  border-radius: 50% 50% 48% 48%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.9), transparent 0 18%, transparent 19%),
    linear-gradient(145deg, #ffb6ca 0%, #ff6c98 52%, #d94472 100%);
  box-shadow: 0 0 13px rgba(255, 124, 165, 0.62);
  transform: rotate(45deg);
  animation: life-pulse 1.8s ease-in-out infinite;
}

.life.is-empty {
  background: rgba(190, 224, 230, 0.2);
  box-shadow: none;
}

.icon-button {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 8px;
  color: #ecfeff;
  font-size: 18px;
  font-weight: 900;
  box-shadow:
    0 13px 30px rgba(1, 14, 22, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.sound-button.is-active {
  color: #06242d;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 44%),
    linear-gradient(180deg, #fff1a5, #76fff0);
}

.sound-panel {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + 54px);
  right: max(12px, env(safe-area-inset-right));
  z-index: 8;
  width: min(272px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid rgba(180, 245, 246, 0.32);
  border-radius: 8px;
  color: #ecfeff;
  background:
    linear-gradient(180deg, rgba(14, 70, 82, 0.92), rgba(3, 26, 38, 0.9)),
    rgba(3, 28, 38, 0.88);
  box-shadow:
    0 18px 38px rgba(1, 13, 20, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.98);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.sound-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.sound-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sound-panel-head strong {
  color: #fff1a5;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.sound-close,
.music-toggle {
  border: 1px solid rgba(180, 245, 246, 0.28);
  border-radius: 8px;
  color: #ecfeff;
  background: rgba(1, 20, 29, 0.42);
  font-weight: 900;
}

.sound-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 18px;
}

.music-toggle {
  width: 100%;
  height: 34px;
  margin-bottom: 10px;
  color: #06242d;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent 44%),
    linear-gradient(180deg, #fff1a5, #76fff0);
}

.music-toggle.is-muted {
  color: rgba(236, 254, 255, 0.78);
  background: rgba(1, 20, 29, 0.48);
}

.sound-control {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  color: rgba(232, 255, 255, 0.86);
  font-size: 12px;
  font-weight: 900;
}

.sound-control span {
  display: flex;
  justify-content: space-between;
}

.sound-control b {
  color: #fff1a5;
}

.sound-control input {
  width: 100%;
  accent-color: #76fff0;
}

.icon-button:active,
.ability-button:active,
.primary-button:active,
.character-card:active,
.music-toggle:active,
.sound-close:active {
  transform: translateY(1px);
}

.ability-button {
  --charge: 0;
  --ability-tint: #fff0a3;
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 4;
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  padding: 10px;
  border: 0;
  border-radius: 50%;
  color: rgba(232, 255, 255, 0.92);
  background:
    radial-gradient(circle at 50% 47%, rgba(11, 61, 70, 0.98) 0 43%, rgba(3, 25, 36, 0.98) 58%, transparent 60%),
    conic-gradient(var(--ability-tint) calc(var(--charge) * 1%), rgba(140, 230, 232, 0.2) 0);
  box-shadow:
    0 18px 34px rgba(0, 11, 18, 0.48),
    0 0 0 1px rgba(183, 255, 250, 0.18),
    inset 0 2px 2px rgba(255, 255, 255, 0.12),
    inset 0 -8px 16px rgba(0, 12, 20, 0.34);
  transform: translateZ(0);
  transition:
    filter 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
  will-change: transform, filter;
}

.game-shell:not(.is-playing) .ability-button {
  opacity: 0;
  pointer-events: none;
}

.ability-button::before {
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(188, 255, 250, 0.26);
  border-radius: inherit;
  background:
    radial-gradient(circle at 38% 26%, rgba(255, 255, 255, 0.18), transparent 0 18%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(0, 12, 20, 0.16));
  box-shadow: inset 0 0 18px rgba(113, 255, 243, 0.08);
  content: "";
}

.ability-button::after {
  position: absolute;
  inset: -9px;
  border: 2px solid transparent;
  border-radius: inherit;
  background:
    conic-gradient(from 210deg, transparent, rgba(255, 255, 255, 0.86), transparent 30%) border-box;
  -webkit-mask:
    linear-gradient(#000 0 0) padding-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) padding-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  content: "";
  opacity: 0;
}

.ability-button:disabled {
  filter: saturate(0.86);
  opacity: 0.9;
}

.ability-button.is-ready {
  color: #05252c;
  background:
    radial-gradient(circle at 50% 47%, color-mix(in srgb, var(--ability-tint) 88%, white) 0 42%, var(--ability-tint) 55%, transparent 58%),
    conic-gradient(#68fff1 0 100%);
  box-shadow:
    0 0 0 5px rgba(255, 239, 150, 0.18),
    0 0 24px rgba(255, 235, 126, 0.68),
    0 0 42px color-mix(in srgb, var(--ability-tint) 48%, transparent),
    0 18px 32px rgba(0, 11, 18, 0.48),
    inset 0 2px 3px rgba(255, 255, 255, 0.28);
  animation: ability-ready 860ms cubic-bezier(0.55, 0, 0.2, 1) infinite;
}

.ability-button.is-ready::after {
  opacity: 1;
  animation: skill-ring 860ms ease-in-out infinite;
}

.ability-icon,
.ability-core,
.ability-art,
.ability-label,
.ability-meter {
  position: relative;
  z-index: 1;
  line-height: 1;
}

.ability-core {
  display: grid;
  place-items: center;
  width: 47px;
  height: 39px;
  margin-top: -4px;
  border-radius: 50%;
  background: radial-gradient(circle at 48% 42%, rgba(255, 255, 255, 0.18), transparent 0 62%);
}

.ability-art {
  grid-area: 1 / 1;
  width: 57px;
  height: 48px;
  object-fit: contain;
  filter:
    drop-shadow(0 5px 7px rgba(0, 16, 24, 0.36))
    drop-shadow(0 0 8px rgba(255, 255, 255, 0.12));
  transform: scale(1.02);
}

.ability-icon {
  grid-area: 1 / 1;
  font-size: 24px;
  font-weight: 900;
  opacity: 0;
}

.ability-label {
  margin-top: -3px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 1px 8px rgba(0, 13, 18, 0.48);
}

.ability-meter {
  min-width: 34px;
  margin-top: -2px;
  padding: 2px 5px;
  border-radius: 99px;
  color: rgba(233, 255, 255, 0.76);
  background: rgba(0, 14, 20, 0.22);
  font-size: 11px;
  font-weight: 900;
}

.ability-button.is-ready .ability-meter {
  color: #173036;
}

.ability-button.is-ready .ability-label {
  color: #05252c;
}

.ability-button.is-ready .ability-art {
  filter:
    drop-shadow(0 5px 7px rgba(0, 16, 24, 0.22))
    drop-shadow(0 0 13px rgba(255, 255, 255, 0.42));
  animation: ability-art-ready 680ms ease-in-out infinite;
}

.corner-links {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  pointer-events: auto;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.game-shell.is-playing .corner-links {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.corner-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid rgba(178, 246, 246, 0.32);
  border-radius: 8px;
  color: rgba(238, 255, 255, 0.92);
  background:
    linear-gradient(180deg, rgba(17, 75, 84, 0.78), rgba(3, 28, 40, 0.68)),
    rgba(3, 30, 42, 0.62);
  box-shadow:
    0 12px 24px rgba(0, 13, 20, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px) saturate(1.2);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  touch-action: manipulation;
}

.corner-link::after {
  width: 6px;
  height: 6px;
  margin-left: 7px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  content: "";
  transform: rotate(45deg);
  opacity: 0.72;
}

.corner-link:focus-visible {
  outline: 2px solid #fff1a6;
  outline-offset: 2px;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  padding: max(24px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom));
  text-align: center;
  background:
    linear-gradient(180deg, rgba(2, 21, 31, 0.2), rgba(2, 13, 22, 0.86)),
    linear-gradient(90deg, rgba(9, 77, 85, 0.28), rgba(16, 49, 70, 0.18), rgba(9, 77, 85, 0.24));
  backdrop-filter: blur(1.5px);
}

.overlay.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(173, 246, 247, 0.46);
  border-radius: 50%;
  color: #89fbf1;
  background:
    radial-gradient(circle at 36% 26%, rgba(255, 255, 255, 0.24), transparent 0 24%),
    linear-gradient(180deg, rgba(15, 82, 92, 0.76), rgba(4, 42, 51, 0.58));
  box-shadow:
    0 0 28px rgba(91, 239, 230, 0.36),
    inset 0 0 18px rgba(255, 255, 255, 0.1);
  animation: mark-float 2.6s ease-in-out infinite;
}

.overlay h1 {
  margin: 0;
  color: #fff9ef;
  font-size: clamp(34px, 10vw, 58px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 8px 22px rgba(0, 13, 20, 0.5);
}

.logo-title {
  width: min(86vw, 520px);
}

.logo-image {
  display: block;
  width: 100%;
  height: auto;
  filter:
    drop-shadow(0 12px 18px rgba(0, 12, 18, 0.46))
    drop-shadow(0 0 16px rgba(111, 255, 244, 0.24));
}

.overlay p {
  max-width: 300px;
  margin: 0;
  color: rgba(225, 252, 255, 0.86);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.42;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
  width: min(calc(100vw - 28px), 430px);
}

.character-card {
  min-width: 0;
  min-height: 142px;
  padding: 8px 6px 7px;
  border: 1px solid rgba(174, 236, 241, 0.24);
  border-radius: 8px;
  color: #eefcff;
  background:
    linear-gradient(180deg, rgba(17, 68, 78, 0.66), rgba(4, 32, 45, 0.68)),
    rgba(4, 37, 48, 0.64);
  box-shadow:
    0 12px 24px rgba(0, 13, 20, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateZ(0);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.character-card.is-selected {
  border-color: rgba(255, 236, 142, 0.95);
  background:
    linear-gradient(180deg, rgba(74, 86, 70, 0.86), rgba(11, 56, 61, 0.78)),
    rgba(20, 62, 65, 0.76);
  box-shadow:
    0 0 0 2px rgba(255, 236, 142, 0.22),
    0 16px 30px rgba(0, 13, 20, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transform: translateY(-2px);
}

.character-card img {
  width: 100%;
  height: 58px;
  object-fit: contain;
  filter:
    drop-shadow(0 7px 7px rgba(0, 16, 24, 0.38))
    drop-shadow(0 0 8px rgba(133, 255, 243, 0.13));
}

.character-card strong {
  display: block;
  margin-top: 3px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.1;
}

.character-card span {
  display: block;
  min-height: 28px;
  color: rgba(229, 255, 255, 0.78);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.28;
}

.stat-row {
  display: grid;
  gap: 3px;
  margin-top: 5px;
}

.stat {
  display: grid;
  grid-template-columns: 17px 1fr;
  align-items: center;
  gap: 4px;
  color: rgba(231, 255, 255, 0.78);
  font-size: 9px;
  font-weight: 900;
}

.stat i {
  display: block;
  height: 5px;
  border-radius: 99px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    rgba(184, 231, 236, 0.18);
  overflow: hidden;
}

.stat i::after {
  display: block;
  width: calc(var(--value) * 1%);
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #79fff1, #ffe780),
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), transparent);
  content: "";
}

.ability-line,
.best-line {
  color: rgba(232, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 800;
}

.ability-line {
  min-height: 20px;
  max-width: 310px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.best-line strong {
  color: #fff1b1;
  font-size: 18px;
}

.primary-button {
  min-width: 132px;
  height: 48px;
  border: 0;
  border-radius: 8px;
  color: #06242d;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 38%),
    linear-gradient(180deg, #fff1a5 0%, #ffc663 100%);
  box-shadow:
    0 14px 32px rgba(0, 14, 22, 0.38),
    inset 0 -2px 0 rgba(146, 82, 21, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.44);
  font-size: 18px;
  font-weight: 900;
}

@keyframes rider-bob {
  0%,
  100% {
    transform: translate(-50%, -50%) translateY(1px) scaleX(1);
  }

  50% {
    transform: translate(-50%, -50%) translateY(-6px) scaleX(1.015);
  }
}

@keyframes rider-sway {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(-3.6deg) scaleY(1) scaleX(1);
  }

  50% {
    transform: translate(-50%, -50%) rotate(4.2deg) scaleY(0.982) scaleX(1.012);
  }
}

@keyframes rider-cast {
  0% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }

  28% {
    transform: translate(-50%, -50%) scale(1.11) rotate(-4deg);
  }

  58% {
    transform: translate(-50%, -50%) scale(0.96) rotate(3deg);
  }

  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

@keyframes shield-pulse {
  0%,
  100% {
    transform: scale(0.95) rotate(-2deg);
    opacity: 0.72;
  }

  50% {
    transform: scale(1.08) rotate(2deg);
    opacity: 1;
  }
}

@keyframes ability-ready {
  0%,
  100% {
    transform: scale(1) translateY(0);
  }

  50% {
    transform: scale(1.07) translateY(-2px);
  }
}

@keyframes ability-art-ready {
  0%,
  100% {
    transform: scale(1.06) rotate(-4deg);
  }

  50% {
    transform: scale(1.22) rotate(5deg);
  }
}

@keyframes skill-ring {
  0%,
  100% {
    transform: scale(0.92) rotate(0deg);
    opacity: 0.4;
  }

  50% {
    transform: scale(1.12) rotate(14deg);
    opacity: 1;
  }
}

@keyframes cast-wash {
  0% {
    opacity: 0;
    transform: scale(0.72);
  }

  28% {
    opacity: 0.28;
  }

  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

@keyframes cast-streak {
  0% {
    opacity: 0;
    transform: translateX(-88%) skewX(-12deg);
  }

  32% {
    opacity: 0.46;
  }

  100% {
    opacity: 0;
    transform: translateX(82%) skewX(-12deg);
  }
}

@keyframes life-pulse {
  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.18);
  }
}

@keyframes mark-float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

@media (max-width: 900px) {
  .character-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    max-width: 300px;
  }
}

@media (max-width: 460px) {
  .hud {
    grid-template-columns: minmax(64px, auto) minmax(64px, 1fr) auto 40px 40px;
    gap: 6px;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }

  .weapon-board {
    min-width: 64px;
    font-size: 11px;
  }

  .character-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    max-width: 300px;
  }

  .character-card {
    min-height: 116px;
  }

  .character-card img {
    height: 44px;
  }

  .ability-button {
    width: 82px;
    height: 82px;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
  }

  .corner-links {
    left: max(10px, env(safe-area-inset-left));
    bottom: max(10px, env(safe-area-inset-bottom));
    gap: 6px;
  }

  .corner-link {
    min-height: 34px;
    padding: 0 10px;
    font-size: 11px;
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  .game-shell::after {
    position: absolute;
    inset: auto 16px max(12px, env(safe-area-inset-bottom));
    z-index: 6;
    color: rgba(232, 255, 255, 0.78);
    content: "세로 화면에 맞춰 설계되었습니다.";
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    pointer-events: none;
  }

  .overlay {
    gap: 8px;
  }

  .overlay h1 {
    font-size: 32px;
  }

  .character-grid {
    max-width: 560px;
  }

  .character-card {
    min-height: 112px;
  }
}
