:root {
  --lime: #d4ff00;
  --lime-deep: #9ed000;
  --pink: #e10a7d;
  --ink: #111111;
  --panel: #101010;
  --text: #f4f6ef;
  --muted: #a4aa9c;
  --line: rgba(255, 255, 255, 0.08);
  --display: "Unbounded", "Arial Black", sans-serif;
  --sans: "Manrope", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--lime);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
}

body::before,
body::after {
  content: "";
  position: fixed;
  top: 0;
  bottom: 0;
  width: 16px;
  background: var(--pink);
  z-index: 40;
  pointer-events: none;
}

body::before { left: 0; }
body::after { right: 0; }

body.lock { overflow: hidden; }

::selection {
  background: var(--ink);
  color: var(--lime);
}

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

.wrap {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 8px 34px 8px;
  flex: 1;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 12px 0 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand img {
  width: 112px;
  height: 112px;
  flex: none;
}

.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.brand p {
  margin: 6px 0 0;
  font-weight: 700;
}

.season {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.season span {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 8px;
  flex: none;
}

.btn {
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  border-radius: 999px;
  padding: 9px 14px;
  white-space: nowrap;
}

.btn:hover { background: rgba(0, 0, 0, 0.06); }

.btn.primary {
  background: var(--ink);
  color: var(--lime);
}

.btn.primary:hover { background: #000; }

.btn:focus-visible,
.chip:focus-visible,
.viewtoggle button:focus-visible,
.player-btn:focus-visible,
.menu-pop button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.menu { position: relative; }

.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--ink);
  color: var(--lime);
  min-width: 240px;
  padding: 6px;
  border-radius: 14px;
  z-index: 30;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.menu-pop button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  font-weight: 800;
  border-radius: 10px;
  padding: 10px 12px;
}

.menu-pop button:hover { background: #242424; }
.menu-pop button.danger { color: var(--pink); }

.scorebug {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kpi {
  appearance: none;
  background: var(--ink);
  color: white;
  border: 0;
  border-radius: 16px;
  text-align: left;
  padding: 12px 14px 11px;
  box-shadow: inset 4px 0 0 var(--pink);
  min-width: 0;
}

.kpi:hover { outline: 2px solid var(--ink); outline-offset: 2px; }

.kpi span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c8c8c8;
}

.kpi strong {
  display: block;
  margin-top: 4px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.08;
  color: var(--lime);
  white-space: normal;
  overflow-wrap: break-word;
}

.kpi em {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-weight: 700;
  font-size: 13px;
  color: #ececec;
}

.kpi em.pos { color: var(--lime); }
.kpi em.neg { color: #ff8abf; }

.panel {
  background: var(--panel);
  color: var(--text);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.panel-accent { height: 5px; background: var(--pink); }

.panel-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #0c0c0c;
  border-bottom: 1px solid var(--line);
}

.search {
  display: flex;
  align-items: center;
  background: #1b1b1b;
  border-radius: 999px;
  padding: 0 12px;
  min-width: 200px;
  flex: 1;
}

.search:focus-within { outline: 2px solid var(--lime); }

.search input {
  width: 100%;
  background: transparent;
  border: 0;
  color: white;
  padding: 10px 0;
}

.search input:focus { outline: none; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip, .viewtoggle button, .textbtn, .mini {
  border: 1px solid #3a3a3a;
  background: transparent;
  color: #eee;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.chip.on, .viewtoggle button.on {
  background: var(--lime);
  color: var(--ink);
  border-color: var(--lime);
}

.viewtoggle { display: flex; gap: 6px; margin-left: auto; }

.table-scroll { overflow: auto; }

table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

caption.sr-only { position: absolute; }

th, td {
  padding: 11px 8px;
  text-align: right;
  white-space: nowrap;
  background: #101010;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0c0c0c;
  color: var(--lime);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

th button {
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  font-weight: 800;
  padding: 0;
}

th button.on::after { content: " ↓"; }
th button.on.asc::after { content: " ↑"; }

tbody tr:nth-child(even) td { background: #161616; }

th.who, td.who {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  min-width: 148px;
  box-shadow: 8px 0 10px -10px rgba(0, 0, 0, 0.9);
}
th.who { z-index: 3; background: #0c0c0c; }
tbody tr:nth-child(odd) td.who { background: #101010; }
tbody tr:nth-child(even) td.who { background: #161616; }
tfoot td.who { background: #0c0c0c; }

.jno {
  display: inline-block;
  min-width: 1.7em;
  margin-right: 6px;
  font-family: var(--display);
  font-weight: 700;
  color: var(--lime);
}
.jname { font-weight: 800; }

tbody tr.player-row { cursor: pointer; }
tbody tr.player-row:focus-visible td.who { box-shadow: inset 0 0 0 2px var(--lime); }

.pos {
  display: inline-block;
  min-width: 36px;
  text-align: center;
  border: 1px solid rgba(212, 255, 0, 0.4);
  color: var(--lime);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 6px;
}

.pos.gk {
  background: var(--pink);
  border-color: var(--pink);
  color: #111;
}

td.num { position: relative; }
td.num .bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(212, 255, 0, 0.22);
  z-index: 0;
}
td.assists .bar { background: rgba(225, 10, 125, 0.28); }
td.ga .bar { background: rgba(212, 255, 0, 0.55); }
td.ga .val { font-weight: 800; }
td.num .val { position: relative; z-index: 1; }

.cardchip {
  display: inline-block;
  width: 8px;
  height: 12px;
  border-radius: 1px;
  margin-right: 5px;
  vertical-align: -1px;
}
.cardchip.yc { background: #ffe14a; }
.cardchip.rc { background: var(--pink); }

.form { display: inline-flex; gap: 4px; justify-content: flex-end; }
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #5c5c5c;
}
.dot.hot { background: var(--lime); }
.dot.ok { background: #f4f6ef; }
.dot.bad { background: var(--pink); }
.dot.none { background: transparent; box-shadow: inset 0 0 0 1.5px #666; }

tr.top1 td.who { box-shadow: inset 4px 0 0 var(--lime); }
tr.top2 td.who { box-shadow: inset 4px 0 0 #fff; }
tr.top3 td.who { box-shadow: inset 4px 0 0 var(--pink); }

@media (hover: hover) {
  tbody tr:hover td { background: #1c260f; }
  tbody tr:hover td.who { background: #1c260f; }
}

tfoot td {
  background: #0c0c0c;
  border-top: 2px solid var(--lime);
  font-weight: 800;
  color: white;
}

.legend {
  margin: 0;
  padding: 10px 14px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.empty {
  padding: 42px 20px 48px;
  text-align: center;
}

.empty-score {
  font-family: var(--display);
  font-weight: 800;
  font-size: 84px;
  line-height: 0.85;
  letter-spacing: -0.06em;
  color: rgba(212, 255, 0, 0.28);
}

.empty h2 { margin: 8px 0; font-size: 28px; }
.empty p { margin: 0 auto 18px; max-width: 460px; color: #d5d5d5; }

.empty-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 14px;
}

.mcard {
  background: #161616;
  border: 1px solid #2c2c2c;
  border-radius: 16px;
  padding: 14px;
}

.mdate { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }

.mscore {
  font-family: var(--display);
  font-size: 42px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--lime);
  margin: 4px 0;
}

.mcard h3 { margin: 0 0 6px; font-size: 18px; }
.mcard p { margin: 0 0 10px; color: #d7d7d7; font-size: 14px; }

.madd {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 168px;
  height: 100%;
  background: transparent;
  color: var(--lime);
  border: 2px dashed rgba(212, 255, 0, 0.55);
  border-radius: 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}
.madd-plus {
  font-family: var(--display);
  font-size: 76px;
  line-height: 0.8;
}
.madd-label { font-size: 14px; letter-spacing: 0.04em; }
.madd:hover, .madd:focus-visible { background: rgba(212, 255, 0, 0.08); border-color: var(--lime); }
.mactions { display: flex; gap: 6px; }

.tagline {
  margin: 18px 0 2px;
  padding: 0 12px;
  text-align: center;
  font-family: var(--display);
  font-weight: 500;
  font-style: italic;
  font-synthesis: style;
  transform: skewX(-12deg);
  font-size: clamp(22px, 3.6vw, 36px);
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-transform: uppercase;
  color: var(--ink);
}

.hem {
  height: 96px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='72' height='96' viewBox='0 0 72 96' fill='none'><polyline points='0,6 9,14 18,6 27,14 36,6 45,14 54,6 63,14 72,6' stroke='%23111' stroke-width='3'/><polyline points='0,18 9,26 18,18 27,26 36,18 45,26 54,18 63,26 72,18' stroke='%23E10A7D' stroke-width='3'/><polyline points='0,30 9,38 18,30 27,38 36,30 45,38 54,30 63,38 72,30' stroke='%23111' stroke-width='3'/><polyline points='0,42 9,50 18,42 27,50 36,42 45,50 54,42 63,50 72,42' stroke='%236f9000' stroke-width='3'/><polyline points='0,54 9,62 18,54 27,62 36,54 45,62 54,54 63,62 72,54' stroke='%23E10A7D' stroke-width='3'/><polyline points='0,66 9,74 18,66 27,74 36,66 45,74 54,66 63,74 72,66' stroke='%23111' stroke-width='4'/><polyline points='0,78 9,86 18,78 27,86 36,78 45,86 54,78 63,86 72,78' stroke='%23E10A7D' stroke-width='4'/></svg>");
  background-size: 72px 96px;
  background-repeat: repeat-x;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: var(--lime);
  font-weight: 800;
  padding: 12px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 90;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal-back {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 28px 18px;
  overflow: auto;
}

.sheet {
  position: relative;
  width: min(980px, 100%);
  background: #121212;
  color: var(--text);
  border-radius: 22px;
  outline: 3px solid var(--lime);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 56px);
  color-scheme: dark;
}

.sheet.narrow { width: min(640px, 100%); }
.pass-error { min-height: 1.2em; margin: 8px 0 0; color: var(--pink); font-weight: 800; }
.sheet.shirt {
  width: min(560px, 100%);
  background: var(--lime);
  color: var(--ink);
  outline-color: var(--ink);
  color-scheme: light;
}

.sheet-head, .sheet-foot { padding: 16px 18px; }
.sheet-head { padding-right: 56px; }
.sheet-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.sheet-lead { margin: 6px 0 0; color: var(--muted); font-size: 13px; font-weight: 600; }

.sheet-body { overflow: auto; padding: 6px 18px 16px; }

.sheet-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #2a2a2a;
  background: #0e0e0e;
  border-radius: 0 0 20px 20px;
}

.sheet.shirt .sheet-foot {
  background: #c6f000;
  border-top-color: rgba(0, 0, 0, 0.15);
}

.foot-right, .lineup-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.hint { color: var(--muted); font-size: 12px; font-weight: 700; }

.close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: transparent;
  font-size: 22px;
  line-height: 1;
}

.btn-lime, .btn-ghost, .btn-danger, .mini {
  border-radius: 999px;
  font-weight: 800;
  padding: 10px 14px;
}

.btn-lime {
  background: var(--lime);
  color: var(--ink);
  border: 2px solid var(--lime);
}

.btn-ghost {
  background: transparent;
  color: white;
  border: 2px solid #444;
}

.sheet.shirt .btn-ghost {
  color: var(--ink);
  border-color: var(--ink);
}

.btn-danger {
  background: transparent;
  color: var(--pink);
  border: 2px solid var(--pink);
}

.sheet :focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }
.sheet.shirt :focus-visible { outline-color: var(--ink); }

.match-meta {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 88px 88px;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c9c9c9;
}

.field input, .field select, .roster-row input, .roster-row select, .shirt-name, .shirt-num, .shirt-pos {
  background: #1c1c1c;
  color: white;
  border: 1px solid #343434;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.field input:focus, .field select:focus, .roster-row input:focus, .roster-row select:focus {
  border-color: var(--lime);
  outline: none;
}

.note { margin-top: 10px; }

.lineup-tools { margin: 14px 0 8px; }
.played-count { margin-left: auto; color: var(--lime); font-size: 13px; font-weight: 800; }

.line {
  display: grid;
  grid-template-columns: 44px minmax(150px, 1.5fr) repeat(2, minmax(72px, 0.45fr));
  gap: 6px;
  align-items: center;
  padding: 4px 0;
}

.line.head {
  position: sticky;
  top: 0;
  background: #141414;
  z-index: 1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 0;
}

.who { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.who b { font-family: var(--display); color: var(--lime); font-size: 18px; }
.who span { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--muted); font-weight: 800; }

.play { display: flex; justify-content: center; }
.play input { width: 18px; height: 18px; accent-color: var(--lime); }

.stat { position: relative; }
.stat span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.stat input {
  width: 100%;
  background: #1c1c1c;
  color: white;
  border: 1px solid #343434;
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  font-weight: 800;
}
.stat input:focus { outline: none; border-color: var(--lime); }
.stat input::placeholder { color: #555; }
.line.off { opacity: 0.42; }

.roster-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 40px;
  gap: 8px;
  margin-bottom: 8px;
}

.icon-btn {
  width: 40px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid #444;
  background: transparent;
  color: var(--pink);
  font-size: 22px;
}

.dup { min-height: 1.2em; margin: 4px 0 0; color: var(--pink); font-weight: 800; font-size: 13px; }

.shirt-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.giant {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(72px, 14vw, 120px);
  line-height: 0.8;
  letter-spacing: -0.06em;
}

.shirt-name, .shirt-num, .shirt-pos {
  width: 100%;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  padding: 4px 0;
}

.shirt-name {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.03em;
}

.shirt-row { display: grid; grid-template-columns: 88px; gap: 10px; margin-top: 8px; }

.statgrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.statgrid div {
  background: var(--ink);
  color: var(--lime);
  border-radius: 12px;
  padding: 8px 10px;
}

.statgrid strong {
  display: block;
  font-family: var(--display);
  font-size: 26px;
  line-height: 1;
}

.statgrid span {
  display: block;
  margin-top: 4px;
  color: white;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.history-title {
  margin: 18px 0 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.history { list-style: none; margin: 6px 0 0; padding: 0; }
.history li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.16);
}
.history li b { font-family: var(--display); }
.sheet.shirt .textbtn {
  color: var(--ink);
  border-color: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 800px) {
  .extra { display: none; }
  table { min-width: 0; }
}

@media (max-width: 900px) {
  .actions { flex-wrap: wrap; }
  body::before, body::after { width: 8px; }
  .wrap { padding-left: 18px; padding-right: 18px; }
  .top { flex-direction: column; align-items: stretch; }
  .actions { justify-content: flex-start; padding-bottom: 0; }
  .scorebug { grid-template-columns: 1fr 1fr; }
  .kpi strong { font-size: 22px; }
  .brand img { width: 88px; height: 88px; }
  .panel-bar { flex-wrap: wrap; }
  .viewtoggle { margin-left: 0; }
  .match-meta { grid-template-columns: 1fr 1fr; }
  .match-meta .opp { grid-column: 1 / -1; }
  .line.head { display: none; }
  .line {
    grid-template-columns: 32px repeat(2, minmax(0, 1fr));
    border-top: 1px solid #2a2a2a;
    padding: 10px 0;
  }
  .line .who { grid-column: 2 / -1; }
  .stat span {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    display: block;
    margin-bottom: 3px;
    color: #aaa;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-align: center;
  }
  .roster-row { grid-template-columns: 64px minmax(0, 1fr) 40px; }
  .statgrid { grid-template-columns: 1fr 1fr; }
  .played-count { margin-left: 0; }
}

th.amp, td.amp, th.dots, td.dots { text-align: center; }

.panel :focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

@media print {
  body { background: white; }
  body::before, body::after, .hem, .actions, .panel-bar, .tagline, .toast { display: none !important; }
  .panel { box-shadow: none; color: black; }
  th, td, tfoot td, th.who, td.who { background: white !important; color: black; position: static; }
  .jno, .kpi strong { color: black; }
  .scorebug { break-after: avoid; }
  .kpi { box-shadow: none; border: 1px solid #111; }
}
