/* =========================================================
   NEON SHATTER — 霓虹碎光
   Mobile-first HTML5 arcade · no external assets
   ========================================================= */

:root {
  --bg: #05050d;
  --panel: rgba(10, 12, 25, 0.84);
  --ink: #f3f6ff;
  --muted: #8a90b4;
  --faint: #565d80;
  --cyan: #3cecff;
  --pink: #ff4f9e;
  --violet: #9872ff;
  --lime: #b8ff5c;
  --gold: #ffc857;
  --red: #ff6363;
  --line: rgba(155, 200, 255, 0.14);
  --line-hot: rgba(60, 236, 255, 0.42);
  --display: "Arial Black", "Helvetica Neue", "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  --body: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", "Helvetica Neue", system-ui, sans-serif;
  --mono: "SFMono-Regular", "Roboto Mono", "Noto Sans Mono", "Cascadia Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 100%;
  background:
    radial-gradient(circle at 22% 12%, rgba(44, 93, 151, 0.16), transparent 34%),
    radial-gradient(circle at 80% 88%, rgba(137, 39, 104, 0.13), transparent 38%),
    #05050d;
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.23;
  background-image:
    linear-gradient(rgba(97, 143, 190, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(97, 143, 190, 0.08) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at center, #000 10%, transparent 74%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 10%, transparent 74%);
}

button {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  color: inherit;
  background: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-glow {
  position: fixed;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(90px);
  opacity: 0.32;
}

.page-glow--a {
  left: -16vw;
  top: 3vh;
  background: rgba(33, 164, 203, 0.23);
}

.page-glow--b {
  right: -18vw;
  bottom: 0;
  background: rgba(175, 43, 113, 0.19);
}

/* ---------------------------------------------------------
   Stage
   --------------------------------------------------------- */

.stage {
  position: relative;
  z-index: 1;
  width: min(100vw, calc(100vh * 450 / 975), 560px);
  height: min(100vh, calc(100vw * 975 / 450), calc(560px * 975 / 450));
  width: min(100vw, calc(100dvh * 450 / 975), 560px);
  height: min(100dvh, calc(100vw * 975 / 450), calc(560px * 975 / 450));
  aspect-ratio: 450 / 975;
  overflow: hidden;
  isolation: isolate;
  background: #060610;
  border: 1px solid rgba(118, 184, 230, 0.18);
  border-radius: clamp(0px, 3.5vh, 30px);
  box-shadow:
    0 0 0 1px rgba(5, 8, 18, 0.7),
    0 32px 90px rgba(0, 0, 0, 0.75),
    0 0 90px rgba(42, 150, 207, 0.09);
  container-type: inline-size;
  touch-action: none;
  overscroll-behavior: none;
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(60, 236, 255, 0.08), transparent 9%, transparent 91%, rgba(255, 79, 158, 0.06)),
    linear-gradient(180deg, rgba(5, 5, 13, 0.25), transparent 18%, transparent 84%, rgba(4, 4, 12, 0.48));
  opacity: 0.65;
}

#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 46%, transparent 48%, rgba(2, 2, 8, 0.34) 80%, rgba(2, 2, 8, 0.66) 100%),
    linear-gradient(180deg, rgba(2, 2, 8, 0.38), transparent 14%, transparent 84%, rgba(2, 2, 8, 0.4));
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0.05;
  pointer-events: none;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}

/* ---------------------------------------------------------
   HUD
   --------------------------------------------------------- */

.hud {
  position: absolute;
  z-index: 12;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 2cqw;
  padding:
    calc(env(safe-area-inset-top, 0px) + clamp(14px, 3.6cqw, 20px))
    clamp(15px, 4.2cqw, 22px)
    18px;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.45s var(--ease);
}

.stage[data-mode="menu"] .hud,
.stage[data-mode="how"] .hud {
  opacity: 0;
  transform: translateY(-8px);
}

.hud button { pointer-events: auto; }

.hud-overline {
  display: block;
  margin-bottom: 0.38em;
  color: var(--faint);
  font-family: var(--mono);
  font-size: clamp(7px, 2.1cqw, 10px);
  font-weight: 700;
  letter-spacing: 0.2em;
  line-height: 1;
}

.hud-level-line {
  display: flex;
  align-items: baseline;
  gap: 1.7cqw;
  min-width: 0;
}

#hudLevel {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: clamp(18px, 5.2cqw, 27px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
  text-shadow: 0 0 18px rgba(60, 236, 255, 0.44);
}

#hudLevelName {
  overflow: hidden;
  max-width: 16cqw;
  color: #aebad8;
  font-size: clamp(8px, 2.45cqw, 12px);
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-score-wrap {
  position: relative;
  min-width: 0;
  text-align: center;
}

.hud-score-wrap .hud-overline {
  color: #6f7ba5;
}

.hud-score {
  display: block;
  color: #f4fbff;
  font-family: var(--mono);
  font-size: clamp(19px, 5.9cqw, 30px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  line-height: 1;
  text-shadow: 0 0 22px rgba(157, 221, 255, 0.2);
}

.hud-score.is-bumped {
  animation: score-bump 0.22s ease;
}

@keyframes score-bump {
  50% { color: var(--cyan); transform: scale(1.06); }
}

.combo-hud {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  color: var(--pink);
  font-family: var(--mono);
  font-size: clamp(7px, 2.05cqw, 10px);
  font-weight: 700;
  letter-spacing: 0.09em;
  white-space: nowrap;
  border: 1px solid rgba(255, 79, 158, 0.26);
  border-radius: 999px;
  background: rgba(32, 7, 22, 0.68);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.2s ease, transform 0.25s var(--ease);
}

.combo-hud.is-active {
  opacity: 1;
  transform: translate(-50%, 0);
}

.combo-hud b {
  color: #fff;
  font-size: 1.28em;
  text-shadow: 0 0 10px rgba(255, 79, 158, 0.8);
}

.hud-right {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: clamp(6px, 2cqw, 12px);
}

.lives {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding-top: 3px;
}

.life {
  display: block;
  width: clamp(6px, 1.8cqw, 9px);
  height: clamp(12px, 3.4cqw, 17px);
  background: linear-gradient(180deg, #ecffff, var(--cyan));
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  filter: drop-shadow(0 0 5px rgba(60, 236, 255, 0.65));
  transition: opacity 0.3s ease, background 0.3s ease;
}

.life.is-empty {
  background: rgba(158, 177, 212, 0.15);
  filter: none;
}

.icon-btn {
  display: grid;
  flex: 0 0 auto;
  width: clamp(34px, 9.3cqw, 42px);
  height: clamp(34px, 9.3cqw, 42px);
  place-items: center;
  color: rgba(227, 239, 255, 0.82);
  border: 1px solid rgba(164, 195, 238, 0.18);
  border-radius: 50%;
  background: rgba(8, 11, 23, 0.48);
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.icon-btn:hover {
  color: var(--cyan);
  border-color: rgba(60, 236, 255, 0.4);
  background: rgba(17, 30, 48, 0.72);
}

.icon-btn:active {
  transform: scale(0.93);
}

.icon-btn--hud {
  width: clamp(30px, 8cqw, 37px);
  height: clamp(30px, 8cqw, 37px);
  background: rgba(8, 11, 23, 0.36);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.pause-glyph {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 12px;
}

.pause-glyph i {
  display: block;
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 0 0 7px rgba(60, 236, 255, 0.35);
}

/* Sound icons */
.sound-on { display: block; }
.sound-off { display: none; }
.is-muted .sound-on { display: none; }
.is-muted .sound-off { display: block; }
.sound-on path:first-child,
.sound-off path:first-child {
  fill: currentColor;
  stroke: none;
}
.sound-on .wave,
.sound-off .wave {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

/* ---------------------------------------------------------
   Floating buffs
   --------------------------------------------------------- */

.buffs {
  position: absolute;
  z-index: 11;
  top: calc(env(safe-area-inset-top, 0px) + clamp(79px, 20cqw, 96px));
  right: clamp(14px, 4.2cqw, 22px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  pointer-events: none;
}

.buff {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 4px;
  color: #dfe9ff;
  border: 1px solid color-mix(in srgb, var(--buff-color) 28%, transparent);
  border-radius: 999px;
  background: rgba(6, 9, 20, 0.64);
  box-shadow: 0 0 16px color-mix(in srgb, var(--buff-color) 12%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--mono);
  font-size: clamp(7px, 2.15cqw, 10px);
  font-weight: 700;
  letter-spacing: 0.06em;
  animation: buff-in 0.24s var(--ease);
}

.buff b {
  display: grid;
  width: clamp(16px, 4.2cqw, 20px);
  height: clamp(16px, 4.2cqw, 20px);
  place-items: center;
  color: #071019;
  border-radius: 50%;
  background: var(--buff-color);
  box-shadow: 0 0 8px color-mix(in srgb, var(--buff-color) 55%, transparent);
  font-family: var(--mono);
  font-size: 0.9em;
  font-weight: 900;
}

.buff em {
  color: var(--buff-color);
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

@keyframes buff-in {
  from { opacity: 0; transform: translateX(8px); }
}

/* ---------------------------------------------------------
   Announcement
   --------------------------------------------------------- */

.announce {
  position: absolute;
  z-index: 15;
  top: 46%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 8%;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.4s ease, transform 0.55s var(--ease);
}

.announce.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.announce .kicker {
  color: var(--cyan);
  font-size: clamp(8px, 2.5cqw, 12px);
  letter-spacing: 0.22em;
  text-shadow: 0 0 18px rgba(60, 236, 255, 0.5);
}

.announce strong {
  display: block;
  margin-top: 0.24em;
  color: #fff;
  font-family: var(--display);
  font-size: clamp(29px, 8.8cqw, 44px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  text-shadow:
    0 0 22px rgba(60, 236, 255, 0.32),
    0 0 55px rgba(255, 79, 158, 0.18);
}

.announce p {
  margin: 0.72em 0 0;
  color: rgba(198, 208, 237, 0.78);
  font-size: clamp(9px, 2.65cqw, 13px);
  letter-spacing: 0.12em;
}

/* ---------------------------------------------------------
   Common screen + type + buttons
   --------------------------------------------------------- */

.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  visibility: hidden;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s ease, visibility 0.32s;
}

.screen.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.kicker {
  display: block;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: clamp(8px, 2.55cqw, 12px);
  font-weight: 700;
  letter-spacing: 0.2em;
  line-height: 1.4;
}

.kicker--pink { color: var(--pink); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 2.3cqw;
  color: rgba(180, 198, 229, 0.65);
  font-family: var(--mono);
  font-size: clamp(7px, 2.35cqw, 11px);
  font-weight: 600;
  letter-spacing: 0.24em;
}

.eyebrow span {
  display: inline-block;
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, var(--pink), transparent);
}

.btn-primary {
  position: relative;
  display: flex;
  width: 100%;
  min-height: clamp(55px, 14.5cqw, 67px);
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  overflow: hidden;
  padding: 0 clamp(17px, 4.8cqw, 24px);
  color: #031115;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: clamp(12px, 3.2cqw, 17px);
  background: linear-gradient(102deg, #f2feff 0%, #c8fbff 34%, #6beaff 72%, #66caff 100%);
  box-shadow:
    0 0 35px rgba(60, 236, 255, 0.18),
    0 12px 28px rgba(0, 0, 0, 0.25),
    inset 0 -4px 0 rgba(5, 80, 98, 0.16);
  text-align: left;
  transition: transform 0.25s var(--ease), box-shadow 0.25s ease;
}

.btn-primary::after {
  content: "";
  position: absolute;
  top: -70%;
  left: -30%;
  width: 36%;
  height: 240%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.82), transparent);
  transform: rotate(22deg);
  animation: button-sheen 5.8s ease-in-out infinite;
  pointer-events: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 50px rgba(60, 236, 255, 0.3),
    0 17px 34px rgba(0, 0, 0, 0.3),
    inset 0 -4px 0 rgba(5, 80, 98, 0.16);
}

.btn-primary:active { transform: translateY(0) scale(0.985); }

.btn-label {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.27em;
  color: #041115;
  font-size: clamp(16px, 4.7cqw, 22px);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}

.btn-label small {
  color: rgba(4, 30, 37, 0.52);
  font-family: var(--mono);
  font-size: clamp(7px, 1.85cqw, 9px);
  font-weight: 800;
  letter-spacing: 0.22em;
}

.btn-arrow {
  position: relative;
  z-index: 1;
  display: grid;
  width: clamp(29px, 7.7cqw, 36px);
  height: clamp(29px, 7.7cqw, 36px);
  flex: 0 0 auto;
  place-items: center;
  color: #eaffff;
  border-radius: 50%;
  background: #05161c;
  font-family: var(--mono);
  font-size: clamp(15px, 4cqw, 19px);
  box-shadow: 0 0 20px rgba(5, 25, 35, 0.24);
}

.btn-primary--compact {
  min-height: clamp(50px, 13cqw, 59px);
  margin-top: clamp(16px, 4.4cqw, 23px);
}

.btn-glow {
  position: absolute;
  inset: auto -20% -70% auto;
  width: 70%;
  height: 160%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
  filter: blur(22px);
  pointer-events: none;
}

.ghost-btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  color: rgba(210, 223, 247, 0.8);
  border: 1px solid rgba(156, 188, 233, 0.19);
  border-radius: 999px;
  background: rgba(13, 17, 33, 0.35);
  font-size: clamp(10px, 2.8cqw, 13px);
  font-weight: 500;
  letter-spacing: 0.08em;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.ghost-btn svg {
  width: 14px;
  height: 14px;
}

.ghost-btn:hover {
  color: #fff;
  border-color: rgba(60, 236, 255, 0.4);
  background: rgba(23, 38, 60, 0.52);
}

.text-btn {
  padding: 7px 2px;
  color: #8a95b5;
  font-size: clamp(11px, 3cqw, 14px);
  letter-spacing: 0.06em;
  transition: color 0.2s ease;
}

.text-btn:hover { color: var(--cyan); }

/* ---------------------------------------------------------
   Menu
   --------------------------------------------------------- */

.screen--menu {
  padding:
    calc(env(safe-area-inset-top, 0px) + clamp(15px, 4cqw, 22px))
    clamp(18px, 5.4cqw, 30px)
    calc(env(safe-area-inset-bottom, 0px) + clamp(15px, 4cqw, 23px));
  background:
    radial-gradient(ellipse at 50% 35%, rgba(31, 40, 71, 0.14), transparent 48%),
    linear-gradient(180deg, rgba(5, 5, 13, 0.16) 0%, rgba(5, 5, 13, 0.05) 40%, rgba(5, 5, 13, 0.83) 100%);
  transition: opacity 0.6s ease, visibility 0.6s;
}

.screen--menu.is-active .menu-top {
  animation: menu-rise 0.8s 0.08s both var(--ease);
}

.screen--menu.is-active .hero {
  animation: menu-rise 0.9s 0.16s both var(--ease);
}

.screen--menu.is-active .menu-bottom {
  animation: menu-rise 0.9s 0.28s both var(--ease);
}

@keyframes menu-rise {
  from { opacity: 0; transform: translateY(17px); }
}

.menu-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2.4cqw, 12px);
}

.brand-mark {
  display: flex;
  width: 23px;
  height: 28px;
  align-items: flex-end;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(60, 236, 255, 0.26);
  border-radius: 5px;
  background: rgba(9, 19, 31, 0.5);
}

.brand-mark i {
  display: block;
  width: 4px;
  border-radius: 1px;
  background: var(--cyan);
  box-shadow: 0 0 7px rgba(60, 236, 255, 0.55);
}

.brand-mark i:nth-child(1) { height: 8px; opacity: 0.55; }
.brand-mark i:nth-child(2) { height: 15px; }
.brand-mark i:nth-child(3) { height: 11px; opacity: 0.78; background: var(--pink); box-shadow: 0 0 7px rgba(255, 79, 158, 0.55); }

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: #e6f5ff;
  font-family: var(--mono);
  font-size: clamp(8px, 2.2cqw, 10px);
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1;
}

.brand-copy small {
  color: #596381;
  font-size: 0.72em;
  font-weight: 500;
  letter-spacing: 0.14em;
}

.sound-btn {
  width: clamp(34px, 9.3cqw, 42px);
  height: clamp(34px, 9.3cqw, 42px);
}

.hero {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding-top: 3%;
  padding-left: 1px;
}

.logo {
  display: flex;
  flex-direction: column;
  margin: 0;
  line-height: 0.8;
  filter: drop-shadow(0 10px 35px rgba(0, 0, 0, 0.45));
}

.logo-main {
  display: block;
  width: fit-content;
  color: #dffcff;
  background: linear-gradient(180deg, #ffffff 2%, #e6fdff 31%, #82f2ff 68%, #36c9ed 100%);
  -webkit-background-clip: text;
  background-clip: text;
  font-family: var(--display);
  font-size: clamp(52px, 23.5cqw, 118px);
  font-weight: 900;
  letter-spacing: -0.065em;
  line-height: 0.74;
  text-shadow: none;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 26px rgba(60, 236, 255, 0.22));
  transform: scaleX(0.94);
  transform-origin: left center;
}

.logo-sub {
  display: block;
  width: fit-content;
  margin-top: 1.8cqw;
  margin-left: 0.55cqw;
  color: transparent;
  font-family: var(--display);
  font-size: clamp(23px, 9.7cqw, 49px);
  font-weight: 900;
  letter-spacing: 0.275em;
  line-height: 0.82;
  -webkit-text-stroke: 1px rgba(255, 114, 174, 0.86);
  text-shadow: 0 0 20px rgba(255, 79, 158, 0.22);
}

.cn-title {
  display: flex;
  width: fit-content;
  gap: clamp(7px, 2.1cqw, 13px);
  margin-top: clamp(15px, 4cqw, 24px);
  padding-left: 3px;
  color: #f1f7ff;
  font-family: var(--body);
  font-size: clamp(12px, 3.15cqw, 16px);
  font-weight: 500;
  letter-spacing: 0;
}

.cn-title span {
  position: relative;
  display: block;
}

.cn-title span:nth-child(2),
.cn-title span:nth-child(4) {
  color: #a9b4d0;
}

.cn-title::before {
  content: "";
  width: clamp(17px, 5cqw, 28px);
  height: 1px;
  align-self: center;
  margin-right: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan));
}

.tagline {
  margin: clamp(10px, 2.7cqw, 15px) 0 0;
  color: #8b95b5;
  font-size: clamp(10px, 2.9cqw, 13px);
  letter-spacing: 0.12em;
}

.menu-aura {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.menu-ring {
  position: absolute;
  top: 37%;
  left: 51%;
  width: 76cqw;
  aspect-ratio: 1;
  border: 1px solid rgba(60, 236, 255, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.menu-ring--one {
  border-color: rgba(60, 236, 255, 0.13);
  border-style: dashed;
  animation: spin 44s linear infinite;
}

.menu-ring--two {
  width: 106cqw;
  border-color: rgba(255, 79, 158, 0.075);
  animation: spin-reverse 68s linear infinite;
}

.menu-ring--two::before {
  content: "";
  position: absolute;
  top: 12%;
  right: 7%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 12px 2px rgba(255, 79, 158, 0.55);
}

.menu-ring--three {
  width: 44cqw;
  border-color: rgba(120, 141, 203, 0.09);
}

.menu-core {
  position: absolute;
  top: 37%;
  left: 51%;
  width: clamp(9px, 2.4cqw, 13px);
  height: clamp(9px, 2.4cqw, 13px);
  border-radius: 50%;
  background: #d9fdff;
  box-shadow:
    0 0 14px 4px rgba(60, 236, 255, 0.45),
    0 0 52px 18px rgba(60, 236, 255, 0.12);
  animation: core-pulse 3.8s ease-in-out infinite;
}

.menu-dot {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(183, 242, 255, 0.8);
  box-shadow: 0 0 9px 2px rgba(60, 236, 255, 0.38);
}

.menu-dot--a { top: 23%; left: 17%; animation: float-dot 9s ease-in-out infinite; }
.menu-dot--b { top: 48%; right: 12%; background: rgba(255, 154, 196, 0.86); box-shadow: 0 0 9px 2px rgba(255, 79, 158, 0.32); animation: float-dot 11s 2s ease-in-out infinite; }

@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes spin-reverse { to { transform: translate(-50%, -50%) rotate(-360deg); } }
@keyframes core-pulse {
  50% { opacity: 0.6; transform: scale(0.7); }
}
@keyframes float-dot {
  0%, 100% { transform: translate(0, 0); opacity: 0.35; }
  50% { transform: translate(8px, -13px); opacity: 0.9; }
}

.menu-bottom {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2.8cqw, 15px);
}

.best-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 1.6cqw;
  border-bottom: 1px solid rgba(132, 159, 201, 0.12);
  color: #5c6687;
  font-family: var(--mono);
  font-size: clamp(7px, 2.15cqw, 10px);
  font-weight: 700;
  letter-spacing: 0.14em;
}

.best-row > span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
}

.best-row i {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 8px rgba(184, 255, 92, 0.74);
}

.best-row strong {
  color: #d8e5ff;
  font-size: clamp(11px, 3.1cqw, 15px);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.best-tag {
  margin-left: auto;
  padding: 2px 6px;
  color: #667494;
  border: 1px solid rgba(120, 147, 190, 0.18);
  border-radius: 3px;
  font-size: 0.76em;
  letter-spacing: 0.1em;
}

.menu-actions {
  display: flex;
  gap: 8px;
}

.menu-actions .ghost-btn {
  flex: 1;
}

.control-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 1px;
  color: #6b7594;
  font-size: clamp(9px, 2.55cqw, 11px);
  letter-spacing: 0.09em;
}

.control-line i {
  display: block;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #59607a;
}

.build-line {
  margin: 0;
  color: #343b54;
  font-family: var(--mono);
  font-size: clamp(6px, 1.8cqw, 8px);
  font-weight: 600;
  letter-spacing: 0.13em;
  text-align: center;
}

@keyframes button-sheen {
  0%, 55% { transform: translateX(-170%) rotate(22deg); opacity: 0; }
  68% { opacity: 0.7; }
  82%, 100% { transform: translateX(520%) rotate(22deg); opacity: 0; }
}

/* ---------------------------------------------------------
   Sheets (how-to, pause, results)
   --------------------------------------------------------- */

.screen--sheet,
.screen--modal {
  align-items: center;
  justify-content: center;
  padding:
    calc(env(safe-area-inset-top, 0px) + 18px)
    clamp(15px, 4.2cqw, 24px)
    calc(env(safe-area-inset-bottom, 0px) + 18px);
  background: rgba(3, 4, 10, 0.55);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.screen--sheet { z-index: 32; }

.sheet {
  width: 100%;
  max-width: 430px;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: none;
  padding: clamp(20px, 6cqw, 30px);
  border: 1px solid rgba(136, 177, 225, 0.16);
  border-radius: clamp(18px, 5cqw, 25px);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(38, 91, 127, 0.13), transparent 45%),
    linear-gradient(160deg, rgba(15, 18, 35, 0.97), rgba(7, 8, 18, 0.97));
  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.sheet::-webkit-scrollbar { display: none; }

.screen.is-active .sheet {
  animation: sheet-in 0.38s var(--ease) both;
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(15px, 4cqw, 22px);
}

.close-btn {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #98a4c3;
  border: 1px solid rgba(151, 182, 223, 0.16);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.close-btn:hover {
  color: #fff;
  border-color: rgba(60, 236, 255, 0.4);
}

.sheet h2 {
  margin: 0;
  color: #f6f9ff;
  font-family: var(--display);
  font-size: clamp(27px, 8.2cqw, 39px);
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1;
  text-shadow: 0 0 28px rgba(60, 236, 255, 0.1);
}

.sheet h2 span {
  color: var(--cyan);
}

.sheet-lead {
  margin: clamp(11px, 3.2cqw, 16px) 0 0;
  color: #8d98b9;
  font-size: clamp(11px, 3.05cqw, 14px);
  line-height: 1.72;
  letter-spacing: 0.02em;
}

.rules {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: clamp(18px, 5cqw, 25px);
  overflow: hidden;
  border: 1px solid rgba(134, 168, 214, 0.1);
  border-radius: 13px;
  background: rgba(126, 166, 214, 0.08);
}

.rule {
  display: flex;
  gap: 12px;
  padding: clamp(12px, 3.4cqw, 16px) clamp(12px, 3.4cqw, 16px);
  background: rgba(7, 9, 20, 0.76);
}

.rule-num {
  flex: 0 0 auto;
  padding-top: 2px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: clamp(8px, 2.3cqw, 10px);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.rule strong {
  display: block;
  color: #e2eaff;
  font-size: clamp(11px, 3.1cqw, 14px);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.rule p {
  margin: 0.55em 0 0;
  color: #7883a3;
  font-size: clamp(9px, 2.55cqw, 12px);
  line-height: 1.65;
}

.power-title {
  margin: clamp(19px, 5cqw, 26px) 0 0;
  color: #7784a5;
  font-family: var(--mono);
  font-size: clamp(8px, 2.4cqw, 10px);
  font-weight: 700;
  letter-spacing: 0.13em;
}

.power-title span { color: var(--pink); }

.power-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 9px;
}

.power-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid rgba(134, 168, 214, 0.1);
  border-radius: 9px;
  background: rgba(11, 14, 28, 0.66);
}

.power-item b {
  display: grid;
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  place-items: center;
  color: #061116;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.08);
}

.power-item span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #dfe6f7;
  font-size: clamp(10px, 2.75cqw, 12px);
  font-weight: 600;
  line-height: 1.2;
}

.power-item small {
  color: #59657f;
  font-family: var(--mono);
  font-size: 0.68em;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.p-m { background: var(--cyan); }
.p-w { background: var(--lime); }
.p-l { background: var(--pink); }
.p-s { background: var(--violet); }
.p-n { background: var(--gold); }
.p-h { background: #ff88b6; }

.how-foot {
  margin: clamp(10px, 2.8cqw, 14px) 0 0;
  color: #4e5874;
  font-family: var(--mono);
  font-size: clamp(7px, 2.05cqw, 9px);
  line-height: 1.7;
  text-align: center;
}

/* Modals */

.screen--modal {
  z-index: 33;
  background:
    radial-gradient(ellipse at center, rgba(23, 31, 57, 0.14), transparent 60%),
    rgba(3, 4, 10, 0.66);
  backdrop-filter: blur(10px) saturate(0.85);
  -webkit-backdrop-filter: blur(10px) saturate(0.85);
}

.modal-card {
  max-width: 370px;
  text-align: center;
}

.modal-card h2 {
  margin-top: clamp(8px, 2.2cqw, 12px);
  font-size: clamp(30px, 8.8cqw, 42px);
}

.modal-card .sheet-lead {
  margin-bottom: clamp(17px, 4.5cqw, 23px);
}

.modal-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.modal-row .ghost-btn { flex: 1; }

.modal-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: clamp(16px, 4.5cqw, 22px);
}

.modal-links span {
  width: 1px;
  height: 11px;
  background: rgba(148, 173, 211, 0.18);
}

.result-card {
  max-width: 390px;
}

.record-line {
  min-height: 1.4em;
  margin: clamp(8px, 2.2cqw, 11px) 0 0;
  color: var(--lime);
  font-family: var(--mono);
  font-size: clamp(8px, 2.3cqw, 10px);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.result-score {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: clamp(15px, 4.3cqw, 21px);
  padding: clamp(12px, 3.4cqw, 17px) 10px;
  border: 1px solid rgba(129, 171, 221, 0.12);
  border-radius: 13px;
  background: rgba(9, 12, 24, 0.66);
}

.result-score span {
  color: #5b6683;
  font-family: var(--mono);
  font-size: clamp(7px, 2.1cqw, 9px);
  font-weight: 700;
  letter-spacing: 0.18em;
}

.result-score strong {
  color: #effdff;
  background: linear-gradient(180deg, #ffffff, #7aeeff);
  -webkit-background-clip: text;
  background-clip: text;
  font-family: var(--mono);
  font-size: clamp(31px, 9.4cqw, 45px);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 20px rgba(60, 236, 255, 0.18));
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(129, 171, 221, 0.1);
  border-radius: 11px;
  background: rgba(129, 171, 221, 0.09);
}

.result-grid > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  padding: clamp(9px, 2.6cqw, 13px) 5px;
  background: rgba(8, 10, 22, 0.86);
}

.result-grid span {
  overflow: hidden;
  color: #59647f;
  font-size: clamp(8px, 2.3cqw, 10px);
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-grid strong {
  color: #dbe9ff;
  font-family: var(--mono);
  font-size: clamp(12px, 3.45cqw, 16px);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.result-card .btn-primary { margin-top: clamp(17px, 4.6cqw, 23px); }

.result-card > .text-btn {
  display: block;
  margin: 7px auto 0;
}

.result-card--win {
  position: relative;
  overflow: hidden;
  border-color: rgba(60, 236, 255, 0.26);
  box-shadow:
    0 25px 90px rgba(0, 0, 0, 0.68),
    0 0 65px rgba(60, 236, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.result-card--win .kicker { color: var(--lime); }

.win-orbit {
  position: relative;
  width: 66px;
  height: 66px;
  margin: -4px auto 12px;
  border: 1px solid rgba(60, 236, 255, 0.2);
  border-radius: 50%;
  animation: spin 18s linear infinite;
}

.win-orbit::before,
.win-orbit::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 79, 158, 0.14);
  border-radius: 50%;
}

.win-orbit::before { inset: 8px; }
.win-orbit::after { inset: 19px; background: rgba(60, 236, 255, 0.08); }
.win-orbit i {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px 2px rgba(60, 236, 255, 0.5);
}
.win-orbit i:nth-child(1) { top: -3px; left: 30px; }
.win-orbit i:nth-child(2) { right: 3px; bottom: 12px; background: var(--pink); box-shadow: 0 0 12px 2px rgba(255, 79, 158, 0.5); }
.win-orbit i:nth-child(3) { left: 10px; bottom: 10px; width: 3px; height: 3px; }

/* Fatal error card */
.fatal {
  position: absolute;
  z-index: 100;
  right: 14px;
  bottom: 14px;
  left: 14px;
  padding: 14px;
  color: #ffd8de;
  border: 1px solid rgba(255, 99, 99, 0.45);
  border-radius: 12px;
  background: rgba(37, 7, 15, 0.97);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}

/* ---------------------------------------------------------
   Responsive details
   --------------------------------------------------------- */

@container (max-width: 360px) {
  .brand-copy small { display: none; }
  .brand-copy { font-size: 8px; }
  #hudLevelName { max-width: 13cqw; }
  .hud { gap: 1cqw; }
  .control-line { gap: 6px; }
  .build-line { display: none; }
  .sheet { padding: 18px; }
  .result-grid span { font-size: 7px; }
  .result-card .btn-primary { margin-top: 12px; }
}

@media (max-height: 760px) {
  .hero { padding-top: 1%; }
  .tagline { margin-top: 8px; }
  .menu-bottom { gap: 8px; }
  .menu-ring { top: 34%; }
  .menu-core { top: 34%; }
  .build-line { display: none; }
}

@media (hover: none) {
  .btn-primary:hover { transform: none; }
  .ghost-btn:hover { color: inherit; border-color: rgba(156, 188, 233, 0.19); background: rgba(13, 17, 33, 0.35); }
}

@media (max-width: 620px) {
  .stage {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

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


/* Portrait recommendation for short landscape screens */
.rotate-hint {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 24px;
  text-align: center;
  background: #05050d;
}
.rotate-hint .rotate-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 8px;
  place-items: center;
  color: var(--cyan);
  border: 1px solid rgba(60, 236, 255, 0.28);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 25px;
  box-shadow: 0 0 30px rgba(60, 236, 255, 0.12);
}
.rotate-hint strong {
  color: #e9f7ff;
  font-size: 20px;
  letter-spacing: 0.12em;
}
.rotate-hint small {
  color: #59627f;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.13em;
}

@media (orientation: landscape) and (max-height: 540px) {
  .rotate-hint { display: flex; }
}


@container (max-width: 340px) {
  .power-grid { grid-template-columns: repeat(2, 1fr); }
  .power-item { gap: 6px; padding: 6px; }
  .power-item b { width: 22px; height: 22px; }
}
