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

@font-face {
  font-family: 'Marola';
  src: url('./assets/fonts/MAROLA_.TTF') format('truetype');
  font-weight: normal;
  font-style: normal;
}

#tooltip {
  position: fixed;
  pointer-events: none;
  font-family: 'Marola', serif;
  font-size: 45px;
  letter-spacing: 0.06em;
  color: rgba(255, 220, 60, 0.95);
  z-index: 9999;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s ease;
  text-shadow: 0 0 18px rgba(255, 200, 0, 0.9), 0 0 40px rgba(255, 160, 0, 0.5);
}

#tooltip.visible {
  opacity: 1;
}

@keyframes tooltip-float {
  0%   { transform: translate(0px,     0px);   }
  20%  { transform: translate(1.4px,  -1.8px); }
  45%  { transform: translate(-1px,   -0.7px); }
  65%  { transform: translate(1.7px,   1.4px); }
  80%  { transform: translate(-1.4px,  1px);   }
  100% { transform: translate(0px,     0px);   }
}

.tooltip-letter {
  display: inline-block;
  opacity: 0;
  transition: opacity 0.18s ease-in-out;
}

.tooltip-letter.shown {
  opacity: 1;
}

/* ── Custom cursors ──────────────────────────────────────────────────────────
   Default everywhere; "select" while hovering an interactive object; "grab"
   while the mouse is held down (toggled via body classes from JS). */
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a0a;
  cursor: url('./assets/cursors/cursor.cur'), auto;
}

/* Force every element to use the site cursor (override UA pointer/text/etc.). */
* {
  cursor: inherit;
}

/* Static fallback while hovering (JS cycles the frames inline for animation). */
body.hover-interactive,
body.hover-interactive * {
  cursor: url('./assets/cursors/select0.cur'), pointer;
}

/* Held state wins over everything. */
body.grabbing,
body.grabbing * {
  cursor: url('./assets/cursors/grab.cur'), grabbing !important;
}

#scene {
  display: block;
  width: 100vw;
  height: 100vh;
  touch-action: none;
}

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: #0a0a0a;
  z-index: 50;
  pointer-events: none;
  /* The black background fades over ~1s → the scene fades in from black. */
  transition: opacity 1s ease;
}

/* "loading" text below the image — letters in a row with the tooltip drift. */
.load-word {
  display: flex;
  justify-content: center;
  gap: 0.16em; /* spacing between letters */
  margin-top: -0.35em; /* tuck closer to the image */
  font-family: 'Marola', serif;
  font-size: clamp(14px, 3vw, 23px);
  line-height: 1;
  color: rgba(255, 236, 205, 0.92);
  text-shadow: 0 0 16px rgba(255, 200, 0, 0.35);
  user-select: none;
}

/* Loading letters: visible immediately (no type-out), just the float drift. */
.load-letter {
  display: inline-block;
}

/* Step 1 of the exit: the cat + text fade out first, leaving just black. */
#loading.content-out #loading-img,
#loading.content-out .load-word {
  opacity: 0;
  transition: opacity 0.35s ease;
}

#loading-img {
  width: min(36vw, 240px);
  height: auto;
  display: block;
  /* Vertical reveal: clipped from the top; JS shrinks the inset as it loads,
     so the image fills upward from the bottom pixels. */
  clip-path: inset(100% 0 0 0);
  -webkit-clip-path: inset(100% 0 0 0);
  transition: clip-path 0.4s ease-out, -webkit-clip-path 0.4s ease-out;
  user-select: none;
}

#loading.hidden {
  opacity: 0;
}

/* ── Game-style menu (menu.html, right side) ──────────────────────────────── */
#game-menu {
  position: fixed;
  right: clamp(28px, 7vw, 110px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 3.2vh, 36px);
  z-index: 60;
  font-family: 'Marola', serif;
}

.gm-item {
  display: flex;
  align-items: center;
  gap: 0.35em;
  font-size: clamp(26px, 4.6vw, 56px);
  line-height: 1;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  letter-spacing: 0.03em;
  text-transform: lowercase;
  transition: color 0.18s ease, transform 0.18s ease, text-shadow 0.18s ease;
  /* staggered entrance */
  opacity: 0;
  transform: translateX(26px);
  animation: gm-in 0.5s ease forwards;
}
.gm-item:nth-child(1) { animation-delay: 2.6s; }
.gm-item:nth-child(2) { animation-delay: 2.74s; }
.gm-item:nth-child(3) { animation-delay: 2.88s; }

@keyframes gm-in {
  to { opacity: 1; transform: translateX(0); }
}

.gm-caret {
  font-size: 0.55em;
  color: rgba(255, 210, 120, 0.95);
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.gm-item:hover {
  color: #fff;
  transform: translateX(12px);
  text-shadow: 0 0 18px rgba(255, 200, 80, 0.65), 0 0 44px rgba(255, 150, 0, 0.35);
}
.gm-item:hover .gm-caret {
  opacity: 1;
  transform: translateX(0);
}

/* "← back" on the menu page */
#home-link {
  position: fixed;
  left: 22px;
  bottom: 18px;
  z-index: 60;
  font-family: 'Marola', serif;
  font-size: 16px;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  transition: color 0.18s ease, text-shadow 0.18s ease;
}
#home-link:hover {
  color: #fff;
  text-shadow: 0 0 16px rgba(255, 200, 80, 0.6);
}

/* Corner link on the index page → the menu version */
#enter-link {
  position: fixed;
  right: 22px;
  bottom: 18px;
  z-index: 60;
  font-family: 'Marola', serif;
  font-size: 16px;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: color 0.18s ease, transform 0.18s ease, text-shadow 0.18s ease;
}
#enter-link:hover {
  color: #fff;
  transform: translateX(3px);
  text-shadow: 0 0 16px rgba(255, 200, 80, 0.6);
}

/* ── Candlelight debug panel ─────────────────────────────────────────── */
#debug-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 230px;
  padding: 12px 14px;
  background: rgba(18, 18, 20, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: #ddd;
  user-select: none;
  z-index: 10;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#debug-panel.dp-hidden {
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
}

.dp-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffae6b;
  margin-bottom: 10px;
}

.dp-hint {
  color: #666;
  font-size: 9px;
  letter-spacing: 0.05em;
}

.dp-sub {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #9ec5ff;
}

.dp-row {
  display: grid;
  grid-template-columns: 56px 1fr 42px;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.dp-name {
  color: #999;
}

.dp-row input[type="range"] {
  width: 100%;
  accent-color: #ff8a3d;
}

.dp-row output {
  text-align: right;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.dp-check {
  display: flex;
  gap: 8px;
  grid-template-columns: none;
  color: #999;
  cursor: pointer;
}

.dp-check input {
  accent-color: #ff8a3d;
}

.dp-readout {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #8fd18f;
  font-size: 10px;
  line-height: 1.5;
  white-space: pre;
}

/* ── Touch / mobile overrides ─────────────────────────────────────────────── */
@media (pointer: coarse) {
  /* Reset every custom cursor back to the browser default on touch screens. */
  html, body,
  body.hover-interactive,
  body.hover-interactive *,
  body.grabbing,
  body.grabbing * {
    cursor: auto !important;
  }

  /* Tooltip is mouse-driven; keep it hidden on touch. */
  #tooltip {
    display: none !important;
  }

  /* ── Mobile music image link (top-right) ─────────────────────────────────── */
  #mobile-music {
    position: fixed;
    top: 5%;
    right: 4%;
    z-index: 100;
    display: block;
    -webkit-tap-highlight-color: transparent;
  }

  #mobile-music img {
    display: block;
    width: clamp(70px, 22vw, 120px);
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
    filter: brightness(0) invert(1) drop-shadow(0 0 6px rgba(255,255,255,0.8)) drop-shadow(0 0 14px rgba(255,255,255,0.4));
  }

  /* ── Mobile link pills ───────────────────────────────────────────────────── */
  .mobile-pill {
    position: fixed;
    font-family: 'Marola', serif;
    font-size: 14px;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 50px;
    padding: 5px 15px;
    text-decoration: none;
    background: transparent;
    z-index: 100;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-pill:active {
    background: rgba(255, 255, 255, 0.08);
  }
}
