/* ============================================================
   NEW BERN BEAR HUNT — STYLES
   Mobile-first. Theme switches via body.family / body.adult
   ============================================================ */

:root {
  /* Bern flag palette: gold field, red diagonal, black bear */
  --bg: #FFF3C2;
  --card: #FFFDF5;
  --ink: #1C1710;
  --ink-soft: #79683F;
  --brand: #C8102E;        /* Bern red */
  --accent: #FFD100;       /* Bern gold */
  --accent-deep: #E3A900;  /* deep gold */
  --green: #C8102E;        /* primary action color (Bern red) */
  --green-soft: #FFE9A3;   /* soft gold chip/track */
  --danger: #7A1220;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(60, 40, 0, 0.14);
}

body.adult {
  /* Adult palette: black bear night — black, gold, a cut of red */
  --bg: #17140E;
  --card: #262019;
  --ink: #F7EFD8;
  --ink-soft: #B3A480;
  --brand: #E3B94E;
  --accent: #FFD100;
  --accent-deep: #C8102E;
  --green: #C8102E;
  --green-soft: #3A3223;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  transition: background 0.3s;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 96px; /* room for bottom nav */
}

h1 { font-size: 1.7rem; line-height: 1.2; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p  { line-height: 1.5; }

.muted { color: var(--ink-soft); font-size: 0.92rem; }
.center { text-align: center; }

/* ---------- Cards & buttons ---------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 14px 0;
}

.btn {
  display: block;
  width: 100%;
  padding: 16px 20px;          /* big tap targets */
  border: none;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: var(--accent-deep);
  transition: transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn + .btn { margin-top: 12px; }

.btn.primary { background: var(--green); }
.btn.ghost {
  background: transparent;
  color: var(--brand);
  border: 2px solid var(--brand);
}
.btn.small { padding: 10px 14px; font-size: 0.95rem; width: auto; display: inline-block; }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: 0.45; cursor: default; }

/* ---------- Header ---------- */

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 10px;
}
.top .back {
  background: none; border: none; font-size: 1.5rem;
  color: var(--brand); cursor: pointer; padding: 6px 10px 6px 0;
}
.top h1 { font-size: 1.25rem; flex: 1; }
.top .count-chip {
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- Bottom nav ---------- */

nav.bottom {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.12);
  display: flex;
  justify-content: space-around;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  z-index: 50;
}
nav.bottom a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 0;
}
nav.bottom a .ico { display: block; font-size: 1.45rem; }
nav.bottom a.active { color: var(--accent-deep); }

/* ---------- Home ---------- */

.hero {
  text-align: center;
  padding: 26px 10px 8px;
}
.hero .big-bear { font-size: 4.5rem; display: block; }
.hero h1 { margin: 8px 0 4px; }

/* ---------- Mode select ---------- */

.mode-card {
  display: block;
  width: 100%;
  text-align: left;
  border: 3px solid transparent;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 14px 0;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
}
.mode-card .m-emoji { font-size: 2.2rem; }
.mode-card h2 { margin: 6px 0 4px; }

/* ---------- Toggle rows ---------- */

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
}
.toggle-row + .toggle-row { border-top: 1px solid rgba(125, 95, 60, 0.15); }
.toggle-row .lbl { font-weight: 700; }

.switch { position: relative; width: 54px; height: 32px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 2; }
.switch .track {
  position: absolute; inset: 0;
  background: #c9bba6;
  border-radius: 999px;
  transition: background 0.2s;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 26px; height: 26px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.2s;
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { left: 25px; }

.seg {
  display: flex;
  background: var(--green-soft);
  border-radius: 999px;
  padding: 4px;
  margin: 10px 0;
}
.seg button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.seg button.on { background: var(--green); color: #fff; }

/* ---------- Hunt ---------- */

.clue-card {
  text-align: center;
  padding: 30px 22px;
}
.clue-card .c-emoji { font-size: 3rem; }
.clue-card .clue-text {
  font-size: 1.25rem;
  line-height: 1.5;
  margin: 14px 0;
  font-weight: 600;
}
.clue-card .c-area {
  display: inline-block;
  background: var(--green-soft);
  color: var(--green);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.85rem;
  font-weight: 700;
}
body.adult .clue-card .c-area { color: var(--ink); }

.progress-bar {
  height: 14px;
  background: rgba(125, 95, 60, 0.18);
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 4px;
}
.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* ---------- Bear list ---------- */

.area-head {
  margin: 22px 4px 8px;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.bear-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 13px 14px;
  margin: 8px 0;
  text-decoration: none;
  color: var(--ink);
}
.bear-row .b-emoji { font-size: 1.7rem; width: 40px; text-align: center; }
.bear-row .b-info { flex: 1; min-width: 0; }
.bear-row .b-name { font-weight: 700; }
.bear-row .b-sub { font-size: 0.82rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bear-row .b-check { font-size: 1.3rem; }
.bear-row.found { border-left: 5px solid var(--green); }

.filter-bar { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.filter-bar button {
  border: 2px solid var(--brand);
  background: transparent;
  color: var(--brand);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}
.filter-bar button.on { background: var(--brand); color: #fff; }

/* ---------- Bear detail ---------- */

.detail-hero { text-align: center; padding: 16px 0 4px; }
.detail-hero .d-emoji { font-size: 4rem; }
.photo-thumb {
  width: 100%;
  border-radius: var(--radius);
  display: block;
  margin: 10px 0;
}

/* ---------- Reveal / modals ---------- */

.overlay {
  position: fixed; inset: 0;
  background: rgba(30, 20, 8, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px 22px;
  width: 100%;
  max-width: 420px;
  max-height: 86vh;
  overflow-y: auto;
  text-align: center;
}
.modal .m-emoji { font-size: 3.4rem; }
.modal h2 { margin: 8px 0; }

.crawl-rule {
  background: var(--green-soft);
  border-radius: 14px;
  padding: 14px;
  margin: 14px 0;
  font-weight: 700;
}

/* ---------- Adult gate ---------- */

.gate-box {
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px;
  margin: 14px 0;
  text-align: left;
}
.gate-box ul { margin: 10px 0 0 20px; line-height: 1.7; }
.ack-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 16px 0;
  text-align: left;
}
.ack-row input { width: 26px; height: 26px; flex-shrink: 0; accent-color: var(--green); }

/* ---------- Progress / badges ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: center;
}
.stat .n { font-size: 1.9rem; font-weight: 800; color: var(--accent-deep); }
.stat .l { font-size: 0.8rem; color: var(--ink-soft); font-weight: 600; }

.badges { display: flex; gap: 10px; margin: 14px 0; }
.badge {
  flex: 1;
  text-align: center;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 6px;
  opacity: 0.35;
}
.badge.earned { opacity: 1; border: 2px solid var(--accent); }
.badge .b-ico { font-size: 1.8rem; display: block; }
.badge .b-lbl { font-size: 0.72rem; font-weight: 700; color: var(--ink-soft); }

/* ---------- Certificate ---------- */

#cert-canvas {
  width: 100%;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin: 12px 0;
}
input.text {
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  border: 2px solid var(--brand);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  margin: 8px 0;
}

/* ---------- Confetti ---------- */

.confetti-piece {
  position: fixed;
  top: -40px;
  font-size: 1.6rem;
  z-index: 200;
  pointer-events: none;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(540deg); }
}

.milestone-pop {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  background: var(--card);
  border-radius: 22px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
  padding: 30px 34px;
  text-align: center;
  z-index: 210;
  animation: pop 0.4s ease forwards;
}
@keyframes pop {
  to { transform: translate(-50%, -50%) scale(1); }
}
.milestone-pop .mp-emoji { font-size: 3.4rem; }
