/* identidade da TVC Marília (cores e fonte do tvcmarilia.com.br) */
:root {
  --bg: #f4f5f7;
  --card: rgba(255, 255, 255, 0.94);
  --ink: #152236;
  --ink-soft: #596574;
  --line: rgba(21, 34, 54, 0.10);
  --accent: #053d87;      /* azul TVC */
  --accent-text: #053d87; /* azul para texto e ícones */
  --accent-2: #ff7600;    /* laranja TVC */
  --accent-ink: #ffffff;
  --shadow: 0 6px 22px rgba(10, 25, 50, 0.16), 0 1px 3px rgba(10, 25, 50, 0.10);
  --radius: 16px;
  --gutter: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --card: rgba(16, 24, 38, 0.92);
    --ink: #eef2f8;
    --ink-soft: #a7b2c2;
    --line: rgba(255, 255, 255, 0.10);
    --accent: #2f6fd6;
    --accent-text: #8db8ff;
    --bg: #0e1520;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
body {
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
kbd {
  font-family: inherit; font-size: 11px; font-weight: 800;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; margin: 0 1px;
  background: rgba(127, 127, 127, 0.08);
}

#app { position: fixed; inset: 0; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#gl.dragging { cursor: grabbing; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---------- marca */
.brand {
  position: absolute; top: var(--gutter); left: var(--gutter);
  display: flex; align-items: center; gap: 12px; padding: 9px 16px 9px 14px;
}
.tvc { display: block; line-height: 0; }
.tvc img { height: 30px; width: auto; display: block; }
.brand-txt { padding-left: 12px; border-left: 3px solid var(--accent-2); }
.brand h1 { margin: 0; font: 800 17px/1.1 "Manrope", sans-serif; letter-spacing: -.1px; }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--ink-soft); font-weight: 600; }

/* ---------- busca */
.search {
  position: absolute; top: var(--gutter); left: 50%; transform: translateX(-50%);
  width: min(380px, calc(100vw - 2 * var(--gutter)));
  display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 46px;
}
.search i { color: var(--ink-soft); font-size: 18px; }
.search input {
  flex: 1; border: 0; outline: 0; background: none; font: 600 15px "Manrope", sans-serif; color: var(--ink);
  min-width: 0;
}
.search input::placeholder { color: var(--ink-soft); }
#sugg {
  position: absolute; top: 52px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  max-height: 50vh; overflow: auto;
}
#sugg li {
  padding: 8px 10px; border-radius: 10px; cursor: pointer; display: flex; gap: 10px; align-items: center;
  font-weight: 700; font-size: 14px;
}
#sugg li small { color: var(--ink-soft); font-weight: 600; margin-left: auto; font-size: 12px; }
#sugg li i { color: var(--accent-text); font-size: 17px; }
#sugg li.active, #sugg li:hover { background: rgba(5, 61, 135, 0.10); }

/* ---------- cartão do lugar */
#place {
  position: absolute; top: 76px; left: var(--gutter); width: 300px; padding: 16px 16px 14px;
  max-height: calc(100dvh - 76px - 190px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin;
}
#place h2 { margin: 8px 0 4px; font: 800 19px/1.2 "Manrope", sans-serif; }
#place p { margin: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.45; }
.place-hist { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.place-hist h3 {
  margin: 0 0 7px; font: 800 12px/1 "Manrope", sans-serif; letter-spacing: .6px; text-transform: uppercase;
  color: var(--accent-text); display: flex; align-items: center; gap: 6px;
  padding-left: 8px; border-left: 3px solid var(--accent-2);
}
.place-hist h3 i { font-size: 15px; }
#place .hist-text { color: var(--ink); font-size: 13.5px; line-height: 1.5; user-select: text; -webkit-user-select: text; }
#place .hist-text.none { color: var(--ink-soft); font-style: italic; }
#place .hist-src { margin-top: 7px; font-size: 11.5px; line-height: 1.4; }
.hist-src a { color: var(--accent-text); font-weight: 700; text-decoration: none; }
.hist-src a:hover { text-decoration: underline; }
#place .x { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; }
#place .x:hover { background: var(--line); }
.place-icon {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 23px; color: #fff;
}

/* ---------- ferramentas */
.tools {
  position: absolute; right: var(--gutter); top: var(--gutter);
  display: flex; flex-direction: column; gap: 10px;
}
.stack { display: flex; flex-direction: column; align-items: center; padding: 4px; }
.stack button {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px;
}
.stack button:hover { background: var(--line); }
.stack button.on { background: var(--accent); color: var(--accent-ink); }
#compass .needle {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  font: 700 12px "Manrope", sans-serif; color: #fff;
  background: conic-gradient(from -20deg, #d6493b 0 40deg, var(--ink-soft) 40deg 360deg);
  transition: transform .15s linear;
}
.tilt { padding: 10px 4px 12px; gap: 6px; }
.tilt i { font-size: 18px; color: var(--ink-soft); }
.tilt input {
  writing-mode: vertical-lr; direction: rtl; width: 22px; height: 96px; accent-color: var(--accent); margin: 0;
}

/* ---------- dock inferior */
.dock {
  position: absolute; left: 50%; bottom: var(--gutter); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: min(640px, calc(100vw - 2 * var(--gutter)));
}
.carousel { display: flex; align-items: center; gap: 4px; padding: 6px; width: 100%; }
.carousel .nav { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; }
.carousel .nav:hover { background: var(--line); }
.cards { display: flex; gap: 8px; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; flex: 1; }
.cards::-webkit-scrollbar { display: none; }
.lm-card {
  flex: none; width: 112px; height: 74px; border-radius: 12px; position: relative; overflow: hidden;
  color: #fff; text-align: left; padding: 8px 9px; display: flex; flex-direction: column; justify-content: space-between;
  transition: transform .12s ease;
}
.lm-card { isolation: isolate; }
.lm-card:hover { transform: translateY(-2px); }
.lm-card i { font-size: 24px; opacity: .95; }
.lm-card span { font: 700 12px/1.15 "Manrope", sans-serif; text-shadow: 0 1px 3px rgba(0,0,0,.45); }
.lm-card img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1;
  animation: fade-in .5s ease;
}
.lm-card.has-img::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgba(10, 20, 18, .72), rgba(10, 20, 18, 0) 62%);
}
.lm-card.has-img i {
  font-size: 13px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--badge); box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modes { display: flex; gap: 8px; }
.mode {
  display: flex; align-items: center; gap: 7px; height: 44px; padding: 0 18px 0 14px; border-radius: 999px;
  background: var(--card); box-shadow: var(--shadow); font-weight: 800; font-size: 15px;
}
.mode i { font-size: 19px; color: var(--accent-text); }
.mode.on { background: var(--accent); color: var(--accent-ink); }
.mode.on i { color: var(--accent-ink); }

/* ---------- minimapa */
.minimap {
  position: absolute; left: var(--gutter); bottom: var(--gutter); padding: 5px; line-height: 0;
}
#mini { width: 160px; height: 160px; border-radius: 11px; cursor: crosshair; }

.credits {
  position: absolute; right: var(--gutter); bottom: 4px; font-size: 10px; color: var(--ink-soft);
  font-weight: 600; opacity: .85; pointer-events: none; text-align: right;
}

/* ---------- rótulos no mapa */
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lbl {
  position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform;
  display: flex; align-items: center; gap: 5px; transition: opacity .2s;
}
.lbl.pin {
  pointer-events: auto; cursor: pointer; font-weight: 800; font-size: 12px;
  background: var(--card); border-radius: 999px; padding: 3px 9px 3px 4px; box-shadow: var(--shadow);
}
.lbl.pin .dot {
  width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px;
}
.lbl.hood {
  font: 800 12px "Manrope", sans-serif; letter-spacing: .6px; color: #1d2b40;
  text-shadow: 0 0 3px #fff, 0 0 6px #fff, 0 0 10px rgba(255,255,255,.8);
  text-transform: uppercase; opacity: .78;
}

/* ---------- voo */
#fly-hud {
  position: absolute; top: 72px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px; align-items: center; padding: 8px 16px; font-size: 13px; font-weight: 700;
}
#fly-hud .hint-touch { display: none; }
@media (pointer: coarse) { #fly-hud span { display: none; } #fly-hud .hint-touch { display: inline; } }

/* ---------- desafio */
#chal {
  position: absolute; top: 72px; left: 50%; transform: translateX(-50%);
  width: min(380px, calc(100vw - 2 * var(--gutter))); padding: 14px 16px;
}
.chal-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 800; }
.chal-tag { color: var(--accent-text); display: flex; align-items: center; gap: 5px; text-transform: uppercase; letter-spacing: .5px; }
.chal-step { color: var(--ink-soft); }
#chal h2 { margin: 6px 0 4px; font: 800 20px/1.2 "Manrope", sans-serif; }
#chal p { margin: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.45; }
.chal-score { margin-top: 10px; display: flex; align-items: baseline; gap: 10px; font-weight: 800; }
.chal-score b { font: 800 30px "Manrope", sans-serif; color: var(--accent-text); }
.chal-score .dots { margin-left: auto; font-size: 18px; letter-spacing: 2px; }
.chal-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.chal-actions button {
  height: 36px; padding: 0 14px; border-radius: 999px; font-weight: 800; font-size: 14px;
  background: var(--line); display: flex; align-items: center; gap: 6px;
}
.chal-actions button.primary { background: var(--accent); color: #fff; margin: 0; }
#gl.picking { cursor: crosshair; }

/* ---------- aviso */
#toast {
  position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%);
  padding: 10px 18px; font-weight: 800; font-size: 14px; z-index: 5;
  animation: fade-in .2s ease;
}

/* ---------- carregamento */
#loader {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 10;
  background: radial-gradient(circle at 50% 40%, #ffffff, #e3e9f1);
  transition: opacity .6s ease;
}
#loader.done { opacity: 0; pointer-events: none; }
.loader-box { text-align: center; width: 260px; }
.loader-logo { width: 220px; height: auto; display: block; margin: 0 auto 14px; }
.loader-box h2 { font: 800 22px "Manrope", sans-serif; margin: 0 0 16px; color: #152236; }
.bar { height: 8px; border-radius: 99px; background: rgba(21,34,54,.10); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s; }
#load-msg { font-size: 13px; color: #596574; font-weight: 700; margin-top: 10px; }

/* ---------- sobre */
dialog#about {
  border: 0; max-width: min(520px, calc(100vw - 32px)); padding: 22px 24px; color: var(--ink);
}
dialog#about::backdrop { background: rgba(10, 20, 36, 0.40); }
dialog#about h2 { font: 800 22px "Manrope", sans-serif; margin: 0 0 8px; }
dialog#about a { color: var(--accent-text); font-weight: 700; }
.about-logo { height: 34px; width: auto; display: block; margin-bottom: 12px; }
@media (prefers-color-scheme: dark) { .about-logo { content: url("brand/tvc-logo-dark.webp"); } }
dialog#about h2 small { font-size: 13px; color: var(--ink-soft); }
dialog#about p, dialog#about li { font-size: 14px; line-height: 1.5; }
dialog#about ul { padding-left: 18px; }
.primary {
  background: var(--accent); color: #fff; font-weight: 800; border-radius: 999px; padding: 10px 22px; margin-top: 6px;
}

/* ---------- celular */
@media (max-width: 720px) {
  :root { --gutter: 10px; }
  .brand { padding: 8px 12px 8px 10px; gap: 9px; }
  .brand p { display: none; }
  .brand h1 { font-size: 14px; }
  .brand-txt { padding-left: 9px; }
  .tvc img { height: 22px; }
  .search { top: 62px; left: var(--gutter); transform: none; width: calc(100vw - 2 * var(--gutter) - 60px); height: 42px; }
  #place { top: 112px; width: calc(100vw - 2 * var(--gutter) - 60px); max-height: calc(100dvh - 112px - 200px); }
  .minimap { display: none; }
  .tools { gap: 6px; }
  .stack button { width: 36px; height: 36px; font-size: 18px; }
  .tilt input { height: 70px; }
  .mode { padding: 0 12px 0 10px; font-size: 13px; height: 40px; gap: 5px; }
  .mode i { font-size: 17px; }
  #chal { top: 112px; }
  .lm-card { width: 98px; height: 64px; }
  .dock { bottom: 22px; gap: 8px; }
  .credits {
    left: var(--gutter); right: var(--gutter); bottom: 4px; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 9px;
  }
}
@media (max-width: 420px) {
  .mode:not(.on) span { display: none; }
  .mode:not(.on) { padding: 0 12px; }
}

/* aviso de cookies de estatística (mesma escolha do Complianz do site) */
#consent {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60;
  width: min(480px, calc(100vw - 24px)); padding: 14px 16px; border-left: 4px solid var(--accent-2);
  font-size: 13.5px; line-height: 1.45; animation: consent-in .35s ease-out;
}
#consent p { margin: 0 0 10px; }
#consent a { color: var(--accent-text); }
#consent .consent-actions { display: flex; gap: 8px; }
#consent button {
  flex: 1; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--ink); font: 700 14px Manrope, sans-serif; cursor: pointer;
}
#consent button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@keyframes consent-in { from { opacity: 0; transform: translate(-50%, 12px); } }
