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

body {
  overflow: hidden;
  background: #0a0a0a;
  font-family: 'JetBrains Mono', monospace;
  color: #e0e0e0;
  cursor: default;
}

#scene-container {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
}

#scene-container canvas {
  display: block;
}

/* ===== START SCREEN ===== */
#start-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 100;
  background: radial-gradient(ellipse at center, #1a1412 0%, #0a0806 60%, #000 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.start-content {
  text-align: center;
  max-width: 520px;
  padding: 20px;
}

#title-text {
  font-family: 'Creepster', cursive;
  font-size: clamp(3.5rem, 12vw, 7rem);
  color: #d4a847;
  text-shadow:
    0 0 20px rgba(212, 168, 71, 0.6),
    0 0 60px rgba(212, 168, 71, 0.3),
    0 0 100px rgba(212, 168, 71, 0.15);
  animation: flicker 4s infinite;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  5% { opacity: 0.85; }
  10% { opacity: 1; }
  15% { opacity: 0.9; }
  20% { opacity: 1; }
  50% { opacity: 1; }
  52% { opacity: 0.7; }
  54% { opacity: 1; }
  80% { opacity: 1; }
  82% { opacity: 0.88; }
  84% { opacity: 1; }
}

.subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 300;
  font-size: 0.95rem;
  color: #8a7a5a;
  margin-bottom: 36px;
  font-style: italic;
}

.size-selector {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.size-btn {
  background: rgba(212, 168, 71, 0.08);
  border: 1px solid rgba(212, 168, 71, 0.25);
  color: #a09070;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  padding: 12px 20px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
}

.size-btn span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: #6a5a40;
  margin-top: 4px;
}

.size-btn:hover, .size-btn.active {
  background: rgba(212, 168, 71, 0.18);
  border-color: #d4a847;
  color: #d4a847;
}

.size-btn.active {
  box-shadow: 0 0 15px rgba(212, 168, 71, 0.2);
}

.best-times {
  font-size: 0.7rem;
  color: #5a5040;
  margin-bottom: 28px;
  min-height: 18px;
}

#start-btn {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.6rem;
  letter-spacing: 0.15em;
  background: linear-gradient(135deg, #d4a847, #b8922e);
  color: #1a1206;
  border: none;
  padding: 16px 48px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 0 30px rgba(212, 168, 71, 0.3);
  display: block;
  margin: 0 auto 28px;
}

#start-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 50px rgba(212, 168, 71, 0.5);
}

.controls-guide {
  font-size: 0.7rem;
  color: #5a5040;
  line-height: 1.8;
}

.controls-guide strong {
  color: #8a7a5a;
}

.footer-link {
  margin-top: 30px;
}

.footer-link a {
  color: #3a3020;
  font-size: 0.65rem;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link a:hover {
  color: #6a5a40;
}

/* ===== HUD ===== */
#hud {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 10;
  pointer-events: none;
}

#hud > * {
  pointer-events: auto;
}

#hud-timer {
  position: absolute;
  top: 16px; left: 20px;
}

.hud-label {
  font-size: 0.55rem;
  color: #6a6a6a;
  letter-spacing: 0.2em;
  margin-bottom: 2px;
}

#timer-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #c8b060;
  text-shadow: 0 0 10px rgba(200, 176, 96, 0.4);
}

#hud-steps {
  position: absolute;
  top: 62px; left: 20px;
}

#steps-value {
  font-size: 1.1rem;
  font-weight: 400;
  color: #909090;
}

#hud-compass {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
}

#compass-ring {
  width: 56px;
  height: 56px;
  border: 2px solid rgba(200, 176, 96, 0.3);
  border-radius: 50%;
  position: relative;
  background: rgba(0,0,0,0.4);
}

#compass-needle {
  position: absolute;
  top: 50%; left: 50%;
  width: 2px; height: 20px;
  background: linear-gradient(to top, transparent, #d4a847);
  transform-origin: bottom center;
  transform: translate(-50%, -100%);
  border-radius: 1px;
  box-shadow: 0 0 6px rgba(212, 168, 71, 0.5);
}

.compass-n, .compass-e, .compass-s, .compass-w {
  position: absolute;
  font-size: 0.5rem;
  font-weight: 700;
  color: #8a8a6a;
}

.compass-n { top: 2px; left: 50%; transform: translateX(-50%); color: #d4a847; }
.compass-s { bottom: 2px; left: 50%; transform: translateX(-50%); }
.compass-e { right: 4px; top: 50%; transform: translateY(-50%); }
.compass-w { left: 4px; top: 50%; transform: translateY(-50%); }

#hud-hints {
  position: absolute;
  top: 80px; left: 50%;
  transform: translateX(-50%);
}

#hint-btn {
  background: rgba(212, 168, 71, 0.15);
  border: 1px solid rgba(212, 168, 71, 0.3);
  color: #c8b060;
  border-radius: 50%;
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s;
}

#hint-btn:hover {
  background: rgba(212, 168, 71, 0.3);
}

#hint-count {
  position: absolute;
  top: -4px; right: -4px;
  background: #d4a847;
  color: #1a1206;
  font-size: 0.55rem;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#hud-breadcrumb {
  position: absolute;
  top: 16px; right: 190px;
}

#breadcrumb-btn {
  background: rgba(100, 200, 100, 0.1);
  border: 1px solid rgba(100, 200, 100, 0.3);
  color: #6ac06a;
  border-radius: 4px;
  width: 32px; height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#breadcrumb-btn.active {
  background: rgba(100, 200, 100, 0.25);
  border-color: #6ac06a;
  box-shadow: 0 0 8px rgba(100, 200, 100, 0.3);
}

#minimap {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 2px solid rgba(200, 176, 96, 0.3);
  border-radius: 6px;
  background: rgba(0,0,0,0.6);
  image-rendering: pixelated;
}

/* ===== PAUSE MENU ===== */
#pause-menu {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 50;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pause-content {
  text-align: center;
}

.pause-content h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3rem;
  letter-spacing: 0.15em;
  color: #d4a847;
  margin-bottom: 30px;
}

.pause-btn {
  display: block;
  width: 200px;
  margin: 10px auto;
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  background: rgba(212, 168, 71, 0.1);
  border: 1px solid rgba(212, 168, 71, 0.3);
  color: #c8b060;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.pause-btn:hover {
  background: rgba(212, 168, 71, 0.25);
  border-color: #d4a847;
}

/* ===== VICTORY SCREEN ===== */
#victory-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 60;
  background: radial-gradient(ellipse at center, rgba(30, 25, 15, 0.95), rgba(0,0,0,0.98));
  display: flex;
  align-items: center;
  justify-content: center;
}

#confetti-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.victory-content {
  text-align: center;
  z-index: 1;
  position: relative;
}

.victory-content h1 {
  font-family: 'Creepster', cursive;
  font-size: clamp(2.5rem, 10vw, 5rem);
  color: #d4a847;
  text-shadow: 0 0 30px rgba(212, 168, 71, 0.6);
  margin-bottom: 30px;
  animation: victoryPulse 2s ease-in-out infinite;
}

@keyframes victoryPulse {
  0%, 100% { text-shadow: 0 0 30px rgba(212, 168, 71, 0.6); }
  50% { text-shadow: 0 0 50px rgba(212, 168, 71, 0.9), 0 0 80px rgba(212, 168, 71, 0.4); }
}

.victory-stats {
  display: flex;
  gap: 30px;
  justify-content: center;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 0.6rem;
  color: #6a5a40;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #c8b060;
}

.victory-btns {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.victory-btns button {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  padding: 14px 32px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

#tryagain-btn {
  background: rgba(212, 168, 71, 0.15);
  border: 1px solid rgba(212, 168, 71, 0.4);
  color: #d4a847;
}

#tryagain-btn:hover {
  background: rgba(212, 168, 71, 0.3);
}

#bigger-btn {
  background: linear-gradient(135deg, #d4a847, #b8922e);
  border: none;
  color: #1a1206;
}

#bigger-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(212, 168, 71, 0.4);
}

/* ===== CLICK OVERLAY ===== */
#click-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 15;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#click-overlay p {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  color: #d4a847;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ===== MOBILE CONTROLS ===== */
#mobile-controls {
  position: fixed;
  bottom: 0; left: 0;
  width: 100%; height: 40%;
  z-index: 20;
  pointer-events: none;
}

#joystick-zone {
  position: absolute;
  bottom: 20px;
  left: 30px;
  width: 120px;
  height: 120px;
  pointer-events: auto;
}

#joystick-base {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(212, 168, 71, 0.1);
  border: 2px solid rgba(212, 168, 71, 0.25);
  position: relative;
}

#joystick-stick {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(212, 168, 71, 0.35);
  border: 1px solid rgba(212, 168, 71, 0.5);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: none;
}

#look-zone {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 50%;
  height: 100%;
  pointer-events: auto;
}

/* ===== HINT FLASH ===== */
.hint-arrow {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  pointer-events: none;
}

.hint-arrow svg {
  width: 80px;
  height: 80px;
  filter: drop-shadow(0 0 20px rgba(212, 168, 71, 0.8));
  animation: hintFade 2s ease-out forwards;
}

@keyframes hintFade {
  0% { opacity: 0; transform: scale(0.5); }
  20% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== STEP PULSE ===== */
.step-pulse {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(200, 176, 96, 0.5);
  z-index: 10;
  pointer-events: none;
  animation: stepPulseAnim 0.4s ease-out forwards;
}

@keyframes stepPulseAnim {
  0% { transform: translateX(-50%) scale(1); opacity: 0.6; }
  100% { transform: translateX(-50%) scale(3); opacity: 0; }
}

@media (max-width: 600px) {
  #minimap {
    width: 100px !important;
    height: 100px !important;
  }
  #hud-breadcrumb {
    right: 130px;
  }
}