/* ==========================================================================
   Cartas estilo Ultimate Team
   ========================================================================== */

.fut-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 12px;
}
@media (min-width: 520px) {
  .fut-grid { grid-template-columns: repeat(3, 1fr); }
}

.fut {
  --ink: #46340a;
  --rim: linear-gradient(160deg, #f3d77e, #b4862a 45%, #f0cf72 70%, #a77a20);
  --main: linear-gradient(160deg, #fbe7a3 0%, #e4bd57 36%, #f7df8d 54%, #cb9c34 78%, #ecd075 100%);
  --pattern: repeating-linear-gradient(125deg, rgba(255, 255, 255, 0.1) 0 1.5px, transparent 1.5px 8px);
  --shield: polygon(50% 0%, 63% 2.4%, 78% 2.4%, 89% 6.5%, 100% 6.5%, 100% 86%, 91% 90.5%, 66% 95.5%, 50% 100%,
    34% 95.5%, 9% 90.5%, 0% 86%, 0% 6.5%, 11% 6.5%, 22% 2.4%, 37% 2.4%);
  position: relative;
  display: block;
  aspect-ratio: 0.72;
  container-type: inline-size;
  color: var(--ink);
  text-decoration: none;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.5));
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-tap-highlight-color: transparent;
}
a.fut:active { transform: scale(0.96); }
@media (hover: hover) {
  a.fut:hover { transform: translateY(-4px) rotate(-1deg); }
}

.fut-silver {
  --ink: #2b3138;
  --rim: linear-gradient(160deg, #e8ecef, #87919a 45%, #dfe3e7 70%, #7b858e);
  --main: linear-gradient(160deg, #f7f9fa 0%, #c6cdd3 38%, #eef1f3 56%, #a1aab2 80%, #dde2e6 100%);
}
.fut-bronze {
  --ink: #3d1f0b;
  --rim: linear-gradient(160deg, #e2a77a, #81461f 45%, #d99d70, #6f3a18);
  --main: linear-gradient(160deg, #f3c9a3 0%, #cd8c5e 38%, #ecbb92 56%, #a3613a 80%, #d8a379 100%);
}
.fut-special {
  --ink: #f6d98a;
  --rim: linear-gradient(160deg, #fbe6a2, #9c7420 40%, #f2c14e 65%, #7d5a12);
  --main: radial-gradient(90% 55% at 50% 28%, rgba(242, 193, 78, 0.28), transparent 62%),
    linear-gradient(160deg, #34312a 0%, #121110 50%, #24201a 100%);
  --pattern: repeating-linear-gradient(125deg, rgba(242, 193, 78, 0.07) 0 1.5px, transparent 1.5px 8px);
}

.fut-face {
  position: absolute;
  inset: 0;
  clip-path: var(--shield);
  background: var(--rim);
}
.fut-face::before {
  /* face interna (o aro externo forma a moldura) */
  content: '';
  position: absolute;
  inset: 2.2cqw;
  clip-path: var(--shield);
  background: var(--pattern), var(--main);
}
.fut-face::after {
  /* brilho que atravessa a carta */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.5) 47%, transparent 56%) no-repeat;
  background-size: 260% 100%;
  background-position: 130% 0;
  mix-blend-mode: soft-light;
  animation: futShine 5s ease-in-out infinite;
  pointer-events: none;
}
.fut-special .fut-face::after { mix-blend-mode: screen; opacity: 0.55; animation-duration: 3.2s; }
.fut-bronze .fut-face::after { animation: none; }
@keyframes futShine {
  0%, 55% { background-position: 130% 0; }
  85%, 100% { background-position: -30% 0; }
}

.fut-side {
  position: absolute;
  z-index: 2;
  left: 9cqw;
  top: 14cqw;
  width: 20cqw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2cqw;
}
.fut-ovr {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19cqw;
  line-height: 0.82;
  letter-spacing: -0.02em;
}
.fut-pos {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 7.5cqw;
  line-height: 1;
  padding-bottom: 1.6cqw;
  border-bottom: 0.5cqw solid color-mix(in srgb, var(--ink) 35%, transparent);
}
.fut-flag { width: 10.5cqw; height: auto; border-radius: 0.6cqw; box-shadow: 0 0.3cqw 0.8cqw rgba(0, 0, 0, 0.25); }
.fut-club { width: 10cqw; height: 10cqw; }

.fut-photo {
  position: absolute;
  z-index: 1;
  right: 6cqw;
  top: 8cqw;
  width: 64cqw;
  height: 63cqw;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.fut-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-mask-image: radial-gradient(ellipse 62% 74% at 50% 42%, #000 62%, transparent 100%);
  mask-image: radial-gradient(ellipse 62% 74% at 50% 42%, #000 62%, transparent 100%);
}
.fut-silhouette {
  width: 74%;
  fill: currentColor;
  opacity: 0.22;
}

.fut-name {
  position: absolute;
  z-index: 2;
  top: 73cqw;
  left: 9cqw;
  right: 9cqw;
  padding-bottom: 1.6cqw;
  border-bottom: 0.5cqw solid color-mix(in srgb, var(--ink) 35%, transparent);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 10.5cqw;
  line-height: 1.05;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fut-attrs {
  position: absolute;
  z-index: 2;
  top: 88cqw;
  left: 14cqw;
  right: 12cqw;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.fut-col + .fut-col {
  border-left: 0.5cqw solid color-mix(in srgb, var(--ink) 30%, transparent);
  padding-left: 6cqw;
}
.fut-attr {
  display: flex;
  align-items: baseline;
  gap: 2.4cqw;
  font-size: 8.2cqw;
  line-height: 1.2;
}
.fut-attr b {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05em;
  min-width: 2ch;
  text-align: right;
}
.fut-attr span {
  font-family: var(--font-display);
  font-weight: 600;
  opacity: 0.85;
}

.fut-lg {
  width: min(76vw, 300px);
  margin: 4px auto 0;
}
.profile-card {
  padding: 8px 0 4px;
  perspective: 900px;
}
.profile-card .fut {
  animation: futIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes futIn {
  from { opacity: 0; transform: rotateY(-60deg) scale(0.85); }
  to { opacity: 1; transform: none; }
}
.tier-label {
  margin: 14px 0 10px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}
.back-link {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.stat-grid.six { grid-template-columns: repeat(3, 1fr); }
.profile-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}
.profile-form > div { display: flex; gap: 4px; }
.form-chip {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
}
.f-V { background: var(--neon); color: var(--neon-ink); }
.f-E { background: rgba(255, 255, 255, 0.18); color: var(--text); }
.f-D { background: var(--danger); color: #fff; }

.attr-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.attr-list li {
  display: grid;
  grid-template-columns: 40px 1fr 34px;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 4px;
}
.attr-k { grid-column: 1; grid-row: 1 / 3; font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; color: var(--gold); }
.attr-name { grid-column: 2; grid-row: 1; font-size: 0.8rem; color: var(--muted); }
.attr-list .meter-bar { grid-column: 2; grid-row: 2; }
.attr-list b { grid-column: 3; grid-row: 1 / 3; text-align: right; font-family: var(--font-display); font-size: 1.3rem; }

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.recent-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.88rem;
}
.recent-main { flex: 1; min-width: 0; color: var(--muted); }
.recent-score { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; }
.recent-ga { min-width: 52px; text-align: right; }

/* Ranking (artilharia / assistências) */
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rank-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
  text-decoration: none;
}
.rank-pos { width: 24px; text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; color: var(--muted); }
.rank-pos.top1 { color: var(--gold); }
.rank-pos.top2 { color: #cfd6dc; }
.rank-pos.top3 { color: #d29c72; }
.rank-avatar {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: var(--main);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
}
.rank-avatar img { width: 100%; height: 100%; object-fit: cover; }
.rank-name { flex: 1; min-width: 0; display: grid; }
.rank-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name small { color: var(--muted); font-size: 0.78rem; }
.rank-val { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; color: var(--neon); text-align: right; line-height: 1; }
.rank-val small { display: block; font-size: 0.65rem; color: var(--muted); font-weight: 600; text-transform: uppercase; }

/* ==========================================================================
   Juiz: placar, cronômetro, gols e rodízio
   ========================================================================== */

.tdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--tc, var(--t1)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35); flex: none; }
.c1 { --tc: var(--t1); }
.c2 { --tc: var(--t2); }
.c3 { --tc: var(--t3); }
.c4 { --tc: var(--t4); }
.c5 { --tc: var(--t5); }
.c6 { --tc: var(--t6); }
.c7 { --tc: var(--t7); }
.c8 { --tc: var(--t8); }
.c9 { --tc: var(--t9); }

.tteam { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
.tteam.big { font-family: var(--font-display); font-size: 1.25rem; text-transform: uppercase; }
.tteam.big .tdot { width: 14px; height: 14px; }
.tteam.win { color: var(--neon); }

.sb {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 14px 6px;
  margin-bottom: 14px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
}
.sb-team { display: grid; justify-items: center; gap: 2px; min-width: 0; }
.sb-score {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3.6rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.sb-mid { display: grid; justify-items: center; gap: 2px; }
.sb-half { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.clock {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.4);
}
.clock.xl { font-size: 2.6rem; }
.clock.warn { color: var(--gold); }
.clock.over { color: var(--danger); animation: pulseText 1s ease-in-out infinite; }
@keyframes pulseText { 50% { opacity: 0.55; } }

.goal-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.goal-btn {
  min-height: 84px;
  flex-direction: column;
  gap: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.7rem;
  border: 0;
  color: #0b1a05;
  background: var(--tc);
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.6), inset 0 -4px 0 rgba(0, 0, 0, 0.18);
}
.goal-btn small { font-size: 0.85rem; font-weight: 700; opacity: 0.8; }
.ref-controls { display: grid; gap: 10px; }
.ref-controls .btn-row .btn { min-height: 50px; }

.goal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.goal-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
}
.goal-min { width: 38px; font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; color: var(--gold); display: grid; line-height: 1; }
.goal-min small { font-size: 0.62rem; color: var(--muted); font-weight: 600; }
.goal-who { flex: 1; min-width: 0; display: grid; }
.goal-who small { color: var(--muted); font-size: 0.8rem; }
.center { text-align: center; }

.live-card { border-color: rgba(255, 100, 100, 0.35); }
.live-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--danger);
  vertical-align: middle;
  animation: liveDot 1.2s ease-in-out infinite;
}
@keyframes liveDot { 50% { opacity: 0.35; } }

.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.results li {
  display: grid;
  grid-template-columns: 30px 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
}
.results li .tteam:last-child { justify-self: end; }
.res-n { font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.res-score { font-family: var(--font-display); font-size: 1.3rem; white-space: nowrap; }

.next-match {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 8px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.3);
}
.vs { font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; color: var(--muted); }

.stepper { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stepper .btn { width: 56px; font-size: 1.5rem; }
.stepper span { font-size: 1.1rem; color: var(--muted); }
.stepper b { font-family: var(--font-display); font-size: 2rem; color: var(--text); }

.segmented.mini button { min-height: 32px; font-size: 0.78rem; padding: 0 8px; }

.order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.order-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid transparent;
}
.order-list li.starts { border-color: var(--line-strong); }
.order-pos { width: 26px; font-family: var(--font-display); font-weight: 800; color: var(--gold); }
.order-names { flex: 1; min-width: 0; font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-btns { display: flex; gap: 2px; }
.icon-btn.up:hover,
.icon-btn.up:focus-visible { background: rgba(198, 255, 61, 0.12); color: var(--neon); }
.icon-btn:disabled { opacity: 0.25; pointer-events: none; }

.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 4px; max-height: 55dvh; overflow-y: auto; }
.pick-grid .btn { min-height: 54px; font-size: 0.95rem; }
.pick-grid .wide { grid-column: 1 / -1; }

.tabbar .tab { font-size: 0.64rem; }

/* Atualização automática (polling): sem repetir animações de entrada */
.quiet .roster li,
.quiet .teams .team,
.quiet .teams li,
.quiet .profile-card .fut {
  animation: none;
}

/* Nome tocável na lista -> carta do jogador */
.name-btn {
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(198, 255, 61, 0.35);
  text-underline-offset: 3px;
}
.name-btn:hover,
.name-btn:focus-visible { text-decoration-color: var(--neon); }
.card-pop { padding: 4px 0 18px; perspective: 900px; }
.card-pop .fut { animation: futIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
.card-pop .fut-lg { width: min(64vw, 250px); }

/* Lista: convidados depois dos membros */
.roster li.guest-divider {
  min-height: 0;
  margin-top: 6px;
  padding: 6px 4px 2px;
  background: none;
  border: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9fdcff;
}
.notice.priority {
  background: rgba(79, 195, 255, 0.08);
  border-color: rgba(79, 195, 255, 0.35);
  color: #cdeeff;
  margin: 0 0 12px;
}

.tag.priority-tag {
  background: rgba(242, 193, 78, 0.16);
  color: var(--gold);
  white-space: nowrap;
}
.notice.priority b { color: #fff; }

/* Mapa do campo */
.map-wrap {
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.35);
}
.map-frame {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 0;
}

/* Links com cara de botão não usam a cor padrão de link */
a.btn { color: var(--text); }
a.btn.primary { color: var(--neon-ink); }
a.btn.whats { color: #062b14; }

/* ---------- Botão flutuante de localização ---------- */
.map-fab {
  position: fixed;
  z-index: 25;
  right: max(16px, calc((100vw - 560px) / 2 + 16px));
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  padding: 0 18px 0 14px;
  border: 0;
  border-radius: 999px;
  background: #f4fbe8;
  color: #0b1a05;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 24px -6px rgba(0, 0, 0, 0.65), 0 0 0 4px rgba(6, 18, 11, 0.6);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s;
  animation: fabIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.map-fab:active { transform: scale(0.94); }
.map-fab.open { transform: scale(0.85); opacity: 0; pointer-events: none; }
.map-fab-pin {
  font-size: 1.35rem;
  line-height: 1;
  animation: pinHop 2.8s ease-in-out infinite;
}
@keyframes fabIn {
  from { opacity: 0; transform: translateY(20px) scale(0.8); }
}
@keyframes pinHop {
  0%, 70%, 100% { transform: translateY(0); }
  80% { transform: translateY(-5px); }
  90% { transform: translateY(0); }
}
/* espaço para o botão não cobrir o fim da página */
.app { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 90px); }

/* ---------- Popup do mapa: cresce a partir do botão e encolhe de volta ---------- */
.map-modal .modal {
  max-width: 520px;
  padding-top: 16px;
  transform-origin: calc(100% - 50px) 100%;
  animation: mapPopIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.map-modal.closing .modal { animation: mapPopOut 0.26s cubic-bezier(0.55, 0, 1, 0.45) both; }
@keyframes mapPopIn {
  from { opacity: 0; transform: translateY(24px) scale(0.3); }
  to { opacity: 1; transform: none; }
}
@keyframes mapPopOut {
  to { opacity: 0; transform: translateY(24px) scale(0.3); }
}
.map-pop-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.map-pop-head h3 { margin-bottom: 2px; }
.map-pop-head .modal-sub { margin: 0 0 10px; color: var(--muted); }
.icon-btn.close-x {
  flex: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}
.icon-btn.close-x:hover,
.icon-btn.close-x:focus-visible { background: rgba(255, 255, 255, 0.14); color: var(--text); }
.map-modal .map-frame { aspect-ratio: 1 / 1; max-height: 52dvh; }

/* ---------- Saída animada de todos os popups ---------- */
.modal-backdrop.closing { animation: fadeOut 0.26s ease both; }
.modal-backdrop.closing .modal { animation: sheetOut 0.26s cubic-bezier(0.55, 0, 1, 0.45) both; }
.map-modal.closing .modal { animation-name: mapPopOut; }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes sheetOut { to { opacity: 0; transform: translateY(40px); } }
