/* TEAM TACTICS — typical line-up + formation graphic, roster, recent-tactics strip.
   Mobile-first, FotMob feel. Uses ONLY the existing :root theme tokens (no new
   colour vars). Linked from src/views/team.ejs. */

.tactics-wrap { margin-top: .35rem; }

/* honesty banner shown when a block is squad-derived / awaiting the lineup feed */
.tac-note {
  margin: .5rem 0 0;
  font-size: .72rem;
  line-height: 1.45;
  color: var(--muted);
}
.tac-note .tac-flag {
  display: inline-block;
  font-weight: 700;
  color: var(--brand-3);
}

/* ---- formation header strip ---- */
.tac-head {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  margin-bottom: .65rem;
}
.tac-formation-badge {
  font-weight: 800;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  color: #04140d;
  background: var(--grad-brand);
  padding: .3rem .7rem;
  border-radius: 999px;
  font-size: .95rem;
  box-shadow: var(--ring);
}
.tac-formation-sub { color: var(--muted); font-size: .8rem; }

/* ---- the pitch ---- */
.tac-pitch {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    repeating-linear-gradient(
      0deg,
      rgba(22, 199, 132, .055) 0,
      rgba(22, 199, 132, .055) 8.33%,
      rgba(22, 199, 132, .02) 8.33%,
      rgba(22, 199, 132, .02) 16.66%),
    radial-gradient(120% 80% at 50% 0%, var(--surface-2), var(--surface));
  overflow: hidden;
  box-shadow: var(--ring);
}
/* pitch markings */
.tac-pitch::before { /* halfway line */
  content: "";
  position: absolute;
  left: 6%; right: 6%; top: 50%;
  height: 1px;
  background: rgba(238, 243, 248, .14);
}
.tac-pitch::after { /* centre circle */
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 22%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(238, 243, 248, .14);
  border-radius: 50%;
}
.tac-box {
  position: absolute;
  left: 28%; right: 28%;
  height: 11%;
  border: 1px solid rgba(238, 243, 248, .12);
  border-top: 0;
}
.tac-box.bottom { bottom: 0; border-bottom: 0; border-top: 1px solid rgba(238, 243, 248, .12); }
.tac-box.top { top: 0; }

/* a player dot */
.tac-player {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 19%;
  max-width: 78px;
  text-align: center;
  z-index: 2;
}
.tac-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.05rem;
  height: 2.05rem;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--brand);
  color: var(--text);
  font-weight: 800;
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-md);
}
.tac-name {
  display: block;
  margin-top: .2rem;
  font-size: .62rem;
  line-height: 1.15;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
/* owned-player gild — gold dot + star */
.tac-player.is-owned .tac-dot {
  border-color: var(--warn);
  background: rgba(245, 185, 33, .14);
}
.tac-player.is-owned .tac-name { color: var(--warn); }
.tac-own-star { color: var(--warn); margin-left: .12rem; }

/* ---- roster ---- */
.tac-roster { margin-top: 1.1rem; }
.tac-roster-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}
.tac-pos-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: .6rem .7rem;
  box-shadow: var(--ring);
}
.tac-pos-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand-3);
  margin: 0 0 .5rem;
}
.tac-pos-count {
  margin-left: auto;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0;
}
.tac-roster-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.tac-roster-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .32rem .25rem;
  border-radius: 8px;
}
.tac-roster-row + .tac-roster-row { border-top: 1px solid var(--line); }
.tac-rnum {
  flex: 0 0 1.6rem;
  text-align: center;
  font-weight: 800;
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.tac-rname { font-weight: 600; font-size: .9rem; color: var(--text); }
.tac-rage { margin-left: auto; color: var(--muted); font-size: .76rem; }
.tac-roster-row.is-owned { background: rgba(245, 185, 33, .08); }
.tac-roster-row.is-owned .tac-rname { color: var(--warn); }

/* ---- recent tactics strip ---- */
.tac-recent { margin-top: 1.1rem; }
.tac-usage-bars {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin: .25rem 0 .9rem;
}
.tac-usage-row {
  display: grid;
  grid-template-columns: 3.4rem 1fr 2.6rem;
  align-items: center;
  gap: .55rem;
}
.tac-usage-form {
  font-weight: 800;
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.tac-usage-track {
  height: .55rem;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.tac-usage-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--grad-brand);
}
.tac-usage-pct {
  text-align: right;
  color: var(--muted);
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
}

.tac-timeline {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding: .2rem .1rem .5rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.tac-tl-card {
  flex: 0 0 auto;
  min-width: 8.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: .5rem .6rem;
  box-shadow: var(--ring);
}
a.tac-tl-card { color: inherit; text-decoration: none; display: block; }
a.tac-tl-card:hover { border-color: var(--brand); }
.tac-tl-form {
  font-weight: 800;
  font-size: .95rem;
  color: var(--brand-3);
  font-variant-numeric: tabular-nums;
}
.tac-tl-opp { font-size: .76rem; color: var(--text); margin-top: .15rem; }
.tac-tl-meta { font-size: .68rem; color: var(--muted); margin-top: .1rem; }
.tac-tl-venue {
  display: inline-block;
  font-weight: 700;
  font-size: .6rem;
  padding: .04rem .3rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--muted);
}

/* tighten on the smallest screens */
@media (max-width: 420px) {
  .tac-name { font-size: .56rem; }
  .tac-dot { width: 1.85rem; height: 1.85rem; font-size: .76rem; }
}

/* roomier on tablet+ : roster in two columns, pitch + roster can sit together */
@media (min-width: 640px) {
  .tac-roster-grid { grid-template-columns: 1fr 1fr; }
}
