/* ============ TOGETHER MODE — remote treasure drops ============ */

#tg-root { position: fixed; inset: 0; z-index: 240; display: none; background: #17102b; }
#tg-root.is-on { display: block; }

/* ---- entry buttons injected on start screen / club ---- */
.tg-entry {
  display: block; width: 100%; margin-top: 10px;
  border: 1px solid rgba(255, 214, 130, 0.45);
  background: linear-gradient(135deg, rgba(255, 200, 90, 0.16), rgba(150, 90, 255, 0.14));
  color: #ffe9bd; font: inherit; font-weight: 700;
  border-radius: 14px; padding: 12px 14px; cursor: pointer;
}

/* ---- shared chrome ---- */
.tg-screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.tg-screen.is-on { display: flex; }

.tg-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1200;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
  background: linear-gradient(180deg, rgba(23, 16, 43, 0.92), rgba(23, 16, 43, 0));
  pointer-events: none;
}
.tg-topbar > * { pointer-events: auto; }
.tg-back {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.25);
  background: rgba(23, 16, 43, 0.75); color: #fff; font-size: 20px; cursor: pointer;
}
.tg-title { flex: 1; color: #fff; line-height: 1.15; text-shadow: 0 1px 6px rgba(0,0,0,0.5); }
.tg-title strong { display: block; font-family: "Bungee", cursive; font-size: 15px; letter-spacing: 0.3px; }
.tg-title small { opacity: 0.85; font-size: 12px; }

/* ---- pairing ---- */
#tg-pair { justify-content: center; align-items: center; padding: 24px; text-align: center;
  background: radial-gradient(120% 90% at 50% 0%, #2a1b52 0%, #17102b 70%); }
#tg-pair .tg-pair-inner { width: 100%; max-width: 380px; }
#tg-pair h2 { font-family: "Bungee", cursive; color: #ffd982; font-size: 22px; margin: 8px 0 4px; }
#tg-pair p { color: #cfc3ee; font-size: 14px; margin: 6px 0 16px; }
.tg-pair-card {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px; padding: 16px; margin-top: 14px; text-align: left;
}
.tg-pair-card h3 { color: #fff; font-size: 15px; margin: 0 0 8px; }
.tg-pair-card input {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 16px;
  background: rgba(0,0,0,0.35); color: #fff; border: 1px solid rgba(255,255,255,0.25);
  border-radius: 12px; padding: 11px 12px; margin: 5px 0;
}
.tg-btn {
  display: block; width: 100%; margin-top: 10px; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 16px; color: #2a1600;
  background: linear-gradient(135deg, #ffd982, #ffb14e); border: 0;
  border-radius: 14px; padding: 13px 16px;
}
.tg-btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: #fff; font-weight: 600; }
.tg-btn:disabled { opacity: 0.5; }
.tg-code-big {
  font-family: "Bungee", cursive; font-size: 34px; letter-spacing: 2px; color: #ffd982;
  text-align: center; background: rgba(0,0,0,0.35); border-radius: 14px; padding: 14px; margin: 10px 0;
}
.tg-err { color: #ff9d9d; font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ---- full-bleed map ---- */
#tg-map-screen { background: #8fd8ff; }
#tg-map { position: absolute; inset: 0; z-index: 1; background: #8fd8ff; }
.leaflet-container { font: inherit; }
/* Game-world look: real streets and parks, but with the candy-bright
   palette of a video-game overworld — vivid greens, deep blue water. */
.leaflet-tile { filter: saturate(2.1) brightness(1.06) contrast(1.12) hue-rotate(-8deg); }

/* Drifting cartoon clouds + a soft sky vignette frame the world map.
   Purely decorative — clicks pass straight through to the map. */
.tg-world-deco { position: absolute; inset: 0; z-index: 1100; pointer-events: none; overflow: hidden; }
.tg-world-deco::after {
  content: ""; position: absolute; inset: 0;
  box-shadow: inset 0 0 90px 18px rgba(120, 200, 255, 0.35);
  border-radius: 26px;
}
.tg-cloud { position: absolute; font-size: 54px; opacity: 0.9;
  filter: drop-shadow(0 6px 8px rgba(30, 90, 140, 0.25));
  animation: tg-drift 46s linear infinite; }
.tg-cloud.c1 { top: 9%;  font-size: 64px; animation-duration: 52s; }
.tg-cloud.c2 { top: 20%; font-size: 40px; animation-duration: 38s; animation-delay: -14s; }
.tg-cloud.c3 { top: 72%; font-size: 48px; animation-duration: 60s; animation-delay: -30s; }
.tg-cloud.c4 { top: 85%; font-size: 34px; animation-duration: 44s; animation-delay: -8s; }
@keyframes tg-drift {
  from { left: -18%; }
  to   { left: 108%; }
}
@media (prefers-reduced-motion: reduce) { .tg-cloud { animation: none; left: 8%; } }

.tg-fabs {
  position: absolute; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  z-index: 1200; display: flex; flex-direction: column; gap: 10px;
}
.tg-fab {
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.3);
  background: rgba(23, 16, 43, 0.9); color: #fff; font-size: 24px; cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,0.45);
}
.tg-fab.gold { background: linear-gradient(135deg, #ffd982, #ffb14e); color: #2a1600; border: 0; font-size: 28px; }

/* map marker icons — chunky game-level markers with a happy bounce */
.tg-pin { display: grid; place-items: center; }
.tg-pin .bubble {
  width: 42px; height: 42px; border-radius: 50% 50% 50% 8px; transform: rotate(0deg);
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, #ff5b5b, #d92f2f); border: 3px solid #fff;
  box-shadow: 0 4px 0 rgba(120, 30, 30, 0.55), 0 8px 16px rgba(0,0,0,0.35);
  animation: tg-bob 2.2s ease-in-out infinite;
}
.tg-pin.egg .bubble { background: linear-gradient(135deg, #ffe08a, #f0a53a); box-shadow: 0 4px 0 rgba(150, 100, 20, 0.55), 0 8px 16px rgba(0,0,0,0.35); }
.tg-pin.found .bubble { filter: grayscale(0.9); opacity: 0.55; animation: none; box-shadow: 0 3px 10px rgba(0,0,0,0.3); }
.tg-pin.mine .bubble { background: linear-gradient(135deg, #47b0ff, #1d78d0); box-shadow: 0 4px 0 rgba(20, 70, 130, 0.55), 0 8px 16px rgba(0,0,0,0.35); }
.tg-pin .bubble.pulse { animation: tg-pulse 1.6s ease-in-out infinite; }
@keyframes tg-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes tg-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .tg-pin .bubble { animation: none; } }

/* cartoon home markers — like the start castle on a world map */
.tg-house { display: flex; flex-direction: column; align-items: center; gap: 2px; pointer-events: none; }
.tg-house .roof { font-size: 38px; line-height: 1;
  filter: drop-shadow(0 4px 4px rgba(60, 30, 10, 0.4));
  animation: tg-house-bob 3.4s ease-in-out infinite; }
.tg-house .tag { font-weight: 800; font-size: 11px; white-space: nowrap;
  color: #5b3413; background: linear-gradient(180deg, #fff6df, #ffe9b8);
  border: 2px solid #e8b45f; border-radius: 999px; padding: 2px 9px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25); }
@keyframes tg-house-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .tg-house .roof { animation: none; } }

/* the player: a bright star badge instead of a GPS dot */
/* ---------- view toggle (Map / Scan) ---------- */
.tg-views { display: flex; gap: 4px; margin-left: auto; background: rgba(26, 20, 44, .85);
  border: 1px solid rgba(246, 196, 83, .3); border-radius: 999px; padding: 3px; }
.tg-view-btn { border: 0; background: none; color: #cfc3ea; font-weight: 800; font-size: 12px;
  padding: 6px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tg-view-btn.is-on { background: #F6C453; color: #241c3d; }

/* ---------- scan view ---------- */
/* scanning: the map's own controls step aside */
#tg-map-screen.scanning .tg-fabs,
#tg-map-screen.scanning .tg-tracker { display: none !important; }
.tg-scan { position: absolute; inset: 0; z-index: 1150; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; text-align: center;
  padding: 74px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(120% 90% at 50% 0%, #2b2150 0%, #17112e 60%, #0e0a1f 100%);
  color: #f3edff; }
.tg-scan-title { font-weight: 800; font-size: 15px; color: #F6C453; margin: 0; }
.tg-scan-arrow-wrap { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center;
  border: 2px dashed rgba(246, 196, 83, .5); box-shadow: 0 0 40px rgba(246, 196, 83, .15) inset; }
.tg-scan-arrow { font-size: 72px; line-height: 1; transition: transform .25s ease-out;
  filter: drop-shadow(0 4px 10px rgba(246, 196, 83, .35)); }
.tg-scan-dist { display: flex; align-items: baseline; gap: 8px; }
.tg-scan-dist span { font-family: "Bungee", cursive; font-size: 44px; color: #fff;
  font-variant-numeric: tabular-nums; }
.tg-scan-dist small { font-size: 14px; color: #cfc3ea; font-weight: 700; }
.tg-scan-hint { font-size: 13px; color: #b7a8d4; max-width: 250px; margin: 0; min-height: 2.4em; }
.tg-scan-open { margin-top: 4px; }
.tg-scan-stars { position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 88% 38%, #F6C453 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 32%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 62% 24%, #fff 50%, transparent 51%); }
/* thumbnail proximity map — bottom right */
.tg-minimap-wrap { position: absolute; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  width: 128px; height: 128px; border-radius: 16px; overflow: hidden;
  border: 2px solid rgba(246, 196, 83, .6); box-shadow: 0 8px 22px rgba(10, 5, 25, .55); }
#tg-minimap { width: 100%; height: 100%; background: #241c3d; }
.tg-minimap-tag { position: absolute; left: 6px; top: 5px; z-index: 800; font-size: 9px;
  font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #241c3d;
  background: rgba(246, 196, 83, .92); border-radius: 999px; padding: 2px 7px; pointer-events: none; }
.tg-mini-pin { font-size: 16px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(20, 10, 40, .5)); }
.tg-mini-me { width: 14px; height: 14px; border-radius: 50%; background: #6FE3C4;
  border: 2.5px solid #fff; box-shadow: 0 0 10px rgba(111, 227, 196, .8); }

/* ---------- character avatars (Cambry + Dad) ---------- */
.tg-avatar { position: relative; width: 46px; height: 54px; pointer-events: none; }
.tg-avatar .char { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
  font-size: 30px; line-height: 1; display: block;
  filter: drop-shadow(0 3px 4px rgba(20, 10, 40, .35));
  animation: tg-walk 1.1s ease-in-out infinite; transform-origin: 50% 100%; }
.tg-avatar.kid .char { animation: tg-skip .9s ease-in-out infinite; }
.tg-avatar .ring { position: absolute; left: 50%; bottom: 0; width: 30px; height: 12px;
  transform: translateX(-50%); border-radius: 50%;
  border: 2px solid rgba(246, 196, 83, .9); opacity: .9;
  animation: tg-ring 2s ease-out infinite; }
.tg-avatar.me .ring { border-color: rgba(111, 227, 196, .95); }
.tg-avatar .feet-shadow { position: absolute; left: 50%; bottom: 3px; width: 22px; height: 7px;
  transform: translateX(-50%); border-radius: 50%; background: rgba(20, 10, 40, .3); }
/* Dad's backwards black hat: crown on top, strap + snap at the front */
.tg-avatar.dad .cap { position: absolute; left: 50%; bottom: 32px; transform: translateX(-50%) rotate(-6deg);
  width: 22px; height: 10px; background: #17141f; border-radius: 11px 11px 4px 4px;
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, .08); z-index: 2; }
.tg-avatar.dad .cap .strap { position: absolute; left: 50%; top: 6px; transform: translateX(-50%);
  width: 12px; height: 4px; background: #17141f; border-radius: 2px; }
.tg-avatar.dad .cap .strap::after { content: ""; position: absolute; left: 50%; top: 1px;
  transform: translateX(-50%); width: 3px; height: 2px; border-radius: 1px; background: #3a3350; }
/* Cambry's little bow */
.tg-avatar.kid .bow { position: absolute; left: 50%; bottom: 34px; transform: translateX(-30%) rotate(14deg);
  width: 10px; height: 6px; z-index: 2; }
.tg-avatar.kid .bow::before, .tg-avatar.kid .bow::after { content: ""; position: absolute; top: 0;
  width: 5px; height: 6px; background: #ff8fb2; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.tg-avatar.kid .bow::before { left: 0; transform: rotate(-24deg); }
.tg-avatar.kid .bow::after { right: 0; transform: rotate(24deg); }
@keyframes tg-walk { 0%, 100% { transform: translateX(-50%) rotate(-3deg); } 50% { transform: translateX(-50%) rotate(3deg); } }
@keyframes tg-skip { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-4px); } }
@keyframes tg-ring { 0% { opacity: .9; scale: .7; } 80% { opacity: 0; scale: 1.5; } 100% { opacity: 0; scale: 1.5; } }
@media (prefers-reduced-motion: reduce) {
  .tg-avatar .char, .tg-avatar.kid .char, .tg-avatar .ring { animation: none; }
}

/* ---------- treasure tracker panel ---------- */
.tg-tracker { position: absolute; left: 10px; bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 940; max-width: min(calc(100vw - 96px), 330px);
  background: rgba(26, 20, 44, .92); border: 1px solid rgba(246, 196, 83, .35);
  border-radius: 14px; color: #f3edff; backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(10, 5, 25, .45); overflow: hidden; }
.tg-tracker-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 8px 12px; background: none; border: 0; color: #F6C453;
  font-weight: 800; font-size: 13px; cursor: pointer; }
.tg-tracker-body { padding: 2px 12px 10px; max-height: 32vh; overflow-y: auto; }
.tw-row { padding: 6px 0; border-top: 1px dashed rgba(255, 255, 255, .12); }
.tw-row:first-child { border-top: 0; }
.tw-drop { font-size: 12.5px; font-weight: 700; margin-bottom: 3px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.tw-people { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.tw-person { font-size: 12px; color: #cfc3ea; }
.tw-person b { color: #fff; font-variant-numeric: tabular-nums; }
.tw-person.close { color: #6FE3C4; }
.tw-person.close b { color: #6FE3C4; }

.tg-me-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #ffe259, #ffa751); border: 3px solid #fff;
  box-shadow: 0 0 0 7px rgba(255, 200, 80, 0.3), 0 4px 12px rgba(0,0,0,0.3); }
.tg-me-dot::after { content: "⭐"; font-size: 15px; }

/* ---- bottom drop sheet / gather guide ---- */
.tg-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1300;
  background: rgba(26, 18, 48, 0.97); border-radius: 22px 22px 0 0;
  border-top: 1px solid rgba(255, 214, 130, 0.35);
  padding: 14px 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateY(110%); transition: transform 0.28s ease; color: #fff;
  max-height: 78%; overflow-y: auto;
}
.tg-sheet.is-on { transform: translateY(0); }
.tg-sheet h3 { margin: 2px 0 4px; font-size: 18px; }
.tg-sheet .tg-sub { color: #cfc3ee; font-size: 13px; margin: 0 0 10px; }
.tg-sheet .close-x { position: absolute; top: 10px; right: 12px; width: 34px; height: 34px;
  border-radius: 10px; border: 0; background: rgba(255,255,255,0.12); color: #fff; font-size: 17px; cursor: pointer; }

.tg-guide-dist { text-align: center; margin: 10px 0 4px; }
.tg-guide-dist .feet { font-family: "Bungee", cursive; font-size: 44px; color: #ffd982; line-height: 1; }
.tg-guide-dist .unit { color: #cfc3ee; font-size: 14px; }
.tg-guide-hint { text-align: center; color: #cfc3ee; font-size: 13px; min-height: 18px; }
#tg-guide-arrow {
  width: 74px; height: 74px; margin: 8px auto; display: grid; place-items: center;
  font-size: 46px; transition: transform 0.25s ease; color: #ffd982;
}
.tg-here { text-align: center; }
.tg-here .big { font-size: 52px; animation: tg-pulse 1.2s ease-in-out infinite; }

/* ---- create form ---- */
.tg-form label { display: block; font-size: 13px; color: #cfc3ee; margin: 10px 0 4px; }
.tg-form input[type="text"], .tg-form textarea {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 15px;
  background: rgba(0,0,0,0.35); color: #fff; border: 1px solid rgba(255,255,255,0.25);
  border-radius: 12px; padding: 10px 12px;
}
.tg-form textarea { min-height: 74px; resize: vertical; }
.tg-kind-row, .tg-emoji-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tg-kind-row button, .tg-emoji-row button {
  font: inherit; cursor: pointer; border-radius: 12px; padding: 8px 12px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2); color: #fff;
}
.tg-kind-row button.sel, .tg-emoji-row button.sel {
  background: linear-gradient(135deg, #ffd982, #ffb14e); color: #2a1600; border-color: transparent; font-weight: 700;
}
.tg-emoji-row button { font-size: 20px; padding: 6px 10px; }
.tg-photo-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.tg-photo-row img { width: 54px; height: 54px; object-fit: cover; border-radius: 10px; border: 1px solid rgba(255,255,255,0.3); }
.tg-place-hint {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 64px); left: 50%; transform: translateX(-50%);
  z-index: 1250; background: rgba(23,16,43,0.92); color: #ffd982; border: 1px solid rgba(255,214,130,0.5);
  padding: 9px 16px; border-radius: 999px; font-size: 14px; white-space: nowrap;
}

/* ---- reveal card ---- */
#tg-reveal {
  position: absolute; inset: 0; z-index: 1400; display: none;
  background: rgba(10, 6, 24, 0.92); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 22px;
}
#tg-reveal.is-on { display: flex; }
.tg-reveal-card {
  width: 100%; max-width: 380px; max-height: 86%; overflow-y: auto; text-align: center;
  background: linear-gradient(160deg, #2c1d58, #1a1233); border: 1px solid rgba(255,214,130,0.5);
  border-radius: 22px; padding: 22px 18px; color: #fff; box-shadow: 0 10px 50px rgba(0,0,0,0.6);
}
.tg-reveal-card .big-emoji { font-size: 64px; }
.tg-reveal-card h3 { font-family: "Bungee", cursive; color: #ffd982; margin: 8px 0; }
.tg-reveal-card .note { color: #e8e0ff; font-size: 15px; white-space: pre-wrap; margin: 10px 0; }
.tg-reveal-card img.photo { max-width: 100%; border-radius: 14px; margin-top: 8px; border: 1px solid rgba(255,255,255,0.25); }
.tg-reveal-card .from { color: #cfc3ee; font-size: 13px; margin-top: 10px; }
