#full-area {
  width: 100%;
  height: 100vh;
  position: absolute;
  overflow: hidden;
  user-select: none;
  background: #ff7a12;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

#game-area {
  position: absolute;
  width: 1280px;
  height: 720px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  overflow: hidden;
  background: #ff7a12;
}

#play-section,
#zz-levels,
#zz-complete {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

#zz-canvas {
  display: block;
  width: 1280px;
  height: 720px;
  touch-action: none;
}

#zz-hud-top {
  position: absolute;
  left: 24px;
  top: 20px;
  right: 24px;
  height: 66px;
  display: flex;
  gap: 14px;
  align-items: stretch;
  z-index: 3;
  pointer-events: none;
}

.zz-chip {
  border-radius: 18px;
  background: #4a1d7a;
  border: 3px solid #7b3fe4;
  box-shadow: 0 5px 0 #2a0f4a, 0 8px 20px rgba(0, 0, 0, 0.3);
}

.zz-chip-time {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 160px;
  padding: 0 20px;
}
.zz-chip-time .zz-chip-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #ffd934;
  line-height: 1;
}
.zz-chip-time .zz-chip-value {
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 #2a0f4a;
}

.zz-chip-map {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.zz-chip-map svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#zz-hud-panel {
  position: absolute;
  left: 24px;
  bottom: 88px;
  width: 440px;
  padding: 14px 18px 16px;
  border-radius: 18px;
  background: rgba(74, 29, 122, 0.92);
  border: 3px solid #7b3fe4;
  box-shadow: 0 5px 0 #2a0f4a, 0 8px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  gap: 16px;
  align-items: center;
  z-index: 3;
}
#zz-hud-panel .zz-mic {
  width: 34px;
  height: 48px;
  flex: none;
}
#zz-hud-panel .zz-panel-rows {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#zz-hud-panel .zz-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* drop the loudness row down toward sensitivity, reclaiming the same amount from
   the gap below it so the panel keeps its height and the mic stays centred */
#zz-hud-panel .zz-row:first-child {
  margin-top: 8px;
}
#zz-hud-panel .zz-row-sens {
  margin-top: 0;
}
#zz-hud-panel .zz-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
#zz-hud-panel .zz-row-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ffd934;
}
#zz-hud-panel .zz-row-value {
  font-size: 15px;
  font-weight: 900;
}
#zz-hud-panel .zz-loud-bar {
  position: relative;
  height: 18px;
  border-radius: 9px;
  background: #012541;
  margin-bottom: 14px;
}
#zz-hud-panel .zz-loud-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 9px;
  background: #ff4fbf;
  transition: width 0.08s linear;
}
#zz-hud-panel .zz-loud-mark {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 4px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 0 2px #4a1d7a;
  transform: translateX(-50%);
}
#zz-hud-panel .zz-loud-shout {
  position: absolute;
  top: 22px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  opacity: 0.85;
  transform: translateX(-50%);
}
#zz-hud-panel .zz-sens-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
#zz-hud-panel .zz-round-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: #ffd934;
  color: #3a1a00;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 0 #c9a200;
  flex: none;
  padding: 0;
  outline: none;
}
#zz-hud-panel .zz-round-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #c9a200;
}
#zz-hud-panel #micSensitivitySlider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: #012541;
  outline: none;
  cursor: pointer;
}
#zz-hud-panel #micSensitivitySlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #e2445c;
}
#zz-hud-panel #micSensitivitySlider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #e2445c;
}

#zz-intro {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* transparent so the live canvas behind shows the themed world and the track;
     the vignette just keeps the title readable over it */
  background:
    radial-gradient(circle at 50% 48%, rgba(20, 5, 45, 0.15) 0%, rgba(20, 5, 45, 0.5) 55%, rgba(12, 3, 30, 0.72) 100%);
}

/* Intro beat: the blob rockets in from the left, blows up mid-stage, and the
   title is thrown out of the blast. Timings below are all relative to the
   moment #zz-intro gains .is-playing (see game.showIntro). */
#zz-intro-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

#zz-intro-stage > * {
  position: absolute;
  left: 50%;
  top: 50%;
}

.zz-intro-blob {
  width: 250px;
  height: 240px;
  margin: -120px 0 0 -125px;
  filter: drop-shadow(0 14px 26px rgba(60, 20, 0, 0.45));
  opacity: 0;
}

#zz-intro.is-playing .zz-intro-blob {
  animation: zz-charge 880ms cubic-bezier(0.55, 0, 0.85, 0.4) both;
}

/* speed lines that streak past while the blob is still incoming */
.zz-intro-streaks {
  width: 0;
  height: 0;
}

.zz-intro-streaks span {
  position: absolute;
  left: 0;
  top: var(--y);
  width: var(--w);
  height: 10px;
  margin-left: -60px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 240, 200, 0.85));
  opacity: 0;
}

#zz-intro.is-playing .zz-intro-streaks span {
  animation: zz-streak 620ms ease-out var(--dl) 1 both;
}

.zz-intro-flash {
  width: 320px;
  height: 320px;
  margin: -160px 0 0 -160px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #ffe27a 38%, rgba(255, 168, 61, 0) 70%);
  opacity: 0;
}

#zz-intro.is-playing .zz-intro-flash {
  animation: zz-flash 520ms ease-out 690ms both;
}

.zz-intro-burst {
  width: 0;
  height: 0;
}

.zz-intro-burst span {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--s);
  height: var(--s);
  margin: calc(var(--s) / -2);
  border-radius: 50%;
  background: var(--c);
  opacity: 0;
}

/* forwards, not both: a backwards fill would park all 14 dots visible at centre
   during the charge, before the blast has happened */
#zz-intro.is-playing .zz-intro-burst span {
  animation: zz-burst 780ms cubic-bezier(0.15, 0.85, 0.3, 1) 700ms forwards;
}

.zz-intro-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -50%);
  opacity: 0;
  line-height: 0.94;
  /* the site's own display face rather than Arial Black */
  font-family: puzzleGamesMainFont, fontFamilyUltra, "Arial Black", Arial, sans-serif;
  font-weight: 400;
  letter-spacing: 3px;
  text-transform: uppercase;
  /* layered shadows stand in for a stroke so the type reads on any backdrop */
  text-shadow:
    -4px 0 0 #2a0f4a, 4px 0 0 #2a0f4a, 0 -4px 0 #2a0f4a, 0 4px 0 #2a0f4a,
    -4px -4px 0 #2a0f4a, 4px -4px 0 #2a0f4a, -4px 4px 0 #2a0f4a, 4px 4px 0 #2a0f4a,
    0 12px 22px rgba(50, 15, 0, 0.5);
}

.zz-intro-zig {
  font-size: 104px;
  color: #fff;
}

.zz-intro-scream {
  font-size: 140px;
  color: #ffd934;
}

#zz-intro.is-playing .zz-intro-title {
  animation: zz-title-in 640ms cubic-bezier(0.2, 1.5, 0.4, 1) 780ms both;
}

/* blob accelerates in from the left, squashing as it goes, then blows up */
@keyframes zz-charge {
  0%   { transform: translateX(-900px) scale(0.55, 1.1); opacity: 0; }
  10%  { opacity: 1; }
  55%  { transform: translateX(-190px) scale(1.2, 0.86); opacity: 1; }
  78%  { transform: translateX(0) scale(1.45, 0.78); opacity: 1; }
  90%  { transform: translateX(0) scale(1.75); opacity: 1; }
  100% { transform: translateX(0) scale(2.2); opacity: 0; }
}

@keyframes zz-streak {
  0%   { transform: translateX(520px) scaleX(0.3); opacity: 0; }
  35%  { opacity: 0.9; }
  100% { transform: translateX(-680px) scaleX(1.4); opacity: 0; }
}

@keyframes zz-flash {
  0%   { transform: scale(0.15); opacity: 0; }
  22%  { transform: scale(1.35); opacity: 0.95; }
  100% { transform: scale(3.2); opacity: 0; }
}

@keyframes zz-burst {
  0%   { transform: rotate(var(--a)) translateX(0) scale(0.4); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: rotate(var(--a)) translateX(var(--d)) scale(0.15); opacity: 0; }
}

/* title is thrown out of the blast, overshoots, then settles */
@keyframes zz-title-in {
  0%   { transform: translate(-50%, -50%) scale(0.2) rotate(-8deg); opacity: 0; }
  40%  { opacity: 1; }
  60%  { transform: translate(-50%, -50%) scale(1.14) rotate(3deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  #zz-intro.is-playing .zz-intro-blob,
  #zz-intro.is-playing .zz-intro-streaks span,
  #zz-intro.is-playing .zz-intro-flash,
  #zz-intro.is-playing .zz-intro-burst span,
  #zz-intro.is-playing .zz-intro-title { animation: none; }
  /* skip straight to the finished title card */
  #zz-intro .zz-intro-blob,
  #zz-intro .zz-intro-streaks,
  #zz-intro .zz-intro-flash,
  #zz-intro .zz-intro-burst { display: none; }
  #zz-intro .zz-intro-title { opacity: 1; }
}

#zz-levels {
  z-index: 5;
  /* centred column: extra bottom padding lifts both title and grid, while the
     larger gap lifts the title further than the grid (~30px vs ~14px) */
  padding-bottom: 70px;
  background: rgba(40, 10, 70, 0.4);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 38px;
}

#zz-levels-title {
  margin: 0;
  font-family: puzzleGamesMainFont, fontFamilyUltra, "Arial Black", Arial, sans-serif;
  font-size: 46px;
  font-weight: 400;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #fff;
  text-shadow:
    -3px 0 0 #2a0f4a, 3px 0 0 #2a0f4a, 0 -3px 0 #2a0f4a, 0 3px 0 #2a0f4a,
    -3px -3px 0 #2a0f4a, 3px -3px 0 #2a0f4a, -3px 3px 0 #2a0f4a, 3px 3px 0 #2a0f4a,
    0 8px 16px rgba(20, 5, 45, 0.5);
  animation: zz-levels-title-in 300ms ease-out backwards;
}

/* backwards (not both): once the entrance finishes the cards fall back to their
   normal styles, so the :hover lift on .zz-card.is-unlocked still works */
.zz-card {
  animation: zz-card-in 280ms cubic-bezier(0.2, 1.25, 0.4, 1) backwards;
  animation-delay: calc(200ms + var(--i, 0) * 55ms);
}

@keyframes zz-levels-title-in {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes zz-card-in {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  #zz-levels-title,
  .zz-card { animation: none; }
}

.zz-levels-grid {
  display: grid;
  grid-template-columns: repeat(4, 232px);
  gap: 24px 26px;
}

.zz-card {
  position: relative;
  height: 200px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 18px;
  box-sizing: border-box;
}
.zz-card.is-unlocked {
  background: linear-gradient(180deg, #8b4ef2, #5a2bb8);
  border: 4px solid #ffd934;
  box-shadow: 0 8px 0 #3a1a7a, 0 14px 30px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.zz-card.is-unlocked:hover, .zz-card.is-unlocked:focus {
  transform: translateY(-3px);
}
.zz-card.is-locked {
  background: rgba(74, 29, 122, 0.75);
  border: 4px solid #4a1d7a;
  box-shadow: 0 8px 0 #2a0f4a;
  color: rgba(255, 255, 255, 0.6);
}
.zz-card.is-locked .zz-card-preview svg:first-child {
  opacity: 0.35;
}
.zz-card .zz-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.zz-card .zz-card-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 3px;
}
.zz-card.is-unlocked .zz-card-label {
  color: #ffd934;
}
.zz-card .zz-card-num {
  font-size: 40px;
  font-weight: 900;
  line-height: 1;
}
.zz-card.is-unlocked .zz-card-num {
  text-shadow: 0 3px 0 #3a1a7a;
}
.zz-card .zz-card-preview {
  position: relative;
  height: 66px;
  border-radius: 14px;
  background: rgba(1, 37, 65, 0.55);
  overflow: hidden;
}
.zz-card .zz-card-preview svg:first-child {
  display: block;
  width: 100%;
  height: 100%;
}
.zz-card .zz-card-lock {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.zz-card .zz-card-foot {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.5px;
}
.zz-card .zz-card-best-label {
  opacity: 0.8;
}
.zz-card .zz-card-best {
  color: #ffd934;
}
.zz-card .zz-card-locked-text {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  text-align: center;
}

#zz-complete {
  z-index: 6;
  background: rgba(40, 10, 70, 0.45);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 110px;
  box-sizing: border-box;
}

.zz-panel {
  width: 640px;
  padding: 44px 40px 40px;
  border-radius: 28px;
  background: linear-gradient(180deg, #8b4ef2, #5a2bb8);
  border: 4px solid #a97cff;
  box-shadow: 0 10px 0 #3a1a7a, 0 24px 50px rgba(0, 0, 0, 0.45);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  box-sizing: border-box;
}
.zz-panel .zz-panel-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.zz-panel .zz-level-tag {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 5px;
  color: #ffd934;
}
.zz-panel h2 {
  margin: 0;
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1;
  text-shadow: 0 4px 0 #3a1a7a;
}

.zz-stats {
  display: flex;
  gap: 18px;
  justify-content: center;
  width: 100%;
}
.zz-stats .zz-stat {
  flex: 1;
  padding: 16px 18px 18px;
  border-radius: 20px;
  background: #4a1d7a;
  border: 3px solid #7b3fe4;
  box-shadow: 0 5px 0 #2a0f4a;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.zz-stats .zz-stat small {
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #ffd934;
}
.zz-stats .zz-stat span {
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 3px 0 #2a0f4a;
}
.zz-stats .zz-stat-best small {
  color: #ff4fbf;
}
.zz-stats .zz-stat-best span {
  color: #ffd934;
}

.zz-btns {
  display: flex;
  gap: 18px;
  justify-content: center;
}

.zz-btn {
  border: none;
  outline: none;
  cursor: pointer;
  padding: 16px 34px;
  border-radius: 999px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #3a1a00;
  background: #ffd934;
  box-shadow: 0 6px 0 #c9a200;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.zz-btn:hover, .zz-btn:focus {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #c9a200;
}
.zz-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #c9a200;
}
.zz-btn.alt {
  color: #fff;
  background: #ff4fbf;
  box-shadow: 0 6px 0 #b8207f;
}
.zz-btn.alt:hover, .zz-btn.alt:focus {
  box-shadow: 0 8px 0 #b8207f;
}
.zz-btn.alt:active {
  box-shadow: 0 2px 0 #b8207f;
}

@media (max-width: 600px) {
  .zz-panel {
    width: 90%;
    padding: 26px 20px 28px;
  }
  .zz-panel h2 {
    font-size: 40px;
  }
  .zz-stats .zz-stat span {
    font-size: 32px;
  }
}
