@font-face {
  font-family: "DigitalNumbers";
  src: url("/fonts/DigitalNumbers-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

/* Tutorial rebuild: story shell plus real game-engine mechanics. */
body[data-page="learn"],
body[data-page="learn"] .app {
  background: #050505;
}

.tutorial-page {
  position: relative;
  min-height: var(--app-stable-height);
  overflow: hidden;
  background: #050505;
  color: #fff;
  isolation: isolate;
  --tutorial-story-width: min(calc(100vw - var(--scroll-gap, 16px) * 6), 430px);
}

.tutorial-page[data-tutorial-mode="intro"],
.tutorial-page[data-tutorial-mode="lore"],
.tutorial-page[data-tutorial-mode="modes"] {
  background: #050505;
}

.tutorial-spark-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tutorial-view {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--scroll-gap, 16px);
  width: 100%;
  max-width: 100%;
  min-height: var(--app-stable-height);
  padding: max(var(--scroll-gap, 16px), env(safe-area-inset-top)) var(--scroll-gap, 16px)
    max(var(--scroll-gap, 16px), env(safe-area-inset-bottom));
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transform: none;
  transition: opacity 520ms ease;
}

.tutorial-view.active {
  opacity: 1;
  pointer-events: auto;
}

.tutorial-view.is-fading {
  opacity: 0;
  pointer-events: none;
}

.tutorial-pixel-text {
  font-family: var(--font-vcr);
  font-synthesis: none;
  letter-spacing: 0.03em;
  text-shadow:
    1px 0 rgba(0, 0, 0, 0.68),
    -1px 0 rgba(0, 0, 0, 0.68),
    0 1px rgba(0, 0, 0, 0.68),
    0 -1px rgba(0, 0, 0, 0.68);
}

.tutorial-image-slot {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--tutorial-story-width);
  aspect-ratio: 1;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.56);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.015)),
    rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.56);
  font: 400 clamp(16px, 3.8vw, 22px)/1.3 var(--font-vcr);
  box-sizing: border-box;
}

.tutorial-image-slot::after {
  content: attr(data-image-label);
}

.tutorial-intro-view {
  grid-template-rows: auto auto auto;
}

.tutorial-intro-image {
  width: min(var(--tutorial-story-width), 38vh);
  opacity: 0;
  animation: tutorialCleanReveal 1800ms ease forwards;
}

.tutorial-intro-text {
  display: grid;
  gap: 0.78em;
  width: var(--tutorial-story-width);
  text-align: center;
  font-size: clamp(16px, 4.2vw, 24px);
  line-height: 1.55;
}

.tutorial-text-line {
  opacity: 0;
  transition: opacity 520ms ease;
}

.tutorial-text-line.visible {
  opacity: 1;
}

.tutorial-actions,
.tutorial-intro-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--scroll-gap, 16px);
  width: var(--tutorial-story-width);
  justify-items: stretch;
}

.tutorial-action-button,
.tutorial-wide-button {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: clamp(64px, 8.4vh, 82px);
  opacity: 0;
  pointer-events: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 360ms ease, transform 160ms ease;
}

.tutorial-action-button.visible,
.tutorial-wide-button.visible {
  opacity: 1;
  pointer-events: auto;
}

.tutorial-action-button:active,
.tutorial-wide-button:active {
  transform: scale(0.985);
}

.tutorial-lore-view,
.tutorial-modes-view {
  grid-template-rows: auto auto auto;
  align-content: center;
}

.tutorial-lore-image,
.tutorial-lore-text,
#tutorialLoreNextButton {
  opacity: 0;
  transition: opacity 520ms ease;
}

.tutorial-lore-image.visible,
.tutorial-lore-text.visible,
#tutorialLoreNextButton.visible {
  opacity: 1;
}

.tutorial-lore-text {
  width: var(--tutorial-story-width);
  min-height: 4.2em;
  text-align: center;
  font-size: clamp(18px, 4vw, 24px);
  line-height: 1.46;
}

.tutorial-modes-card {
  display: grid;
  gap: calc(var(--scroll-gap, 16px) * 0.7);
  width: var(--tutorial-story-width);
  padding: calc(var(--scroll-gap, 16px) * 1.25);
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.04);
  box-sizing: border-box;
}

.tutorial-modes-card h2 {
  margin: 0 0 0.15em;
  font: 400 clamp(18px, 4.4vw, 26px)/1.25 var(--font-vcr);
  text-align: center;
}

.tutorial-modes-card p {
  margin: 0;
  font: 400 clamp(13px, 3.4vw, 17px)/1.5 var(--font-vcr);
}

.tutorial-close-button,
.tutorial-engine-close-button {
  position: absolute;
  top: max(var(--scroll-gap, 14px), env(safe-area-inset-top));
  right: max(var(--scroll-gap, 14px), env(safe-area-inset-right));
  z-index: 50;
  display: grid;
  place-items: center;
  width: calc(var(--touch-target-size, 48px) * 0.72);
  height: calc(var(--touch-target-size, 48px) * 0.72);
  padding: 0;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.72);
  background: rgba(0, 0, 0, 0.24);
  box-sizing: border-box;
  color: transparent;
  font-size: 0;
  touch-action: manipulation;
  overflow: hidden;
}

.tutorial-close-button::before,
.tutorial-close-button::after,
.tutorial-engine-close-button::before,
.tutorial-engine-close-button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62%;
  height: 12%;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.38);
}

.tutorial-close-button::before,
.tutorial-engine-close-button::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.tutorial-close-button::after,
.tutorial-engine-close-button::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.tutorial-close-button.hidden,
.tutorial-engine-close-button.hidden {
  display: none;
}

.tutorial-exit-dialog,
.tutorial-engine-exit-dialog {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: var(--scroll-gap, 16px);
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(8px);
}

.tutorial-exit-dialog.is-hidden,
.tutorial-engine-exit-dialog.is-hidden {
  display: none;
}

.tutorial-exit-card,
.tutorial-engine-exit-card {
  display: grid;
  gap: var(--scroll-gap, 16px);
  width: min(calc(100vw - var(--scroll-gap, 16px) * 3), 520px);
  padding: calc(var(--scroll-gap, 16px) * 1.5);
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.58);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04)),
    rgba(58, 92, 134, 0.82);
  box-sizing: border-box;
  text-align: center;
}

.tutorial-exit-card p,
.tutorial-engine-exit-card p {
  margin: 0;
  font: 400 clamp(16px, 4vw, 22px)/1.35 var(--font-vcr);
}

.tutorial-exit-actions,
.tutorial-engine-exit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--scroll-gap, 16px);
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-page {
  --tutorial-engine-text-inset: var(--scroll-gap, 16px);
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate,
body.tutorial-runtime-active.tutorial-mechanics-active .game-board-plate,
body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate {
  transition: opacity 900ms ease, filter 900ms ease;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate {
  position: relative;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate > :not(.tutorial-engine-text) {
  opacity: 0.08;
  pointer-events: none;
}

.tutorial-engine-text {
  position: absolute;
  inset: var(--tutorial-engine-text-inset, var(--scroll-gap, 16px));
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  padding: calc(var(--scroll-gap, 16px) * 0.75);
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.42);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035)),
    rgba(60, 112, 174, 0.72);
  color: #fff;
  font-size: clamp(11px, 2.9vw, 17px);
  line-height: 1.44;
  opacity: 0;
  box-sizing: border-box;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 360ms ease;
}

.tutorial-engine-text.visible {
  opacity: 1;
  pointer-events: auto;
}

.tutorial-engine-text {
  display: grid;
  align-items: center;
}

.tutorial-engine-text-reserve,
.tutorial-engine-text-visible {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  white-space: pre-wrap;
}

.tutorial-engine-text-reserve {
  visibility: hidden;
  pointer-events: none;
}

.tutorial-engine-text-visible {
  pointer-events: none;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate {
  position: relative;
  overflow: hidden;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate .skill-button {
  filter: blur(5px) grayscale(0.16);
  opacity: 0.32;
  pointer-events: auto;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate .skill-button.tutorial-engine-skill-focus {
  position: relative;
  z-index: 4;
  filter: none;
  opacity: 1;
  box-shadow: inset 0 0 0 var(--game-line-width, 1px) rgba(255, 255, 255, 0.68), 0 0 20px rgba(255, 219, 76, 0.32);
}

.tutorial-engine-skill-gate {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgba(22, 54, 94, 0.28);
  backdrop-filter: blur(7px);
  pointer-events: none;
}

.tutorial-engine-skill-gate.is-hidden {
  display: none;
}

.tutorial-engine-interface-card {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 45;
  display: grid;
  gap: calc(var(--scroll-gap, 16px) * 0.7);
  width: min(calc(100vw - var(--scroll-gap, 16px) * 4), 520px);
  max-height: calc(var(--app-stable-height) - var(--scroll-gap, 16px) * 6);
  padding: calc(var(--scroll-gap, 16px) * 1.2);
  transform: translate(-50%, -50%);
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.62);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04)),
    rgba(48, 80, 122, 0.86);
  backdrop-filter: blur(10px);
  box-sizing: border-box;
}

.tutorial-engine-interface-card.is-hidden {
  display: none;
}

.tutorial-engine-interface-card h2 {
  margin: 0;
  text-align: center;
  font: 400 clamp(18px, 4.2vw, 26px)/1.25 var(--font-vcr);
}

.tutorial-engine-interface-card p {
  margin: 0;
  font: 400 clamp(12px, 3vw, 16px)/1.45 var(--font-vcr);
}

.tutorial-interface-next {
  width: 100%;
  margin-top: calc(var(--scroll-gap, 16px) * 0.3);
}

body.tutorial-runtime-active.tutorial-engine-transitioning .game-board-plate,
body.tutorial-runtime-active.tutorial-engine-transitioning .game-skills-plate,
body.tutorial-runtime-active.tutorial-engine-transitioning .tutorial-engine-text {
  opacity: 0;
  pointer-events: none;
}

@keyframes tutorialCleanReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 520px) {
  .tutorial-page {
    --tutorial-story-width: min(calc(100vw - var(--scroll-gap, 16px) * 4), 430px);
  }

  .tutorial-lore-text {
    min-height: 4.8em;
  }

  .tutorial-engine-text {
    font-size: clamp(7px, 2.15vw, 10px);
    line-height: 1.22;
  }
}

/* Tutorial mechanics final layout guard. This must remain at the end of styles.css. */
body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate {
  min-height: 0 !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate > :not(.tutorial-engine-text):not(.tutorial-engine-close-button) {
  opacity: 0 !important;
  pointer-events: none !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active.tutorial-engine-hud-visible .game-top-plate > :not(.tutorial-engine-text):not(.tutorial-engine-close-button) {
  opacity: 1 !important;
  pointer-events: none !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .tutorial-engine-text {
  inset: 8px !important;
  max-height: calc(100% - 16px);
  padding: 7px 8px !important;
  border: 0 !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.98) !important;
  font: 400 clamp(8px, 1.75vw, 11px)/1.2 var(--font-vcr, monospace) !important;
  text-shadow:
    1px 0 0 #000,
    -1px 0 0 #000,
    0 1px 0 #000,
    0 -1px 0 #000 !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-board-plate,
body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate,
body.tutorial-runtime-active.tutorial-mechanics-active .tutorial-engine-text {
  transition: opacity 720ms ease !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .tutorial-engine-skill-gate {
  background: rgba(20, 40, 78, 0.76) !important;
  -webkit-backdrop-filter: blur(18px) saturate(90%) !important;
  backdrop-filter: blur(18px) saturate(90%) !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate .skill-button {
  filter: blur(3px) grayscale(0.1) !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate .skill-button.tutorial-engine-skill-focus {
  filter: none !important;
}

/* Tutorial mechanics v3: keep the mechanics screen on the exact game-mode layout. */
body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate {
  min-height: 0 !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate > :not(.tutorial-engine-text):not(.tutorial-engine-close-button) {
  opacity: 0 !important;
  pointer-events: none !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active.tutorial-engine-hud-visible .game-top-plate > :not(.tutorial-engine-text):not(.tutorial-engine-close-button) {
  opacity: 1 !important;
  pointer-events: none !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .tutorial-engine-text {
  inset: 8px !important;
  max-height: calc(100% - 16px);
  padding: 7px 8px !important;
  border: 0 !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.98) !important;
  font: 400 clamp(8px, 1.75vw, 11px)/1.2 var(--font-vcr, monospace) !important;
  text-shadow:
    1px 0 0 #000,
    -1px 0 0 #000,
    0 1px 0 #000,
    0 -1px 0 #000 !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-board-plate,
body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate,
body.tutorial-runtime-active.tutorial-mechanics-active .tutorial-engine-text {
  transition: opacity 720ms ease !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .tutorial-engine-skill-gate {
  background: rgba(20, 40, 78, 0.76) !important;
  -webkit-backdrop-filter: blur(18px) saturate(90%) !important;
  backdrop-filter: blur(18px) saturate(90%) !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate .skill-button {
  filter: blur(3px) grayscale(0.1) !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate .skill-button.tutorial-engine-skill-focus {
  filter: none !important;
}

/* Tutorial mechanics v2 flow overrides. Keep this at the end of the cascade. */
body.tutorial-runtime-active.tutorial-mechanics-active.tutorial-engine-hud-visible .game-top-plate > :not(.tutorial-engine-text):not(.tutorial-engine-close-button) {
  opacity: 1 !important;
  pointer-events: none !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active.tutorial-engine-hud-visible .tutorial-engine-text,
body.tutorial-runtime-active.tutorial-mechanics-active.tutorial-engine-hint-hidden .tutorial-engine-text {
  opacity: 0 !important;
  pointer-events: none !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate .skill-button .power-count {
  display: none !important;
}

.tutorial-image-slot::after {
  content: none !important;
}

/* Glass pixel menu buttons. CSS adaptation of the canvas button sketch. */
body[data-page="menu"] .menu-layout .page-button {
  --pixel-menu-button-body: rgba(255, 255, 255, 0.028);
  --pixel-menu-button-hover: rgba(255, 255, 255, 0.055);
  --pixel-menu-button-pressed: rgba(255, 255, 255, 0.018);
  --pixel-menu-button-shadow: rgba(6, 12, 28, 0.16);
  --pixel-menu-button-edge: rgba(255, 255, 255, 0.07);
  --pixel-menu-button-highlight: rgba(255, 255, 255, 0.13);
  position: relative;
  isolation: isolate;
  min-height: max(34px, calc(var(--current-clock-block-height, 42px) / 1.05));
  padding: 2px 14px 5px;
  overflow: visible;
  border: 2px solid rgba(255, 255, 255, 0.42);
  background-color: var(--pixel-menu-button-body);
  background-image:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.055) 0%,
      rgba(255, 255, 255, 0.012) 46%,
      rgba(255, 255, 255, 0.028) 100%
    ),
    linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(100% - 8px),
      var(--pixel-menu-button-edge) calc(100% - 8px),
      var(--pixel-menu-button-edge) calc(100% - 4px),
      transparent calc(100% - 4px)
    ),
    linear-gradient(
      to right,
      transparent 0,
      transparent 4px,
      rgba(255, 255, 255, 0.42) 4px,
      rgba(255, 255, 255, 0.42) calc(100% - 4px),
      transparent calc(100% - 4px)
    ),
    linear-gradient(
      to right,
      transparent 0,
      transparent 4px,
      var(--pixel-menu-button-highlight) 4px,
      var(--pixel-menu-button-highlight) calc(100% - 4px),
      transparent calc(100% - 4px)
    );
  background-size: 100% 100%, 100% 100%, 100% 1px, 100% 2px;
  background-position: 0 0, 0 0, 0 3px, 0 5px;
  background-repeat: no-repeat;
  box-shadow: 4px 4px 0 var(--pixel-menu-button-shadow);
  -webkit-backdrop-filter: blur(2px) saturate(1.04);
  backdrop-filter: blur(2px) saturate(1.04);
  color: #ffffff;
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", monospace !important;
  font-size: clamp(11px, 2.75vw, 14px);
  font-weight: 400 !important;
  letter-spacing: 0.045em;
  line-height: 1.05;
  text-transform: uppercase;
  text-shadow:
    1px 0 0 #000000,
    -1px 0 0 #000000,
    0 1px 0 #000000,
    0 -1px 0 #000000,
    1px 1px 0 #000000,
    -1px 1px 0 #000000,
    1px -1px 0 #000000,
    -1px -1px 0 #000000 !important;
  -webkit-text-stroke: 2px #000000;
  paint-order: stroke fill;
  transform: translate(0, 0);
  transition:
    background-color 120ms steps(2, end),
    box-shadow 120ms steps(2, end),
    transform 120ms steps(2, end),
    filter 160ms ease,
    opacity 220ms ease;
}

body[data-page="menu"] .menu-layout .page-button::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 7px;
  z-index: -1;
  width: 10px;
  height: 1px;
  background: var(--pixel-menu-button-highlight);
  pointer-events: none;
}

body[data-page="menu"] .menu-layout .page-button:hover {
  background-color: var(--pixel-menu-button-hover);
}

body[data-page="menu"] .menu-layout .page-button:active {
  background-color: var(--pixel-menu-button-pressed);
  background-image:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.035) 0%,
      rgba(255, 255, 255, 0.008) 100%
    ),
    linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(100% - 8px),
      var(--pixel-menu-button-edge) calc(100% - 8px),
      var(--pixel-menu-button-edge) calc(100% - 4px),
      transparent calc(100% - 4px)
    );
  box-shadow: 2px 2px 0 var(--pixel-menu-button-shadow);
  transform: translate(2px, 2px);
}

body[data-page="menu"] .menu-layout .page-button:active::before {
  opacity: 0;
}

body[data-page="menu"] .menu-layout .page-button:disabled {
  filter: grayscale(0.55);
  opacity: 0.55;
  box-shadow: 3px 3px 0 rgba(85, 7, 11, 0.7);
}

/* Tutorial rebuild final overrides. Keep this block last so the old prototype tutorial CSS cannot win the cascade. */
body.tutorial-active,
body[data-page="learn"] {
  background: #050505 !important;
}

body.tutorial-story-active .app,
body.tutorial-story-active #pageLearn,
body[data-page="learn"] #pageLearn.tutorial-page {
  background: #050505 !important;
  color: #f5f5f5;
}

.tutorial-page {
  --tutorial-gap: var(--scroll-gap, 16px);
  --tutorial-story-width: min(calc(100vw - var(--tutorial-gap) * 4), 520px);
  position: relative !important;
  width: 100% !important;
  min-height: var(--app-stable-height, 100vh) !important;
  padding: calc(var(--tutorial-gap) * 1.4) 0 calc(var(--tutorial-gap) * 2) !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  isolation: isolate;
}

.tutorial-spark-canvas {
  position: absolute !important;
  inset: 0 !important;
  z-index: 0 !important;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none !important;
}

.tutorial-view {
  position: relative !important;
  z-index: 1 !important;
  display: none !important;
  width: var(--tutorial-story-width) !important;
  min-height: calc(var(--app-stable-height, 100vh) - var(--tutorial-gap) * 4) !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
  opacity: 0 !important;
  transition: opacity 520ms ease !important;
}

.tutorial-view.active {
  display: grid !important;
  opacity: 1 !important;
}

.tutorial-view.is-fading {
  opacity: 0 !important;
  pointer-events: none !important;
}

.tutorial-intro-view,
.tutorial-lore-view,
.tutorial-modes-view {
  align-content: center !important;
  justify-items: center !important;
  gap: calc(var(--tutorial-gap) * 1.45) !important;
}

.tutorial-image-slot {
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.5) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  display: grid !important;
  place-items: center !important;
  box-sizing: border-box !important;
  opacity: 0.88 !important;
}

.tutorial-image-slot::before {
  content: attr(data-image-label);
  color: rgba(255, 255, 255, 0.48) !important;
  font: 400 clamp(18px, 4vw, 28px)/1.2 var(--font-vcr, monospace) !important;
  text-shadow: none !important;
}

.tutorial-lore-image,
.tutorial-lore-text,
.tutorial-lore-button {
  opacity: 0 !important;
  transition: opacity 520ms ease !important;
}

.tutorial-lore-image.visible,
.tutorial-lore-text.visible,
.tutorial-lore-button.visible {
  opacity: 1 !important;
}

.tutorial-pixel-text {
  width: 100% !important;
  margin: 0 !important;
  color: #f7f7f7 !important;
  text-align: center !important;
  font: 400 clamp(18px, 4.2vw, 28px)/1.48 var(--font-vcr, monospace) !important;
  letter-spacing: 0.02em !important;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.8) !important;
  box-sizing: border-box !important;
}

.tutorial-intro-text {
  display: grid !important;
  gap: 0.62em !important;
}

.tutorial-text-line {
  display: block !important;
  opacity: 0 !important;
}

.tutorial-text-line.visible {
  opacity: 1 !important;
  transition: opacity 520ms ease !important;
}

.tutorial-lore-text {
  min-height: 3.8em !important;
  display: grid !important;
  place-items: center !important;
}

.tutorial-actions,
.tutorial-intro-actions {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: calc(var(--tutorial-gap) * 1.1) !important;
  width: 100% !important;
}

.tutorial-action-button {
  min-height: clamp(62px, 10vh, 92px) !important;
  width: 100% !important;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.55) !important;
  background: rgba(255, 255, 255, 0.045) !important;
  color: #f5f5f5 !important;
  font: 400 clamp(13px, 3vw, 18px)/1.2 var(--font-vcr, monospace) !important;
  letter-spacing: 0.02em !important;
  text-transform: none !important;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.8) !important;
  display: grid !important;
  place-items: center !important;
  padding: calc(var(--tutorial-gap) * 0.7) !important;
  box-sizing: border-box !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  pointer-events: auto !important;
  opacity: 0 !important;
  transition: opacity 420ms ease, background 160ms ease, border-color 160ms ease !important;
}

.tutorial-action-button.visible,
.tutorial-lore-button.visible,
.tutorial-finish-button.visible,
.tutorial-interface-next.visible {
  opacity: 1 !important;
}

.tutorial-action-button:active {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.82) !important;
}

.tutorial-close-button,
.tutorial-engine-close-button {
  position: absolute !important;
  top: var(--tutorial-gap, 16px) !important;
  right: var(--tutorial-gap, 16px) !important;
  z-index: 80 !important;
  width: clamp(32px, 7vw, 44px) !important;
  height: clamp(32px, 7vw, 44px) !important;
  display: grid !important;
  place-items: center !important;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.7) !important;
  background: rgba(18, 28, 42, 0.35) !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  touch-action: manipulation !important;
  pointer-events: auto !important;
}

.tutorial-close-button.hidden,
.tutorial-engine-close-button.hidden {
  display: none !important;
}

.tutorial-close-button::before,
.tutorial-close-button::after,
.tutorial-engine-close-button::before,
.tutorial-engine-close-button::after {
  content: "" !important;
  position: absolute !important;
  left: 19% !important;
  top: calc(50% - 2px) !important;
  width: 62% !important;
  height: 4px !important;
  background: #fff !important;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.65) !important;
  transform-origin: center !important;
}

.tutorial-close-button::before,
.tutorial-engine-close-button::before {
  transform: rotate(45deg) !important;
}

.tutorial-close-button::after,
.tutorial-engine-close-button::after {
  transform: rotate(-45deg) !important;
}

.tutorial-modes-card {
  width: 100% !important;
  display: grid !important;
  gap: calc(var(--tutorial-gap) * 0.9) !important;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.48) !important;
  background: rgba(255, 255, 255, 0.045) !important;
  padding: calc(var(--tutorial-gap) * 1.2) !important;
  box-sizing: border-box !important;
}

.tutorial-modes-card p {
  margin: 0 !important;
  font: 400 clamp(14px, 3.3vw, 19px)/1.45 var(--font-vcr, monospace) !important;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.75) !important;
}

.tutorial-exit-dialog {
  position: fixed !important;
  inset: 0 !important;
  z-index: 160 !important;
  display: grid !important;
  place-items: center !important;
  padding: calc(var(--tutorial-gap, 16px) * 2) !important;
  background: rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(8px) !important;
  box-sizing: border-box !important;
}

.tutorial-exit-dialog.hidden,
.tutorial-engine-dialog.hidden {
  display: none !important;
}

.tutorial-exit-dialog-card {
  width: min(calc(100vw - var(--tutorial-gap, 16px) * 4), 520px) !important;
  display: grid !important;
  gap: calc(var(--tutorial-gap, 16px) * 1.2) !important;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.65) !important;
  background: rgba(58, 91, 137, 0.82) !important;
  padding: calc(var(--tutorial-gap, 16px) * 1.6) !important;
  box-sizing: border-box !important;
}

.tutorial-exit-dialog-card p {
  margin: 0 !important;
  color: #fff !important;
  text-align: center !important;
  font: 400 clamp(16px, 3.8vw, 23px)/1.25 var(--font-vcr, monospace) !important;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.8) !important;
}

.tutorial-exit-dialog-actions {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: calc(var(--tutorial-gap, 16px) * 1.1) !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .status-panel,
body.tutorial-runtime-active.tutorial-mechanics-active .game-meta,
body.tutorial-runtime-active.tutorial-mechanics-active .game-divider:not(.skill-divider) {
  display: none !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate {
  position: relative !important;
  min-height: clamp(150px, 28vh, 230px) !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate > :not(.tutorial-engine-text):not(.tutorial-engine-close-button) {
  opacity: 0.06 !important;
  pointer-events: none !important;
}

.tutorial-engine-text {
  position: absolute !important;
  inset: calc(var(--scroll-gap, 16px) * 0.75) calc(var(--scroll-gap, 16px) * 1.25) !important;
  z-index: 50 !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  overflow: hidden !important;
  padding: calc(var(--scroll-gap, 16px) * 0.85) !important;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.55) !important;
  background: rgba(108, 157, 216, 0.56) !important;
  color: #fff !important;
  text-align: left !important;
  font: 400 clamp(10px, 2.35vw, 15px)/1.42 var(--font-vcr, monospace) !important;
  letter-spacing: 0.01em !important;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.72) !important;
  box-sizing: border-box !important;
  transition: opacity 900ms ease !important;
  pointer-events: none !important;
  opacity: 1 !important;
}

.tutorial-engine-text.tutorial-text-fresh {
  animation: tutorialTextFade 520ms ease both;
}

@keyframes tutorialTextFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-board-plate,
body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate {
  transition: opacity 900ms ease !important;
}

body.tutorial-runtime-active.tutorial-engine-transitioning .game-board-plate,
body.tutorial-runtime-active.tutorial-engine-transitioning .game-skills-plate,
body.tutorial-runtime-active.tutorial-engine-transitioning .tutorial-engine-text {
  opacity: 0 !important;
  pointer-events: none !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate {
  position: relative !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .skill-button {
  filter: blur(7px) saturate(0.55) !important;
  opacity: 0.23 !important;
  pointer-events: none !important;
  transition: filter 220ms ease, opacity 220ms ease, border-color 220ms ease, background 220ms ease !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .skill-button.tutorial-skill-focus,
body.tutorial-runtime-active.tutorial-mechanics-active .skill-button.tutorial-engine-skill-focus {
  filter: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  border-color: rgba(255, 228, 68, 0.95) !important;
  background: rgba(255, 228, 68, 0.12) !important;
  z-index: 30 !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .skill-button.tutorial-skill-armed {
  box-shadow: 0 0 0 2px rgba(255, 228, 68, 0.55), 0 0 18px rgba(255, 228, 68, 0.3) !important;
}

.tutorial-engine-skill-gate {
  position: absolute !important;
  inset: 0 !important;
  z-index: 24 !important;
  background: rgba(14, 34, 64, 0.54) !important;
  backdrop-filter: blur(18px) !important;
  pointer-events: none !important;
}

.tutorial-engine-skill-gate.is-hidden {
  display: none !important;
}

.tutorial-engine-interface-card {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  z-index: 120 !important;
  width: min(calc(100vw - var(--scroll-gap, 16px) * 4), 520px) !important;
  max-height: calc(var(--app-stable-height, 100vh) - var(--scroll-gap, 16px) * 4) !important;
  overflow: auto !important;
  transform: translate(-50%, -50%) !important;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.62) !important;
  background: rgba(48, 80, 122, 0.86) !important;
  backdrop-filter: blur(10px) !important;
  padding: calc(var(--scroll-gap, 16px) * 1.2) !important;
  display: grid !important;
  gap: calc(var(--scroll-gap, 16px) * 0.85) !important;
  box-sizing: border-box !important;
}

.tutorial-engine-interface-card.is-hidden {
  display: none !important;
}

.tutorial-engine-interface-card h2,
.tutorial-engine-interface-card p {
  margin: 0 !important;
  color: #fff !important;
  font-family: var(--font-vcr, monospace) !important;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.76) !important;
}

.tutorial-engine-interface-card h2 {
  text-align: center !important;
  font-size: clamp(18px, 4.2vw, 26px) !important;
  line-height: 1.2 !important;
}

.tutorial-engine-interface-card p {
  font-size: clamp(12px, 3vw, 16px) !important;
  line-height: 1.45 !important;
}

@media (max-width: 520px) {
  .tutorial-page {
    --tutorial-story-width: min(calc(100vw - var(--tutorial-gap) * 3), 430px);
  }

  .tutorial-actions,
  .tutorial-intro-actions,
  .tutorial-exit-dialog-actions {
    grid-template-columns: 1fr !important;
  }

  .tutorial-action-button {
    min-height: 74px !important;
  }

  .tutorial-engine-text {
    font-size: clamp(10px, 2.55vw, 13px) !important;
    line-height: 1.38 !important;
  }
}

@font-face {
  font-family: "IBM 029 Key Punch";
  src: url("/fonts/IBM029KeyPunch-Regular.otf") format("opentype");
  font-weight: 400 900;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "VCR OSD Mono Nova";
  src: url("/fonts/VCROSDMonoNova.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "VCROSDMonoNova";
  src: url("/fonts/VCROSDMonoNova.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

:root {
  color-scheme: light;
  --bg: #528dad;
  --bg-accent: #1c2a5b;
  --panel: rgba(255, 251, 244, 0.94);
  --panel-border: rgba(97, 74, 45, 0.14);
  --text: #2f2417;
  --muted: #6f5b43;
  --accent: #bd5d38;
  --accent-strong: #8f3a1e;
  --level-color: #2563eb;
  --covered: #e7dcc7;
  --covered-border: #bca888;
  --open: #fbf7ef;
  --open-border: rgba(120, 95, 60, 0.14);
  --purchase-a: #f97316;
  --purchase-b: #b91c1c;
  --shadow: 0 18px 42px rgba(91, 61, 21, 0.14);
  --font: "Montserrat", sans-serif;
  --font-pixel: "Press Start 2P", monospace;
  --font-vcr: "VCR OSD Mono Nova", "VCROSDMonoNova", "IBM 029 Key Punch", "Montserrat", sans-serif;

  --scroll-gap: 16px;
  --board-inset: 0px;
  --current-clock-block-height: 42px;
  --clock-small-font-size: 16px;
  --clock-large-font-size: 36px;
  --clock-small-letter-spacing: -3px;
  --clock-large-letter-spacing: -4px;
  --clock-small-scale-x: 0.92;
  --clock-large-scale-x: 0.92;
  --clock-large-shift-left: -4px;
  --clock-small-shift-right: -4px;
  --clock-small-baseline-shift: 0px;
  --clock-timer-small-gap: 4px;
  --clock-inner-pad-x: 8px;
  --clock-inner-pad-y: 2px;
  --clock-gap: 12px;
  --clock-border: rgba(255, 255, 255, 0.95);
  --game-line-width: 1px;
  --clock-digit-active: rgba(255, 255, 255, 1);
  --clock-digit-inactive: rgba(255, 255, 255, 0.08);
  --clock-square-border: #ffd84d;
  --defeat-overlay-bottom: 0px;
  --app-stable-height: 100vh;
  --app-shell-max-width: 720px;
  --app-shell-adaptive-max-width: max(56.25vh, calc(100vw - 24px));
  --app-shell-width: min(100vw, var(--app-shell-max-width), var(--app-shell-adaptive-max-width));
  --app-shell-left: calc((100vw - var(--app-shell-width)) / 2);
  --game-entry-duration: 420ms;
  --game-plate-entry-duration: 2000ms;
  --crt-filter-strength: 0.53;
  --crt-rgb-filter: none;
  --crt-rgb-impact-filter: drop-shadow(3.15px 0 rgba(255, 18, 58, 0.62)) drop-shadow(-3.15px 0 rgba(0, 238, 255, 0.56));
}

html {
  color-scheme: light;
  height: 100%;
  overflow: hidden;
  background: #000000;
}

html::before {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: clamp(48px, 8vh, 88px);
  z-index: 2147483002;
  pointer-events: none;
  user-select: none;
  contain: strict;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(108, 205, 255, 0.018) 28%,
      rgba(255, 255, 255, 0.055) 48%,
      rgba(0, 238, 255, 0.024) 56%,
      rgba(255, 255, 255, 0) 100%
    );
  mix-blend-mode: screen;
  opacity: 0.72;
  transform: translate3d(0, -16vh, 0);
  animation: crtMovingScanline 8.5s linear infinite;
  will-change: transform;
}

html:has(body[data-crt-filter="off"])::before {
  display: none;
}

* {
  box-sizing: border-box;
  font-family: var(--font);
}

body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  overflow: hidden;
  background: #000000;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  user-select: none;
  contain: strict;
}

body::before {
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0) 60%, rgba(0, 0, 0, 0.18) 100%),
    linear-gradient(90deg, rgba(255, 48, 48, 0.02), rgba(68, 255, 180, 0.011) 33%, rgba(72, 120, 255, 0.02) 66%, rgba(255, 48, 48, 0.02)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.027) 0 1px, rgba(0, 0, 0, 0.035) 1px 6px);
  mix-blend-mode: overlay;
  opacity: var(--crt-filter-strength);
}

body::after {
  background:
    repeating-linear-gradient(90deg, rgba(255, 18, 58, 0.012) 0 1px, rgba(0, 238, 255, 0.01) 1px 2px, rgba(0, 0, 0, 0) 2px 4px),
    repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.0138) 0 25%, rgba(0, 0, 0, 0) 0 50%) 0 0 / 4px 4px,
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.039) 0 1px, rgba(0, 0, 0, 0) 1px 4px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0) 0 7px, rgba(255, 255, 255, 0.0068) 7px 8px);
  mix-blend-mode: soft-light;
  opacity: 0.155;
  transform: translate3d(0, 0, 0);
}

body[data-crt-filter="off"]::before,
body[data-crt-filter="off"]::after {
  display: none;
}

body:not([data-crt-filter="off"]).crt-rgb-impact-active .app,
body:not([data-crt-filter="off"]).crt-rgb-impact-active .menu-drone-canvas,
body:not([data-crt-filter="off"]).crt-rgb-impact-active .app-loading-screen {
  animation: crtRgbSplitImpact 520ms steps(1, end) both;
  will-change: filter;
}

@keyframes crtRgbSplitImpact {
  0% {
    filter: var(--crt-rgb-filter);
  }
  12% {
    filter: var(--crt-rgb-impact-filter);
  }
  24% {
    filter: drop-shadow(-2.55px 0 rgba(255, 18, 58, 0.52)) drop-shadow(2.55px 0 rgba(0, 238, 255, 0.47));
  }
  42% {
    filter: drop-shadow(1.6px 0 rgba(255, 18, 58, 0.36)) drop-shadow(-1.6px 0 rgba(0, 238, 255, 0.31));
  }
  100% {
    filter: var(--crt-rgb-filter);
  }
}

@keyframes crtMovingScanline {
  0% {
    transform: translate3d(0, -16vh, 0);
  }
  100% {
    transform: translate3d(0, 116vh, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html::before {
    animation: none;
    opacity: 0.28;
  }
  body:not([data-crt-filter="off"]) .app,
  body:not([data-crt-filter="off"]) .menu-drone-canvas,
  body:not([data-crt-filter="off"]) .app-loading-screen {
    animation: none;
  }
}

.app-background {
  position: fixed;
  top: 0;
  left: 50%;
  width: var(--app-shell-width, min(100vw, 720px));
  height: var(--app-stable-height, 100vh);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.app-background::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  pointer-events: none;
}

.app-background-base,
.app-background-menu-image,
.app-background-menu-fx,
.app-background-stats-image,
.app-background-challenge-page-image,
.app-background-create-page-image,
.app-background-purchase-page-image,
.app-background-trade-page-image,
.app-background-ordinary-run-image,
.app-background-chill-run-image,
.app-background-ordinary-run-dim,
.app-background-hardcore-page-image,
.app-background-hardcore-run-image,
.app-background-tone,
.app-background-bang-wave,
.app-background-magnet-wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.app-background-base,
.app-background-menu-image,
.app-background-menu-fx,
.app-background-stats-image,
.app-background-challenge-page-image,
.app-background-create-page-image,
.app-background-purchase-page-image,
.app-background-trade-page-image,
.app-background-ordinary-run-image,
.app-background-chill-run-image,
.app-background-ordinary-run-dim,
.app-background-hardcore-page-image,
.app-background-hardcore-run-image {
  transition: opacity 420ms ease;
}

.app-background-base {
  background: linear-gradient(180deg, #528dad 0%, #1c2a5b 100%);
}

.app-background-menu-image {
  background:
    linear-gradient(180deg, rgba(9, 8, 19, 0.18), rgba(9, 8, 19, 0.28)),
    url("/menu-image-20260522.png?v=menu-background-fx-20260522") center center / cover no-repeat;
  opacity: 0;
  pointer-events: none;
}

.app-background-menu-fx {
  display: block;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: screen;
  transition: opacity 420ms ease;
}

.app-background-stats-image {
  background:
    linear-gradient(180deg, rgba(12, 8, 8, 0.22), rgba(24, 9, 9, 0.34)),
    url("/stats-background.png") center center / cover no-repeat;
  opacity: 0;
  pointer-events: none;
}

.app-background-challenge-page-image {
  background:
    linear-gradient(180deg, rgba(20, 35, 52, 0.08), rgba(22, 13, 5, 0.22)),
    url("/assets/challenge/challenge-page-background.png?v=audit-fixes-20260522") center center / cover no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 720ms ease;
}

.app-background-create-page-image {
  background:
    linear-gradient(180deg, rgba(7, 10, 18, 0.08), rgba(6, 8, 12, 0.2)),
    url("/assets/create/create-page-background.png?v=loading-backgrounds-20260526") center center / cover no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 720ms ease;
}

.app-background-purchase-page-image {
  background:
    linear-gradient(180deg, rgba(6, 75, 120, 0.06), rgba(5, 35, 55, 0.16)),
    url("/assets/purchase/purchase-page-background.png?v=audit-fixes-20260522") center center / cover no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 720ms ease;
}

.app-background-trade-page-image {
  background:
    linear-gradient(180deg, rgba(22, 8, 14, 0.1), rgba(10, 5, 8, 0.24)),
    url("/assets/trade/trade-page-background.png?v=audit-fixes-20260522") center center / cover no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 720ms ease;
}

.app-background-ordinary-run-image {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(10, 40, 64, 0.12)),
    url("/assets/ordinary/ordinary-run-background.png") center center / cover no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 680ms ease;
}

.app-background-chill-run-image {
  background:
    linear-gradient(180deg, rgba(20, 24, 32, 0.08), rgba(18, 18, 24, 0.18)),
    url("/assets/chill/chill-run-background.png?v=loading-backgrounds-20260526") center center / cover no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 680ms ease;
}

.app-background-ordinary-run-dim {
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 680ms ease;
}

.app-background-hardcore-page-image {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)),
    url("/assets/hardcore/hardcore-page-background.png?v=loading-backgrounds-20260526") center center / cover no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 720ms ease;
}

.app-background-hardcore-run-image {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)),
    url("/assets/hardcore/hardcore-run-background.png?v=loading-backgrounds-20260526") center center / cover no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 620ms ease;
}

body[data-page="menu"] .app-background-menu-image {
  opacity: 1;
}

body[data-page="menu"] .app-background-menu-fx {
  opacity: 1;
}

body.menu-page-exiting .app-background-menu-image,
body.menu-page-exiting .app-background-menu-fx {
  opacity: 0;
}

body.menu-page-entering .app-background-menu-image,
body.menu-page-entering .app-background-menu-fx {
  opacity: 1;
}

body[data-page="menu"] .app-background-base,
body.menu-page-exiting .app-background-base,
body.menu-page-entering .app-background-base {
  opacity: 0;
}

body[data-page="stats"] .app-background-stats-image {
  opacity: 1;
}

body[data-background-target="stats"] .app-background-stats-image {
  opacity: 1;
}

body[data-page="challenge-day-stats"] .app-background-challenge-page-image,
body[data-page="challenge-result"] .app-background-challenge-page-image {
  opacity: 1;
}

body[data-page="create"] .app-background-challenge-page-image,
body[data-page="create-editor"] .app-background-challenge-page-image,
body[data-page="create-share"] .app-background-challenge-page-image,
body[data-page="my-maps"] .app-background-challenge-page-image,
body[data-page="foreign-maps"] .app-background-challenge-page-image {
  opacity: 0;
}

body[data-page="create"] .app-background-create-page-image,
body[data-page="create-editor"] .app-background-create-page-image,
body[data-page="create-share"] .app-background-create-page-image,
body[data-page="my-maps"] .app-background-create-page-image,
body[data-page="foreign-maps"] .app-background-create-page-image {
  opacity: 1;
}

body[data-background-target="challenge-page"] .app-background-challenge-page-image {
  opacity: 1;
}

body[data-background-target="create-page"] .app-background-create-page-image {
  opacity: 1;
}

body.ordinary-run-background-active .app-background-ordinary-run-image {
  opacity: 1;
}

body.chill-run-background-active .app-background-chill-run-image {
  opacity: 1;
}

body.ordinary-run-background-active .app-background-ordinary-run-dim {
  opacity: 1;
}

body[data-background-target="game-ordinary"] .app-background-ordinary-run-image,
body[data-background-target="game-ordinary"] .app-background-ordinary-run-dim {
  opacity: 1;
}

body[data-page="stories"][data-story-background-mode="ordinary"] .app-background-ordinary-run-image,
body[data-page="stories"][data-story-background-mode="ordinary"] .app-background-ordinary-run-dim {
  opacity: 1;
}

body[data-page="stories"][data-story-background-mode="chill"] .app-background-chill-run-image,
body[data-page="stories"][data-story-background-mode="chill"] .app-background-ordinary-run-dim {
  opacity: 1;
}

body[data-page="stories"][data-story-background-mode="hardcore"] .app-background-hardcore-run-image {
  opacity: 1;
}

body[data-page="story-ascii-game"] .app-background-base {
  background: #0000aa;
}

body[data-page="story-ascii-game"].story-ascii-dos-active .app-background-base,
body[data-page="story-ascii-game"].story-ascii-black-screen .app-background-base {
  background: #000000;
}

body[data-page="story-ascii-game"] .app-background-tone,
body[data-page="story-ascii-game"] .app-background-ordinary-run-image,
body[data-page="story-ascii-game"] .app-background-chill-run-image,
body[data-page="story-ascii-game"] .app-background-ordinary-run-dim,
body[data-page="story-ascii-game"] .app-background-hardcore-run-image {
  opacity: 0 !important;
}

body[data-background-target="game-chill"] .app-background-chill-run-image,
body[data-background-target="game-chill"] .app-background-ordinary-run-dim {
  opacity: 1;
}

body.game-fast-return-active .app-background-menu-image,
body.game-fast-return-active .app-background-menu-fx,
body.game-fast-return-active .app-background-stats-image,
body.game-fast-return-active .app-background-challenge-page-image,
body.game-fast-return-active .app-background-create-page-image,
body.game-fast-return-active .app-background-purchase-page-image,
body.game-fast-return-active .app-background-trade-page-image,
body.game-fast-return-active .app-background-ordinary-run-image,
body.game-fast-return-active .app-background-chill-run-image,
body.game-fast-return-active .app-background-ordinary-run-dim,
body.game-fast-return-active .app-background-hardcore-page-image,
body.game-fast-return-active .app-background-hardcore-run-image {
  transition-duration: 480ms;
}

body.game-fast-return-active .app-page:not(.game-page) > * {
  transition-duration: 480ms;
}

body.game-fast-return-active.game-fast-return-page-exiting.ordinary-run-background-active .app-background-ordinary-run-image,
body.game-fast-return-active.game-fast-return-page-exiting.ordinary-run-background-active .app-background-ordinary-run-dim,
body.game-fast-return-active.game-fast-return-page-exiting.chill-run-background-active .app-background-chill-run-image,
body.game-fast-return-active.game-fast-return-page-exiting.chill-run-background-active .app-background-ordinary-run-dim,
body.game-fast-return-active.game-fast-return-page-exiting.hardcore-run-background-active .app-background-hardcore-run-image {
  opacity: 1;
}

body.game-fast-return-active.game-fast-return-page-exiting.game-fast-return-from-stats .app-background-stats-image,
body.game-fast-return-active.game-fast-return-page-exiting.game-fast-return-from-trade .app-background-trade-page-image,
body.game-fast-return-active.game-fast-return-page-exiting.game-fast-return-from-purchase .app-background-purchase-page-image {
  opacity: 0;
}

body.ordinary-ui-theme {
  --game-entry-duration: 840ms;
  --game-plate-background: rgba(255, 255, 255, 0.34);
  --game-plate-border-color: rgba(255, 255, 255, 0.3);
}

body.hardcore-ui-theme {
  --game-entry-duration: 980ms;
  --game-plate-background: rgba(10, 10, 10, 0.28);
  --game-plate-border-color: rgba(248, 113, 113, 0.16);
}

body.hardcore-ui-theme .game-board-plate {
  background: rgba(6, 5, 6, 0.48);
}

body.hardcore-pre-game-entering {
  --game-entry-duration: 1960ms;
}

body.game-fast-return-active {
  --game-entry-duration: 480ms;
  --game-plate-entry-duration: 480ms;
}

body[data-page="hardcore"] .app-background-hardcore-page-image {
  opacity: 1;
}

body[data-background-target="hardcore"] .app-background-hardcore-page-image {
  opacity: 1;
}

body[data-page="trade"] .app-background-trade-page-image {
  opacity: 1;
}

body[data-background-target="trade"] .app-background-trade-page-image {
  opacity: 1;
}

body[data-page="purchase"] .app-background-base {
  opacity: 0;
}

body[data-page="purchase"] .app-background-purchase-page-image {
  opacity: 1;
}

body[data-background-target="purchase"] .app-background-purchase-page-image {
  opacity: 1;
}

body[data-page="purchase"] .app-background-tone {
  opacity: 0;
}

body.hardcore-page-exiting .app-background-hardcore-page-image {
  opacity: 1;
}

body.hardcore-run-background-active .app-background-hardcore-run-image {
  opacity: 1;
}

body[data-background-target="game-hardcore"] .app-background-hardcore-run-image {
  opacity: 1;
}

.app-background-tone {
  display: block;
  opacity: 1;
  background: transparent;
}

.app-background-bang-wave,
.app-background-magnet-wave {
  display: block;
  opacity: 1;
  background: transparent;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  z-index: 4;
}

.app-background-tone.visible {
  opacity: 1;
}

.app {
  position: relative;
  z-index: 2;
  width: var(--app-shell-width, min(100vw, 720px));
  max-width: var(--app-shell-width, min(100vw, 720px));
  height: var(--app-stable-height, 100vh);
  min-height: var(--app-stable-height, 100vh);
  margin: 0 auto;
  padding: 20px 16px 28px;
  overflow: hidden;
}

body[data-page="game"] .app {
  padding-left: 12px;
  padding-right: 12px;
}

.hero {
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  color: #f8fbff;
  font-family: var(--font);
  font-size: clamp(36px, 9vw, 56px);
  line-height: 0.95;
}

.subtitle {
  margin: 10px 0 0;
  max-width: 46ch;
  color: rgba(240, 247, 255, 0.82);
  font-size: 16px;
  line-height: 1.45;
}

.panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

input,
button,
textarea,
select {
  color-scheme: light;
}

button,
input,
textarea,
select {
  font-family: var(--font);
}

.game-panel {
  gap: 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.mode-panel {
  margin-bottom: var(--scroll-gap);
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.46));
  box-shadow: 0 14px 42px rgba(68, 49, 27, 0.06);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.mode-switch {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  padding: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.5);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.mode-switch::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 33.333%;
  border-radius: 0;
  background: #2f2417;
}

.mode-button {
  position: relative;
  z-index: 1;
  overflow: hidden;
  min-height: 42px;
  border: 0;
  border-radius: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
}

.mode-button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0;
  opacity: 0;
  pointer-events: none;
}

.mode-hardcore::after {
  background: rgba(220, 38, 38, 0.16);
  opacity: 1;
}

.mode-chill::after {
  background: rgba(30, 64, 175, 0.18);
  opacity: 1;
}

.mode-button.active {
  color: white;
  background: transparent;
}

.mode-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.mode-button:disabled::after {
  opacity: 1;
}

.difficulty-switch {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.58));
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.difficulty-button,
.new-game-button,
.power-button,
.cell {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.difficulty-button,
.new-game-button,
.power-button {
  min-height: 46px;
  border-radius: 16px;
  padding: 0 12px;
}

.difficulty-button {
  position: relative;
  background: rgba(239, 227, 203, 0.9);
  color: var(--muted);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  min-width: 0;
  padding-inline: 8px;
  text-align: center;
}

.difficulty-button.active {
  background: rgba(255, 255, 255, 0.96);
  color: #9a3412;
  box-shadow: inset 0 0 0 2px var(--purchase-a);
}

.difficulty-button-custom:disabled {
  background: #d1d5db;
  color: #6b7280;
  opacity: 1;
}

.new-game-button,
.power-button {
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.new-game-button {
  background: #2f2417;
  color: white;
}

.power-button {
  position: relative;
  grid-row: auto;
  background: linear-gradient(135deg, var(--purchase-a), var(--purchase-b));
  color: white;
  box-shadow: none;
  isolation: isolate;
}

.bonus-button {
  display: grid;
  align-content: center;
  justify-items: center;
  place-items: center;
  gap: 2px;
  min-height: 46px;
  border: 0;
  border-radius: 16px;
  opacity: 1;
  cursor: not-allowed;
}



.power-button.needs-purchase {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  line-height: 1.1;
  box-shadow: none;
}

.power-button.needs-purchase .power-count {
  margin-left: 0;
}

.power-button .power-count {
  display: inline-block;
  margin-left: 4px;
  min-width: 18px;
  color: white;
}

.power-label,
.power-count {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
}

.power-button.active {
  background: linear-gradient(135deg, #fdba74, #fb923c);
  box-shadow: inset 0 0 0 2px #f97316;
}

.power-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.game-meta {
  display: none;
  justify-content: space-between;
  gap: 0;
  padding: 10px clamp(6px, 2.4vw, 12px);
  border-radius: 16px;
  background: rgba(255, 245, 228, 0.7);
  color: var(--muted);
  font-size: clamp(10px, 2.8vw, 13px);
  font-weight: 500;
}

.game-meta span {
  flex: 1;
  text-align: center;
  white-space: nowrap;
}

.game-meta span + span {
  border-left: 1px solid rgba(111, 91, 67, 0.22);
}

.game-meta strong {
  color: var(--text);
  font-weight: 800;
}

.hidden {
  display: none !important;
}

.app-loading-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: block;
  overflow: hidden;
  background: #000;
  opacity: 1;
  pointer-events: auto;
  transition: opacity var(--app-loading-fade-ms, 620ms) ease;
}

.app-loading-screen.is-fading-out {
  opacity: 0;
  pointer-events: none;
}

.app-loading-screen.is-hidden {
  display: none;
}

body.tutorial-active .app-loading-screen {
  pointer-events: none !important;
}

.app-loading-drone-wrap {
  position: absolute;
  left: 50%;
  top: 25%;
  width: min(42vw, 280px);
  max-width: 52vh;
  aspect-ratio: 100 / 81;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 520ms ease;
  will-change: transform, opacity;
}

.app-loading-screen.drone-ready .app-loading-drone-wrap {
  opacity: 1;
  animation: app-loading-drone-drift 4.8s ease-in-out infinite alternate;
}

.app-loading-love-drone {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 10px 18px rgba(255, 91, 176, 0.2));
}

.app-loading-fuse-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

@keyframes app-loading-drone-drift {
  0% {
    transform: translate(calc(-50% - 11vw), calc(-50% - 2vh)) rotate(-2deg);
  }
  45% {
    transform: translate(calc(-50% + 4vw), calc(-50% + 1.8vh)) rotate(1.2deg);
  }
  100% {
    transform: translate(calc(-50% + 12vw), calc(-50% - 1.1vh)) rotate(-0.8deg);
  }
}

.status-panel {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.24));
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.status-text {
  margin: 0;
  width: 100%;
  padding-inline: 0;
  color: #3b6f9f;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
}

.status-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--purchase-a);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.board {
  position: absolute;
  display: block;
  margin-inline: var(--board-inset);
  overflow: visible;
  contain: layout;
  background: transparent;
  z-index: 3;
  pointer-events: auto;
  box-sizing: border-box;
}

.board-canvas-layer {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transform: rotate(var(--board-rotation, 0deg));
  transform-origin: center;
  transition: opacity 240ms ease;
}

.board-base-canvas {
  z-index: 1;
}

.board-content-canvas {
  z-index: 3;
}

.board-hardcore-bonus-canvas {
  z-index: 14;
}

.board-evil-mine-underlay-canvas {
  z-index: 5;
}

.board-electromagnet-canvas {
  z-index: 9;
}

.board-evil-drone-body-canvas {
  z-index: 10;
}

.board-evil-closer-canvas {
  z-index: 8;
}

.board-challenge-start-canvas {
  z-index: 6;
}

.board-victory-overlay-canvas {
  z-index: 13;
}

.board-pause-overlay-canvas {
  z-index: 20;
  opacity: 0;
  visibility: hidden;
}

.board-popup-canvas {
  position: absolute;
  display: block;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transform: rotate(var(--board-rotation, 0deg));
  transform-origin: center;
  transition: opacity 320ms ease;
}

.board-action-popup-canvas {
  z-index: 14;
  transform: none;
  transform-origin: center;
}

.board-flag-popup-canvas {
  z-index: 15;
  transform: none;
  transform-origin: center;
}

.board-armor-primary-canvas {
  z-index: 8;
  transform: none;
  transform-origin: center;
}

.board-armor-secondary-canvas {
  z-index: 9;
  transform: none;
  transform-origin: center;
}

.board-bang-primary-canvas {
  z-index: 10;
  transform: none;
  transform-origin: center;
}

.board-bang-secondary-canvas {
  z-index: 11;
  transform: none;
  transform-origin: center;
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 0;
  border-radius: var(--cell-radius, 10px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.8));
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: var(--cell-font-size, clamp(18px, 4.8vw, 24px));
  font-weight: 800;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -2px 0 rgba(82, 141, 173, 0.2);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  isolation: isolate;
  z-index: 1;
}

.cell-content {
  position: relative;
  z-index: 4;
  display: inline-grid;
  place-items: center;
  white-space: pre;
  line-height: 1;
  transform: rotate(0deg);
  transform-origin: center;
  transition: transform 160ms ease-out;
  will-change: transform;
}

.cell.gravity-rotating-number .cell-content {
  transform: rotate(var(--cell-digit-rotation, 0deg));
}

.cell::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.8));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -2px 0 rgba(82, 141, 173, 0.2);
  opacity: 0;
  pointer-events: none;
}

.cell::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.cell.icon-cell {
  font-size: var(--icon-font-size, calc(var(--cell-font-size, 20px) * 0.72));
}

.cell.open {
  background: rgba(251, 247, 239, 0.5);
  border: 1px solid var(--open-border);
  box-shadow: none;
}

.cell.open:not(.icon-cell) {
  border-radius: 50% !important;
}

.cell.open:not(.icon-cell):not(.empty-cell) {
  background: rgba(198, 224, 244, 0.3);
  border-color: transparent;
  box-shadow: none;
}

.cell.loss-main-mine {
  border-radius: 0 !important;
}

.cell.open.empty-cell {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  border-width: 1px;
  color: rgba(255, 255, 255, 0.96) !important;
  font-size: calc(var(--cell-font-size, 20px) * 0.36);
}

.cell.game-over {
  opacity: 0.96;
}

.cell.exploded {
}

.cell.loss-main-mine {
  background: #f97316;
  border-color: #ea580c;
}

.cell.rescued {
  background: var(--open);
  border-color: #f97316;
  box-shadow: none;
}

.cell.flagged-cell,
.cell.neutralized-mine,
.cell.open.icon-cell {
  background: #f7d9df;
  border-color: #8b6f47;
}

.cell.open.icon-cell.loss-main-mine {
  background: #f97316;
  border-color: #ea580c;
}


































.section-divider {
  height: 1px;
  margin: 18px 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
}

.profile-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.profile-item {
  min-height: 72px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 245, 228, 0.9);
  border: 1px solid rgba(97, 74, 45, 0.08);
}

.player-card {
  background: linear-gradient(135deg, rgba(189, 93, 56, 0.14), rgba(246, 187, 98, 0.22));
}

.profile-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.profile-item strong {
  font-size: 16px;
  line-height: 1.15;
  word-break: break-word;
}

.cell:active,
.difficulty-button:active,
.new-game-button:active,
.power-button:active,
.n1,
.n2,
.n3,
.n4,
.n5,
.n6,
.n7,
.n8 {
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: var(--number-font-size, calc(var(--cell-font-size, 20px) * 0.78));
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

* {
  border-radius: 0 !important;
}

































@media (max-width: 640px) {
  .app {
    padding: 14px 12px 22px;
  }

  .panel {
    padding: 14px;
    border-radius: 20px;
  }

  .difficulty-switch {
    gap: 0;
  }

  .new-game-button,
  .power-button,
  .bonus-button {
    min-height: 42px;
    padding: 0 8px;
    font-size: 13px;
  }

  .difficulty-button {
    min-height: 42px;
    padding: 0 8px;
    font-size: 13px;
  }

  .power-button {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 2px;
    line-height: 1.1;
  }

  .power-button .power-count {
    margin-left: 0;
    font-size: 12px;
  }

  .profile-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body[data-page="story-ascii-game"] .story-ascii-fire-button,
body[data-page="story-ascii-game"] .story-ascii-back-button {
  min-height: 58px !important;
  padding: 0 !important;
  color: #f4f7ff !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  font-family: "Courier New", Courier, monospace !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-shadow: none !important;
  -webkit-text-stroke: 0 !important;
  paint-order: normal !important;
}

body[data-page="story-ascii-game"] .story-ascii-fire-button:active,
body[data-page="story-ascii-game"] .story-ascii-back-button:active {
  color: #0000aa !important;
  background: #f4f7ff !important;
}

.story-ascii-button-art {
  display: block;
  white-space: pre;
  line-height: 0.92;
}

body[data-page="story-ascii-game"] .story-ascii-fire-button.story-ascii-fire-button-broken {
  pointer-events: none !important;
  color: rgba(244, 247, 255, 0) !important;
  animation: story-ascii-fire-crumble 680ms steps(5, end) forwards;
}

body[data-page="story-ascii-game"] .story-ascii-fire-button.story-ascii-fire-button-broken .story-ascii-button-art {
  color: rgba(244, 247, 255, 0.92);
  text-shadow:
    -18px 14px 0 rgba(244, 247, 255, 0.62),
    10px 20px 0 rgba(244, 247, 255, 0.46),
    24px -8px 0 rgba(244, 247, 255, 0.36);
}

@keyframes story-ascii-fire-crumble {
  0% {
    opacity: 1;
    transform: translateY(0);
    clip-path: inset(0);
  }
  55% {
    opacity: 0.72;
    transform: translateY(7px);
    clip-path: polygon(0 0, 43% 0, 37% 100%, 0 86%, 62% 0, 100% 14%, 100% 100%, 54% 82%);
  }
  100% {
    opacity: 0;
    transform: translateY(28px);
    clip-path: inset(48% 0 50% 0);
  }
}

.app-page {
  display: none;
}

.app-page.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body[data-page="game"] {
  overflow: hidden;
}

body[data-page="game"] .app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--app-shell-width, min(100vw, 720px));
  max-width: var(--app-shell-width, min(100vw, 720px));
  height: var(--app-stable-height, 100vh);
  min-height: var(--app-stable-height, 100vh);
  padding: 8px 12px;
  overflow: hidden;
}

.menu-page,
.app-page:not(.game-page) {
  min-height: 0;
  justify-content: center;
  gap: 14px;
}

.app-page:not(.game-page) > * {
  transition: opacity 520ms ease, transform 520ms ease;
}

body.game-fast-return-active .app {
  transition: opacity 480ms ease;
}

body.game-fast-return-active.game-fast-return-entering .app {
  opacity: 0;
}

.app-page:not(.game-page).entering > *,
.app-page:not(.game-page).leaving > * {
  opacity: 0;
  transform: none;
}

.menu-page {
  position: relative;
  isolation: isolate;
  justify-content: flex-start;
  padding-top: 16px;
}

.menu-drone-canvas {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 30;
  width: var(--app-shell-width, min(100vw, 720px));
  height: var(--app-stable-height, 100vh);
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 1;
  transition: opacity 180ms ease;
}

.menu-drone-canvas.is-exiting,
body.menu-page-exiting .menu-drone-canvas {
  opacity: 0;
}

.menu-drone-canvas.is-hidden {
  visibility: hidden;
}

.menu-page .page-head,
.menu-page .menu-layout,
.menu-page .app-version {
  position: relative;
  z-index: 2;
  transition: opacity 420ms ease;
}

.menu-page.entering .page-head,
.menu-page.entering .menu-layout,
.menu-page.entering .app-version,
.menu-page.leaving .page-head,
.menu-page.leaving .menu-layout,
.menu-page.leaving .app-version {
  opacity: 0;
}

.menu-page.leaving {
  pointer-events: none;
}

.page-head {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: white;
}

.page-head h1 {
  margin: 0;
  max-width: 100%;
  color: white;
  font-size: clamp(32px, 8vw, 52px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.page-head p {
  margin: 0;
  max-width: 100%;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.menu-profile-card,
.stats-card,
.page-button {
  border: 0;
  font: inherit;
  min-width: 0;
}

.menu-profile-card {
  --menu-button-width: min(100%, clamp(115px, 32vw, 169px));
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: var(--menu-button-width);
  min-height: var(--current-clock-block-height, 42px);
  padding: 6px 12px;
  color: white;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transition: opacity 420ms ease;
}

.menu-profile-card strong {
  font-size: 10px;
  font-weight: 800;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.menu-profile-card span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 8px;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.menu-profile-card b {
  color: white;
}

.menu-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  column-gap: 18px;
  row-gap: 0;
  flex: 1 1 auto;
  min-height: 0;
}

.menu-left-column,
.menu-right-column {
  display: grid;
  gap: 8px;
  align-content: start;
}

.menu-left-column {
  grid-column: 1;
  grid-row: 1;
  justify-items: start;
}

.menu-right-column {
  grid-column: 2;
  grid-row: 2;
  justify-items: end;
}

.page-button {
  min-height: var(--current-clock-block-height, 42px);
  width: var(--menu-button-width, min(100%, clamp(150px, 42vw, 220px)));
  padding: 0 12px;
  color: white;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal;
  transition: opacity 420ms ease;
}

body[data-page="menu"] .page-button {
  min-height: calc(var(--current-clock-block-height, 42px) / 1.3);
  width: var(--menu-button-width, min(100%, clamp(115px, 32vw, 169px)));
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1.1;
  text-transform: uppercase;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.2);
  paint-order: stroke fill;
}

body[data-page="menu"] .menu-profile-card {
  --menu-button-width: min(100%, clamp(115px, 32vw, 169px));
  width: var(--menu-button-width);
  min-height: calc(var(--current-clock-block-height, 42px) / 1.3);
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
}

body[data-page="menu"] .menu-profile-card strong,
body[data-page="menu"] .menu-profile-card span,
body[data-page="menu"] .menu-profile-card b {
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1.1;
  text-transform: uppercase;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.2);
  paint-order: stroke fill;
}

body[data-page="menu"] #menuPlayerName,
body[data-page="menu"] #menuPlayerLevel,
body[data-page="menu"] .menu-profile-card span {
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
}

body[data-page="menu"] .menu-profile-card strong {
  font-size: 14px;
}

body[data-page="menu"] .menu-profile-card span {
  font-size: 7px;
}

body[data-page="menu"] .menu-profile-card b {
  font-size: inherit;
}

body[data-page="menu"] .page-head {
  width: 100%;
  max-width: none;
}

body[data-page="menu"] .page-head h1 {
  font-size: clamp(28px, 8vmin, 40px);
}

body[data-page="menu"] .page-head p {
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-weight: 400;
  letter-spacing: 0.05em;
  -webkit-text-stroke: 0;
  paint-order: normal;
}

.page-button-dark {
  background: rgba(255, 255, 255, 0.04);
}

.page-button-danger {
  border-color: rgba(248, 113, 113, 0.48);
  background: rgba(127, 29, 29, 0.2);
}

.page-divider,
.game-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.stories-page {
  justify-content: center;
  gap: 14px;
}

.stories-list {
  display: grid;
  gap: 10px;
  width: min(100%, 420px);
  padding: 14px;
}

.stories-list-button,
.stories-back-button {
  width: 100%;
}

.story-ascii-game-page {
  justify-content: center;
  gap: 10px;
  padding: 10px;
  background: #0000aa;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body.story-ascii-black-screen .story-ascii-game-page {
  background: #000000;
}

body.story-ascii-dos-active .story-ascii-game-page {
  background: #000000;
}

.story-ascii-shell {
  --story-dos-board-size: min(100%, 620px);
  --story-dos-font-size: clamp(11px, 2.45vw, 18px);
  --story-dos-font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", "Courier New", Courier, monospace;
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  align-content: center;
  gap: 8px;
  width: min(100%, 560px);
  height: min(100%, calc(var(--app-stable-height, 100vh) - 20px));
  min-height: 0;
  isolation: isolate;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body.story-ascii-dos-active .story-ascii-shell {
  align-content: start;
  gap: 10px;
  width: min(100%, 640px);
}

.story-ascii-shell::before {
  content: "";
  position: absolute;
  inset: -12px;
  z-index: 20;
  pointer-events: none;
  background: transparent;
}

.story-ascii-canvas {
  position: relative;
  z-index: 2;
  display: block;
  align-self: center;
  justify-self: center;
  width: min(100%, 100vmin, calc(var(--app-stable-height, 100vh) - 178px), 560px);
  max-height: calc(var(--app-stable-height, 100vh) - 178px);
  aspect-ratio: 1 / 1;
  background: #0000aa;
  border: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  outline: none;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body.story-ascii-dos-active .story-ascii-canvas {
  display: none;
}

.story-ascii-dos-terminal {
  position: relative;
  z-index: 2;
  display: none;
  justify-self: center;
  width: min(100%, var(--story-dos-board-size));
  min-height: min(460px, calc(var(--app-stable-height, 100vh) - 250px));
  max-height: calc(var(--app-stable-height, 100vh) - 202px);
  margin: 0;
  padding: clamp(10px, 2.8vw, 22px);
  color: #f2f2f2;
  background: #000000;
  border: 0;
  overflow: hidden;
  font-family: var(--story-dos-font-family);
  font-size: var(--story-dos-font-size);
  font-weight: 400;
  font-style: normal;
  line-height: 1.35;
  letter-spacing: 0;
  font-synthesis: none;
  -webkit-font-smoothing: none;
  text-rendering: geometricPrecision;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.28);
}

body.story-ascii-dos-active .story-ascii-dos-terminal {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
}

.story-ascii-dos-terminal,
.story-ascii-dos-terminal *,
.story-ascii-dos-keyboard,
.story-ascii-dos-keyboard * {
  font-family: var(--story-dos-font-family) !important;
  font-synthesis: none !important;
  -webkit-font-smoothing: none !important;
  text-rendering: geometricPrecision !important;
}

.story-ascii-dos-screen {
  margin: 0;
  color: inherit;
  font: inherit;
  line-height: inherit;
  white-space: pre;
  overflow: auto;
}

.story-ascii-dos-screen .story-dos-board {
  display: inline-block;
  font-size: calc(var(--story-dos-font-size) * 1.5);
  line-height: 1.36;
  white-space: pre;
}

.story-ascii-dos-screen .story-dos-row-label {
  display: inline-block;
  width: 3ch;
  min-width: 3ch;
  text-align: left;
}

.story-ascii-dos-screen .story-dos-cell {
  display: inline-block;
  width: 2ch;
  min-width: 2ch;
  line-height: 1.12;
  text-align: center;
  vertical-align: baseline;
}

.story-ascii-dos-screen .story-dos-cell-head {
  color: #f2f2f2;
  background: transparent;
  text-shadow: inherit;
}

.story-ascii-dos-screen .story-dos-cell-hidden {
  color: #ffffff;
  background: #202020;
}

.story-ascii-dos-screen .story-dos-cell-empty {
  color: #3b3b3b;
  text-shadow: 0 0 4px rgba(80, 80, 80, 0.35);
}

.story-ascii-dos-screen .story-dos-cell-number {
  color: #4ccaff;
  background: #202020;
  text-shadow: 0 0 6px rgba(76, 202, 255, 0.62);
}

.story-ascii-dos-screen .story-dos-cell-danger {
  color: #ff4b4b;
  background: #202020;
  text-shadow: 0 0 6px rgba(255, 75, 75, 0.68);
}

.story-ascii-dos-screen .story-dos-cell-bang-explosion {
  animation: story-dos-bang-mine-explosion 520ms steps(3, end) infinite;
}

.story-dos-top-alert {
  color: #ff2a2a;
  text-shadow: 0 0 8px rgba(255, 42, 42, 0.72);
}

.story-dos-top-laugh {
  opacity: 1;
}

.story-dos-top-laugh-dim {
  opacity: 0.08;
}

@keyframes story-dos-danger-pulse {
  0%,
  100% {
    color: #ff4b4b;
    text-shadow: 0 0 6px rgba(255, 75, 75, 0.64);
  }
  50% {
    color: #fff06a;
    text-shadow: 0 0 12px rgba(255, 220, 58, 0.82);
  }
}

@keyframes story-dos-bang-mine-explosion {
  0% {
    color: #ff4b4b;
    background: #202020;
    text-shadow: 0 0 5px rgba(255, 75, 75, 0.7);
  }
  35% {
    color: #ffff33;
    background: #ff6a00;
    text-shadow: 0 0 10px rgba(255, 220, 32, 0.9);
  }
  70% {
    color: #ffffff;
    background: #ff2b00;
    text-shadow: 0 0 14px rgba(255, 120, 0, 0.9);
  }
  100% {
    color: #ff4b4b;
    background: #202020;
    text-shadow: 0 0 5px rgba(255, 75, 75, 0.7);
  }
}

.story-ascii-control-row {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

body.story-ascii-booting .story-ascii-control-row {
  opacity: 0;
  pointer-events: none;
}

body.story-ascii-black-screen .story-ascii-control-row,
body.story-ascii-dos-active .story-ascii-control-row,
body.story-ascii-win-active .story-ascii-control-row {
  display: none;
}

.story-ascii-intro-next-button {
  position: absolute;
  left: 50%;
  bottom: clamp(58px, 10.5vh, 112px);
  z-index: 6;
  display: none;
  width: min(78vw, 430px);
  min-height: clamp(46px, 8vh, 64px);
  padding: 10px 18px;
  transform: translateX(-50%);
  color: #050505;
  background: rgba(242, 242, 242, 0.94);
  border: 1px solid rgba(242, 242, 242, 0.84);
  border-radius: 0;
  font: 400 clamp(14px, 3.1vw, 20px) / 1.15 var(--story-dos-font-family);
  font-synthesis: none;
  -webkit-font-smoothing: none;
  text-rendering: geometricPrecision;
  text-shadow: none;
  box-shadow: inset 0 0 0 1px rgba(5, 5, 5, 0.22), 0 0 18px rgba(244, 247, 255, 0.18);
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.story-ascii-intro-next-button.visible {
  display: block;
}

.story-ascii-intro-next-button:disabled {
  opacity: 0;
  pointer-events: none;
}

.story-ascii-intro-next-button:active {
  color: #f2f2f2;
  background: #050505;
}

body:not(.story-ascii-black-screen) .story-ascii-intro-next-button {
  display: none;
}

.story-ascii-command-line {
  display: none;
  min-height: 34px;
  grid-template-columns: auto minmax(7ch, 1fr);
  align-items: center;
  column-gap: 1ch;
  border-top: 1px solid #f2f2f2;
  padding-top: 10px;
  font: inherit;
  color: inherit;
}

body.story-ascii-dos-active .story-ascii-command-line {
  display: grid;
}

.story-ascii-console-history {
  display: none;
}

.story-ascii-command-prompt {
  display: contents;
  color: #f2f2f2;
}

.story-ascii-command-prompt span {
  white-space: nowrap;
}

.story-ascii-command-input {
  min-width: 0;
  width: 100%;
  color: #f2f2f2;
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
  text-transform: uppercase;
  caret-color: #f2f2f2;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  text-shadow: inherit;
}

.story-ascii-dos-terminal .story-ascii-command-line,
.story-ascii-dos-terminal .story-ascii-command-prompt,
.story-ascii-dos-terminal .story-ascii-command-input {
  font-family: var(--story-dos-font-family) !important;
  font-size: var(--story-dos-font-size) !important;
  font-weight: 400 !important;
  font-style: normal !important;
  line-height: 1.35 !important;
  letter-spacing: 0 !important;
  font-synthesis: none !important;
  -webkit-font-smoothing: none !important;
  text-rendering: geometricPrecision !important;
}

.story-ascii-dos-keyboard {
  position: relative;
  z-index: 2;
  display: none;
  justify-self: center;
  width: min(100%, var(--story-dos-board-size));
  padding: 0;
  background: #050505;
  border: 0;
  font-family: var(--story-dos-font-family);
  font-weight: 400;
  font-style: normal;
  font-synthesis: none;
  -webkit-font-smoothing: none;
  text-rendering: geometricPrecision;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body.story-ascii-dos-active .story-ascii-dos-keyboard {
  display: grid;
  gap: 4px;
}

.story-ascii-dos-keyboard-row {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 4px;
}

.story-ascii-dos-keyboard-row-qwerty-top {
  grid-template-columns: repeat(10, minmax(0, 1fr));
}

.story-ascii-dos-keyboard-row-qwerty-home {
  grid-template-columns: repeat(9, minmax(0, 1fr));
}

.story-ascii-dos-keyboard-row-qwerty-bottom {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.story-ascii-dos-keyboard-row-digits {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.story-ascii-dos-keyboard-row-actions {
  grid-template-columns: 1fr 1.25fr 1fr 1.35fr 1.1fr;
}

.story-ascii-dos-keyboard button {
  min-width: 0;
  min-height: calc(var(--story-dos-font-size) * 1.76);
  padding: 0 2px;
  color: rgba(184, 184, 184, 0.96);
  background: #0d0d0d;
  border: 1px solid rgba(184, 184, 184, 0.5);
  border-radius: 0;
  font: 400 var(--story-dos-font-size) / 1.15 var(--story-dos-font-family);
  font-style: normal;
  font-synthesis: none;
  -webkit-font-smoothing: none;
  text-rendering: geometricPrecision;
  text-shadow: none;
  box-shadow: inset 0 0 0 1px rgba(184, 184, 184, 0.06);
  touch-action: manipulation;
}

.story-ascii-dos-keyboard button:active {
  color: #050505;
  background: #f4f7ff;
}

.story-ascii-dos-keyboard button.story-ascii-dos-key-action-flag {
  color: #ffb04a;
  border-color: rgba(255, 176, 74, 0.72);
  background: rgba(255, 128, 0, 0.13);
}

.story-ascii-dos-keyboard button.story-ascii-dos-key-action-chord {
  color: #72c9ff;
  border-color: rgba(114, 201, 255, 0.72);
  background: rgba(46, 144, 255, 0.13);
}

.story-ascii-dos-keyboard button.story-ascii-dos-key-action-del {
  color: #ff6b6b;
  border-color: rgba(255, 80, 80, 0.72);
  background: rgba(255, 32, 32, 0.13);
}

.story-ascii-dos-keyboard button.story-ascii-dos-key-action-enter {
  color: #050505;
  border-color: rgba(242, 242, 242, 0.84);
  background: rgba(242, 242, 242, 0.94);
}

.story-ascii-win-menu-button {
  position: relative;
  z-index: 2;
  display: none;
  width: 100%;
}

body.story-ascii-win-active .story-ascii-win-menu-button {
  display: block;
}

/* Johnny tutorial */
body[data-page="learn"],
body[data-page="learn"] .app {
  background: #050505;
}

.tutorial-page {
  position: relative;
  min-height: var(--app-stable-height);
  overflow: hidden;
  background: #050505;
  color: #fff;
  isolation: isolate;
  --tutorial-story-width: min(76vw, 430px);
}

.tutorial-page[data-tutorial-mode="play"] {
  background: linear-gradient(180deg, #78baf6 0%, #4d7fc9 54%, #274b91 100%);
}

.tutorial-page[data-tutorial-mode="intro"],
.tutorial-page[data-tutorial-mode="lore"],
.tutorial-page[data-tutorial-mode="interface"],
.tutorial-page[data-tutorial-mode="modes"] {
  background: #050505;
}

.tutorial-spark-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tutorial-view {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--scroll-gap);
  padding: clamp(20px, 5vw, 34px);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 520ms ease;
}

.tutorial-view.active {
  opacity: 1;
  pointer-events: auto;
}

.tutorial-pixel-text {
  font-family: var(--font-vcr);
  font-synthesis: none;
  letter-spacing: 0.03em;
  text-shadow:
    1px 0 rgba(0, 0, 0, 0.62),
    -1px 0 rgba(0, 0, 0, 0.62),
    0 1px rgba(0, 0, 0, 0.62),
    0 -1px rgba(0, 0, 0, 0.62);
}

.tutorial-close-button {
  position: absolute;
  top: max(var(--scroll-gap, 14px), env(safe-area-inset-top));
  right: max(var(--scroll-gap, 14px), env(safe-area-inset-right));
  z-index: 40;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: rgba(255, 255, 255, 0.96);
  background: rgba(0, 0, 0, 0.24);
  border: var(--game-line-width) solid rgba(255, 255, 255, 0.72);
  font: 400 0/1 var(--font-vcr);
  text-shadow: none;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.tutorial-close-button::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 4px;
  background: rgba(255, 255, 255, 0.96);
  transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.tutorial-close-button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 4px;
  background: rgba(255, 255, 255, 0.96);
  transform: translate(-50%, -50%) rotate(-45deg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.tutorial-close-button.hidden {
  display: none;
}

.tutorial-image-slot {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--tutorial-story-width);
  aspect-ratio: 1;
  border: var(--game-line-width) solid rgba(255, 255, 255, 0.46);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02)),
    rgba(0, 0, 0, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 22px 50px rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.54);
  font: 400 clamp(16px, 4vw, 24px)/1.3 var(--font-vcr);
}

.tutorial-image-slot::after {
  content: attr(data-image-label);
}

.tutorial-intro-image {
  width: min(var(--tutorial-story-width), 36vh);
  opacity: 0;
  animation: tutorialSlowReveal 1800ms ease forwards;
}

.tutorial-intro-text {
  display: grid;
  gap: 0.7em;
  width: var(--tutorial-story-width);
  text-align: center;
  font-size: clamp(15px, 3.9vw, 25px);
  line-height: 1.5;
}

.tutorial-text-line {
  opacity: 0;
  transition: opacity 520ms ease;
}

.tutorial-text-line.visible {
  opacity: 1;
}

.tutorial-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--scroll-gap);
  justify-self: center;
  justify-items: stretch;
  width: min(88vw, 560px);
}

.tutorial-intro-actions {
  grid-template-columns: 1fr;
  gap: clamp(16px, 2.8vh, 24px);
  width: var(--tutorial-story-width);
}

.tutorial-action-button,
.tutorial-wide-button {
  position: relative;
  z-index: 4;
  justify-self: stretch;
  width: 100%;
  min-height: 64px;
  opacity: 0;
  pointer-events: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 360ms ease;
}

.tutorial-action-button.visible,
.tutorial-wide-button.visible,
.tutorial-lore-next-button.visible {
  opacity: 1;
  pointer-events: auto;
}

.tutorial-intro-actions .tutorial-action-button {
  min-height: clamp(72px, 9vh, 88px);
}

.tutorial-lore-view {
  grid-template-rows: auto auto auto;
  background: rgba(0, 0, 0, 0.62);
}

.tutorial-lore-image,
.tutorial-lore-text,
#tutorialLoreNextButton {
  opacity: 0;
  transition: opacity 520ms ease;
}

.tutorial-lore-image.visible,
.tutorial-lore-text.visible,
#tutorialLoreNextButton.visible {
  opacity: 1;
}

.tutorial-lore-text {
  width: var(--tutorial-story-width);
  min-height: 4.5em;
  text-align: center;
  font-size: clamp(17px, 4vw, 24px);
  line-height: 1.44;
}

.tutorial-wide-button {
  justify-self: center;
  width: var(--tutorial-story-width);
}

.tutorial-interface-view,
.tutorial-modes-view {
  background: rgba(0,0,0,0.55);
}

.tutorial-interface-card,
.tutorial-modes-card {
  display: grid;
  gap: 0.9em;
  width: min(88vw, 590px);
  padding: clamp(18px, 5vw, 30px);
  font-size: clamp(14px, 3.4vw, 19px);
  line-height: 1.46;
}

.tutorial-interface-card h2,
.tutorial-modes-card h2 {
  margin: 0 0 0.4em;
  color: #ffd84d;
  font: 400 clamp(22px, 6vw, 36px)/1.25 var(--font-vcr);
  text-align: center;
}

.tutorial-interface-card p,
.tutorial-modes-card p {
  margin: 0;
}

.tutorial-exit-dialog {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: var(--scroll-gap);
  background: rgba(0, 0, 0, 0.58);
  opacity: 1;
  transition: opacity 220ms ease;
}

.tutorial-exit-dialog.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.tutorial-exit-card {
  display: grid;
  gap: var(--scroll-gap);
  width: min(86vw, 480px);
  padding: clamp(18px, 5vw, 28px);
  text-align: center;
  font-size: clamp(15px, 3.8vw, 20px);
}

.tutorial-exit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--scroll-gap);
}

.tutorial-page[data-tutorial-mode="intro"],
.tutorial-page[data-tutorial-mode="lore"],
.tutorial-page[data-tutorial-mode="modes"],
.tutorial-page[data-tutorial-mode="interface"] {
  background: #050505;
}

.tutorial-page[data-tutorial-mode="intro"] .tutorial-view,
.tutorial-page[data-tutorial-mode="lore"] .tutorial-view,
.tutorial-page[data-tutorial-mode="modes"] .tutorial-view,
.tutorial-page[data-tutorial-mode="interface"] .tutorial-view {
  background: transparent;
}

.tutorial-intro-view {
  grid-template-rows: min-content min-content min-content;
  align-content: center;
  gap: clamp(18px, 4vh, 34px);
}

.tutorial-pixel-text,
.tutorial-pixel-text *,
.tutorial-action-button,
.tutorial-wide-button {
  font-family: var(--font-vcr) !important;
  font-weight: 400 !important;
  font-synthesis: none;
}

.tutorial-action-button,
.tutorial-wide-button {
  min-height: clamp(44px, 8vh, 58px);
  font-size: clamp(10px, 2.7vw, 15px);
  line-height: 1.12;
}

.tutorial-actions {
  width: min(86vw, 520px);
}

body.tutorial-active {
  --game-plate-border-color: rgba(255, 255, 255, 0.3);
  --game-plate-background: rgba(255, 255, 255, 0.34);
}

.tutorial-page[data-tutorial-mode="intro"] .tutorial-view,
.tutorial-page[data-tutorial-mode="lore"] .tutorial-view,
.tutorial-page[data-tutorial-mode="modes"] .tutorial-view,
.tutorial-page[data-tutorial-mode="interface"] .tutorial-view {
  width: 100%;
  max-width: 100%;
  background: transparent;
}

.tutorial-intro-view,
.tutorial-lore-view,
.tutorial-modes-view {
  justify-content: center;
  justify-items: center;
}

.tutorial-intro-image,
.tutorial-lore-image {
  width: min(100%, var(--tutorial-story-width));
  max-width: calc(100% - var(--scroll-gap, 14px) * 2);
}

.tutorial-lore-text,
.tutorial-intro-text,
.tutorial-wide-button,
.tutorial-actions {
  max-width: calc(100% - var(--scroll-gap, 14px) * 2);
}

.tutorial-lore-view {
  background: transparent;
}

.tutorial-game-frame {
  width: min(100%, 620px);
  max-width: 100%;
  box-sizing: border-box;
}

@keyframes tutorialSlowReveal {
  from { opacity: 0; filter: blur(8px); }
  to { opacity: 1; filter: blur(0); }
}

/* Tutorial mechanics are rendered on the real game page. */
body.tutorial-runtime-active.tutorial-mechanics-active,
body.tutorial-runtime-active.tutorial-mechanics-active .app {
  --game-plate-background: rgba(255, 255, 255, 0.34);
  --game-plate-border-color: rgba(255, 255, 255, 0.3);
  background: transparent;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-page {
  background: transparent;
}

body.tutorial-runtime-active.tutorial-mechanics-active {
  --tutorial-engine-text-inset-x: calc(var(--scroll-gap, 16px) * 2);
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-panel {
  position: relative;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate,
body.tutorial-runtime-active.tutorial-mechanics-active .game-board-plate,
body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate {
  align-self: stretch !important;
  width: 100% !important;
  max-width: 100% !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate {
  position: relative;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate > :not(.tutorial-engine-text) {
  opacity: 0;
  pointer-events: none;
}

.tutorial-engine-text {
  position: absolute;
  inset:
    var(--scroll-gap, 16px)
    var(--tutorial-engine-text-inset-x, calc(var(--scroll-gap, 16px) * 2));
  z-index: 34;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  box-sizing: border-box;
  overflow: hidden;
  padding: clamp(8px, 2.3vw, 14px);
  color: rgba(255, 255, 255, 0.96);
  text-align: left;
  font-size: clamp(9px, 1.9vw, 12px);
  line-height: 1.24;
  background: transparent;
  border: 0;
  opacity: 0;
  transition: opacity 360ms ease;
}

.tutorial-engine-text.visible {
  opacity: 1;
}

.tutorial-engine-close-button {
  position: absolute;
  top: max(var(--scroll-gap), env(safe-area-inset-top));
  right: max(var(--scroll-gap), env(safe-area-inset-right));
  z-index: 80;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  box-sizing: border-box;
  border: var(--game-line-width) solid rgba(255, 255, 255, 0.74);
  background: rgba(0, 0, 0, 0.24);
  color: transparent;
  overflow: hidden;
}

.tutorial-engine-close-button::before,
.tutorial-engine-close-button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 2px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.42);
  transform-origin: center;
}

.tutorial-engine-close-button::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.tutorial-engine-close-button::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate {
  position: relative;
  overflow: hidden;
}

.tutorial-engine-skill-gate {
  position: absolute;
  inset: 0;
  z-index: 24;
  opacity: 1;
  pointer-events: none;
  background: rgba(22, 41, 82, 0.9);
  -webkit-backdrop-filter: blur(82px) saturate(90%);
  backdrop-filter: blur(82px) saturate(90%);
  transition: opacity 360ms ease;
}

.tutorial-engine-skill-gate.is-hidden {
  opacity: 0;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate .skill-button {
  position: relative;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate .skill-button.tutorial-engine-skill-focus {
  z-index: 30;
  opacity: 1;
  border-color: rgba(255, 220, 58, 0.95);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.24), 0 0 18px rgba(255, 207, 36, 0.3);
}

.tutorial-engine-exit-dialog {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: calc(var(--scroll-gap) * 1.25);
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.46);
  opacity: 1;
  transition: opacity 300ms ease;
}

.tutorial-engine-exit-dialog.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.tutorial-engine-exit-card {
  width: min(calc(100% - var(--scroll-gap) * 2), 560px);
  box-sizing: border-box;
  padding: clamp(18px, 4vw, 28px);
  border: var(--game-line-width) solid rgba(255, 255, 255, 0.72);
  background: rgba(66, 100, 149, 0.78);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: rgba(255, 255, 255, 0.96);
  text-align: center;
}

.tutorial-engine-exit-card p {
  margin: 0 0 var(--scroll-gap);
  font-size: clamp(12px, 2.8vw, 17px);
  line-height: 1.25;
}

.tutorial-engine-exit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--scroll-gap);
}

.tutorial-engine-exit-actions button {
  min-height: 48px;
  border: var(--game-line-width) solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.96);
  font: 400 clamp(12px, 3vw, 17px)/1.1 var(--font-vcr);
  text-transform: uppercase;
}

body.tutorial-runtime-active.tutorial-engine-transitioning .game-board-plate,
body.tutorial-runtime-active.tutorial-engine-transitioning .game-skills-plate,
body.tutorial-runtime-active.tutorial-engine-transitioning .tutorial-engine-text {
  opacity: 0;
  transition: opacity 1600ms ease;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-board-plate,
body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate,
body.tutorial-runtime-active.tutorial-mechanics-active .tutorial-engine-text {
  transition: opacity 1600ms ease;
}

@media (max-width: 430px) {
  .tutorial-view {
    padding-inline: 14px;
  }
  .tutorial-actions,
  .tutorial-exit-actions {
    grid-template-columns: 1fr;
  }
  .tutorial-intro-actions {
    width: min(82vw, 430px);
  }
  .tutorial-action-button {
    width: 100%;
    min-height: 76px;
  }
}

.story-ascii-fire-button,
.story-ascii-back-button {
  width: 100%;
  min-height: 44px;
  touch-action: none;
}

.story-ascii-fire-button {
  background: #0000aa;
}

.story-ascii-back-button {
  background: #00007d;
}

.story-ascii-fire-button:active,
.story-ascii-back-button:active {
  background: #f4f7ff;
  color: #0000aa;
}

.app-version {
  margin: auto 0 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  text-align: center;
}

.game-plate.hardcore-page-plate {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

#pageHardcore .page-head,
#pageHardcore .hardcore-page-plate {
  transition: opacity 520ms ease;
}

#pageHardcore.entering .page-head,
#pageHardcore.entering .hardcore-page-plate,
#pageHardcore.leaving .page-head,
#pageHardcore.leaving .hardcore-page-plate {
  opacity: 0;
}

.hardcore-page-meta {
  color: rgba(254, 226, 226, 0.94);
  font-size: 13px;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.62);
}

.hardcore-page-copy {
  margin: 0;
  color: rgba(255, 240, 240, 0.84);
  font-size: 13px;
  line-height: 1.45;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.62);
}

.hardcore-page-rules {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: rgba(255, 235, 235, 0.82);
  font-size: 13px;
  line-height: 1.35;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.62);
}

.hardcore-start-button {
  width: 100%;
}

.hardcore-page-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.hardcore-page-action-button {
  width: 100%;
}

#pageHardcore {
  position: relative;
  overflow: hidden;
}

.hardcore-page-spark-wall {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

#pageHardcore .page-head,
#pageHardcore .page-divider,
#pageHardcore #hardcoreBackButton {
  position: relative;
  z-index: 1;
}

.trade-page {
  position: relative;
  overflow: hidden;
  gap: 14px;
}

.trade-page.active {
  justify-content: center;
  padding: 22px 18px 32px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

@supports (justify-content: safe center) {
  .trade-page.active {
    justify-content: safe center;
  }
}

.trade-page-head {
  position: relative;
  z-index: 1;
  width: 100%;
}

.trade-page-head h1,
.trade-page-head p {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.62);
}

.trade-page-actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.trade-page-action-button {
  width: 100%;
}

#tradeEarnButton {
  border-color: rgba(252, 165, 165, 0.74);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.32), rgba(127, 29, 29, 0.2));
  color: white;
}

#tradeBuyButton.trade-buy-button {
  border-color: rgba(134, 239, 172, 0.72);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.32), rgba(21, 128, 61, 0.2));
  color: white;
}

.trade-page-plate {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(15, 10, 12, 0.34);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: none;
}

.trade-balance-row,
.trade-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 244, 238, 0.88);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}

.trade-balance-row {
  font-size: 15px;
  font-weight: 900;
}

.trade-balance-row strong {
  color: #fff5c2;
  font-size: 22px;
}

.trade-total-row {
  font-size: 12px;
  font-weight: 800;
}

.trade-total-row strong {
  color: white;
  font-size: 14px;
}

.trade-total-row-main {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.trade-total-row.cost-limit-flash {
  animation: tradeCostLimitFlash 2000ms ease-out;
}

.trade-status-text {
  min-height: 1.25em;
  margin: -2px 0 0;
  color: rgba(255, 220, 170, 0.92);
  font-family: var(--menu-button-font);
  font-size: 10px;
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.58);
}

.trade-status-text:empty {
  display: none;
}

@keyframes tradeCostLimitFlash {
  0%,
  42%,
  58% {
    border-color: rgba(255, 92, 92, 0.78);
    color: #ffd2d2;
    background: rgba(255, 42, 42, 0.18);
  }

  100% {
    border-color: rgba(255, 255, 255, 0.18);
    color: rgba(255, 244, 238, 0.88);
    background: rgba(255, 255, 255, 0.08);
  }
}

.trade-slider-list {
  display: grid;
  gap: 8px;
}

.trade-slider-row {
  display: grid;
  grid-template-columns: 30px minmax(86px, 0.82fr) minmax(96px, 1fr) 34px;
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.trade-item-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  font-size: 19px;
}

.trade-item-icon-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 34px;
}

.trade-owned-count {
  position: absolute;
  left: -4px;
  bottom: -3px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 14px;
  padding: 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.44);
  background: rgba(10, 6, 8, 0.58);
  color: white;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.trade-owned-count.trade-owned-count-burst {
  animation: tradeOwnedCountBurst 720ms cubic-bezier(0.18, 0.9, 0.24, 1);
}

@keyframes tradeOwnedCountBurst {
  0% {
    transform: scale(1);
    border-color: rgba(255, 255, 255, 0.44);
    background: rgba(10, 6, 8, 0.58);
    box-shadow: 0 0 0 rgba(251, 191, 36, 0);
  }

  28% {
    transform: scale(1.56) rotate(-7deg);
    border-color: rgba(255, 247, 170, 0.95);
    background: rgba(239, 68, 68, 0.86);
    box-shadow:
      0 0 0 5px rgba(251, 191, 36, 0.2),
      0 0 18px rgba(248, 113, 113, 0.66);
  }

  58% {
    transform: scale(0.92) rotate(4deg);
    box-shadow:
      0 0 0 9px rgba(251, 191, 36, 0),
      0 0 14px rgba(248, 113, 113, 0.28);
  }

  100% {
    transform: scale(1);
    border-color: rgba(255, 255, 255, 0.44);
    background: rgba(10, 6, 8, 0.58);
    box-shadow: 0 0 0 rgba(251, 191, 36, 0);
  }
}

@keyframes level-notification-dot-pop {
  0% {
    transform: scale(1);
    box-shadow: none;
  }

  34% {
    transform: scale(1.55);
    box-shadow:
      0 0 0 4px rgba(255, 245, 158, 0.2),
      0 0 14px rgba(248, 113, 113, 0.46);
  }

  100% {
    transform: scale(1);
    box-shadow: none;
  }
}

@keyframes level-notification-ring-burst {
  0% {
    opacity: 0.92;
    transform: scale(0.38);
  }

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

@keyframes level-notification-spark-burst {
  0% {
    opacity: 0;
    transform: scale(0.25) rotate(0deg);
  }

  24% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: scale(1.55) rotate(38deg);
  }
}

@keyframes stats-close-ring-burst {
  0% {
    opacity: 0.92;
    transform: scale(0.4);
  }

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

@keyframes stats-close-spark-burst {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(0deg);
  }

  22% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: scale(1.52) rotate(-34deg);
  }
}

@keyframes stats-level-card-burst {
  0% {
    transform: scale(1);
    box-shadow: none;
  }

  32% {
    transform: scale(1.018);
    box-shadow:
      0 0 0 6px rgba(74, 222, 128, 0.13),
      0 0 20px rgba(74, 222, 128, 0.24);
  }

  100% {
    transform: scale(1);
    box-shadow: none;
  }
}

@keyframes stats-level-close-pop {
  0% {
    opacity: 0;
    transform: scale(0.45) rotate(-14deg);
  }

  62% {
    opacity: 1;
    transform: scale(1.16) rotate(6deg);
  }

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

.trade-item-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}

.trade-item-copy strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-item-copy small {
  color: rgba(255, 235, 225, 0.76);
  font-size: 10px;
  font-weight: 400;
}

.trade-slider {
  width: 100%;
  accent-color: #fbbf24;
}

.trade-slider-value {
  color: white;
  font-size: 16px;
  font-weight: 900;
  text-align: right;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}

.trade-page-actions-bottom {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 2px;
}

@media (max-width: 380px) {
  .trade-page.active {
    padding: 18px 14px 28px;
  }

  .trade-slider-row {
    grid-template-columns: 26px minmax(74px, 0.76fr) minmax(82px, 1fr) 28px;
    gap: 6px;
    padding: 7px;
  }

  .trade-item-icon-wrap {
    width: 26px;
  }

  .trade-item-icon {
    width: 26px;
  }

  .trade-item-copy strong {
    font-size: 11px;
  }

  .trade-item-copy small {
    font-size: 9px;
  }
}

.purchase-page {
  position: relative;
  overflow: hidden;
  gap: 14px;
}

.purchase-page.active {
  justify-content: center;
  padding: 22px 18px 32px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

@supports (justify-content: safe center) {
  .purchase-page.active {
    justify-content: safe center;
  }
}

.purchase-page-head,
.purchase-status-text,
.purchase-page-actions,
.purchase-offer-block {
  position: relative;
  z-index: 1;
  width: 100%;
}

.purchase-page-head h1,
.purchase-page-head p {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.62);
}

.purchase-page-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.purchase-page-action-button {
  width: 100%;
}

.purchase-status-text {
  padding: 9px 10px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}

.purchase-status-text:empty {
  display: none;
}

.purchase-offer-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(12, 18, 30, 0.54);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.12);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}

.purchase-page.active .purchase-offer-block {
  opacity: 0;
  transform: translateY(14px) scale(0.99);
  animation: purchase-offer-block-load 1000ms cubic-bezier(0.2, 0.72, 0.22, 1) both;
  will-change: opacity, transform;
}

.purchase-page.active .purchase-offer-block:nth-of-type(1) {
  animation-delay: 80ms;
}

.purchase-page.active .purchase-offer-block:nth-of-type(2) {
  animation-delay: 1080ms;
}

.purchase-page.active .purchase-offer-block:nth-of-type(3) {
  animation-delay: 2080ms;
}

.purchase-page.active .purchase-offer-block:nth-of-type(4) {
  animation-delay: 3080ms;
}

@keyframes purchase-offer-block-load {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.purchase-offer-copy {
  display: grid;
  gap: 4px;
}

.purchase-offer-copy h2 {
  display: inline-flex;
  align-items: center;
  gap: 0.28em;
  margin: 0;
  color: #fff5c2;
  font-size: 16px;
  line-height: 1.15;
}

.purchase-offer-copy p {
  margin: 0;
  color: rgba(240, 248, 255, 0.82);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.purchase-offer-grid,
.purchase-offer-list {
  display: grid;
  gap: 8px;
}

.purchase-offer-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.purchase-offer-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.purchase-offer-button {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 58px;
  width: 100%;
  padding: 10px;
  color: white;
  font: inherit;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)),
    linear-gradient(135deg, rgba(96, 165, 250, 0.24), rgba(34, 197, 94, 0.14));
  -webkit-backdrop-filter: blur(12px) saturate(128%);
  backdrop-filter: blur(12px) saturate(128%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 8px 22px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
  overflow: hidden;
  overflow-wrap: anywhere;
}

.purchase-offer-button-wide {
  grid-column: 1 / -1;
}

.purchase-offer-button-row {
  min-height: 64px;
}

.purchase-offer-button span {
  color: rgba(240, 248, 255, 0.78);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
}

.purchase-offer-button strong {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.28em;
  max-width: 100%;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.purchase-offer-button b,
.purchase-price b {
  font: inherit;
  font-weight: 900;
}

.purchase-price {
  display: inline-flex;
  align-items: center;
  gap: 0.28em;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.purchase-star-icon,
.purchase-bomb-icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 1.2em;
  height: 1.2em;
  vertical-align: -0.16em;
  -webkit-text-stroke: 0 !important;
  text-shadow: none !important;
}

.purchase-star-icon::before {
  content: "★";
  display: block;
  color: #facc15;
  font-size: 1.18em;
  line-height: 1;
  text-shadow:
    0 0 0 1px rgba(120, 53, 15, 0.8),
    0 1px 4px rgba(0, 0, 0, 0.44);
}

.purchase-bomb-icon {
  background: url("/assets/ui/trade-bomb.png?v=audit-fixes-20260522") center / contain no-repeat;
}

.purchase-offer-button:active {
  transform: translateY(1px);
}

.purchase-offer-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

@media (max-width: 380px) {
  .purchase-page.active {
    padding: 18px 14px 28px;
  }

  .purchase-offer-grid-three {
    grid-template-columns: minmax(0, 1fr);
  }

  .purchase-offer-button {
    min-height: 54px;
    padding: 9px;
  }
}

.hardcore-finish-page {
  padding: 0;
  overflow: hidden;
}

.hardcore-finish-page.entering .hardcore-finish-content {
  opacity: 0;
}

.hardcore-finish-stage {
  position: relative;
  width: 100%;
  min-height: 100%;
  padding: 28px 18px 32px;
  overflow: hidden;
}

.hardcore-finish-backdrop {
  position: absolute;
  top: 28px;
  bottom: 32px;
  left: 50%;
  width: min(calc(100% - 36px), 420px);
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(10, 5, 5, 0.48), rgba(10, 5, 5, 0.62));
  border: 1px solid rgba(248, 113, 113, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 220, 0.08),
    0 14px 32px rgba(0, 0, 0, 0.26);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  pointer-events: none;
  z-index: 1;
}

.hardcore-finish-spark-wall,
.hardcore-finish-fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hardcore-finish-spark-wall {
  z-index: 2;
}

.hardcore-finish-fx-canvas {
  z-index: 3;
}

.hardcore-finish-content {
  position: relative;
  z-index: 4;
  display: grid;
  align-content: start;
  justify-items: stretch;
  gap: 14px;
  max-width: 420px;
  margin: 0 auto;
  padding: 18px 18px 24px;
  min-height: calc(var(--app-stable-height, 100vh) - 56px);
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  transition: opacity 360ms ease;
}

.hardcore-finish-title,
.hardcore-finish-divider,
.hardcore-finish-line,
.hardcore-finish-menu-button {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.hardcore-finish-title.is-visible,
.hardcore-finish-divider.is-visible,
.hardcore-finish-line.is-visible,
.hardcore-finish-menu-button.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.hardcore-finish-title {
  margin: 0;
  color: rgba(255, 241, 222, 0.98);
  font-size: clamp(30px, 7vw, 44px);
  line-height: 1;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.42);
}

.hardcore-finish-divider {
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 180, 143, 0.86), transparent);
}

.hardcore-finish-section-heading {
  color: rgba(255, 234, 213, 0.92);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: center;
}

.hardcore-finish-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 236, 226, 0.86);
  font-size: 18px;
  line-height: 1.2;
}

.hardcore-finish-stat-row strong {
  color: rgba(255, 247, 239, 0.98);
  font-size: 22px;
  font-weight: 900;
}

.hardcore-finish-stat-row strong,
.hardcore-finish-points-value,
.hardcore-finish-multiplier-popup,
.hardcore-summary-row strong,
.challenge-result-stat-row strong,
.challenge-result-place-row strong,
.challenge-result-points-row strong,
.challenge-result-rewards strong {
  font-family: var(--font-vcr) !important;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  -webkit-text-stroke: 2px rgba(255, 255, 255, 0.4);
  paint-order: stroke fill;
  text-shadow: none;
}

.hardcore-finish-points-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  text-align: center;
}

.hardcore-finish-points-label {
  color: rgba(255, 236, 226, 0.9);
  font-size: 20px;
  font-weight: 800;
}

.hardcore-finish-points-value {
  color: rgba(255, 153, 51, 0.98);
  font-size: clamp(38px, 10vw, 58px);
  line-height: 0.9;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.hardcore-finish-points-value.is-multiplied {
  color: rgba(255, 191, 71, 0.98);
}

.hardcore-finish-points-value-shell {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
}

.hardcore-finish-multiplier-popup {
  position: absolute;
  right: -0.34em;
  top: -0.58em;
  opacity: 0;
  transform: translateY(8px) scale(0.82);
  transform-origin: 100% 100%;
  pointer-events: none;
  color: rgba(255, 66, 66, 0.98);
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", "IBM 029 Key Punch", "Montserrat", sans-serif;
  font-size: clamp(19px, 5vw, 29px);
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-shadow:
    -1px -1px 0 rgba(255, 255, 255, 0.96),
    1px -1px 0 rgba(255, 255, 255, 0.96),
    -1px 1px 0 rgba(255, 255, 255, 0.96),
    1px 1px 0 rgba(255, 255, 255, 0.96),
    0 0 12px rgba(255, 84, 84, 0.46);
  transition: opacity 260ms ease, transform 260ms ease;
}

.hardcore-finish-multiplier-popup.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.hardcore-finish-menu-button {
  width: 100%;
  margin-top: auto;
}

.hardcore-finish-reward-row {
  margin-top: 4px;
  justify-content: center;
  gap: 10px;
  text-align: center;
}

.hardcore-finish-buttons-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: auto;
}

.hardcore-finish-buttons-row .hardcore-finish-menu-button {
  margin-top: 0;
}

.stats-page {
  position: relative;
  overflow: hidden;
  gap: 14px;
}

.stats-page.active {
  justify-content: center;
  padding: 22px 18px 32px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

@supports (justify-content: safe center) {
  .stats-page.active {
    justify-content: safe center;
  }
}

.stats-page-head,
.stats-level-notifications,
.stats-page-actions,
.stats-page-plate {
  position: relative;
  z-index: 1;
  width: 100%;
}

.stats-page-head h1,
.stats-page-head p {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.62);
}

.stats-page-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.stats-page-action-button {
  width: 100%;
}

.stats-level-notifications {
  display: grid;
  gap: 10px;
}

.stats-level-notifications.hidden {
  display: none;
}

.stats-level-notification-card {
  position: relative;
  display: grid;
  gap: 8px;
  max-height: var(--closing-height, 520px);
  padding: 14px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(15, 10, 12, 0.38);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
  transform-origin: 50% 50%;
  overflow: visible;
  transition:
    opacity 320ms ease,
    transform 320ms ease,
    max-height 360ms cubic-bezier(0.2, 0.8, 0.24, 1),
    margin 360ms cubic-bezier(0.2, 0.8, 0.24, 1),
    padding 360ms cubic-bezier(0.2, 0.8, 0.24, 1);
}

.stats-level-notification-card h2 {
  margin: 0;
  padding-right: 30px;
  color: #fff5c2;
  font-size: 18px;
  line-height: 1.1;
}

.stats-level-notification-card p {
  margin: 0;
  color: rgba(255, 244, 238, 0.86);
  font-size: 12px;
  font-weight: 700;
}

.stats-level-notification-rewards {
  display: grid;
  gap: 5px;
}

.stats-level-notification-reward-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 24px;
}

.stats-level-notification-reward-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-size: 16px;
}

.stats-level-notification-reward-row strong {
  color: white;
  font-size: 14px;
  font-weight: 900;
}

.stats-level-notification-claim {
  width: 100%;
  min-height: 38px;
  margin-top: 4px;
}

.stats-level-notification-card.is-claiming {
  pointer-events: none;
  opacity: 0.82;
}

.stats-level-notification-card.is-claimed {
  border-color: rgba(74, 222, 128, 0.42);
}

.stats-level-notification-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: white;
  background: rgba(220, 38, 38, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  animation: stats-level-close-pop 420ms ease both;
}

.stats-level-notification-close::before,
.stats-level-notification-close::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  pointer-events: none;
}

.stats-level-notification-close::before {
  border: 1px solid rgba(255, 245, 158, 0.92);
  animation: stats-close-ring-burst 620ms ease-out both;
}

.stats-level-notification-close::after {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.96) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 88% 18%, rgba(255, 245, 158, 0.95) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 100% 50%, rgba(248, 113, 113, 0.96) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 80% 86%, rgba(96, 165, 250, 0.92) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.9) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 15% 82%, rgba(255, 245, 158, 0.92) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 0% 48%, rgba(248, 113, 113, 0.94) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.94) 0 1.5px, transparent 2.5px);
  animation: stats-close-spark-burst 700ms ease-out both;
}

.stats-level-notification-card.is-closing {
  pointer-events: none;
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  transform: translateY(-8px) scale(0.98);
  overflow: hidden;
}

.stats-level-notification-card.level-reward-card-burst {
  animation: stats-level-card-burst 560ms ease both;
}

.stats-page-plate {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(15, 10, 12, 0.34);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: none;
}

.stats-appearance-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(88px, 1fr) minmax(0, 2fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(15, 10, 12, 0.34);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: none;
}

.stats-avatar-preview {
  position: relative;
  width: 100%;
  max-width: 132px;
  aspect-ratio: 1 / 1.25;
  justify-self: center;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.44));
}

.stats-avatar-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 68%, rgba(0, 0, 0, 0.78) 88%, transparent 100%);
  mask-image: radial-gradient(ellipse at center, #000 68%, rgba(0, 0, 0, 0.78) 88%, transparent 100%);
}

.stats-avatar-body {
  z-index: 1;
}

.stats-avatar-glass {
  z-index: 2;
}

.stats-avatar-accessory {
  z-index: 3;
  animation: stats-accessory-float 3400ms ease-in-out infinite;
  filter:
    drop-shadow(0 7px 5px rgba(250, 204, 21, 0.42))
    drop-shadow(0 12px 12px rgba(250, 204, 21, 0.22));
}

.stats-appearance-rows {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.stats-appearance-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 7px 9px;
  color: white;
  font: inherit;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
  transition:
    border-color 180ms ease,
    background 180ms ease,
    opacity 180ms ease;
}

.stats-appearance-row span {
  color: rgba(255, 244, 238, 0.78);
  font-size: 12px;
  font-weight: 800;
}

.stats-appearance-row strong {
  min-width: 0;
  overflow: hidden;
  color: #fff5c2;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-appearance-row:disabled {
  cursor: default;
  opacity: 0.82;
}

.stats-appearance-panel.is-editing .stats-appearance-row:not(:disabled) {
  cursor: pointer;
  border-color: rgba(250, 204, 21, 0.46);
  background: rgba(250, 204, 21, 0.1);
}

.stats-appearance-edit-button {
  min-height: 34px;
  margin-top: 2px;
  font-size: 12px;
}

.stats-appearance-divider {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 1px;
}

.stats-appearance-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.46);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 1;
  visibility: visible;
  transition:
    opacity 220ms ease,
    visibility 220ms ease;
}

.stats-appearance-dialog-backdrop.is-hidden {
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.stats-appearance-dialog {
  display: grid;
  gap: 12px;
  width: min(100%, 420px);
  max-height: min(78vh, 520px);
  padding: 14px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(15, 10, 12, 0.56);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}

.stats-appearance-dialog h2 {
  margin: 0;
  color: #fff5c2;
  font-size: 18px;
  line-height: 1.1;
}

.stats-appearance-picker {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  min-height: 154px;
}

.stats-appearance-arrow {
  display: grid;
  place-items: center;
  width: 36px;
  height: 104px;
  padding: 0;
  color: white;
  font: inherit;
  font-size: 28px;
  font-weight: 900;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.stats-appearance-options-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(92px, 34%);
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.stats-appearance-options-track::-webkit-scrollbar {
  display: none;
}

.stats-appearance-option {
  display: grid;
  gap: 6px;
  justify-items: center;
  min-height: 140px;
  padding: 8px 6px;
  color: white;
  font: inherit;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  scroll-snap-align: center;
  cursor: pointer;
}

.stats-appearance-option.is-selected {
  border-color: rgba(250, 204, 21, 0.72);
  background: rgba(250, 204, 21, 0.12);
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.12);
}

.stats-appearance-option-preview {
  position: relative;
  width: 78px;
  aspect-ratio: 1 / 1.25;
}

.stats-appearance-option-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.stats-appearance-option span {
  max-width: 100%;
  overflow: hidden;
  color: rgba(255, 244, 238, 0.88);
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-appearance-ok-button {
  width: 100%;
  min-height: 38px;
}

@keyframes stats-accessory-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.stats-level-block {
  display: grid;
  gap: 6px;
  padding: 12px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}

.stats-level-block span,
.stats-level-block small {
  color: rgba(255, 244, 238, 0.84);
  font-size: 12px;
  font-weight: 700;
}

.stats-level-block strong {
  font-size: 42px;
  line-height: 0.95;
}

.stats-level-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
}

.stats-level-progress-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.96), rgba(34, 197, 94, 0.96));
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 220ms ease;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stats-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: stretch;
  align-items: stretch;
  min-height: 84px;
  padding: 10px;
  color: white;
  font: inherit;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}

.stats-card strong {
  align-self: end;
  font-size: 22px;
  line-height: 1;
}

.stats-card span {
  align-self: start;
  color: rgba(255, 244, 238, 0.78);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
}

.stats-next-rewards {
  display: grid;
  gap: 8px;
  padding: 12px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}

.stats-next-rewards > span {
  color: rgba(255, 244, 238, 0.84);
  font-size: 12px;
  font-weight: 800;
}

.stats-next-rewards-list {
  display: grid;
  gap: 5px;
}

.stats-next-reward-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 24px;
}

.stats-next-reward-row strong {
  color: #fff5c2;
  font-size: 13px;
  font-weight: 900;
  text-align: left;
}

.stats-next-reward-row span {
  min-width: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.stats-appearance-row strong,
.stats-level-block strong,
.stats-card strong,
.stats-next-reward-row strong,
.stats-level-notification-reward-row strong,
.reward-summary-amount,
.reward-summary-multiplier-prefix,
.stats-appearance-option > span,
.stats-appearance-arrow,
.stats-appearance-lock {
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-weight: 400;
  color: #fff;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.78);
  paint-order: stroke fill;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.92),
    1px 0 0 rgba(0, 0, 0, 0.78),
    0 0 8px rgba(0, 0, 0, 0.42);
}

.stats-level-block strong {
  font-size: clamp(40px, 11vw, 56px);
}

.stats-level-block small b,
.stats-card span,
.stats-next-reward-row span,
.stats-next-reward-row strong,
.reward-summary-amount,
.reward-summary-multiplier-prefix {
  font-weight: 400;
}

.stats-level-progress-fill {
  background: linear-gradient(90deg, rgba(248, 68, 40, 0.98), rgba(255, 153, 31, 0.98));
}

.stats-appearance-options-track {
  grid-auto-flow: initial;
  grid-auto-columns: initial;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
  scroll-snap-type: none;
}

.stats-appearance-option {
  min-width: 0;
  transition:
    opacity 180ms ease,
    filter 180ms ease,
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.stats-appearance-option.is-muted {
  opacity: 0.46;
  filter: brightness(0.68) saturate(0.72);
  transform: scale(0.88);
}

.stats-appearance-option.is-selected {
  transform: scale(1);
}

.stats-appearance-option.is-unpurchased:not(.is-selected) {
  opacity: 0.7;
}

.stats-appearance-option-preview.is-locked-preview img {
  filter: blur(2px) brightness(0.54) saturate(0.6);
}

.stats-appearance-lock {
  position: absolute;
  inset: auto 4px 4px;
  z-index: 6;
  display: grid;
  place-items: center;
  min-height: 20px;
  padding: 2px 4px;
  color: #fff;
  font-size: 9px;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.42);
}

.stats-appearance-perk-info {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  color: rgba(255, 244, 238, 0.88);
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
}

.stats-appearance-perk-info p {
  margin: 0;
}

.stats-appearance-purchase-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 8px;
}

.stats-appearance-purchase-panel.hidden {
  display: none;
}

.stats-appearance-purchase-button {
  width: 100%;
  min-height: 36px;
}

.stats-appearance-balance {
  color: rgba(255, 244, 238, 0.84);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
}

.stats-appearance-arrow {
  height: 100%;
  min-height: 140px;
  font-size: 28px;
}

.stats-level-notification-trade {
  width: 100%;
  margin-top: 8px;
}

.stats-appearance-dialog {
  width: min(100%, 520px);
}

.stats-appearance-dialog h2,
.stats-appearance-row span,
.stats-appearance-row strong {
  font-weight: 400;
}

.stats-appearance-dialog h2 {
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  color: #fff;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.78);
  paint-order: stroke fill;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.92),
    0 0 8px rgba(0, 0, 0, 0.42);
}

.stats-appearance-picker {
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: stretch;
  min-height: 174px;
}

.stats-appearance-options-track {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.stats-appearance-option,
.stats-appearance-arrow {
  height: 174px;
  min-height: 174px;
}

.stats-appearance-option {
  align-content: center;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 10px 8px;
}

.stats-appearance-option-preview {
  width: min(94px, 82%);
  justify-self: center;
  align-self: center;
}

.stats-appearance-option > span {
  min-height: 18px;
  font-size: 12px;
  line-height: 1;
}

.stats-appearance-option.is-muted {
  opacity: 0.38;
  filter: brightness(0.52) saturate(0.62);
  transform: scale(0.9);
}

.stats-appearance-option.is-selected {
  opacity: 1;
  filter: none;
  transform: scale(1);
}

.stats-appearance-perk-info,
.stats-appearance-purchase-panel,
.stats-appearance-ok-button {
  min-height: 48px;
}

.stats-next-reward-row > strong {
  color: #ff9a24;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.82);
}

.stats-next-reward-row .reward-summary-amount,
.stats-next-reward-row .reward-summary-multiplier-prefix {
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-weight: 400;
  color: #fff;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.78);
  paint-order: stroke fill;
}

@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

body[data-page="stats"] .app-background-base {
  opacity: 0;
}

body[data-page="game"] .game-page.active {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  justify-content: center;
  overflow: hidden;
}

body[data-page="create"] .app,
body[data-page="create-editor"] .app,
body[data-page="create-share"] .app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: var(--app-shell-width, min(100vw, 720px));
  max-width: var(--app-shell-width, min(100vw, 720px));
  height: var(--app-stable-height, 100vh);
  min-height: var(--app-stable-height, 100vh);
  padding: 22px 18px 32px;
  overflow: hidden;
}

.create-entry-page {
  position: relative;
  gap: 14px;
}

.create-entry-page.active {
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.create-entry-head,
.create-entry-plate,
.create-entry-menu-button {
  position: relative;
  z-index: 1;
  width: 100%;
}

.create-entry-head h1,
.create-entry-head p {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.62);
}

.create-entry-plate {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(15, 10, 12, 0.34);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: none;
}

.create-entry-button {
  width: 100%;
}

.create-builder-page.active,
.create-share-page.active {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  justify-content: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.create-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  height: 100%;
  min-height: 0;
  align-items: stretch;
  justify-content: flex-start;
}

.create-page-head {
  position: relative;
  z-index: 1;
  width: 100%;
}

.create-page-head h1,
.create-page-head p {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.62);
}

.create-panel .game-divider,
.create-panel .skill-divider {
  display: none;
}

.create-top-plate,
.create-share-top-plate,
.create-board-plate,
.create-bottom-plate {
  width: 100%;
  max-width: 100%;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(15, 10, 12, 0.34);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: none;
  transition: opacity 420ms ease;
}

.create-top-plate,
.create-share-top-plate {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.create-top-actions,
.create-size-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.create-meta-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--current-clock-block-height, 42px);
  gap: 8px;
  align-items: end;
}

.create-size-button,
.create-top-actions .menu-button,
.create-share-back-button,
.create-action-button,
.create-mini-button,
.create-share-submit-button {
  border: 1px solid rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 252, 255, 0.96);
  font: inherit;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.create-top-actions .menu-button {
  min-height: 40px;
  background: rgba(255, 255, 255, 0.08);
}

.create-size-button {
  min-height: 40px;
  font-size: 14px;
}

.create-size-button.active {
  color: #fde68a;
  border-color: #fde68a;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.24), rgba(180, 83, 9, 0.14));
}

.create-title-field,
.create-mine-block {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.create-field-label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.create-title-input,
.create-status-value {
  min-height: var(--current-clock-block-height, 42px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(248, 252, 255, 0.96);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.48);
}

.create-title-input {
  width: 100%;
  padding: 0 12px;
  outline: none;
}

.create-title-input::placeholder {
  color: rgba(255, 255, 255, 0.44);
}

.create-title-input:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.create-status-value {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.create-board-plate {
  position: relative;
  flex: 0 0 auto;
  min-height: 0;
  overflow: hidden;
  align-self: center;
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  max-height: 100%;
  display: grid;
  place-items: center;
  padding: 10px;
  background: rgba(12, 18, 30, 0.3);
}

.create-board-shell {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--create-board-size, 8) / var(--create-board-height, 8);
  overflow: hidden;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
}

.create-board-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

.create-actions-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.create-bottom-plate {
  padding: 14px;
}

.create-mini-button,
.create-action-button,
.create-share-submit-button {
  width: 100%;
  min-height: var(--current-clock-block-height, 42px);
  font-size: 14px;
}

.create-mini-button:disabled {
  display: none;
}

.create-action-button-clear {
  border-color: rgba(251, 146, 60, 0.8);
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.22), rgba(154, 52, 18, 0.12));
  color: #fdba74;
}

.create-action-button-back {
  border-color: rgba(226, 232, 240, 0.76);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 252, 255, 0.96);
}

.create-action-button-save,
.create-share-submit-button {
  border-color: rgba(134, 239, 172, 0.88);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.24), rgba(21, 128, 61, 0.12));
  color: #bbf7d0;
}

.create-share-submit-button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.create-share-back-button {
  width: 100%;
  min-height: var(--current-clock-block-height, 42px);
  font-size: 14px;
  text-align: left;
  padding: 0 12px;
}

.create-share-copy {
  display: grid;
  gap: 8px;
  color: rgba(255, 255, 255, 0.94);
  font-size: 14px;
  line-height: 1.4;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}

.create-share-copy p {
  margin: 0;
}

.create-share-copy strong {
  font-weight: 900;
}

@media (max-height: 720px) {
  body[data-page="create"] .app,
  body[data-page="create-editor"] .app,
  body[data-page="create-share"] .app {
    padding-top: 16px;
    padding-bottom: 22px;
  }

  .create-panel {
    gap: 10px;
  }

  .create-page-head {
    gap: 4px;
  }

  .create-page-head h1 {
    font-size: clamp(26px, 7vw, 38px);
  }

  .create-page-head p {
    display: none;
  }

  .create-top-plate,
  .create-share-top-plate,
  .create-bottom-plate {
    padding: 10px;
  }

  .create-size-button,
  .create-share-back-button,
  .create-action-button,
  .create-share-submit-button,
  .create-title-input,
  .create-status-value {
    min-height: 38px;
    font-size: 13px;
  }
}

.my-maps-page {
  --my-map-card-preview-size: 104px;
  --my-map-card-gap: 8px;
  --my-map-card-padding: 10px;
  --my-map-card-height: calc(var(--my-map-card-preview-size) + (var(--my-map-card-padding) * 2));
  justify-content: flex-start;
  gap: 14px;
}

.my-maps-page.active {
  padding: 22px 18px 32px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.my-maps-head {
  gap: 4px;
}

.my-maps-head h1,
.my-maps-head p {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.62);
}

.my-maps-list {
  display: grid;
  gap: 12px;
  width: 100%;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.my-map-card {
  display: grid;
  grid-template-columns: var(--my-map-card-preview-size) minmax(0, 1fr);
  gap: var(--my-map-card-gap);
  padding: var(--my-map-card-padding);
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(15, 10, 12, 0.34);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: white;
  align-items: stretch;
  min-height: var(--my-map-card-height);
  height: var(--my-map-card-height);
  overflow: hidden;
  box-shadow: none;
}

.my-map-card.is-empty {
  grid-template-columns: minmax(0, 1fr);
}

.my-map-preview {
  width: var(--my-map-card-preview-size);
  height: var(--my-map-card-preview-size);
  min-height: var(--my-map-card-preview-size);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(14, 19, 27, 0.24);
  display: block;
  align-self: start;
  justify-self: start;
  aspect-ratio: 1 / 1;
  image-rendering: pixelated;
}

.my-map-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--my-map-card-gap);
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.my-map-card-header {
  display: grid;
  gap: var(--my-map-card-gap);
}

.my-map-card-title {
  font-size: 16px;
  font-weight: 800;
}

.my-map-card-meta {
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  line-height: 1.35;
}

.my-map-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: var(--my-map-card-gap);
  align-items: stretch;
  align-self: end;
  margin-top: auto;
}

.my-map-card-actions[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.my-map-card-action {
  min-height: var(--current-clock-block-height, 42px);
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 252, 255, 0.96);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.my-map-card-action.is-icon {
  width: var(--current-clock-block-height, 42px);
  padding: 0;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.my-map-card-action.is-primary {
  border-color: rgba(134, 239, 172, 0.88);
  color: #bbf7d0;
}

.my-map-card-action.is-secondary {
  border-color: rgba(250, 204, 21, 0.66);
  color: #fde68a;
}

.my-map-card-action.is-danger {
  border-color: rgba(248, 113, 113, 0.78);
  color: #fca5a5;
}

.my-map-card-action:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.my-maps-back-button {
  width: 100%;
}

.challenge-day-page,
.challenge-result-page {
  position: relative;
  gap: 14px;
}

.challenge-day-page.active,
.challenge-result-page.active {
  padding: 22px 18px 32px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.challenge-day-page.active {
  justify-content: flex-start;
  align-items: stretch;
}

.challenge-result-page.active {
  justify-content: center;
}

.challenge-day-head,
.challenge-day-plate {
  flex: 0 0 auto;
}

#pageChallengeStats .page-head,
#pageChallengeStats .challenge-day-plate,
#pageChallengeResult .challenge-result-content {
  position: relative;
  z-index: 1;
  width: 100%;
  transition: opacity 520ms ease, transform 520ms ease;
}

#pageChallengeStats.entering .page-head,
#pageChallengeStats.entering .challenge-day-plate,
#pageChallengeStats.leaving .page-head,
#pageChallengeStats.leaving .challenge-day-plate,
#pageChallengeResult.entering .challenge-result-content,
#pageChallengeResult.leaving .challenge-result-content {
  opacity: 0;
  transform: none;
}

.challenge-day-head,
.challenge-day-head h1,
.challenge-day-head p {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.62);
}

.challenge-day-plate {
  display: grid;
  gap: 14px;
  width: 100%;
}

.challenge-task-card {
  display: grid;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(15, 10, 12, 0.38);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: none;
}

.challenge-task-title {
  margin: 0;
  color: white;
  font-family: var(--font-pixel);
  font-size: clamp(13px, 3.8vw, 22px);
  font-weight: 400;
  line-height: 1.8;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  -webkit-text-stroke: var(--pixel-stroke, 2px) #000;
  paint-order: stroke fill;
  text-shadow:
    var(--pixel-shadow-size, 3px) 0 0 #000,
    calc(var(--pixel-shadow-size, 3px) * -1) 0 0 #000,
    0 var(--pixel-shadow-size, 3px) 0 #000,
    0 calc(var(--pixel-shadow-size, 3px) * -1) 0 #000,
    var(--pixel-shadow-size, 3px) var(--pixel-shadow-size, 3px) 0 #000,
    calc(var(--pixel-shadow-size, 3px) * -1) var(--pixel-shadow-size, 3px) 0 #000,
    var(--pixel-shadow-size, 3px) calc(var(--pixel-shadow-size, 3px) * -1) 0 #000,
    calc(var(--pixel-shadow-size, 3px) * -1) calc(var(--pixel-shadow-size, 3px) * -1) 0 #000;
  -webkit-font-smoothing: none;
  text-rendering: geometricPrecision;
}

.challenge-day-meta {
  color: rgba(255, 244, 198, 0.96);
  font-size: 13px;
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}

.challenge-day-copy {
  margin: 0;
  color: rgba(255, 244, 238, 0.88);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}

.challenge-day-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.challenge-day-play-button,
.challenge-day-cooldown,
.challenge-day-menu-button {
  width: 100%;
  min-height: var(--current-clock-block-height, 42px);
  box-sizing: border-box;
}

.challenge-day-play-button {
  border-color: rgba(253, 224, 71, 0.95);
  color: #fde68a;
  background: rgba(202, 138, 4, 0.18);
  height: auto;
  padding-block: 8px;
  line-height: 1.2;
}

.challenge-day-play-button:disabled {
  opacity: 0.78;
  cursor: not-allowed;
}

.challenge-day-cooldown {
  display: none;
}

.challenge-day-section {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.challenge-day-plate-title {
  color: rgba(255, 255, 255, 0.98);
  font-size: 16px;
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}

.challenge-day-empty-copy {
  color: rgba(255, 255, 255, 0.86);
  font-size: 15px;
  font-weight: 600;
}

.challenge-day-personal-stats {
  display: grid;
  gap: 10px;
}

.challenge-day-personal-date {
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 700;
}

.challenge-day-stat-grid {
  display: grid;
  gap: 8px;
}

.challenge-day-stat-row,
.challenge-day-leader-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.challenge-day-stat-row span,
.challenge-day-leader-name,
.challenge-day-leader-level {
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  font-weight: 600;
}

.challenge-day-stat-row strong {
  color: rgba(255, 255, 255, 0.98);
  font-size: 15px;
  font-weight: 900;
}

.challenge-day-invite-button {
  width: 100%;
  border-color: rgba(134, 239, 172, 0.9);
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.16);
}

.challenge-day-leaders-list {
  display: grid;
  gap: 6px;
  max-height: 202px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.challenge-day-leaders-list::-webkit-scrollbar {
  width: 3px;
}

.challenge-day-leaders-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.36);
}

.challenge-day-leader-row {
  grid-template-columns: 28px minmax(0, 1fr) auto;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
}

.challenge-day-leader-place {
  color: rgba(255, 255, 255, 0.96);
  font-size: 15px;
  font-weight: 900;
}

.challenge-day-leader-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.challenge-day-leader-level {
  font-weight: 800;
}

.challenge-daily-task-list {
  display: grid;
  gap: 8px;
}

.challenge-daily-task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(86px, 0.34fr);
  gap: 8px;
  align-items: center;
  min-height: var(--current-clock-block-height, 42px);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
}

.challenge-daily-task-row > span {
  display: grid;
  gap: 3px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.challenge-task-reward {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff5c2;
  font-size: 12px;
  font-weight: 900;
}

.challenge-task-reward .purchase-bomb-icon {
  width: 18px;
  height: 18px;
}

.challenge-daily-task-button {
  width: 100%;
  min-height: var(--current-clock-block-height, 42px);
  border-color: rgba(255, 255, 255, 0.3);
}

.challenge-daily-task-button:disabled {
  opacity: 0.54;
  cursor: not-allowed;
}

.challenge-result-stage {
  position: relative;
  width: 100%;
  min-height: 100%;
  display: grid;
  align-items: center;
}

.challenge-result-backdrop {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(100%, 420px);
  background: linear-gradient(180deg, rgba(10, 5, 5, 0.38), rgba(10, 5, 5, 0.54));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
  pointer-events: none;
}

.challenge-result-content {
  display: grid;
  align-content: center;
  gap: 14px;
  max-width: 420px;
  min-height: calc(var(--app-stable-height, 100vh) - 64px);
  margin: 0 auto;
  padding: 18px;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.58);
}

.challenge-result-title {
  margin: 0;
  color: rgba(255, 241, 222, 0.98);
  font-family: var(--font-pixel);
  font-size: clamp(18px, 5vw, 34px);
  line-height: 1.8;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
  -webkit-text-stroke: var(--pixel-stroke, 2px) #000;
  paint-order: stroke fill;
  text-shadow:
    var(--pixel-shadow-size, 3px) 0 0 #000,
    calc(var(--pixel-shadow-size, 3px) * -1) 0 0 #000,
    0 var(--pixel-shadow-size, 3px) 0 #000,
    0 calc(var(--pixel-shadow-size, 3px) * -1) 0 #000,
    var(--pixel-shadow-size, 3px) var(--pixel-shadow-size, 3px) 0 #000,
    calc(var(--pixel-shadow-size, 3px) * -1) var(--pixel-shadow-size, 3px) 0 #000,
    var(--pixel-shadow-size, 3px) calc(var(--pixel-shadow-size, 3px) * -1) 0 #000,
    calc(var(--pixel-shadow-size, 3px) * -1) calc(var(--pixel-shadow-size, 3px) * -1) 0 #000;
}

.challenge-result-divider {
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 180, 143, 0.86), transparent);
}

.challenge-result-stat-list {
  display: grid;
  gap: 9px;
}

.challenge-result-stat-row,
.challenge-result-place-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 236, 226, 0.88);
  font-size: 16px;
  line-height: 1.2;
}

.challenge-result-stat-row strong,
.challenge-result-place-row strong {
  color: rgba(255, 247, 239, 0.98);
  font-size: 20px;
  font-family: var(--font-vcr);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  -webkit-text-stroke: 2px rgba(255, 255, 255, 0.4);
  paint-order: stroke fill;
  text-shadow: none;
}

.challenge-result-points-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
  color: rgba(255, 236, 226, 0.9);
  font-size: 18px;
  font-weight: 800;
}

.challenge-result-points-row strong {
  color: rgba(255, 153, 51, 0.98);
  font-size: clamp(38px, 10vw, 58px);
  line-height: 0.9;
  font-family: var(--font-vcr);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  -webkit-text-stroke: 2px rgba(255, 153, 51, 0.42);
  paint-order: stroke fill;
  text-shadow: none;
}

.challenge-result-rewards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
  padding: 10px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.challenge-result-rewards.hidden {
  display: none;
}

.challenge-result-copy {
  margin: 0;
  color: rgba(255, 244, 238, 0.88);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.challenge-result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

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

@media (max-width: 390px) {
  .create-meta-strip {
    grid-template-columns: minmax(0, 1fr) var(--current-clock-block-height, 42px);
  }
}

.game-bang-circle-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: transparent;
  z-index: 1;
  transition: opacity 420ms ease;
}

.game-magnet-circle-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: transparent;
  z-index: 2;
  transition: opacity 420ms ease;
}

.game-lightning-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: transparent;
  z-index: 4;
  transition: opacity 420ms ease;
}

.game-drone-shot-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: transparent;
  z-index: 5;
  transition: opacity 420ms ease;
}

.hardcore-bonus-stage-fx-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: transparent;
  z-index: 6;
  opacity: 0;
  transition: opacity 320ms ease;
}

.hardcore-bonus-stage {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 7;
  display: grid;
  justify-items: center;
  width: min(100%, 420px);
  padding: 0 18px;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms ease;
}

.hardcore-bonus-stage-title {
  margin: 0;
  color: rgba(255, 241, 222, 0.98);
  font-size: clamp(28px, 7vw, 42px);
  line-height: 1;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.42);
}

body[data-page="game"] .game-panel {
  --game-control-gap: 20px;
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  max-height: none;
  min-height: 0;
  width: 100%;
  padding: 0;
  overflow: hidden;
  align-items: center;
  justify-content: center;
}



.game-plate {
  width: 100%;
  padding: 8px;
  border: var(--game-line-width, 1px) solid var(--game-plate-border-color, rgba(255, 255, 255, 0.2));
  background: var(--game-plate-background, rgba(255, 251, 244, 0.3));
  box-shadow: none;
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  box-sizing: border-box;
}

.game-panel {
  transition: opacity var(--game-entry-duration, 420ms) ease;
}

.game-top-plate {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.game-top-plate,
.game-board-plate,
.game-skills-plate {
  transition:
    opacity var(--game-plate-entry-duration, var(--game-entry-duration, 420ms)) ease,
    transform var(--game-plate-entry-duration, var(--game-entry-duration, 420ms)) ease,
    background 360ms ease,
    border-color 360ms ease,
    backdrop-filter 360ms ease,
    -webkit-backdrop-filter 360ms ease;
}

.game-page.entering .game-bang-circle-canvas,
.game-page.entering .game-magnet-circle-canvas,
.game-page.entering .game-lightning-canvas,
.game-page.entering .hardcore-bonus-stage-fx-canvas,
.game-page.entering .hardcore-bonus-stage,
.game-page.entering .game-top-plate,
.game-page.entering .game-board-plate,
.game-page.entering .game-skills-plate {
  opacity: 0;
}

body.game-fast-return-active .game-page.entering .game-top-plate,
body.game-fast-return-active .game-page.entering .game-board-plate,
body.game-fast-return-active .game-page.entering .game-skills-plate {
  opacity: 1;
}

body.game-fast-return-active .game-bang-circle-canvas,
body.game-fast-return-active .game-magnet-circle-canvas,
body.game-fast-return-active .game-lightning-canvas,
body.game-fast-return-active .game-drone-shot-canvas,
body.game-fast-return-active .hardcore-bonus-stage-fx-canvas,
body.game-fast-return-active .hardcore-bonus-stage {
  transition-duration: 480ms;
}

.game-page.leaving .game-bang-circle-canvas,
.game-page.leaving .game-magnet-circle-canvas,
.game-page.leaving .game-lightning-canvas,
.game-page.leaving .hardcore-bonus-stage-fx-canvas,
.game-page.leaving .hardcore-bonus-stage,
.game-page.leaving .game-top-plate,
.game-page.leaving .game-board-plate,
.game-page.leaving .game-skills-plate {
  opacity: 0;
}

body.game-plates-intro:not(.game-plates-intro-visible) .game-top-plate,
body.game-plates-intro:not(.game-plates-intro-visible) .game-board-plate,
body.game-plates-intro:not(.game-plates-intro-visible) .game-skills-plate {
  opacity: 0;
}

body.game-plates-intro-prep .game-top-plate,
body.game-plates-intro-prep .game-board-plate,
body.game-plates-intro-prep .game-skills-plate {
  opacity: 0 !important;
  transition: none !important;
}

.game-board-plate,
.game-skills-plate {
  display: grid;
  place-items: center;
}

.game-board-plate {
  position: relative;
  flex: 0 0 auto;
  min-height: 0;
  overflow: hidden;
  align-self: center;
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  max-height: 100%;
}

.chill-expired-panel {
  display: none;
  place-items: center;
  align-self: center;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  padding: clamp(18px, 5vw, 34px);
  text-align: center;
  box-sizing: border-box;
  border: var(--game-line-width, 1px) solid var(--game-plate-border-color, rgba(255, 255, 255, 0.2));
  background: var(--game-plate-background, rgba(255, 251, 244, 0.3));
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  opacity: 0;
  transition: opacity 520ms ease, transform 520ms ease;
}

.chill-expired-panel p {
  max-width: 28em;
  margin: 0;
  color: rgba(248, 252, 255, 0.96);
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-size: clamp(14px, 4vw, 22px);
  line-height: 1.28;
  letter-spacing: 0.04em;
}

.chill-expired-purchase-button {
  min-height: var(--current-clock-block-height, 42px);
  padding: 0 18px;
  border: 1px solid rgba(251, 191, 36, 0.86);
  color: rgba(255, 247, 237, 0.98);
  background: rgba(249, 115, 22, 0.16);
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-size: clamp(13px, 3.6vw, 18px);
  letter-spacing: 0.05em;
  cursor: pointer;
}

body.chill-session-expired-gate .game-board-plate,
body.chill-session-expired-gate .skill-divider,
body.chill-session-expired-gate .game-skills-plate {
  display: none;
}

body.chill-session-expired-gate .chill-expired-panel {
  display: grid;
  gap: clamp(16px, 5vw, 26px);
  opacity: 1;
}

.game-skills-plate {
  position: relative;
  padding: 8px;
  border: var(--game-line-width, 1px) solid var(--game-plate-border-color, rgba(255, 255, 255, 0.2));
  background: var(--game-plate-background, rgba(255, 251, 244, 0.3));
  box-shadow: none;
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}

.challenge-share-button {
  width: 100%;
  min-height: var(--current-clock-block-height, 42px);
  padding: 0 12px;
  border: 1px solid rgba(134, 239, 172, 0.9);
  background: rgba(34, 197, 94, 0.16);
  color: #bbf7d0;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
}

.challenge-share-button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

body[data-page="game"] .game-divider,
body[data-page="game"] .game-meta,
body[data-page="game"] .status-panel {
  display: none !important;
}

.top-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--current-clock-block-height, 42px) minmax(0, 1fr);
  gap: var(--clock-gap, 12px);
  min-height: var(--current-clock-block-height, 42px);
  transition:
    opacity 320ms ease,
    transform 320ms ease;
}

body[data-page="game"].ordinary-ui-theme .top-actions,
body[data-page="game"].chill-game .top-actions {
  grid-template-columns: minmax(0, 1fr) var(--current-clock-block-height, 42px) minmax(0, 1fr);
}

.bars-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--current-clock-block-height, 42px) minmax(0, 1fr);
  gap: var(--clock-gap, 12px);
  align-items: center;
  width: 100%;
  height: 10px;
  min-height: 10px;
  overflow: visible;
  transition:
    opacity 320ms ease,
    transform 320ms ease;
}

.bar-track {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.18);
}

.bar-fill-base {
  position: absolute;
  inset: 0;
}

.bar-fill {
  position: absolute;
  inset: 0;
  transform: scaleX(var(--bar-progress-scale, 0));
  transform-origin: left center;
}

.armor-track {
  background: transparent;
}

.armor-base-fill {
  background: #8ebef5;
}

.armor-fill {
  background: #60a5fa;
}

.armor-damage-fill {
  background: rgba(239, 68, 68, 0.96);
  left: calc(var(--armor-damage-fill-left, 0) * 100%);
  width: calc(var(--armor-damage-fill-width, 0) * 100%);
  opacity: var(--armor-damage-fill-opacity, 0);
  transform: none;
}

.level-fill {
  background: #facc15;
}

.level-gain-fill {
  background: rgba(34, 197, 94, 0.98);
  left: calc(var(--level-gain-fill-left, 0) * 100%);
  width: calc(var(--level-gain-fill-width, 0) * 100%);
  opacity: var(--level-gain-fill-opacity, 0);
  transform: none;
}

.bar-spacer {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.bars-overlay-canvas {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.bars-fx-canvas {
  z-index: 1;
}

.bars-popup-canvas {
  z-index: 3;
}

.pause-button,
.menu-button,
.hardcore-top-button {
  min-height: var(--current-clock-block-height, 42px);
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.95);
  color: rgba(248, 252, 255, 0.94);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  background: transparent;
  box-sizing: border-box;
  transition:
    opacity 500ms ease,
    border-color 500ms ease,
    color 500ms ease,
    background-color 500ms ease;
}

.pause-button {
  width: var(--current-clock-block-height, 42px);
  min-width: var(--current-clock-block-height, 42px);
  padding: 0;
  display: grid;
  place-items: center;
  justify-self: center;
  position: relative;
  overflow: hidden;
  font-size: 20px;
  line-height: 1;
}



.menu-button,
.hardcore-top-button {
  width: 100%;
}

.game-mode-switch {
  --mode-switch-pad: 3px;
  --mode-switch-x: 0%;
  --mode-switch-motion-ms: 420ms;
  position: relative;
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  width: 100%;
  min-height: var(--current-clock-block-height, 42px);
  padding: var(--mode-switch-pad);
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.95);
  color: rgba(248, 252, 255, 0.94);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  touch-action: manipulation;
  contain: paint;
}

body[data-page="game"].ordinary-ui-theme .game-mode-switch,
body[data-page="game"].chill-game .game-mode-switch {
  display: grid;
}

body[data-page="game"].ordinary-ui-theme .hardcore-top-button,
body[data-page="game"].chill-game .hardcore-top-button {
  display: none;
}

.game-mode-switch-thumb {
  position: absolute;
  z-index: 0;
  left: var(--mode-switch-pad);
  top: var(--mode-switch-pad);
  width: calc((100% - var(--mode-switch-pad) * 2) / 2);
  height: calc(100% - var(--mode-switch-pad) * 2);
  background: rgba(255, 255, 255, 0.18);
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.42);
  transform: translate3d(var(--mode-switch-x), 0, 0);
  will-change: transform;
  transition:
    transform var(--mode-switch-motion-ms) cubic-bezier(0.18, 0.82, 0.22, 1),
    background-color var(--mode-switch-motion-ms) ease,
    border-color var(--mode-switch-motion-ms) ease;
}

.game-mode-switch[data-mode="chill"] .game-mode-switch-thumb {
  --mode-switch-x: 100%;
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(191, 219, 254, 0.5);
}

.game-mode-switch-button {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 0 clamp(2px, 1vw, 7px);
  border: 0;
  color: rgba(248, 252, 255, 0.76);
  background: transparent;
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-size: clamp(7px, 2.05vw, 11px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: 0.035em;
  text-align: center;
  overflow-wrap: anywhere;
  hyphens: none;
  cursor: pointer;
  pointer-events: none;
  transition:
    color 260ms ease,
    opacity 260ms ease;
}

body[data-page="game"] .top-actions .menu-button,
body[data-page="game"] .top-actions .game-mode-switch-button {
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
  font-weight: 400;
  letter-spacing: 0.04em;
}

body[data-page="game"] .top-actions .pause-button {
  font-family: var(--font), Arial, sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.game-mode-switch-button.active {
  color: rgba(248, 252, 255, 0.98);
}

.game-mode-switch-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.shared-map-hardcore-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  padding: 5px 8px;
  text-align: left;
  cursor: default;
  pointer-events: none;
  opacity: 1;
}

.challenge-date-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  color: rgba(255, 245, 245, 0.98);
  background: rgba(185, 28, 28, 0.32);
  border-color: rgba(252, 165, 165, 0.92);
  cursor: default;
  pointer-events: none;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
}

.challenge-date-card:disabled {
  opacity: 1;
  cursor: default;
}

.challenge-date-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  white-space: nowrap;
}

.shared-map-hardcore-title {
  display: block;
  width: 100%;
  color: rgba(248, 252, 255, 0.98);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shared-map-hardcore-owner {
  display: block;
  width: 100%;
  color: rgba(248, 252, 255, 0.82);
  font-size: 9px;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shared-map-hardcore-owner strong {
  color: rgba(248, 252, 255, 0.96);
  font-weight: 800;
}

.hardcore-top-button:disabled,
.menu-button:disabled,
.pause-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

body[data-page="game"] .top-actions {
  gap: 6px;
}

body[data-page="game"] .bars-panel {
  gap: 6px;
}

body[data-page="game"] .clock-panel.clock-block {
  gap: 6px;
}

.clock-panel.clock-block {
  display: flex;
  grid-template-columns: minmax(0, 1fr) var(--current-clock-block-height, 42px) minmax(0, 1fr);
  display: grid;
  align-items: stretch;
  justify-content: stretch;
  gap: var(--clock-gap, 12px);
  min-height: var(--current-clock-block-height, 42px);
  height: var(--current-clock-block-height, 42px);
  width: 100%;
  transition:
    opacity 320ms ease,
    transform 320ms ease;
}

.clock-block {
  width: 100%;
}

.clock-counter {
  position: relative;
  min-width: 0;
  width: 100%;
  height: 100%;
  border: var(--game-line-width, 1px) solid var(--clock-border);
  background: transparent;
  box-sizing: border-box;
  overflow: hidden;
}

.clock-counter.clock-counter-inactive {
  opacity: 0.42;
}

.clock-counter.clock-counter-inactive .digits-bg .digit-group {
  color: rgba(255, 255, 255, 0.05);
}

.clock-center-square {
  width: var(--current-clock-block-height, 42px);
  height: var(--current-clock-block-height, 42px);
  flex: 0 0 var(--current-clock-block-height, 42px);
  box-sizing: border-box;
  background: transparent;
  border: var(--game-line-width, 1px) solid var(--clock-square-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.clock-center-icons,
.clock-face {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: white;
  font-size: 22px;
  line-height: 1;
  pointer-events: auto;
}

.clock-counter-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: var(--clock-inner-pad-y) var(--clock-inner-pad-x);
  box-sizing: border-box;
  overflow: hidden;
}

.digits-measure {
  position: relative;
  z-index: 0;
  height: 100%;
  display: flex;
  align-items: center;
  visibility: hidden;
  pointer-events: none;
}

.digits-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: var(--clock-inner-pad-y) var(--clock-inner-pad-x);
  box-sizing: border-box;
  pointer-events: none;
  z-index: 1;
}

.field-counter .digits-layer,
.field-counter .digits-measure {
  justify-content: flex-end;
}

.timer-counter .digits-layer,
.timer-counter .digits-measure {
  justify-content: flex-start;
}

.chill-clock-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(249, 115, 22, 0.24);
  opacity: 0;
  transform: scaleX(var(--chill-time-ratio, 1));
  transform-origin: left center;
  transition: transform 180ms linear, opacity 220ms ease;
  pointer-events: none;
}

.chill-clock-panel {
  --chill-time-ratio: 1;
  --chill-clock-gap: 6px;
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: var(--chill-clock-gap, 6px);
  padding: var(--chill-clock-gap, 6px);
  box-sizing: border-box;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font);
}

body[data-page="game"].chill-game .timer-counter .chill-clock-panel::before {
  opacity: 1;
}

body[data-page="game"].chill-game .timer-counter > .clock-counter-inner {
  visibility: hidden;
}

body[data-page="game"].chill-game .timer-counter .chill-clock-panel {
  opacity: 1;
  pointer-events: auto;
}

.chill-clock-time,
.chill-clock-purchase-button {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.48);
  color: rgba(248, 252, 255, 0.96);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(9px) saturate(1.35);
  backdrop-filter: blur(9px) saturate(1.35);
  text-align: center;
}

.chill-clock-time {
  grid-template-rows: 1fr;
  align-content: center;
  gap: 0;
  padding: 2px 4px;
  line-height: 1.05;
}

.chill-clock-time span {
  font-size: clamp(5px, 1.6vw, 8px);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.chill-clock-time strong {
  font-size: clamp(9px, 2.7vw, 13px);
  font-weight: 400;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.chill-clock-purchase-button {
  width: 100%;
  height: 100%;
  padding: 2px 4px;
  font: inherit;
  font-size: clamp(8px, 2.2vw, 12px);
  letter-spacing: 0.05em;
  cursor: pointer;
}

.digits-row {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: calc(var(--clock-large-font-size) - 1px);
  white-space: pre;
}

.field-row {
  justify-content: flex-end;
}

.timer-row {
  justify-content: flex-start;
}

.timer-main-group,
.timer-small-group {
  display: inline-flex;
  flex: 0 0 auto;
}

.timer-main-group {
  justify-content: flex-start;
}

.timer-small-group {
  justify-content: flex-end;
  margin-left: calc(var(--clock-timer-small-gap) + var(--clock-small-shift-right));
}

.digit-group {
  display: inline-flex;
  align-items: flex-end;
  font-family: "DigitalNumbers", monospace;
  font-weight: 400;
  line-height: 1;
  height: 100%;
  white-space: pre;
  font-variant-numeric: tabular-nums;
  text-rendering: geometricPrecision;
  transform-origin: center bottom;
  flex: 0 0 auto;
}

.digit-group-small {
  font-size: var(--clock-small-font-size);
  letter-spacing: var(--clock-small-letter-spacing);
  transform: scaleX(var(--clock-small-scale-x));
}

.digit-group-large {
  font-size: var(--clock-large-font-size);
  letter-spacing: var(--clock-large-letter-spacing);
  transform: scaleX(var(--clock-large-scale-x));
  margin-left: var(--clock-large-shift-left);
}

.timer-counter .digit-group-large {
  margin-left: 0;
}

.field-counter .digit-group-large {
  margin-left: calc(var(--clock-timer-small-gap) + var(--clock-large-shift-left));
}

.digits-bg .digit-group {
  color: var(--clock-digit-inactive);
}

.digits-value .digit-group {
  color: var(--clock-digit-active);
  text-shadow: none;
}

.clock-face-rotator {
  cursor: pointer;
}

.board-shell {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.board-scroll-layer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.board-transform-layer,
.board,
.bang-preview-overlay,
.water-overlay,
.smoke-overlay {
  transition: opacity 320ms ease;
}

.board-transform-layer {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  aspect-ratio: var(--board-size, 10) / var(--board-height, 10);
  overflow: hidden;
}

body.challenge-game .board-scroll-layer {
  align-items: flex-start;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

body.challenge-game .board-scroll-layer::-webkit-scrollbar {
  display: none;
}

body.challenge-game .board-scroll-layer {
  scrollbar-width: none;
}

body.challenge-game .board {
  touch-action: pan-y;
}

body[data-page="game"] .board-transform-layer,
body[data-page="game"] .board-canvas-layer,
body[data-page="game"] .board,
.bang-preview-overlay,
.water-overlay,
.smoke-overlay {
  width: 100%;
  max-width: 100%;
}

body[data-page="game"] .board {
  position: absolute;
  inset: auto;
  transform: rotate(var(--board-rotation, 0deg));
  transform-origin: center;
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.3);
}

.bang-preview-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(var(--board-rotation, 0deg));
  transform-origin: center;
}

.water-overlay {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  will-change: opacity;
}

.water-overlay {
  z-index: 4;
  opacity: 0;
}

.smoke-overlay {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  will-change: opacity;
  opacity: 0;
}

.water-overlay.visible {
  opacity: 1;
}

.water-overlay.is-fading {
  opacity: 0;
}

.water-preview-overlay {
  z-index: 7;
  transition-duration: 140ms;
}

.water-active-overlay {
  z-index: 8;
}

.water-bubble-overlay {
  z-index: 9;
}

.board-evil-mine-bars-canvas {
  z-index: 16;
}

.board-evil-drone-hud-canvas {
  z-index: 10;
}

.board-drone-tame-hud-canvas {
  z-index: 15;
}

.smoke-overlay.visible {
  opacity: 1;
}

.smoke-overlay.is-fading {
  opacity: 0;
}

.smoke-preview-overlay {
  z-index: 11;
  transition-duration: 140ms;
}

.smoke-active-overlay {
  z-index: 12;
}

.bang-preview-overlay {
  z-index: 13;
  display: block;
  opacity: 1;
  pointer-events: none;
}

.bang-preview-group {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  grid-template-columns: repeat(3, var(--bang-preview-cell-width, 32px));
  grid-template-rows: repeat(3, var(--bang-preview-cell-height, 32px));
  gap: var(--board-gap, 6px);
  transform: translate3d(var(--bang-preview-x, 0px), var(--bang-preview-y, 0px), 0);
}

.bang-preview-cell {
  background: rgba(255, 0, 0, 0.95);
  border: 1px solid rgba(255, 0, 0, 0.82);
  box-shadow: 0 0 18px rgba(255, 0, 0, 0.46);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.bang-preview-10 { opacity: 0.1; }
.bang-preview-30 { opacity: 0.3; }
.skills-panel {
  transition:
    opacity 320ms ease,
    transform 320ms ease;
}

.bang-preview-50 { opacity: 0.5; }

.game-paused .skills-panel {
  pointer-events: none;
}

body.game-scene-exiting .board-transform-layer,
body.game-scene-exiting .bang-preview-overlay,
body.game-scene-exiting .water-overlay,
body.game-scene-exiting .smoke-overlay,
body.game-scene-exiting .board-popup-canvas,
body.game-scene-exiting .game-magnet-circle-canvas,
body.game-scene-exiting .game-lightning-canvas,
body.game-scene-exiting .game-drone-shot-canvas,
body.game-scene-exiting .hardcore-bonus-stage-fx-canvas,
body.game-scene-exiting .hardcore-bonus-stage {
  opacity: 0;
  pointer-events: none;
}

.game-paused .bang-preview-overlay,
.game-paused .water-overlay,
.game-paused .smoke-overlay,
.game-paused .board-popup-canvas,
.game-paused .game-magnet-circle-canvas,
.game-paused .game-lightning-canvas,
.game-paused .game-drone-shot-canvas {
  opacity: 0;
}

body.shared-map-finished .bars-panel,
body.shared-map-finished .clock-panel.clock-block,
body.shared-map-finished #newGameButton,
body.shared-map-finished #hardcoreTopButton,
body.shared-map-finished .game-board-plate,
body.shared-map-finished .game-skills-plate {
  opacity: 0.42;
  filter: none;
  pointer-events: none;
}

body.shared-map-finished #menuButton {
  opacity: 1;
  filter: none;
  pointer-events: auto;
}

.skill-divider {
  margin-top: 1px;
}

.skills-panel {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  align-items: stretch;
  justify-items: stretch;
  position: relative;
  z-index: 22;
}

.skill-button {
  position: relative;
  --skill-icon-size: 65%;
  --skill-count-size-px: 16px;
  --skill-count-offset-px: 4px;
  --skill-count-pad-px: 1px;
  --skill-count-font-size-px: 6px;
  --skill-count-text-y-px: 0px;
  display: grid;
  place-items: center;
  justify-self: stretch;
  align-self: stretch;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  max-width: none;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.3);
  border-radius: 0 !important;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: clamp(18px, 5vw, 26px);
  cursor: pointer;
  touch-action: none;
  overflow: hidden;
}

.lightning-skill-button.active,
.lightning-skill-button.dragging {
  color: white;
  background: rgba(250, 204, 21, 0.2);
  border-color: rgba(250, 204, 21, 0.56);
}

.water-skill-button.active,
.water-skill-button.dragging {
  color: white;
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.55);
}

.smoke-skill-button.active,
.smoke-skill-button.dragging {
  color: white;
  background: rgba(148, 163, 184, 0.22);
  border-color: rgba(203, 213, 225, 0.52);
}

.stone-skill-button.active,
.stone-skill-button.dragging {
  color: white;
  background: rgba(120, 113, 108, 0.22);
  border-color: rgba(231, 229, 228, 0.5);
}

.magnet-skill-button.active,
.magnet-skill-button.dragging {
  color: white;
  background: rgba(37, 99, 235, 0.22);
  border-color: rgba(191, 219, 254, 0.56);
}

.skill-button.defeat-dragging {
  opacity: 0.2;
}

body.defeat-options-mode .app {
  z-index: 21;
}

body.defeat-options-mode .game-panel {
  position: relative;
  z-index: auto;
}

body.defeat-options-mode .game-skills-plate {
  position: relative;
  z-index: 22;
}

body.defeat-options-mode .defeat-backdrop-canvas {
  display: block;
}

body.defeat-options-mode .skills-panel,
body.defeat-options-mode .skill-cancel-button {
  position: relative;
  z-index: 23;
}

.defeat-backdrop-canvas {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.defeat-backdrop-canvas.hidden {
  display: none;
}

.defeat-drag-ghost {
  position: fixed;
  z-index: 23;
  opacity: 0.8;
  pointer-events: none;
  margin: 0;
}

.skill-button small,
.skill-button .power-count {
  position: absolute;
  right: var(--skill-count-offset-px);
  bottom: var(--skill-count-offset-px);
  display: grid;
  place-items: center;
  width: var(--skill-count-size-px);
  min-width: var(--skill-count-size-px);
  height: var(--skill-count-size-px);
  box-sizing: border-box;
  padding: var(--skill-count-pad-px);
  border: 1px solid rgba(255, 255, 255, 0.44);
  background: rgba(10, 6, 8, 0.58);
  color: white;
  font-family: var(--font-vcr) !important;
  font-size: var(--skill-count-font-size-px);
  font-weight: 400;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -webkit-text-stroke: 0.35px rgba(255, 255, 255, 0.38);
  paint-order: stroke fill;
  text-shadow: none;
}

.skill-button small,
.skill-button small *,
.skill-button .power-count,
.skill-button .power-count *,
.level-skill-button,
.level-skill-button * {
  font-family: var(--font-vcr) !important;
}

.skill-button .power-count > span {
  display: block;
  line-height: 1;
  transform: translateY(var(--skill-count-text-y-px));
}

.skill-button .power-count:empty {
  display: none;
}

.skill-button .power-count.is-empty {
  display: none;
}

.skill-countdown-badge {
  position: absolute;
  top: max(2px, calc(var(--skill-count-offset-px) * 0.45));
  right: max(2px, calc(var(--skill-count-offset-px) * 0.45));
  z-index: 4;
  min-width: calc(var(--skill-count-size-px) * 0.75);
  height: calc(var(--skill-count-size-px) * 0.75);
  display: grid;
  place-items: center;
  color: #fde047;
  font-family: "VCR OSD Mono Nova", "IBM 029", Montserrat, sans-serif;
  font-size: max(5px, calc(var(--skill-count-font-size-px) * 0.92));
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  -webkit-text-stroke: 1px rgba(56, 189, 248, 0.95);
  paint-order: stroke fill;
  text-shadow:
    0 0 2px rgba(56, 189, 248, 0.75),
    0 1px 2px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.skill-countdown-badge.hidden {
  display: none;
}

.skill-button:disabled,
.skills-panel.skill-dragging .skill-button:not(.bang-skill-button) {
  color: rgba(47, 36, 23, 0.45);
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.32);
  cursor: not-allowed;
}

.skills-panel.skill-dragging .skill-button:not(.bang-skill-button) {
  background: rgba(209, 213, 219, 0.22);
}

.skills-panel.skill-dragging {
  opacity: 0;
  pointer-events: none;
}

.skill-cancel-button {
  position: absolute;
  inset: 8px;
  z-index: 2;
  border: 0;
  color: white;
  background: #dc2626;
  font-size: 16px;
  font-weight: 800;
  transform-origin: center bottom;
}

.skill-cancel-button.hidden {
  display: none;
}

.bang-skill-button.active,
.bang-skill-button.dragging {
  color: white;
  background: rgba(249, 115, 22, 0.18);
  border-color: rgba(249, 115, 22, 0.5);
}

.bang-skill-button .power-label {
  font-size: 1.18em;
}

.bang-skill-button {
  --skill-icon-size: 69%;
}

.trade-skill-button span {
  color: #22c55e;
  font-size: 1.36em;
  font-family: var(--font), Arial, sans-serif;
  font-weight: 900;
  font-style: normal;
  font-variant-emoji: text;
  line-height: 1;
  text-shadow: none;
}

.trade-skill-button.chill-settings-skill-button {
  touch-action: manipulation;
}

.trade-skill-button.chill-settings-skill-button .chill-skill-label {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0 3px;
  box-sizing: border-box;
  color: white;
  font-family: var(--font), Arial, sans-serif;
  font-size: clamp(8px, 2.25vw, 11px);
  font-weight: 400;
  line-height: 0.96;
  text-align: center;
  text-transform: lowercase;
  overflow-wrap: anywhere;
}

.trade-skill-button.chill-settings-skill-button .chill-skill-gear {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", var(--font), sans-serif;
  font-size: clamp(22px, 6vw, 34px);
  line-height: 1;
  text-transform: none;
  overflow-wrap: normal;
}

.level-skill-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  color: white;
  text-align: center;
  touch-action: manipulation;
  overflow: visible;
}

.level-skill-button .level-skill-label {
  display: block;
  width: 100%;
  color: white;
  font-size: clamp(8px, 2.25vw, 11px);
  font-family: var(--font-vcr) !important;
  font-weight: 400;
  font-style: normal;
  line-height: 0.96;
  text-align: center;
  text-transform: lowercase;
  -webkit-text-stroke: 0.35px rgba(255, 255, 255, 0.38);
  paint-order: stroke fill;
  text-shadow: none;
}

.level-skill-button strong {
  display: block;
  width: 100%;
  color: white;
  font-size: clamp(8px, 2.25vw, 11px);
  font-family: var(--font-vcr) !important;
  font-weight: 400;
  line-height: 0.96;
  text-align: center;
  -webkit-text-stroke: 0.35px rgba(255, 255, 255, 0.38);
  paint-order: stroke fill;
  text-shadow: none;
}

.level-notification-badge {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 9px;
  height: 9px;
  aspect-ratio: 1 / 1;
  min-width: 9px;
  min-height: 9px;
  padding: 0;
  color: transparent;
  background: #dc2626;
  border: 1.5px solid white;
  border-radius: 999px;
  font-style: normal;
  font-size: 0;
  font-weight: 400;
  line-height: 1;
  box-shadow: none;
  pointer-events: none;
}

.level-notification-badge.hidden {
  display: none;
}

.menu-profile-notification-badge {
  right: -4px;
  bottom: -4px;
}

.level-notification-badge.level-notification-burst {
  animation: level-notification-dot-pop 680ms ease both;
}

.level-notification-badge.level-notification-burst::before,
.level-notification-badge.level-notification-burst::after {
  content: "";
  position: absolute;
  inset: -14px;
  z-index: 2;
  border-radius: 50%;
  pointer-events: none;
}

.level-notification-badge.level-notification-burst::before {
  border: 1px solid rgba(255, 245, 158, 0.95);
  animation: level-notification-ring-burst 760ms ease-out both;
}

.level-notification-badge.level-notification-burst::after {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.96) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 90% 18%, rgba(255, 245, 158, 0.95) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 100% 50%, rgba(248, 113, 113, 0.96) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 78% 86%, rgba(96, 165, 250, 0.92) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.9) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 12% 82%, rgba(255, 245, 158, 0.92) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 0% 48%, rgba(248, 113, 113, 0.94) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.94) 0 1.5px, transparent 2.5px);
  animation: level-notification-spark-burst 780ms ease-out both;
}

.defeat-options {
  position: fixed;
  left: 50%;
  top: 43%;
  z-index: 24;
  display: flex;
  flex-direction: column;
  width: min(38vw, 340px);
  min-width: min(72vw, 290px);
  max-width: calc(100vw - 64px);
  padding: 12px 14px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, rgba(179, 32, 21, 0.96), rgba(104, 12, 12, 0.96));
  backdrop-filter: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.26);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
  pointer-events: none;
}

.hardcore-summary-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 42%, rgba(127, 29, 29, 0.22), rgba(10, 10, 14, 0.56));
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transition: opacity 320ms ease;
}

.hardcore-summary-dialog {
  position: fixed;
  left: 50%;
  top: 46%;
  z-index: 24;
  display: flex;
  flex-direction: column;
  width: min(38vw, 340px);
  min-width: min(72vw, 290px);
  max-width: calc(100vw - 64px);
  padding: 14px;
  border: 1px solid rgba(248, 113, 113, 0.3);
  background: linear-gradient(180deg, rgba(54, 22, 22, 0.96), rgba(20, 11, 11, 0.96));
  color: white;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.26);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
  pointer-events: none;
  transition:
    opacity 320ms ease,
    transform 320ms ease;
}

.hardcore-summary-dialog h2 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 900;
}

.hardcore-summary-dialog p {
  margin: 0 0 12px;
  color: rgba(255, 235, 235, 0.84);
  font-size: 12px;
  line-height: 1.35;
}

.hardcore-summary-stats {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.hardcore-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 240, 240, 0.88);
  font-size: 12px;
}

.hardcore-summary-row strong {
  color: #fff;
  font-size: 14px;
  font-family: var(--font-vcr);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  -webkit-text-stroke: 2px rgba(255, 255, 255, 0.4);
  paint-order: stroke fill;
  text-shadow: none;
}

.hardcore-summary-menu-button {
  width: 100%;
}

body.hardcore-run-summary-mode .hardcore-summary-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.hardcore-run-summary-mode .hardcore-summary-dialog {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.chill-settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 23;
  background: rgba(0, 0, 0, 0.2);
  opacity: 1;
  pointer-events: auto;
  transition: opacity 220ms ease;
}

.chill-settings-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.chill-settings-dialog {
  position: fixed;
  z-index: 24;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 240px;
  min-height: 240px;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  opacity: 1;
  pointer-events: auto;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.chill-settings-dialog.hidden {
  opacity: 0;
  transform: scale(0.985);
  pointer-events: none;
}

.chill-settings-scroll {
  display: grid;
  gap: 10px;
  min-height: 0;
  padding: 12px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.chill-settings-scroll h2,
.chill-settings-section h3 {
  margin: 0;
  color: white;
  text-align: center;
}

.chill-settings-scroll h2 {
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 900;
}

.chill-settings-section {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  backdrop-filter: blur(12px) saturate(130%);
}

.chill-settings-section h3 {
  font-size: 12px;
  font-weight: 900;
}

.chill-settings-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.chill-settings-options-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.chill-settings-options button,
.chill-settings-actions button {
  min-height: 32px;
  padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.08);
  font: inherit;
  font-size: clamp(9px, 2.35vw, 12px);
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  cursor: pointer;
}

.chill-settings-options button.active {
  color: white;
  border-color: rgba(191, 219, 254, 0.74);
  background: rgba(96, 165, 250, 0.24);
}

.chill-settings-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.08);
}

.chill-settings-actions button:first-child {
  border-color: rgba(134, 239, 172, 0.56);
  background: rgba(34, 197, 94, 0.18);
}

body.hardcore-ui-theme {
  --clock-border: rgba(248, 113, 113, 0.23);
  --clock-digit-active: rgba(248, 113, 113, 0.98);
  --clock-digit-inactive: rgba(248, 113, 113, 0.08);
  --clock-square-border: rgba(248, 113, 113, 0.21);
}

body.hardcore-ui-theme .game-plate,
body.hardcore-ui-theme .game-skills-plate {
  border-color: var(--game-plate-border-color, rgba(248, 113, 113, 0.16));
  background: var(--game-plate-background, rgba(10, 10, 10, 0.28));
}

body.ordinary-ui-theme .game-plate,
body.ordinary-ui-theme .game-skills-plate {
  border-color: var(--game-plate-border-color, rgba(255, 255, 255, 0.3));
  background: var(--game-plate-background, rgba(255, 255, 255, 0.34));
}

body.ordinary-ui-theme .game-board-plate {
  background: var(--game-plate-background, rgba(255, 255, 255, 0.34));
}

body.hardcore-ui-theme .game-board-plate {
  background: var(--game-plate-background, rgba(10, 10, 10, 0.28));
  -webkit-backdrop-filter: blur(9px) saturate(118%);
  backdrop-filter: blur(9px) saturate(118%);
}

#pageChallengeStats .challenge-task-card,
body[data-page="challenge-day-stats"] .challenge-task-card {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(15, 10, 12, 0.38);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  backdrop-filter: blur(14px) saturate(130%);
}

#pageChallengeStats .challenge-daily-task-row,
body[data-page="challenge-day-stats"] .challenge-daily-task-row {
  background: rgba(255, 255, 255, 0.1);
}

body.hardcore-bonus-phase-active .game-board-plate,
body.hardcore-bonus-visual-suppressed .game-board-plate {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: opacity 120ms ease !important;
}

body.hardcore-bonus-phase-active .hardcore-bonus-stage,
body.hardcore-bonus-phase-active .hardcore-bonus-stage-fx-canvas {
  opacity: 1;
}

body.hardcore-bonus-phase-closing .hardcore-bonus-stage,
body.hardcore-bonus-phase-closing .hardcore-bonus-stage-fx-canvas {
  opacity: 0;
}

body.hardcore-bonus-phase-active .game-top-plate,
body.hardcore-bonus-phase-active .game-meta,
body.hardcore-bonus-phase-active .status-panel,
body.hardcore-bonus-phase-active .game-skills-plate,
body.hardcore-bonus-phase-active .game-panel > .game-divider,
body.hardcore-bonus-visual-suppressed .game-top-plate,
body.hardcore-bonus-visual-suppressed .game-meta,
body.hardcore-bonus-visual-suppressed .status-panel,
body.hardcore-bonus-visual-suppressed .game-skills-plate,
body.hardcore-bonus-visual-suppressed .game-panel > .game-divider {
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease !important;
}

body.hardcore-bonus-phase-active .board-base-canvas,
body.hardcore-bonus-phase-active .board-content-canvas,
body.hardcore-bonus-phase-active .board-evil-mine-underlay-canvas,
body.hardcore-bonus-phase-active .board-evil-drone-body-canvas,
body.hardcore-bonus-phase-active .board-evil-closer-canvas,
body.hardcore-bonus-phase-active .board-challenge-start-canvas,
body.hardcore-bonus-phase-active .board-victory-overlay-canvas,
body.hardcore-bonus-phase-active .board-pause-overlay-canvas,
body.hardcore-bonus-phase-active .board-evil-mine-bars-canvas,
body.hardcore-bonus-phase-active .board-evil-drone-hud-canvas,
body.hardcore-bonus-phase-active .board-electromagnet-canvas,
body.hardcore-bonus-phase-active .board,
body.hardcore-bonus-phase-active .water-overlay,
body.hardcore-bonus-phase-active .smoke-overlay,
body.hardcore-bonus-phase-active .app-background-magnet-wave,
body.hardcore-bonus-phase-active .game-magnet-circle-canvas,
body.hardcore-bonus-phase-active .bang-preview-overlay,
body.hardcore-bonus-visual-suppressed .board-base-canvas,
body.hardcore-bonus-visual-suppressed .board-content-canvas,
body.hardcore-bonus-visual-suppressed .board-evil-mine-underlay-canvas,
body.hardcore-bonus-visual-suppressed .board-evil-drone-body-canvas,
body.hardcore-bonus-visual-suppressed .board-evil-closer-canvas,
body.hardcore-bonus-visual-suppressed .board-challenge-start-canvas,
body.hardcore-bonus-visual-suppressed .board-victory-overlay-canvas,
body.hardcore-bonus-visual-suppressed .board-pause-overlay-canvas,
body.hardcore-bonus-visual-suppressed .board-evil-mine-bars-canvas,
body.hardcore-bonus-visual-suppressed .board-evil-drone-hud-canvas,
body.hardcore-bonus-visual-suppressed .board-electromagnet-canvas,
body.hardcore-bonus-visual-suppressed .board,
body.hardcore-bonus-visual-suppressed .water-overlay,
body.hardcore-bonus-visual-suppressed .smoke-overlay,
body.hardcore-bonus-visual-suppressed .app-background-magnet-wave,
body.hardcore-bonus-visual-suppressed .game-magnet-circle-canvas,
body.hardcore-bonus-visual-suppressed .bang-preview-overlay {
  opacity: 0 !important;
  transition: opacity 120ms ease !important;
}

body.hardcore-field-reset-window:not(.game-plates-intro) .game-top-plate,
body.hardcore-field-reset-window:not(.game-plates-intro) .game-board-plate,
body.hardcore-field-reset-window:not(.game-plates-intro) .game-skills-plate,
body.hardcore-field-reset-window .game-bang-circle-canvas,
body.hardcore-field-reset-window .game-magnet-circle-canvas,
body.hardcore-field-reset-window .game-lightning-canvas,
body.hardcore-field-reset-window .game-drone-shot-canvas {
  opacity: 0;
}

body.hardcore-ui-theme .pause-button,
body.hardcore-ui-theme .menu-button,
body.hardcore-ui-theme .hardcore-top-button {
  border-color: rgba(248, 113, 113, 0.23);
  color: rgba(254, 226, 226, 0.92);
  background: rgba(0, 0, 0, 0.14);
}

body.hardcore-ui-theme .bar-track {
  background: rgba(107, 114, 128, 0.3);
}

body.hardcore-ui-theme .armor-base-fill {
  background: rgba(120, 120, 120, 0.9);
}

body.hardcore-ui-theme .armor-fill {
  background: rgba(249, 115, 22, 0.96);
}

body.hardcore-ui-theme .armor-damage-fill {
  background: rgba(255, 52, 52, 0.98);
}

body.hardcore-ui-theme .level-fill {
  background: #facc15;
}

body.hardcore-ui-theme .level-gain-fill {
  background: rgba(34, 197, 94, 0.98);
}

body.hardcore-ui-theme .clock-counter,
body.hardcore-ui-theme .clock-center-square {
  background: rgba(0, 0, 0, 0.18);
}

body.hardcore-ui-theme .clock-face {
  color: rgba(248, 113, 113, 0.98);
}

body.hardcore-ui-theme .skill-button {
  border-color: rgba(248, 113, 113, 0.09);
  background: rgba(10, 10, 10, 0.18);
  color: rgba(254, 226, 226, 0.92);
}

body.hardcore-ui-theme .skill-button:disabled,
body.hardcore-ui-theme .skills-panel.skill-dragging .skill-button:not(.bang-skill-button) {
  color: rgba(254, 226, 226, 0.36);
  border-color: rgba(248, 113, 113, 0.07);
  background: rgba(40, 10, 10, 0.14);
}

body.hardcore-field-victory-ui .clock-counter,
body.hardcore-field-victory-ui .clock-center-square,
body.hardcore-field-victory-ui .pause-button,
body.hardcore-field-victory-ui .menu-button,
body.hardcore-field-victory-ui .hardcore-top-button {
  background: rgba(0, 0, 0, 0.18);
}

.defeat-options.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.defeat-options h2 {
  margin: 0 0 4px;
  padding-bottom: 0;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  border-bottom: 0;
}

.defeat-options p {
  order: 0;
  margin: 0 0 9px;
  font-size: 11px;
  line-height: 1.24;
}

.defeat-options p strong {
  font-weight: 900;
}

.defeat-options-actions {
  order: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin: 6px 0 8px;
}

.defeat-options-actions button {
  min-height: 24px;
  padding: 0 6px;
  border: 0;
  color: white;
  background: #2f2417;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.defeat-options-actions button:first-child {
  background: #f97316;
}

.defeat-options-actions button:disabled {
  background: rgba(209, 213, 219, 0.6);
  color: rgba(47, 36, 23, 0.72);
  cursor: not-allowed;
}
















































@media (max-width: 420px) {
  body[data-page="game"] .game-panel {
    --game-control-gap: 14px;
  }

  .skills-panel {
    gap: 8px;
  }

  .clock-panel,
  .top-actions {
    gap: calc(var(--game-control-gap, 14px) * 0.5);
  }

  :root {
    --clock-small-font-size: 14px;
    --clock-large-font-size: 31px;
    --clock-small-letter-spacing: -2px;
    --clock-large-letter-spacing: -4px;
    --clock-small-baseline-shift: 0px;
    --clock-timer-small-gap: 3px;
    --clock-inner-pad-x: 6px;
    --clock-inner-pad-y: 2px;
    --clock-gap: 10px;
  }

  body[data-page="game"] .board,
  .bang-preview-overlay {
    width: 100%;
  }
}

.bang-skill-button {
  --skill-icon-image: url("/assets/ui/skill-bang.png?v=audit-fixes-20260522");
}

.lightning-skill-button {
  --skill-icon-image: url("/assets/ui/skill-lightning.png?v=audit-fixes-20260522");
}

.smoke-skill-button {
  --skill-icon-image: url("/assets/ui/skill-smoke.png?v=audit-fixes-20260522");
}

.magnet-skill-button {
  --skill-icon-image: url("/assets/ui/skill-magnet.png?v=audit-fixes-20260522");
}

.skill-button .power-label-image {
  display: block;
  width: var(--skill-icon-size);
  height: var(--skill-icon-size);
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0;
  background-image: var(--power-label-icon, var(--skill-icon-image));
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  -webkit-text-stroke: 0 !important;
  text-shadow: none !important;
}

.bang-skill-button .power-label-image {
  width: var(--skill-icon-size);
  height: var(--skill-icon-size);
}

.trade-slider-row[data-trade-row="bang"] .trade-item-icon,
.trade-slider-row[data-trade-row="lightning"] .trade-item-icon,
.trade-slider-row[data-trade-row="smoke"] .trade-item-icon,
.trade-slider-row[data-trade-row="magnet"] .trade-item-icon {
  color: transparent;
  font-size: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  -webkit-text-stroke: 0 !important;
  text-shadow: none !important;
}

.trade-slider-row[data-trade-row="bang"] .trade-item-icon {
  background-image: url("/assets/ui/skill-bang.png?v=audit-fixes-20260522");
}

.trade-slider-row[data-trade-row="lightning"] .trade-item-icon {
  background-image: url("/assets/ui/skill-lightning.png?v=audit-fixes-20260522");
}

.trade-slider-row[data-trade-row="smoke"] .trade-item-icon {
  background-image: url("/assets/ui/skill-smoke.png?v=audit-fixes-20260522");
}

.trade-slider-row[data-trade-row="magnet"] .trade-item-icon {
  background-image: url("/assets/ui/skill-magnet.png?v=audit-fixes-20260522");
}

.trade-balance-row > span:first-child::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 22px;
  margin-right: 6px;
  vertical-align: middle;
  background: url("/assets/ui/trade-bomb.png?v=audit-fixes-20260522") center / contain no-repeat;
}

#hardcoreFinishTradeBombsRow > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: transparent;
  font-size: 0;
  -webkit-text-stroke: 0 !important;
  text-shadow: none !important;
}

#hardcoreFinishTradeBombsRow > span:first-child::before {
  content: "";
  width: 22px;
  height: 22px;
  background: url("/assets/ui/trade-bomb.png?v=audit-fixes-20260522") center / contain no-repeat;
}

#hardcoreFinishTradeBombsRow > span:first-child::after {
  content: ":";
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
}

.ui-reward-icon-image {
  display: inline-block;
  width: 1.55em;
  height: 1.55em;
  background-image: var(--ui-reward-icon);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  vertical-align: middle;
  color: transparent;
  font-size: 1em;
  -webkit-text-stroke: 0 !important;
  text-shadow: none !important;
}

.reward-summary-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px 10px;
}

.reward-summary-token {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.reward-summary-amount {
  display: inline-flex;
  align-items: baseline;
  gap: 0.32em;
}

.reward-summary-multiplier-prefix {
  display: inline-block;
  width: auto;
  font-size: 0.33em !important;
  line-height: 1;
  transform: translateY(-0.08em);
  transform-origin: 50% 60%;
}

.reward-summary-icon {
  display: inline-flex;
  width: 1.35em;
  height: 1.35em;
}


.clock-face.clock-face-image {
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0;
  background-image: var(--clock-face-johnny-image);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 82% 82%;
  image-rendering: auto;
  -webkit-text-stroke: 0 !important;
  text-shadow: none !important;
}

.clock-face.clock-face-johnny-normal {
  --clock-face-johnny-image: url("/assets/ui/johnny-normal.png?v=audit-fixes-20260522");
}

.clock-face.clock-face-johnny-hardcore {
  --clock-face-johnny-image: url("/assets/ui/johnny-hardcore.png?v=audit-fixes-20260522");
}

.clock-face.clock-face-johnny-happy {
  --clock-face-johnny-image: url("/assets/ui/johnny-happy.png?v=audit-fixes-20260522");
}


/* Pixel typography v2 */
:root {
  --pixel-stroke: 2px;
  --pixel-shadow-size: 3px;
}

.page-head h1,
.trade-page-head h1,
.stats-level-notification-card h2,
.hardcore-bonus-stage-title,
.hardcore-finish-title,
.hardcore-summary-dialog h2,
.defeat-options h2 {
  font-family: var(--font-pixel) !important;
  text-transform: uppercase;
  font-weight: 400 !important;
  letter-spacing: 0.02em;
  line-height: 1.8;
  color: #ffffff;
  -webkit-text-stroke: var(--pixel-stroke) #000000;
  paint-order: stroke fill;
  text-shadow:
    var(--pixel-shadow-size) 0 0 #000,
    calc(var(--pixel-shadow-size) * -1) 0 0 #000,
    0 var(--pixel-shadow-size) 0 #000,
    0 calc(var(--pixel-shadow-size) * -1) 0 #000,
    var(--pixel-shadow-size) var(--pixel-shadow-size) 0 #000,
    calc(var(--pixel-shadow-size) * -1) var(--pixel-shadow-size) 0 #000,
    var(--pixel-shadow-size) calc(var(--pixel-shadow-size) * -1) 0 #000,
    calc(var(--pixel-shadow-size) * -1) calc(var(--pixel-shadow-size) * -1) 0 #000;
  -webkit-font-smoothing: none;
  font-smooth: never;
  text-rendering: geometricPrecision;
}

.page-head h1 {
  font-size: clamp(18px, 5.2vw, 34px) !important;
}

.trade-page-head h1,
.stats-page-head h1 {
  font-size: clamp(17px, 4.9vw, 30px) !important;
}

.hardcore-finish-title {
  font-size: clamp(18px, 4.9vw, 34px) !important;
}

#pageHardcore.active {
  justify-content: center;
  padding: 22px 18px 32px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#pageHardcore .hardcore-page-plate {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px;
}

#pageHardcore .hardcore-page-head {
  width: 100%;
  max-width: none;
  margin: 0 0 2px;
}

#pageHardcore .hardcore-page-head p {
  max-width: none;
}

.page-button,
.menu-button,
.hardcore-top-button,
.create-action-button,
.purchase-offer-button,
.challenge-day-play-button,
.challenge-day-invite-button,
.challenge-daily-task-button,
.challenge-result-button,
.challenge-share-button,
.chill-clock-purchase-button,
.chill-expired-purchase-button,
.chill-settings-options button,
.chill-settings-actions button,
.defeat-options button,
.hardcore-summary-menu-button,
.stats-appearance-ok-button,
.stats-appearance-purchase-button,
.stats-level-notification-claim {
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font) !important;
  font-weight: 400 !important;
  letter-spacing: 0.055em;
  line-height: 1.1;
  color: rgba(255, 255, 255, 0.96);
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.2);
  paint-order: stroke fill;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.54),
    0 0 8px rgba(0, 0, 0, 0.34);
}

.page-button,
.create-action-button,
.purchase-offer-button,
.challenge-day-play-button,
.challenge-day-invite-button,
.challenge-daily-task-button,
.challenge-result-button,
.challenge-share-button,
.chill-clock-purchase-button,
.chill-expired-purchase-button,
.chill-settings-options button,
.chill-settings-actions button,
.defeat-options button,
.hardcore-summary-menu-button,
.stats-appearance-ok-button,
.stats-appearance-purchase-button,
.stats-level-notification-claim {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.04);
}

.page-button:disabled,
.create-action-button:disabled,
.purchase-offer-button:disabled,
.challenge-day-play-button:disabled,
.challenge-day-invite-button:disabled,
.challenge-daily-task-button:disabled,
.challenge-result-button:disabled,
.challenge-share-button:disabled,
.chill-clock-purchase-button:disabled,
.chill-expired-purchase-button:disabled,
.chill-settings-options button:disabled,
.chill-settings-actions button:disabled,
.defeat-options button:disabled,
.hardcore-summary-menu-button:disabled,
.stats-appearance-ok-button:disabled,
.stats-appearance-purchase-button:disabled,
.stats-level-notification-claim:disabled {
  cursor: default;
  opacity: 0.46;
  filter: grayscale(0.2);
}

.create-size-button,
.create-share-back-button,
.create-share-submit-button,
.skill-cancel-button,
.game-mode-switch-button {
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font) !important;
  font-weight: 400 !important;
  letter-spacing: 0.045em;
  color: rgba(255, 255, 255, 0.96);
  -webkit-text-stroke: 1.4px rgba(255, 255, 255, 0.2);
  paint-order: stroke fill;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.54),
    0 0 8px rgba(0, 0, 0, 0.34);
}

.create-size-button,
.create-share-back-button,
.create-share-submit-button,
.skill-cancel-button {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.04);
}

.purchase-offer-button span,
.purchase-offer-button strong,
.purchase-offer-button b,
.page-button span,
.page-button strong,
.page-button b {
  font-family: "VCR OSD Mono Nova", "VCROSDMonoNova", var(--font) !important;
  font-weight: 400 !important;
  letter-spacing: 0.04em;
}

body[data-page="game"] .top-actions .menu-button,
body[data-page="game"] .top-actions .hardcore-top-button,
body[data-page="game"] .top-actions .game-mode-switch-button,
body[data-page="game"] .top-actions .pause-button,
body[data-page="game"] .clock-panel .chill-clock-time,
body[data-page="game"] .clock-panel .chill-clock-purchase-button {
  text-transform: uppercase;
  text-shadow: none !important;
}

body[data-page="game"] .clock-counter {
  --game-clock-digit-gap-y: 6px;
  --clock-large-font-size: 28px;
  --clock-small-font-size: 13px;
  --clock-digit-optical-y: -2px;
}

body[data-page="game"] .clock-counter-inner,
body[data-page="game"] .clock-counter .digits-layer {
  padding-top: var(--game-clock-digit-gap-y);
  padding-bottom: var(--game-clock-digit-gap-y);
}

body[data-page="game"] .clock-counter .digits-row {
  transform: translateY(var(--clock-digit-optical-y));
}

body[data-page="game"] .clock-counter .digit-group-large {
  align-items: center;
}

body[data-page="game"] .clock-counter .digit-group-small {
  align-items: flex-end;
}

@media (max-width: 640px) {
  .stats-appearance-dialog-backdrop {
    padding: 12px;
  }

  .stats-appearance-dialog {
    width: min(calc(100vw - 24px), 430px);
    max-height: min(84vh, 620px);
    gap: 10px;
    padding: 16px;
  }

  .stats-appearance-dialog h2 {
    font-size: 20px;
  }

  .stats-appearance-picker {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    min-height: 232px;
    padding: 0 34px;
  }

  .stats-appearance-options-track {
    grid-template-columns: minmax(0, 0.68fr) minmax(128px, 1.32fr) minmax(0, 0.68fr);
    align-items: stretch;
    gap: 8px;
    overflow: visible;
  }

  .stats-appearance-option,
  .stats-appearance-arrow {
    height: 232px;
    min-height: 232px;
  }

  .stats-appearance-option {
    align-content: center;
    padding: 10px 5px;
    background: rgba(255, 255, 255, 0.045);
  }

  .stats-appearance-option.is-selected {
    z-index: 2;
    border-color: rgba(250, 204, 21, 0.88);
    background:
      linear-gradient(180deg, rgba(250, 204, 21, 0.18), rgba(250, 204, 21, 0.08)),
      rgba(255, 255, 255, 0.06);
    box-shadow:
      inset 0 0 0 1px rgba(250, 204, 21, 0.26),
      0 0 20px rgba(250, 204, 21, 0.13);
  }

  .stats-appearance-option.is-muted {
    opacity: 0.36;
    filter: blur(0.3px) brightness(0.48) saturate(0.65);
    transform: scale(0.92);
  }

  .stats-appearance-option-preview {
    width: min(76px, 88%);
  }

  .stats-appearance-option.is-selected .stats-appearance-option-preview {
    width: min(122px, 90%);
  }

  .stats-appearance-option > span {
    display: block;
    width: 100%;
    min-height: 20px;
    font-size: 11px;
    line-height: 1.05;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .stats-appearance-option.is-selected > span {
    font-size: 13px;
  }

  .stats-appearance-option.is-muted > span {
    opacity: 0;
  }

  .stats-appearance-arrow {
    position: absolute;
    top: 0;
    z-index: 4;
    width: 30px;
    min-width: 30px;
    padding: 0;
    font-size: 32px;
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.07);
  }

  #statsAppearancePrevButton {
    left: 0;
  }

  #statsAppearanceNextButton {
    right: 0;
  }

  .stats-appearance-lock {
    inset: auto 50% 16px auto;
    width: 40px;
    min-height: 20px;
    transform: translateX(50%);
    font-size: 8px;
  }

  .stats-appearance-perk-info,
  .stats-appearance-purchase-panel,
  .stats-appearance-ok-button {
    min-height: 44px;
  }
}

@media (max-width: 430px) {
  .stats-appearance-panel {
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .stats-avatar-preview {
    max-width: 108px;
  }

  .stats-appearance-row {
    min-height: 34px;
    padding: 7px 8px;
  }

  .stats-appearance-row span,
  .stats-appearance-row strong {
    font-size: 11px;
  }
}

.render-audit-hud {
  position: fixed;
  left: 8px;
  bottom: 8px;
  z-index: 9999;
  max-width: min(360px, calc(100vw - 16px));
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.72);
  color: #d7f7ff;
  font: 10px/1.35 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-line;
  pointer-events: none;
}

/* Character picker final carousel layout. Kept late to override older modal variants. */
.stats-appearance-dialog {
  --appearance-option-size: clamp(118px, 29vw, 154px);
  width: min(100%, 520px);
}

.stats-appearance-dialog h2 {
  text-align: center;
}

.stats-appearance-picker {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  min-height: calc(var(--appearance-option-size) + 10px);
  padding-inline: 0;
  overflow: hidden;
}

.stats-appearance-options-track {
  display: flex;
  grid-template-columns: none;
  grid-auto-flow: initial;
  grid-auto-columns: initial;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: calc(var(--appearance-option-size) + 10px);
  overflow-x: hidden;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: none;
  scrollbar-width: none;
  pointer-events: none;
  touch-action: none;
  -webkit-overflow-scrolling: touch;
}

.stats-appearance-options-track::before,
.stats-appearance-options-track::after {
  content: "";
  flex: 0 0 max(0px, calc((100% - var(--appearance-option-size)) / 2));
  height: 1px;
}

.stats-appearance-options-track::-webkit-scrollbar {
  display: none;
}

.stats-appearance-option {
  flex: 0 0 var(--appearance-option-size);
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
  justify-items: center;
  width: var(--appearance-option-size);
  height: var(--appearance-option-size);
  min-width: var(--appearance-option-size);
  min-height: var(--appearance-option-size);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0);
  background: rgba(255, 255, 255, 0.035);
  scroll-snap-align: center;
  pointer-events: none;
  opacity: 0.62;
  filter: brightness(0.82) saturate(0.82);
  transform: scale(0.92);
  transition:
    opacity 160ms ease,
    filter 160ms ease,
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.stats-appearance-option.is-selected {
  grid-template-rows: minmax(0, 1fr) auto;
  z-index: 2;
  opacity: 1;
  filter: none;
  transform: scale(1);
  border-color: rgba(250, 204, 21, 0.92);
  background:
    linear-gradient(180deg, rgba(250, 204, 21, 0.18), rgba(250, 204, 21, 0.07)),
    rgba(255, 255, 255, 0.055);
  box-shadow:
    inset 0 0 0 1px rgba(250, 204, 21, 0.18),
    0 0 18px rgba(250, 204, 21, 0.12);
}

.stats-appearance-option.is-muted {
  opacity: 0.66;
  filter: brightness(0.72) saturate(0.76);
  transform: scale(0.93);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.015) 62%),
    rgba(255, 255, 255, 0.035);
}

.stats-appearance-option.is-unpurchased:not(.is-selected) {
  opacity: 0.58;
}

.stats-appearance-option-preview {
  position: relative;
  display: block;
  align-self: center;
  justify-self: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: visible;
  aspect-ratio: 1 / 1;
}

.stats-appearance-option-preview::before {
  position: absolute;
  inset: 8%;
  z-index: 0;
  content: "";
  background: radial-gradient(circle, rgba(255, 244, 210, 0.07), rgba(255, 255, 255, 0) 66%);
  pointer-events: none;
}

.stats-appearance-option-preview img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.stats-appearance-option.is-muted .stats-appearance-option-preview {
  opacity: 0.72;
}

.stats-appearance-option.is-muted .stats-appearance-option-preview img {
  opacity: 0.78;
  filter: blur(1.5px) brightness(0.68) saturate(0.72);
}

.stats-appearance-option.is-muted .stats-appearance-lock {
  display: none;
}

.stats-appearance-option > span:not(.stats-appearance-option-preview) {
  display: none;
  width: 100%;
  min-width: 0;
  min-height: 18px;
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-appearance-option.is-selected > span:not(.stats-appearance-option-preview) {
  display: block;
}

.stats-appearance-option.is-muted > span:not(.stats-appearance-option-preview) {
  opacity: 0;
}

.stats-appearance-arrow {
  position: absolute;
  top: 50%;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  height: 72px;
  min-height: 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.42);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 8px 18px rgba(0, 0, 0, 0.22);
  opacity: 0.86;
  pointer-events: auto;
  transform: translateY(-50%);
}

.stats-appearance-arrow:hover,
.stats-appearance-arrow:focus-visible {
  color: #fff;
  opacity: 1;
  outline: none;
}

#statsAppearancePrevButton {
  left: 8px;
}

#statsAppearanceNextButton {
  right: 8px;
}

.stats-appearance-perk-info {
  display: grid;
  box-sizing: border-box;
  height: 106px;
  align-content: center;
  gap: 4px;
  padding: 10px 12px;
  color: rgba(255, 244, 238, 0.9);
  font-size: 11px;
  line-height: 1.25;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
}

.stats-appearance-perk-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.stats-appearance-perk-label {
  color: rgba(255, 244, 238, 0.95);
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
}

.stats-appearance-perk-value {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: left;
}

.stats-appearance-purchase-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 10px;
  min-height: 46px;
}

.stats-appearance-purchase-panel.hidden {
  display: grid;
}

.stats-appearance-purchase-panel.is-owned,
.stats-appearance-purchase-panel.is-locked {
  grid-template-columns: minmax(0, 1fr);
}

.stats-appearance-status-text {
  display: grid;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  color: rgba(255, 244, 238, 0.9);
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.055);
}

@media (max-width: 640px) {
  .stats-appearance-dialog {
    --appearance-option-size: clamp(112px, 36vw, 150px);
  }

  .stats-appearance-picker {
    min-height: calc(var(--appearance-option-size) + 8px);
    padding-inline: 0;
  }

  .stats-appearance-options-track {
    height: calc(var(--appearance-option-size) + 8px);
    overflow-x: hidden;
    overflow-y: hidden;
  }

  .stats-appearance-option {
    width: var(--appearance-option-size);
    height: var(--appearance-option-size);
    min-width: var(--appearance-option-size);
    min-height: var(--appearance-option-size);
    padding: 8px;
  }

  .stats-appearance-arrow {
    height: auto;
  }

  .stats-appearance-option-preview,
  .stats-appearance-option.is-selected .stats-appearance-option-preview {
    width: 100%;
    height: 100%;
  }

  .stats-appearance-option > span:not(.stats-appearance-option-preview),
  .stats-appearance-option.is-selected > span:not(.stats-appearance-option-preview) {
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
  }

  .stats-appearance-arrow {
    width: 32px;
    min-width: 32px;
    height: 62px;
    min-height: 0;
    font-size: 30px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(0, 0, 0, 0.42);
  }

  .stats-appearance-lock {
    inset: auto 50% 12px auto;
    transform: translateX(50%);
  }
}

/* Final tutorial rebuild overrides. Keep after legacy tutorial CSS. */
body[data-page="learn"],
body[data-page="learn"] .app {
  background: #050505;
}

.tutorial-page {
  position: relative;
  min-height: var(--app-stable-height);
  overflow: hidden;
  background: #050505;
  color: #fff;
  isolation: isolate;
  --tutorial-story-width: min(calc(100vw - var(--scroll-gap, 16px) * 6), 430px);
}

.tutorial-page[data-tutorial-mode="intro"],
.tutorial-page[data-tutorial-mode="lore"],
.tutorial-page[data-tutorial-mode="modes"] {
  background: #050505;
}

.tutorial-spark-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tutorial-view {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--scroll-gap, 16px);
  width: 100%;
  max-width: 100%;
  min-height: var(--app-stable-height);
  padding: max(var(--scroll-gap, 16px), env(safe-area-inset-top)) var(--scroll-gap, 16px)
    max(var(--scroll-gap, 16px), env(safe-area-inset-bottom));
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transform: none;
  transition: opacity 520ms ease;
}

.tutorial-view.active {
  opacity: 1;
  pointer-events: auto;
}

.tutorial-view.is-fading {
  opacity: 0;
  pointer-events: none;
}

.tutorial-pixel-text {
  font-family: var(--font-vcr);
  font-synthesis: none;
  letter-spacing: 0.03em;
  text-shadow:
    1px 0 rgba(0, 0, 0, 0.68),
    -1px 0 rgba(0, 0, 0, 0.68),
    0 1px rgba(0, 0, 0, 0.68),
    0 -1px rgba(0, 0, 0, 0.68);
}

.tutorial-image-slot {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--tutorial-story-width);
  aspect-ratio: 1;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.56);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.015)),
    rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.56);
  font: 400 clamp(16px, 3.8vw, 22px)/1.3 var(--font-vcr);
  box-sizing: border-box;
}

.tutorial-image-slot::after {
  content: attr(data-image-label);
}

.tutorial-intro-view {
  grid-template-rows: auto auto auto;
}

.tutorial-intro-image {
  width: min(var(--tutorial-story-width), 38vh);
  opacity: 0;
  animation: tutorialCleanReveal 1800ms ease forwards;
}

.tutorial-intro-text {
  display: grid;
  gap: 0.78em;
  width: var(--tutorial-story-width);
  text-align: center;
  font-size: clamp(16px, 4.2vw, 24px);
  line-height: 1.55;
}

.tutorial-text-line {
  opacity: 0;
  transition: opacity 520ms ease;
}

.tutorial-text-line.visible {
  opacity: 1;
}

.tutorial-actions,
.tutorial-intro-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--scroll-gap, 16px);
  width: var(--tutorial-story-width);
  justify-items: stretch;
}

.tutorial-action-button,
.tutorial-wide-button {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: clamp(64px, 8.4vh, 82px);
  opacity: 0;
  pointer-events: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 360ms ease, transform 160ms ease;
}

.tutorial-action-button.visible,
.tutorial-wide-button.visible {
  opacity: 1;
  pointer-events: auto;
}

.tutorial-action-button:active,
.tutorial-wide-button:active {
  transform: scale(0.985);
}

.tutorial-lore-view,
.tutorial-modes-view {
  grid-template-rows: auto auto auto;
  align-content: center;
}

.tutorial-lore-image,
.tutorial-lore-text,
#tutorialLoreNextButton {
  opacity: 0;
  transition: opacity 520ms ease;
}

.tutorial-lore-image.visible,
.tutorial-lore-text.visible,
#tutorialLoreNextButton.visible {
  opacity: 1;
}

.tutorial-lore-text {
  width: var(--tutorial-story-width);
  min-height: 4.2em;
  text-align: center;
  font-size: clamp(18px, 4vw, 24px);
  line-height: 1.46;
}

.tutorial-modes-card {
  display: grid;
  gap: calc(var(--scroll-gap, 16px) * 0.7);
  width: var(--tutorial-story-width);
  padding: calc(var(--scroll-gap, 16px) * 1.25);
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.04);
  box-sizing: border-box;
}

.tutorial-modes-card h2 {
  margin: 0 0 0.15em;
  font: 400 clamp(18px, 4.4vw, 26px)/1.25 var(--font-vcr);
  text-align: center;
}

.tutorial-modes-card p {
  margin: 0;
  font: 400 clamp(13px, 3.4vw, 17px)/1.5 var(--font-vcr);
}

.tutorial-close-button,
.tutorial-engine-close-button {
  position: absolute;
  top: max(var(--scroll-gap, 14px), env(safe-area-inset-top));
  right: max(var(--scroll-gap, 14px), env(safe-area-inset-right));
  z-index: 50;
  display: grid;
  place-items: center;
  width: calc(var(--touch-target-size, 48px) * 0.72);
  height: calc(var(--touch-target-size, 48px) * 0.72);
  padding: 0;
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.72);
  background: rgba(0, 0, 0, 0.24);
  box-sizing: border-box;
  color: transparent;
  font-size: 0;
  touch-action: manipulation;
  overflow: hidden;
}

.tutorial-close-button::before,
.tutorial-close-button::after,
.tutorial-engine-close-button::before,
.tutorial-engine-close-button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62%;
  height: 12%;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.38);
}

.tutorial-close-button::before,
.tutorial-engine-close-button::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.tutorial-close-button::after,
.tutorial-engine-close-button::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.tutorial-close-button.hidden,
.tutorial-engine-close-button.hidden {
  display: none;
}

.tutorial-exit-dialog,
.tutorial-engine-exit-dialog {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: var(--scroll-gap, 16px);
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(8px);
}

.tutorial-exit-dialog.is-hidden,
.tutorial-engine-exit-dialog.is-hidden {
  display: none;
}

.tutorial-exit-card,
.tutorial-engine-exit-card {
  display: grid;
  gap: var(--scroll-gap, 16px);
  width: min(calc(100vw - var(--scroll-gap, 16px) * 3), 520px);
  padding: calc(var(--scroll-gap, 16px) * 1.5);
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.58);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.04)),
    rgba(58, 92, 134, 0.82);
  box-sizing: border-box;
  text-align: center;
}

.tutorial-exit-card p,
.tutorial-engine-exit-card p {
  margin: 0;
  font: 400 clamp(16px, 4vw, 22px)/1.35 var(--font-vcr);
}

.tutorial-exit-actions,
.tutorial-engine-exit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--scroll-gap, 16px);
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-page {
  --tutorial-engine-text-inset: var(--scroll-gap, 16px);
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate,
body.tutorial-runtime-active.tutorial-mechanics-active .game-board-plate,
body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate {
  transition: opacity 720ms ease, filter 720ms ease;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate {
  position: relative;
  min-height: 0 !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-top-plate > :not(.tutorial-engine-text):not(.tutorial-engine-close-button) {
  opacity: 0;
  pointer-events: none;
}

body.tutorial-runtime-active.tutorial-mechanics-active.tutorial-engine-hud-visible .game-top-plate > :not(.tutorial-engine-text):not(.tutorial-engine-close-button) {
  opacity: 1 !important;
  pointer-events: none !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active.tutorial-engine-hud-visible .tutorial-engine-text,
body.tutorial-runtime-active.tutorial-mechanics-active.tutorial-engine-hint-hidden .tutorial-engine-text {
  opacity: 0 !important;
  pointer-events: none !important;
}

.tutorial-engine-text {
  position: absolute;
  inset: 8px;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  max-height: calc(100% - 16px);
  padding: 7px 8px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: clamp(8px, 1.75vw, 11px);
  line-height: 1.2;
  opacity: 0;
  box-sizing: border-box;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 360ms ease;
}

.tutorial-engine-text.visible {
  opacity: 1;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate {
  position: relative;
  overflow: hidden;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate .skill-button {
  filter: blur(3px) grayscale(0.1);
  opacity: 0.32;
  pointer-events: auto;
}

body.tutorial-runtime-active.tutorial-mechanics-active .game-skills-plate .skill-button.tutorial-engine-skill-focus {
  position: relative;
  z-index: 4;
  filter: none;
  opacity: 1;
  box-shadow: inset 0 0 0 var(--game-line-width, 1px) rgba(255, 255, 255, 0.68), 0 0 20px rgba(255, 219, 76, 0.32);
}

.tutorial-engine-skill-gate {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgba(20, 40, 78, 0.76);
  -webkit-backdrop-filter: blur(18px) saturate(90%);
  backdrop-filter: blur(18px) saturate(90%);
  pointer-events: none;
}

.tutorial-engine-skill-gate.is-hidden {
  display: none;
}

.tutorial-engine-interface-card {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 45;
  display: grid;
  gap: calc(var(--scroll-gap, 16px) * 0.7);
  width: min(calc(100vw - var(--scroll-gap, 16px) * 4), 520px);
  max-height: calc(var(--app-stable-height) - var(--scroll-gap, 16px) * 6);
  padding: calc(var(--scroll-gap, 16px) * 1.2);
  transform: translate(-50%, -50%);
  border: var(--game-line-width, 1px) solid rgba(255, 255, 255, 0.62);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04)),
    rgba(48, 80, 122, 0.86);
  backdrop-filter: blur(10px);
  box-sizing: border-box;
}

.tutorial-engine-interface-card.is-hidden {
  display: none;
}

.tutorial-engine-interface-card h2 {
  margin: 0;
  text-align: center;
  font: 400 clamp(18px, 4.2vw, 26px)/1.25 var(--font-vcr);
}

.tutorial-engine-interface-card p {
  margin: 0;
  font: 400 clamp(12px, 3vw, 16px)/1.45 var(--font-vcr);
}

.tutorial-interface-next {
  width: 100%;
  margin-top: calc(var(--scroll-gap, 16px) * 0.3);
}

body.tutorial-runtime-active.tutorial-engine-transitioning .game-board-plate,
body.tutorial-runtime-active.tutorial-engine-transitioning .game-skills-plate,
body.tutorial-runtime-active.tutorial-engine-transitioning .tutorial-engine-text {
  opacity: 0;
  pointer-events: none;
}

@keyframes tutorialCleanReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 520px) {
  .tutorial-page {
    --tutorial-story-width: min(calc(100vw - var(--scroll-gap, 16px) * 4), 430px);
  }

  .tutorial-lore-text {
    min-height: 4.8em;
  }

  .tutorial-engine-text {
    font-size: clamp(10px, 2.6vw, 14px);
    line-height: 1.36;
  }
}

body.tutorial-runtime-active.tutorial-mechanics-active .tutorial-engine-text {
  display: grid !important;
  align-items: center !important;
  pointer-events: none;
}

body.tutorial-runtime-active.tutorial-mechanics-active .tutorial-engine-text.visible {
  pointer-events: auto !important;
}

body.tutorial-runtime-active.tutorial-mechanics-active .tutorial-engine-text-reserve,
body.tutorial-runtime-active.tutorial-mechanics-active .tutorial-engine-text-visible {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  white-space: pre-wrap;
}

body.tutorial-runtime-active.tutorial-mechanics-active .tutorial-engine-text-reserve {
  visibility: hidden;
  pointer-events: none;
}

body.tutorial-runtime-active.tutorial-mechanics-active .tutorial-engine-text-visible {
  pointer-events: none;
}
