/* Missão Wi-Fi · RBT Internet ------------------------------------------- */
:root {
  --brand: #dc0000;
  --brand-dark: #a80000;
  --brand-soft: #ffe9e6;
  --ink: #1f1a17;
  --ink-2: #5b524c;
  --ink-3: #8c827a;
  --bg: #f7f2ec;
  --card: #ffffff;
  --line: #ebe2d8;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(60, 30, 10, .06), 0 8px 24px rgba(60, 30, 10, .08);
  --font: "Nunito", "Segoe UI Rounded", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 100% -10%, #ffe1dc 0, transparent 60%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.app { max-width: 1280px; margin: 0 auto; padding: 16px 20px 28px; }

/* Topo ----------------------------------------------------------------- */
.topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.brand img { width: 64px; height: auto; display: block; }
.title h1 { margin: 0; font-size: 28px; font-weight: 900; letter-spacing: -.5px; line-height: 1; }
.title p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.missions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.rank-btn { border: 0; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 900; font-size: 13px; padding: 9px 14px; box-shadow: var(--shadow); }
.rank-btn:hover { background: #3a302a; }
.mission-chip {
  display: flex; align-items: center; gap: 6px;
  border: 2px solid var(--line); background: var(--card); color: var(--ink);
  padding: 7px 12px; border-radius: 999px; font-weight: 800; font-size: 13px;
  transition: transform .15s, border-color .15s, background .15s;
}
.mission-chip:hover { transform: translateY(-1px); border-color: #e4b8b1; }
.mission-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.mission-chip .done { font-size: 12px; }

/* Layout --------------------------------------------------------------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.stage-card, .panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.stage-card { padding: 14px; }
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 4px 10px; }
.mission-goal { font-weight: 700; font-size: 15px; color: var(--ink-2); }
.mission-goal b { color: var(--ink); }
.devices { display: flex; gap: 6px; flex-shrink: 0; }
.device-pill {
  display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800;
  padding: 5px 10px; border-radius: 999px; background: #f4eee8; color: var(--ink-2);
}
.device-pill.placed { background: #e6f6ec; color: #116b33; }
.device-pill.next { background: var(--brand-soft); color: var(--brand-dark); outline: 2px dashed #f2a69c; }

/* Seletor de casas ---------------------------------------------------- */
.houses { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 12px; }
.house-chip {
  display: flex; align-items: center; gap: 8px; text-align: left;
  border: 2px solid var(--line); background: #fbf8f5; color: var(--ink);
  padding: 8px 12px; border-radius: 14px; font-weight: 800; font-size: 14px;
  transition: border-color .15s, background .15s, transform .15s;
}
.house-chip:hover { border-color: #e4b8b1; transform: translateY(-1px); }
.house-chip .hi { font-size: 22px; }
.house-chip .hn { flex: 1; }
.house-chip .hp { letter-spacing: 1px; font-size: 14px; }
.house-chip .hp b { color: #f2a33a; }
.house-chip .hp i { font-style: normal; color: #ddd3c8; }
.house-chip.active { border-color: var(--brand); background: var(--brand-soft); }

/* Palco / maquete ------------------------------------------------------ */
.stage {
  position: relative; overflow: hidden; border-radius: 14px;
  background: radial-gradient(120% 90% at 50% 0%, #fdf8f2 0%, #f3e9de 60%, #eadccd 100%);
  aspect-ratio: 16 / 10.5;
  user-select: none; -webkit-user-select: none;
}
.layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#heat { pointer-events: none; opacity: .8; mix-blend-mode: multiply; }
#svgFloor { pointer-events: none; }
.iso-objects, .iso-labels, .iso-markers, .iso-waves { pointer-events: none; }

.room-hit { fill: transparent; cursor: pointer; transition: fill .2s; }
.room-hit:hover, .room-hit:focus { fill: rgba(220, 0, 0, .12); outline: none; }
.room-hit.focused, .room-hit.focused:hover { fill: transparent; cursor: default; }
.room-label rect { fill: rgba(255,255,255,.94); stroke: rgba(60,40,25,.12); stroke-width: .01; }
.room-label text { font-family: var(--font); font-weight: 800; fill: var(--ink); }
.room-label .score { font-weight: 900; }
.iso-labels { animation: fadeIn .4s ease both; }

.rise { animation: rise .55s cubic-bezier(.3, 1.3, .5, 1) both; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes rise { from { transform: scaleY(.15); opacity: .3; } to { transform: none; opacity: 1; } }

.wave { fill: none; stroke: var(--brand); pointer-events: none; }

.device-marker { filter: drop-shadow(0 .02px .05px rgba(0,0,0,.4)); }
.drop-in { animation: dropIn .55s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes dropIn { 0% { opacity: 0; } 100% { opacity: 1; } }

.spot { cursor: pointer; color: var(--brand); }
.spot .spot-shadow { fill: rgba(0,0,0,.18); }
.spot .spot-pole { stroke: var(--brand); opacity: .6; }
.spot .halo { fill: var(--brand); opacity: .25; animation: halo 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes halo { 0%, 100% { transform: scale(.8); opacity: .35; } 50% { transform: scale(1.3); opacity: .1; } }
.spot .dot { fill: #fff; stroke: var(--brand); transition: fill .2s; }
.spot .glyph-dot { fill: var(--brand); }
.spot:hover .dot, .spot:focus .dot { fill: var(--brand-soft); }
.spot.selected .dot { fill: var(--brand); }
.spot.selected .glyph { color: #fff; }
.spot.selected .glyph-dot { fill: #fff; }
.spot.selected .halo { opacity: .5; }
.spot:focus { outline: none; }
.spot-tag { display: none; pointer-events: none; }
.spot:hover .spot-tag, .spot:focus .spot-tag, .spot.selected .spot-tag { display: inline; }
.spot-label { font-family: var(--font); font-weight: 800; fill: var(--ink); }
.spot-label-bg { fill: rgba(255,255,255,.97); stroke: rgba(60,40,25,.18); stroke-width: .01; }

/* Barra do cômodo (sobre a maquete) */
.roombar {
  position: absolute; left: 12px; right: 12px; bottom: 12px;
  display: flex; align-items: center; gap: 12px; padding: 8px 10px;
  background: rgba(255,255,255,.96); border-radius: 14px; box-shadow: var(--shadow);
  animation: slideUp .35s cubic-bezier(.3, 1.3, .5, 1) both;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.roombar-info { flex: 1; min-width: 0; line-height: 1.2; }
.roombar-info b { display: block; font-size: 15px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roombar-info small { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 700; }
.roombar .btn { padding: 10px 14px; font-size: 14px; white-space: nowrap; }

/* Lista de pontos no painel */
.spot-list { display: grid; gap: 6px; margin: 10px 0; }
.spot-item {
  display: flex; align-items: center; gap: 10px; text-align: left; width: 100%;
  border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 10px;
  font-weight: 800; font-size: 14px; color: var(--ink); transition: border-color .15s, background .15s;
}
.spot-item:hover { border-color: #e4b8b1; }
.spot-item.active { border-color: var(--brand); background: var(--brand-soft); }
.spot-item:disabled { opacity: .45; cursor: not-allowed; }
.spot-item .k { font-size: 16px; }
.spot-item small { display: block; font-size: 12px; color: var(--ink-3); font-weight: 700; }
.house-intro { font-size: 13px; color: var(--ink-2); background: #faf6f2; border-radius: 10px; padding: 8px 10px; margin-bottom: 12px; line-height: 1.4; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Toast ---------------------------------------------------------------- */
.toast {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-weight: 800; font-size: 14px;
  padding: 10px 16px; border-radius: 999px; box-shadow: var(--shadow); white-space: nowrap;
  animation: fadeIn .25s ease both;
}

/* Legenda -------------------------------------------------------------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 4px 0; font-size: 12.5px; color: var(--ink-2); font-weight: 700; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.legend em { font-style: normal; font-weight: 600; color: var(--ink-3); }
.disclaimer { margin: 8px 4px 0; font-size: 11.5px; color: var(--ink-3); }

/* Painel lateral ------------------------------------------------------- */
.panel { padding: 18px; position: sticky; top: 12px; }
.panel h3 { margin: 0 0 6px; font-size: 20px; font-weight: 900; letter-spacing: -.2px; }
.panel p { margin: 0 0 10px; color: var(--ink-2); font-size: 14.5px; line-height: 1.45; }
.panel .lead { font-size: 15px; }
.steps { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); font-weight: 600; line-height: 1.35; }
.steps .n {
  flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 900; font-size: 13px;
}
.selected-spot { background: #faf6f2; border: 2px solid var(--line); border-radius: 14px; padding: 12px; margin: 10px 0; }
.selected-spot .what { font-size: 17px; font-weight: 900; margin: 2px 0 4px; }
.selected-spot .desc { font-size: 14px; color: var(--ink-2); margin: 0; font-style: italic; }
.selected-spot .height { font-size: 12.5px; font-weight: 800; color: var(--ink-2); margin-top: 6px; }

.btn {
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 900; font-size: 15px;
  background: var(--brand); color: #fff; box-shadow: 0 3px 0 var(--brand-dark);
  transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { background: #ea1a1a; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--brand-dark); }
.btn.secondary { background: #fff; color: var(--ink); box-shadow: 0 3px 0 #d9cfc5; border: 2px solid var(--line); }
.btn.secondary:hover { background: #fbf7f3; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: none; padding: 8px 10px; font-size: 14px; }
.btn.ghost:hover { background: #f4eee8; }
.btn.block { width: 100%; }
.btn-row { display: grid; gap: 8px; margin-top: 12px; }

/* Resultado */
.result-top { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.score-ring { position: relative; width: 96px; height: 96px; flex-shrink: 0; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 30px; }
.score-ring .num small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 800; margin-top: -6px; text-align: center; }
.stars { font-size: 24px; letter-spacing: 2px; }
.stars .off { filter: grayscale(1); opacity: .25; }
.verdict { font-size: 19px; font-weight: 900; margin: 2px 0 0; line-height: 1.15; }
.mission-status { border-radius: 12px; padding: 10px 12px; font-weight: 800; font-size: 14px; margin: 8px 0 12px; }
.mission-status.ok { background: #e6f6ec; color: #0f5f2c; }
.mission-status.no { background: #fff4e0; color: #8a4b00; }

.tips { list-style: none; margin: 6px 0 12px; padding: 0; display: grid; gap: 8px; }
.tips li { display: flex; gap: 8px; font-size: 13.8px; line-height: 1.4; color: var(--ink-2); font-weight: 600; }
.tips .ic { flex: 0 0 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 900; color: #fff; }
.tips .good .ic { background: var(--good); }
.tips .warn .ic { background: var(--warn); }
.tips .bad .ic { background: var(--bad); }

.section-title { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-3); margin: 14px 0 6px; }
.room-bars { display: grid; gap: 6px; }
.room-bar { display: grid; grid-template-columns: 22px 1fr 44px; gap: 8px; align-items: center; font-size: 13px; font-weight: 700; }
.room-bar .name { grid-column: 2; font-size: 12.5px; color: var(--ink-2); margin-bottom: -4px; }
.room-bar .track { grid-column: 2; height: 9px; border-radius: 99px; background: #f1ebe5; overflow: hidden; }
.room-bar .fill { height: 100%; border-radius: 99px; width: 0; transition: width .9s cubic-bezier(.3, .9, .3, 1); }
.room-bar .emo { grid-row: span 2; font-size: 16px; }
.room-bar .pct { grid-row: span 2; text-align: right; font-weight: 900; }

.cta {
  margin-top: 16px; border-radius: 14px; padding: 14px; color: #fff;
  background: linear-gradient(135deg, var(--brand), #ff4d2e);
}
.cta b { display: block; font-size: 16px; font-weight: 900; margin-bottom: 4px; }
.cta p { color: #fff; opacity: .95; margin: 0 0 10px; font-size: 13.5px; }
.cta a { display: inline-block; background: #fff; color: var(--brand); font-weight: 900; text-decoration: none; padding: 8px 14px; border-radius: 10px; font-size: 14px; }

/* Confete -------------------------------------------------------------- */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* Responsivo ----------------------------------------------------------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; }
  .missions { margin-left: 0; width: 100%; }
}
@media (max-width: 560px) {
  .app { padding: 10px 10px 20px; }
  .brand img { width: 48px; }
  .title h1 { font-size: 22px; }
  .title p { font-size: 13px; }
  .missions { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .mission-chip { flex-shrink: 0; }
  .stage-card { padding: 8px; }
  .stage-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .mission-goal { font-size: 13.5px; }
  .toast { font-size: 12.5px; white-space: normal; text-align: center; width: 90%; border-radius: 14px; }
}
@media (max-width: 640px) {
  .stage { aspect-ratio: 4 / 3.3; }
  .stage.room-open { aspect-ratio: 1 / 1.05; }
  .houses { gap: 6px; }
  .house-chip { flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 6px 4px; font-size: 12.5px; }
  .house-chip .hi { font-size: 20px; }
  .roombar { left: 6px; right: 6px; bottom: 6px; flex-wrap: wrap; gap: 6px; }
  .roombar .btn.ghost { padding: 6px 8px; }
  .roombar #btnInstall { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Andares --------------------------------------------------------------- */
.levels { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.level-btn { border: 2px solid var(--line); background: rgba(255,255,255,.95); border-radius: 12px; padding: 7px 10px; font-weight: 900; font-size: 13px; color: var(--ink); text-align: left; box-shadow: var(--shadow); }
.level-btn.active { border-color: var(--brand); background: var(--brand-soft); }
.level-btn .lv-dev { font-size: 11px; }
.bars-level { font-size: 12px; font-weight: 900; color: var(--ink-2); margin: 6px 0 0; }
.lv-note { font-size: 13px; background: #faf6f2; border-radius: 10px; padding: 8px 10px; }

/* Segmentados ----------------------------------------------------------- */
.seg { display: flex; background: #f4eee8; border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 8px; padding: 6px 8px; font-weight: 800; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.roombar .seg.via { flex: 0 0 auto; }
.mini-label { display: block; font-size: 12px; font-weight: 900; color: var(--ink-3); text-transform: uppercase; letter-spacing: .4px; margin: 10px 0 6px; }
.via-hint { font-size: 12.5px !important; margin: 6px 0 10px !important; }

/* Laboratório (modo livre) ---------------------------------------------- */
#svgTop.lab { touch-action: none; }
.iso-markers .lab-handle { pointer-events: all; cursor: grab; }
#svgTop.dragging, #svgTop.dragging .lab-handle { cursor: grabbing; }
.lab-handle .grab { fill: rgba(220,0,0,.08); stroke: rgba(220,0,0,.35); stroke-width: .03; stroke-dasharray: .12 .08; }
.lab-handle.active .grab { fill: rgba(220,0,0,.16); stroke: var(--brand); animation: halo 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.lab-hint { font-size: 13.5px !important; }
.lab-live { display: flex; align-items: center; gap: 14px; margin: 6px 0 10px; }
.score-ring.live { width: 82px; height: 82px; }
.score-ring.live .num { font-size: 26px; }
.ring-fill { transition: stroke-dashoffset .6s cubic-bezier(.3,.9,.3,1), stroke .3s; }
.score-ring.live .ring-fill { transition: stroke-dashoffset .15s linear, stroke .2s; }
.lab-devices { display: grid; gap: 8px; margin-bottom: 10px; }
.lab-dev { border: 2px solid var(--line); border-radius: 14px; padding: 10px; display: grid; gap: 4px; }
.lab-dev.active { border-color: var(--brand); background: #fffaf9; }
.lab-dev label { font-size: 11px; font-weight: 900; color: var(--ink-3); text-transform: uppercase; letter-spacing: .4px; margin-top: 4px; }
.lab-dev-head { display: flex; align-items: center; justify-content: space-between; }
.lab-pick { border: 0; background: none; font-size: 14px; padding: 0; color: var(--ink); text-align: left; }
.lab-del { border: 0; background: #f4eee8; border-radius: 8px; width: 28px; height: 28px; font-weight: 900; color: var(--ink-2); }
.lab-del:hover { background: #fde2df; color: var(--brand); }

/* Legenda: cabo */
.legend i.cable { background: linear-gradient(#334155, #334155) center/100% 4px no-repeat; border-radius: 0; }

/* Ranking -------------------------------------------------------------- */
.modal { position: fixed; inset: 0; background: rgba(30, 15, 5, .45); display: grid; place-items: center; z-index: 60; padding: 16px; animation: fadeIn .2s ease both; }
.modal-card { width: min(480px, 100%); max-height: 92vh; overflow: auto; background: #fff; border-radius: 20px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: slideUp .3s cubic-bezier(.3, 1.3, .5, 1) both; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h3 { margin: 0; font-size: 20px; font-weight: 900; }
.rank-me { display: flex; gap: 14px; align-items: center; background: var(--brand-soft); border-radius: 14px; padding: 12px 14px; font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.rank-me .big { font-size: 30px; font-weight: 900; color: var(--brand); white-space: nowrap; }
.rank-me .big small { font-size: 14px; }
.rank-me small { color: var(--ink-3); font-weight: 600; }
.rank-form { display: flex; gap: 8px; margin: 12px 0 4px; }
.rank-form input { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; font-weight: 700; }
.rank-form input:focus { outline: none; border-color: var(--brand); }
.rank-msg { min-height: 20px; margin: 4px 0; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.rank-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.rank-list li { display: grid; grid-template-columns: 34px 1fr auto 70px; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: #faf6f2; font-weight: 800; font-size: 14px; }
.rank-list li.me { background: #e6f6ec; outline: 2px solid #86d19f; }
.rank-list .pos { font-size: 16px; text-align: center; }
.rank-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .ms { font-size: 12px; color: var(--ink-3); }
.rank-list .sc { text-align: right; font-weight: 900; color: var(--brand); }
.rank-empty { font-size: 14px; color: var(--ink-3); font-weight: 700; }
.rank-src { font-size: 11.5px; color: var(--ink-3); margin: 10px 0 0; }

@media (max-width: 980px) { .houses { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 640px) {
  .houses { grid-template-columns: repeat(2, 1fr); }
  .rank-btn { width: 100%; }
  .levels { top: 6px; left: 6px; }
  .level-btn { padding: 5px 8px; font-size: 12px; }
  .roombar .seg.via { order: 3; width: 100%; }
}

/* Modo livre: pontos de encaixe, lupa, chips --------------------------- */
.iso-markers .lab-dot { pointer-events: all; cursor: pointer; }
.lab-dot .hit { fill: transparent; }
.lab-dot .dot { fill: rgba(255,255,255,.9); stroke: var(--brand); opacity: .75; transition: opacity .15s; }
.lab-dot:hover .dot { opacity: 1; fill: var(--brand-soft); }
.lab-dot.cand .dot { fill: var(--brand); opacity: 1; animation: halo 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
#svgTop.dragging .lab-dot .dot { opacity: 1; }
.snap-ring { fill: rgba(220,0,0,.15); stroke: var(--brand); animation: halo 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.device-marker.lifted { filter: drop-shadow(0 .1px .2px rgba(0,0,0,.45)); }
.iso-lupas .lupa { cursor: pointer; }
.lupa .hit { fill: transparent; }
.lupa .bg { fill: #fff; stroke: var(--brand); }
.lupa .glass { stroke: var(--brand); }
.lupa:hover .bg, .lupa:focus .bg { fill: var(--brand); }
.lupa:hover .glass, .lupa:focus .glass { stroke: #fff; }
.lupa:focus { outline: none; }
.nb-label rect { fill: rgba(255,255,255,.9); }
.lab-where { display: block; width: 100%; text-align: left; border: 0; background: #faf6f2; border-radius: 10px; padding: 8px 10px; font-size: 14px; color: var(--ink); line-height: 1.25; }
.lab-where:hover { background: var(--brand-soft); }
.lab-where small { display: block; font-size: 12px; color: var(--ink-3); font-weight: 700; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0; }
.chip { font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 3px 8px; background: #f4eee8; color: var(--ink-2); }
.chip.ok { background: #e6f6ec; color: #116b33; }
.chip.mid { background: #fff4e0; color: #8a4b00; }
.chip.bad { background: #fde2df; color: #9f1d1d; }

/* Toque (totem / celular): alvos maiores */
@media (pointer: coarse) {
  .seg button { padding: 10px 8px; font-size: 13.5px; }
  .level-btn { padding: 10px 12px; font-size: 14px; }
  .spot-item { padding: 12px 12px; }
  .lab-del { width: 38px; height: 38px; }
  .roombar .btn { padding: 12px 16px; }
  .mission-chip { padding: 10px 14px; }
}

/* Celular: cabeçalho compacto para a maquete aparecer logo */
@media (max-width: 640px) {
  .topbar { gap: 8px 10px; margin-bottom: 8px; }
  .brand img { width: 40px; }
  .title h1 { font-size: 20px; }
  .title p { display: none; }
  .rank-btn { width: auto; margin-left: auto; padding: 7px 12px; font-size: 12.5px; }
  .missions { order: 3; width: 100%; gap: 6px; }
  .mission-chip { padding: 6px 10px; font-size: 12.5px; }
  .houses { grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 8px; }
  .house-chip { padding: 5px 2px; font-size: 11px; gap: 0; border-radius: 10px; }
  .house-chip .hi { font-size: 18px; }
  .house-chip .hp { font-size: 10px; }
  .stage-head { margin: 0 2px 8px; }
  .mission-goal { font-size: 13px; }
  .legend { gap: 4px 10px; font-size: 12px; }
  .legend em { display: none; }
}

/* Onde ficou cada aparelho */
.where-list { display: grid; gap: 6px; }
.where-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 10px; font-size: 13.5px; color: var(--ink); }
.where-item:hover { border-color: #e4b8b1; background: #fffaf9; }
.where-item .wi { font-size: 18px; }
.where-item .wt { flex: 1; line-height: 1.3; }
.where-item small { display: block; color: var(--ink-3); font-weight: 700; font-size: 12px; }
.where-item .wgo { font-size: 15px; opacity: .6; }
.tips .who { display: inline-block; background: #f4eee8; color: var(--ink); border-radius: 6px; padding: 0 6px; margin-right: 2px; font-size: 12px; font-weight: 900; }
.dev-tag rect { fill: var(--ink); }
.dev-tag path { fill: var(--ink); }
.dev-tag text { fill: #fff; font-family: var(--font); }
.device-marker.flash { animation: flash 1.2s ease 2; }
@keyframes flash { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* Botões de andar mais discretos */
.levels { gap: 4px; }
.level-btn { padding: 4px 9px; font-size: 12px; border-width: 1.5px; border-radius: 9px; }
.level-btn .lv-dev { font-size: 9px; color: var(--brand); letter-spacing: 1px; }
@media (pointer: coarse) { .level-btn { padding: 6px 10px; font-size: 13px; } }
@media (max-width: 640px) { .level-btn { padding: 4px 8px; font-size: 11.5px; } }

/* Ranking por etapa ----------------------------------------------------- */
.rank-missions { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; }
.rank-missions li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 10px; background: #faf6f2; font-size: 13.5px; font-weight: 700; }
.rank-missions li.ok { background: #e6f6ec; }
.rank-missions li.skip { color: var(--ink-3); }
.rank-missions b { font-weight: 900; white-space: nowrap; }
.rank-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.rank-tabs button { flex-shrink: 0; border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 11px; font-weight: 800; font-size: 12.5px; color: var(--ink); }
.rank-tabs button.on { border-color: var(--brand); background: var(--brand-soft); }
.rank-ok { background: #e6f6ec; color: #0f5f2c; border-radius: 12px; padding: 10px 12px; font-weight: 800; font-size: 14px; margin-bottom: 8px; }
.rank-ok.warn { background: #fff4e0; color: #8a4b00; }
.rank-list.mine { margin-top: 6px; border-top: 2px dashed var(--line); padding-top: 6px; }
.rank-list small { color: var(--ink-3); font-weight: 700; }
@media (pointer: coarse) { .rank-tabs button { padding: 9px 13px; font-size: 13.5px; } .rank-form input { padding: 13px 14px; font-size: 16px; } }

/* Chamada final, compartilhar e "Tenho interesse" ------------------------- */
.rank-btn.share { background: #fff; color: var(--ink); border: 2px solid var(--line); margin-left: 0; }
.rank-btn.share:hover { background: #fbf7f3; }
.missions + .rank-btn.share { margin-left: 0; }
.cta-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cta .cta-btn { display: inline-block; border: 0; background: #fff; color: var(--brand); font-weight: 900; text-decoration: none; padding: 9px 14px; border-radius: 10px; font-size: 14px; cursor: pointer; }
.cta .cta-btn.ghost { background: rgba(255,255,255,.18); color: #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.7); }
.modal-lead { font-size: 14.5px; color: var(--ink-2); margin: 0 0 12px; line-height: 1.45; }
.share-link { display: flex; gap: 8px; margin-bottom: 10px; }
.share-link input { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 13px; color: var(--ink-2); background: #faf6f2; }
.share-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.share-btns .btn { text-align: center; text-decoration: none; }
.btn.wa { background: #16a34a; box-shadow: 0 3px 0 #0f7a35; }
.btn.wa:hover { background: #15803d; }
.share-cta { background: #f3f0ff; border-radius: 14px; padding: 12px; margin: 12px 0 0; font-size: 13.5px; color: #4c3a8f; display: grid; gap: 8px; }
.share-cta b { color: #3b2a7a; }
.lead-form { display: grid; gap: 10px; }
.lead-form label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 800; color: var(--ink-2); }
.lead-form input, .lead-form select, .lead-form textarea { border: 2px solid var(--line); border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 15px; font-weight: 600; color: var(--ink); background: #fff; width: 100%; }
.lead-form input:focus, .lead-form select:focus, .lead-form textarea:focus { outline: none; border-color: var(--brand); }
.lead-form .lf-row { display: flex; gap: 8px; }
.lead-form .lf-row > label { flex: 1; min-width: 0; }
.lead-form .lf-row > .grow { flex: 3; }
.lead-form .lf-row > .small { flex: 1; }
.lead-form .chk { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; font-size: 12.5px; line-height: 1.35; }
.lead-form .chk input { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; accent-color: var(--brand); }
.lead-form .chk a { color: var(--brand); }
@media (pointer: coarse) { .lead-form input, .lead-form select { padding: 12px; font-size: 16px; } }
@media (max-width: 640px) { .rank-btn.share { padding: 7px 10px; font-size: 12px; } }
.top-actions { display: flex; gap: 8px; flex-shrink: 0; }
.top-actions .rank-btn { margin-left: 0; }
.missions { margin-left: auto; }
@media (max-width: 1500px) { .rank-btn.share { font-size: 0; padding: 9px 12px; } .rank-btn.share::before { content: "📣"; font-size: 14px; } }
@media (max-width: 640px) {
  .top-actions { margin-left: auto; }
  .top-actions .rank-btn { width: auto; }
  .rank-btn.share { font-size: 0; padding: 7px 10px; }
}

/* Seletor de idioma (bandeiras) */
.lang { display: flex; gap: 4px; align-items: center; background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 4px 6px; }
.lang button { border: 0; background: none; padding: 2px; border-radius: 6px; line-height: 0; cursor: pointer; opacity: .45; filter: grayscale(.6); transition: opacity .15s, filter .15s, transform .15s; }
.lang button:hover { opacity: .85; filter: none; }
.lang button.on { opacity: 1; filter: none; box-shadow: 0 0 0 2px var(--brand); }
.lang svg { width: 24px; height: 16px; border-radius: 3px; display: block; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
@media (pointer: coarse) { .lang button { padding: 4px; } .lang svg { width: 28px; height: 19px; } }
@media (max-width: 640px) { .lang { padding: 3px 4px; } .lang svg { width: 22px; height: 15px; } }
.top-actions { margin-left: auto; }
.lang button { filter: none; opacity: .5; }

.disclaimer a { color: inherit; text-decoration: underline; }

/* ===== Lote 31/10: objetivo em destaque, botões da maquete, pinça, modais ===== */

/* Objetivo da missão: cartão de destaque acima da maquete */
.stage-head { flex-wrap: wrap; align-items: stretch; }
.mission-goal {
  flex: 1 1 320px; display: flex; gap: 12px; align-items: center;
  background: linear-gradient(135deg, #fff1ef, #ffe6e2); border: 2px solid #f6b9b0; border-left: 6px solid var(--brand);
  border-radius: 14px; padding: 10px 14px; color: var(--ink);
}
.mission-goal .mg-icon { font-size: 30px; line-height: 1; flex-shrink: 0; }
.mission-goal .mg-body { display: grid; gap: 1px; min-width: 0; }
.mission-goal .mg-tag { font-size: 11.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .7px; color: var(--brand); }
.mission-goal .mg-title { font-size: 19px; font-weight: 900; line-height: 1.15; }
.mission-goal .mg-text { font-size: 15.5px; font-weight: 700; color: #3d332d; line-height: 1.35; }
.mission-goal.pop { animation: goalPop .7s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes goalPop { 0% { transform: scale(.96); box-shadow: 0 0 0 0 rgba(220,0,0,.45); } 60% { transform: scale(1.01); box-shadow: 0 0 0 10px rgba(220,0,0,0); } 100% { transform: none; } }
.stage-head .devices { align-self: center; flex-wrap: wrap; }
@media (max-width: 640px) {
  .mission-goal { padding: 9px 11px; gap: 9px; border-left-width: 5px; }
  .mission-goal .mg-icon { font-size: 24px; }
  .mission-goal .mg-title { font-size: 16.5px; }
  .mission-goal .mg-text { font-size: 14px; }
  .stage-head { gap: 6px; }
}

/* Botões sobre a maquete: Voltar (canto superior esquerdo) e Desfazer (superior direito) */
.stage { touch-action: pan-y; }
.stage-btn {
  position: absolute; top: 10px; z-index: 3; border: 2px solid var(--line); background: rgba(255,255,255,.97);
  color: var(--ink); font-weight: 900; font-size: 14px; border-radius: 12px; padding: 9px 14px; box-shadow: var(--shadow);
  animation: fadeIn .25s ease both;
}
.stage-btn:hover { background: #fff; border-color: #e4b8b1; }
.stage-btn.back { left: 10px; }
.stage-btn.undo { right: 10px; }
.stage.has-back .levels { top: 58px; }
@media (pointer: coarse) { .stage-btn { padding: 11px 16px; font-size: 15px; } .stage.has-back .levels { top: 64px; } }
@media (max-width: 640px) { .stage-btn { top: 6px; padding: 8px 12px; font-size: 13.5px; } .stage-btn.back { left: 6px; } .stage-btn.undo { right: 6px; } .stage.has-back .levels { top: 52px; } }

/* Barra do cômodo: informação à esquerda, confirmar à direita */
.roombar #btnInstall { margin-left: auto; }
.btn.wait { background: #c9bfb6; box-shadow: 0 3px 0 #a99d92; }
.btn.wait:hover { background: #bfb4aa; }
.seg.ask { outline: 2px dashed var(--brand); outline-offset: 2px; animation: askPulse 1.4s ease-in-out infinite; }
@keyframes askPulse { 50% { outline-color: rgba(220,0,0,.25); } }
.seg.nudge { animation: nudge .45s ease; }
@keyframes nudge { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.via-ask { font-size: 12.5px !important; font-weight: 800; color: var(--brand) !important; margin: 4px 0 0 !important; }
@media (max-width: 640px) {
  .roombar-info { flex: 1 1 100%; }
  .roombar .seg.via { order: 0; width: auto; flex: 1 1 auto; }
  .roombar #btnInstall { width: auto; flex: 1 1 auto; }
}

/* Pontos de instalação: área de toque maior que o desenho */
.spot .spot-hit { fill: transparent; }

/* Voltar no painel (canto superior esquerdo) */
.panel-back { border: 0; background: #f4eee8; color: var(--ink); font-weight: 900; font-size: 13.5px; border-radius: 10px; padding: 7px 12px; margin: -4px 0 10px; }
.panel-back:hover { background: var(--brand-soft); }

/* Ranking: confirmar embaixo, à direita */
.rank-form.stack { display: grid; gap: 6px; margin-top: 14px; }
.rank-form.stack .mini-label { margin: 0; }
.btn-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.btn-row.end { display: flex; justify-content: flex-end; }

/* Modo livre no topo, ao lado dos idiomas */
.lab-btn { border: 2px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; font-weight: 900; font-size: 13px; padding: 7px 13px; white-space: nowrap; }
.lab-btn:hover { border-color: #e4b8b1; }
.lab-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.top-actions { align-items: center; flex-wrap: wrap; }
@media (max-width: 640px) {
  .top-actions { order: 2; width: 100%; margin-left: 0; gap: 6px; }
  .top-actions .rank-btn:last-child { margin-left: auto; }
  .lab-btn { padding: 6px 11px; font-size: 12.5px; }
  .missions { order: 3; }
}
@media (pointer: coarse) { .lab-btn { padding: 9px 14px; } }

/* Política de privacidade em janela */
.modal-card.wide { width: min(760px, 100%); display: flex; flex-direction: column; max-height: 92vh; }
.priv-frame { width: 100%; flex: 1; min-height: 55vh; border: 0; border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); }
#privModal { z-index: 70; }
#privModal .btn-row { margin-top: 10px; }
@media (max-width: 640px) { #privModal { padding: 0; } #privModal .modal-card { border-radius: 0; max-height: 100vh; height: 100%; } .priv-frame { min-height: 0; } }
@media (max-width: 640px) {
  .stage-head .mission-goal { flex: none; width: 100%; }
  /* topo no celular: linha 1 = logo, título e ranking; linha 2 = modo livre, idiomas, desafiar */
  .topbar .title { flex: 1; min-width: 0; }
  .top-actions { display: contents; }
  .top-actions .rank-btn#rankBtn { order: 1; margin-left: auto; }
  .topbar::after { content: ""; order: 2; flex-basis: 100%; height: 0; }
  .lab-btn, .top-actions .lang, .top-actions .rank-btn.share { order: 3; }
  .missions { order: 4; }
}
/* com o cômodo aberto a barra ocupa o rodapé: o aviso sobe para o topo */
.stage.room-open .toast { bottom: auto; top: 58px; z-index: 4; }
@media (max-width: 640px) { .stage.room-open .toast { top: 50px; } }
