/* =====================================================================
   The Big Lap — Endless Play UI (v43): Big Lap Hub, toasts, story cards,
   driving ghost pill, map chip & NPC friendship panel
   ===================================================================== */

/* ---------- Hub modal ---------- */
.endless-modal .modal-content {
  max-width: 920px;
  max-height: min(88dvh, calc(100% - 10px));
}
@media (min-width: 600px) {
  .endless-modal .modal-content { max-height: min(84dvh, calc(100% - 16px)); }
}
.eh-header { gap: 10px; }
.eh-header-right { display: flex; align-items: center; gap: 10px; }
.eh-wallet { display: flex; gap: 6px; font-size: 12px; font-weight: 800; }
.eh-wallet span { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 999px; padding: 3px 9px; color: #0f172a; white-space: nowrap; }

.eh-tabs {
  display: flex; gap: 4px; padding: 6px 10px; overflow-x: auto; border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(180deg, #f8fafc, #ffffff); scrollbar-width: thin; flex-shrink: 0;
}
.eh-tab {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 66px;
  padding: 5px 6px; border-radius: 12px; border: 1.5px solid transparent; background: transparent; cursor: pointer;
  font-family: inherit; color: #475569; transition: all .15s ease;
}
.eh-tab span { font-size: 19px; line-height: 1.1; }
.eh-tab small { font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.eh-tab:hover { background: #f1f5f9; }
.eh-tab.active { background: #e0f2fe; border-color: #38bdf8; color: #0369a1; }
.eh-dot { display: none; position: absolute; top: 4px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px #fff; }
.eh-body { padding: 12px 14px 18px; background: #fbfdff; }

.eh-hero {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; margin-bottom: 12px; color: #fff;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.22);
}
.eh-hero b { display: block; font-size: 15.5px; }
.eh-hero small { display: block; font-size: 12px; opacity: 0.94; line-height: 1.42; margin-top: 3px; }
.eh-hero .eh-bar { background: rgba(255,255,255,0.3); margin-top: 6px; }
.eh-hero-season { background: linear-gradient(135deg, #f59e0b, #ef4444 60%, #8b5cf6); }
.eh-hero-dispatch { background: linear-gradient(135deg, #0f766e, #0ea5e9); }
.eh-hero-sanctuary { background: linear-gradient(135deg, #16a34a, #65a30d); }
.eh-hero-cons { background: linear-gradient(135deg, #15803d, #0d9488); }
.eh-hero-laps { background: linear-gradient(135deg, #b45309, #ca8a04 50%, #7c3aed); }
.eh-hero-coll { background: linear-gradient(135deg, #2563eb, #9333ea); }
.eh-hero-custom { background: linear-gradient(135deg, #db2777, #f97316); }
.eh-hero-mastery { background: linear-gradient(135deg, #7c3aed, #4338ca); }
.eh-hero-mates { background: linear-gradient(135deg, #e11d48, #f59e0b); }
.eh-hero-ranger { background: linear-gradient(135deg, #166534, #0f766e 60%, #1e3a8a); }
.eh-big { font-size: 30px; line-height: 1; flex-shrink: 0; }

.eh-section { margin: 0 0 14px; }
.eh-section-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 2px 8px; }
.eh-section-h b { font-size: 14px; color: #0f172a; }
.eh-section-h small { font-size: 11.5px; color: #64748b; font-weight: 700; }

.eh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.eh-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 10px 12px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05); display: flex; flex-direction: column; gap: 6px;
}
.eh-card-dim { opacity: 0.78; background: #f8fafc; }
.eh-card p { margin: 0; font-size: 12.3px; line-height: 1.45; color: #334155; }
.eh-card-top { display: flex; gap: 10px; align-items: center; }
.eh-card-top b { display: block; font-size: 13.5px; color: #0f172a; }
.eh-card-top small { display: block; font-size: 11.3px; color: #64748b; line-height: 1.35; }
.eh-card-top svg, .eh-row svg, .eh-portrait svg { width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; }
.eh-portrait { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: #ecfdf5; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.eh-portrait svg { width: 56px; height: 56px; }
.eh-portrait.sm, .eh-portrait.sm svg { width: 40px; height: 40px; }
.eh-tip { font-size: 11.8px; line-height: 1.4; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 9px; padding: 6px 9px; }
.eh-note { font-size: 11.8px; color: #475569; background: #f1f5f9; border-radius: 10px; padding: 8px 10px; line-height: 1.45; }
.eh-empty { font-size: 12.5px; color: #64748b; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px; padding: 12px; text-align: center; }
.eh-muted { color: #64748b; font-size: 11.3px; display: block; }

.eh-pills, .eh-mini-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.eh-loc {
  display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px; border-radius: 999px; font-family: inherit;
  font-size: 11px; font-weight: 700; cursor: pointer; border: 1px solid #cbd5e1; background: #f8fafc; color: #334155;
}
.eh-loc.visited { border-color: #10b981; background: #ecfdf5; color: #065f46; }
.eh-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; font-size: 11.3px; font-weight: 700; background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; margin: 2px; }
.eh-chip.dim { background: #f1f5f9; color: #94a3b8; border-color: #e2e8f0; }
.eh-mini-pills span { font-size: 10.5px; padding: 2px 7px; border-radius: 999px; background: #f1f5f9; color: #94a3b8; border: 1px solid #e2e8f0; }
.eh-mini-pills span.on { background: #ecfdf5; color: #047857; border-color: #6ee7b7; }

.eh-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px dashed #e2e8f0; }
.eh-row > div { flex: 1; min-width: 0; }
.eh-row b { display: block; font-size: 13px; color: #0f172a; }
.eh-row small { display: block; font-size: 11.3px; color: #64748b; line-height: 1.35; }

.eh-bar { height: 8px; border-radius: 999px; background: #e2e8f0; overflow: hidden; margin: 4px 0 2px; }
.eh-bar i { display: block; height: 100%; border-radius: 999px; transition: width .4s ease; }

.eh-task, .eh-set { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 9px 11px; margin-bottom: 7px; }
.eh-task.done, .eh-set.done { background: #f0fdf4; border-color: #86efac; }
.eh-task-main { flex: 1; min-width: 0; }
.eh-task-main b { font-size: 12.8px; color: #0f172a; display: block; }
.eh-task-main small { font-size: 11px; color: #64748b; display: block; }
.eh-reward { font-size: 10.5px; font-weight: 800; color: #b45309; background: #fef3c7; border-radius: 999px; padding: 3px 8px; white-space: nowrap; }

.eh-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.eh-btn {
  font-family: inherit; font-weight: 800; font-size: 12.5px; padding: 8px 14px; border-radius: 11px; cursor: pointer;
  border: none; background: linear-gradient(135deg, #0284c7, #2563eb); color: #fff; box-shadow: 0 3px 8px rgba(37, 99, 235, 0.25);
}
.eh-btn:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.eh-btn.eh-sm { font-size: 11.5px; padding: 6px 10px; border-radius: 9px; }
.eh-btn.eh-green { background: linear-gradient(135deg, #059669, #16a34a); box-shadow: 0 3px 8px rgba(5, 150, 105, 0.25); }
.eh-btn.eh-gold { background: linear-gradient(135deg, #f59e0b, #ea580c); box-shadow: 0 3px 8px rgba(234, 88, 12, 0.3); margin-top: 6px; }
.eh-btn.eh-btn-alt { background: #fff; color: #0369a1; border: 1.5px solid #7dd3fc; box-shadow: none; }

.eh-animal .eh-feed { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
.eh-release { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: #f0fdf4; border: 1px solid #86efac; border-radius: 10px; padding: 7px; }
.eh-release input, .eh-input {
  flex: 1; min-width: 140px; font-family: inherit; font-size: 12.5px; padding: 7px 10px; border-radius: 9px; border: 1.5px solid #cbd5e1;
}
.eh-input { width: 100%; box-sizing: border-box; margin-bottom: 8px; }

.eh-pips { display: flex; gap: 5px; }
.eh-pips i { width: 22px; height: 8px; border-radius: 999px; background: #e2e8f0; }
.eh-pips i.on { background: linear-gradient(90deg, #22c55e, #15803d); }

.eh-stamps { display: flex; flex-wrap: wrap; gap: 10px; }
.eh-stamp {
  width: 108px; height: 92px; border-radius: 14px; border: 2px dashed #cbd5e1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 4px; background: #f8fafc; color: #94a3b8; transform: rotate(-2deg);
}
.eh-stamp span { font-size: 30px; }
.eh-stamp small { font-size: 10.5px; font-weight: 800; padding: 0 4px; }
.eh-stamp.got { border: 2.5px solid var(--c); color: var(--c); background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,0.08); }
.eh-journal { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.eh-journal details { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 7px 10px; }
.eh-journal summary { font-weight: 800; font-size: 12.5px; color: #92400e; cursor: pointer; }
.eh-journal p { font-size: 12.5px; line-height: 1.5; color: #44403c; font-style: italic; margin: 6px 0 2px; }
.eh-journal-locked { font-size: 12px; color: #94a3b8; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 7px 10px; }

.eh-species { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px dashed #e2e8f0; }
.eh-species b { display: block; font-size: 13px; }
.eh-species small { display: block; font-size: 11.3px; color: #b45309; font-weight: 700; margin-bottom: 3px; }
.eh-postcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 7px; }
.eh-postcard {
  text-align: left; font-family: inherit; border-radius: 10px; padding: 7px 9px; cursor: pointer;
  background: linear-gradient(135deg, #fff7ed, #ffffff); border: 1.5px solid #fdba74; display: flex; flex-direction: column; gap: 2px;
}
.eh-postcard b { font-size: 11.8px; color: #9a3412; }
.eh-postcard small { font-size: 10.5px; color: #57534e; line-height: 1.3; }
.eh-postcard.locked { background: #f8fafc; border: 1.5px dashed #e2e8f0; cursor: default; }
.eh-postcard.locked b { color: #94a3b8; }

.eh-swatches, .eh-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 7px; margin-bottom: 6px; }
.eh-swatch, .eh-item {
  font-family: inherit; text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 8px 9px; border-radius: 12px;
  background: #fff; border: 1.5px solid #e2e8f0; cursor: pointer;
}
.eh-swatch i { display: block; height: 28px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.12); }
.eh-swatch b, .eh-item b { font-size: 12px; color: #0f172a; }
.eh-swatch small, .eh-item small { font-size: 10.5px; color: #64748b; line-height: 1.3; }
.eh-swatch.active, .eh-item.active { border-color: #22c55e; background: #f0fdf4; }
.eh-swatch.locked, .eh-item.locked { opacity: 0.6; }
.eh-item:disabled { cursor: default; }

.eh-mastery { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed #e2e8f0; }
.eh-mastery b { display: block; font-size: 13px; text-transform: capitalize; }
.eh-mastery small { display: block; font-size: 11.3px; color: #475569; }
.eh-tier { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; border: 2.5px solid var(--c); background: #fff; flex-shrink: 0; }

.eh-mate details { font-size: 12px; background: #fff7ed; border-radius: 9px; padding: 5px 8px; }
.eh-mate summary { font-weight: 800; color: #9a3412; cursor: pointer; }
.eh-mate details p { margin: 5px 0; line-height: 1.45; color: #44403c; }

.eh-quiz, .eh-quiz-done { background: #fff; border: 1.5px solid #bbf7d0; border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 9px; text-align: left; }
.eh-quiz-done { text-align: center; align-items: center; }
.eh-quiz h3, .eh-quiz-done h3 { margin: 0; font-size: 16px; color: #0f172a; line-height: 1.35; }
.eh-quiz-opts { display: flex; flex-direction: column; gap: 6px; }
.eh-opt {
  font-family: inherit; text-align: left; font-size: 13px; font-weight: 700; padding: 9px 12px; border-radius: 11px;
  border: 1.5px solid #cbd5e1; background: #f8fafc; color: #0f172a; cursor: pointer;
}
.eh-opt:hover:not(:disabled) { border-color: #0ea5e9; background: #f0f9ff; }
.eh-opt.right { background: #dcfce7; border-color: #22c55e; color: #14532d; }
.eh-opt.wrong { background: #fee2e2; border-color: #ef4444; color: #7f1d1d; }
.eh-opt.dim { opacity: 0.55; }

/* ---------- Toast stack ---------- */
#endless-toasts {
  position: fixed; top: calc(var(--safe-top, 0px) + 96px); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px; z-index: 160; width: min(380px, calc(100vw - 24px)); pointer-events: none;
}
.eh-toast {
  pointer-events: auto; cursor: pointer; display: flex; gap: 9px; align-items: center; padding: 8px 12px; border-radius: 14px;
  background: rgba(15, 23, 42, 0.9); color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,0.25); border-left: 4px solid #38bdf8;
  opacity: 0; transform: translateY(-10px); transition: all .3s ease; backdrop-filter: blur(4px);
}
.eh-toast.show { opacity: 1; transform: translateY(0); }
.eh-toast b { display: block; font-size: 12.5px; line-height: 1.3; }
.eh-toast small { display: block; font-size: 11px; opacity: 0.85; line-height: 1.35; margin-top: 1px; }
.eh-toast-ic { font-size: 24px; flex-shrink: 0; }
.eh-toast-event { border-left-color: #f59e0b; }
.eh-toast-dispatch { border-left-color: #14b8a6; }
.eh-toast-sanctuary { border-left-color: #22c55e; }
.eh-toast-conservation { border-left-color: #16a34a; }
.eh-toast-lap { border-left-color: #a855f7; }
.eh-toast-collection { border-left-color: #3b82f6; }
.eh-toast-mastery { border-left-color: #8b5cf6; }
.eh-toast-friend { border-left-color: #f43f5e; }
.eh-toast-pet { border-left-color: #ea580c; }
body.mode-driving #endless-toasts { top: calc(var(--safe-top, 0px) + 92px); }

/* ---------- Story card overlay ---------- */
.eh-story {
  position: fixed; inset: 0; z-index: 170; display: flex; align-items: center; justify-content: center;
  background: rgba(2, 6, 23, 0.55); padding: 16px;
}
.eh-story.hidden { display: none; }
.eh-story-card {
  width: min(440px, 100%); background: linear-gradient(180deg, #fffbeb, #ffffff); border-radius: 20px; padding: 18px 18px 14px;
  text-align: center; box-shadow: 0 16px 40px rgba(0,0,0,0.35); border: 2px solid #fcd34d; animation: ehPop .32s ease;
}
.eh-story-ic { font-size: 46px; }
.eh-story-card h3 { margin: 4px 0 8px; font-size: 17px; color: #0f172a; }
.eh-story-card p { margin: 0 0 10px; font-size: 13.3px; line-height: 1.55; color: #334155; text-align: left; }
.eh-story-foot { font-size: 12px; font-weight: 800; color: #b45309; background: #fef3c7; border-radius: 10px; padding: 6px 9px; margin-bottom: 10px; }
.eh-story-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
@keyframes ehPop { from { transform: scale(0.88); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Driving ghost pill ---------- */
.eh-ghost {
  position: fixed; top: calc(var(--safe-top, 0px) + 54px); left: 50%; transform: translateX(-50%); z-index: 45;
  background: rgba(15, 23, 42, 0.42); color: #f8fafc; font-size: 11.5px; font-weight: 800; padding: 4px 11px;
  border-radius: 999px; pointer-events: none; white-space: nowrap; backdrop-filter: blur(3px); border: 1px solid rgba(255,255,255,0.18);
}
.eh-ghost.ahead { background: rgba(21, 128, 61, 0.55); }
.eh-ghost.hidden { display: none; }
body.has-modal .eh-ghost { display: none; }

/* ---------- Map chip & nav badge ---------- */
.eh-map-chip {
  position: absolute; left: 10px; top: calc(var(--safe-top, 0px) + 200px); z-index: 40; display: none; align-items: center; gap: 5px;
  font-family: inherit; font-size: 12px; font-weight: 800; padding: 7px 12px; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; border: 2px solid rgba(255,255,255,0.75);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35); animation: ehBob 3.2s ease-in-out infinite;
  transition: top 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
body.qt-expanded .eh-map-chip,
body:has(.q-tracker.expanded:not(.hidden)) .eh-map-chip {
  top: calc(var(--safe-top, 0px) + 258px);
}
@keyframes ehBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
body.title-active .eh-map-chip, body.mode-driving .eh-map-chip, body.mode-camp .eh-map-chip,
body.in-minigame .eh-map-chip, body.has-modal .eh-map-chip, body.has-dialog .eh-map-chip, body.has-sheet .eh-map-chip { display: none !important; }
#nav-hub { position: relative; }
.eh-nav-badge {
  display: none; position: absolute; top: 2px; right: 8px; min-width: 16px; height: 16px; border-radius: 999px; padding: 0 4px;
  background: #ef4444; color: #fff; font-size: 10px; font-weight: 800; font-style: normal; align-items: center; justify-content: center;
}

/* ---------- NPC modal friendship panel ---------- */
.eh-npc-panel {
  margin-top: 10px; padding: 9px 11px; border-radius: 12px; background: linear-gradient(135deg, #fff1f2, #fff7ed);
  border: 1px solid #fecdd3; font-size: 12.3px; color: #7f1d1d; display: flex; flex-direction: column; gap: 5px;
}
