/* Onde fica essa cidade? — NeuroBrincadeiras */
@import url("../assets/nb-theme.css");

:root {
  --map-land: #3ecf8e;
  --map-land-2: #2bb67a;
  --map-land-3: #4ad49a;
  --map-land-4: #34c488;
  --map-land-stroke: #0f5c40;
  --map-water: #7ec8f0;
  --map-shell: linear-gradient(160deg, #0b3d66 0%, #0a68ff 42%, #0cc8ba 100%);
  --map-uf: rgba(255, 255, 255, 0.35);
  --pin-guess: #0A68FF;
  --pin-truth: #1BAF72;
  --line-link: #7547DC;
}

body {
  background:
    radial-gradient(circle at 8% 0%, rgba(12, 200, 186, 0.16), transparent 32%),
    radial-gradient(circle at 100% 12%, rgba(10, 104, 255, 0.14), transparent 34%),
    radial-gradient(circle at 50% 100%, rgba(117, 71, 220, 0.1), transparent 40%),
    var(--nb-bg);
}

.app {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 10px 12px 28px;
}

.loading-status {
  margin: 0 0 8px;
  min-height: 0;
}

.loading-status:empty {
  display: none;
}

.setup-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.topbar { display: none !important; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.brand-copy strong {
  display: block;
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
  letter-spacing: -0.03em;
}

.brand-copy span {
  display: block;
  color: var(--nb-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--nb-border);
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  box-shadow: var(--nb-shadow-xs);
}

.icon-btn:active { transform: scale(0.96); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--nb-focus); }

.screen { display: none; }
.screen.is-active { display: block; }

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.85fr);
  gap: 16px;
}

.setup-grid--solo {
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
}

.best-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  align-items: center;
  margin: 8px 0 4px;
  padding: 14px 16px;
  border-radius: var(--nb-radius-md);
  background: linear-gradient(135deg, #eef5ff, #e8fbf7);
  border: 1px solid #d5e6f5;
}

.best-box span {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nb-muted);
}

.best-box b {
  grid-row: span 2;
  font-size: 1.45rem;
  color: var(--nb-blue-700);
}

.best-box small {
  color: var(--nb-muted);
  font-size: 0.86rem;
}

.rules-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--nb-text-2);
  line-height: 1.5;
}

.rules-list li { margin-bottom: 8px; }

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--nb-border);
  border-radius: var(--nb-radius-xl);
  box-shadow: var(--nb-shadow-md);
  padding: 24px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--nb-radius-pill);
  background: var(--nb-info-bg);
  color: var(--nb-blue-700);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-title {
  margin: 14px 0 8px;
  font-size: clamp(2rem, 1.5rem + 2vw, 3.4rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.hero-title span { color: var(--nb-blue); }

.lead {
  margin: 0 0 18px;
  color: var(--nb-muted);
  max-width: 36rem;
  line-height: 1.55;
}

.section-label {
  margin: 16px 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nb-muted);
}

.mode-grid,
.diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice {
  position: relative;
  text-align: left;
  border: 2px solid var(--nb-border);
  background: #fff;
  border-radius: var(--nb-radius-md);
  padding: 14px;
  cursor: pointer;
  min-height: 96px;
  transition: transform 0.15s var(--nb-ease), border-color 0.15s;
}

.choice:hover { transform: translateY(-1px); }
.choice.is-selected {
  border-color: var(--nb-blue);
  background: linear-gradient(180deg, #fff, #eef5ff);
  box-shadow: 0 12px 28px rgba(10, 104, 255, 0.12);
}

.choice.is-selected::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--nb-blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 800;
}

.choice b { display: block; margin-bottom: 4px; }
.choice small { color: var(--nb-muted); line-height: 1.35; }

.diff-grid .choice { min-height: 78px; }

.primary-btn,
.secondary-btn {
  width: 100%;
  border-radius: var(--nb-radius-md);
  padding: 15px 16px;
  font-weight: 800;
  cursor: pointer;
  border: 0;
}

.primary-btn {
  margin-top: 16px;
  background: linear-gradient(135deg, var(--nb-turquoise), var(--nb-blue));
  color: #fff;
  box-shadow: 0 14px 30px rgba(10, 104, 255, 0.22);
}

.secondary-btn {
  margin-top: 8px;
  background: #fff;
  border: 1px solid var(--nb-border);
  color: var(--nb-text);
}

.journey-box {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 14px;
  border-radius: var(--nb-radius-md);
  background: linear-gradient(135deg, #eefbf8, #f3f0ff);
  border: 1px solid #d9ebe6;
}

.level-orb {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--nb-border);
  font-weight: 900;
  color: var(--nb-blue-700);
  flex: 0 0 auto;
}

.progress {
  height: 7px;
  background: #dde7ef;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}

.progress > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--nb-turquoise), var(--nb-blue));
  border-radius: 99px;
}

.journey-map {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.phase-btn {
  border: 1px solid var(--nb-border);
  background: #fff;
  border-radius: 14px;
  padding: 10px 6px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.85rem;
}

.phase-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.phase-btn.is-current {
  border-color: var(--nb-blue);
  background: #eef5ff;
}

.phase-btn .stars {
  display: block;
  font-size: 0.7rem;
  color: var(--nb-warning);
  margin-top: 2px;
}

.side-note {
  color: var(--nb-muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0 0 14px;
}

/* —— Gameplay —— */
.game-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.game-title b { display: block; font-size: 1.15rem; }
.game-title span { color: var(--nb-muted); font-size: 0.82rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stats--wide {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.progress-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 8px 0 4px;
}

.rank-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--nb-radius-md);
  background: linear-gradient(135deg, #f3f0ff, #eefbf8);
  border: 1px solid #ddd5f5;
}

.rank-box span {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nb-muted);
}

.rank-box b {
  grid-row: span 2;
  font-size: 1.15rem;
  color: #5b3db8;
}

.rank-box small {
  color: var(--nb-muted);
  font-size: 0.86rem;
}

.badge-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 10px 0 4px;
  font-size: 0.9rem;
  color: var(--nb-text-2);
}

.badge-strip b { color: var(--nb-text); }

.region-pick { margin-top: 4px; }
.region-pick.is-hidden { display: none; }

.quiz-pick { margin-top: 8px; }
.quiz-pick.is-hidden { display: none; }

.quiz-uf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.quiz-uf-head .section-label { margin: 0; }

.quiz-uf-actions {
  display: flex;
  gap: 8px;
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--nb-blue);
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 4px 6px;
}

.text-btn:hover { text-decoration: underline; }

.quiz-uf-hint {
  margin: 6px 0 8px;
  font-size: 0.86rem;
  color: var(--nb-muted);
}

.quiz-uf-hint.is-warn { color: #c0392b; font-weight: 700; }

.quiz-uf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 2px;
}

.quiz-uf-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  border: 2px solid var(--nb-border);
  background: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  min-height: 58px;
}

.quiz-uf-chip b { font-size: 0.95rem; }
.quiz-uf-chip span {
  font-size: 0.72rem;
  color: var(--nb-muted);
  line-height: 1.2;
}

.quiz-uf-chip.is-selected {
  border-color: var(--nb-blue);
  background: linear-gradient(180deg, #fff, #eef5ff);
}

.quiz-shell {
  position: relative;
  background: linear-gradient(165deg, #f7fbff 0%, #e8f1ff 55%, #dff6f2 100%);
  border: 1px solid rgba(10, 104, 255, 0.14);
  border-radius: var(--nb-radius-xl);
  box-shadow: var(--nb-shadow-md);
  padding: 18px 16px 20px;
  min-height: min(62vh, 520px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.quiz-shell.is-hidden { display: none !important; }

.quiz-prompt-label {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nb-muted);
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 2px solid #c9d7ea;
  background: #fff;
  border-radius: 16px;
  padding: 14px 14px;
  cursor: pointer;
  min-height: 84px;
  transition: transform 0.15s ease, border-color 0.15s, box-shadow 0.15s;
}

.quiz-option:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--nb-blue);
  box-shadow: 0 12px 24px rgba(10, 104, 255, 0.14);
}

.quiz-letter {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, #0a68ff, #12b5c9);
}

.quiz-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.quiz-option-text b {
  font-size: 1.02rem;
  line-height: 1.2;
}

.quiz-option-text small {
  color: var(--nb-muted);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.quiz-option.is-hint {
  border-color: #f5a524;
  background: #fff8e8;
}

.quiz-option.is-revealed-hint {
  border-color: var(--nb-blue);
  box-shadow: 0 0 0 3px rgba(10, 104, 255, 0.18);
}

.quiz-option.is-eliminated {
  opacity: 0.38;
  filter: grayscale(0.4);
  pointer-events: none;
}

.quiz-option.is-correct {
  border-color: #1baf72;
  background: #e8faf1;
}

.quiz-option.is-wrong {
  border-color: #e5484d;
  background: #ffecec;
}

.quiz-option:disabled { cursor: default; }

.map-layout.is-quiz {
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.75fr);
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.help-btn .cost {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(10, 104, 255, 0.12);
  color: var(--nb-blue-700);
  font-size: 0.75rem;
  font-weight: 800;
}

.power-toast {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 12px;
  z-index: 4;
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--nb-radius-md);
  background: linear-gradient(135deg, #fff7e0, #e8fbf7);
  border: 1px solid #ead9a8;
  font-weight: 700;
  font-size: 0.88rem;
  color: #6a4b00;
  animation: toastIn 280ms ease;
  pointer-events: none;
  text-align: center;
}

.power-toast.is-hidden {
  display: block !important;
  visibility: hidden;
  opacity: 0;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.timer-ring.is-frozen {
  box-shadow: 0 0 0 3px rgba(12, 200, 186, 0.45);
}

.brazil-map .state.is-eliminated,
.map-host .state.is-eliminated {
  fill: #9aa5b1 !important;
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.lives-stat b {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.result-rank {
  margin: 10px 0 12px;
  font-weight: 800;
  color: var(--nb-blue-700);
  font-size: 0.92rem;
  line-height: 1.45;
}

.result-badges {
  display: none;
}

.heatmap-wrap { margin: 8px 0 12px; }

.heatmap-panel {
  border-radius: var(--nb-radius-md);
  background: #e8f2fb;
  border: 1px solid var(--nb-border);
  padding: 10px;
}

.heatmap-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--nb-text-2);
}

.heatmap-legend .swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
  border: 1px solid rgba(15, 40, 70, 0.18);
}

.swatch-hit { background: #1BAF72; }
.swatch-miss { background: #E5484D; }
.swatch-none { background: #d9e2ec; }

.heatmap-host {
  border-radius: var(--nb-radius-md);
  overflow: visible;
  background: transparent;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0 2px;
  min-height: 0;
}

.heatmap-host svg,
.heatmap-host .heatmap-map,
.heatmap-map {
  display: block;
  width: 100% !important;
  max-width: 440px;
  height: auto !important;
  max-height: min(52vh, 520px) !important;
  margin: 0 auto;
}

.is-hidden { display: none !important; }

.stat {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--nb-border);
  border-radius: var(--nb-radius-md);
  padding: 10px 12px;
  box-shadow: var(--nb-shadow-xs);
}

.stat span {
  display: block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nb-muted);
}

.stat b { font-size: 1.2rem; }

.prompt-card {
  background: linear-gradient(135deg, #0A68FF, #0CC8BA 70%, #7547DC);
  color: #fff;
  border-radius: var(--nb-radius-lg);
  padding: 14px 16px 12px;
  margin-bottom: 12px;
  box-shadow: var(--nb-shadow-md);
}

.prompt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prompt-card .label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.prompt-card h2 {
  margin: 4px 0 0;
  font-size: clamp(1.35rem, 1.05rem + 1.3vw, 1.9rem);
  letter-spacing: -0.03em;
}

.prompt-card .meta {
  margin-top: 6px;
  opacity: 0.92;
  font-size: 0.9rem;
}

.timer-ring {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.16);
  border: 3px solid rgba(255, 255, 255, 0.55);
  line-height: 1.05;
}

.timer-ring b {
  font-size: 1.35rem;
}

.timer-ring span {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}

.timer-ring.is-urgent {
  background: rgba(255, 91, 103, 0.35);
  border-color: #ffd0d4;
  animation: timerPulse 0.55s ease infinite;
}

.timer-track {
  margin-top: 10px;
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.timer-track > i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #fff, #ffc51a);
  transition: width 50ms linear;
}

.timer-track.is-urgent > i {
  background: linear-gradient(90deg, #ff5b67, #ffc51a);
}

@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.lives-stat b {
  letter-spacing: 0.06em;
  color: #e44555;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.7fr);
  gap: 10px;
  align-items: start;
}

.map-host .brazil-map.is-regional-focus {
  width: 100%;
  height: auto;
  max-height: min(74vh, 680px);
  display: block;
}
.map-host .state.is-region-hidden {
  display: none !important;
  pointer-events: none !important;
}

.map-shell {
  background: var(--map-shell);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--nb-radius-xl);
  box-shadow: var(--nb-shadow-md);
  padding: 8px;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.map-host {
  width: 100%;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.28), transparent 42%),
    linear-gradient(180deg, #9fd8f5 0%, #6eb8e8 100%);
  border-radius: 16px;
  padding: 4px;
}

.brazil-map,
.map-host > svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(78vh, 700px);
  overflow: visible;
}

.brazil-map .state,
.map-host .state {
  fill: var(--map-land);
  stroke: var(--map-land-stroke);
  stroke-width: 1.05;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill 160ms ease, stroke 160ms ease, filter 160ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.brazil-map .state[data-tone="2"],
.map-host .state[data-tone="2"] { fill: var(--map-land-2); }
.brazil-map .state[data-tone="3"],
.map-host .state[data-tone="3"] { fill: var(--map-land-3); }
.brazil-map .state[data-tone="4"],
.map-host .state[data-tone="4"] { fill: var(--map-land-4); }

.brazil-map .state:hover,
.map-host .state:hover {
  fill: #ffc51a;
  stroke: #fff;
  stroke-width: 1.5;
  filter: drop-shadow(0 4px 10px rgba(10, 40, 80, 0.28));
}

/* box-shadow em <path> vira retângulo do getBBox — nunca usar no mapa */
.brazil-map .state:focus,
.brazil-map .state:focus-visible,
.map-host .state:focus,
.map-host .state:focus-visible {
  outline: none;
  box-shadow: none;
  stroke: #fff;
  stroke-width: 2;
  filter: drop-shadow(0 0 8px rgba(10, 104, 255, 0.55));
}

.brazil-map .state.is-hint,
.map-host .state.is-hint {
  fill: #5aa8ff;
  stroke: #fff;
}

.brazil-map .state.is-correct,
.map-host .state.is-correct {
  fill: #1BAF72 !important;
  stroke: #0d6b45 !important;
  stroke-width: 1.7;
}

.brazil-map .state.is-wrong,
.map-host .state.is-wrong {
  fill: #ff5b67 !important;
  stroke: #8f1f2c !important;
  stroke-width: 1.7;
}

.brazil-map .state.is-reveal,
.map-host .state.is-reveal {
  filter: drop-shadow(0 0 12px rgba(27, 175, 114, 0.65));
}

.brazil-map .state.is-pulse,
.map-host .state.is-pulse {
  animation: statePulse 720ms ease;
}

@keyframes statePulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.map-pin {
  fill: #ffc51a;
  stroke: #0b2a4a;
  stroke-width: 0.6;
  cursor: pointer;
}

.uf-label {
  fill: #0b2a4a;
  font-size: 11px;
  font-weight: 800;
  font-family: Aptos, "Segoe UI", sans-serif;
  paint-order: stroke fill;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linejoin: round;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  outline: none;
  box-shadow: none;
}

.uf-labels {
  pointer-events: none;
  outline: none;
  box-shadow: none;
}

.map-host.show-labels .uf-label,
.brazil-map.show-labels .uf-label,
svg.show-labels .uf-label {
  opacity: 1;
  visibility: visible;
}

#mapSvg {
  width: 100%;
  height: auto;
  display: block;
  touch-action: none;
  cursor: crosshair;
  border-radius: var(--nb-radius-lg);
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.45), transparent 40%),
    var(--map-water);
}

#mapSvg .brasil-land {
  fill: var(--map-land);
  stroke: var(--map-land-stroke);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

#mapSvg .uf-line {
  fill: none;
  stroke: var(--map-uf);
  stroke-width: 0.8;
  pointer-events: none;
}

#mapSvg .uf-hint {
  fill: rgba(10, 104, 255, 0.22);
  stroke: var(--nb-blue);
  stroke-width: 1.5;
  pointer-events: none;
}

#mapSvg .pin {
  pointer-events: none;
}

#mapSvg .link-line {
  stroke: var(--line-link);
  stroke-width: 2;
  stroke-dasharray: 6 5;
  fill: none;
  pointer-events: none;
}

.side-panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--nb-border);
  border-radius: var(--nb-radius-xl);
  padding: 10px;
  box-shadow: var(--nb-shadow-sm);
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 0;
}

.feedback-slot {
  min-height: 132px;
  height: 132px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--nb-border);
  background: #f7fbff;
  padding: 10px 12px;
  display: grid;
  align-content: start;
}

.feedback-idle p,
.feedback-card p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feedback-card b {
  font-size: 1rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message {
  background: linear-gradient(135deg, #eefaf6, #f4f2ff);
  border: 1px solid #dcebe6;
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--nb-success);
  line-height: 1.35;
  min-height: 44px;
  max-height: 44px;
  overflow: hidden;
}

.legend-mode-tag {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--nb-blue-700);
  text-align: center;
  letter-spacing: 0.02em;
}

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.control-btn {
  border: 1px solid var(--nb-border);
  background: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
}

.legend-choice-grid {
  display: grid;
  gap: 10px;
  margin: 14px 0 8px;
}

.legend-modal .choice {
  min-height: 78px;
}

.side-panel h3 { margin: 0; font-size: 1rem; }
.side-panel p {
  margin: 0;
  color: var(--nb-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.feedback-idle strong {
  display: block;
  margin-bottom: 4px;
  color: var(--nb-blue-700);
}

.feedback-card {
  display: grid;
  gap: 4px;
}

.feedback-badge {
  display: inline-flex;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.feedback-card.is-ok .feedback-badge {
  background: var(--nb-success-bg);
  color: var(--nb-success);
}

.feedback-card.is-bad .feedback-badge {
  background: var(--nb-error-bg);
  color: var(--nb-error);
}

.feedback-card.is-ok {
  color: var(--nb-success);
}

.feedback-card.is-bad {
  color: var(--nb-error);
}

.feedback-pts {
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--nb-text);
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 520px) {
  .share-actions {
    grid-template-columns: 1fr 1fr;
  }
  .share-actions .primary {
    grid-column: 1 / -1;
  }
}

.share-hint {
  margin: 0 0 10px !important;
  font-weight: 700;
  color: var(--nb-blue-700) !important;
}

.control-btn.primary {
  background: linear-gradient(135deg, var(--nb-turquoise), var(--nb-blue));
  border: 0;
  color: #fff;
}

.control-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 25, 87, 0.48);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
}

.overlay.is-hidden { display: none !important; }

.modal {
  width: min(100%, 520px);
  background: #fff;
  border-radius: var(--nb-radius-xl);
  padding: 24px;
  text-align: center;
  box-shadow: var(--nb-shadow-lg);
  border: 1px solid var(--nb-border);
}

.modal.result-modal {
  width: min(100%, 640px);
  max-height: min(94vh, 920px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 18px 22px;
}

.modal h2 {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2.1rem);
}

.modal > p {
  margin: 0 0 14px;
  color: var(--nb-muted);
  line-height: 1.5;
}

.stars-row {
  font-size: 1.8rem;
  letter-spacing: 0.12em;
  color: var(--nb-yellow);
  margin: 6px 0 12px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

@media (min-width: 560px) {
  .result-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.result-box {
  border: 1px solid var(--nb-border);
  border-radius: 14px;
  padding: 10px;
}

.result-box span {
  display: block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nb-muted);
}

.result-box b {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-actions button {
  flex: 1 1 140px;
  border-radius: 14px;
  padding: 12px;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid var(--nb-border);
  background: #fff;
}

.modal-actions .primary {
  background: linear-gradient(135deg, var(--nb-turquoise), var(--nb-blue));
  border: 0;
  color: #fff;
}

.modal.tutorial { text-align: left; }
.modal.tutorial ol { margin: 0 0 12px; padding-left: 1.2rem; color: var(--nb-text-2); }
.modal.tutorial li { margin-bottom: 6px; }

.splash {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #0b2a4a;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.splash.is-leaving {
  animation: splashOut 0.28s ease forwards;
  pointer-events: none;
}

.splash-picture,
.splash-art {
  width: 100%;
  height: 100%;
  display: block;
}

.splash-art {
  object-fit: contain;
  object-position: center;
}

@keyframes splashOut {
  to { opacity: 0; visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .splash.is-leaving {
    animation: none;
    opacity: 0;
    visibility: hidden;
  }
}

.seo-block {
  margin-top: 28px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--nb-border);
  border-radius: var(--nb-radius-lg);
  color: var(--nb-text-2);
  font-size: 0.92rem;
  line-height: 1.55;
}

.seo-block h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  color: var(--nb-text);
}

.seo-block h3 {
  margin: 16px 0 6px;
  font-size: 1rem;
}

@media (max-width: 900px) {
  .setup-grid,
  .map-layout { grid-template-columns: 1fr; }
  .map-layout.is-quiz { grid-template-columns: 1fr; }
  .quiz-options { grid-template-columns: 1fr; }

  .side-panel {
    position: static;
  }
  .brazil-map,
  .map-host > svg {
    max-height: min(58vh, 520px);
  }
  .modal.result-modal {
    width: min(100%, 560px);
  }
  .heatmap-host .heatmap-map,
  .heatmap-host svg {
    max-width: 100%;
    max-height: min(48vh, 420px) !important;
  }
}

@media (max-width: 640px) {
  .app { padding: 8px 8px 24px; }
  .mode-grid { grid-template-columns: 1fr; }
  .diff-grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats--wide { grid-template-columns: repeat(3, 1fr); }
  .progress-row { grid-template-columns: 1fr; }
  .help-grid { grid-template-columns: 1fr 1fr; }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 18px; border-radius: 22px; }
  .overlay { padding: 10px; align-items: start; overflow-y: auto; }
  .game-header { margin-bottom: 8px; }
  .prompt-card { margin-bottom: 8px; padding: 12px; }
  .brazil-map,
  .map-host > svg {
    max-height: min(52vh, 420px);
  }
  .modal.result-modal {
    width: 100%;
    max-height: none;
    margin: 8px 0 16px;
    padding: 16px 14px 18px;
  }
  .heatmap-host {
    padding: 4px 0;
  }
  .heatmap-host .heatmap-map,
  .heatmap-host svg {
    max-height: min(42vh, 360px) !important;
  }
  .share-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}


/* ---- HUD sob a engrenagem ---- */
.game-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px calc(var(--nb-gs-safe, 60px) + 10px) 4px 4px;
  margin-top: 4px;
}
#gameScreen.is-active .game-top-row {
  padding-right: calc(var(--nb-gs-safe, 60px) + 6px);
}
#gameScreen.is-active .game-top-right {
  margin-right: 2px;
}
.game-top-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.hud-round-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 36px;
}
.hud-round-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--nb-ink, #0b2a4a);
}
.hud-round-label b { font-weight: 850; }
.hud-lives {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
  min-height: 22px;
}
.hud-lives .hud-heart {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: block;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.08));
}
.hud-lives .hud-heart.is-on {
  color: #e31837;
}
.hud-lives .hud-heart.is-off {
  color: #e31837;
  opacity: 0.22;
}
.hud-lives .hud-heart-extra {
  margin-left: 2px;
  font-size: 0.82rem;
  font-weight: 850;
  color: #e31837;
  letter-spacing: 0.02em;
}
.game-top-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}
.hud-score-line {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stat--score {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid var(--nb-border, #d7e0ef);
  background: #fff;
}
.stat--score span { font-size: 0.75rem; color: var(--nb-muted, #5b6478); }
.stat--score b { font-size: 1.1rem; }
.hint-fab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--nb-border, #d7e0ef);
  background: #fff7e8;
  cursor: pointer;
  font: inherit;
}
.hint-fab .hint-ico { font-size: 1.15rem; line-height: 1; }
.hint-fab .hint-count {
  font-weight: 850;
  font-size: 0.95rem;
  color: var(--nb-ink, #0b2a4a);
}
.hint-fab .hint-plus {
  position: absolute;
  top: -8px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  background: #1d44a2;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 850;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hint-fab .hint-plus.is-hidden { display: none !important; }

.quiz-pick-actions {
  display: grid;
  gap: 10px;
}
.quiz-pick-actions .secondary-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.quiz-pick-actions .secondary-btn b {
  font-weight: 850;
  color: var(--nb-blue, #1d44a2);
}

.choice--center {
  text-align: center;
  justify-content: center;
}
.choice--center b {
  width: 100%;
  text-align: center;
}

.legend-choice-grid .choice small { display: none; }

/* Pop-ups abaixo da linha da engrenagem */
.overlay {
  align-content: start;
  place-items: start center;
  padding: calc(var(--nb-gs-safe, 64px) + 12px) 16px 16px;
  overflow: auto;
}
.overlay .modal {
  margin-top: 0;
}

/* Siglas: escala com o mapa */
.uf-label {
  font-size: 10px;
  vector-effect: non-scaling-stroke;
}

@media (max-width: 720px) {
  .uf-label { font-size: 9px; }
  .game-top-row { padding-top: 2px; }
  .stats.stats--wide { display: none; }
}

.setup-grid {
  grid-template-columns: 1fr;
}
.setup-aside { display: none; }
.seo-block { display: none; }
