/* /hunt -- shared stylesheet for every hunt page (landing, builder, player,
 * dashboard). Loaded after /style.css, so it only ever reaches for the same
 * design tokens (--bg/--bg-2/--bg-3/--border/--text/--text-2/--text-3/
 * --accent/--accent-dim/--success/--error/--radius/--mono/--sans) -- no
 * hard-coded hex, no new theme handling (the site's html[data-theme="light"]
 * override on :root already recolors every var(--...) used below).
 *
 * Reuses global classes where they already fit (.btn, .form, .form-group,
 * .form-row, .flash, .result-box/.result-row/.result-label/.result-url,
 * .text-muted) -- everything here is additive, hunt-specific chrome.
 *
 * Mobile-first: base rules target narrow screens, @media (min-width: 720px)
 * widens layout for tablet/desktop.
 *
 * ── Component index (for the builder/play/dash pages) ──────────────────────
 *   Language toggle   .hunt-lang-toggle
 *   Layout            .hunt-hero, .hunt-steps, .hunt-step, .hunt-tabs,
 *                      .hunt-tabpanel, .hunt-warn, .hunt-empty
 *   Your-hunts list   .hunt-mine-list, .hunt-mine-item, .hunt-mine-main,
 *                      .hunt-mine-title, .hunt-mine-meta, .hunt-mine-actions
 *   Cards / lists     .hunt-card, .hunt-card-head, .hunt-card-body,
 *                      .hunt-wp-list, .hunt-wp-item, .hunt-wp-seq,
 *                      .hunt-wp-main, .hunt-wp-actions
 *   Status            .hunt-badge (+ -done/-points/-order/-live/-ended
 *                      modifiers), .hunt-progress, .hunt-progress-bar,
 *                      .hunt-progress-fill, .hunt-progress-label
 *   Hints             .hunt-hint-list, .hunt-hint-item, .hunt-hint-cost
 *   Leaderboard        .hunt-board, .hunt-board-row, .hunt-board-rank,
 *                      .hunt-board-name, .hunt-board-score
 *   Photos             .hunt-photo-grid, .hunt-photo-thumb, .hunt-lightbox,
 *                      .hunt-lightbox-img, .hunt-lightbox-close
 *   Map (slippy)       .smap sizing + .smap-* cosmetics, .smap-path
 *   Team/emoji         .hunt-emoji-grid, .hunt-emoji-btn, .hunt-team-chip
 *   Location opt-in    .hunt-share-toggle
 *   Compass            .hunt-compass, .hunt-compass-arrow, .hunt-compass-dist
 *   Cheat sheet        .hunt-cheatsheet (+ @media print rules at the bottom)
 */

/* ─── Language toggle (pill pair, mirrors .fin-lang-toggle) ─────────────── */
.hunt-lang-toggle {
  display: inline-flex;
  gap: 0.35rem;
}
.hunt-lang-toggle .hunt-lang-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 500;
}
.hunt-lang-toggle .hunt-lang-btn.active:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: #000;
}

/* ─── Hero + 3-step explainer ────────────────────────────────────────────── */
.hunt-hero {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.5rem;
}
.hunt-hero p { color: var(--text-2); font-size: 0.92rem; line-height: 1.55; margin: 0 0 1rem; }
.hunt-steps {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.hunt-step {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}
.hunt-step-n {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hunt-step-body strong { display: block; color: var(--text); font-size: 0.9rem; }
.hunt-step-body span { color: var(--text-2); font-size: 0.82rem; }
@media (min-width: 720px) {
  .hunt-steps { flex-direction: row; }
  .hunt-step { flex: 1; }
}

/* ─── Tabs (Create / Import / Join) ──────────────────────────────────────── */
.hunt-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}
.hunt-tab {
  background: transparent;
}
.hunt-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 500;
}
.hunt-tabpanel { display: none; }
.hunt-tabpanel.active { display: block; }

/* ─── Warning / callout boxes ────────────────────────────────────────────── */
.hunt-warn {
  background: rgba(245, 166, 35, 0.08);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.5;
  margin: 1rem 0;
}
.hunt-warn strong { color: var(--accent); }

/* ─── Empty states ───────────────────────────────────────────────────────── */
.hunt-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1rem;
  text-align: center;
  color: var(--text-2);
  font-size: 0.86rem;
}

/* ─── "Your hunts" resume list ───────────────────────────────────────────── */
.hunt-mine-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.hunt-mine-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
}
.hunt-mine-title { color: var(--text); font-weight: 500; font-size: 0.92rem; }
.hunt-mine-meta { color: var(--text-3); font-size: 0.74rem; font-family: var(--mono); margin-top: 0.15rem; }
.hunt-mine-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.hunt-mine-remove { color: var(--text-3); padding: 0.35rem 0.6rem; }
.hunt-mine-remove:hover { color: var(--error); border-color: var(--error); }

/* ─── Generic card ───────────────────────────────────────────────────────── */
.hunt-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
}
.hunt-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.hunt-card-body { display: flex; flex-direction: column; gap: 0.6rem; }

/* ─── Collapsible card toggle (AI prompt generator, landing/import tab) ──── */
.hunt-ai-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.hunt-ai-toggle .hunt-ai-chevron {
  color: var(--text-3);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.hunt-ai-toggle[aria-expanded="true"] .hunt-ai-chevron { transform: rotate(90deg); }
#huntAiBody { margin-top: 0.75rem; }
#huntAiPrompt { min-height: 12rem; }

/* ─── Waypoint list (builder + player) ───────────────────────────────────── */
.hunt-wp-list { display: flex; flex-direction: column; gap: 0.5rem; }
.hunt-wp-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
}
.hunt-wp-item.active { border-color: var(--accent); }
.hunt-wp-item.done { opacity: 0.7; }
.hunt-wp-seq {
  flex-shrink: 0;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hunt-wp-item.done .hunt-wp-seq { background: var(--success); color: #000; }
.hunt-wp-main { flex: 1; min-width: 0; }
.hunt-wp-title { color: var(--text); font-weight: 500; font-size: 0.92rem; overflow-wrap: anywhere; }
.hunt-wp-sub { color: var(--text-3); font-size: 0.76rem; margin-top: 0.1rem; }
.hunt-wp-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }

/* ─── Status badges / chips ──────────────────────────────────────────────── */
.hunt-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text-2);
}
.hunt-badge-points { color: var(--accent); border-color: var(--accent-dim); }
.hunt-badge-done { color: var(--success); border-color: var(--success); }
.hunt-badge-order { color: var(--text-2); }
.hunt-badge-live { color: var(--success); border-color: var(--success); }
.hunt-badge-ended { color: var(--error); border-color: var(--error); }

/* ─── Progress bar (x/y + score) ─────────────────────────────────────────── */
.hunt-progress { margin-bottom: 1rem; }
.hunt-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-2);
  margin-bottom: 0.3rem;
  font-family: var(--mono);
}
.hunt-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  overflow: hidden;
}
.hunt-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ─── Hints ──────────────────────────────────────────────────────────────── */
.hunt-hint-list { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.5rem; }
.hunt-hint-item {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
  color: var(--text);
}
.hunt-hint-cost { color: var(--text-3); font-size: 0.72rem; font-family: var(--mono); }

/* ─── Leaderboard ─────────────────────────────────────────────────────────── */
.hunt-board { display: flex; flex-direction: column; gap: 0.35rem; }
.hunt-board-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}
.hunt-board-row.self { border-color: var(--accent); }
.hunt-board-rank { font-family: var(--mono); color: var(--text-3); width: 1.6rem; flex-shrink: 0; text-align: center; }
.hunt-board-emoji { font-size: 1.1rem; flex-shrink: 0; }
.hunt-board-name { flex: 1; min-width: 0; color: var(--text); font-size: 0.9rem; overflow-wrap: anywhere; }
.hunt-board-score { font-family: var(--mono); color: var(--accent); font-weight: 700; flex-shrink: 0; }

/* ─── Photo wall + lightbox ──────────────────────────────────────────────── */
.hunt-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.5rem;
}
.hunt-photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-3);
  cursor: pointer;
  padding: 0;
}
.hunt-photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hunt-photo-thumb-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 1.4rem;
  height: 1.4rem;
  line-height: 1;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
}
.hunt-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.hunt-lightbox[hidden] { display: none; }
.hunt-lightbox-img { max-width: 100%; max-height: 100%; border-radius: var(--radius); }
.hunt-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 50%;
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1.2rem;
  cursor: pointer;
}

/* ─── Slippy map (cosmetic-only; structural sizing/position is set inline by
 * /_slippymap.js -- see that file's header comment. Sizing here is cosmetic
 * in the sense that the map still functions without it, but a 0-height
 * container would render nothing, so a real height is given.) ────────────── */
.smap {
  position: relative;
  width: 100%;
  height: 320px;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-2);
  touch-action: none;
}
.smap-tile { display: block; user-select: none; -webkit-user-drag: none; }
.smap-marker {
  width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
  pointer-events: none;
}
.smap-acc {
  border-radius: 50%;
  background: rgba(74,144,217,0.15);
  border: 1px solid #4a90d9;
  pointer-events: none;
  transform: translate(-50%,-50%);
}
.smap-attr {
  font-size: 0.7rem;
  line-height: 1.4;
  background: rgba(255,255,255,0.75);
  color: #333;
  padding: 1px 5px;
  border-radius: 3px;
}
.smap-attr a { color: #333; }
.smap-zoom { display: flex; flex-direction: column; gap: 4px; }
.smap-zoom-btn {
  width: 28px; height: 28px; line-height: 1;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-1, var(--bg-2));
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
}
.smap-peer-name {
  font-size: 10px;
  line-height: 1.25;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(0,0,0,0.62);
  color: #fff;
  text-align: center;
}
/* Route line drawn by builder-owned setPath() (spec §8): the canvas itself is
 * created/positioned by /_slippymap.js; this only guarantees it never blocks
 * taps on the map underneath. */
.smap-path { pointer-events: none; }
.hunt-map-wrap { margin: 0.75rem 0; }

/* ─── Team emoji picker ───────────────────────────────────────────────────── */
.hunt-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.35rem;
  max-width: 360px;
}
.hunt-emoji-btn {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.hunt-emoji-btn.active { border-color: var(--accent); background: var(--bg-3); }
.hunt-team-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text);
}

/* ─── Location-sharing opt-in toggle (off by default; deliberate, geoshare-
 * style copy sits alongside it in markup, not styled here) ─────────────────── */
.hunt-share-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
}
.hunt-share-toggle input[type="checkbox"] { width: 1.1rem; height: 1.1rem; flex-shrink: 0; }
.hunt-share-toggle-label { font-size: 0.85rem; color: var(--text); flex: 1; }

/* ─── Compass / distance (player target card) ───────────────────────────── */
.hunt-compass {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-3);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  margin-top: 0.5rem;
}
.hunt-compass-arrow {
  display: inline-block;
  font-size: 1.4rem;
  color: var(--accent);
  transition: transform 0.2s ease;
}
.hunt-compass-dist { font-family: var(--mono); color: var(--text); font-size: 0.95rem; }

/* ─── Cheat sheet (builder print view) ───────────────────────────────────── */
.hunt-cheatsheet { display: none; }

@media (min-width: 720px) {
  .hunt-photo-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

@media print {
  body * { visibility: hidden; }
  .hunt-cheatsheet, .hunt-cheatsheet * { visibility: visible; }
  .hunt-cheatsheet {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    color: #000;
    background: #fff;
    font-family: var(--sans);
  }
  .hunt-cheatsheet-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; }
  .hunt-cheatsheet table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
  .hunt-cheatsheet th, .hunt-cheatsheet td { border: 1px solid #999; padding: 0.3rem 0.5rem; text-align: left; }
  .hunt-cheatsheet th { background: #eee; }
}
