:root {
  --bg: #0c1210; --panel: #141d1a; --panel2: #1a2521; --line: #263631;
  --ink: #e9f2ee; --muted: #8fa39c; --accent: #4ade80; --accent2: #59c3e0;
  --danger: #f87171; --warn: #facc15;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: 12px;
}
.wrap { max-width: 480px; margin: 0 auto; padding: 16px 14px 24px; position: relative; }
@media (min-width: 900px) { .wrap { max-width: 760px; } }

a.back { display:inline-flex; align-items:center; gap:8px; color:var(--ink); text-decoration:none; font-size:15px; font-weight:600; margin-bottom:20px; padding:8px 14px; border:1px solid var(--line); border-radius:999px; background:var(--panel); transition:border-color .15s ease, transform .05s ease; }
a.back:hover { border-color:var(--accent); transform:translateX(-2px); }

.appHeader h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.01em; }
.appHeader p { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 12px; transition: border-color .3s ease, box-shadow .3s ease;
}
.card.flash-highlight { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.25); }
.card h2, .card h3 { margin: 0 0 10px; font-size: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

button, .btn {
  background: var(--panel2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; font-size: 14px; cursor: pointer;
  font-weight: 600;
}
button:hover, .btn:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #06170f; border-color: var(--accent); }
button.primary:hover { filter: brightness(1.08); }
button.danger { border-color: var(--danger); color: var(--danger); background: transparent; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
select, input[type="text"], input[type="search"], input[type="number"] {
  background: var(--panel2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 16px;
}

.tabbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  background: rgba(20, 29, 26, 0.97); border-bottom: 1px solid var(--line);
  border-radius: 12px;
  backdrop-filter: blur(6px);
  padding: 5px;
  margin: 0 0 14px;
}
.tabbtn {
  position: relative;
  background: none; border: none; color: var(--muted); font-size: 10px; font-weight: 600;
  padding: 9px 1px; border-radius: 9px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 360px) {
  .tabbar { grid-template-columns: repeat(7, minmax(42px, 1fr)); overflow-x: auto; }
}
.tabbtn.active { color: var(--accent); background: var(--panel2); }
.tabBadge {
  position: absolute; top: 3px; right: 10%;
  min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px;
  background: var(--danger); color: #2a0a0a; font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}

/* ---- New career ---- */
.clubList { max-height: 60vh; overflow-y: auto; }
.clubRow {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 8px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.clubRow:hover { background: var(--panel2); }
.clubRow .swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; margin-right: 8px; vertical-align: middle; }

/* ---- squad / player cards ---- */
.playerRow {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.playerRow:last-child { border-bottom: none; }
.playerRow:hover { background: var(--panel2); }
.pip { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.pip.good { background: var(--accent); }
.pip.ok { background: var(--warn); }
.pip.bad { background: var(--danger); }
.condList { display: flex; flex-direction: column; gap: 4px; }
.condRow {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px;
  border-left: 3px solid var(--line); border-radius: 6px; background: var(--panel2);
  cursor: pointer; font-size: 13px;
}
.condRow.good { border-left-color: var(--accent); }
.condRow.ok { border-left-color: var(--warn); }
.condRow.bad { border-left-color: var(--danger); }
.condRow .pos { color: var(--muted); font-size: 11.5px; width: 26px; flex: none; }
.condRow .name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playerRow .name { font-weight: 600; flex: 1; min-width: 0; }
.playerRow2 {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.playerRow2:last-child { border-bottom: none; }
.playerRow2[data-action]:hover { background: var(--panel2); cursor: pointer; }
.playerRow2 .pip { margin-top: 4px; }
.playerRow2Body { flex: 1; min-width: 0; }
.playerRow2Body .name { font-weight: 600; }
.playerRow2Sub { margin-top: 3px; }
.traitTag.muted { color: var(--muted); }
.playerRow .pos { color: var(--muted); font-size: 12px; width: 30px; }
.stars { letter-spacing: 1px; color: var(--accent); white-space: nowrap; }
.chipRow { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; }
.chip {
  border: 1px solid var(--line); background: var(--panel2); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 12.5px; white-space: nowrap; cursor: pointer;
}
.chip.active { color: var(--bg); background: var(--accent); border-color: var(--accent); font-weight: 700; }

/* ---- tactics layout: narrow pitch column + wider roles column ---- */
.tacticsTopRow { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 0; }
.pitchCard { flex: 0 0 180px; max-width: 180px; }
.rolesCard { flex: 1 1 260px; min-width: 240px; }
@media (max-width: 480px) {
  .tacticsTopRow { flex-direction: column; }
  .pitchCard { flex-basis: auto; max-width: 240px; margin: 0 auto; }
  .rolesCard { flex-basis: auto; width: 100%; }
}
.pitch {
  position: relative; background: linear-gradient(#183a24, #12291a);
  border: 1px solid var(--line); border-radius: 10px; aspect-ratio: 3/4; margin-bottom: 4px;
}
.slotChip {
  position: absolute; transform: translate(-50%, -50%);
  width: 40px; text-align: center; font-size: 8.5px; cursor: pointer; line-height: 1.2;
}
.slotChip .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--panel); border: 2px solid var(--accent); margin: 0 auto 1px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 8.5px; }
.slider-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.slider-row label { width: 110px; font-size: 12.5px; color: var(--muted); flex: none; }
.slider-row input[type=range] { flex: 1; }
.triggerRow { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; font-size: 12.5px; }

/* ---- player picker sheet (tap a tactics slot) ---- */
.pickerOverlay {
  position: fixed; inset: 0; background: rgba(6, 10, 8, 0.85); z-index: 55;
  display: flex; align-items: flex-end; justify-content: center;
}
.pickerSheet {
  width: 100%; max-width: 480px; max-height: 82vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px 18px 0 0;
  padding: 16px;
}
.pickerHeader { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pickerRow {
  display: flex; align-items: center; gap: 8px; padding: 10px 6px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.pickerRow:hover { background: var(--panel2); }
.pickerRow .name { font-weight: 600; flex: 1; min-width: 0; }
.pickerRow .fitTag { font-size: 11px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pickerRow .fitTag.natural { color: var(--accent); border-color: var(--accent); }
.pickerRow .fitTag.accomplished { color: var(--accent2); border-color: var(--accent2); }

/* ---- glossary: always-available floating button + panel ---- */
.glossaryFab {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  width: 46px; height: 46px; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; line-height: 1;
  background: var(--accent); color: #06170f; border: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.glossaryFab:hover { filter: brightness(1.08); }
.glossaryEntry { padding: 10px 6px; border-bottom: 1px solid var(--line); border-radius: 6px; }
.glossaryEntry:last-child { border-bottom: none; }
.glossaryEntry p { margin: 4px 0 0; }
.glossaryEntry.highlight { background: rgba(74, 222, 128, 0.10); border: 1px solid var(--accent); }

/* ---- transfers ---- */
.bidRow { display:flex; gap:8px; align-items:center; margin-top: 6px; }

/* ---- week report swipe stack ---- */
.reportOverlay {
  position: fixed; inset: 0; background: rgba(6, 10, 8, 0.92); z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px;
}
.reportStack { width: 100%; max-width: 420px; }
.reportCard {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 24px 20px; min-height: 320px; display: flex; flex-direction: column; justify-content: center;
}
.reportCard h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent2); }
.reportCard .big { font-size: 30px; font-weight: 800; margin: 8px 0; }
.reportNav { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.reportDots { display: flex; gap: 6px; }
.reportDots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.reportDots span.active { background: var(--accent); }

/* ---- misc ---- */
.about { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.about h2 { font-size: 18px; margin: 0 0 10px; }
.about p { color: var(--muted); font-size: 13.5px; margin: 0 0 10px; }
footer { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 24px; }
footer a { color: var(--muted); }
.stat-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.stat-table th, .stat-table td { padding: 5px 4px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.stat-table th { color: var(--muted); font-weight: 600; }
.you-row { background: rgba(74, 222, 128, 0.08); }
.searchbar { display: flex; gap: 8px; margin-bottom: 10px; }
.searchbar input { flex: 1; }
.loading { text-align: center; padding: 40px 0; color: var(--muted); }
.progressText { margin-top: 10px; font-size: 13px; }
.field-list { display: flex; flex-direction: column; gap: 6px; }
.kv { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.statGroupHeading { margin: 14px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent2); border-top: 1px solid var(--line); padding-top: 10px; }
.statGroupHeading:first-of-type { border-top: none; padding-top: 0; margin-top: 6px; }
.glossaryLink {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; padding: 0; border-radius: 50%;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
  font-size: 10px; font-weight: 700; cursor: pointer; vertical-align: middle;
}
.statFilterGrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.statFilterField { display: flex; flex-direction: column; gap: 3px; }
.statFilterField input { width: 100%; }
.traitTag { display: inline-block; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; font-size: 11.5px; margin: 2px 4px 2px 0; color: var(--accent2); }
