/* Cags: coluna de app de celular, visual claro e limpo, rosa como cor principal. */
:root {
  --bg: #F7F7FA; --surface: #FFFFFF; --surface-2: #F1F2F7;
  --ink: #17171F; --ink-2: #565A6B; --ink-3: #74788A; --line: #ECEDF3;
  --accent: #E02D6B; --accent-ink: #FFFFFF; --accent-soft: #FFE6EE;
  --gold: #F0AE00; --gold-soft: #FFF0C4; --gold-ink: #4A3500;
  --ok: #12805C; --bad: #C0262D;
  --map-land: #EDEEF5;
  --av-s: 62%; --av-l: 46%;
  --shadow: 0 1px 2px rgba(20,32,56,.06), 0 6px 18px rgba(20,32,56,.06);
  --font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F0F16; --surface: #1A1A24; --surface-2: #232330;
    --ink: #F2F2F7; --ink-2: #B4B6C6; --ink-3: #8C8FA3; --line: #2A2A38;
    --accent: #FF7AA8; --accent-ink: #1A0A12; --accent-soft: #3A1C2A;
    --gold: #FFC531; --gold-soft: #3A3014; --gold-ink: #FFE9A8;
    --ok: #4ADE9B; --bad: #FF8A8F;
    --map-land: #1D1D2A;
    --av-s: 70%; --av-l: 64%;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; text-wrap: balance; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.err { color: var(--bad); font-size: 14px; font-weight: 600; min-height: 0; }
.err:empty { display: none; }

/* ---------- topo ---------- */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); }
.top-in { max-width: 480px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 8px; }
.logo { font-size: 26px; line-height: 1; }
.word { font-family: var(--font-display); font-weight: 800; font-size: 26px; letter-spacing: -0.03em; line-height: 1; }
.group { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); background: var(--surface); border: 0; padding: 8px 14px; border-radius: 999px; min-width: 0; box-shadow: var(--shadow); max-width: 55%; }
.group span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- conteúdo ---------- */
main { max-width: 480px; margin: 0 auto; padding-block: 12px 128px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); }
.notice { font-size: 13px; color: var(--ink-2); background: var(--accent-soft); border-radius: 16px; padding: 9px 12px; }
.seg { display: flex; background: var(--surface); border-radius: 999px; padding: 4px; gap: 3px; box-shadow: var(--shadow); }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 999px; padding: 9px 10px; font-weight: 700; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.section-title { font-size: 20px; font-weight: 700; }
.section-sub { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.lbl, legend { font-weight: 700; font-size: 14px; padding: 0; margin-bottom: 8px; display: block; }

.btn { border: 0; border-radius: 999px; padding: 11px 18px; font-weight: 700; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn[disabled] { opacity: .6; cursor: progress; }
.field { width: 100%; min-width: 0; background: var(--surface-2); border: 1px solid transparent; border-radius: 14px; padding: 11px 14px; }
.field::placeholder { color: var(--ink-3); }

/* ---------- avatar com skin ---------- */
.av { width: var(--sz, 40px); height: var(--sz, 40px); flex: none; border-radius: 50%; display: inline-grid; place-items: center;
  background: hsl(var(--h) var(--av-s) var(--av-l)); position: relative; font-size: calc(var(--sz, 40px) * .6); line-height: 1; }
.av .poo { display: block; }
.av .acc { position: absolute; left: 50%; transform: translate(-50%, -50%); font-style: normal; line-height: 1; pointer-events: none; }
.av .acc-top { top: 17%; font-size: .62em; }
.av .acc-eyes { top: 50%; font-size: .7em; }
.av .acc-belly { top: 76%; font-size: .5em; }

/* ---------- entrada e grupos ---------- */
.auth { display: flex; flex-direction: column; gap: 16px; padding-top: 16px; }
.auth h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; }
.auth form, .box { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.row { display: flex; gap: 8px; }
.row .field { flex: 1; }
.glist { display: flex; flex-direction: column; gap: 10px; }
.gitem { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 0; text-align: left; width: 100%; }
.gitem b { font-family: var(--font-display); font-size: 18px; }
.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .12em; background: var(--surface-2); padding: 3px 10px; border-radius: 8px; }

/* ---------- feed ---------- */
.invite { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.invite .row { align-items: center; justify-content: space-between; }
.post { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.post-h { display: flex; gap: 10px; align-items: flex-start; }
.post-who { flex: 1; min-width: 0; }
.post-who .where { font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.post-who .where strong { color: var(--ink); font-weight: 600; }
.pts { flex: none; font-family: var(--font-display); font-weight: 800; font-size: 15px; background: var(--gold-soft); color: var(--gold-ink); padding: 3px 10px; border-radius: 999px; }
.post-m { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 14px; color: var(--ink-2); }
.stars { color: var(--gold); letter-spacing: 1px; font-size: 16px; }
.tag { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 6px; }
.quote { font-size: 15px; overflow-wrap: anywhere; }
.acts { display: flex; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.act { border: 0; background: transparent; border-radius: 8px; padding: 6px 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.act[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.comments { display: flex; flex-direction: column; gap: 8px; }
.cm { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.cm p { background: var(--surface-2); border-radius: 12px; padding: 6px 10px; min-width: 0; overflow-wrap: anywhere; }
.cm-form { display: flex; gap: 8px; }

/* ---------- mapa ---------- */
.map { position: relative; height: 340px; overflow: hidden; border-radius: 26px; background: var(--map-land); touch-action: none; cursor: grab; box-shadow: var(--shadow); isolation: isolate; }
.map.drag { cursor: grabbing; }
.map .pane { position: absolute; left: 0; top: 0; will-change: transform; }
.map img.t { position: absolute; width: 256px; height: 256px; max-width: none; user-select: none; -webkit-user-drag: none; }
.mk { position: absolute; width: 0; height: 0; }
.mk .fz { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  border: 1.5px dashed hsl(var(--h) var(--av-s) var(--av-l)); background: hsl(var(--h) var(--av-s) var(--av-l) / .18); }
.mk .pin { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); border: 0; padding: 3px; border-radius: 50%; background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,.3); display: grid; place-items: center; }
.mk.sel .pin { box-shadow: 0 0 0 3px var(--accent), 0 2px 8px rgba(0,0,0,.3); }
.mk .empty { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); font-weight: 800; }
.mk .lbl { position: absolute; left: 0; top: 24px; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 700; background: var(--surface); color: var(--ink); padding: 1px 8px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.2); pointer-events: none; margin: 0; }
.mk.sel { z-index: 2; }
.me-dot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #2B7BFF; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(43,123,255,.25); }
.map-ctl { position: absolute; right: 10px; top: 10px; z-index: 5; display: flex; flex-direction: column; gap: 6px; }
.map-ctl button { width: 38px; height: 38px; border: 0; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); font-size: 18px; font-weight: 800; }
.map-attr { position: absolute; right: 8px; bottom: 6px; z-index: 5; font-size: 10px; background: rgba(255,255,255,.85); color: #333; padding: 1px 6px; border-radius: 6px; }
.map-attr a { color: inherit; }
.map-empty { position: absolute; left: 12px; right: 60px; bottom: 12px; z-index: 5; font-size: 13px; background: var(--surface); padding: 8px 12px; border-radius: 12px; box-shadow: var(--shadow); }
.detail { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.detail-h { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.owner { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.owner b { color: var(--ink); }
.bars { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 70px 1fr 26px; align-items: center; gap: 8px; font-size: 13px; }
.bar-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: hsl(var(--h, 330) var(--av-s) var(--av-l)); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid transparent; background: var(--surface-2); border-radius: 999px; padding: 7px 12px; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.chip .av { --sz: 20px; }
.chip small { color: var(--ink-3); font-weight: 500; }

/* ---------- placar ---------- */
.hero { padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.hero .big { font-family: var(--font-display); font-weight: 800; font-size: 44px; line-height: 1; letter-spacing: -0.03em; }
.hero .big small { font-size: 16px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.rank li { display: grid; grid-template-columns: 28px 40px 1fr auto; gap: 10px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); }
.rank li:first-child { border-top: 0; }
.rank li.me { background: var(--accent-soft); }
.pos { font-family: var(--font-display); font-weight: 800; font-size: 18px; text-align: center; color: var(--ink-2); }
.pos.first { color: var(--gold); }
.rk-name { font-weight: 700; overflow-wrap: anywhere; }
.rk-sub { font-size: 12.5px; color: var(--ink-2); }
.rk-bar { height: 6px; background: var(--surface-2); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.rk-bar i { display: block; height: 100%; border-radius: 99px; background: hsl(var(--h) var(--av-s) var(--av-l)); }
.rk-pts { font-family: var(--font-display); font-weight: 800; font-size: 20px; text-align: right; }
.rk-pts small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 12px; color: var(--ink-2); }

/* ---------- perfil ---------- */
.me-head { display: flex; align-items: center; gap: 14px; padding: 16px; }
.me-head h2 { font-size: 24px; font-weight: 800; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 12px; }
.stat b { display: block; font-family: var(--font-display); font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat span { font-size: 12.5px; color: var(--ink-2); }
.skins { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.skin { padding: 14px 8px 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.skin .av { margin-bottom: 6px; }
.skin b { font-size: 13px; }
.skin small { font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.skin .btn { width: 100%; padding: 7px 4px; }
.skin.on { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.badges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.badge { padding: 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.medal { width: 52px; height: 58px; display: grid; place-items: center; clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%);
  background: var(--gold); color: var(--gold-ink); font-family: var(--font-display); font-weight: 800; font-size: 19px; }
.locked .medal { background: var(--surface-2); color: var(--ink-3); }
.badge h3 { font-size: 16px; font-weight: 700; }
.badge p { font-size: 13px; color: var(--ink-2); }
.prog { width: 100%; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.prog .bar { height: 6px; }
.prog .bar i { background: var(--accent); }
.done { font-size: 12px; font-weight: 700; color: var(--ok); }
.account { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

/* ---------- barra de abas ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); box-shadow: 0 -8px 28px rgba(23,23,31,.07); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabbar-in { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr 76px 1fr 1fr; align-items: end;
  padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
.tab { border: 0; background: transparent; padding: 10px 2px 9px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--ink-3); min-width: 0; }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--accent); }
.fab { justify-self: center; width: 62px; height: 62px; border-radius: 50%; border: 4px solid var(--surface); background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; margin-top: -24px; margin-bottom: 8px; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 45%, transparent); }
.fab span { font-size: 30px; line-height: 1; }

/* ---------- folha de registro ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; }
.scrim { position: absolute; inset: 0; background: rgba(8, 14, 28, .55); }
.panel { position: absolute; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; background: var(--surface); border-radius: 30px 30px 0 0; max-height: 92%; overflow-y: auto;
  padding-top: 10px; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 16px; }
.grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); align-self: center; }
.panel h2 { font-size: 24px; font-weight: 800; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.rate { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rate button { border: 0; background: var(--surface-2); border-radius: 14px; padding: 8px 0; font-weight: 700; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.rate button span { color: var(--gold); font-size: 16px; }
.rate button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.rate button[aria-pressed="true"] span { color: var(--accent-ink); }
.rate-label { font-size: 14px; color: var(--ink-2); min-height: 20px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.preview { background: var(--gold-soft); color: var(--gold-ink); border-radius: 14px; padding: 10px 12px; font-size: 14px; }
.preview b { font-family: var(--font-display); font-size: 20px; font-weight: 800; }
.actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.loc { display: flex; align-items: center; gap: 8px; border: 1px dashed var(--accent); background: var(--accent-soft); color: var(--ink); border-radius: 999px; padding: 10px 14px; font-weight: 700; width: 100%; justify-content: center; }
.loc svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.loc[disabled] { opacity: .7; cursor: progress; }
.loc-status { font-size: 13px; color: var(--ink-2); min-height: 18px; }

/* ---------- aviso ---------- */
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50; width: min(440px, calc(100% - 32px));
  background: var(--ink); color: var(--bg); border-radius: 16px; padding: 12px 16px; font-weight: 600; box-shadow: 0 10px 28px rgba(0,0,0,.28); display: flex; flex-direction: column; gap: 2px; }
.toast small { font-weight: 500; opacity: .85; font-size: 13px; }

@media (prefers-reduced-motion: no-preference) {
  .panel { animation: up .22s ease-out; }
  .scrim { animation: fade .22s ease-out; }
  .toast { animation: pop .2s ease-out; }
  @keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
}

/* ---------- textos legais e caixa de aceite ---------- */
.doc { padding-bottom: 48px; }
.doc h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 8px 0 4px; }
.doc h2 { font-size: 18px; margin: 22px 0 6px; }
.doc p, .doc li { max-width: 62ch; }
.doc ul { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.doc a { color: var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.check a { color: var(--accent); }
.links { font-size: 13px; color: var(--ink-2); display: flex; gap: 14px; flex-wrap: wrap; }
.links a { color: inherit; }

/* ---------- Cags PRO ---------- */
.pro { padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--accent-soft); }
.pro h3 { font-size: 18px; font-weight: 800; }
.pro > div { min-width: 0; }
.pro .btn { flex: none; }

/* Rei do trono e skin Ouro */
.rank li.king { background: linear-gradient(135deg, var(--gold-soft), var(--surface)); box-shadow: inset 0 0 0 2px var(--gold); border-radius: 16px; margin: 6px; }
.rank li.king.me { background: linear-gradient(135deg, var(--gold-soft), var(--accent-soft)); }
.king-tag { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-ink); background: var(--gold-soft); border-radius: 99px; padding: 2px 8px; }
.av.gold { overflow: hidden; box-shadow: 0 0 0 2px #f7c823, 0 0 14px rgba(247,200,35,.65); }
.av.gold::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.85) 50%, transparent 65%); transform: translateX(-120%); animation: shine 2.8s ease-in-out infinite; pointer-events: none; }
@keyframes shine { 55%, 100% { transform: translateX(120%); } }
@media (prefers-reduced-motion: reduce) { .av.gold::after { animation: none; } }

.code-box { padding: 16px; display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.code { font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: .08em; user-select: all; overflow-wrap: anywhere; }

.act.del { margin-left: auto; }
.act.del.armed { color: #fff; background: var(--bad); }

.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.box h3 { font-size: 16px; margin-bottom: 4px; }

.gwrap { padding: 0; overflow: hidden; }
.gwrap .gitem { width: 100%; border: 0; background: transparent; box-shadow: none; border-radius: 0; padding: 16px; display: flex; justify-content: space-between; align-items: center; text-align: left; font: inherit; color: inherit; }
.grow { padding: 0 12px 12px; display: flex; }
.btn.danger { color: #fff; background: var(--bad); }

/* botão do grupo atual: em destaque */
.group { font-size: 15px; font-weight: 800; color: #fff; background: var(--accent); padding: 10px 16px; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 38%, transparent); max-width: 62vw; }
.group:active { transform: scale(.97); }
.group span[aria-hidden] { font-size: 12px; opacity: .85; }
