@font-face {
  font-family: 'Akzidenz Grotesk';
  src: url('fonts/Berthold Akzidenz Grotesk BE Bold Extended.otf') format('opentype');
  font-weight: normal;
}

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

body {
  background-color: #f4ead8;
  background-image: url('images/Background.webp');
  background-size: cover;
  background-attachment: fixed;
  background-blend-mode: multiply;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#stage {
  position: relative;
  display: inline-block;
  mix-blend-mode: multiply;
  overflow: hidden;
  transition: opacity 0.35s ease;
}

#spread {
  display: block;
  max-height: 100vh;
  max-width: 90vw;
  width: auto;
  height: auto;
}

#text-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: translateZ(0);
}

.bubble-text {
  position: absolute;
  font-family: 'Times New Roman', Times, serif;
  font-size: calc(10pt * var(--font-scale, 1));
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: #1a1a1a;
  overflow: hidden;
}

/* ── WDYD image ──────────────────────────────────────────────── */
@keyframes wdyd-wiggle {
  0%   { transform: rotate(-1deg); }
  50%  { transform: rotate(1deg);  }
  100% { transform: rotate(-1deg); }
}

.wdyd-img {
  position: absolute;
  height: auto;
  opacity: 0;
  transition: opacity 0.04s ease;
  pointer-events: none;
  animation: wdyd-wiggle 1s steps(1) infinite;
}

/* ── Overlay elements ────────────────────────────────────────── */
@keyframes bow-rumble {
  0%    { transform: translate( 0px,  0px); }
  4.3%  { transform: translate( 2px, -1px); }
  8.7%  { transform: translate(-1px,  2px); }
  13.1% { transform: translate( 2px,  1px); }
  17.4% { transform: translate(-2px, -1px); }
  21.7% { transform: translate( 1px,  2px); }
  26.1% { transform: translate(-1px, -2px); }
  30.4% { transform: translate( 2px,  0px); }
  34.8% { transform: translate(-2px,  1px); }
  39.1% { transform: translate( 1px, -2px); }
  43.5% { transform: translate( 0px,  0px); }
  100%  { transform: translate( 0px,  0px); }
}
@keyframes jitter-c {
  0%   { transform: translate( 0px,  -1px); }
  25%  { transform: translate( 0px,   1px); }
  50%  { transform: translate(-1px,   0px); }
  75%  { transform: translate( 1px,   0px); }
  100% { transform: translate( 0px,  -1px); }
}

.overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
}
.overlay.jitter-a   { animation: bow-rumble 2.3s steps(1) infinite; }
.overlay.jitter-b   { animation: bow-rumble 2.3s steps(1) -0.9s infinite; }
.overlay.jitter-c   { animation: jitter-c 0.13s steps(1) infinite; }

@keyframes eek-flash {
  0%     { opacity: 1; animation-timing-function: step-end; }
  8.33%  { opacity: 0; animation-timing-function: step-end; }
  16.67%, 100% { opacity: 1; }
}
.overlay.jitter-eek { animation: eek-flash 3s linear 3s infinite backwards, jitter-c 0.13s linear infinite; }

/* Beep: flashes on 4 times then stays visible */
@keyframes beep {
  0%    { opacity: 0; }
  12.5% { opacity: 1; }
  25%   { opacity: 0; }
  37.5% { opacity: 1; }
  50%   { opacity: 0; }
  62.5% { opacity: 1; }
  75%   { opacity: 0; }
  87.5% { opacity: 1; }
  100%  { opacity: 1; }
}
.overlay.beep { animation: beep 1.6s steps(1) forwards; }

/* Z sequential: one z visible at a time, 0.5s each, 2.5s total cycle */
@keyframes z-seq-1 { 0% { opacity: 1; } 100% { opacity: 1; } }
@keyframes z-seq-2 { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 1; } }
@keyframes z-seq-3 { 0% { opacity: 0; } 40% { opacity: 1; } 100% { opacity: 1; } }
@keyframes z-seq-4 { 0% { opacity: 0; } 60% { opacity: 1; } 100% { opacity: 1; } }
@keyframes z-seq-5 { 0% { opacity: 0; } 80% { opacity: 1; } 100% { opacity: 1; } }
.overlay.z-seq-1 { animation: z-seq-1 2.5s steps(1) infinite; }
.overlay.z-seq-2 { animation: z-seq-2 2.5s steps(1) infinite; }
.overlay.z-seq-3 { animation: z-seq-3 2.5s steps(1) infinite; }
.overlay.z-seq-4 { animation: z-seq-4 2.5s steps(1) infinite; }
.overlay.z-seq-5 { animation: z-seq-5 2.5s steps(1) infinite; }

/* Sparkle cycling: 1→1+2→2→2+3→3→1+3→repeat (3s period, 0.5s per state) */
@keyframes twinkle-a {
  0%   { opacity: 1; }
  33%  { opacity: 0; }
  83%  { opacity: 1; }
  100% { opacity: 1; }
}
@keyframes twinkle-b {
  0%   { opacity: 0; }
  17%  { opacity: 1; }
  67%  { opacity: 0; }
  100% { opacity: 0; }
}
@keyframes twinkle-c {
  0%   { opacity: 0; }
  50%  { opacity: 1; }
  100% { opacity: 1; }
}
.overlay.twinkle-a { animation: twinkle-a 1.5s steps(1) infinite; }
.overlay.twinkle-b { animation: twinkle-b 1.5s steps(1) infinite; }
.overlay.twinkle-c { animation: twinkle-c 1.5s steps(1) infinite; }

@keyframes vibes-pulse {
  0%  { transform: scale(1.000); animation-timing-function: step-end; }
  20% { transform: scale(1.025); animation-timing-function: step-end; }
  40% { transform: scale(1.050); animation-timing-function: step-end; }
  60% { transform: scale(1.075); animation-timing-function: step-end; }
  80% { transform: scale(1.100); animation-timing-function: step-end; }
}
.overlay.vibes-pulse {
  transform-origin: 71.8% 61.4%;
  animation: vibes-pulse 1s infinite;
  z-index: 1;
}
.overlay.bubble-art  { z-index: 2; }
.overlay.option-art  { z-index: 3; transition: scale 0.15s ease; }

/* ── Choice hotspots ─────────────────────────────────────────── */
#hotspots { position: absolute; inset: 0; z-index: 11; pointer-events: none; }

.hotspot {
  position: absolute;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease, scale 0.15s ease;
  pointer-events: auto;
}

.hotspot:hover { scale: 1.1; }

.overlay.choice-overlay {
  transition: opacity 0.1s ease, scale 0.15s ease;
}

.choice-label {
  font-family: 'Times New Roman', Times, serif;
  font-size: calc(10pt * var(--font-scale, 1));
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: #1a1a1a;
  text-align: center;
  white-space: pre-line;
  pointer-events: none;
}

/* ── Crosshair rules ─────────────────────────────────────────── */
.crosshair-h, .crosshair-v {
  position: absolute;
  background: red;
  opacity: 0.35;
  pointer-events: none;
  display: none;
}
.crosshair-h { left: 0; width: 100%; height: 1px; }
.crosshair-v { top: 0;  height: 100%; width: 1px; }

/* ── Splash screen ───────────────────────────────────────────── */
#splash-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  pointer-events: none;
  mix-blend-mode: multiply;
}

#splash-title,
#btn-start,
#btn-continue { pointer-events: auto; }

#splash-overlay.hidden { display: none; }

#splash-title {
  font-family: 'Akzidenz Grotesk', 'AkzidenzGrotesk', Arial, sans-serif;
  font-size: 48pt;
  font-weight: normal;
  color: #1a1a1a;
  letter-spacing: -0.06em;
  animation: wdyd-wiggle 1s steps(1) infinite;
}

#splash-buttons {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 50px;
}

.splash-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 150px;
  transition: transform 0.1s ease;
}
.splash-btn:hover { transform: scale(1.05); }
.splash-btn img { display: block; width: 100%; }

.splash-btn-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Times New Roman', Times, serif;
  font-size: 10pt;
  letter-spacing: -0.01em;
  color: #1a1a1a;
  pointer-events: none;
  white-space: nowrap;
}
#btn-start   .splash-btn-label { top: 38%; }
#btn-continue .splash-btn-label { top: 34%; }

/* ── Navigation buttons ──────────────────────────────────────── */
#nav-ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#nav-left {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  gap: 0;
  align-items: center;
  pointer-events: none;
}

#nav-left .nav-btn { pointer-events: auto; }

#btn-back { display: none; }
#btn-back.visible { display: block; }

#btn-die { position: absolute; top: 1rem; right: 1rem; }

#btn-die img { width: 72px; }

.nav-btn {
  pointer-events: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  transform-origin: center;
  transition: transform 0.15s ease;
}

.nav-btn:hover { transform: scale(1.1); }

.nav-btn img {
  display: block;
  width: 48px;
  height: auto;
}

/* ── Menu overlay ────────────────────────────────────────────── */
#menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(244, 234, 216, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

#menu-overlay.visible { display: flex; }

#btn-close-menu {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: none;
  pointer-events: auto;
}

#menu-overlay.visible #btn-close-menu { display: block; }

#menu-card {
  position: relative;
  display: inline-block;
}

#menu-scrap-bg {
  display: block;
  width: 480px;
  max-width: 85vw;
  height: auto;
}

#menu-items {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-2deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 75%;
  padding: 0 0.75rem;
  box-sizing: border-box;
}

#menu-main-title {
  font-family: 'Akzidenz Grotesk', 'AkzidenzGrotesk', Arial, sans-serif;
  font-size: 32pt;
  font-weight: normal;
  color: #1a1a1a;
  letter-spacing: -0.06em;
  margin: 0;
  text-align: center;
}

.menu-section-title {
  font-family: 'Akzidenz Grotesk', 'AkzidenzGrotesk', Arial, sans-serif;
  font-size: 20pt;
  font-weight: normal;
  color: #1a1a1a;
  letter-spacing: -0.06em;
  margin: 0;
  text-align: center;
}

#special-thanks-block {
  position: relative;
  width: 100%;
}


#sax-img {
  position: absolute;
  height: 80px;
  width: auto;
  display: none;
  top: 0;
  right: -55px;
  z-index: 0;
}

#thanks-text {
  position: relative;
  z-index: 1;
  font-family: 'Times New Roman', Times, serif;
  font-size: 10pt;
  letter-spacing: -0.01em;
  color: #1a1a1a;
  margin: 0;
  text-align: left;
}

#about-text {
  font-family: 'Times New Roman', Times, serif;
  font-size: 10pt;
  letter-spacing: -0.01em;
  color: #1a1a1a;
  margin: 0;
  text-align: left;
  padding: 0 0.5rem;
  box-sizing: border-box;
  width: 100%;
}

#menu-toggles {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  align-items: flex-start;
  justify-content: center;
}

.menu-toggle-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.menu-toggle-btn img {
  display: block;
  width: 72px;
  height: auto;
  transform-origin: center;
  transition: transform 0.15s ease;
}

.menu-toggle-btn:hover img { transform: scale(1.25); }

#btn-sfx img { width: 72px; }

.menu-toggle-label {
  font-family: 'Times New Roman', Times, serif;
  font-size: 10pt;
  letter-spacing: -0.01em;
  color: #1a1a1a;
  text-align: center;
}

#menu-about-buttons {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  align-items: center;
  justify-content: center;
}

.menu-about-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease;
}

.menu-about-btn:hover { transform: scale(1.1); }

.menu-about-btn img {
  display: block;
  width: 120px;
  height: auto;
}

.menu-about-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Times New Roman', Times, serif;
  font-size: 10pt;
  letter-spacing: -0.01em;
  color: #1a1a1a;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  white-space: nowrap;
}

.menu-about-btn:hover .menu-about-label { opacity: 1; }

/* ── Small screen overlay ────────────────────────────────────── */
#small-screen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(244, 234, 216, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

#stage.blurred,
#btn-die.blurred,
#splash-overlay.blurred {
  filter: blur(8px);
}

#small-screen-overlay.visible {
  display: flex;
}

#small-screen-message {
  position: relative;
  display: inline-block;
}

#small-screen-bg {
  display: block;
  max-width: 80vw;
  max-height: 80vh;
  width: auto;
  height: auto;
}

#small-screen-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50%;
  text-align: center;
}

#small-screen-header {
  font-family: 'Akzidenz Grotesk', 'AkzidenzGrotesk', Arial, sans-serif;
  font-size: 18pt;
  font-weight: normal;
  color: #1a1a1a;
  margin-bottom: 0.5em;
  display: inline-block;
  animation: wdyd-wiggle 1s steps(1) infinite;
}

#small-screen-text {
  font-family: 'Times New Roman', Times, serif;
  font-size: 10pt;
  line-height: 1.5;
  color: #1a1a1a;
}

/* ── Password overlay ────────────────────────────────────────── */
#password-overlay {
  position: fixed;
  inset: 0;
  background-color: #f4ead8;
  background-image: url('images/Background.webp');
  background-size: cover;
  background-attachment: fixed;
  background-blend-mode: multiply;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: opacity 0.4s ease;
}

#password-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#password-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

#password-label {
  font-family: 'Akzidenz Grotesk', 'AkzidenzGrotesk', Arial, sans-serif;
  font-size: 14pt;
  font-weight: normal;
  color: #1a1a1a;
  letter-spacing: -0.06em;
  margin: 0;
}

#password-field {
  display: flex;
  align-items: center;
  width: 200px;
  border: 2px solid #1a1a1a;
  border-radius: 8px;
  background: transparent;
  padding: 0.5rem 0.5rem 0.5rem 0.6rem;
}

#password-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: 'Times New Roman', Times, serif;
  font-size: 10pt;
  color: #1a1a1a;
  outline: none;
}

#password-submit {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Akzidenz Grotesk', 'AkzidenzGrotesk', Arial, sans-serif;
  font-size: 12pt;
  font-weight: normal;
  color: #1a1a1a;
  letter-spacing: -0.06em;
  padding: 0;
  margin-left: 0.4rem;
  line-height: 1;
}

#password-submit:hover { opacity: 0.6; }

@keyframes password-shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-6px); }
  75%       { transform: translateX(6px); }
}

#password-field.shake { animation: password-shake 0.3s ease; }

/* ── Coordinate helper ───────────────────────────────────────── */
#coord-ui {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-family: monospace;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
}

#spread-width {
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
  pointer-events: none;
}

#coords {
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
  pointer-events: none;
  display: none;
}

#coord-toggle {
  background: rgba(0,0,0,0.75);
  color: #fff;
  border: none;
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
}

#coord-toggle:hover {
  background: rgba(0,0,0,0.9);
}
