:root {
  color-scheme: dark;
  --bg: #03060d;
  --panel: rgba(7, 14, 25, 0.92);
  --panel-2: rgba(12, 24, 39, 0.94);
  --line: rgba(136, 189, 214, 0.14);
  --line-bright: rgba(128, 229, 238, 0.36);
  --text: #edf8f8;
  --muted: #7990a0;
  --cyan: #71f2e6;
  --cyan-2: #b9fff6;
  --blue: #5aa7ff;
  --violet: #9b7cff;
  --danger: #ff5878;
  --gold: #ffd371;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.55);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
}


[hidden] {
  display: none !important;
}

button,
canvas {
  touch-action: none;
}

button {
  font: inherit;
  color: inherit;
}

button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

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

#app {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 100%;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% -5%, rgba(53, 130, 164, 0.12), transparent 34%),
    linear-gradient(180deg, #07101a 0%, #03060d 52%, #02040a 100%);
}

#app::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(95, 190, 205, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(95, 190, 205, 0.028) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.ambient {
  position: absolute;
  z-index: -2;
  width: 45vmax;
  height: 45vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.13;
  pointer-events: none;
  animation: drift 16s ease-in-out infinite alternate;
}

.ambient-a {
  top: -24vmax;
  left: -15vmax;
  background: #3ef9e5;
}

.ambient-b {
  right: -20vmax;
  bottom: -28vmax;
  background: #7254ff;
  animation-delay: -7s;
}

@keyframes drift {
  to { transform: translate3d(9vmax, 5vmax, 0) scale(1.12); }
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
}

.screen.is-visible {
  display: grid;
}

.title-screen {
  place-items: center;
  padding: calc(22px + var(--safe-top)) 22px calc(18px + var(--safe-bottom));
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 26%, rgba(92, 231, 222, 0.09), transparent 24%),
    linear-gradient(180deg, rgba(4, 9, 17, 0.62), rgba(2, 5, 11, 0.96));
}

.title-screen::before,
.title-screen::after {
  content: "";
  position: fixed;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: min(76vw, 430px);
  aspect-ratio: 1;
  border: 1px solid rgba(98, 241, 226, 0.06);
  pointer-events: none;
}

.title-screen::before { top: -25vw; }
.title-screen::after { bottom: -42vw; border-color: rgba(137, 110, 255, 0.06); }

.title-content {
  position: relative;
  width: min(100%, 430px);
  text-align: center;
  animation: titleEnter 700ms cubic-bezier(.2,.8,.2,1) both;
}

@keyframes titleEnter {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sigil {
  position: relative;
  width: 86px;
  height: 86px;
  margin: 0 auto 17px;
  filter: drop-shadow(0 0 22px rgba(105, 245, 233, 0.22));
}

.sigil::before,
.sigil::after,
.sigil i,
.sigil b,
.sigil span {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%) rotate(45deg);
}

.sigil::before {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(139, 255, 243, 0.82);
  background: rgba(46, 208, 196, 0.03);
  animation: sigilPulse 3.2s ease-in-out infinite;
}

.sigil::after {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(139, 255, 243, 0.32);
}

.sigil i {
  width: 17px;
  height: 17px;
  border: 1px solid var(--cyan);
  background: rgba(115, 246, 232, 0.2);
  box-shadow: 0 0 24px rgba(115, 246, 232, 0.6);
}

.sigil b {
  width: 77px;
  height: 1px;
  transform: translate(-50%, -50%) rotate(0deg);
  background: linear-gradient(90deg, transparent, rgba(127, 240, 234, 0.65), transparent);
}

.sigil span {
  width: 1px;
  height: 77px;
  transform: translate(-50%, -50%) rotate(0deg);
  background: linear-gradient(180deg, transparent, rgba(127, 240, 234, 0.65), transparent);
}

@keyframes sigilPulse {
  0%, 100% { transform: translate(-50%, -50%) rotate(45deg) scale(1); opacity: .7; }
  50% { transform: translate(-50%, -50%) rotate(135deg) scale(1.08); opacity: 1; }
}

.eyebrow,
.modal-kicker {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.29em;
}

.title-content h1 {
  margin: 0;
  font-size: clamp(47px, 14vw, 68px);
  font-weight: 250;
  line-height: 0.94;
  letter-spacing: 0.055em;
  text-shadow: 0 0 38px rgba(113, 242, 230, 0.08);
}

.title-content h1 span {
  font-weight: 800;
  color: transparent;
  -webkit-text-stroke: 1px rgba(232, 255, 254, 0.87);
}

.jp-title {
  margin: 11px 0 0;
  color: #a9c7ce;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.72em;
  text-indent: .72em;
}

.tagline {
  margin: 23px 0 25px;
  color: #8ba0ad;
  font-size: 13px;
  line-height: 1.9;
  letter-spacing: 0.04em;
}

.title-actions {
  display: grid;
  gap: 10px;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button,
.dpad-button,
.action-button {
  position: relative;
  border: 0;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.primary-button {
  min-height: 68px;
  padding: 11px 18px;
  overflow: hidden;
  border: 1px solid rgba(132, 255, 243, 0.58);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(91, 245, 228, 0.16), rgba(41, 118, 130, 0.07)),
    rgba(7, 21, 29, 0.87);
  box-shadow: inset 0 0 28px rgba(102, 245, 231, 0.05), 0 10px 30px rgba(0,0,0,.22);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.primary-button::before,
.primary-button::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-color: var(--cyan);
}

.primary-button::before {
  top: 5px;
  left: 5px;
  border-top: 1px solid;
  border-left: 1px solid;
}

.primary-button::after {
  right: 5px;
  bottom: 5px;
  border-right: 1px solid;
  border-bottom: 1px solid;
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.danger-button:active,
.dpad-button:active,
.action-button:active {
  transform: scale(0.975);
}

.button-kicker {
  display: block;
  margin-bottom: 4px;
  color: #75bfc2;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .24em;
}

.primary-button strong {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .08em;
}

.secondary-button {
  display: flex;
  min-height: 49px;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px;
  border: 1px solid rgba(125, 163, 181, 0.17);
  border-radius: 4px;
  background: rgba(10, 18, 29, 0.72);
  color: #c7d9de;
  font-size: 13px;
  transition: transform 120ms ease, border-color 120ms ease;
}

.secondary-button small {
  color: #5fbebf;
  font-size: 10px;
  letter-spacing: .08em;
}

.secondary-button.centered {
  justify-content: center;
}

.title-sub-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#howToBtn {
  grid-column: 1 / -1;
}

.title-sub-actions.has-install #howToBtn {
  grid-column: auto;
}

.ghost-button {
  min-height: 39px;
  border: 1px solid rgba(123, 157, 174, 0.11);
  border-radius: 3px;
  background: rgba(8, 15, 25, 0.38);
  color: #8198a5;
  font-size: 11px;
  letter-spacing: .08em;
}

.run-meta {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 24px;
  color: #617581;
  font-size: 9px;
  letter-spacing: .09em;
}

.run-meta b {
  color: #9ab6bd;
  font-size: 11px;
}

.best-score {
  margin: 15px 0 0;
  color: #5b6d78;
  font-size: 9px;
  letter-spacing: .17em;
}

.best-score strong {
  color: var(--gold);
  font-size: 11px;
}

.version {
  margin: 9px 0 0;
  color: #3c4b55;
  font-size: 8px;
  letter-spacing: .08em;
}

.game-screen {
  position: relative;
  width: min(100%, 520px);
  height: 100dvh;
  min-height: 100%;
  margin: 0 auto;
  display: none;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  background: linear-gradient(180deg, rgba(5, 12, 21, 0.96), rgba(2, 5, 10, 0.99));
  box-shadow: 0 0 90px rgba(0,0,0,.75);
}

.game-screen.is-visible {
  display: grid;
}

.hud {
  min-height: 73px;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 44px;
  gap: 11px;
  align-items: center;
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 27, 40, 0.96), rgba(6, 14, 24, 0.9));
}

.floor-panel {
  min-width: 0;
  height: 56px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 14px 27px 14px;
  align-items: center;
  padding: 4px 7px;
  border-left: 2px solid rgba(113, 242, 230, 0.75);
  background: linear-gradient(90deg, rgba(87, 221, 215, 0.07), transparent);
}

.floor-panel small {
  grid-column: 1 / -1;
  color: #5e8892;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .22em;
}

.floor-panel strong {
  grid-column: 1 / -1;
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: .06em;
}

.floor-panel span {
  grid-column: 1 / -1;
  overflow: hidden;
  color: #77919c;
  font-size: 8px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bars-panel {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.bar-row {
  display: grid;
  grid-template-columns: 12px minmax(40px, 1fr) 62px;
  gap: 7px;
  align-items: center;
}

.bar-row.compact {
  grid-template-columns: 12px minmax(40px, 1fr) 62px;
}

.bar-icon {
  color: var(--cyan);
  font-size: 9px;
  text-align: center;
}

.meter {
  position: relative;
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(130, 179, 194, 0.14);
  background: rgba(0, 0, 0, 0.34);
  transform: skewX(-10deg);
}

.meter::before {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: 2;
  background: repeating-linear-gradient(90deg, transparent 0 10%, rgba(0,0,0,.27) 10.5% 11.5%);
}

.meter i {
  display: block;
  width: 100%;
  height: 100%;
  transition: width 240ms ease;
}

.hp-meter i {
  background: linear-gradient(90deg, #2bc5be, #83f7e8);
  box-shadow: 0 0 12px rgba(90, 244, 228, .45);
}

.hp-meter.is-low i {
  background: linear-gradient(90deg, #b72f50, #ff617f);
  box-shadow: 0 0 12px rgba(255, 72, 107, .45);
  animation: lowHp 900ms ease-in-out infinite;
}

@keyframes lowHp { 50% { opacity: .52; } }

.xp-meter {
  height: 6px;
}

.xp-meter i {
  background: linear-gradient(90deg, #6b5ee8, #b795ff);
  box-shadow: 0 0 10px rgba(155, 124, 255, .38);
}

.bar-row output {
  color: #b7cbd0;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  letter-spacing: .04em;
}

.icon-button {
  width: 39px;
  height: 39px;
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(125, 177, 192, 0.16);
  border-radius: 50%;
  background: rgba(6, 14, 23, 0.78);
}

.icon-button span {
  width: 2px;
  height: 12px;
  background: #7f9ba4;
}

.stat-strip {
  min-height: 25px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  border-bottom: 1px solid rgba(123, 164, 181, 0.09);
  background: rgba(3, 8, 14, 0.75);
}

.stat-strip span {
  border-right: 1px solid rgba(122, 165, 183, 0.08);
  color: #526a76;
  font-size: 7px;
  font-weight: 800;
  text-align: center;
  letter-spacing: .13em;
}

.stat-strip span:last-child { border-right: 0; }
.stat-strip b { color: #9eb7be; font-size: 9px; font-variant-numeric: tabular-nums; }

.stage-region {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 5px 8px;
  overflow: hidden;
}

.stage-frame {
  position: relative;
  width: min(100%, calc((100dvh - 268px - var(--safe-top) - var(--safe-bottom)) * 0.7894737));
  max-height: 100%;
  aspect-ratio: 600 / 760;
  overflow: hidden;
  border: 1px solid rgba(105, 180, 196, 0.13);
  background: #02060b;
  box-shadow: inset 0 0 45px rgba(0,0,0,.55), 0 11px 35px rgba(0,0,0,.25);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
}

.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .13;
  background: repeating-linear-gradient(180deg, transparent 0 3px, rgba(132, 238, 228, .035) 4px);
  mix-blend-mode: screen;
}

.scanlines::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 55px rgba(0,0,0,.58);
}

.toast {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 16px;
  min-width: 160px;
  max-width: calc(100% - 30px);
  padding: 8px 14px;
  transform: translate(-50%, 12px);
  border: 1px solid rgba(127, 228, 226, 0.24);
  border-radius: 2px;
  background: rgba(4, 13, 22, 0.9);
  color: #cce7e7;
  font-size: 10px;
  text-align: center;
  letter-spacing: .06em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  backdrop-filter: blur(7px);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-danger {
  border-color: rgba(255, 83, 119, .38);
  color: #ffd0d8;
}

.boss-banner {
  position: absolute;
  z-index: 6;
  top: 18%;
  left: 50%;
  width: 84%;
  padding: 12px 18px;
  transform: translate(-50%, -10px) scale(.97);
  border-top: 1px solid rgba(255, 84, 121, .5);
  border-bottom: 1px solid rgba(255, 84, 121, .5);
  background: linear-gradient(90deg, transparent, rgba(35, 4, 14, .94) 18%, rgba(35, 4, 14, .94) 82%, transparent);
  text-align: center;
  opacity: 0;
  pointer-events: none;
}

.boss-banner.is-visible {
  animation: bossBanner 2.6s ease both;
}

.boss-banner small {
  display: block;
  color: #ff7792;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .28em;
}

.boss-banner strong {
  display: block;
  margin-top: 4px;
  color: #ffe8ed;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .12em;
}

@keyframes bossBanner {
  0% { opacity: 0; transform: translate(-50%, -10px) scale(.97); }
  14%, 75% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, 8px) scale(1.02); }
}

.status-line {
  min-height: 26px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  overflow: hidden;
  border-top: 1px solid rgba(115, 160, 178, 0.07);
  border-bottom: 1px solid rgba(115, 160, 178, 0.09);
  background: rgba(7, 15, 24, 0.94);
  color: #8fa5ae;
  font-size: 9px;
  letter-spacing: .03em;
  white-space: nowrap;
}

.status-dot {
  flex: 0 0 auto;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 7px var(--cyan);
}

#statusText {
  overflow: hidden;
  text-overflow: ellipsis;
}

.controls {
  min-height: 138px;
  display: grid;
  grid-template-columns: minmax(154px, 44%) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(117, 167, 185, 0.11);
  background:
    linear-gradient(180deg, rgba(12, 24, 36, 0.96), rgba(5, 10, 18, .98));
  box-shadow: 0 -14px 35px rgba(0,0,0,.22);
}

.dpad {
  width: min(100%, 184px);
  aspect-ratio: 1.52 / 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  justify-self: center;
  grid-template-areas:
    ". up ."
    "left wait right"
    ". down .";
}

.dpad-button {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(122, 174, 190, 0.17);
  border-radius: 7px;
  background: linear-gradient(145deg, rgba(20, 39, 54, .92), rgba(6, 14, 24, .92));
  color: #7897a2;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025), 0 5px 12px rgba(0,0,0,.16);
  transition: transform 70ms ease, border-color 80ms ease, color 80ms ease;
}

.dpad-button:active {
  border-color: rgba(110, 242, 230, .45);
  color: var(--cyan-2);
}

.dpad-button span {
  font-size: 13px;
  transform: scaleX(.85);
}

.dpad-button.up { grid-area: up; }
.dpad-button.left { grid-area: left; }
.dpad-button.wait { grid-area: wait; display: flex; flex-direction: column; gap: 0; }
.dpad-button.right { grid-area: right; }
.dpad-button.down { grid-area: down; }
.dpad-button.wait span { color: var(--cyan); font-size: 23px; line-height: 16px; }
.dpad-button.wait small { color: #4f6d78; font-size: 6px; font-weight: 800; letter-spacing: .14em; }

.action-pad {
  min-width: 0;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
}

.action-button {
  min-width: 0;
  min-height: 50px;
  display: grid;
  grid-template-columns: 37px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid rgba(119, 176, 191, 0.18);
  border-radius: 7px;
  background: linear-gradient(135deg, rgba(16, 34, 47, .94), rgba(5, 12, 20, .94));
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025), 0 5px 12px rgba(0,0,0,.14);
  transition: transform 70ms ease, border-color 80ms ease;
}

.skill-button { border-color: rgba(135, 111, 255, .28); }
.potion-button { border-color: rgba(93, 223, 197, .2); }
.action-button:active { border-color: rgba(129, 245, 230, .52); }

.action-button.is-cooling {
  filter: saturate(.55);
}

.action-glyph {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(137, 198, 210, .14);
  border-radius: 50%;
  background: rgba(0,0,0,.2);
  color: var(--cyan);
  font-size: 18px;
  text-align: center;
}

.skill-button .action-glyph {
  color: #ad91ff;
  text-shadow: 0 0 12px rgba(158, 123, 255, .7);
}

.action-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.action-copy strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .07em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.action-copy small {
  margin-top: 2px;
  color: #58707b;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .12em;
}

.action-copy small b { color: #8ca6ad; }

#skillCooldownRing {
  position: absolute;
  right: -15px;
  top: -22px;
  width: 72px;
  height: 72px;
  border: 1px solid rgba(152, 120, 255, .08);
  border-radius: 50%;
  pointer-events: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: none;
  background: rgba(1, 4, 9, 0.76);
  backdrop-filter: blur(8px);
}

.modal-backdrop.is-visible {
  display: block;
  animation: fadeIn 180ms ease both;
}

@keyframes fadeIn { from { opacity: 0; } }

.modal {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: calc(18px + var(--safe-top)) 18px calc(18px + var(--safe-bottom));
  overflow-y: auto;
}

.modal.is-visible {
  display: grid;
}

.modal-card {
  position: relative;
  width: min(100%, 430px);
  padding: 28px 24px 22px;
  overflow: hidden;
  border: 1px solid rgba(131, 204, 212, 0.2);
  border-radius: 5px;
  background:
    linear-gradient(145deg, rgba(15, 31, 44, .97), rgba(5, 11, 20, .985));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.025);
  text-align: center;
  animation: modalIn 220ms cubic-bezier(.2,.8,.2,1) both;
}

.modal-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(133, 204, 214, .055);
  pointer-events: none;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(15px) scale(.98); }
}

.modal-card h2 {
  margin: 0;
  color: #f0fbfb;
  font-size: 25px;
  font-weight: 500;
  letter-spacing: .13em;
}

.modal-summary {
  margin: 10px 0 20px;
  color: #78909a;
  font-size: 11px;
  line-height: 1.65;
}

.compact-button {
  width: 100%;
  min-height: 52px;
}

.help-card {
  max-height: min(92dvh, 720px);
  overflow-y: auto;
  text-align: left;
}

.help-card .modal-kicker,
.help-card h2,
.help-card .compact-button { text-align: center; }

.help-grid {
  display: grid;
  gap: 13px;
  margin: 20px 0 18px;
}

.help-grid article {
  display: grid;
  grid-template-columns: 35px 1fr;
  gap: 11px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(129, 178, 192, .09);
}

.help-grid article > span {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(104, 225, 218, .22);
  color: var(--cyan);
  font-size: 8px;
  letter-spacing: .08em;
  transform: rotate(45deg);
}

.help-grid article > span::first-line { transform: rotate(-45deg); }
.help-grid h3 { margin: 0 0 4px; color: #cfe1e4; font-size: 12px; letter-spacing: .04em; }
.help-grid p { margin: 0; color: #748a95; font-size: 10px; line-height: 1.7; }

.control-note {
  margin: 0 0 18px;
  padding: 10px;
  border: 1px solid rgba(123, 175, 190, .1);
  background: rgba(0,0,0,.18);
  color: #67808a;
  font-size: 9px;
  line-height: 1.7;
  text-align: center;
}
.control-note b { color: #a2bdc2; }

.menu-card {
  display: grid;
  gap: 9px;
}
.menu-card h2 { margin-bottom: 0; }
.menu-card .modal-summary { margin: 0 0 9px; }

.danger-button {
  min-height: 42px;
  margin-top: 4px;
  border: 1px solid rgba(255, 78, 112, .17);
  border-radius: 4px;
  background: rgba(40, 5, 15, .3);
  color: #b96778;
  font-size: 10px;
  letter-spacing: .1em;
}

.level-card {
  width: min(100%, 470px);
  padding-top: 31px;
}

.level-burst {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: -5px auto 13px;
  border: 1px solid rgba(154, 122, 255, .35);
  color: #bd9fff;
  font-size: 22px;
  transform: rotate(45deg);
  box-shadow: inset 0 0 22px rgba(151, 118, 255, .12), 0 0 30px rgba(151, 118, 255, .08);
}

.upgrade-choices {
  display: grid;
  gap: 10px;
}

.upgrade-card {
  position: relative;
  min-height: 82px;
  display: grid;
  grid-template-columns: 51px 1fr 20px;
  gap: 12px;
  align-items: center;
  padding: 12px 13px;
  overflow: hidden;
  border: 1px solid rgba(130, 174, 191, .16);
  border-radius: 4px;
  background: linear-gradient(110deg, rgba(18, 35, 50, .92), rgba(7, 14, 24, .92));
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.upgrade-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan);
  opacity: .6;
}

.upgrade-card:active { transform: scale(.985); }
.upgrade-card:hover { border-color: rgba(121, 239, 229, .35); }

.upgrade-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(139, 218, 219, .15);
  border-radius: 50%;
  background: rgba(1, 7, 12, .32);
  color: var(--cyan);
  font-size: 19px;
}

.upgrade-copy strong { display: block; color: #d8e9eb; font-size: 13px; letter-spacing: .06em; }
.upgrade-copy small { display: block; margin-top: 5px; color: #738b95; font-size: 10px; line-height: 1.45; }
.upgrade-arrow { color: #506d77; font-size: 13px; }

.end-card { padding-top: 26px; }
.end-sigil {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 15px;
  border: 1px solid rgba(255, 93, 125, .27);
  color: #ff6986;
  font-size: 27px;
  transform: rotate(45deg);
  box-shadow: inset 0 0 27px rgba(255, 70, 108, .08);
}
.end-card.is-victory .end-sigil { border-color: rgba(109, 246, 230, .35); color: var(--cyan); box-shadow: inset 0 0 27px rgba(95, 244, 230, .1); }
.end-message { margin: 10px auto 19px; max-width: 310px; color: #7b9099; font-size: 11px; line-height: 1.8; }

.result-score {
  position: relative;
  display: grid;
  place-items: center;
  margin: 0 0 15px;
  padding: 14px;
  border-top: 1px solid rgba(135, 185, 199, .11);
  border-bottom: 1px solid rgba(135, 185, 199, .11);
  background: rgba(0,0,0,.16);
}
.result-score small { color: #58717a; font-size: 7px; font-weight: 800; letter-spacing: .23em; }
.result-score strong { margin-top: 2px; color: #e7f7f7; font-size: 31px; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: .05em; }
.result-score span { position: absolute; right: 10px; top: 10px; padding: 3px 6px; border: 1px solid rgba(255, 211, 113, .32); color: var(--gold); font-size: 6px; font-weight: 800; letter-spacing: .13em; transform: rotate(3deg); }

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 0 0 15px;
  background: rgba(125, 173, 188, .09);
}
.result-grid div { padding: 10px; background: #08111c; }
.result-grid dt { color: #506872; font-size: 8px; letter-spacing: .08em; }
.result-grid dd { margin: 4px 0 0; color: #b8ccd0; font-size: 14px; font-variant-numeric: tabular-nums; }
.end-card .secondary-button { width: 100%; margin-top: 9px; }

.rotate-notice {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  place-items: center;
  align-content: center;
  gap: 18px;
  background: #03070d;
  color: #79909a;
  font-size: 12px;
  letter-spacing: .08em;
}
.phone-icon {
  width: 41px;
  height: 67px;
  border: 2px solid #79909a;
  border-radius: 7px;
  transform: rotate(-90deg);
  animation: rotatePhone 1.8s ease-in-out infinite;
}
.phone-icon::after { content: ""; position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; transform: translateX(-50%); border-radius: 50%; background: #79909a; }
@keyframes rotatePhone { 50% { transform: rotate(0deg); } }

@media (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
  .rotate-notice { display: grid; }
}

@media (max-height: 730px) {
  .hud { min-height: 62px; padding-top: 5px; padding-bottom: 4px; }
  .floor-panel { height: 49px; grid-template-rows: 11px 24px 11px; }
  .floor-panel strong { font-size: 21px; }
  .controls { min-height: 121px; padding-top: 6px; padding-bottom: 7px; }
  .stage-frame { width: min(100%, calc((100dvh - 235px - var(--safe-top) - var(--safe-bottom)) * 0.7894737)); }
  .status-line { min-height: 23px; }
  .dpad { width: min(100%, 166px); gap: 5px; }
  .action-pad { gap: 6px; }
  .action-button { min-height: 45px; padding: 6px 9px; }
  .action-glyph { width: 31px; height: 31px; font-size: 16px; }
  .tagline { margin-top: 17px; margin-bottom: 19px; line-height: 1.7; }
  .sigil { width: 67px; height: 67px; margin-bottom: 11px; transform: scale(.82); }
}

@media (max-height: 620px) {
  .hud { min-height: 54px; }
  .floor-panel { height: 42px; grid-template-rows: 9px 21px 9px; }
  .floor-panel strong { font-size: 18px; }
  .controls { min-height: 103px; grid-template-columns: 43% 1fr; gap: 9px; }
  .stage-frame { width: min(100%, calc((100dvh - 207px - var(--safe-top) - var(--safe-bottom)) * 0.7894737)); }
  .action-button { min-height: 39px; grid-template-columns: 29px 1fr; }
  .action-glyph { width: 27px; height: 27px; font-size: 14px; }
  .dpad { width: min(100%, 145px); }
  .stat-strip { min-height: 21px; }
  .status-line { min-height: 21px; }
}

@media (min-width: 700px) {
  .game-screen {
    border-left: 1px solid rgba(128, 186, 200, .09);
    border-right: 1px solid rgba(128, 186, 200, .09);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
