html,
body {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #06080d;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

button {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.flicker-app {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 7px;
  color: #f7f9ff;
  background:
    radial-gradient(circle at 50% -12%, rgba(57, 111, 218, 0.18), transparent 38%),
    #06080d;
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

.menu-screen,
.game-screen {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #080c14;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 18px 60px rgba(0, 0, 0, 0.38);
}

.render-host {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.webgl-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}

.menu-render-host .webgl-canvas {
  pointer-events: none;
}

.game-render-host .webgl-canvas {
  pointer-events: auto;
}

.menu-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(4, 7, 13, 0.08), rgba(4, 7, 13, 0.72) 79%, rgba(4, 7, 13, 0.94)),
    radial-gradient(circle at 50% 28%, transparent 0 22%, rgba(5, 8, 15, 0.18) 58%, rgba(5, 8, 15, 0.72));
}

.menu-content {
  position: relative;
  z-index: 4;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: end;
  justify-items: center;
  gap: 15px;
  padding: clamp(26px, 5vh, 52px) 20px max(22px, env(safe-area-inset-bottom));
  text-align: center;
  pointer-events: none;
}

.menu-heading,
.menu-actions,
.menu-footnote {
  pointer-events: auto;
}

.menu-heading small,
.modal-kicker {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: #8fbaff;
  text-shadow: 0 0 18px rgba(78, 142, 255, 0.48);
}

.menu-heading h1 {
  margin: 6px 0 0;
  font-family: Impact, "Arial Black", system-ui, sans-serif;
  font-size: clamp(4rem, 15vw, 7.8rem);
  line-height: 0.84;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff 0%, #eaf1ff 46%, #89b5ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 7px 0 rgba(24, 55, 112, 0.72))
    drop-shadow(0 0 28px rgba(91, 155, 255, 0.25));
}

.menu-heading p {
  max-width: 450px;
  margin: 15px auto 0;
  font-family: system-ui, sans-serif;
  font-size: clamp(0.86rem, 2.4vw, 1.04rem);
  line-height: 1.42;
  color: rgba(230, 237, 252, 0.75);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.5);
}

.menu-actions {
  width: min(100%, 430px);
  display: grid;
  gap: 9px;
}

.menu-button {
  position: relative;
  width: 100%;
  min-height: 60px;
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  color: white;
  text-align: left;
  backdrop-filter: blur(13px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28),
    0 10px 26px rgba(0, 0, 0, 0.26);
  transition: transform 0.14s ease, filter 0.14s ease;
}

.menu-button::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 16%, rgba(255, 255, 255, 0.18) 48%, transparent 72%);
  transform: translateX(-120%);
  transition: transform 0.42s ease;
}

.menu-button:hover::after {
  transform: translateX(120%);
}

.menu-button:active {
  transform: translateY(3px) scale(0.99);
  filter: brightness(1.12);
}

.menu-button strong,
.menu-button small {
  display: block;
}

.menu-button strong {
  font-size: 1.02rem;
}

.menu-button small {
  margin-top: 2px;
  font-family: system-ui, sans-serif;
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.68);
}

.button-icon {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.18);
  font-size: 0.84rem;
  font-weight: 900;
}

.play-button {
  background: linear-gradient(135deg, rgba(48, 130, 255, 0.96), rgba(32, 70, 172, 0.96));
}

.timed-button {
  background: linear-gradient(135deg, rgba(147, 77, 255, 0.96), rgba(78, 40, 162, 0.96));
}

.settings-button {
  background: linear-gradient(135deg, rgba(42, 49, 67, 0.95), rgba(18, 23, 34, 0.96));
}

.menu-footnote {
  font-family: system-ui, sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  color: rgba(219, 229, 247, 0.42);
}

.game-screen {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  gap: 6px;
  border: 0;
  background: #06080d;
  box-shadow: none;
}

.game-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background: #080c14;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.3),
    0 12px 30px rgba(0, 0, 0, 0.28);
}

.stage-vignette,
.stage-grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.stage-vignette {
  background:
    radial-gradient(circle at 50% 43%, transparent 43%, rgba(5, 8, 14, 0.13) 70%, rgba(4, 6, 10, 0.48) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 22%);
}

.stage-grain {
  opacity: 0.055;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.38'/%3E%3C/svg%3E");
}

.score-fx-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  overflow: hidden;
  pointer-events: none;
}


.flick-guide-hud {
  --power-level: 0%;
  --power-hue: 205;
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: 12px;
  width: min(72%, 330px);
  transform: translateX(-50%);
  padding: 9px 11px 10px;
  border: 1px solid hsla(var(--power-hue), 95%, 72%, 0.7);
  border-radius: 15px;
  background:
    linear-gradient(180deg, rgba(8, 13, 24, 0.88), rgba(7, 10, 18, 0.76));
  box-shadow:
    0 9px 26px rgba(0, 0, 0, 0.35),
    inset 0 1px rgba(255, 255, 255, 0.11),
    0 0 18px hsla(var(--power-hue), 95%, 58%, 0.18);
  backdrop-filter: blur(9px);
  pointer-events: none;
  animation: powerMeterEnter 0.16s ease-out both;
}

.power-meter-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  color: white;
}

.power-bolt {
  color: hsl(var(--power-hue), 100%, 68%);
  font-size: 0.9rem;
  filter: drop-shadow(0 0 7px hsla(var(--power-hue), 100%, 62%, 0.75));
}

.power-label {
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: rgba(233, 240, 255, 0.78);
}

#powerMeterValue {
  min-width: 38px;
  text-align: right;
  font-size: 0.78rem;
  color: hsl(var(--power-hue), 100%, 76%);
  text-shadow: 0 0 10px hsla(var(--power-hue), 100%, 62%, 0.7);
}

.power-meter-track {
  position: relative;
  height: 13px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(2, 5, 11, 0.78);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.72),
    inset 0 -1px rgba(255, 255, 255, 0.06);
}

.power-meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--power-level);
  border-radius: inherit;
  background:
    linear-gradient(
      90deg,
      hsl(205, 100%, 58%) 0%,
      hsl(174, 100%, 55%) 42%,
      hsl(52, 100%, 60%) 72%,
      hsl(10, 100%, 60%) 100%
    );
  box-shadow:
    0 0 12px hsla(var(--power-hue), 100%, 58%, 0.88),
    inset 0 1px rgba(255, 255, 255, 0.55);
  transition: width 0.035s linear;
}

.power-meter-fill::after {
  content: "";
  position: absolute;
  inset: 1px 0 1px auto;
  width: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  filter: blur(3px);
  opacity: 0.66;
}

.power-meter-segments {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent calc(8.333% - 2px),
      rgba(5, 9, 16, 0.82) calc(8.333% - 2px),
      rgba(5, 9, 16, 0.82) 8.333%
    );
}

.flick-guide-hud.max-power {
  animation:
    powerMeterEnter 0.16s ease-out both,
    maxPowerPulse 0.38s ease-in-out infinite alternate;
}

@keyframes powerMeterEnter {
  from {
    opacity: 0;
    transform: translate(-50%, 6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes maxPowerPulse {
  to {
    box-shadow:
      0 9px 26px rgba(0, 0, 0, 0.35),
      inset 0 1px rgba(255, 255, 255, 0.14),
      0 0 25px hsla(var(--power-hue), 100%, 60%, 0.5);
  }
}

.score-pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: Impact, "Arial Black", system-ui, sans-serif;
  font-size: clamp(1.1rem, 4.2vw, 1.7rem);
  letter-spacing: 0.015em;
  color: #fff;
  text-shadow:
    0 3px 0 rgba(18, 32, 61, 0.78),
    0 0 15px currentColor;
  will-change: transform, opacity;
}

.mode-badge,
.timer-badge {
  position: absolute;
  z-index: 10;
  top: 11px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  color: white;
  background: rgba(9, 14, 24, 0.7);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.12),
    0 7px 20px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
}

.mode-badge {
  left: 11px;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.timer-badge {
  left: 50%;
  min-width: 62px;
  transform: translateX(-50%);
  text-align: center;
  font-size: 1.48rem;
  font-weight: 900;
}

.timer-badge.start-flash {
  animation: timerStart 0.28s ease-in-out 7;
}

.timer-badge.low-time {
  color: #fff2a1;
  background: rgba(151, 28, 44, 0.88);
  box-shadow: 0 0 24px rgba(255, 46, 77, 0.45);
  animation: timerLow 0.45s ease-in-out infinite;
}

@keyframes timerStart {
  50% {
    transform: translateX(-50%) scale(1.25);
    background: #438bff;
    box-shadow: 0 0 28px rgba(69, 145, 255, 0.7);
  }
}

@keyframes timerLow {
  50% {
    transform: translateX(-50%) scale(1.12);
  }
}

.round-banner {
  position: absolute;
  z-index: 18;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%) scale(0.75);
  width: min(84%, 440px);
  padding: 17px 18px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 19px;
  text-align: center;
  font-family: Impact, "Arial Black", system-ui, sans-serif;
  font-size: clamp(2rem, 9vw, 4rem);
  letter-spacing: 0.045em;
  color: white;
  background: linear-gradient(135deg, rgba(45, 126, 245, 0.97), rgba(119, 58, 211, 0.97));
  box-shadow:
    0 20px 55px rgba(0, 0, 0, 0.42),
    0 0 40px rgba(93, 126, 255, 0.28);
}

.round-banner.show {
  display: block !important;
  animation: roundBanner 1.15s ease both;
}

@keyframes roundBanner {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6) rotate(-4deg);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08) rotate(2deg);
  }
  32% {
    transform: translate(-50%, -50%) scale(1) rotate(0);
  }
  82% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -56%) scale(0.96);
  }
}

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

.hud-grid > div {
  min-width: 0;
  padding: 7px 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 13px;
  text-align: center;
  background:
    linear-gradient(145deg, rgba(43, 50, 65, 0.98), rgba(20, 24, 34, 0.98));
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.07),
    0 5px 12px rgba(0, 0, 0, 0.18);
}

.hud-grid small,
.hud-grid strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-grid small {
  font-family: system-ui, sans-serif;
  font-size: 0.65rem;
  color: rgba(220, 229, 246, 0.55);
}

.hud-grid strong {
  margin-top: 1px;
  font-size: clamp(0.94rem, 3.5vw, 1.18rem);
  color: #f7f9ff;
}

.hud-grid > div:first-child strong {
  color: #87b9ff;
}

.hud-grid > div:nth-child(3) strong {
  color: #ffd15f;
  text-shadow: 0 0 12px rgba(255, 198, 62, 0.25);
}

.status-text {
  min-height: 18px;
  margin: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  color: rgba(220, 229, 246, 0.66);
}

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

.game-controls button {
  min-width: 0;
  min-height: 40px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  color: #f2f5fb;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: linear-gradient(145deg, #2d3340, #1a1f29);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
}

.screen-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 14px;
  background: rgba(4, 6, 11, 0.8);
  backdrop-filter: blur(13px);
}

.modal-card {
  width: min(100%, 430px);
  max-height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  color: #f6f8ff;
  background:
    radial-gradient(circle at 20% 0%, rgba(83, 131, 229, 0.16), transparent 40%),
    linear-gradient(150deg, rgba(42, 48, 62, 0.99), rgba(18, 22, 31, 0.99));
  box-shadow:
    0 24px 65px rgba(0, 0, 0, 0.52),
    inset 0 1px rgba(255, 255, 255, 0.08);
}

.modal-card h2 {
  margin: 5px 0 18px;
  font-size: 1.58rem;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row small {
  max-width: 270px;
  margin-top: 4px;
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  line-height: 1.35;
  color: rgba(220, 228, 244, 0.58);
}

.setting-row button {
  min-width: 61px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: white;
  background: #2f70d2;
}

.modal-primary,
.modal-secondary {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  border-radius: 14px;
  color: white;
  font-weight: 800;
}

.modal-primary {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(135deg, #4d8cff, #2c5fc4);
  box-shadow: 0 8px 22px rgba(43, 94, 199, 0.25);
}

.modal-secondary {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.055);
}

.results-card {
  text-align: center;
}

.results-card h2 {
  margin-bottom: 5px;
}

.final-score {
  font-family: Impact, "Arial Black", system-ui, sans-serif;
  font-size: clamp(3rem, 15vw, 5rem);
  line-height: 1;
  color: white;
  text-shadow:
    0 6px 0 rgba(29, 75, 156, 0.64),
    0 0 26px rgba(79, 143, 255, 0.22);
}

.final-label {
  display: block;
  margin-top: 4px;
  color: rgba(218, 227, 245, 0.54);
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.results-grid > div {
  padding: 11px 6px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.results-grid small,
.results-grid strong {
  display: block;
}

.results-grid small {
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  color: rgba(218, 227, 245, 0.55);
}

.results-grid strong {
  margin-top: 3px;
  font-size: 1.14rem;
}

.boot-message {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 100;
  transform: translate(-50%, -50%);
  width: min(88%, 420px);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  text-align: center;
  background: #171c27;
}

@media (max-height: 680px) {
  .menu-content {
    gap: 9px;
    padding: 14px 16px 12px;
  }

  .menu-heading h1 {
    font-size: 3.45rem;
  }

  .menu-heading p {
    margin-top: 7px;
    font-size: 0.78rem;
  }

  .menu-actions {
    gap: 6px;
  }

  .menu-button {
    min-height: 48px;
    padding: 6px 11px;
  }

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

  .menu-footnote {
    display: none;
  }

  .modal-card {
    padding: 15px;
  }

  .results-grid {
    margin-top: 10px;
  }

  .modal-primary,
  .modal-secondary {
    min-height: 42px;
    margin-top: 8px;
  }
}
