:root {
  --bg: #020617;
  --panel: #0f172a;
  --panel2: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --line: #1f2937;
  --green: #14532d;
  --green2: #166534;
  --accent: #2563eb;
  --warn: #f59e0b;
  --danger: #dc2626;
  --ok: #16a34a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
#app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 12px 96px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 16px;
  margin-bottom: 14px;
}
.title-card { text-align: center; }
.title-card h1 { margin: 0 0 6px; font-size: 1.6rem; }
.subtle { color: var(--muted); font-size: 0.95rem; }
.section-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }
.grid { display: grid; gap: 10px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.btn {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 18px;
  background: #1d4ed8;
  color: white;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn.secondary { background: #334155; }
.btn.outline   { background: transparent; border: 1px solid #475569; }
.btn.warn      { background: var(--warn); color: #111827; }
.btn.danger    { background: var(--danger); }
.btn.ok        { background: var(--ok); }
.btn.edit      { background: #475569; color: white; }
.btn.small     { min-height: 40px; font-size: 0.88rem; padding: 6px 10px; }
.btn:disabled  { opacity: 0.45; cursor: not-allowed; }

label { display: block; margin: 0 0 6px; color: var(--muted); font-size: .9rem; }
.input, select, textarea {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid #334155;
  background: #020617;
  color: var(--text);
  padding: 10px 12px;
}
textarea { min-height: 88px; resize: vertical; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.list-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: var(--panel2);
  margin-bottom: 10px;
  position: relative;
}
.kv   { color: var(--muted); font-size: .9rem; }
.pill {
  display: inline-block;
  background: #1e293b;
  border-radius: 999px;
  padding: 6px 10px;
  margin: 4px 6px 0 0;
  font-size: .85rem;
}

/* ── Pitch ── */
.pitch {
  background: linear-gradient(180deg, var(--green2), var(--green));
  border-radius: 28px;
  border: 1px solid #166534;
  padding: 12px;
}
.pitch-row { display: grid; gap: 10px; margin-bottom: 14px; }
.pitch-btn {
  min-height: 78px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(2,6,23,.38);
  color: white;
  padding: 8px 6px;
  position: relative;
  cursor: pointer;
}
.pitch-pos      { font-size: .7rem; color: #bbf7d0; text-transform: uppercase; }
.pitch-initials { font-size: 1.1rem; font-weight: 800; margin-top: 4px; }
.pitch-name     { font-size: .72rem; margin-top: 4px; opacity: .9; }

.pitch-wrap {
  display: grid;
  grid-template-columns: 58px 1fr 58px;
  gap: 8px;
  align-items: stretch;
}
.formation-logo {
  width: 54px;
  height: 54px;
  align-self: center;
  justify-self: center;
  opacity: 0.92;
}

/* ── Score / clock ── */
.score { text-align: center; font-size: 2rem; font-weight: 900; }
.clock { font-size: 2rem; font-weight: 900; text-align: right; }

/* ── Sticky bar ── */
.sticky-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(2,6,23,.96);
  border-top: 1px solid var(--line);
  padding: 10px;
  backdrop-filter: blur(10px);
}
.sticky-inner {
  max-width: 460px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 8px;
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.68);
  padding: 14px;
  z-index: 100;
}
.modal {
  max-width: 460px;
  margin: 40px auto 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 16px;
  max-height: 85vh;
  overflow-y: auto;
}

/* ── Match log ── */
.match-log-item {
  border: 1px solid var(--line);
  background: var(--panel2);
  border-radius: 16px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: .9rem;
}
.section-subtitle {
  margin-top: 12px;
  margin-bottom: 6px;
  font-size: .9rem;
  font-weight: 700;
  color: var(--muted);
}

/* ── Utilities ── */
.center { text-align: center; }
.muted  { color: var(--muted); }
.hide   { display: none; }

/* ── Card states ── */
.pitch-btn.yellow-card,
.list-item.yellow-card {
  background: rgba(250, 204, 21, 0.22);
  border-color: #facc15;
  color: #fde68a;
}
.pitch-btn.yellow-card .pitch-pos,
.pitch-btn.yellow-card .pitch-name,
.pitch-btn.yellow-card .kv { color: #fde68a; }

.list-item.bench-subbed {
  background: rgba(147, 51, 234, 0.22);
  border-color: #9333ea;
  color: #e9d5ff;
}
.list-item.bench-subbed-yellow {
  background: linear-gradient(135deg, rgba(147,51,234,0.22), rgba(250,204,21,0.22));
  border-color: #facc15;
  color: #fde68a;
}
.list-item.bench-subbed-yellow .kv { color: #fde68a; }

.pitch-btn.red-card,
.list-item.red-card {
  background: rgba(239, 68, 68, 0.24);
  border-color: #ef4444;
  color: #fecaca;
  opacity: 0.72;
}
.pitch-btn.red-card .pitch-pos,
.pitch-btn.red-card .pitch-name,
.pitch-btn.red-card .kv,
.list-item.red-card .kv { color: #fecaca; }
.pitch-btn.red-card { cursor: not-allowed; pointer-events: none; }

/* ── Card icons ── */
.card-icon  { position: absolute; top: 6px; right: 8px; font-size: 14px; line-height: 1; }
.yellow-icon { right: 26px; }
.red-icon    { right: 8px; }

/* ── Action buttons ── */
.action-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 8px;
  font-size: 0.8rem;
  white-space: nowrap;
}
.list-item .row > div:last-child {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Match Report Cards ── */
.report-card {
  padding-bottom: 4px;
}

/* Tab button row */
.report-tab-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 6px;
  margin-top: 10px;
}
.report-tab-btn {
  min-height: 38px;
  border: 1px solid #334155;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.report-tab-btn.active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: white;
}
.report-tab-btn.danger-tab {
  border-color: #7f1d1d;
  color: #f87171;
  padding: 6px 10px;
}
.report-tab-btn.danger-tab:hover { background: rgba(220,38,38,.15); }

/* Tab panel container */
.report-tab-panel {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

/* Minutes played bar */
.mins-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mins-rank {
  font-size: 0.75rem;
  color: var(--muted);
  width: 18px;
  flex-shrink: 0;
  text-align: right;
}
.mins-name {
  font-size: 0.88rem;
  min-width: 90px;
  flex-shrink: 0;
}
.mins-bar-wrap {
  flex: 1;
  height: 8px;
  background: #1f2937;
  border-radius: 99px;
  overflow: hidden;
}
.mins-bar {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #1d4ed8, #38bdf8);
  border-radius: 99px;
  min-width: 4px;
}
.mins-value {
  font-size: 0.82rem;
  color: var(--muted);
  min-width: 44px;
  text-align: right;
  flex-shrink: 0;
}

/* Rating pill in report */
.report-rating-pill {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 48px;
  text-align: right;
}
.report-rating-pill.rated {
  color: #fbbf24;
}

/* ── Tiny btn ── */
.tiny-btn {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: .78rem;
}

/* ── Bench subbed ── */
.pitch-btn.subbed {
  background: rgba(168, 85, 247, 0.45);
  border: 2px solid #a855f7;
}

/* ════════════════════════════════════════
   TEAM SELECT SCREEN
═══════════════════════════════════════════ */
.team-select-header {
  background: linear-gradient(135deg, #0f172a, #1e3a5f);
  border-color: #1d4ed8;
}
.team-select-logo {
  font-size: 2.8rem;
  margin-bottom: 6px;
  display: block;
}

/* Team card on team-select screen */
.team-card {
  border-left: 3px solid var(--line);
  transition: border-color 0.15s;
}
.team-card-active {
  border-left: 3px solid #34d399;
  background: rgba(16,185,129,.05);
}

/* Active team badge */
.team-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(52,211,153,.18);
  color: #34d399;
  border: 1px solid #34d399;
  border-radius: 99px;
  padding: 2px 8px;
  letter-spacing: 0.03em;
}

/* Team logo column in team list */
.team-logo-col {
  width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 8px;
}
.team-logo-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255,255,255,.05);
}
.team-logo-placeholder {
  font-size: 2rem;
  opacity: 0.4;
}

/* Logo upload row in team form */
.logo-upload-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 6px;
  padding: 10px;
  border: 1px dashed #334155;
  border-radius: 14px;
  background: rgba(255,255,255,.02);
}
.logo-preview {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  flex-shrink: 0;
}
.logo-preview-empty {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px dashed #334155;
  border-radius: 10px;
  flex-shrink: 0;
}

/* Team logo in active title card */
.title-team-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin: 0 auto 8px;
  display: block;
  border-radius: 14px;
}

/* ── Stat highlight cards (top scorer / assists) ── */
.stat-highlight {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stat-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(255,255,255,.15));
}

/* ── Formation select on pitch ── */
.formation-select {
  width: 100%;
  min-height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(2,6,23,.7);
  color: #bbf7d0;
  padding: 6px 10px;
  font-weight: 700;
  font-size: .9rem;
}

/* ════════════════════════════════════════
   FULLSCREEN MODE
═══════════════════════════════════════════ */
.fs-wrap {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
}

/* Top bar: score | clock | period | controls */
.fs-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #0f172a;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.fs-score {
  font-size: 1.4rem;
  font-weight: 900;
  flex: 1;
}
.fs-clock {
  font-size: 1.4rem;
  font-weight: 900;
  color: #38bdf8;
}
.fs-period {
  font-size: .8rem;
  color: var(--muted);
  font-weight: 700;
  min-width: 24px;
}
.fs-controls {
  display: flex;
  gap: 6px;
}
.fs-btn {
  min-width: 36px;
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #1e293b;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fs-btn.exit-btn {
  border-color: #7f1d1d;
  color: #f87171;
}

/* Pitch area fills available space */
.fs-pitch-area {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 4px;
}
.fs-pitch-area .pitch {
  border-radius: 20px;
}
.fs-pitch-area .pitch-btn {
  min-height: 66px;
}

/* Bench strip */
.fs-bench {
  padding: 6px 10px 4px;
  flex-shrink: 0;
  border-top: 1px solid var(--line);
}
.fs-bench-label {
  font-size: .75rem;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.fs-bench .grid-3 {
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
}

/* Bottom action bar */
.fs-sticky {
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 6px;
  padding: 8px 10px;
  background: rgba(2,6,23,.98);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.fs-sticky .btn {
  min-height: 44px;
  font-size: .8rem;
}

/* Lock overlay */
.fs-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(2,6,23,.72);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  cursor: pointer;
}
.fs-lock-msg {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.5;
  pointer-events: none;
}
.fs-lock-msg span {
  display: block;
  font-size: .9rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 6px;
}
/* When locked, make fs-wrap position relative so overlay clips to it */
.fs-wrap.fs-locked {
  position: fixed;
}
.sub-badge {
  display: inline-block;
  background: #7c3aed;
  color: #ede9fe;
  border-radius: 99px;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  margin-left: 3px;
  vertical-align: middle;
  line-height: 1.4;
}

/* ── Responsive ── */
@media (max-width: 460px) {
  .action-btn { min-width: 0; }
}

.sub-badge{display:inline-block;margin-left:4px;padding:1px 6px;border-radius:999px;background:#1d4ed8;color:#fff;font-size:.7rem;font-weight:700;}
.stat-highlight{display:flex;align-items:center;gap:8px;}
.stat-icon{font-size:1.2rem;}

.tv-heat-wrap{display:flex;flex-direction:column;align-items:center}
.tv-screen{width:100%;max-width:360px;background:#0b1220;border:10px solid #1f2937;border-radius:18px;padding:10px;box-shadow:0 8px 24px rgba(0,0,0,.35)}
.tv-heat-pitch{position:relative;width:100%;aspect-ratio:0.72;background-color:#166534;border-radius:12px;overflow:hidden;background-repeat:no-repeat}
.tv-heat-pitch:before{content:"";position:absolute;inset:8px;border:2px solid rgba(255,255,255,.55);border-radius:4px}
.tv-halfway{position:absolute;left:8px;right:8px;top:50%;border-top:2px solid rgba(255,255,255,.5)}
.tv-center-circle{position:absolute;left:50%;top:50%;width:60px;height:60px;transform:translate(-50%,-50%);border:2px solid rgba(255,255,255,.5);border-radius:50%}
.tv-box{position:absolute;left:50%;transform:translateX(-50%);width:44%;height:16%;border:2px solid rgba(255,255,255,.5)}
.tv-box.top{top:8px;border-bottom:none}
.tv-box.bottom{bottom:8px;border-top:none}


.stat-icon-img{
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}
.rating-progress-wrap {
  width: 100%;
  height: 8px;
  background: #1f2937;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.rating-progress {
  display: block;
  height: 100%;
  border-radius: 99px;
  min-width: 4px;
}
.rating-progress.ok { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.rating-progress.good { background: linear-gradient(90deg, #2563eb, #38bdf8); }
.rating-progress.great { background: linear-gradient(90deg, #16a34a, #4ade80); }
.rating-progress-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
}


.inline-cleat-icon{
  width: 16px;
  height: 16px;
  object-fit: contain;
  vertical-align: -2px;
  margin-right: 4px;
}

.form-badge{
  display:inline-block;
  margin-left:8px;
  padding:4px 8px;
  border-radius:999px;
  font-size:.72rem;
  font-weight:700;
  vertical-align:middle;
}
.form-badge.hot{
  background: rgba(34,197,94,.16);
  color: #86efac;
  border: 1px solid rgba(34,197,94,.32);
}
.form-badge.cool{
  background: rgba(148,163,184,.12);
  color: #cbd5e1;
  border: 1px solid rgba(148,163,184,.24);
}

/* ════════════════════════════════════════
   PLAYER CHEMISTRY BAR
═══════════════════════════════════════════ */
.chem-bar-wrap {
  height: 6px;
  background: #1f2937;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.chem-bar {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #c084fc);
  border-radius: 99px;
  min-width: 4px;
}

/* ════════════════════════════════════════
   GOAL TIMING CHART
═══════════════════════════════════════════ */
.timing-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 90px;
  margin-top: 4px;
}
.timing-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.timing-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.timing-bar {
  width: 70%;
  background: linear-gradient(180deg, #2563eb, #38bdf8);
  border-radius: 4px 4px 0 0;
  min-height: 0;
  transition: height 0.3s;
}
.timing-bar.late {
  background: linear-gradient(180deg, #d97706, #fbbf24);
}
.timing-count {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  margin-top: 3px;
  min-height: 14px;
}
.timing-lbl {
  font-size: 0.58rem;
  color: var(--muted);
  text-align: center;
  opacity: 0.75;
  line-height: 1.2;
}

/* ════════════════════════════════════════
   FUT CARD
═══════════════════════════════════════════ */
.fut-modal-backdrop {
  align-items: center;
  justify-content: center;
}
.fut-card-wrap {
  perspective: 800px;
}
.fut-card {
  width: 240px;
  min-height: 360px;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.12),
    0 25px 60px rgba(0,0,0,0.75),
    inset 0 1px 0 rgba(255,255,255,0.25);
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, sans-serif;
}
.fut-card-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.fut-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.fut-card-ovr-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  z-index: 1;
}
.fut-card-ovr {
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.fut-card-pos {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.fut-card-flag {
  font-size: 1.1rem;
  margin-top: 4px;
}
.fut-card-img {
  flex: 1;
  height: 110px;
  position: relative;
  z-index: 1;
}
.fut-card-name {
  font-size: 1.15rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  line-height: 1;
  margin-bottom: 2px;
  z-index: 1;
  position: relative;
  text-transform: uppercase;
}
.fut-card-fullname {
  font-size: 0.65rem;
  text-align: center;
  color: rgba(255,255,255,0.55);
  margin-bottom: 8px;
  z-index: 1;
  position: relative;
}
.fut-card-divider {
  border-top: 1px solid;
  margin-bottom: 10px;
  z-index: 1;
  position: relative;
}
.fut-card-stats {
  display: flex;
  gap: 0;
  z-index: 1;
  position: relative;
  flex: 1;
}
.fut-stat-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.fut-stat-divider {
  width: 1px;
  border-left: 1px solid;
  margin: 0 10px;
  align-self: stretch;
}
.fut-stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fut-stat-val {
  font-size: 1.05rem;
  font-weight: 900;
  min-width: 26px;
  text-align: right;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.fut-stat-lbl {
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.fut-card-footer {
  display: flex;
  justify-content: space-around;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.12);
  z-index: 1;
  position: relative;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
}
