:root {
  --amber: #f5c15a;
  --honey: #c47b16;
  --cyan: #5ce1ff;
  --sting: #ff3d7f;
  --wax: #1a120c;
  --cream: #f4e6c3;
  --void: #07040a;
  --cap: #140c08;
  --font-display: "Cinzel", serif;
  --font-body: "Source Sans 3", sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #07040a;
  color: var(--cream);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body {
  background:
    radial-gradient(ellipse 80% 55% at 50% 38%, rgba(196, 123, 22, 0.2), transparent 58%),
    radial-gradient(ellipse 50% 36% at 50% 100%, rgba(245, 193, 90, 0.08), transparent 52%),
    #07040a;
}

[hidden] {
  display: none !important;
}

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

.mt-coin {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(61, 220, 107, 0.6));
}

.mt-coin.sm {
  width: 22px;
  height: 22px;
}

.stat-value-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.eco-credit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
  padding: 0.65rem 1rem;
  border: 1px solid rgba(61, 220, 107, 0.32);
  background: rgba(6, 22, 12, 0.55);
  max-width: min(520px, 100%);
}

.eco-name {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  color: #7dff9a;
  text-transform: uppercase;
}

.eco-by {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: rgba(244, 230, 195, 0.78);
}

.eco-by-panel {
  margin-top: 1rem;
  letter-spacing: 0.04em;
}

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.32;
  pointer-events: none;
  z-index: 0;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse 70% 70% at 50% 45%, transparent 40%, rgba(7, 4, 10, 0.72) 100%);
}

#app {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

#app::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  opacity: 0.04;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>");
}

.hidden {
  display: none !important;
}

#stage {
  position: absolute;
  inset: 0;
}

#board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
}

.hud {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 5;
  pointer-events: none;
}

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

.hud button {
  pointer-events: auto;
}

.hud-top {
  top: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.85rem;
  padding: 0.55rem 0.85rem 0.4rem;
  background: linear-gradient(180deg, rgba(7, 4, 10, 0.82), rgba(7, 4, 10, 0.15));
}

.hud-bottom {
  bottom: 0;
  padding: 0.4rem 1rem 0.85rem;
  background: linear-gradient(0deg, rgba(7, 4, 10, 0.82), rgba(7, 4, 10, 0.12));
}

.wordmark-small {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(0.62rem, 1.6vw, 0.82rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--amber);
  display: flex;
  gap: 0.35rem;
  align-items: center;
  white-space: nowrap;
}

.wordmark-small .slash {
  color: var(--honey);
}

.lives {
  display: flex;
  gap: 0.28rem;
  align-items: center;
}

.bee {
  width: 22px;
  height: 22px;
  color: var(--amber);
  filter: drop-shadow(0 0 5px rgba(245, 193, 90, 0.45));
  transition: opacity 0.2s ease, color 0.2s ease, filter 0.2s ease;
}

.bee.lost {
  color: var(--sting);
  opacity: 0.28;
  filter: none;
}

.stat {
  display: flex;
  flex-direction: column;
  min-width: 3.2rem;
}

.stat-label {
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--honey);
}

.stat-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--cream);
  line-height: 1.15;
}

.pips {
  display: flex;
  gap: 0.32rem;
  align-items: center;
}

.pip {
  width: 13px;
  height: 15px;
  background: var(--cyan);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  opacity: 0.18;
}

.pip.on {
  opacity: 1;
  box-shadow: 0 0 10px rgba(92, 225, 255, 0.7);
}

.hud-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.memory-bar {
  position: relative;
  height: 18px;
  width: min(560px, 92vw);
  margin: 0 auto;
  background: rgba(20, 12, 8, 0.85);
  border: 1px solid rgba(92, 225, 255, 0.28);
  overflow: hidden;
}

.memory-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1a6a7a, #5ce1ff);
  box-shadow: 0 0 12px rgba(92, 225, 255, 0.55);
}

.memory-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: var(--cream);
  text-shadow: 0 1px 2px #07040a;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(7, 4, 10, 0.72);
  z-index: 20;
  backdrop-filter: blur(7px);
}

.overlay.show {
  display: flex;
}

.menu-card {
  width: min(980px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.menu-heroes {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.5rem, 3vw, 2.4rem);
  width: 100%;
}

.menu-heroes img {
  height: min(22vh, 180px);
  width: auto;
  max-width: 22vw;
  object-fit: contain;
  mix-blend-mode: lighten;
  -webkit-mask-image: radial-gradient(circle, #000 52%, transparent 74%);
  mask-image: radial-gradient(circle, #000 52%, transparent 74%);
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
}

.menu-title-block {
  text-align: center;
  min-width: 0;
}

.kicker {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--honey);
}

.wordmark {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-height: 4.6rem;
}

.wordmark-hive {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.4rem, 4.4vw, 3.2rem);
  letter-spacing: 0.1em;
  line-height: 1.05;
  color: var(--amber);
  white-space: nowrap;
  text-shadow: 0 0 22px rgba(245, 193, 90, 0.38), 0 2px 0 #6a3e08;
  animation: amberPulse 4.6s ease-in-out infinite;
}

.wordmark-mine {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.95rem, 2.4vw, 1.45rem);
  letter-spacing: 0.46em;
  color: var(--cream);
}

.tagline {
  margin: 0.7rem 0 0;
  color: rgba(244, 230, 195, 0.72);
  font-size: 0.95rem;
}

.keyart {
  width: min(420px, 70vw);
  max-height: 16vh;
  object-fit: cover;
  border: 1px solid rgba(245, 193, 90, 0.28);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
}

.menu-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.difficulties {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  width: min(860px, 100%);
}

.diff-btn {
  font-family: var(--font-display);
  background: linear-gradient(180deg, #24180f, var(--wax));
  color: var(--cream);
  border: 1px solid rgba(245, 193, 90, 0.28);
  padding: 0.75rem 0.55rem 0.7rem;
  cursor: pointer;
  min-height: 44px;
  text-align: center;
}

.diff-btn:hover,
.diff-btn:focus-visible,
.diff-btn.selected {
  border-color: var(--amber);
  box-shadow: 0 0 16px rgba(245, 193, 90, 0.22);
}

.diff-btn.selected {
  color: var(--amber);
}

.diff-name {
  display: block;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.diff-meta,
.diff-best {
  display: block;
  margin-top: 0.28rem;
  font-family: var(--font-body);
  font-size: 0.74rem;
  color: rgba(244, 230, 195, 0.62);
}

.diff-best {
  color: var(--cyan);
}

.panel {
  background: linear-gradient(180deg, #24160e, var(--wax));
  border: 1px solid rgba(245, 193, 90, 0.42);
  padding: 1.8rem 1.6rem 1.5rem;
  min-width: min(90vw, 360px);
  max-width: min(560px, 100%);
  text-align: center;
  box-shadow: 0 0 40px rgba(245, 193, 90, 0.12), 0 20px 48px rgba(0, 0, 0, 0.5);
}

.panel-sting {
  border-color: rgba(255, 61, 127, 0.45);
  box-shadow: 0 0 40px rgba(255, 61, 127, 0.12), 0 20px 48px rgba(0, 0, 0, 0.5);
}

.panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
  font-size: 1.25rem;
}

.panel-sting .panel-title {
  color: var(--sting);
}

.panel-sub {
  margin: 0.45rem 0 0;
  color: rgba(244, 230, 195, 0.7);
}

.panel-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 1.2rem;
}

.rules {
  margin: 1rem 0 1.3rem;
  padding: 0 0 0 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  text-align: left;
}

.rules li {
  color: var(--cream);
  line-height: 1.45;
}

.rules li::marker {
  color: var(--amber);
  font-family: var(--font-display);
  font-weight: 700;
}

.stats-dl {
  margin: 1.1rem 0 0;
  display: grid;
  gap: 0.45rem;
}

.stats-dl > div {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  border-bottom: 1px solid rgba(245, 193, 90, 0.12);
  padding-bottom: 0.3rem;
}

.stats-dl dt {
  font-family: var(--font-display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--honey);
}

.stats-dl dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--cream);
}

.best-banner {
  margin: 0.55rem 0 0;
  font-family: var(--font-display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cyan);
  font-size: 0.72rem;
}

.btn {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #2a1c12, var(--wax));
  color: var(--amber);
  border: 1px solid rgba(245, 193, 90, 0.45);
  padding: 0.8rem 1.45rem;
  min-height: 44px;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--amber);
  box-shadow: 0 0 18px rgba(245, 193, 90, 0.25);
  color: #f8e2a8;
}

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

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(180deg, #d3922a, var(--honey) 40%, #8a4e0c);
  color: var(--cap);
  border-color: var(--amber);
}

.btn-primary:hover {
  color: var(--void);
  box-shadow: 0 0 22px rgba(245, 193, 90, 0.4);
}

.btn-cyan {
  color: var(--cyan);
  border-color: rgba(92, 225, 255, 0.45);
  padding: 0.45rem 0.8rem;
  min-height: 40px;
  font-size: 0.72rem;
}

.btn-cyan:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(92, 225, 255, 0.3);
}

.btn-icon {
  padding: 0.4rem 0.55rem;
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@keyframes amberPulse {
  0%,
  100% {
    text-shadow: 0 0 18px rgba(245, 193, 90, 0.25), 0 2px 0 #6a3e08;
  }
  50% {
    text-shadow: 0 0 30px rgba(245, 193, 90, 0.55), 0 2px 0 #6a3e08;
  }
}

@media (max-width: 720px) {
  .overlay {
    overflow-y: auto;
    align-items: flex-start;
    padding-top: 1.2rem;
  }

  .difficulties {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .menu-nav {
    width: 100%;
    flex-direction: column;
  }

  .menu-nav .btn {
    width: 100%;
    letter-spacing: 0.1em;
    padding: 0.75rem 0.6rem;
  }

  .menu-heroes {
    flex-direction: column;
  }

  .menu-heroes img {
    height: min(10vh, 84px);
    max-width: 36vw;
  }

  .keyart {
    display: none;
  }

  .wordmark-hive {
    letter-spacing: 0.1em;
  }

  .wordmark-mine {
    letter-spacing: 0.28em;
  }

  .wordmark-small span:nth-child(3),
  .wordmark-small .slash {
    display: none;
  }

  .eco-credit {
    flex-direction: column;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wordmark-hive {
    animation: none;
  }
}
