:root {
  --bg: #0b0f14;
  --bg2: #10161d;
  --panel: #151c25;
  --panel2: #1b2430;
  --line: #263241;
  --text: #e6edf3;
  --muted: #8b9bb0;
  --accent: #22c55e;
  --accent2: #16a34a;
  --gold: #f5c542;
  --red: #ef4444;
  --orange: #f59e0b;
  --blue: #38bdf8;
  --purple: #a78bfa;
  --club: #22c55e;
  --club2: #0f172a;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, rgba(34, 197, 94, .07), transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
button { font: inherit; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; }
h2 { font-size: 20px; }
h3 { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- layout */
#app { display: grid; grid-template-columns: 230px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
#app.nocareer { grid-template-columns: 1fr; }
#app.nocareer #sidebar, #app.nocareer #topbar { display: none; }
#topbar {
  grid-column: 2; position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
  padding: 10px 22px; background: rgba(11, 15, 20, .97);
  border-bottom: 1px solid var(--line);
}
#sidebar {
  grid-row: 1 / span 2; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--bg2); border-right: 1px solid var(--line); padding: 14px 10px;
}
#view { grid-column: 2; padding: 22px; max-width: 1280px; width: 100%; min-width: 0; }
#app.nocareer #view { grid-column: 1; margin: 0 auto; }

/* ---- espaço de anúncios (rodapé do conteúdo; altura reservada para não deslocar o layout) */
#ad-bottom { grid-column: 2; padding: 0 22px 22px; min-width: 0; }
#app.nocareer #ad-bottom { grid-column: 1; max-width: 1280px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.ad-slot {
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  width: 100%; max-width: 728px; height: 90px; margin: 0 auto; box-sizing: border-box;
  border: 1px dashed var(--line); border-radius: 10px; background: var(--bg2);
}
.ad-slot > span { color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .6; }
.ad-slot.filled { border-style: solid; background: transparent; }
@media (max-width: 860px) { #ad-bottom { grid-column: 1; padding: 0 14px 14px; } .ad-slot { height: 60px; } }

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font-weight: 800; letter-spacing: .02em; }
.brand .ball { width: 30px; height: 30px; border-radius: 50%; background: conic-gradient(var(--accent), var(--gold), var(--accent)); display: grid; place-items: center; color: #08130c; font-size: 15px; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 1px 0;
  color: var(--text); border-radius: 8px; opacity: .85;
}
nav a .ico { width: 20px; text-align: center; opacity: .9; }
nav a:hover { background: var(--panel); opacity: 1; }
nav a.active { background: linear-gradient(90deg, rgba(34, 197, 94, .18), transparent); color: #fff; opacity: 1; box-shadow: inset 3px 0 0 var(--club); }
nav .sep { height: 1px; background: var(--line); margin: 8px 6px; }
.navfoot { margin-top: 12px; padding: 0 6px; display: grid; gap: 6px; }

/* ---------------------------------------------------------------- topbar */
.tb-club { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.tb-item { display: flex; flex-direction: column; min-width: 70px; }
.tb-item b { font-size: 15px; font-variant-numeric: tabular-nums; }
.tb-item span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.meter { width: 110px; height: 7px; background: var(--panel2); border-radius: 9px; overflow: hidden; margin-top: 4px; }
.meter > i { display: block; height: 100%; border-radius: 9px; background: var(--accent); transition: width .4s; }
.tb-spacer { flex: 1; }

.crest {
  --c1: var(--club); --c2: var(--club2);
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-size: 11px; font-weight: 800; letter-spacing: .02em;
  background: linear-gradient(135deg, var(--c1) 0 50%, var(--c2) 50% 100%);
  color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); border: 1px solid rgba(255, 255, 255, .15);
}
.crest.sm { width: 22px; height: 22px; border-radius: 6px; font-size: 8px; }
.crest.lg { width: 64px; height: 64px; border-radius: 16px; font-size: 18px; }
.teamcell { display: inline-flex; align-items: center; gap: 8px; }

/* ---------------------------------------------------------------- panels */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h3 { padding: 14px 16px 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.pagehead h1 { font-size: 24px; margin: 0; }
.pagehead p { margin: 4px 0 0; color: var(--muted); }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.kpi b { font-size: 22px; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); cursor: pointer;
  background: var(--panel2); color: var(--text); font-weight: 600; transition: transform .05s, background .15s, border-color .15s;
}
.btn:hover { border-color: #3a4a5e; background: #212c3a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent2)); border-color: transparent; color: #04130a; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.gold { background: linear-gradient(180deg, #f8d26a, #e0a920); border-color: transparent; color: #1d1402; }
.btn.danger { background: #3a1717; border-color: #5c2424; color: #fecaca; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn.lg { padding: 12px 22px; font-size: 16px; border-radius: 11px; }
.btn.block { width: 100%; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; }
.seg button.on { background: var(--panel2); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset; }

input[type=text], input[type=number], select {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  padding: 8px 11px; border-radius: 9px; font: inherit; outline: none; min-width: 0;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 197, 94, .15); }
label.field { display: grid; gap: 5px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------------------------------------------------------------- tables */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; background: var(--panel); position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sorted::after { content: " ▾"; color: var(--accent); }
th.sorted.asc::after { content: " ▴"; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
tr.me td { background: rgba(34, 197, 94, .10); font-weight: 700; }
tr.me td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
td.zone-lib { box-shadow: inset 3px 0 0 var(--blue); }
td.zone-sula { box-shadow: inset 3px 0 0 var(--orange); }
td.zone-rel { box-shadow: inset 3px 0 0 var(--red); }
td.zone-promo { box-shadow: inset 3px 0 0 var(--accent); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 10px 16px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.ovr { display: inline-grid; place-items: center; min-width: 30px; padding: 1px 6px; border-radius: 6px; font-weight: 800; background: var(--panel2); }
.ovr.hi { background: rgba(34, 197, 94, .22); color: #86efac; }
.ovr.mid { background: rgba(245, 197, 66, .18); color: #fde68a; }
.fitbar { display: inline-flex; align-items: center; gap: 6px; }
.fitbar .meter { width: 54px; margin: 0; height: 6px; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.badge.red { background: rgba(239, 68, 68, .15); color: #fca5a5; border-color: rgba(239, 68, 68, .35); }
.badge.green { background: rgba(34, 197, 94, .15); color: #86efac; border-color: rgba(34, 197, 94, .35); }
.badge.gold { background: rgba(245, 197, 66, .15); color: #fde68a; border-color: rgba(245, 197, 66, .35); }
.badge.blue { background: rgba(56, 189, 248, .14); color: #7dd3fc; border-color: rgba(56, 189, 248, .35); }
.badge.purple { background: rgba(167, 139, 250, .15); color: #c4b5fd; border-color: rgba(167, 139, 250, .35); }
.pos { display: inline-block; width: 34px; text-align: center; font-size: 11px; font-weight: 800; border-radius: 5px; padding: 1px 0; }
.pos.GK { background: #3b2f0b; color: #fcd34d; }
.pos.DEF { background: #0b2a3b; color: #7dd3fc; }
.pos.MID { background: #0e3320; color: #86efac; }
.pos.FWD { background: #3b1111; color: #fca5a5; }
.res { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-weight: 800; font-size: 12px; }
.res.V { background: rgba(34, 197, 94, .22); color: #86efac; }
.res.E { background: rgba(245, 197, 66, .18); color: #fde68a; }
.res.D { background: rgba(239, 68, 68, .2); color: #fca5a5; }
.starter-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; }

/* ---------------------------------------------------------------- start screen */
.hero { text-align: center; padding: 42px 10px 26px; }
.hero h1 { font-size: 40px; letter-spacing: -.02em; margin-bottom: 4px; }
.hero h1 span { background: linear-gradient(90deg, var(--accent), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); margin: 0; }
.clubgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.clubcard {
  display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--bg2); cursor: pointer; text-align: left; color: var(--text);
}
.clubcard:hover { border-color: #3a4a5e; }
.clubcard.sel { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); background: rgba(34, 197, 94, .06); }
.clubcard .info { flex: 1; min-width: 0; }
.clubcard .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clubcard .info small { color: var(--muted); }
.strength { height: 5px; border-radius: 9px; background: var(--panel2); margin-top: 5px; overflow: hidden; }
.strength i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--orange), var(--accent)); background-size: 220px 100%; }
.savelist { display: grid; gap: 8px; }
.saveitem { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.saveitem .info { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------- dashboard */
.nextmatch { position: relative; overflow: hidden; }
.nextmatch .vs { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 10px 0 16px; }
.nextmatch .side { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; width: 40%; }
.nextmatch .side b { font-size: 17px; }
.nextmatch .x { font-size: 22px; font-weight: 800; color: var(--muted); }
.comp-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); }
.comp-tag.league { color: #86efac; }
.comp-tag.cup { color: #fde68a; border-color: rgba(245, 197, 66, .4); }
.comp-tag.ncup { color: #fde68a; border-color: rgba(245, 197, 66, .4); }
.comp-tag.cl { color: #93c5fd; border-color: rgba(96, 165, 250, .45); }
.comp-tag.lib { color: #c4b5fd; border-color: rgba(167, 139, 250, .4); }
.comp-tag.mundial { color: #7dd3fc; border-color: rgba(56, 189, 248, .45); }
.balls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.slot { border: 1px dashed var(--line); border-radius: 10px; padding: 8px; min-height: 86px; background: var(--bg2); }
.slot b { font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.ball { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; font-weight: 700; animation: pop .35s ease-out; }
.ball i { width: 18px; height: 18px; border-radius: 50%; display: inline-block; flex: none;
  background: radial-gradient(circle at 30% 30%, #fff, #cbd5e1 60%, #64748b); box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.ball.p1 i { background: radial-gradient(circle at 30% 30%, #fff, #93c5fd 60%, #1d4ed8); }
.ball.p2 i { background: radial-gradient(circle at 30% 30%, #fff, #fde68a 60%, #b45309); }
@media (max-width: 860px) { .balls { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.newslist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.newslist li { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.newslist li:last-child { border-bottom: 0; }
.newslist .tag { color: var(--muted); font-size: 11px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid; margin-bottom: 16px; flex-wrap: wrap; }
.banner.gold { background: rgba(245, 197, 66, .08); border-color: rgba(245, 197, 66, .35); }
.banner.red { background: rgba(239, 68, 68, .08); border-color: rgba(239, 68, 68, .35); }
.banner.green { background: rgba(34, 197, 94, .08); border-color: rgba(34, 197, 94, .35); }
.banner .grow { flex: 1; min-width: 200px; }

/* ---------------------------------------------------------------- match */
.scoreboard {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 22px; border-radius: 16px; border: 1px solid var(--line);
  background: linear-gradient(180deg, #17212c, #111821);
  box-shadow: var(--shadow);
}
.scoreboard .team { display: flex; align-items: center; gap: 14px; font-size: 18px; font-weight: 800; min-width: 0; }
.scoreboard .team.away { justify-content: flex-end; text-align: right; }
.scoreboard .team .nm { overflow: hidden; text-overflow: ellipsis; }
.scoreboard .team small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.scoreboard .score { text-align: center; }
.scoreboard .score b { font-size: 46px; font-weight: 900; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.scoreboard .clock { display: inline-block; margin-top: 4px; padding: 3px 12px; border-radius: 999px; background: #0b1117; border: 1px solid var(--line); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); }
.scoreboard .clock.ht { color: var(--gold); }
.scoreboard .clock.ft { color: var(--text); }
.progress { height: 4px; background: var(--panel2); border-radius: 9px; overflow: hidden; margin: 14px 0 4px; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--gold)); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 420px; overflow-y: auto; }
.timeline li {
  display: grid; grid-template-columns: 44px 26px 1fr; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 9px; background: var(--bg2); border: 1px solid var(--line);
  animation: pop .35s ease-out;
}
.timeline li.away { grid-template-columns: 1fr 26px 44px; text-align: right; }
.timeline li.away .m { order: 3; text-align: right; }
.timeline li.away .ic { order: 2; }
.timeline li.away .tx { order: 1; }
.timeline li.goal { border-color: rgba(34, 197, 94, .45); background: rgba(34, 197, 94, .08); }
.timeline li.goal.opp { border-color: rgba(239, 68, 68, .45); background: rgba(239, 68, 68, .07); }
.timeline li.sep { display: block; text-align: center; background: transparent; border: 0; color: var(--gold); font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding: 4px; grid-template-columns: none; }
.timeline .m { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .ic { font-size: 16px; text-align: center; }
.timeline .tx small { color: var(--muted); }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .7); } 100% { box-shadow: 0 0 0 26px rgba(34, 197, 94, 0); } }
.scoreboard.flash { animation: flash .9s ease-out; }
.result-word { font-size: 22px; font-weight: 900; letter-spacing: .06em; }
.result-word.V { color: var(--accent); }
.result-word.E { color: var(--gold); }
.result-word.D { color: var(--red); }

#post .teamcell > span:last-child, .modal .teamcell > span:last-child { max-width: 118px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }
#post td { padding: 6px 4px; }

/* ---------------------------------------------------------------- tactics pitch */
.pitch {
  position: relative; border-radius: 14px; padding: 18px 10px; min-height: 380px;
  background:
    linear-gradient(rgba(255, 255, 255, .08), rgba(255, 255, 255, .08)) center / 100% 2px no-repeat,
    radial-gradient(circle at center, transparent 56px, rgba(255, 255, 255, .08) 57px, rgba(255, 255, 255, .08) 59px, transparent 60px),
    repeating-linear-gradient(180deg, #0f3d22 0 48px, #12472a 48px 96px);
  border: 2px solid rgba(255, 255, 255, .12);
  display: flex; flex-direction: column; justify-content: space-around; gap: 10px;
}
.pitch .line { display: flex; justify-content: space-around; gap: 6px; }
.pitch .pl { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 92px; text-align: center; }
.pitch .shirt { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: var(--club); color: #fff; border: 2px solid rgba(255, 255, 255, .7); text-shadow: 0 1px 2px #000; box-shadow: 0 3px 10px rgba(0, 0, 0, .4); }
.pitch .pl small { font-size: 11px; line-height: 1.15; text-shadow: 0 1px 2px #000; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pitch .pl .f { font-size: 10px; color: #d1fae5; }
.optgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.opt { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; text-align: left; color: var(--text); }
.opt:hover { border-color: #3a4a5e; }
.opt.on { border-color: var(--accent); background: rgba(34, 197, 94, .08); box-shadow: 0 0 0 2px rgba(34, 197, 94, .18); }
.opt b { display: block; }
.opt small { color: var(--muted); }

/* ---------------------------------------------------------------- competitions */
.bracket { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.stagecol h4 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.tie { background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; margin-bottom: 6px; font-size: 13px; }
.tie .r { display: flex; justify-content: space-between; gap: 6px; }
.tie .r span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tie .r.w { font-weight: 800; }
.tie .r.l { color: var(--muted); }
.tie.me { border-color: rgba(34, 197, 94, .55); }
.tie .p { font-size: 11px; color: var(--gold); }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.groups table th, .groups table td { padding: 5px 8px; }

/* ---------------------------------------------------------------- modal / toast */
#modal-root { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; background: rgba(3, 6, 10, .8); padding: 16px; }
#modal-root.show { display: grid; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); animation: pop .2s ease-out; }
.modal.wide { width: min(980px, 100%); }
.modal header { padding: 18px 20px 6px; }
.modal header h2 { margin: 0; }
.modal .body { padding: 8px 20px 14px; }
.modal footer { padding: 12px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 11px 14px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); box-shadow: var(--shadow); animation: pop .2s ease-out; }
.toast.err { border-color: rgba(239, 68, 68, .5); background: #2a1414; color: #fecaca; }
.toast.ok { border-color: rgba(34, 197, 94, .5); background: #0f2618; color: #bbf7d0; }
.offerlist { display: grid; gap: 8px; margin: 10px 0; }
.offer { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.offer .info { flex: 1; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.empty { padding: 26px; text-align: center; color: var(--muted); }
.trophy { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; background: rgba(245, 197, 66, .07); border: 1px solid rgba(245, 197, 66, .25); margin-bottom: 6px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* ---- elementos só-mobile ficam ocultos no desktop */
#bottomnav { display: none; }
#nav-backdrop { display: none; }
.sheet-close { display: none; }
input[type=search] { background: var(--bg2); border: 1px solid var(--line); color: var(--text); padding: 8px 11px; border-radius: 9px; font: inherit; outline: none; min-width: 0; }
textarea { font: inherit; }

@media (max-width: 860px) {
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 15px; -webkit-tap-highlight-color: transparent; }
  body.menu-open { overflow: hidden; }
  #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; padding-bottom: calc(64px + env(safe-area-inset-bottom)); overflow-x: hidden; }
  #app.nocareer { padding-bottom: env(safe-area-inset-bottom); }

  /* menu lateral vira "gaveta" que sobe de baixo (abre pelo botão Mais) */
  #sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; max-height: 82vh; max-height: 82dvh;
    z-index: 90; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    padding: 12px 12px calc(76px + env(safe-area-inset-bottom)); border: 1px solid var(--line); border-bottom: 0;
    border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .55);
    transform: translateY(105%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s;
  }
  body.menu-open #sidebar { transform: none; visibility: visible; transition: transform .22s ease; }
  #sidebar .brand { display: flex; padding: 2px 6px 10px; }
  nav#nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  nav#nav a { min-height: 48px; padding: 8px 12px; margin: 0; white-space: normal; background: var(--panel); border: 1px solid var(--line); font-size: 15px; opacity: 1; }
  nav#nav a.active { background: rgba(34, 197, 94, .14); border-color: var(--club); box-shadow: none; }
  nav#nav .sep { display: block; grid-column: 1 / -1; margin: 2px 0; background: transparent; }
  .navfoot { display: grid; grid-template-columns: 1fr 1fr; margin-top: 12px; }
  .navfoot .btn { min-height: 48px; font-size: 15px; }
  #nav-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(3, 6, 10, .6); }
  body.menu-open #nav-backdrop { display: block; }
  .sheet-close { display: block; width: 44px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 10px; }

  /* barra inferior (alcance do polegar) */
  #bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: rgba(16, 22, 29, .98); border-top: 1px solid var(--line);
  }
  body.nocareer-b #bottomnav { display: none; }
  #bottomnav a, #bottomnav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px;
    color: var(--muted); background: transparent; border: 0; font-size: 11px; font-weight: 600; padding: 4px 0; cursor: pointer;
  }
  #bottomnav .ico { font-size: 20px; line-height: 1; }
  #bottomnav a.active, #bottomnav button.on { color: #fff; box-shadow: inset 0 2px 0 var(--club); }

  /* topo compacto */
  #topbar { grid-column: 1; position: static; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 10px 14px; gap: 8px 10px; }
  .tb-club { grid-column: 1 / -1; font-size: 15px; min-width: 0; }
  .tb-spacer { display: none; }
  .tb-item { min-width: 0; }
  .tb-item[style*="max-width"] { grid-column: 1 / -1; max-width: none !important; }
  .tb-item b { font-size: 14px; }
  .meter { width: 100%; max-width: 110px; }
  #view { grid-column: 1; padding: 12px 12px 8px; }
  #ad-bottom { grid-column: 1; padding: 0 12px 12px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: auto; }
  .grid { gap: 12px; }
  .card { padding: 14px; }
  .pagehead h1 { font-size: 21px; }
  .pagehead { align-items: flex-start; }
  h2 { font-size: 18px; }

  /* alvos de toque >= 44px */
  .btn { min-height: 44px; padding: 10px 14px; }
  .btn.sm { min-height: 44px; padding: 8px 12px; font-size: 14px; }
  .btn.lg { min-height: 52px; }
  .seg button { min-height: 40px; padding: 8px 12px; }
  .opt, .clubcard, .saveitem { min-height: 48px; }
  input[type=text], input[type=number], input[type=search], input[type=password], input[type=email], select, textarea { font-size: 16px !important; min-height: 44px; }
  input[type=number] { width: 88px !important; }
  input[type=search], select { max-width: 100%; }
  .btnrow > input[type=search], .btnrow > select { flex: 1 1 100%; width: 100% !important; }
  .btnrow > label:not(.field) { display: flex; align-items: center; gap: 8px; }

  /* tabelas: rolagem horizontal contida, colunas compactas */
  .card.flush, .tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 9px 8px; }
  th { font-size: 10px; }
  td[colspan], td.empty { white-space: normal; }
  .modal td { white-space: normal; }
  .modal td.nowrap, .modal td.num, .modal td.center { white-space: nowrap; }
  table { font-size: 13px; }
  td button.btn.sm { min-height: 44px; padding: 6px 10px; white-space: nowrap; }
  .teamcell > span:last-child { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .legend { padding: 10px 12px; }
  .bracket { grid-auto-columns: minmax(210px, 80vw); scroll-snap-type: x proximity; }
  .stagecol { scroll-snap-align: start; }
  .groups { grid-template-columns: 1fr; }

  /* tela inicial */
  .hero { padding: 22px 6px 16px; }
  .hero h1 { font-size: 28px; }
  .clubgrid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .clubcard { padding: 10px 8px; gap: 8px; }
  .clubcard .info b { font-size: 13px; }
  .saveitem { flex-wrap: wrap; }
  .btnrow > label.field { flex: 1 1 100% !important; min-width: 0 !important; }

  #start { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 50; box-shadow: 0 6px 24px rgba(0, 0, 0, .6); }
  #start:disabled { opacity: 1; background: var(--panel2); color: var(--muted); border-color: var(--line); }
  #app.nocareer #view { padding-bottom: 84px; }

  /* painel */
  .nextmatch .vs { gap: 10px; }
  .nextmatch .side { width: 42%; }
  .nextmatch .side b { font-size: 15px; }
  .banner { padding: 12px; gap: 10px; }
  .banner .grow { min-width: 0; flex-basis: 100%; }
  .banner .btn { flex: 1 1 auto; }

  /* partida */
  .scoreboard { padding: 12px 8px; gap: 4px; }
  .scoreboard .team { font-size: 13px; gap: 6px; flex-direction: column; text-align: center; justify-content: flex-start; }
  .scoreboard .team.away { flex-direction: column-reverse; text-align: center; justify-content: flex-end; }
  .scoreboard .team .nm { max-width: 100%; overflow-wrap: anywhere; }
  .scoreboard .score b { font-size: 34px; letter-spacing: 0; white-space: nowrap; }
  .crest.lg { width: 46px; height: 46px; font-size: 14px; }
  .timeline { max-height: 46vh; max-height: 46dvh; }
  .timeline li { grid-template-columns: 38px 24px 1fr; padding: 8px; font-size: 14px; }
  .timeline li.away { grid-template-columns: 1fr 24px 38px; }
  body.r-partida #topbar { display: none; }
  body.r-partida .scoreboard { position: sticky; top: 0; z-index: 15; margin-top: 0; }
  body.r-partida .pagehead { margin-bottom: 10px; }
  body.r-partida .pagehead .btnrow { width: 100%; justify-content: space-between; }
  body.r-partida .timeline { max-height: none; }
  #post .teamcell > span:last-child { max-width: 96px; }
  #post .btnrow .btn { flex: 1 1 100%; }

  /* tática */
  .pitch { min-height: 440px; padding: 14px 4px; gap: 6px; }
  .pitch .line { gap: 2px; }
  .pitch .pl { width: 60px; flex: 0 1 60px; }
  .pitch .shirt { width: 38px; height: 38px; font-size: 14px; }
  .pitch .pl small { max-width: 64px; font-size: 10.5px; white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
  .g2 > .card:has(.pitch) { order: -1; }
  .optgrid { grid-template-columns: 1fr 1fr; }
  .opt { padding: 12px; }

  /* modais: tela cheia */
  #modal-root { padding: 0; place-items: stretch; align-items: end; }
  .modal, .modal.wide {
    width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; display: flex; flex-direction: column; overflow: hidden;
    padding-top: env(safe-area-inset-top);
  }
  /* diálogos simples: gaveta inferior; os "wide" (tabelas/resumos) ocupam a tela toda */
  .modal:not(.wide) { height: auto; max-height: 92vh; max-height: 92dvh; border-radius: 18px 18px 0 0; border-top: 1px solid var(--line); padding-top: 0; }
  .modal header { padding: 14px 16px 6px; flex: none; }
  .modal .body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 16px 14px; min-height: 0; }
  .modal footer { flex: none; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--panel); }
  .modal footer .btn { flex: 1 1 auto; min-height: 48px; }
  .modal .tablewrap { max-height: none !important; }

  #toasts { left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); max-width: none; }
  .offer { flex-wrap: wrap; }
  .facet .grow { min-width: 0; flex-basis: 100%; }
}
@media (max-width: 400px) {
  .clubgrid { grid-template-columns: 1fr; }
  .pitch .pl { width: 54px; flex-basis: 54px; }
  .pitch .pl small { max-width: 58px; font-size: 10px; }
}

/* ---------------------------------------------------------------- categoria de base */
.stars { color: var(--gold); letter-spacing: 1px; white-space: nowrap; }
.stars i { color: var(--line, #2a3340); font-style: normal; }
.potrange { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 64px; }
.potrange .meter { width: 64px; }
.potrange .meter i { display: block; background: var(--gold); }
.facet { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line, #2a3340); }
.facet:last-of-type { border-bottom: 0; }
.facet .grow { flex: 1; min-width: 160px; }
.facet .lvl { color: var(--accent); letter-spacing: 2px; }
.facet .lvl i { color: var(--line, #2a3340); font-style: normal; }

/* ---------------------------------------------------------------- nova carreira: dificuldade / aporte */
.newopts { display: grid; gap: 12px; margin-bottom: 14px; }
.optblock { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg2); }
.optlabel { text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.optblock .optgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.optblock .opt { text-align: center; min-height: 44px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
label.optblock.backing { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); }
label.optblock.backing.on { border-color: var(--accent); background: rgba(34, 197, 94, .06); }
label.optblock.backing input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--accent); }

/* ---------------------------------------------------------------- negociação */
.negnote { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 2px; white-space: normal; max-width: 190px; line-height: 1.25; }
.negnote .badge { flex: none; }
.negnote .small { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (min-width: 861px) { .modal.neg { width: min(760px, 100%); } }
.negsteps { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.negsteps span { padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--bg2); border: 1px solid var(--line); color: var(--muted); }
.negsteps span.on { color: #04130a; background: var(--accent); border-color: transparent; }
.negsteps span.done { color: #86efac; border-color: rgba(34, 197, 94, .4); }
.neghead { margin-bottom: 10px; }
.negpanel { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg2); margin-bottom: 12px; display: grid; gap: 8px; }
.negrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.negfields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.negfields input, .negfields select { width: 100%; }
.negcounter { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: rgba(245, 197, 66, .09); border: 1px solid rgba(245, 197, 66, .4); }
.negcounter > div { flex: 1; min-width: 180px; }
.negfb { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; border: 1px solid var(--line); background: var(--bg2); }
.negfb.ok { border-color: rgba(34, 197, 94, .5); background: rgba(34, 197, 94, .09); }
.negfb.warn { border-color: rgba(245, 197, 66, .5); background: rgba(245, 197, 66, .09); }
.negfb.err { border-color: rgba(239, 68, 68, .5); background: rgba(239, 68, 68, .09); }
.pips { display: inline-flex; gap: 4px; }
.pips i { width: 14px; height: 14px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line); }
.pips i.on { background: var(--accent); border-color: transparent; }
.pips i.on.low { background: var(--red); }
.swaplist { display: grid; gap: 4px; max-height: 190px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin-top: 4px; }
.chk { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; min-height: 36px; }
.chk:hover { background: rgba(255, 255, 255, .04); }
.chk input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.chk .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.neglog { margin-top: 4px; }
.neglog ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13px; }
.btn:disabled { pointer-events: none; }
@media (max-width: 860px) {
  .optblock .optgrid { grid-template-columns: 1fr 1fr; }
  .negnote { max-width: 170px; }
  .modal.neg input[type=number] { width: 100% !important; }
  .chk { min-height: 44px; }
  .modal.neg .negfields { grid-template-columns: 1fr 1fr; }
  .modal.neg footer { flex-wrap: wrap; }
}
