/* ═══════════════════════════════════════════════════════════════════════════
   Tutorial Overlay
   ═══════════════════════════════════════════════════════════════════════════ */

#tut-overlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  /* The overlay itself NEVER blocks touches — only #tut-card does.
     This lets the player interact with the game (tap ticket, drag vessels, etc.)
     while the tutorial guide is visible. */
  pointer-events: none;
}

/* #tut-dim removed — the ring's box-shadow handles all outer dimming,
   so the spotlit element stays fully visible (no double-darken inside the ring). */

#tut-overlay.hidden #tut-ring,
#tut-overlay.hidden #tut-card {
  opacity: 0;
  pointer-events: none;
}

/* ── Spotlight ring — punches a glowing hole in the dim ─────────────────── */
#tut-ring {
  position: fixed;
  display: none;
  border-radius: 10px;
  pointer-events: none;
  z-index: 951;
  /* Glow border */
  outline: 2px solid var(--c-gold, #c9a227);
  outline-offset: 0px;
  /* Punch-hole: box-shadow creates the dim mask around the ring */
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.60),
              0 0 16px 4px rgba(201, 162, 39, 0.55);
  animation: tut-pulse 1.6s ease-in-out infinite;
  transition: top 0.35s cubic-bezier(0.25, 0.8, 0.25, 1),
              left 0.35s cubic-bezier(0.25, 0.8, 0.25, 1),
              width 0.35s cubic-bezier(0.25, 0.8, 0.25, 1),
              height 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes tut-pulse {
  0%,100% { box-shadow: 0 0 0 9999px rgba(0,0,0,0.60), 0 0 12px 2px rgba(201,162,39,0.45); }
  50%     { box-shadow: 0 0 0 9999px rgba(0,0,0,0.65), 0 0 24px 8px rgba(240,192,64,0.75); }
}

/* ── Instruction card — the ONLY element that captures touches ───────────── */
#tut-card {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 24px));
  /* Never taller than the screen — content scrolls inside if needed */
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: linear-gradient(160deg, #2e2010 0%, #1a1208 100%);
  border: 1px solid var(--c-gold, #c9a227);
  border-radius: 14px;
  padding: 16px 18px 14px;
  z-index: 952;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.70);
  pointer-events: auto; /* card buttons must be tappable */
  transition: top 0.35s cubic-bezier(0.25, 0.8, 0.25, 1),
              bottom 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ── Card internal elements ──────────────────────────────────────────────── */

/* Top row: step counter left, exit button right */
#tut-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

#tut-progress {
  font-family: var(--font-ui, monospace);
  font-size: 10px;
  color: var(--c-gold, #c9a227);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
}

/* Exit / restart button — always visible in card corner */
#tut-exit {
  font-family: var(--font-ui, monospace);
  font-size: 11px;
  color: var(--c-text-dim, #9a8872);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
#tut-exit:active {
  background: rgba(255,255,255,0.14);
}

#tut-headline {
  font-family: var(--font-display, serif);
  font-size: 1.15rem;
  color: var(--c-text, #e8dcc8);
  margin-bottom: 8px;
  line-height: 1.2;
}

#tut-body {
  font-family: var(--font-ui, monospace);
  font-size: 0.82rem;
  color: var(--c-text-dim, #9a8872);
  line-height: 1.55;
  white-space: pre-line; /* respects \n in the body strings */
  margin-bottom: 12px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
#tut-btns {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.tut-btn {
  font-family: var(--font-ui, monospace);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #1a1208;
  background: var(--c-gold, #c9a227);
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.tut-btn:active {
  background: #a07c18;
  transform: scale(0.97);
}

.tut-btn.tut-btn-alt {
  color: var(--c-gold, #c9a227);
  background: rgba(201, 162, 39, 0.12);
  border: 1px solid rgba(201, 162, 39, 0.35);
}

.tut-btn.tut-btn-alt:active {
  background: rgba(201, 162, 39, 0.22);
}

/* When there is no spotlight ring (null highlight), the card floats centred
   over an undimmed screen — its own strong background provides contrast. */
