:root {
  --app-height: 100dvh;
  --bg-top: #fff7fb;
  --bg-bottom: #eef8ff;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-border: #f7d7ea;
  --text-main: #5c4d68;
  --accent: #ff8fb6;
  --accent-2: #8cc9ff;
  --good: #f7b500;
  --shadow: rgba(110, 95, 140, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  min-height: var(--app-height);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text-main);
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
}

html {
  touch-action: manipulation;
}

body {
  position: fixed;
  inset: 0;
  max-width: 100%;
  max-height: 100%;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  touch-action: manipulation;
}

button {
  font-family: inherit;
  touch-action: manipulation;
}

img,
button {
  -webkit-user-drag: none;
}

.app {
  position: relative;
  width: 100%;
  height: calc(var(--app-height) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  min-height: calc(var(--app-height) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.app,
.app * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.is-loading-sdk .app {
  opacity: 0;
  pointer-events: none;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  place-items: center;
  padding: 16px;
  background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.94), rgba(238, 248, 255, 0.98));
  color: var(--text-main);
  overflow: hidden;
}

.is-loading-sdk .loading-screen {
  display: grid;
}

.loading-card {
  min-width: 144px;
  padding: 16px 20px;
  border-radius: 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--panel-border);
  box-shadow: 0 10px 26px var(--shadow);
}

.loading-title {
  font-size: 18px;
  font-weight: 700;
}

.hud {
  grid-row: 1;
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  justify-content: center;
  min-width: 0;
}

.hud-item {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 4px 14px var(--shadow);
  font-size: clamp(14px, 2.2vw, 18px);
}

.hud-pause-btn {
  min-width: 112px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #d9cfeb;
  border-radius: 999px;
  color: #655575;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 14px var(--shadow);
  font-size: clamp(14px, 2.2vw, 17px);
  font-weight: 700;
  cursor: pointer;
}

.hud-pause-btn:hover,
.hud-pause-btn:focus-visible {
  border-color: #cbbbe2;
  box-shadow: 0 6px 18px rgba(110, 95, 140, 0.26);
}

.pause-toggle-icon {
  position: relative;
  width: 14px;
  height: 16px;
  flex: 0 0 14px;
}

.pause-toggle-icon::before,
.pause-toggle-icon::after {
  content: "";
  position: absolute;
  top: 1px;
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: currentColor;
}

.pause-toggle-icon::before {
  left: 2px;
}

.pause-toggle-icon::after {
  right: 2px;
}

.hud-pause-btn.is-paused .pause-toggle-icon::before {
  top: 1px;
  left: 3px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid currentColor;
  border-radius: 0;
  background: transparent;
}

.hud-pause-btn.is-paused .pause-toggle-icon::after {
  display: none;
}

.level4-charge-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.level4-charge-bar {
  width: 94px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 230, 168, 0.35);
  box-shadow: inset 0 0 0 1px rgba(231, 183, 106, 0.28);
  overflow: hidden;
}

.level4-charge-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffe89a, #ffc86f 60%, #ffb45d);
  box-shadow: 0 0 10px rgba(255, 196, 94, 0.65);
  transition: width 0.12s ease-out;
}

.level7-landing-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.level7-status-divider {
  color: #a79ab3;
}

.level7-fuel-bar {
  width: 96px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 224, 135, 0.3);
  box-shadow: inset 0 0 0 1px rgba(203, 157, 57, 0.34);
}

.level7-fuel-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff9d68, #ffd463 58%, #fff2a4);
  box-shadow: 0 0 10px rgba(255, 196, 77, 0.72);
  transition: width 0.1s linear;
}

#lives-hearts {
  color: #ff5e96;
  letter-spacing: 1px;
}

.hud-note {
  grid-row: 2;
  grid-column: 1;
  text-align: center;
  font-size: clamp(12px, 2vw, 14px);
  color: #7a6888;
  margin-bottom: 6px;
}

.phase-message {
  grid-row: 3;
  grid-column: 1;
  align-self: start;
  z-index: 8;
  pointer-events: none;
  text-align: center;
  margin: 0 auto 8px;
  width: fit-content;
  max-width: min(90vw, 760px);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #eadff6;
  color: #5b4a74;
  font-size: clamp(13px, 2.2vw, 16px);
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(108, 92, 136, 0.18);
}

.game-area {
  grid-row: 3;
  grid-column: 1;
  position: relative;
  width: min(960px, 100vw);
  max-width: 100%;
  height: 100%;
  margin: 0 auto;
  min-width: 0;
  border-radius: 18px 18px 0 0;
  background: radial-gradient(circle at 20% 5%, #ffffff 0%, #f8f0ff 45%, #eaf6ff 100%);
  box-shadow: inset 0 0 0 1px #f4dff1;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

.game-area.is-level7 {
  background: #11142f;
  box-shadow: inset 0 0 0 1px rgba(190, 211, 255, 0.18);
}

.game-area.is-level7 .player {
  display: none;
}

.game-area.is-level7 .items-layer {
  z-index: 2;
  pointer-events: none;
}

.game-area,
.items-layer,
.player,
.item {
  touch-action: none;
}

.game-area.is-paused .item,
.game-area.is-paused .player,
.game-area.is-paused .player::before,
.game-area.is-paused .player::after {
  animation-play-state: paused !important;
}

.game-area.is-paused .level7-craft,
.game-area.is-paused .level7-craft::after,
.game-area.is-paused .level7-space-stars,
.game-area.is-paused .level7-object {
  animation-play-state: paused !important;
}

.level7-scene {
  --level7-surface-height: clamp(54px, 16%, 116px);
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(20, 20, 58, 0.28), rgba(74, 41, 91, 0.22) 54%, rgba(20, 39, 66, 0.5)),
    linear-gradient(135deg, #11142f 0%, #26204b 46%, #133f54 100%);
  isolation: isolate;
  pointer-events: none;
}

.level7-space-stars,
.level7-space-stars::before {
  position: absolute;
  inset: 0;
  content: "";
  background-image:
    radial-gradient(circle, rgba(255, 244, 177, 0.96) 0 1px, transparent 1.8px),
    radial-gradient(circle, rgba(167, 229, 255, 0.9) 0 1px, transparent 1.7px),
    radial-gradient(circle, rgba(255, 184, 225, 0.82) 0 1.2px, transparent 1.9px);
  background-position: 13px 17px, 42px 51px, 76px 29px;
  background-size: 91px 83px, 127px 109px, 149px 137px;
}

.level7-space-stars {
  opacity: 0.75;
  animation: level7-stars-drift 14s linear infinite;
}

.level7-space-stars::before {
  opacity: 0.46;
  transform: scale(1.12);
}

.level7-moon-surface {
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: -6px;
  z-index: 2;
  height: var(--level7-surface-height);
  border-top: 3px solid rgba(255, 253, 226, 0.76);
  border-radius: 48% 48% 0 0 / 26% 26% 0 0;
  background:
    radial-gradient(circle at 21% 38%, rgba(145, 151, 165, 0.36) 0 8%, transparent 8.8%),
    radial-gradient(circle at 76% 55%, rgba(134, 141, 155, 0.3) 0 10%, transparent 10.8%),
    radial-gradient(circle at 52% 29%, rgba(255, 255, 244, 0.42) 0 5%, transparent 5.8%),
    linear-gradient(180deg, #e9ebea 0%, #bfc5ce 58%, #8c96a8 100%);
  box-shadow:
    0 -10px 32px rgba(231, 239, 255, 0.3),
    inset 0 12px 20px rgba(255, 255, 255, 0.28);
  opacity: 0;
  transform: translateY(135%);
  transition: transform 4.2s cubic-bezier(0.2, 0.72, 0.22, 1), opacity 2.4s ease;
}

.level7-scene.is-approach .level7-moon-surface {
  opacity: 1;
  transform: translateY(0);
}

.level7-landing-pad {
  position: absolute;
  left: 50%;
  bottom: calc(var(--level7-surface-height) - 8px);
  z-index: 3;
  width: clamp(150px, 32%, 260px);
  height: clamp(28px, 6%, 48px);
  opacity: 0;
  transform: translate(-50%, 100px) scale(0.72);
  border: 3px solid #d9f6ff;
  border-radius: 50% / 42%;
  background: linear-gradient(180deg, #5c7290, #283a59);
  box-shadow:
    0 0 14px rgba(130, 225, 255, 0.7),
    0 0 28px rgba(255, 217, 119, 0.36),
    inset 0 0 0 3px rgba(255, 229, 130, 0.5);
  will-change: left, transform, opacity;
  transition: opacity 1.8s ease, transform 3.8s cubic-bezier(0.2, 0.72, 0.22, 1);
}

.level7-scene.is-approach .level7-landing-pad {
  opacity: 1;
  transform: translate(-50%, var(--level7-pad-orbit-y, 0px)) scale(var(--level7-pad-orbit-scale, 1));
}

.level7-landing-pad::before,
.level7-landing-pad::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: #ffe575;
  box-shadow: 0 0 12px rgba(255, 224, 104, 0.95);
}

.level7-landing-pad::before {
  left: 13px;
}

.level7-landing-pad::after {
  right: 13px;
}

.level7-pad-label {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  color: #f9fbff;
  font-size: clamp(10px, 1.8vw, 14px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(9, 18, 37, 0.92);
}

.level7-craft {
  position: absolute;
  z-index: 4;
  width: clamp(72px, 10vw, 104px);
  aspect-ratio: 0.7;
  filter: drop-shadow(0 8px 12px rgba(6, 10, 28, 0.42));
  will-change: left, top;
  transition: filter 0.2s ease;
}

.level7-craft.is-thrusting::after {
  height: 36%;
  filter: drop-shadow(0 0 12px rgba(255, 192, 91, 0.96));
}

.level7-craft.is-fuel-empty::after {
  height: 12%;
  opacity: 0.42;
}

.level7-craft.is-hit {
  animation: level7-craft-hit 0.38s linear 2;
}

.level7-craft::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16%;
  z-index: 2;
  width: 68%;
  height: 84%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 52% 52% 28% 28% / 40% 40% 20% 20%;
  background:
    linear-gradient(90deg, rgba(138, 204, 240, 0.88), rgba(255, 255, 255, 0.98) 34%, rgba(247, 238, 255, 0.98) 68%, rgba(255, 148, 188, 0.9));
  box-shadow:
    inset 8px 0 12px rgba(136, 198, 232, 0.28),
    inset -8px 0 12px rgba(255, 142, 186, 0.18),
    0 0 18px rgba(170, 223, 255, 0.28);
}

.level7-craft::after {
  content: "";
  position: absolute;
  left: 39%;
  bottom: 0;
  z-index: 0;
  width: 22%;
  height: 29%;
  border-radius: 50% 50% 70% 70%;
  background: linear-gradient(180deg, #f8fdff 0%, #ffe16f 34%, #ff8e58 72%, rgba(255, 100, 129, 0) 100%);
  filter: drop-shadow(0 0 8px rgba(255, 192, 91, 0.82));
  transform-origin: 50% 0;
  animation: level7-rocket-flame 0.25s ease-in-out infinite alternate;
}

.level7-craft-window {
  position: absolute;
  top: 18%;
  left: 50%;
  z-index: 4;
  width: 43%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  overflow: hidden;
  border: 3px solid #d8f3ff;
  border-radius: 50%;
  background: #11182e url("assets/girl-idle.webp") center 18% / 112% auto no-repeat;
  box-shadow:
    0 0 0 2px rgba(83, 120, 159, 0.72),
    inset 0 0 10px rgba(159, 224, 255, 0.44);
}

.level7-craft-companion {
  position: absolute;
  right: -3%;
  bottom: -1%;
  width: 45%;
  aspect-ratio: 1;
  background: url("assets/items/star-yellow.webp") center / 160% auto no-repeat;
  filter: drop-shadow(0 0 5px rgba(255, 219, 91, 0.96));
}

.level7-craft-star {
  position: absolute;
  left: 50%;
  top: 57%;
  z-index: 4;
  width: 26%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: url("assets/items/star-yellow.webp") center / 168% auto no-repeat;
  filter: drop-shadow(0 0 5px rgba(255, 207, 77, 0.8));
}

.level7-craft-fin {
  position: absolute;
  top: 57%;
  z-index: 1;
  width: 31%;
  height: 29%;
  background: linear-gradient(180deg, #ff9fc4, #c95c91);
  border: 2px solid rgba(255, 229, 242, 0.82);
}

.level7-craft-fin-left {
  left: 1%;
  border-radius: 72% 18% 35% 65%;
  transform: rotate(-13deg);
}

.level7-craft-fin-right {
  right: 1%;
  border-radius: 18% 72% 65% 35%;
  transform: rotate(13deg);
}

.level7-craft.is-aligned {
  filter:
    drop-shadow(0 8px 12px rgba(6, 10, 28, 0.42))
    drop-shadow(0 0 14px rgba(111, 255, 203, 0.84));
}

.level7-craft.is-aligned::after {
  height: 17%;
  opacity: 0.64;
}

.level7-craft.is-landed {
  filter:
    drop-shadow(0 6px 10px rgba(6, 10, 28, 0.36))
    drop-shadow(0 0 18px rgba(255, 229, 127, 0.92));
}

.level7-craft.is-landed::after {
  opacity: 0;
  animation: none;
}

.level7-craft.is-missed {
  filter: drop-shadow(0 0 15px rgba(255, 99, 120, 0.9));
}

.level7-object {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  will-change: left, top, transform;
}

.level7-meteor {
  border: 2px solid rgba(255, 211, 151, 0.52);
  border-radius: 46% 54% 43% 57%;
  background:
    radial-gradient(circle at 31% 29%, rgba(60, 43, 57, 0.82) 0 9%, transparent 10%),
    radial-gradient(circle at 66% 63%, rgba(60, 43, 57, 0.72) 0 12%, transparent 13%),
    linear-gradient(135deg, #d59463, #7b5263 55%, #423650);
  box-shadow:
    -10px -8px 24px rgba(255, 137, 77, 0.24),
    inset 7px 7px 10px rgba(255, 210, 156, 0.28),
    inset -8px -8px 12px rgba(29, 25, 43, 0.42);
}

.level7-comet {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 34%, #ffffff 0 12%, #b8edff 20%, #75afd5 50%, #365b9d 76%, transparent 78%);
  filter: drop-shadow(0 0 9px rgba(141, 225, 255, 0.88));
}

.level7-comet::after {
  content: "";
  position: absolute;
  right: 62%;
  top: 28%;
  width: 170%;
  height: 44%;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, rgba(126, 210, 255, 0.28) 28%, rgba(220, 247, 255, 0.86));
  filter: blur(2px);
  transform: rotate(-8deg);
  transform-origin: right center;
}

.level7-heart {
  background: url("assets/items/heart-pink.webp") center / contain no-repeat;
  filter: drop-shadow(0 0 10px rgba(255, 103, 166, 0.88));
}

.level7-black-hole {
  background: url("assets/items/black-hole.webp") center / contain no-repeat;
  filter: drop-shadow(0 0 18px rgba(162, 96, 255, 0.92));
  animation: level7-black-hole-pulse 1.15s ease-in-out infinite alternate;
}

.level7-controls {
  position: absolute;
  left: max(12px, env(safe-area-inset-left, 0px));
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  z-index: 7;
  width: clamp(112px, 22vw, 154px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 5px;
  pointer-events: auto;
}

.level7-control-btn {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(221, 239, 255, 0.72);
  border-radius: 8px;
  color: #f8fbff;
  background: rgba(24, 31, 69, 0.72);
  box-shadow: 0 4px 12px rgba(5, 9, 29, 0.3), inset 0 0 12px rgba(139, 203, 255, 0.12);
  font-size: clamp(24px, 5vw, 34px);
  line-height: 1;
  cursor: pointer;
  touch-action: none;
}

.level7-control-btn:active,
.level7-control-btn.is-active {
  color: #fff4a7;
  background: rgba(72, 96, 151, 0.88);
  transform: translateY(1px);
}

.level7-control-up {
  grid-column: 2;
  grid-row: 1;
}

.level7-control-left {
  grid-column: 1;
  grid-row: 2;
}

.level7-control-down {
  grid-column: 2;
  grid-row: 3;
}

.level7-control-right {
  grid-column: 3;
  grid-row: 2;
}

.items-layer {
  position: absolute;
  inset: 0;
}

.player {
  position: absolute;
  width: 192px;
  height: 288px;
  left: 50%;
  bottom: 10px;
  background-image: url("assets/girl-idle.webp");
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: 92% auto;
  opacity: 1;
  transform: translateY(0) scale(1) translateZ(0);
  will-change: left, opacity, transform;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.player::before,
.player::after {
  content: "";
  position: absolute;
  inset: -14px -10px -8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.player.is-switching {
  opacity: 0.975;
  transform: translateY(0.5px) scale(0.996) translateZ(0);
}

.player.pose-ray-charge {
  filter: brightness(1.03) saturate(1.05);
}

.player.pose-got-star {
  filter:
    brightness(1.04) saturate(1.08)
    drop-shadow(0 0 10px rgba(255, 225, 126, 0.45))
    drop-shadow(0 0 20px rgba(255, 188, 102, 0.32));
}

.player.pose-ray-burst {
  filter:
    brightness(1.05) saturate(1.08)
    drop-shadow(0 0 9px rgba(255, 228, 164, 0.66))
    drop-shadow(0 0 19px rgba(255, 193, 104, 0.5));
}

.player.pose-got-star::before {
  opacity: 0.92;
  border-radius: 58% 42% 54% 46%;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 246, 191, 0.56), rgba(255, 221, 130, 0.2) 48%, rgba(255, 186, 95, 0.03) 76%, transparent 100%),
    radial-gradient(circle at 48% 68%, rgba(255, 231, 170, 0.28), rgba(255, 191, 112, 0.08) 60%, transparent 100%);
  filter: blur(0.55px);
  animation: star-glow 1.7s ease-in-out infinite alternate;
}

.player.pose-got-star::after {
  opacity: 0.82;
  background:
    radial-gradient(circle at 22% 27%, rgba(255, 248, 203, 0.78) 0 2px, transparent 3px),
    radial-gradient(circle at 71% 19%, rgba(255, 238, 176, 0.72) 0 2px, transparent 3px),
    radial-gradient(circle at 33% 56%, rgba(255, 227, 150, 0.68) 0 2px, transparent 3px),
    radial-gradient(circle at 67% 61%, rgba(255, 210, 132, 0.62) 0 2px, transparent 3px);
  animation: star-particles 2.2s ease-in-out infinite;
}

.player.pose-ray-charge::before,
.player.pose-ray-burst::before {
  opacity: 1;
  border-radius: 54% 46% 52% 48%;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 247, 198, 0.55), rgba(255, 219, 132, 0.2) 44%, rgba(255, 183, 98, 0.04) 72%, transparent 100%),
    radial-gradient(circle at 48% 72%, rgba(255, 236, 176, 0.26), rgba(255, 191, 109, 0.08) 56%, transparent 100%);
  filter: blur(0.6px);
  animation: ray-charge-halo 1.9s ease-in-out infinite;
}

.player.pose-ray-charge::after,
.player.pose-ray-burst::after {
  opacity: 0.78;
  background:
    radial-gradient(circle at 24% 26%, rgba(255, 244, 189, 0.52) 0 2px, transparent 3px),
    radial-gradient(circle at 72% 20%, rgba(255, 231, 166, 0.48) 0 2px, transparent 3px),
    radial-gradient(circle at 33% 62%, rgba(255, 221, 143, 0.4) 0 2px, transparent 3px),
    radial-gradient(circle at 68% 58%, rgba(255, 209, 132, 0.34) 0 2px, transparent 3px);
  animation: ray-charge-particles 2.3s linear infinite;
}

.item {
  position: absolute;
  user-select: none;
  line-height: 1;
  text-align: center;
  will-change: transform;
}

.item-crystal {
  width: 64px;
  height: 64px;
  background-image: url("assets/items/crystal-blue.webp");
  background-repeat: no-repeat;
  background-position: center;
  background-size: auto 170%;
  color: transparent;
  text-shadow: none;
  filter:
    drop-shadow(0 0 8px rgba(162, 233, 255, 0.9))
    drop-shadow(0 0 17px rgba(92, 171, 255, 0.68));
  animation: crystal-pulse 1.4s ease-in-out infinite;
}

.item-crystal-bright {
  width: 69px;
  height: 69px;
  background-image: url("assets/items/crystal-blue.webp");
  background-repeat: no-repeat;
  background-position: center;
  background-size: auto 178%;
  color: transparent;
  text-shadow: none;
  filter:
    drop-shadow(0 0 11px rgba(186, 247, 255, 0.96))
    drop-shadow(0 0 22px rgba(121, 188, 255, 0.82));
  animation: crystal-pulse 1.2s ease-in-out infinite;
}

.item-crystal-pink {
  width: 64px;
  height: 64px;
  background-image: url("assets/items/crystal-pink.webp");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 170% auto;
  color: transparent;
  text-shadow: none;
  filter:
    drop-shadow(0 0 8px rgba(255, 177, 228, 0.9))
    drop-shadow(0 0 16px rgba(255, 111, 198, 0.72))
    drop-shadow(0 0 24px rgba(217, 64, 151, 0.5));
  animation: crystal-pulse 1.2s ease-in-out infinite;
}

.item-heart {
  width: 56px;
  height: 56px;
  background-image: url("assets/items/heart-pink.webp");
  background-repeat: no-repeat;
  background-position: center;
  background-size: auto 148%;
  color: transparent;
  text-shadow: none;
  opacity: 1;
  filter:
    drop-shadow(0 0 7px rgba(255, 196, 230, 0.85))
    drop-shadow(0 0 12px rgba(255, 127, 194, 0.65))
    drop-shadow(0 0 18px rgba(223, 79, 161, 0.4));
  animation: crystal-pulse 1.35s ease-in-out infinite;
}

.item-star {
  width: 64px;
  height: 64px;
  background-image: url("assets/items/star-yellow.webp");
  background-repeat: no-repeat;
  background-position: center;
  background-size: auto 168%;
  color: transparent;
  text-shadow: none;
  filter:
    drop-shadow(0 0 10px rgba(255, 229, 146, 0.95))
    drop-shadow(0 0 22px rgba(255, 176, 99, 0.75));
  animation: crystal-pulse 1.25s ease-in-out infinite;
}

.item-yellow-ray {
  --ray-charge: 0;
  width: 66px;
  height: 148px;
  border-radius: 999px;
  background:
    radial-gradient(ellipse at 50% 17%, rgba(255, 251, 220, 0.98), rgba(255, 238, 163, 0.92) 35%, rgba(255, 198, 95, 0.45) 68%, rgba(255, 167, 85, 0.14) 100%),
    linear-gradient(180deg, rgba(255, 245, 186, 0.95) 0%, rgba(255, 214, 122, 0.85) 26%, rgba(255, 188, 99, 0.5) 58%, rgba(255, 165, 90, 0.18) 100%);
  color: transparent;
  text-shadow: none;
  border: 1px solid rgba(255, 232, 170, 0.68);
  box-shadow:
    inset 0 0 22px rgba(255, 248, 210, 0.58),
    0 0 18px rgba(255, 209, 117, 0.86),
    0 0 42px rgba(255, 170, 82, 0.72);
  filter: drop-shadow(0 0 14px rgba(255, 208, 108, 0.85));
  transform: translateZ(0);
  animation: ray-flicker 1.15s ease-in-out infinite alternate;
}

.item-yellow-ray::before {
  content: "";
  position: absolute;
  inset: 12px 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 240, 0.98), rgba(255, 247, 207, 0.85), rgba(255, 233, 164, 0.24));
  opacity: calc(0.35 + var(--ray-charge) * 0.65);
}

.item-yellow-ray.is-charging {
  box-shadow:
    inset 0 0 24px rgba(255, 250, 215, 0.66),
    0 0 22px rgba(255, 219, 136, 0.92),
    0 0 50px rgba(255, 176, 90, 0.8);
}

.item-yellow-ray .ray-charge-bar {
  position: absolute;
  left: 50%;
  top: -10px;
  width: 56px;
  height: 6px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 245, 204, 0.34);
  box-shadow: inset 0 0 0 1px rgba(255, 218, 136, 0.42);
  overflow: hidden;
}

.item-yellow-ray .ray-charge-fill {
  display: block;
  height: 100%;
  width: calc(var(--ray-charge) * 100%);
  border-radius: 999px;
  background: linear-gradient(90deg, #ffe9ac, #ffc874 62%, #ffb45f);
  box-shadow: 0 0 8px rgba(255, 199, 106, 0.7);
  transition: width 0.12s ease-out;
}

.item-black-hole {
  width: 78px;
  height: 78px;
  background-image: url("assets/items/black-hole.webp");
  background-repeat: no-repeat;
  background-position: center;
  background-size: auto 172%;
  color: transparent;
  text-shadow: none;
  filter:
    drop-shadow(0 0 8px rgba(112, 118, 182, 0.82))
    drop-shadow(0 0 18px rgba(36, 39, 78, 0.9))
    drop-shadow(0 0 28px rgba(19, 21, 43, 0.9))
    drop-shadow(0 0 38px rgba(10, 11, 24, 0.75));
  animation: crystal-pulse 1.05s ease-in-out infinite;
}

.item-moon {
  width: 112px;
  height: 112px;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 88px;
  font-weight: 700;
  line-height: 1;
  color: #fff7cc;
  text-shadow:
    0 0 10px rgba(255, 235, 165, 0.85),
    0 0 24px rgba(255, 207, 116, 0.54);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 247, 0.98), rgba(245, 245, 230, 0.95) 42%, rgba(225, 227, 216, 0.88) 75%, rgba(200, 204, 198, 0.74) 100%);
  border: 2px solid rgba(248, 246, 230, 0.78);
  box-shadow:
    inset -16px -10px 20px rgba(171, 174, 170, 0.34),
    inset 10px 8px 16px rgba(255, 255, 246, 0.42),
    0 0 28px rgba(255, 236, 184, 0.66),
    0 0 56px rgba(206, 217, 255, 0.4);
  animation: moon-float 1.8s ease-in-out infinite alternate;
  isolation: isolate;
}

.item-moon::before,
.item-moon::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  background: rgba(168, 173, 170, 0.22);
}

.item-moon::before {
  width: 18px;
  height: 18px;
  top: 28px;
  left: 24px;
}

.item-moon::after {
  width: 14px;
  height: 14px;
  right: 24px;
  top: 52px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2vh, 18px) 12px;
  background: rgba(255, 250, 255, 0.5);
  backdrop-filter: blur(4px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: none;
  z-index: 10;
}

.pause-screen {
  z-index: 30;
  background: rgba(39, 35, 65, 0.58);
  backdrop-filter: blur(7px);
}

.pause-panel {
  width: min(88vw, 380px);
}

.pause-panel .btn {
  min-width: 180px;
}

.menu-actions {
  display: grid;
  gap: 9px;
  margin-top: 4px;
}

.menu-actions .btn {
  width: 100%;
  margin: 0;
}

.start-overlay,
.start-panel,
.panel,
.level-select-panel,
.rules-panel {
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.overlay::-webkit-scrollbar,
.start-panel::-webkit-scrollbar,
.panel::-webkit-scrollbar,
.rules-panel::-webkit-scrollbar {
  display: none;
}

.start-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 3vw, 26px) 12px;
  background:
    radial-gradient(circle at 85% 14%, rgba(255, 246, 194, 0.25) 0 11%, transparent 24%),
    linear-gradient(180deg, rgba(26, 31, 64, 0.5), rgba(43, 36, 74, 0.44));
  backdrop-filter: blur(2px);
  overflow: auto;
}

.start-panel {
  position: relative;
  width: min(95vw, 920px);
  max-width: 100%;
  padding: 16px 16px 18px;
  border-radius: 22px;
  text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.93), rgba(252, 246, 255, 0.91));
  border: 1px solid #eddcf8;
  box-shadow:
    0 14px 34px rgba(29, 34, 71, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.start-panel h1 {
  margin: 0 0 10px;
  font-size: clamp(24px, 3.7vw, 36px);
  line-height: 1.08;
}

.story-slider {
  margin: 0 auto;
  width: 100%;
}

.story-slide {
  display: none;
  margin: 0;
  padding: clamp(8px, 1.5vw, 12px);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(245, 240, 255, 0.86));
  border: 1px solid #ecdeff;
  box-shadow:
    0 9px 18px rgba(58, 52, 90, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.story-slide.is-active {
  display: block;
}

.story-slide img {
  display: block;
  width: 100%;
  max-height: min(56vh, 520px);
  object-fit: contain;
  border-radius: 12px;
}

.story-controls {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.start-goal {
  margin: 0 auto 14px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 245, 200, 0.75), rgba(233, 242, 255, 0.86));
  border: 1px solid #ebdff7;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.start-goal-title {
  margin: 0 0 5px;
  font-weight: 700;
  color: #53436c;
}

.start-goal-text {
  margin: 0;
  font-weight: 700;
  color: #3c6091;
}

.hidden {
  display: none;
}

.panel {
  width: min(88vw, 430px);
  max-width: 100%;
  padding: 24px 22px;
  text-align: center;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 12px 30px var(--shadow);
}

.panel > .btn {
  margin: 4px 6px 0;
}

.panel h1,
.panel h2 {
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 38px);
}

.panel p {
  margin: 0 0 14px;
  font-size: clamp(15px, 2.8vw, 18px);
}

.level-select-panel {
  width: min(92vw, 620px);
}

.level-cards {
  display: grid;
  gap: 12px;
  margin: 12px 0 16px;
}

.level-card {
  width: 100%;
  text-align: left;
  border-radius: 14px;
  border: 1px solid #e8d9f5;
  background: rgba(255, 255, 255, 0.95);
  color: #5c4d68;
  padding: 14px 16px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(126, 106, 153, 0.16);
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.level-card:hover,
.level-card:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(126, 106, 153, 0.24);
}

.level-card-title {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}

.level-card-text {
  display: block;
  font-size: 14px;
  color: #7a6888;
}

.level-card.is-locked {
  opacity: 0.58;
  background: rgba(227, 220, 237, 0.7);
  border-color: #d3c4e2;
  box-shadow: none;
  cursor: not-allowed;
}

.level-card.is-locked:hover,
.level-card.is-locked:focus-visible {
  transform: none;
  box-shadow: none;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 17px;
  color: #fff;
  background: linear-gradient(120deg, var(--accent), #ffa7c8);
  box-shadow: 0 8px 18px rgba(255, 143, 182, 0.35);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(255, 143, 182, 0.5);
}

.btn-ghost {
  color: #6a5a7f;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #e8d9f5;
  box-shadow: 0 8px 16px rgba(126, 106, 153, 0.2);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  box-shadow: 0 10px 18px rgba(126, 106, 153, 0.28);
}

.rules-modal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(27, 24, 46, 0.48);
  z-index: 2;
}

.rules-modal.hidden {
  display: none;
}

.rules-panel {
  width: min(92vw, 520px);
  max-width: 100%;
  padding: 20px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(248, 242, 255, 0.95));
  border: 1px solid #e8d8f6;
  box-shadow: 0 12px 28px rgba(34, 30, 63, 0.35);
  text-align: left;
}

.rules-panel h2 {
  margin: 0 0 10px;
  font-size: clamp(24px, 3.4vw, 32px);
  color: #554470;
}

.rules-panel p {
  margin: 0 0 16px;
  line-height: 1.5;
  color: #5c4d72;
}

@keyframes crystal-pulse {
  0% {
    transform: translateY(0) scale(0.98);
    opacity: 0.94;
  }

  100% {
    transform: translateY(-1px) scale(1.02);
    opacity: 1;
  }
}

@keyframes ray-flicker {
  0% {
    transform: scaleY(0.96) scaleX(0.97);
    opacity: 0.9;
  }

  100% {
    transform: scaleY(1.04) scaleX(1.03);
    opacity: 1;
  }
}

@keyframes ray-charge-halo {
  0% {
    transform: scale(0.985);
    opacity: 0.86;
  }

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

@keyframes ray-charge-particles {
  0% {
    transform: translateY(2px);
    opacity: 0.66;
  }

  100% {
    transform: translateY(-5px);
    opacity: 0.92;
  }
}

@keyframes star-glow {
  0% {
    transform: scale(0.992);
    opacity: 0.8;
  }

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

@keyframes star-particles {
  0% {
    transform: translateY(1px);
    opacity: 0.68;
  }

  100% {
    transform: translateY(-4px);
    opacity: 0.95;
  }
}

@keyframes level7-stars-drift {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(24px);
  }
}

@keyframes level7-rocket-flame {
  0% {
    transform: scaleY(0.86) scaleX(0.92);
    opacity: 0.82;
  }

  100% {
    transform: scaleY(1.08) scaleX(1.04);
    opacity: 1;
  }
}

@keyframes level7-craft-hit {
  0%, 100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-7px) rotate(-2deg);
  }

  75% {
    transform: translateX(7px) rotate(2deg);
  }
}

@keyframes level7-black-hole-pulse {
  0% {
    transform: rotate(-7deg) scale(0.96);
  }

  100% {
    transform: rotate(7deg) scale(1.05);
  }
}

@keyframes moon-float {
  0% {
    transform: translateY(0) scale(0.995);
  }

  100% {
    transform: translateY(-2px) scale(1.01);
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .is-level7-active #score-hud-item,
  .is-level7-active #best-hud-item {
    display: none;
  }

  .is-level7-active .hud {
    flex-wrap: nowrap;
    gap: 5px;
    padding: 5px 7px;
  }

  .is-level7-active .level7-landing-item {
    flex: 1 1 auto;
    max-width: none;
    white-space: nowrap;
  }

  .is-level7-active .hud-pause-btn {
    min-width: 42px;
    width: 42px;
    padding: 6px;
  }

  .is-level7-active .hud-pause-label {
    display: none;
  }
}

@media (max-width: 640px) {
  .hud-pause-btn {
    min-width: 38px;
    width: 38px;
    padding: 7px;
  }

  .hud-pause-label {
    display: none;
  }

  .hud {
    gap: 6px;
    padding: 7px 8px;
  }

  .hud-item {
    padding: 7px 10px;
    font-size: clamp(12px, 2.3vw, 15px);
  }

  .hud-note {
    margin-bottom: 4px;
    font-size: clamp(11px, 2vw, 13px);
  }

  .phase-message {
    margin-bottom: 5px;
    padding: 6px 12px;
    font-size: clamp(12px, 2.1vw, 14px);
  }

  .level4-charge-bar {
    width: 78px;
  }

  .level7-fuel-bar {
    width: 72px;
  }

  .level7-scene {
    --level7-surface-height: clamp(50px, 17%, 90px);
  }

  .level7-craft {
    width: clamp(66px, 18vw, 88px);
  }

  .level7-landing-pad {
    width: clamp(138px, 44%, 220px);
  }

  .game-area {
    border-radius: 14px 14px 0 0;
  }

  .panel,
  .level-select-panel,
  .rules-panel {
    width: min(94vw, 560px);
    padding: 18px 14px;
    border-radius: 16px;
  }

  .panel h1,
  .panel h2 {
    margin-bottom: 8px;
    font-size: clamp(22px, 4.3vw, 30px);
  }

  .panel p {
    margin-bottom: 10px;
    font-size: clamp(14px, 2.7vw, 16px);
  }

  .level-cards {
    gap: 8px;
    margin: 10px 0 12px;
  }

  .level-card {
    padding: 10px 12px;
    border-radius: 12px;
  }

  .level-card-title {
    margin-bottom: 3px;
    font-size: 15px;
  }

  .level-card-text {
    font-size: 13px;
  }

  .player {
    width: 156px;
    height: 234px;
    bottom: 8px;
  }

  .item-crystal {
    width: 56px;
    height: 56px;
    background-size: auto 155%;
  }

  .item-crystal-bright {
    width: 60px;
    height: 60px;
    background-size: auto 162%;
  }

  .item-heart {
    width: 47px;
    height: 47px;
    background-size: auto 140%;
  }

  .item-star {
    width: 56px;
    height: 56px;
    background-size: auto 154%;
  }

  .item-yellow-ray {
    width: 56px;
    height: 124px;
  }

  .item-yellow-ray .ray-charge-bar {
    width: 46px;
  }

  .item-crystal-pink {
    width: 56px;
    height: 56px;
    background-size: 155% auto;
  }

  .item-black-hole {
    width: 68px;
    height: 68px;
    background-size: auto 160%;
  }

  .item-moon {
    width: 94px;
    height: 94px;
    font-size: 74px;
  }

  .start-panel {
    width: min(96vw, 720px);
    padding: 14px 11px 14px;
  }

  .story-slide {
    padding: 6px;
  }

  .story-slide img {
    max-height: min(50vh, 420px);
  }

  .story-controls {
    justify-content: center;
    margin-top: 12px;
  }

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

  .start-goal {
    margin-bottom: 12px;
    padding: 10px 12px;
  }

  .btn {
    font-size: 16px;
    padding: 10px 18px;
  }
}

@media (max-height: 720px) {
  .overlay,
  .rules-modal {
    place-items: start center;
  }

  .start-overlay {
    align-items: flex-start;
  }

  .panel,
  .level-select-panel,
  .rules-panel,
  .start-panel {
    max-height: calc(100% - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (orientation: portrait) and (max-height: 680px) {
  .hud {
    gap: 4px;
    padding: 5px 6px;
  }

  .hud-item {
    padding: 5px 7px;
    font-size: 12px;
  }

  .hud-note {
    margin-bottom: 2px;
    padding: 0 6px;
    font-size: 10px;
    line-height: 1.25;
  }

  .start-overlay,
  .overlay {
    padding: 6px;
  }

  .start-panel {
    max-height: calc(100% - 12px);
    padding: 8px;
    border-radius: 14px;
  }

  .start-panel h1 {
    margin-bottom: 5px;
    font-size: 20px;
    line-height: 1.08;
  }

  .start-goal {
    max-width: 360px;
    margin-bottom: 6px;
    padding: 6px 8px;
    border-radius: 12px;
  }

  .start-goal-title,
  .start-goal-text {
    font-size: 12px;
    line-height: 1.2;
  }

  .story-slide {
    padding: 4px;
    border-radius: 12px;
  }

  .story-slide img {
    max-height: min(30vh, 190px);
    border-radius: 8px;
  }

  .story-controls {
    gap: 6px;
    margin-top: 6px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 14px;
  }

  .panel,
  .level-select-panel,
  .rules-panel {
    max-height: calc(100% - 12px);
    padding: 10px;
  }
}

@media (orientation: portrait) and (max-height: 560px) {
  .story-slide img {
    max-height: min(24vh, 140px);
  }

  .start-panel h1 {
    font-size: 17px;
  }

  .story-controls {
    gap: 4px;
  }

  .btn {
    padding: 7px 10px;
    font-size: 13px;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .app {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .hud {
    gap: 5px;
    padding: 6px 8px;
  }

  .hud-item {
    padding: 5px 9px;
    font-size: clamp(11px, 2.5vh, 14px);
  }

  .hud-note {
    margin-bottom: 3px;
    font-size: clamp(10px, 2.2vh, 12px);
  }

  .phase-message {
    margin-bottom: 4px;
    padding: 5px 10px;
    font-size: clamp(11px, 2.2vh, 13px);
  }

  .game-area {
    border-radius: 12px 12px 0 0;
  }

  .player {
    width: 128px;
    height: 192px;
    bottom: 4px;
  }

  .item-crystal,
  .item-crystal-pink,
  .item-star {
    width: 48px;
    height: 48px;
  }

  .item-crystal-bright {
    width: 52px;
    height: 52px;
  }

  .item-heart {
    width: 40px;
    height: 40px;
  }

  .item-black-hole {
    width: 58px;
    height: 58px;
  }

  .item-yellow-ray {
    width: 48px;
    height: 108px;
  }

  .item-yellow-ray .ray-charge-bar {
    width: 40px;
  }

  .item-moon {
    width: 82px;
    height: 82px;
    font-size: 64px;
  }

  .level7-scene {
    --level7-surface-height: clamp(46px, 20%, 76px);
  }

  .level7-craft {
    width: clamp(58px, 18vh, 76px);
  }

  .level7-landing-pad {
    width: clamp(132px, 30%, 206px);
    height: clamp(24px, 8%, 38px);
  }

  .panel,
  .level-select-panel,
  .rules-panel {
    width: min(94vw, 540px);
    padding: 14px 12px;
  }

  .panel h1,
  .panel h2,
  .rules-panel h2 {
    margin-bottom: 7px;
    font-size: clamp(18px, 4vh, 26px);
  }

  .panel p,
  .rules-panel p {
    margin-bottom: 9px;
    font-size: clamp(12px, 2.6vh, 15px);
  }

  .level-cards {
    gap: 6px;
    margin: 8px 0 10px;
  }

  .level-card {
    padding: 8px 10px;
  }

  .level-card-title {
    font-size: 14px;
  }

  .level-card-text {
    font-size: 12px;
  }

  .btn {
    font-size: 14px;
    padding: 8px 14px;
  }
}

@media (orientation: landscape) and (max-height: 430px) {
  .app {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .game-area {
    grid-row: 2;
  }

  .hud {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 3px;
    padding: 3px 4px;
    overflow-y: auto;
  }

  .hud-item {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 40vw;
    padding: 4px 6px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .level4-charge-item,
  #level5-goal-item,
  .level7-landing-item {
    max-width: 52vw;
  }

  .level4-charge-bar {
    width: 52px;
  }

  .level7-fuel-bar {
    width: 48px;
  }

  .level7-controls {
    width: min(104px, 28vh);
    bottom: 8px;
    left: 8px;
    gap: 4px;
  }

  .hud-note {
    display: none;
  }

  .phase-message {
    position: absolute;
    top: 26px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 8;
    margin: 0;
    max-width: 86vw;
  }

  .game-area {
    width: 100vw;
    border-radius: 0;
  }

  .player {
    width: 104px;
    height: 156px;
    bottom: 2px;
  }

  .item-crystal,
  .item-crystal-pink,
  .item-star {
    width: 40px;
    height: 40px;
  }

  .item-crystal-bright {
    width: 44px;
    height: 44px;
  }

  .item-heart {
    width: 34px;
    height: 34px;
  }

  .item-black-hole {
    width: 48px;
    height: 48px;
  }

  .item-yellow-ray {
    width: 40px;
    height: 88px;
  }

  .item-moon {
    width: 68px;
    height: 68px;
    font-size: 52px;
  }

  .level7-scene {
    --level7-surface-height: clamp(42px, 23%, 68px);
  }

  .level7-craft {
    width: 54px;
  }

  .level7-landing-pad {
    width: clamp(118px, 27%, 176px);
    height: 24px;
  }

  .level7-pad-label {
    font-size: 9px;
  }

  .overlay {
    padding: 6px;
  }

  .start-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(126px, 160px);
    grid-template-areas:
      "title title"
      "goal controls"
      "story controls";
    align-items: center;
    gap: 6px;
    width: min(96vw, 720px);
    max-height: calc(100% - 12px);
    padding: 8px;
    border-radius: 14px;
    overflow-y: auto;
  }

  .start-panel h1 {
    grid-area: title;
    margin-bottom: 5px;
    font-size: 18px;
  }

  .start-goal {
    grid-area: goal;
    margin-bottom: 6px;
    padding: 6px 8px;
  }

  .story-slider {
    grid-area: story;
    min-height: 0;
  }

  .start-goal-title,
  .start-goal-text {
    font-size: 12px;
  }

  .story-slide {
    padding: 4px;
    border-radius: 12px;
  }

  .story-slide img {
    max-height: calc(var(--app-height) - 156px);
    border-radius: 8px;
  }

  .story-controls {
    grid-area: controls;
    flex-direction: column;
    align-self: center;
    gap: 6px;
    margin-top: 0;
  }

  .story-controls .btn {
    width: 100%;
    min-width: 0;
  }

  .panel,
  .level-select-panel,
  .rules-panel {
    width: min(96vw, 560px);
    max-height: calc(100% - 12px);
    padding: 10px;
    border-radius: 14px;
  }
}
