:root {
  --navy: #06183f;
  --navy-deep: #02091b;
  --blue: #0878e8;
  --blue-bright: #26a8ff;
  --white: #f8fbff;
  --ice: #ccecff;
  --gold: #ffcf3f;
  --green: #4ae39b;
  --red: #ff5d5d;
  --ink: #07112b;
  --muted: #7790b5;
  --panel: rgba(7, 26, 70, 0.92);
  --line: rgba(178, 224, 255, 0.25);
  --world-accent: #29a8ff;
  --world-glow: rgba(41, 168, 255, 0.34);
  --pixel-shadow: 5px 5px 0 rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  color-scheme: dark;
  background: var(--navy-deep);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--white);
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 80% 18%, var(--world-glow), transparent 32rem),
    linear-gradient(145deg, var(--navy), var(--navy-deep) 70%);
  background-size: 32px 32px, 32px 32px, auto, auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  transition: background 500ms ease;
}

body[data-world="1"] {
  --world-accent: #f5fbff;
  --world-glow: rgba(20, 129, 255, 0.42);
}

body[data-world="2"] {
  --world-accent: #43e5ff;
  --world-glow: rgba(35, 205, 240, 0.3);
}

body[data-world="3"] {
  --world-accent: #ff7a31;
  --world-glow: rgba(255, 85, 24, 0.35);
}

body[data-world="4"] {
  --world-accent: #c7f4ff;
  --world-glow: rgba(134, 218, 255, 0.35);
}

body[data-world="5"] {
  --world-accent: #9b73ff;
  --world-glow: rgba(117, 73, 255, 0.4);
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(100% - 28px, 1440px);
  margin-inline: auto;
}

.menu-screen {
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 0 max(28px, env(safe-area-inset-bottom));
}

.menu-header,
.game-header {
  display: flex;
  align-items: center;
}

.menu-header {
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.mini-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.brand-cube {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--navy);
  background: var(--white);
  border: 3px solid var(--blue-bright);
  box-shadow: 4px 4px 0 var(--blue);
  font-weight: 1000;
}

.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.offline-badge::before {
  width: 8px;
  height: 8px;
  background: var(--gold);
  border-radius: 50%;
  content: "";
}

.offline-badge.ready::before {
  background: var(--green);
  box-shadow: 0 0 14px var(--green);
}

.menu-hero {
  display: grid;
  min-height: 560px;
  padding: clamp(46px, 8vw, 110px) 0;
  grid-template-columns: minmax(0, 0.95fr) minmax(300px, 0.75fr);
  align-items: center;
  gap: clamp(30px, 7vw, 110px);
}

.eyebrow,
.panel-kicker {
  margin: 0;
  color: var(--world-accent);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin: 15px 0 24px;
  font-size: clamp(4.7rem, 10vw, 9.8rem);
  font-weight: 1000;
  letter-spacing: -0.09em;
  line-height: 0.68;
  text-transform: uppercase;
}

h1 span {
  display: block;
  margin-left: 0.18em;
  color: var(--blue-bright);
  -webkit-text-stroke: 2px var(--white);
  text-shadow: 7px 7px 0 var(--blue);
}

.hero-intro {
  max-width: 570px;
  color: #b6c9e6;
  font-size: clamp(14px, 1.7vw, 18px);
  line-height: 1.65;
}

.menu-actions,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 26px;
}

.primary-action,
.secondary-action {
  min-height: 48px;
  padding: 13px 20px;
  border: 2px solid var(--white);
  cursor: pointer;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.primary-action {
  color: var(--navy);
  background: var(--world-accent);
  box-shadow: 5px 5px 0 var(--blue);
}

.primary-action:hover {
  box-shadow: 2px 2px 0 var(--blue);
  transform: translate(3px, 3px);
}

.secondary-action {
  background: transparent;
}

.secondary-action:hover {
  color: var(--world-accent);
  border-color: var(--world-accent);
}

.career-stats {
  display: grid;
  max-width: 650px;
  margin: 35px 0 0;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
}

.career-stats div {
  padding: 12px;
}

.career-stats div + div {
  border-left: 1px solid var(--line);
}

.career-stats dt {
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.career-stats dd {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 1000;
}

#menu-dragon-name {
  color: var(--gold);
  font-size: 15px;
}

.dragon-core {
  position: relative;
  display: grid;
  width: min(34vw, 430px);
  aspect-ratio: 1;
  place-items: center;
  justify-self: center;
  perspective: 700px;
}

.dragon-avatar {
  --dragon-color: #1689e8;
  --dragon-light: #8fdfff;
  position: relative;
  z-index: 3;
  width: 46%;
  aspect-ratio: 1;
  filter: drop-shadow(10px 12px 0 rgba(0, 0, 0, 0.36));
  animation: dragon-float 3.2s ease-in-out infinite;
}

.dragon-avatar[data-stage="1"] {
  --dragon-color: #24a9ff;
}

.dragon-avatar[data-stage="3"] {
  --dragon-color: #137eea;
  --dragon-light: #b5efff;
}

.dragon-avatar[data-stage="4"] {
  --dragon-color: #6657f4;
  --dragon-light: #d2c7ff;
  filter: drop-shadow(0 0 28px rgba(90, 204, 255, 0.8)) drop-shadow(10px 12px 0 rgba(0, 0, 0, 0.36));
}

.dragon-avatar[data-stage="5"] {
  --dragon-color: #7848ed;
  --dragon-light: #fff0a8;
  filter: drop-shadow(0 0 34px rgba(255, 210, 61, 0.78)) drop-shadow(10px 12px 0 rgba(0, 0, 0, 0.36));
}

.dragon-egg {
  position: absolute;
  inset: 11% 18% 4%;
  overflow: hidden;
  background: linear-gradient(145deg, var(--white), #8bd7ff 60%, var(--dragon-color));
  border: 4px solid var(--white);
  border-radius: 48% 48% 42% 42%;
  box-shadow:
    inset 12px 5px 0 rgba(255, 255, 255, 0.42),
    inset -12px -9px 0 rgba(0, 42, 115, 0.25);
}

.dragon-egg::before,
.dragon-egg::after,
.dragon-egg i {
  position: absolute;
  width: 24%;
  aspect-ratio: 1;
  background: var(--dragon-color);
  content: "";
  transform: rotate(45deg);
}

.dragon-egg::before {
  top: 26%;
  left: 17%;
}

.dragon-egg::after {
  right: 14%;
  bottom: 20%;
}

.dragon-egg i {
  right: 27%;
  top: 15%;
  width: 13%;
}

.dragon-egg b {
  display: none;
}

.dragon-avatar[data-stage="1"] .dragon-egg b {
  position: absolute;
  top: 3%;
  left: 43%;
  display: block;
  width: 7px;
  height: 52%;
  background: var(--navy);
  clip-path: polygon(0 0, 100% 0, 48% 27%, 100% 43%, 25% 70%, 74% 100%, 0 100%, 34% 72%, 0 51%, 59% 26%);
}

.dragon-creature {
  position: absolute;
  inset: 0;
  display: none;
}

.dragon-avatar:not([data-stage="0"]):not([data-stage="1"]) .dragon-egg {
  display: none;
}

.dragon-avatar:not([data-stage="0"]):not([data-stage="1"]) .dragon-creature {
  display: block;
}

.dragon-body,
.dragon-head,
.dragon-wing,
.dragon-tail {
  position: absolute;
  background: var(--dragon-color);
  border: 4px solid var(--white);
  box-shadow: inset -8px -8px 0 rgba(0, 26, 92, 0.24);
}

.dragon-body {
  right: 23%;
  bottom: 10%;
  left: 23%;
  height: 48%;
  clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%);
}

.dragon-head {
  top: 12%;
  right: 16%;
  left: 16%;
  height: 45%;
}

.dragon-eye {
  position: absolute;
  top: 34%;
  width: 11%;
  aspect-ratio: 1;
  background: var(--gold);
  border: 2px solid var(--white);
  box-shadow: inset 3px 0 0 var(--navy);
}

.eye-left {
  left: 18%;
}

.eye-right {
  right: 18%;
}

.dragon-snout {
  position: absolute;
  right: 27%;
  bottom: -12%;
  left: 27%;
  height: 32%;
  background: var(--dragon-light);
  border: 3px solid var(--white);
}

.dragon-snout::before,
.dragon-snout::after {
  position: absolute;
  top: 35%;
  width: 5px;
  height: 5px;
  background: var(--navy);
  content: "";
}

.dragon-snout::before {
  left: 25%;
}

.dragon-snout::after {
  right: 25%;
}

.dragon-tail {
  right: 3%;
  bottom: 9%;
  width: 38%;
  height: 17%;
  clip-path: polygon(0 0, 100% 32%, 70% 100%, 0 78%);
}

.dragon-wing {
  top: 38%;
  display: none;
  width: 34%;
  height: 42%;
  background: var(--dragon-light);
}

.wing-left {
  left: -4%;
  clip-path: polygon(100% 0, 72% 100%, 40% 68%, 0 76%, 22% 14%);
}

.wing-right {
  right: -4%;
  clip-path: polygon(0 0, 28% 100%, 60% 68%, 100% 76%, 78% 14%);
}

.dragon-avatar[data-stage="3"] .dragon-wing,
.dragon-avatar[data-stage="4"] .dragon-wing,
.dragon-avatar[data-stage="5"] .dragon-wing {
  display: block;
}

.dragon-horn {
  position: absolute;
  top: -28%;
  display: none;
  width: 22%;
  height: 34%;
  background: var(--gold);
  border: 3px solid var(--white);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.horn-left {
  left: 7%;
}

.horn-right {
  right: 7%;
}

.dragon-avatar[data-stage="4"] .dragon-horn,
.dragon-avatar[data-stage="5"] .dragon-horn {
  display: block;
}

.dragon-crown {
  position: absolute;
  top: -34%;
  left: 35%;
  display: none;
  width: 30%;
  padding: 5px 0;
  color: var(--navy);
  background: var(--gold);
  border: 3px solid var(--white);
  font-size: 17px;
  text-align: center;
}

.dragon-avatar[data-stage="5"] .dragon-crown {
  display: block;
}

.dragon-evolution-card {
  position: absolute;
  right: 12%;
  bottom: 2%;
  left: 12%;
  z-index: 5;
  padding: 10px 12px;
  background: rgba(2, 9, 27, 0.88);
  border: 1px solid var(--line);
  text-align: center;
}

.dragon-evolution-card strong,
.dragon-evolution-card span {
  display: block;
}

.dragon-evolution-card strong {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.dragon-evolution-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.evolution-track {
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.09);
}

.evolution-track i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--blue-bright), var(--gold));
  transition: width 300ms ease;
}

.core-cube,
.voxel {
  border: 3px solid var(--white);
  background: var(--blue);
  box-shadow:
    inset 13px 13px 0 rgba(255, 255, 255, 0.2),
    inset -14px -14px 0 rgba(0, 0, 0, 0.24),
    10px 10px 0 rgba(0, 0, 0, 0.35);
}

.core-cube {
  z-index: 3;
  display: grid;
  width: 41%;
  aspect-ratio: 1;
  place-items: center;
  animation: core-float 3.2s ease-in-out infinite;
  transform: rotateX(56deg) rotateZ(45deg);
}

.core-cube span {
  color: var(--white);
  font-size: clamp(3rem, 8vw, 7rem);
  font-weight: 1000;
  transform: rotateZ(-45deg) rotateX(-35deg);
}

.core-orbit {
  position: absolute;
  border: 2px solid rgba(115, 204, 255, 0.45);
  border-radius: 50%;
}

.orbit-one {
  inset: 12%;
  animation: orbit 9s linear infinite;
}

.orbit-two {
  inset: 25%;
  border-style: dashed;
  animation: orbit 6s linear infinite reverse;
}

.voxel {
  position: absolute;
  width: 12%;
  aspect-ratio: 1;
  animation: voxel-drift 4s ease-in-out infinite;
}

.voxel-one {
  top: 10%;
  left: 14%;
}

.voxel-two {
  right: 9%;
  bottom: 25%;
  animation-delay: -1.4s;
}

.voxel-three {
  bottom: 8%;
  left: 28%;
  animation-delay: -2.6s;
}

.world-map {
  padding: clamp(55px, 7vw, 90px) 0 35px;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 26px;
}

.section-heading h2 {
  margin: 8px 0 0;
  font-size: clamp(2.2rem, 5vw, 4.5rem);
  letter-spacing: -0.07em;
  line-height: 0.9;
}

.section-heading > p {
  max-width: 380px;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.world-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 9px;
}

.world-card {
  position: relative;
  min-height: 196px;
  padding: 16px;
  overflow: hidden;
  background: linear-gradient(145deg, var(--card-color), rgba(3, 12, 35, 0.96) 70%);
  border: 1px solid var(--line);
}

.world-card::after {
  position: absolute;
  right: -14px;
  bottom: -24px;
  color: rgba(255, 255, 255, 0.08);
  content: attr(data-number);
  font-size: 110px;
  font-weight: 1000;
  line-height: 1;
}

.world-card.locked {
  filter: grayscale(0.9);
  opacity: 0.48;
}

.world-card h3 {
  position: relative;
  z-index: 1;
  margin: 7px 0 4px;
  font-size: 17px;
  line-height: 1;
}

.world-card > span,
.world-card > p {
  position: relative;
  z-index: 1;
}

.world-card > span {
  color: rgba(255, 255, 255, 0.65);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.world-card > p {
  min-height: 35px;
  margin: 10px 0 15px;
  color: #a9bad8;
  font-size: 10px;
  line-height: 1.45;
}

.mission-dots {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 5px;
}

.mission-dot {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 8px;
  font-weight: 950;
}

.mission-dot.unlocked {
  color: var(--white);
  background: var(--blue);
  border-color: var(--ice);
}

.mission-dot.complete {
  color: var(--navy);
  background: var(--green);
  border-color: var(--green);
}

.mission-dot.boss::after {
  content: "◆";
  font-size: 7px;
}

.mission-dot.boss {
  font-size: 0;
}

.menu-help {
  margin: 12px 0 0;
  color: rgba(170, 193, 225, 0.56);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

/* Game screen */
.game-screen {
  min-height: 100dvh;
  padding: max(8px, env(safe-area-inset-top)) 0 max(8px, env(safe-area-inset-bottom));
}

.game-header {
  min-height: 52px;
  padding: 7px 10px;
  gap: 9px;
  background: rgba(2, 9, 27, 0.9);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--white);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
}

.icon-button:hover {
  color: var(--world-accent);
  border-color: var(--world-accent);
}

.level-identity {
  min-width: 0;
  flex: 1;
}

.level-identity span,
.level-identity strong,
.header-score span,
.header-score strong {
  display: block;
}

.level-identity span,
.header-score span {
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.level-identity strong {
  margin-top: 2px;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-score {
  min-width: 88px;
  text-align: right;
}

.header-score strong {
  margin-top: 1px;
  color: var(--world-accent);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.game-stage {
  display: grid;
  min-height: calc(100dvh - 132px);
  padding: 10px 0;
  grid-template-columns: minmax(180px, 0.8fr) auto minmax(180px, 0.8fr);
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.1vw, 30px);
}

.side-panel {
  width: min(100%, 245px);
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--pixel-shadow);
}

.mission-panel {
  justify-self: end;
}

.gear-panel {
  justify-self: start;
}

.mission-panel h2 {
  margin: 8px 0 10px;
  font-size: clamp(1.4rem, 2vw, 2rem);
  letter-spacing: -0.06em;
  line-height: 0.95;
}

.mission-copy,
.world-effect {
  color: #a9bddc;
  font-size: 10px;
  line-height: 1.5;
}

.mission-copy {
  min-height: 45px;
}

.mission-meter {
  margin-top: 15px;
}

.meter-label,
.dragon-meter-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meter-label span,
.dragon-meter-copy span {
  color: var(--muted);
}

.meter-track,
.dragon-track {
  height: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

.meter-track i,
.dragon-track i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue-bright);
  transition: width 180ms ease;
}

.crystal-track i {
  background: var(--gold);
}

.combo-card {
  display: flex;
  margin-top: 18px;
  padding: 10px;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.combo-card span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.combo-card strong {
  color: var(--gold);
  font-size: 18px;
}

.world-effect {
  min-height: 31px;
  margin: 14px 0 0;
  color: var(--world-accent);
}

.boss-intel {
  margin-top: 13px;
  padding: 9px;
  background: rgba(255, 73, 73, 0.1);
  border: 1px solid rgba(255, 112, 92, 0.58);
}

.boss-intel span,
.boss-intel strong {
  display: block;
}

.boss-intel span {
  color: #ff8f77;
  font-size: 8px;
  font-weight: 1000;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.boss-intel strong {
  margin-top: 4px;
  font-size: 9px;
  line-height: 1.35;
}

.board-column {
  width: min(100%, 330px);
}

.board-frame {
  position: relative;
  width: min(100%, 300px);
  margin-inline: auto;
  overflow: hidden;
  background: #020818;
  border: 4px solid var(--white);
  box-shadow:
    0 0 0 5px var(--blue),
    10px 10px 0 rgba(0, 0, 0, 0.48);
}

.board-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
}

.board-frame.power-pickaxe::after {
  background: linear-gradient(
    125deg,
    transparent 34%,
    rgba(255, 217, 62, 0.92) 47%,
    #fff 50%,
    transparent 65%
  );
  animation: power-sweep 700ms ease-out;
}

.board-frame.power-tnt {
  animation: board-blast 520ms ease both;
}

.board-frame.power-tnt::after {
  background: radial-gradient(
    circle at 50% 68%,
    rgba(255, 246, 157, 0.98),
    rgba(255, 87, 38, 0.72) 24%,
    transparent 57%
  );
  animation: power-bloom 700ms ease-out;
}

.board-frame.power-slow::after {
  background: radial-gradient(circle, rgba(140, 240, 255, 0.1), rgba(45, 132, 255, 0.5));
  box-shadow: inset 0 0 60px rgba(159, 240, 255, 0.84);
  animation: power-bloom 750ms ease-out;
}

.board-frame.power-dragon::after {
  background: linear-gradient(
    to top,
    rgba(255, 213, 54, 0.98),
    rgba(54, 184, 255, 0.65) 36%,
    transparent 76%
  );
  animation: dragon-wave 750ms ease-out;
}

.board-frame.time-slowed {
  box-shadow:
    0 0 0 5px #7de9ff,
    0 0 28px rgba(77, 205, 255, 0.62),
    10px 10px 0 rgba(0, 0, 0, 0.48);
}

.board-frame.time-slowed #game-canvas {
  filter: saturate(1.2) brightness(1.08);
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 2;
  touch-action: none;
}

.event-banner {
  position: absolute;
  top: 42%;
  right: 0;
  left: 0;
  z-index: 5;
  padding: 10px;
  color: var(--navy);
  background: var(--world-accent);
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: 0.09em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-105%);
}

.event-banner.show {
  animation: banner-pass 1.25s ease both;
}

.boss-strip {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 4;
  display: flex;
  padding: 6px 8px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: linear-gradient(90deg, rgba(110, 8, 35, 0.94), rgba(255, 73, 73, 0.84));
  border-bottom: 2px solid #ffcc58;
  pointer-events: none;
  text-transform: uppercase;
}

.boss-strip span {
  color: #ffd6cc;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.boss-strip strong {
  font-size: 9px;
}

.dragon-meter {
  display: grid;
  margin-top: 12px;
  padding: 10px;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 7px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.dragon-meter-copy {
  margin: 0;
  grid-column: 1;
  flex-wrap: wrap;
}

.dragon-meter-copy small {
  display: block;
  width: 100%;
  margin-top: 2px;
  color: var(--ice);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: none;
}

.dragon-meter.is-ready {
  border-color: var(--gold);
  animation: ready-pulse 1.1s ease-in-out infinite;
}

.dragon-track {
  grid-column: 1;
}

.dragon-track i {
  background: linear-gradient(90deg, var(--blue-bright), var(--white));
}

.dragon-meter button {
  min-height: 36px;
  padding: 6px 10px;
  color: var(--navy);
  background: var(--gold);
  border: 2px solid var(--white);
  cursor: pointer;
  font-size: 8px;
  font-weight: 1000;
  grid-column: 2;
  grid-row: 1 / span 2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dragon-meter button:disabled {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.32;
}

.preview-card {
  padding: 9px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
}

.preview-card + .preview-card {
  margin-top: 9px;
}

.preview-card > span {
  display: block;
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.preview-card canvas {
  display: block;
  width: 100%;
  max-width: 112px;
  height: auto;
  margin: 3px auto 0;
}

.companion-card {
  margin-top: 9px;
  padding: 9px;
  background: linear-gradient(135deg, rgba(35, 155, 255, 0.16), rgba(255, 207, 63, 0.07));
  border: 1px solid var(--line);
}

.companion-card span,
.companion-card strong,
.companion-card small {
  display: block;
}

.companion-card span {
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.companion-card strong {
  margin-top: 4px;
  color: var(--gold);
  font-size: 10px;
}

.companion-card small {
  margin-top: 3px;
  color: var(--ice);
  font-size: 8px;
}

.power-grid {
  display: grid;
  margin-top: 11px;
  gap: 7px;
}

.power-button {
  position: relative;
  display: grid;
  min-height: 48px;
  padding: 6px 8px;
  grid-template-columns: 32px 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  color: var(--white);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
}

.power-button > span {
  grid-column: 1;
  grid-row: 1 / span 2;
  color: var(--world-accent);
  font-size: 15px;
  font-weight: 1000;
  text-align: center;
}

.power-button strong {
  grid-column: 2;
  grid-row: 1;
  font-size: 9px;
}

.power-button em {
  grid-column: 2;
  grid-row: 2;
  color: #a8cfff;
  font-size: 7px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
}

.power-button small {
  grid-column: 3;
  grid-row: 1 / span 2;
  color: var(--gold);
  font-size: 9px;
  font-weight: 1000;
}

.power-button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.power-button.is-using {
  animation: power-button-burst 700ms ease both;
}

.power-button.is-active,
.power-button.is-active:disabled {
  background: rgba(68, 190, 255, 0.17);
  border-color: #7de9ff;
  opacity: 1;
}

.power-button.is-active em {
  color: #fff;
  animation: slow-pulse 1s ease-in-out infinite;
}

.swipe-guide {
  display: none;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(1, 6, 20, 0.82);
  backdrop-filter: blur(10px);
}

.modal-card {
  width: min(100%, 510px);
  padding: clamp(25px, 5vw, 45px);
  color: var(--white);
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    var(--navy);
  background-size: 22px 22px;
  border: 3px solid var(--world-accent);
  box-shadow: 10px 10px 0 var(--blue);
  text-align: center;
}

.modal-card.reward-mode {
  width: min(100%, 720px);
}

.modal-icon {
  display: grid;
  width: 70px;
  height: 70px;
  margin: 0 auto 18px;
  place-items: center;
  color: var(--navy);
  background: var(--world-accent);
  border: 3px solid var(--white);
  box-shadow: 6px 6px 0 var(--blue);
  font-size: 30px;
}

.modal-card h2 {
  margin: 12px 0;
  font-size: clamp(2.1rem, 6vw, 4rem);
  letter-spacing: -0.07em;
  line-height: 0.9;
}

.modal-card > p:not(.eyebrow) {
  color: #b5c8e6;
  line-height: 1.55;
}

.modal-stats {
  display: grid;
  margin-top: 20px;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
}

.modal-stat {
  padding: 10px 5px;
}

.modal-stat + .modal-stat {
  border-left: 1px solid var(--line);
}

.modal-stat span,
.modal-stat strong {
  display: block;
}

.modal-stat span {
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.modal-stat strong {
  margin-top: 4px;
  font-size: 17px;
}

.modal-actions {
  justify-content: center;
}

.upgrade-rewards {
  margin-top: 20px;
}

.upgrade-rewards > p {
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 9px;
  font-weight: 1000;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.upgrade-choice {
  min-height: 145px;
  padding: 13px 10px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
}

.upgrade-choice:hover,
.upgrade-choice:focus-visible {
  background: rgba(33, 143, 255, 0.2);
  border-color: var(--gold);
  transform: translateY(-3px);
}

.upgrade-choice > span,
.upgrade-choice strong,
.upgrade-choice small,
.upgrade-choice em {
  display: block;
}

.upgrade-choice > span {
  min-height: 32px;
  color: var(--world-accent);
  font-size: 22px;
  font-weight: 1000;
}

.upgrade-choice strong {
  margin-top: 7px;
  font-size: 11px;
}

.upgrade-choice small {
  min-height: 38px;
  margin-top: 5px;
  color: #afc2df;
  font-size: 8px;
  line-height: 1.4;
}

.upgrade-choice em {
  margin-top: 8px;
  color: var(--gold);
  font-size: 7px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes core-float {
  50% {
    transform: translateY(-14px) rotateX(56deg) rotateZ(45deg);
  }
}

@keyframes dragon-float {
  50% {
    transform: translateY(-14px) rotate(-2deg);
  }
}

@keyframes orbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes voxel-drift {
  50% {
    transform: translateY(-13px) rotate(9deg);
  }
}

@keyframes banner-pass {
  0% {
    opacity: 0;
    transform: translateX(-105%);
  }
  18%,
  74% {
    opacity: 1;
    transform: translateX(0);
  }
  100% {
    opacity: 0;
    transform: translateX(105%);
  }
}

@keyframes power-sweep {
  0% {
    opacity: 0;
    transform: translateX(-80%);
  }
  28% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(80%);
  }
}

@keyframes power-bloom {
  0% {
    opacity: 0;
    transform: scale(0.2);
  }
  32% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.4);
  }
}

@keyframes board-blast {
  30% {
    transform: translateX(-4px) rotate(-0.4deg);
  }
  55% {
    transform: translateX(4px) rotate(0.4deg);
  }
}

@keyframes dragon-wave {
  0% {
    opacity: 0;
    transform: translateY(70%);
  }
  28% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-55%);
  }
}

@keyframes power-button-burst {
  35% {
    color: var(--navy);
    background: var(--world-accent);
    box-shadow: 0 0 22px var(--world-accent);
    transform: scale(1.08);
  }
}

@keyframes ready-pulse {
  50% {
    box-shadow: 0 0 20px rgba(255, 207, 63, 0.55);
  }
}

@keyframes slow-pulse {
  50% {
    opacity: 0.55;
  }
}

@media (max-width: 1120px) {
  .world-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .game-stage {
    grid-template-columns: minmax(155px, 0.75fr) auto minmax(145px, 0.7fr);
    gap: 12px;
  }

  .side-panel {
    padding: 11px;
  }
}

@media (max-width: 760px), (pointer: coarse) {
  .app-shell {
    width: min(100% - 14px, 720px);
  }

  .menu-hero {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .dragon-core {
    width: min(72vw, 360px);
    grid-row: 1;
  }

  .hero-copy {
    grid-row: 2;
  }

  .world-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .game-screen {
    padding-top: max(4px, env(safe-area-inset-top));
  }

  .game-header {
    min-height: 46px;
    padding: 4px 6px;
    gap: 5px;
  }

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

  .header-score {
    min-width: 64px;
  }

  .game-stage {
    min-height: 0;
    padding: 6px 0;
    grid-template-columns: minmax(0, 1fr) 100px;
    align-items: start;
    gap: 7px;
  }

  .mission-panel {
    display: grid;
    width: 100%;
    max-width: none;
    min-height: 54px;
    padding: 7px 9px;
    grid-column: 1 / -1;
    grid-template-columns: 1.2fr 1fr 1fr auto;
    align-items: center;
    gap: 7px;
    box-shadow: none;
  }

  .mission-panel .panel-kicker,
  .mission-copy,
  .world-effect,
  .boss-intel {
    display: none;
  }

  .mission-panel h2 {
    margin: 0;
    font-size: 13px;
  }

  .mission-meter {
    margin: 0;
  }

  .combo-card {
    min-width: 58px;
    margin: 0;
    padding: 6px;
  }

  .board-column {
    width: 100%;
    grid-column: 1;
  }

  .board-frame {
    width: auto;
    height: min(65dvh, 600px);
    aspect-ratio: 1 / 2;
  }

  #game-canvas {
    width: 100%;
    height: 100%;
  }

  .gear-panel {
    width: 100px;
    padding: 5px;
    grid-column: 2;
    box-shadow: none;
  }

  .preview-card {
    padding: 4px;
  }

  .preview-card canvas {
    width: 70px;
  }

  .companion-card {
    padding: 5px;
    text-align: center;
  }

  .companion-card span,
  .companion-card small {
    display: none;
  }

  .companion-card strong {
    margin: 0;
    font-size: 8px;
  }

  .power-grid {
    gap: 4px;
  }

  .power-button {
    min-height: 64px;
    padding: 5px 4px;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    justify-items: center;
    gap: 1px 3px;
    text-align: center;
  }

  .power-button > span {
    grid-column: 1;
    grid-row: 1;
  }

  .power-button strong {
    display: block;
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 7px;
  }

  .power-button em {
    grid-column: 1 / -1;
    grid-row: 3;
    font-size: 6px;
  }

  .power-button small {
    grid-column: 2;
    grid-row: 1;
  }

  .swipe-guide {
    display: grid;
    margin: 7px 0 0;
    padding-bottom: max(0px, env(safe-area-inset-bottom));
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    color: #a8cfff;
    font-size: 7px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
    white-space: normal;
  }

  .swipe-guide span {
    padding: 4px 3px;
    background: rgba(58, 153, 255, 0.08);
    border: 1px solid rgba(143, 203, 255, 0.18);
  }

  .dragon-meter {
    margin-top: 7px;
    padding: 7px;
  }
}

@media (max-width: 480px) {
  .menu-header {
    align-items: flex-start;
  }

  .offline-badge {
    max-width: 125px;
    text-align: right;
  }

  h1 {
    font-size: clamp(4.2rem, 24vw, 7rem);
  }

  .career-stats dd {
    font-size: 17px;
  }

  .section-heading {
    display: block;
  }

  .section-heading > p {
    margin-top: 15px;
  }

  .world-card {
    min-height: 184px;
    padding: 12px;
  }

  .mission-dot {
    width: 22px;
    height: 22px;
  }

  .level-identity span {
    display: none;
  }

  .level-identity strong {
    font-size: 11px;
  }

  .header-score strong {
    font-size: 14px;
  }

  .mission-panel {
    grid-template-columns: 1.3fr 1fr 1fr;
  }

  .combo-card {
    display: none;
  }

  .meter-label {
    font-size: 7px;
  }

  .board-frame {
    height: min(63dvh, 560px);
    border-width: 3px;
  }

  .dragon-meter-copy {
    font-size: 7px;
  }

  .swipe-guide {
    font-size: 6.5px;
  }

  .modal-card {
    max-height: calc(100dvh - 24px);
    padding: 24px 17px;
    overflow-y: auto;
  }

  .upgrade-choices {
    grid-template-columns: 1fr;
  }

  .upgrade-choice {
    display: grid;
    min-height: 78px;
    padding: 10px;
    grid-template-columns: 38px 1fr;
    align-items: center;
    gap: 1px 8px;
  }

  .upgrade-choice > span {
    min-height: 0;
    grid-row: 1 / span 3;
  }

  .upgrade-choice strong,
  .upgrade-choice small,
  .upgrade-choice em {
    margin-top: 0;
  }

  .upgrade-choice small {
    min-height: 0;
  }
}

@media (max-height: 720px) and (min-width: 761px) {
  .game-header {
    min-height: 46px;
  }

  .game-stage {
    min-height: 0;
    padding: 6px 0;
  }

  .board-frame {
    width: min(46vh, 270px);
  }

  .dragon-meter {
    margin-top: 7px;
    padding: 7px;
  }

  .side-panel {
    padding: 10px;
  }
}

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