:root {
  --bg: #0d1712;
  --bg-2: #13211a;
  --panel: #182a20;
  --panel-2: #1f3529;
  --line: #2c4a39;
  --text: #eaf3ec;
  --muted: #94ad9d;
  --accent: #f5c518;
  --accent-ink: #1b1600;
  --green: #2bb35a;
  --blue: #3d7ef0;
  --danger: #e5484d;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  display: flex;
  flex-direction: column;
}
button, input { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------------- topo ---------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; background: var(--bg-2); border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: .3px; font-size: 18px; }
.user-area { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.badge.admin { background: #7c3aed; color: #fff; border-color: transparent; font-weight: 700; }
.badge.warn { background: #3a2d0a; color: #ffe39a; border-color: #6a5310; }
.badge.gold { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }

/* ---------------- botões ---------------- */
.btn {
  border: 1px solid var(--line); background: var(--panel-2); padding: 8px 14px;
  border-radius: 8px; cursor: pointer; font-weight: 600; transition: background .15s, transform .05s;
}
.btn:hover:not(:disabled) { background: #284534; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover:not(:disabled) { background: #ffd43b; }
.btn.danger { background: transparent; color: #ff8b8e; border-color: #5a2a2c; width: 100%; }
.btn.ghost { background: transparent; }
.btn:focus-visible, .zoom-group button:focus-visible, .tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- home ---------------- */
#view-home { overflow-y: auto; padding: 22px 18px 40px; max-width: 1120px; width: 100%; margin: 0 auto; }
.hero h1 { margin: 6px 0 6px; font-size: clamp(26px, 4vw, 40px); line-height: 1.1; }
.hero h1 span { color: var(--accent); }
.hero p { margin: 0 0 6px; color: var(--muted); max-width: 640px; }
.online-count { font-size: 13px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 18px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font-size: 18px; }
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.server-card {
  text-align: left; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  background: linear-gradient(160deg, #21402e, #172b20); cursor: pointer; position: relative;
  display: flex; flex-direction: column; gap: 4px; min-height: 112px;
}
.server-card:hover:not(:disabled) { border-color: var(--accent); }
/* amistosos: cards discretos */
.server-card.friendly { background: var(--bg-2); }
.server-card .mode-line { font-size: 12.5px; color: var(--muted); }
/* servidor principal (Corrida ao topo): ocupa a linha inteira e chama atenção */
.server-card.ranked {
  grid-column: 1 / -1; min-height: 132px; padding: 18px 20px;
  background: radial-gradient(120% 140% at 0% 0%, #2f6b3f 0%, #17371f 55%, #122a19 100%);
  border: 2px solid var(--accent); box-shadow: 0 6px 24px rgba(245,197,24,.18);
}
.server-card.ranked:hover:not(:disabled) { box-shadow: 0 8px 30px rgba(245,197,24,.32); }
.server-card.ranked .name { font-size: 28px; }
.server-card.ranked .mode-line { font-size: 14.5px; font-weight: 700; color: var(--accent); }
.server-card.ranked .stats { font-size: 14px; }
.server-card.ranked .tag { top: 14px; right: 14px; font-size: 13px; padding: 3px 12px; }
@media (max-width: 560px) {
  .server-card.ranked .tag { position: static; order: -1; align-self: flex-start; margin-bottom: 4px; }
}
.server-card:disabled { cursor: not-allowed; opacity: .55; }
.server-card .name { font-size: 18px; font-weight: 800; }
.server-card .city { color: var(--muted); font-size: 13px; }
.server-card .stats { margin-top: auto; font-size: 13px; display: flex; gap: 12px; }
.server-card .stats b { color: var(--accent); }
.server-card .tag { position: absolute; top: 10px; right: 10px; }
.home-columns { display: grid; grid-template-columns: 1.3fr 1fr; gap: 0 18px; }
@media (max-width: 860px) { .home-columns { grid-template-columns: 1fr; } }
.tabs { display: flex; gap: 4px; background: var(--bg-2); padding: 3px; border-radius: 8px; }
.tabs button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.tabs button.active { background: var(--panel-2); color: var(--text); }
table.ranking { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.ranking th, table.ranking td { padding: 6px 6px; text-align: right; border-bottom: 1px solid var(--line); }
table.ranking th:nth-child(2), table.ranking td:nth-child(2) { text-align: left; width: 100%; }
table.ranking th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.howto { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: #cfe0d5; }

/* ---------------- amistoso ---------------- */
#view-friendly { overflow-y: auto; padding: 18px 18px 40px; max-width: 900px; width: 100%; margin: 0 auto; }
.notice-bar { margin-top: 14px; background: #3a2d0a; border: 1px solid #6a5310; color: #ffe39a; padding: 10px 14px; border-radius: 10px; }
.player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.player-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
}
.player-who { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.player-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-weight: 800; flex: none; }
.status-pill { font-size: 12.5px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.status-pill.available { color: #7ee2a0; border-color: #2c6b45; }
.status-pill.busy { color: #ffcf6b; border-color: #6a5310; }
.status-pill.playing { color: #9ec5ff; border-color: #2c4f80; }
.player-empty { display: flex; flex-direction: column; gap: 4px; padding: 18px; text-align: center; background: var(--bg-2); border: 1px dashed var(--line); border-radius: 10px; }
@media (max-width: 560px) { .player-row { grid-template-columns: 1fr auto; } .status-pill { grid-column: 1; justify-self: start; } }
.challenge-body { padding: 22px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.challenge-body h2 { margin: 0; }
.challenge-body p { margin: 0; }
.challenge-tag { align-self: center; font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
.challenge-count { font-size: 46px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.challenge-count small { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
#challenge-timer-fill { height: 100%; width: 100%; background: var(--green); transition: width .1s linear; }
#challenge-timer-fill.warn { background: #e8a33d; }
#challenge-timer-fill.crit { background: var(--danger); }
.challenge-body .dialog-actions { justify-content: center; }

/* ---------------- conquistas e títulos ---------------- */
.achievement-popups { position: fixed; top: 70px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 10px; pointer-events: none; max-width: calc(100vw - 32px); }
.achievement-popup {
  display: flex; gap: 12px; align-items: center; width: 320px; max-width: 100%;
  background: linear-gradient(135deg, #3b2f0a, #1c2a1d); border: 2px solid var(--accent); border-radius: 12px;
  padding: 10px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: ach-in .45s cubic-bezier(.2,1.4,.4,1);
}
.achievement-popup.leaving { animation: ach-out .35s ease-in forwards; }
@keyframes ach-in { from { transform: translateX(120%); opacity: 0; } }
@keyframes ach-out { to { transform: translateX(120%); opacity: 0; } }
.achievement-popup .ach-icon { font-size: 34px; }
.ach-kicker { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
.achievement-popup .ach-name { font-weight: 900; font-size: 16px; }
.achievement-popup .ach-desc { font-size: 12.5px; color: #d7e4da; }
.ach-summary { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.ach-count b { font-size: 26px; color: var(--accent); }
.ach-bar { height: 10px; background: var(--bg-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.ach-bar.small { height: 6px; margin-top: 6px; }
.ach-bar-fill { height: 100%; background: linear-gradient(90deg, var(--green), var(--accent)); }
.title-showcase { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; }
.title-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.title-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: #3a1d1d; border: 1px solid #a33; color: #ffd6d6; font-weight: 800; font-size: 12px; white-space: nowrap; }
.title-chip.big { font-size: 14px; padding: 5px 12px; }
.ach-cat { margin: 16px 0 8px; font-size: 15px; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ach-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; opacity: .62; }
.ach-card.unlocked { opacity: 1; border-color: var(--accent); background: linear-gradient(160deg, #2c2a12, #172318); }
.ach-card .ach-icon { font-size: 26px; }
.ach-card .ach-name { font-weight: 800; font-size: 13.5px; margin-top: 2px; }
.ach-card .ach-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ach-date { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.streak-chip { font-weight: 800; color: #ffb35c; }
/* títulos durante a partida */
.title-badges { margin-left: 6px; }
.title-badges span { cursor: help; margin-right: 2px; }
.banner-extra:empty { display: none; }
.banner-extra { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.banner-extra .title-chip { font-size: 13px; }
.title-break {
  background: #5a0f12; border: 2px solid #ff4d55; color: #fff; padding: 6px 14px; border-radius: 10px;
  font-weight: 900; text-transform: uppercase; letter-spacing: .5px; animation: shake .5s ease-in-out 2;
}
@keyframes shake { 25% { transform: translateX(-6px) rotate(-1deg); } 75% { transform: translateX(6px) rotate(1deg); } }
.end-titles { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.end-titles .title-break { font-size: 13px; text-transform: none; animation: none; }

/* ---------------- painel admin ---------------- */
#view-admin { overflow-y: auto; padding: 18px 18px 40px; max-width: 1200px; width: 100%; margin: 0 auto; }
#view-admin .account-head { flex-wrap: wrap; }
.btn.admin-cta { background: #7c3aed; color: #fff; border-color: transparent; }
.btn.admin-cta:hover:not(:disabled) { background: #8b4cf2; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; letter-spacing: 1px; color: #ff8b8e; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); animation: pulse 1.2s ease-in-out infinite; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-sub { color: var(--muted); font-size: 12px; }
.admin-chart { position: relative; }
.chart-empty { padding: 30px 0; text-align: center; }
.line-chart { width: 100%; height: auto; display: block; }
.line-chart .grid { stroke: rgba(255,255,255,.07); stroke-width: 1; }
.line-chart .axis { fill: var(--muted); font-size: 11px; }
.line-chart .line { fill: none; stroke: var(--green); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-chart .area { fill: rgba(43,179,90,.12); stroke: none; }
.line-chart .dot { fill: var(--green); stroke: var(--panel); stroke-width: 2; }
.line-chart .cross { stroke: rgba(255,255,255,.35); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip {
  position: absolute; top: 0; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
  background: #0b140f; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font-size: 12.5px; font-weight: 700;
}
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 14px; }
.bar-card h3 { margin: 0 0 10px; font-size: 15px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 44%) 1fr auto; align-items: center; gap: 8px; margin: 5px 0; font-size: 13px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; background: rgba(255,255,255,.05); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--green); border-radius: 0 4px 4px 0; }
.bar-value { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 2ch; text-align: right; }
.table-wrap { overflow-x: auto; }
.sessions-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sessions-table th, .sessions-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sessions-table th { color: var(--muted); font-weight: 600; }

/* ---------------- premium ---------------- */
#view-premium { overflow-y: auto; padding: 18px 18px 40px; max-width: 900px; width: 100%; margin: 0 auto; }
.benefits { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 18px; }
.plan-card {
  position: relative; text-align: left; padding: 18px; border-radius: 14px; cursor: pointer;
  background: var(--panel); border: 2px solid var(--line); display: flex; flex-direction: column; gap: 4px;
}
.plan-card:hover { border-color: #4b7a5e; }
.plan-card.selected { border-color: var(--accent); box-shadow: 0 6px 24px rgba(245,197,24,.18); background: linear-gradient(160deg, #2c2a12, #182a20); }
.plan-name { font-weight: 800; font-size: 18px; }
.plan-price { font-size: 32px; font-weight: 900; color: var(--accent); }
.plan-note { color: var(--muted); font-size: 14px; }
.plan-tag { position: absolute; top: 12px; right: 12px; }
.checkout-panel h2 { margin: 0 0 10px; font-size: 18px; }
.method-choice { display: flex; gap: 10px; flex-wrap: wrap; }
.method-choice label { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); cursor: pointer; font-weight: 700; }
.method-choice label:has(input:checked) { border-color: var(--accent); }
.premium-summary { color: #e6efe8; margin: 12px 0; }
.email-field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; margin-bottom: 12px; max-width: 360px; }
.email-field input { padding: 9px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.terms-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: #d8e6dc; margin: 6px 0 14px; }
.terms-check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.pay-btn { padding: 12px 22px; font-size: 16px; }
.premium-status { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.premium-status-title { font-size: 18px; font-weight: 800; }
.payments-table { border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.payments-table th, .payments-table td { padding: 4px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.btn.premium-cta { background: linear-gradient(135deg, #f5c518, #ffdd55); color: var(--accent-ink); border-color: transparent; }
.btn.premium-cta:hover:not(:disabled) { background: linear-gradient(135deg, #ffd43b, #ffe680); }
#view-home a, .terms-check a, #view-premium a { color: var(--accent); }

/* ---------------- minha conta ---------------- */
#view-account { overflow-y: auto; padding: 18px 18px 40px; max-width: 1120px; width: 100%; margin: 0 auto; }
.account-head { display: flex; align-items: center; gap: 14px; }
.account-head h1 { margin: 0; font-size: 26px; }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.profile-head .premium-cta { margin-left: auto; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 900; font-size: 24px; }
.profile-name { font-size: 20px; font-weight: 800; margin-bottom: 2px; }
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12.5px; }
@media (max-width: 560px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.style-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px;
  background: var(--bg-2); border: 2px solid var(--line); border-radius: 10px; cursor: pointer; text-align: center;
}
.style-card:hover { border-color: #3f6b52; }
.style-card.selected { border-color: var(--accent); background: #22301f; }
.style-card.locked { opacity: .6; }
.style-card.locked canvas { filter: grayscale(.5); }
.style-name { font-weight: 700; font-size: 13.5px; }
.form-msg { min-height: 1.3em; margin: 10px 0 0; font-size: 14px; }
.form-msg.ok { color: #7ee2a0; }
.form-msg.warn { color: #ffcf6b; }
.formation-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(220px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 760px) { .formation-layout { grid-template-columns: 1fr; } }
.formation-editor { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); touch-action: none; }
.formation-editor canvas { display: block; width: 100%; }
.formation-editor canvas.can-drag { cursor: grab; }
.formation-editor canvas.dragging { cursor: grabbing; }
.formation-editor.locked canvas { filter: grayscale(.6) brightness(.6); }
.formation-lock { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; }
.formation-lock > div { background: rgba(8,14,10,.88); border: 1px solid var(--accent); border-radius: 12px; padding: 16px 20px; max-width: 320px; }
.formation-lock p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.lock-icon { font-size: 28px; }
.formation-side p { margin: 0 0 10px; }
.preset-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }

/* ---------------- jogo ---------------- */
#view-game { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.game-main { flex: 1 1 auto; display: flex; min-height: 0; }
.field-wrap { position: relative; flex: 1 1 auto; min-width: 0; background: #0a120d; overflow: hidden; touch-action: none; }
#field-canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#field-canvas.panning { cursor: grabbing; }
#field-canvas.can-play { cursor: pointer; }
#field-canvas.waiting { cursor: none; }
.cursor-msg {
  position: fixed; z-index: 40; pointer-events: none; transform: translate(-50%, -130%);
  background: rgba(0,0,0,.78); color: #fff; padding: 6px 12px; border-radius: 999px;
  font-weight: 700; white-space: nowrap; border: 1px solid rgba(255,255,255,.25);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .6; } }
.banner {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  background: rgba(8, 14, 10, .86); border: 2px solid var(--accent); border-radius: 14px;
  padding: 8px 22px; text-align: center; pointer-events: none; max-width: 90%;
  box-shadow: 0 10px 40px rgba(0,0,0,.5); animation: pop .25s ease-out;
}
.banner-title { font-size: clamp(20px, 3vw, 30px); font-weight: 900; letter-spacing: 1px; color: var(--accent); text-transform: uppercase; }
.banner-sub { color: #e6efe8; font-size: 14px; }
.banner.goal .banner-title { font-size: clamp(34px, 7vw, 64px); }
@keyframes pop { from { transform: translateX(-50%) scale(.85); opacity: 0; } }
.replay-badge {
  position: absolute; top: 14px; left: 14px; z-index: 5; pointer-events: none;
  background: rgba(0,0,0,.75); color: #fff; font-weight: 900; letter-spacing: 2px;
  padding: 6px 14px; border-radius: 6px; border: 1px solid rgba(255,255,255,.3);
}
.replay-badge small { font-weight: 600; letter-spacing: 0; opacity: .8; margin-left: 6px; }
.replay-badge .rec { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #e5484d; margin-right: 8px; animation: pulse 1s ease-in-out infinite; }
/* faixas de "cinema" durante o replay */
.field-wrap::before, .field-wrap::after {
  content: ""; position: absolute; left: 0; right: 0; height: 0; background: #000; z-index: 4;
  transition: height .35s ease; pointer-events: none;
}
.field-wrap::before { top: 0; }
.field-wrap::after { bottom: 0; }
.field-wrap.replaying::before, .field-wrap.replaying::after { height: 7%; }
.end-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); }
.end-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px 28px; text-align: center; min-width: 280px; max-width: 92%; }
.end-card h2 { margin: 0 0 6px; color: var(--accent); }
.end-score { font-size: 22px; font-weight: 800; margin: 4px 0; }
.end-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

.side-panel {
  flex: 0 0 210px; background: var(--bg-2); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; padding: 12px; overflow-y: auto;
}
.side-block { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.side-block:last-child { border-bottom: 0; margin-top: auto; }
.stadium-name { font-weight: 800; font-size: 17px; }
.zoom-group { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.zoom-group button { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 0; cursor: pointer; font-weight: 700; }
.zoom-group button.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.small-btn { padding: 5px 8px; font-size: 13px; }
.turn-label { font-weight: 800; font-size: 16px; }
.turn-label.mine { color: var(--accent); }
.timer-bar { height: 8px; background: var(--panel); border-radius: 999px; overflow: hidden; }
#turn-timer-fill { height: 100%; width: 0; background: var(--green); transition: width .2s linear; }
#turn-timer-fill.warn { background: #e8a33d; }
#turn-timer-fill.crit { background: var(--danger); }
.turn-timer-text { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); }
.turn-hint { min-height: 2.6em; }
.actions .action { padding: 14px 10px; font-size: 16px; font-weight: 800; }
.action.shoot:not(:disabled) { background: #c0392b; border-color: transparent; color: #fff; animation: glow 1.4s ease-in-out infinite; }
.action.place { background: var(--accent); color: var(--accent-ink); border-color: transparent; animation: glow 1.4s ease-in-out infinite; }
.action.ready:not(:disabled) { background: var(--blue); border-color: transparent; color: #fff; animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px rgba(245,197,24,.35); } }

.bottom-bar {
  flex: 0 0 184px; display: flex; gap: 16px; padding: 10px 16px; align-items: stretch;
  background: linear-gradient(180deg, #13211a, #0f1a14); border-top: 1px solid var(--line); min-height: 0;
}

/* placar estilo transmissão de TV */
.scoreboard {
  flex: 0 1 600px; min-width: 0; align-self: center;
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto minmax(0, 1fr); align-items: center;
  background: linear-gradient(180deg, #1d3326, #142519); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 16px; box-shadow: 0 8px 24px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.04);
  font-variant-numeric: tabular-nums;
}
.sb-team { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 800; font-size: 16px; }
.sb-home { justify-content: flex-end; text-align: right; }
.sb-away { justify-content: flex-start; }
.sb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sb-score {
  min-width: 52px; height: 52px; margin: 0 10px; display: grid; place-items: center;
  font-size: 30px; font-weight: 900; color: #fff; background: #0a130e; border: 1px solid #2f5140; border-radius: 12px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.5);
}
.swatch { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.75); box-shadow: 0 0 0 2px rgba(0,0,0,.25); }
.offline { opacity: .45; text-decoration: line-through; }
.clock { text-align: center; padding: 4px 14px; min-width: 92px; background: var(--accent); color: var(--accent-ink); border-radius: 10px; }
.clock-time { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: .5px; line-height: 1.1; }
.clock-time.low { color: #b3000a; }
.clock-period { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; opacity: .8; }
.title-badges:empty { display: none; }
.sb-home .title-badges { margin: 0 2px 0 0; }

/* chat em balões */
.chat {
  flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; max-width: 760px; margin: 0 auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.chat-log { flex: 1 1 auto; overflow-y: auto; padding: 8px 12px; font-size: 14px; min-height: 0; display: flex; flex-direction: column; gap: 4px; }
.chat-log .msg {
  align-self: flex-start; max-width: 85%; overflow-wrap: anywhere; line-height: 1.35;
  background: #23392c; border: 1px solid #2f4b3a; padding: 4px 10px; border-radius: 12px 12px 12px 4px;
}
.chat-log .msg b { display: block; font-size: 11.5px; margin: 0; }
.chat-log .msg.mine { align-self: flex-end; background: #2a3c22; border-color: #4a5f2d; border-radius: 12px 12px 4px 12px; }
.chat-log .msg.system {
  align-self: center; max-width: 95%; background: transparent; border: 0; padding: 0 4px;
  color: var(--muted); font-style: italic; font-size: 12.5px; text-align: center;
}
.chat-form { display: flex; gap: 8px; padding: 6px 8px; border-top: 1px solid var(--line); background: rgba(0,0,0,.15); }
.chat-form input { flex: 1; min-width: 0; padding: 7px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; }
.chat-form input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.chat-send { border-radius: 999px; background: var(--accent); color: var(--accent-ink); border-color: transparent; padding: 8px 18px; }
.chat-send:hover:not(:disabled) { background: #ffd43b; }

/* elementos que só existem no layout de celular */
.chat-toggle { display: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 5px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
#btn-chat-close { display: none; }
.aim-tip {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 6; pointer-events: none;
  background: rgba(0,0,0,.78); color: #ffe39a; border: 1px solid #6a5310; border-radius: 999px;
  padding: 5px 12px; font-size: 13px; font-weight: 700; white-space: nowrap; max-width: 94%; overflow: hidden; text-overflow: ellipsis;
}
.unread { margin-left: 4px; background: var(--danger); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; font-weight: 800; }

/* ---------- celular em pé: tudo cabe na tela, sem rolagem ---------- */
@media (max-width: 760px) {
  body[data-view="game"] { height: 100dvh; overflow: hidden; }
  body[data-view="game"] .topbar { display: none; }
  #view-game {
    height: 100dvh; display: grid; min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "score" "field" "side";
  }
  .game-main, .bottom-bar { display: contents; }
  .field-wrap { grid-area: field; min-height: 0; height: auto; }

  .scoreboard {
    grid-area: score; justify-content: space-between; gap: 8px; padding: 4px 10px;
    padding-top: calc(4px + env(safe-area-inset-top)); background: var(--bg-2); border-bottom: 1px solid var(--line);
  }
  .scoreboard { border-radius: 0; box-shadow: none; border: 0; border-bottom: 1px solid var(--line); flex: none; align-self: stretch; }
  .sb-team { font-size: 13px; gap: 5px; }
  .sb-score { min-width: 30px; height: 30px; margin: 0 5px; font-size: 17px; border-radius: 8px; }
  .swatch { width: 11px; height: 11px; }
  .clock { padding: 2px 8px; min-width: 64px; border-radius: 8px; }
  .clock-time { font-size: 17px; letter-spacing: 0; }
  .clock-period { font-size: 9.5px; }

  .side-panel {
    grid-area: side; flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
    grid-template-areas: "turn zoom" "actions misc";
    gap: 6px 8px; padding: 6px 8px; padding-bottom: calc(6px + env(safe-area-inset-bottom));
    border: 0; border-top: 1px solid var(--line); overflow: visible;
  }
  .side-panel > .side-block:nth-child(2) { grid-area: zoom; }
  .side-panel > .actions { grid-area: actions; }
  .side-panel > .side-block:last-child { grid-area: misc; }
  .side-block { border: 0; padding: 0; margin: 0; gap: 4px; min-width: 0; }
  .side-block:first-child, #btn-center-ball, .side-panel .side-block > .muted.small, .turn-hint, .turn-timer-text { display: none; }
  .turn-block { grid-area: turn; flex-direction: row; align-items: center; gap: 8px; }
  .turn-label { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
  .turn-block .timer-bar { flex: 1; }
  .zoom-group { grid-template-columns: repeat(4, 30px); gap: 3px; }
  .zoom-group button { padding: 6px 0; font-size: 12px; }
  .actions { flex-direction: row; gap: 6px; }
  .actions .action { flex: 1; padding: 8px 4px; font-size: 13px; line-height: 1.15; min-width: 0; }
  .side-block:last-child { margin-top: 0; flex-direction: row; gap: 6px; }
  .btn.danger { width: auto; padding: 8px 10px; }
  .chat-toggle { display: inline-flex; align-items: center; padding: 8px 10px; }

  /* chat vira gaveta */
  .chat {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: 55dvh; max-width: none; margin: 0;
    background: var(--bg-2); border-top: 2px solid var(--line); border-radius: 14px 14px 0 0; padding: 8px 10px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    transform: translateY(105%); transition: transform .22s ease; box-shadow: 0 -10px 30px rgba(0,0,0,.5);
  }
  #view-game.chat-open .chat { transform: none; }
  .chat-head { margin: -8px -10px 6px; }
  #btn-chat-close { display: inline-flex; }

  .banner { top: 6px; padding: 6px 12px; max-width: 94%; }
  .banner-title { font-size: 20px; }
  .banner.goal .banner-title { font-size: 34px; }
  .banner-sub { font-size: 12.5px; }
  .replay-badge { top: 8px; left: 8px; padding: 4px 10px; font-size: 13px; }
  .topbar { padding: 8px 12px; }
  .brand { font-size: 16px; }
}

/* ---------- celular deitado: controles na lateral ---------- */
@media (max-height: 500px) and (orientation: landscape) {
  body[data-view="game"] { height: 100dvh; overflow: hidden; }
  body[data-view="game"] .topbar { display: none; }
  #view-game {
    height: 100dvh; display: grid; min-height: 0;
    grid-template-columns: minmax(0, 1fr) 230px; grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "field score" "field side";
  }
  .game-main, .bottom-bar { display: contents; }
  .field-wrap { grid-area: field; min-height: 0; height: auto; }
  .scoreboard {
    grid-area: score; padding: 6px; border-radius: 0; box-shadow: none; border: 0; border-left: 1px solid var(--line);
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-areas: "clock clock clock" "home s0 ." "away s1 .";
    row-gap: 3px; align-self: stretch; flex: none;
  }
  .scoreboard .clock { grid-area: clock; justify-self: center; padding: 1px 10px; }
  .sb-home { grid-area: home; justify-content: flex-start; flex-direction: row-reverse; }
  .sb-away { grid-area: away; }
  #score-0 { grid-area: s0; }
  #score-1 { grid-area: s1; }
  .sb-team { font-size: 12.5px; gap: 5px; }
  .sb-score { min-width: 26px; height: 24px; margin: 0 4px; font-size: 15px; border-radius: 6px; }
  .clock-time { font-size: 16px; }
  .clock-period { font-size: 9px; }
  .side-panel { grid-area: side; flex: none; padding: 6px 8px; gap: 4px; border-left: 1px solid var(--line); min-height: 0; }
  .side-block { padding: 3px 0; gap: 4px; }
  .side-block:first-child, #btn-center-ball, .turn-hint, .turn-timer-text, .side-panel .side-block > .muted.small { display: none; }
  .zoom-group button { padding: 4px 0; font-size: 12px; }
  .actions .action { padding: 7px 6px; font-size: 13px; }
  .side-block:last-child { margin-top: auto; flex-direction: row; gap: 6px; }
  .btn.danger { width: auto; flex: 1; }
  .chat-toggle { display: inline-flex; align-items: center; }
  .chat {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; width: min(360px, 70vw); max-width: none; margin: 0;
    background: var(--bg-2); border-left: 2px solid var(--line); padding: 8px 10px;
    transform: translateX(105%); transition: transform .22s ease; box-shadow: -10px 0 30px rgba(0,0,0,.5);
  }
  #view-game.chat-open .chat { transform: none; }
  .chat-head { margin: -8px -10px 6px; }
  #btn-chat-close { display: inline-flex; }
  .banner { top: 6px; padding: 5px 12px; }
  .banner-title { font-size: 18px; }
}

/* ---------------- diálogos ---------------- */
.dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); padding: 0; width: min(440px, 94vw); }
.dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog form { padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; }
.dialog h2 { margin: 0; }
.dialog p { margin: 0; }
.dialog label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
.dialog input { padding: 9px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.dialog input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.warning { background: #3a2d0a; border: 1px solid #6a5310; color: #ffe39a; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; }
.form-error { color: #ff8b8e; min-height: 1.2em; font-size: 13.5px; }
.dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 170px; transform: translateX(-50%); z-index: 50;
  background: #2a1214; border: 1px solid #6b2b2f; color: #ffd6d7; padding: 8px 16px; border-radius: 999px;
  box-shadow: 0 6px 24px rgba(0,0,0,.4); max-width: 92vw; text-align: center;
}
.toast.info { background: #13283a; border-color: #2c5a80; color: #d8ecff; }

/* ---------------- checkout simulado (modo de teste) ---------------- */
.fake-checkout { max-width: 560px; margin: 40px auto; padding: 0 16px; }
.fake-checkout h1 { margin: 12px 0 6px; }
