:root {
  --theme: #FF8A3D;
  --theme-light: #FFD36A;
  --theme-deep: #E9691F;
  --magic: #A55CFF;
  --magic-deep: #5B21A8;
  --ink: #2A1145;
  --glass: rgba(43, 16, 78, 0.62);
  --glass-line: rgba(255, 255, 255, 0.24);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #16082c;
  overscroll-behavior: none;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

button {
  font-family: inherit;
  color: inherit;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ic {
  display: block;
  width: 1em;
  height: 1em;
  fill: currentColor;
  pointer-events: none;
}

.app {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #16082c;
  touch-action: none;
  isolation: isolate;
}

@supports (height: 100dvh) {
  .app {
    height: 100dvh;
  }
}

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

.scene-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(120% 78% at 50% 28%, rgba(20, 6, 42, 0) 48%, rgba(20, 6, 42, 0.32) 100%),
    linear-gradient(180deg, rgba(23, 7, 45, 0.28) 0%, rgba(23, 7, 45, 0) 17%, rgba(23, 7, 45, 0) 78%, rgba(23, 7, 45, 0.28) 100%);
}

.flash {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(85% 70% at 50% 55%, rgba(255, 92, 160, 0.12) 0%, rgba(255, 70, 130, 0.52) 100%);
}

.slow-tint {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  background:
    radial-gradient(100% 70% at 50% 40%, rgba(122, 222, 255, 0) 40%, rgba(94, 178, 255, 0.32) 100%),
    linear-gradient(180deg, rgba(172, 239, 255, 0.14), rgba(99, 140, 255, 0.1));
  box-shadow: inset 0 0 70px rgba(118, 218, 255, 0.4);
}

.slow-tint.on {
  opacity: 1;
}

.dash-tint {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background:
    radial-gradient(82% 62% at 50% 58%, rgba(255, 174, 73, 0) 42%, rgba(255, 138, 61, 0.28) 100%),
    linear-gradient(118deg, rgba(255, 217, 120, 0.08), rgba(255, 104, 190, 0.12));
  box-shadow: inset 0 0 60px rgba(255, 176, 74, 0.35);
}

.dash-tint.on {
  opacity: 1;
}

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

.hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.app.is-playing .hud {
  opacity: 1;
  transform: translateY(0);
}

.hud button {
  pointer-events: auto;
}

.hud-top {
  position: absolute;
  left: calc(12px + var(--safe-left));
  right: calc(12px + var(--safe-right));
  top: calc(10px + var(--safe-top));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.avatar {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 244, 213, 0.92);
  background: linear-gradient(160deg, #8f5cff, #ff9de0);
  box-shadow:
    0 0 0 3px rgba(166, 93, 255, 0.42),
    0 6px 16px rgba(34, 8, 60, 0.45),
    inset 0 0 12px rgba(255, 255, 255, 0.35);
  overflow: hidden;
  z-index: 1;
}

.avatar-img {
  position: absolute;
  inset: 0;
  background-image: url("images/gen/gptimg_1795162768_look.png");
  background-repeat: no-repeat;
  background-size: 410px 273px;
  background-position: -3px -3px;
  transform: scale(1.02);
}

.avatar-glow {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px solid rgba(255, 211, 106, 0.62);
  animation: avatarPulse 2.8s ease-out infinite;
  pointer-events: none;
}

@keyframes avatarPulse {
  0% { transform: scale(0.92); opacity: 0.9; }
  70% { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1.18); opacity: 0; }
}

.hearts {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 30px;
  padding: 0 9px 0 7px;
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(57, 24, 100, 0.78), rgba(35, 11, 67, 0.66));
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 5px 14px rgba(25, 5, 48, 0.25);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.heart {
  width: 19px;
  height: 19px;
  color: #ff5da8;
  filter: drop-shadow(0 1px 3px rgba(114, 10, 68, 0.55)) drop-shadow(0 0 6px rgba(255, 92, 166, 0.5));
  transition: transform 0.3s cubic-bezier(0.2, 1.6, 0.4, 1), color 0.3s ease, opacity 0.3s ease;
}

.heart.lost {
  color: rgba(255, 255, 255, 0.2);
  filter: none;
  transform: scale(0.78);
}

.heart.hurt {
  animation: heartHurt 0.45s ease;
}

@keyframes heartHurt {
  0% { transform: scale(1.45) rotate(-9deg); }
  45% { transform: scale(0.72) rotate(7deg); }
  100% { transform: scale(0.78); }
}

.hud-top-right {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.score-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.score-pill {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 30px;
  min-width: 88px;
  padding: 0 12px 0 10px;
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(57, 24, 100, 0.8), rgba(35, 11, 67, 0.68));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 5px 14px rgba(25, 5, 48, 0.25);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 1px 2px rgba(40, 8, 70, 0.55);
}

.score-pill .ic {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
}

.star-pill .ic {
  color: #ffd15c;
  filter: drop-shadow(0 0 7px rgba(255, 190, 70, 0.82));
}

.crown-pill .ic {
  color: #ffc247;
  filter: drop-shadow(0 0 7px rgba(255, 170, 50, 0.75));
}

.score-pill.bump {
  animation: scoreBump 0.32s cubic-bezier(0.2, 1.8, 0.4, 1);
}

@keyframes scoreBump {
  0% { transform: scale(1); }
  44% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.round-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(64, 29, 111, 0.8), rgba(37, 12, 70, 0.7));
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 5px 14px rgba(25, 5, 48, 0.28);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  transition: transform 0.12s ease, background 0.2s ease;
}

.round-icon .ic {
  width: 16px;
  height: 16px;
  color: rgba(255, 255, 255, 0.92);
}

.round-icon:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.22);
}

.energy {
  position: absolute;
  left: calc(12px + var(--safe-left));
  top: 42%;
  width: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.energy-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 28px;
  padding: 7px 0 6px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(57, 24, 100, 0.78), rgba(35, 11, 67, 0.64));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 5px 14px rgba(25, 5, 48, 0.22);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.energy-label .ic {
  width: 11px;
  height: 11px;
  color: #ffd36a;
  filter: drop-shadow(0 0 5px rgba(255, 198, 84, 0.9));
}

.energy-label span {
  writing-mode: vertical-rl;
  font-size: 9px;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 700;
}

.energy-bar {
  position: relative;
  width: 11px;
  height: 128px;
  border-radius: 7px;
  background: rgba(36, 12, 68, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 0 8px rgba(17, 4, 34, 0.6), 0 3px 12px rgba(25, 5, 48, 0.24);
  overflow: hidden;
}

.energy-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: linear-gradient(0deg, #ff7a2d 0%, #ffbe4d 52%, #fff3bd 100%);
  box-shadow: 0 0 10px rgba(255, 182, 70, 0.95);
  transition: height 0.2s ease-out;
  border-radius: 6px;
}

.energy-pip {
  position: absolute;
  left: 50%;
  bottom: calc(10% + var(--i) * 20%);
  width: 5px;
  height: 5px;
  transform: translateX(-50%) rotate(45deg);
  background: rgba(255, 255, 255, 0.22);
  border-radius: 1px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.energy-pip.on {
  background: #fffdf4;
  box-shadow: 0 0 6px #ffd36a;
}

.powerups {
  position: absolute;
  right: calc(11px + var(--safe-right));
  top: 35%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.powerup {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(150deg, rgba(96, 48, 160, 0.86), rgba(43, 16, 78, 0.82));
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -4px 9px rgba(28, 7, 53, 0.5),
    0 6px 16px rgba(25, 5, 48, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.13s ease, opacity 0.2s ease, filter 0.2s ease;
}

.powerup::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0) 58%);
  pointer-events: none;
}

.powerup:active {
  transform: scale(0.9);
}

.powerup-orb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  color: #ffe4a8;
  background: radial-gradient(circle at 34% 26%, #c08bff, #7429c9 55%, #3c106d);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.25), 0 0 14px rgba(166, 92, 255, 0.55);
}

.powerup-orb .ic {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 1px 2px rgba(40, 7, 70, 0.5));
}

.shield-orb {
  color: #ffe1ef;
  background: radial-gradient(circle at 34% 26%, #ffb0d7, #e64090 55%, #841147);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.3), 0 0 14px rgba(255, 94, 166, 0.52);
}

.slow-orb {
  color: #e9fbff;
  background: radial-gradient(circle at 34% 26%, #b4f1ff, #3ba7e8 55%, #165e9d);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.35), 0 0 14px rgba(95, 202, 255, 0.55);
}

.powerup-count {
  position: absolute;
  right: -2px;
  bottom: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: linear-gradient(180deg, #ffe08d, #ff9a3e);
  border: 1px solid rgba(255, 251, 232, 0.85);
  color: #4b1c00;
  font-size: 11px;
  line-height: 16px;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 2px 6px rgba(55, 15, 0, 0.35);
}

.powerup.empty {
  opacity: 0.42;
  filter: saturate(0.4);
}

.powerup.active {
  animation: powerPulse 1.15s ease-in-out infinite;
}

.powerup.active::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 215, 120, 0.85);
  box-shadow: 0 0 16px rgba(255, 197, 91, 0.7);
  pointer-events: none;
}

@keyframes powerPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.bottom-bar {
  position: absolute;
  left: calc(14px + var(--safe-left));
  right: calc(14px + var(--safe-right));
  bottom: calc(16px + var(--safe-bottom));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.move-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  pointer-events: none;
}

.game-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  pointer-events: auto;
  color: #fff;
  background:
    radial-gradient(circle at 50% 34%, rgba(188, 142, 255, 0.32), rgba(71, 31, 120, 0.48) 68%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -8px 18px rgba(44, 13, 84, 0.35),
    0 0 22px rgba(180, 112, 255, 0.35),
    0 8px 20px rgba(26, 6, 50, 0.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.11s ease, box-shadow 0.16s ease;
}

.game-btn::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  pointer-events: none;
}

.game-btn:active,
.game-btn.pressed {
  transform: scale(0.9);
  box-shadow:
    inset 0 2px 8px rgba(40, 12, 80, 0.4),
    0 0 24px rgba(255, 204, 112, 0.5),
    0 3px 10px rgba(26, 6, 50, 0.35);
}

.jump-btn {
  width: 70px;
  height: 70px;
  padding-top: 2px;
}

.jump-btn .ic {
  width: 27px;
  height: 27px;
  filter: drop-shadow(0 2px 4px rgba(42, 10, 78, 0.5));
}

.btn-label {
  margin-top: 1px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.86);
}

.slide-btn {
  width: 48px;
  height: 48px;
}

.slide-btn .ic {
  width: 21px;
  height: 21px;
  opacity: 0.92;
}

.dash-btn {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  pointer-events: auto;
  --p: 0;
  transition: transform 0.12s ease;
}

.dash-btn:active {
  transform: scale(0.92);
}

.dash-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from -90deg, #ffd36a calc(var(--p) * 1%), rgba(255, 255, 255, 0.17) 0);
  box-shadow: 0 0 16px rgba(255, 186, 76, 0.3);
  transition: background 0.16s linear;
}

.dash-core {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(173, 117, 255, 0.5), rgba(63, 24, 111, 0.92) 68%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02));
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -8px 16px rgba(31, 7, 60, 0.5), 0 6px 18px rgba(28, 7, 54, 0.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
}

.dash-core .ic {
  width: 26px;
  height: 26px;
  margin-top: -6px;
  color: rgba(255, 255, 255, 0.9);
  filter: drop-shadow(0 0 8px rgba(208, 154, 255, 0.8));
}

.dash-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  text-align: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.78);
}

.dash-btn.ready .dash-core {
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 244, 189, 0.6), rgba(255, 145, 53, 0.92) 56%, rgba(133, 46, 14, 0.95) 100%);
  border-color: rgba(255, 245, 200, 0.95);
  box-shadow: 0 0 24px rgba(255, 176, 66, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.dash-btn.ready .dash-core .ic {
  color: #fffdf0;
  filter: drop-shadow(0 0 10px rgba(255, 245, 185, 0.95));
}

.dash-btn.ready .dash-label {
  color: #fff8dc;
}

.dash-btn.ready .dash-ring {
  animation: dashSpin 2.4s linear infinite;
  box-shadow: 0 0 22px rgba(255, 190, 80, 0.7);
}

.dash-btn.ready {
  animation: dashReady 1.6s ease-in-out infinite;
}

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

@keyframes dashReady {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.dash-btn.dashing .dash-core {
  background: radial-gradient(circle at 50% 30%, #fffbe3, #ffb63e 60%, #e65c14);
  box-shadow: 0 0 34px rgba(255, 201, 96, 0.95), inset 0 0 18px rgba(255, 255, 255, 0.75);
}

.dash-btn.dashing .dash-core .ic {
  color: #6a2800;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: calc(102px + var(--safe-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(37, 13, 70, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 14px rgba(22, 5, 41, 0.26);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.82);
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 0;
  pointer-events: none;
}

.hint.show {
  opacity: 1;
}

.hint.hide {
  opacity: 0;
  transform: translate(-50%, 8px);
}

.hint i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 209, 106, 0.72);
}

.toast {
  position: absolute;
  left: 50%;
  top: 31%;
  transform: translate(-50%, 8px) scale(0.92);
  max-width: 82vw;
  padding: 9px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(77, 35, 130, 0.94), rgba(48, 18, 88, 0.92));
  border: 1px solid rgba(255, 213, 130, 0.48);
  box-shadow: 0 8px 26px rgba(18, 4, 38, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #fff6db;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.2, 1.5, 0.4, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

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

/* ------------------------------------------------------------------ */
/* Start screen                                                        */
/* ------------------------------------------------------------------ */

.start-screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  background: #1a0b33;
  transition: opacity 0.68s ease, transform 0.8s cubic-bezier(0.3, 0.7, 0.3, 1), visibility 0.68s;
  transform: scale(1);
}

.start-screen.gone {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.045);
  pointer-events: none;
}

.start-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transform: scale(1.045);
  animation: kenburns 22s ease-in-out infinite alternate;
  filter: saturate(1.07) contrast(1.02);
  will-change: transform;
}

@keyframes kenburns {
  0% { transform: scale(1.045) translate3d(0, 0, 0); }
  100% { transform: scale(1.115) translate3d(-0.6%, -1.2%, 0); }
}

.start-tint {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(20, 6, 44, 0.68) 0%, rgba(24, 8, 50, 0.22) 20%, rgba(26, 9, 52, 0.02) 38%, rgba(24, 8, 50, 0.06) 55%, rgba(22, 7, 46, 0.72) 82%, rgba(17, 4, 35, 0.96) 100%),
    radial-gradient(90% 50% at 50% 94%, rgba(255, 126, 51, 0.28) 0%, rgba(255, 126, 51, 0) 68%),
    radial-gradient(60% 38% at 50% 44%, rgba(171, 94, 255, 0.12) 0%, rgba(171, 94, 255, 0) 100%);
  pointer-events: none;
}

.start-sparks {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.spark {
  position: absolute;
  width: var(--s, 4px);
  height: var(--s, 4px);
  border-radius: 50%;
  background: #fff4be;
  box-shadow: 0 0 8px 2px rgba(255, 221, 125, 0.7);
  opacity: 0;
  animation: sparkFloat var(--d, 7s) linear infinite;
  animation-delay: var(--delay, 0s);
  left: var(--x, 50%);
  top: var(--y, 70%);
}

@keyframes sparkFloat {
  0% { opacity: 0; transform: translate3d(0, 18px, 0) scale(0.5); }
  16% { opacity: 0.9; }
  70% { opacity: 0.65; }
  100% { opacity: 0; transform: translate3d(var(--dx, 10px), -80px, 0) scale(1.1); }
}

.start-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: calc(7vh + var(--safe-top)) max(18px, calc(env(safe-area-inset-left) + 14px)) calc(4vh + var(--safe-bottom));
  max-width: 560px;
  margin: 0 auto;
}

.start-head {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(35, 12, 68, 0.52);
  border: 1px solid rgba(255, 226, 160, 0.38);
  box-shadow: 0 4px 16px rgba(19, 4, 38, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255, 245, 219, 0.94);
  text-shadow: 0 1px 2px rgba(30, 6, 55, 0.5);
}

.eyebrow .ic {
  width: 12px;
  height: 12px;
  color: #ffd36a;
  filter: drop-shadow(0 0 5px rgba(255, 204, 96, 0.9));
}

.logo {
  margin: 14px 0 0;
  font-size: clamp(42px, 13.2vw, 64px);
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-shadow:
    0 2px 0 #a83d1d,
    0 5px 0 rgba(90, 25, 70, 0.55),
    0 10px 26px rgba(37, 5, 55, 0.6),
    0 0 30px rgba(255, 157, 72, 0.3);
}

.logo span {
  background: linear-gradient(180deg, #fffdf2 0%, #fff0b6 38%, #ffcf62 72%, #ff9838 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.42);
}

.logo em {
  display: inline-block;
  margin-left: 0.04em;
  font-style: normal;
  background: linear-gradient(180deg, #fff6dc 0%, #ffc98a 30%, #ff8a3d 65%, #f25a75 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 245, 225, 0.48);
  filter: drop-shadow(0 0 16px rgba(255, 138, 61, 0.5));
}

.tagline {
  margin: 12px 0 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255, 248, 235, 0.88);
  text-shadow: 0 1px 6px rgba(20, 4, 40, 0.72);
}

.start-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.best-line {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(35, 12, 68, 0.46);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 248, 232, 0.82);
  font-size: 10px;
  letter-spacing: 0.06em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.best-line .ic {
  width: 13px;
  height: 13px;
  color: #ffce62;
}

.best-line b {
  font-size: 13px;
  color: #fff5cd;
  font-variant-numeric: tabular-nums;
}

.start-btn {
  position: relative;
  width: min(270px, 76vw);
  height: 62px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  color: #4a1a00;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.14em;
  background: linear-gradient(180deg, #ffe69b 0%, #ffbd58 40%, #ff8a3d 76%, #f27527 100%);
  border: 2px solid rgba(255, 250, 226, 0.92);
  box-shadow:
    0 7px 0 #bf541a,
    0 12px 0 rgba(100, 36, 12, 0.22),
    0 18px 34px rgba(255, 105, 30, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.8),
    inset 0 -4px 8px rgba(171, 62, 13, 0.26);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.start-btn:active {
  transform: translateY(5px);
  box-shadow:
    0 2px 0 #bf541a,
    0 4px 0 rgba(100, 36, 12, 0.2),
    0 9px 20px rgba(255, 105, 30, 0.36),
    inset 0 2px 0 rgba(255, 255, 255, 0.65);
}

.start-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(94, 27, 0, 0.14);
  border: 1px solid rgba(119, 38, 0, 0.18);
}

.start-btn-icon .ic {
  width: 16px;
  height: 16px;
  margin-left: 2px;
  color: #6a2600;
}

.start-btn-sheen {
  position: absolute;
  top: -40%;
  left: -30%;
  width: 28%;
  height: 180%;
  transform: rotate(22deg);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0));
  animation: sheen 3.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sheen {
  0% { left: -40%; }
  46% { left: 118%; }
  100% { left: 118%; }
}

.start-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px 13px;
  margin-top: 18px;
  color: rgba(255, 247, 232, 0.72);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 4px rgba(18, 4, 38, 0.6);
}

.start-hint span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.start-hint .ic {
  width: 13px;
  height: 13px;
  color: rgba(255, 213, 132, 0.88);
}

/* ------------------------------------------------------------------ */
/* Modals                                                              */
/* ------------------------------------------------------------------ */

.modal {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(16, 5, 33, 0.5);
  backdrop-filter: blur(10px) saturate(1.05);
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
}

.modal[hidden] {
  display: none !important;
}

.modal-card {
  position: relative;
  width: min(348px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px 20px 20px;
  border-radius: 28px;
  background:
    radial-gradient(100% 80% at 50% 0%, rgba(157, 92, 236, 0.35), rgba(157, 92, 236, 0) 64%),
    linear-gradient(165deg, rgba(84, 37, 138, 0.98), rgba(44, 16, 81, 0.99) 62%, rgba(31, 10, 59, 0.99));
  border: 1px solid rgba(255, 225, 168, 0.36);
  box-shadow:
    0 30px 70px rgba(5, 0, 15, 0.62),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
  text-align: center;
  animation: cardIn 0.38s cubic-bezier(0.2, 1.5, 0.4, 1);
}

@keyframes cardIn {
  0% { opacity: 0; transform: translateY(16px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: rgba(255, 215, 140, 0.85);
}

.modal-card h2 {
  margin: 6px 0 0;
  font-size: 28px;
  letter-spacing: 0.08em;
  font-weight: 900;
  background: linear-gradient(180deg, #fffdf4, #ffe1a5 62%, #ffb45e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 8px rgba(30, 5, 55, 0.3);
}

.modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 18px 0 20px;
}

.modal-stats > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.modal-stats span {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(255, 244, 225, 0.64);
}

.modal-stats b {
  font-size: 21px;
  line-height: 1.1;
  font-weight: 900;
  color: #fff6d9;
  font-variant-numeric: tabular-nums;
}

.big-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.big-score span {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(255, 244, 225, 0.66);
}

.big-score b {
  font-size: 46px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fffef5 0%, #ffe9a8 44%, #ffb94b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 8px rgba(255, 150, 50, 0.28));
}

.primary-btn,
.ghost-btn {
  width: 100%;
  height: 52px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.1em;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.primary-btn {
  color: #491900;
  background: linear-gradient(180deg, #ffe9a3, #ffbd58 42%, #ff8a3d 100%);
  border: 1.5px solid rgba(255, 250, 230, 0.9);
  box-shadow: 0 5px 0 #b94e16, 0 12px 22px rgba(255, 111, 30, 0.32), inset 0 2px 0 rgba(255, 255, 255, 0.75);
}

.primary-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #b94e16, 0 6px 14px rgba(255, 111, 30, 0.28);
}

.ghost-btn {
  margin-top: 9px;
  color: rgba(255, 247, 232, 0.94);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.ghost-btn:active {
  transform: scale(0.985);
  background: rgba(255, 255, 255, 0.12);
}

.modal-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.11);
  color: rgba(255, 245, 226, 0.68);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.tool-btn .ic {
  width: 13px;
  height: 13px;
}

.tool-btn:active {
  background: rgba(255, 255, 255, 0.12);
}

.new-record {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff4b0, #ffc14d);
  border: 1px solid rgba(255, 252, 229, 0.95);
  color: #6a2600;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  box-shadow: 0 4px 14px rgba(255, 164, 44, 0.46);
  white-space: nowrap;
}

.new-record .ic {
  width: 12px;
  height: 12px;
}

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

@media (max-height: 720px) {
  .start-content {
    padding-top: calc(4.5vh + var(--safe-top));
    padding-bottom: calc(3vh + var(--safe-bottom));
  }

  .logo {
    font-size: clamp(36px, 11.5vw, 52px);
    margin-top: 10px;
  }

  .tagline {
    margin-top: 8px;
    font-size: 11px;
  }

  .best-line {
    margin-bottom: 9px;
  }

  .start-btn {
    height: 56px;
    font-size: 17px;
  }

  .start-hint {
    margin-top: 12px;
  }

  .energy-bar {
    height: 100px;
  }

  .powerups {
    top: 33%;
    gap: 9px;
  }

  .powerup {
    width: 43px;
    height: 43px;
  }

  .powerup-orb {
    width: 29px;
    height: 29px;
  }

  .powerup-orb .ic {
    width: 18px;
    height: 18px;
  }

  .jump-btn {
    width: 62px;
    height: 62px;
  }

  .dash-btn {
    width: 70px;
    height: 70px;
  }

  .slide-btn {
    width: 43px;
    height: 43px;
  }

  .hint {
    bottom: calc(90px + var(--safe-bottom));
  }

  .avatar {
    width: 43px;
    height: 43px;
    flex-basis: 43px;
  }

  .score-pill {
    height: 28px;
    min-width: 82px;
    font-size: 14px;
  }
}

@media (max-height: 620px) {
  .tagline {
    display: none;
  }

  .energy {
    top: 38%;
  }

  .energy-bar {
    height: 84px;
  }

  .powerups {
    top: 31%;
  }

  .start-hint {
    display: none;
  }

  .start-btn {
    margin-top: 4px;
  }

  .hint {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .start-content {
    padding-top: calc(10px + var(--safe-top));
    padding-bottom: calc(10px + var(--safe-bottom));
  }

  .start-head {
    align-items: flex-start;
    text-align: left;
  }

  .logo {
    font-size: 40px;
    margin-top: 4px;
  }

  .tagline {
    display: none;
  }

  .start-foot {
    align-items: flex-end;
    margin-top: auto;
  }

  .start-btn {
    width: 220px;
    height: 50px;
  }

  .start-hint {
    display: none;
  }

  .energy {
    top: 36%;
  }

  .energy-bar {
    height: 80px;
  }

  .powerups {
    top: 28%;
    flex-direction: row;
  }

  .bottom-bar {
    bottom: calc(10px + var(--safe-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .start-art,
  .start-btn-sheen,
  .spark,
  .avatar-glow,
  .dash-btn.ready,
  .dash-btn.ready .dash-ring {
    animation: none !important;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}
