:root {
  --bg0: #0b0b10;
  --bg1: #0e1026;
  --ink: #f6f2ea;
  --muted: rgba(246, 242, 234, 0.72);
  --dimmer: rgba(246, 242, 234, 0.52);

  --hot: #ff2e63;
  --acid: #d6ff3f;
  --sun: #ffcc00;
  --ice: #26e6ff;

  --card: rgba(20, 20, 34, 0.68);
  --card2: rgba(20, 20, 34, 0.38);
  --stroke: rgba(246, 242, 234, 0.18);
  --stroke2: rgba(246, 242, 234, 0.08);

  --shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  --shadow2: 0 8px 22px rgba(0, 0, 0, 0.45);

  --radius: 18px;
  --radius2: 28px;
  --ease: cubic-bezier(0.2, 0.9, 0.15, 1);

  /* Space reserved for fixed footer */
  --foot-space: 64px;
}

* {
  box-sizing: border-box;
}

/* Ensure the HTML `hidden` attribute always wins */
[hidden] {
  display: none !important;
}

#menuBtn[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(1200px 800px at 10% 10%, rgba(255, 46, 99, 0.22), transparent 60%),
    radial-gradient(900px 700px at 85% 18%, rgba(38, 230, 255, 0.2), transparent 55%),
    radial-gradient(1200px 900px at 55% 110%, rgba(214, 255, 63, 0.14), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  background-attachment: fixed;
  color: var(--ink);
  overflow: hidden;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overscroll-behavior: none;
  font-family: "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Keep scrollbars stable where supported */
html {
  scrollbar-gutter: stable both-edges;
}

/* Note: avoid making the stage scrollable by default.
   Mobile scrollbars/indicators can appear/disappear during layout shifts and feel "jumpy".
   We only enable page scrolling in very short viewports (see media query near bottom). */

body.flash {
  animation: flash 220ms var(--ease) 1;
}

body.hudCrash::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 30%, rgba(255, 46, 99, 0.08) 50%, transparent 70%, rgba(0, 0, 0, 0.35)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0px, rgba(255, 255, 255, 0.04) 1px, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, 0) 5px);
  mix-blend-mode: screen;
  animation: crashSweep 420ms steps(2, end) 1;
  z-index: 5;
}

@keyframes crashSweep {
  0% {
    opacity: 0.2;
    transform: translateY(-6px);
  }
  40% {
    opacity: 0.7;
    transform: translateY(2px);
  }
  100% {
    opacity: 0;
    transform: translateY(0);
  }
}

@keyframes flash {
  0% {
    filter: saturate(100%) contrast(100%);
  }
  50% {
    filter: saturate(135%) contrast(110%);
  }
  100% {
    filter: saturate(100%) contrast(100%);
  }
}

.bg {
  position: fixed;
  inset: -20vmax;
  background: conic-gradient(from 210deg, rgba(255, 46, 99, 0.14), rgba(214, 255, 63, 0.1), rgba(38, 230, 255, 0.12), rgba(255, 204, 0, 0.1), rgba(255, 46, 99, 0.14));
  filter: blur(60px) saturate(120%);
  opacity: 0.65;
  transform: translate3d(0, 0, 0);
  animation: drift 10s var(--ease) infinite alternate;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(1200px 900px at 50% 45%, transparent 40%, rgba(0, 0, 0, 0.48) 78%, rgba(0, 0, 0, 0.72) 100%);
}

@keyframes drift {
  0% {
    transform: translate(-2vmax, -1vmax) rotate(-1.5deg);
  }
  100% {
    transform: translate(2vmax, 1vmax) rotate(1.5deg);
  }
}

.top {
  position: relative;
  z-index: 10;
  padding: 18px 18px 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.title {
  font-family: "Bungee Shade", "ZCOOL KuaiLe", cursive;
  letter-spacing: 0.04em;
  font-size: clamp(24px, 4.6vw, 44px);
  line-height: 1;
  text-transform: uppercase;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.6));
}

.subtitle {
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 14px;
  color: var(--muted);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.hud {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.meter {
  padding: 12px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(10px);
  position: relative;
}

.meter.glitch {
  animation: meterGlitch 220ms steps(2, end) 1;
}

.meter.crash {
  animation: meterCrash 420ms steps(3, end) 1;
  filter: saturate(140%) contrast(110%);
}

.meter.crash::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.04) 0px,
    rgba(255, 255, 255, 0.04) 2px,
    rgba(0, 0, 0, 0) 3px,
    rgba(0, 0, 0, 0) 6px
  );
  mix-blend-mode: screen;
  pointer-events: none;
  opacity: 0.65;
}

.meter.glitch::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 46, 99, 0.0) 0px,
    rgba(255, 46, 99, 0.0) 7px,
    rgba(214, 255, 63, 0.12) 8px,
    rgba(214, 255, 63, 0.0) 15px
  );
  mix-blend-mode: screen;
  pointer-events: none;
}

@keyframes meterGlitch {
  0% {
    transform: translate3d(0, 0, 0);
    filter: saturate(100%);
  }
  30% {
    transform: translate3d(-2px, 1px, 0);
    filter: saturate(145%);
  }
  60% {
    transform: translate3d(2px, -1px, 0);
    filter: saturate(110%);
  }
  100% {
    transform: translate3d(0, 0, 0);
    filter: saturate(100%);
  }
}

@keyframes meterCrash {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  25% {
    transform: translate3d(-3px, 1px, 0) scale(1.01);
  }
  55% {
    transform: translate3d(4px, -1px, 0) scale(0.99);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.meterTextGlitch {
  display: inline-block;
  animation: textGlitch 260ms steps(2, end) 1;
}

@keyframes textGlitch {
  0% {
    transform: translateX(0);
    letter-spacing: 0.02em;
  }
  50% {
    transform: translateX(-2px);
    letter-spacing: 0.14em;
  }
  100% {
    transform: translateX(0);
    letter-spacing: 0.02em;
  }
}

.meterLabel {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(214, 255, 63, 0.12);
  color: rgba(214, 255, 63, 0.92);
  border: 1px solid rgba(214, 255, 63, 0.22);
  font-weight: 700;
}

.meterBar {
  height: 12px;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--stroke2);
}

.meterFill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--acid), var(--sun), var(--hot), var(--ice));
  filter: saturate(120%);
  box-shadow: 0 0 16px rgba(255, 46, 99, 0.35);
  transform-origin: left;
  transform: scaleX(0.08);
}

.meterGlare {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.25) 45%, transparent 60%);
  opacity: 0.5;
  transform: translateX(-60%);
  animation: glare 2.2s linear infinite;
}

@keyframes glare {
  0% {
    transform: translateX(-60%);
  }
  100% {
    transform: translateX(120%);
  }
}

.controls {
  display: flex;
  gap: 10px;
}

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow2);
  backdrop-filter: blur(10px);
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 160ms var(--ease), background 160ms var(--ease), border-color 160ms var(--ease);
}

.btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.22);
}

.btn:active {
  transform: translateY(0px) scale(0.98);
}

.btnGhost {
  background: rgba(255, 255, 255, 0.04);
}

.stage {
  position: relative;
  flex: 1;
  height: auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  padding-bottom: calc(22px + var(--foot-space) + env(safe-area-inset-bottom, 0px));
}

.fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.center {
  position: relative;
  z-index: 2;
  width: min(880px, 100%);
  display: grid;
  place-items: center;
  gap: 18px;
}

.prompt {
  width: min(760px, 100%);
  padding: 16px 16px;
  border-radius: var(--radius2);
  background: linear-gradient(180deg, rgba(20, 20, 34, 0.62), rgba(20, 20, 34, 0.32));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transform: translateZ(0);
}

.promptKicker {
  font-family: "ZCOOL KuaiLe", cursive;
  color: rgba(214, 255, 63, 0.92);
  letter-spacing: 0.02em;
  font-size: 14px;
  margin-bottom: 6px;
}

.promptMain {
  font-size: clamp(16px, 2.4vw, 20px);
  font-weight: 700;
  line-height: 1.45;
}

.promptHint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--dimmer);
  line-height: 1.45;
}

.micro {
  font-size: 12px;
  color: rgba(246, 242, 234, 0.62);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

.chicken {
  border: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  position: relative;
  width: min(320px, 70vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 40px 60px rgba(0, 0, 0, 0.55));
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.chicken:focus-visible {
  outline: 3px solid rgba(214, 255, 63, 0.65);
  outline-offset: 6px;
  border-radius: 999px;
}

.ring {
  position: absolute;
  width: 120%;
  height: 120%;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 50%, rgba(214, 255, 63, 0.16), transparent 55%),
    radial-gradient(circle at 50% 50%, rgba(255, 46, 99, 0.12), transparent 60%);
  filter: blur(0px);
  opacity: 0.9;
  transform: rotate(0deg);
  animation: ring var(--ringDur, 1.6s) linear infinite;
}

@keyframes ring {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.02);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

.tap {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-family: "Bungee Shade", cursive;
  font-size: 18px;
  letter-spacing: 0.1em;
  color: rgba(246, 242, 234, 0.72);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 8px 10px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow2);
}

.chickenSvg {
  width: 92%;
  height: 92%;
  display: grid;
  place-items: center;
  transform: rotate(0deg);
  animation: slowSpin var(--spinDur, 3.2s) linear infinite;
}

@keyframes slowSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 10px 14px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: rgba(246, 242, 234, 0.58);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.35));
}

.footRight {
  white-space: nowrap;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
}

.modalCard {
  width: min(520px, 100%);
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(20, 20, 34, 0.76), rgba(20, 20, 34, 0.38));
  box-shadow: var(--shadow);
  max-height: min(82svh, 720px);
  overflow: auto;
}

.modalCard::-webkit-scrollbar {
  width: 10px;
}

.modalCard::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  border: 3px solid rgba(0, 0, 0, 0);
  background-clip: padding-box;
}

.modalCard::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 999px;
}

.modalTitle {
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 22px;
  letter-spacing: 0.02em;
  color: rgba(255, 204, 0, 0.95);
}

.modalBody {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.modalActions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.modalFine {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(246, 242, 234, 0.5);
}

.modalBody {
  white-space: pre-wrap;
}

/* Admin panel styles (was missing) */
.adminGrid {
  display: grid;
  gap: 12px;
}

.adminRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.adminQuick {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.adminNote {
  font-size: 12px;
  color: rgba(246, 242, 234, 0.62);
}

.field {
  display: grid;
  gap: 6px;
}

.fieldLabel {
  font-size: 12px;
  color: rgba(246, 242, 234, 0.72);
}

.input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  outline: none;
}

.input:focus {
  border-color: rgba(214, 255, 63, 0.35);
  box-shadow: 0 0 0 3px rgba(214, 255, 63, 0.12);
}

/* Gift box (upgraded) */
.giftArea {
  margin-top: 12px;
  display: grid;
  place-items: center;
  gap: 10px;
}

.giftCaption {
  font-size: 12px;
  color: rgba(246, 242, 234, 0.62);
}

.giftBox {
  width: min(260px, 76vw);
  aspect-ratio: 1.12;
  border: 0;
  border-radius: 26px;
  position: relative;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 204, 0, 0.18), rgba(255, 46, 99, 0.12));
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  transform: translateZ(0);
  animation: giftIn 620ms var(--ease) 1;
  overflow: hidden;
  isolation: isolate;
}

.giftBox:hover {
  animation: giftWiggle 680ms var(--ease) 1;
}

.giftBox:active {
  transform: scale(0.985);
}

.giftBox:focus-visible {
  outline: 3px solid rgba(214, 255, 63, 0.65);
  outline-offset: 6px;
}

.giftBody {
  position: absolute;
  inset: 18% 10% 10% 10%;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.12)),
    radial-gradient(120px 80px at 20% 10%, rgba(38, 230, 255, 0.2), transparent 60%),
    radial-gradient(160px 100px at 80% 80%, rgba(214, 255, 63, 0.18), transparent 60%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -6px 20px rgba(0, 0, 0, 0.35);
}

.giftLid {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 6%;
  height: 26%;
  border-radius: 16px 16px 12px 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(0, 0, 0, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.2);
  transform-origin: 50% 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 10px 25px rgba(0, 0, 0, 0.35);
}

.giftRim {
  position: absolute;
  inset: 0;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 204, 0, 0.08);
}

.giftRibbonV {
  position: absolute;
  top: 8%;
  bottom: 12%;
  left: 50%;
  width: 18px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(38, 230, 255, 0.6), rgba(255, 255, 255, 0.12));
  box-shadow: 0 0 18px rgba(38, 230, 255, 0.22);
  border-radius: 10px;
}

.giftRibbonH {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 46%;
  height: 18px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(38, 230, 255, 0.6), rgba(255, 255, 255, 0.12));
  border-radius: 10px;
}

.giftBow {
  position: absolute;
  top: 30%;
  left: 50%;
  width: 84px;
  height: 44px;
  transform: translate(-50%, -50%);
}

.giftBow::before,
.giftBow::after {
  content: "";
  position: absolute;
  width: 40px;
  height: 30px;
  top: 6px;
  border-radius: 18px 18px 18px 6px;
  background: rgba(38, 230, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.giftBow::before {
  left: 0;
  transform: rotate(-12deg);
}

.giftBow::after {
  right: 0;
  transform: rotate(12deg);
  border-radius: 18px 18px 6px 18px;
}

.giftShine {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.18) 45%, transparent 70%);
  transform: translateX(-60%);
  animation: giftShine 2.2s linear infinite;
  mix-blend-mode: screen;
}

.giftSpark {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 18% 30%, rgba(255, 255, 255, 0.22), transparent 28%),
    radial-gradient(circle at 74% 62%, rgba(255, 255, 255, 0.18), transparent 30%),
    radial-gradient(circle at 50% 85%, rgba(255, 255, 255, 0.12), transparent 26%);
  mix-blend-mode: screen;
  opacity: 0.85;
  animation: spark 1.4s linear infinite;
}

@keyframes spark {
  0% {
    transform: translate3d(-2px, -1px, 0);
  }
  50% {
    transform: translate3d(2px, 1px, 0);
  }
  100% {
    transform: translate3d(-2px, -1px, 0);
  }
}

@keyframes giftIn {
  0% {
    transform: translateY(10px) scale(0.86);
    opacity: 0;
  }
  100% {
    transform: translateY(0px) scale(1);
    opacity: 1;
  }
}

@keyframes giftWiggle {
  0% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-2deg);
  }
  55% {
    transform: rotate(2.5deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

@keyframes giftShine {
  0% {
    transform: translateX(-60%);
  }
  100% {
    transform: translateX(120%);
  }
}

.giftBox.opening .giftLid {
  animation: lidOpen 520ms var(--ease) 1 forwards;
}

@keyframes lidOpen {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(-28deg) translateY(-6px);
  }
}

.cooldown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 20;
}

.cooldownCard {
  width: min(520px, 100%);
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(20, 20, 34, 0.86), rgba(20, 20, 34, 0.46));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: popIn 360ms var(--ease) 1;
}

.cooldownTitle {
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 18px;
  color: rgba(255, 46, 99, 0.92);
}

.cooldownMain {
  margin-top: 8px;
  font-weight: 800;
  line-height: 1.45;
}

.cooldownBar {
  margin-top: 10px;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.cooldownFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(255, 46, 99, 0.85), rgba(255, 204, 0, 0.85), rgba(214, 255, 63, 0.85));
}

.cooldownFine {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(246, 242, 234, 0.62);
}

.modalBody a {
  color: rgba(38, 230, 255, 0.9);
  text-decoration: none;
  border-bottom: 1px solid rgba(38, 230, 255, 0.3);
}

.modalBody a:hover {
  border-bottom-color: rgba(38, 230, 255, 0.7);
}

.qrWrap {
  margin-top: 12px;
  display: grid;
  place-items: center;
  gap: 10px;
}

.qrImg {
  width: min(240px, 70vw);
  height: auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  background: rgba(255, 255, 255, 0.85);
}

.giftBtn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(180deg, rgba(255, 204, 0, 0.18), rgba(255, 46, 99, 0.1));
  color: var(--ink);
  padding: 14px 16px;
  border-radius: 18px;
  cursor: pointer;
  box-shadow: var(--shadow2);
  font-weight: 800;
  letter-spacing: 0.02em;
  transform: translateZ(0);
  transition: transform 160ms var(--ease), filter 160ms var(--ease);
}

.giftBtn:hover {
  transform: translateY(-2px) scale(1.01);
  filter: saturate(120%);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
  padding: 14px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.drawerCard {
  width: min(720px, 100%);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(20, 20, 34, 0.86), rgba(20, 20, 34, 0.44));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.drawerTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.drawerTitle {
  font-family: "ZCOOL KuaiLe", cursive;
  font-size: 18px;
  color: rgba(214, 255, 63, 0.92);
}

.drawerBody {
  padding: 10px;
  display: grid;
  gap: 10px;
}

.drawerItem {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms var(--ease), background 160ms var(--ease), border-color 160ms var(--ease);
}

.drawerItem:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
}

.drawerItem:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.drawerItemTitle {
  font-weight: 800;
}

.drawerItemMeta {
  font-size: 12px;
  color: rgba(246, 242, 234, 0.62);
}

.drawerFine {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: rgba(246, 242, 234, 0.52);
}

/* Phase upgrades */
body[data-phase="0"] {
  --spinDur: 3.2s;
  --ringDur: 1.6s;
}

body[data-phase="1"] {
  --spinDur: 2.8s;
  --ringDur: 1.4s;
}

body[data-phase="2"] {
  --spinDur: 2.3s;
  --ringDur: 1.2s;
}

body[data-phase="3"] {
  --spinDur: 1.9s;
  --ringDur: 0.95s;
}

body[data-phase="3"] .bg {
  opacity: 0.78;
  filter: blur(54px) saturate(140%);
}

body[data-phase="3"] .meter {
  border-color: rgba(255, 46, 99, 0.26);
}

body[data-phase="2"] .prompt,
body[data-phase="3"] .prompt {
  border-color: rgba(214, 255, 63, 0.22);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(255, 204, 0, 0.08);
}

body[data-phase="3"] .meterGlare {
  animation-duration: 1.4s;
  opacity: 0.65;
}

/* Motion states injected by JS */
.shake {
  animation: shake 240ms var(--ease) 1;
}

@keyframes shake {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  20% {
    transform: translate3d(-6px, 2px, 0) rotate(-1deg);
  }
  55% {
    transform: translate3d(7px, -3px, 0) rotate(1deg);
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
}

.flyOut {
  animation: flyOut 560ms var(--ease) 1 forwards;
}

.clone {
  will-change: transform, opacity;
  z-index: 4;
}

@keyframes flyOut {
  0% {
    transform: translate3d(var(--dx, 0px), var(--dy, 0px), 0) rotate(var(--r, 0deg)) scale(1);
    opacity: 1;
  }
  60% {
    opacity: 1;
  }
  100% {
    transform: translate3d(calc(var(--dx, 0px) * 4), calc(var(--dy, 0px) * 4), 0) rotate(calc(var(--r, 0deg) + 440deg))
      scale(0.65);
    opacity: 0;
  }
}

/* clones inherit chicken styles but must not animate spin */
.clone .chickenSvg {
  animation: none;
}

.popIn {
  animation: popIn 540ms var(--ease) 1;
}

@keyframes popIn {
  0% {
    transform: scale(0.62) rotate(-12deg);
    filter: blur(1px);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0deg);
    filter: blur(0px);
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .hud {
    grid-template-columns: 1fr;
  }

  .brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .stage {
    min-height: 460px;
  }
}

@media (max-width: 560px) {
  .top {
    padding: 14px 12px 0;
  }

  .meter {
    padding: 10px;
  }

  .controls {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .btn {
    padding: 10px 14px;
    min-height: 44px;
  }

  .prompt {
    padding: 14px;
  }

  .chicken {
    width: min(280px, 78vw);
  }

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

  .foot {
    font-size: 11px;
    gap: 6px;
  }

  .adminRow {
    grid-template-columns: 1fr;
  }

  .adminQuick {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-height: 680px) {
  .stage {
    min-height: 420px;
  }

  .prompt {
    padding: 12px;
  }

  .center {
    gap: 12px;
  }

  .chicken {
    width: min(260px, 76vw);
  }

  .promptMain {
    font-size: 15px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
  }

  .promptHint {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .micro {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
  }

  .foot {
    display: none;
  }

  :root {
    --foot-space: 0px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg,
  .ring,
  .chickenSvg,
  .meterGlare {
    animation: none !important;
  }
}
