:root {
  --ink: #f4f6f2;
  --dim: #a9b4ad;
  --panel: rgba(12, 20, 16, 0.82);
  --line: rgba(255, 255, 255, 0.14);
  --accent: #ffe14d;
  --blue: #3d7cf0;
  --red: #e2483f;
  /* The match graphics, as on the sports games: dark translucent panels, white type, a thin teal line for
     stamina, and a deep purple for the clock tab. */
  --tv: rgba(14, 20, 20, 0.82);
  --tv-edge: rgba(255, 255, 255, 0.12);
  --teal: #2fd3c6;
  --comp: #36104f;
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1a12; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#hud, #screens { position: fixed; inset: 0; pointer-events: none; }
#screens > * { pointer-events: auto; }
button, select, input { font: inherit; color: inherit; }

/* Score bug, top left where the sports games put it, small and flat: each club's colour holds its code and
   its score, the competition's badge sits between, and the clock hangs from the badge in a purple tab.
   Every corner of the overlay scales from its own anchor by --hud-scale, so a larger overlay grows inward. */
.board {
  position: absolute; top: 5.5vh; left: 4.6vw; width: 262px; display: grid; grid-template-columns: 1fr 34px 1fr; justify-items: stretch;
  transform: scale(var(--hud-scale, 1)); transform-origin: top left;
  font-variant-numeric: tabular-nums; font-weight: 800; text-transform: uppercase;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4));
}
.board .line { display: contents; }
.board .seg {
  display: flex; align-items: center; gap: 12px; height: 30px; padding: 0 14px; color: #fff; font-size: 15px; letter-spacing: 0.04em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 68%, #000));
}
.board .seg.home { justify-content: flex-start; padding-right: 20px; border-radius: 4px 0 0 4px; clip-path: polygon(0 0, 100% 0, calc(100% - 9px) 100%, 0 100%); }
.board .seg.away { justify-content: flex-end; padding-left: 20px; border-radius: 0 4px 4px 0; clip-path: polygon(9px 0, 100% 0, 100% 100%, 0 100%); background: linear-gradient(270deg, var(--c), color-mix(in srgb, var(--c) 68%, #000)); }
.board .score { font-size: 21px; font-weight: 900; }
.board .badge {
  align-self: center; justify-self: center; z-index: 1; width: 40px; height: 40px; margin: -5px 0; display: grid; place-items: center;
  border-radius: 50%; background: radial-gradient(circle at 35% 28%, #6b3399, var(--comp)); color: #fff; font-size: 18px; font-weight: 900;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.92), 0 2px 6px rgba(0, 0, 0, 0.4);
}
.board .clocktab { grid-column: 2; justify-self: center; margin-top: 5px; padding: 2px 12px 3px; background: var(--comp); color: #fff; font-size: 13px; letter-spacing: 0.06em; border-radius: 0 0 7px 7px; white-space: nowrap; }
.board .you { grid-column: 1 / -1; justify-self: start; margin-top: 6px; font-size: 10px; letter-spacing: 0.14em; color: #e9ecf3; padding: 3px 8px; background: var(--tv); border-left: 3px solid var(--c); border-radius: 2px; }

/* The drop-down under the bug: possession as a split bar, then shots and passes */
.board .stats-strip {
  grid-column: 1 / -1; margin-top: 5px; display: grid; gap: 5px; padding: 7px 12px 8px;
  background: var(--tv); border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
}
.stats-strip .stat-row { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 8px; }
.stats-strip .pct, .stats-strip .v { color: #fff; font-variant-numeric: tabular-nums; }
.stats-strip .pct:last-child, .stats-strip .v:last-child { text-align: right; }
.stats-strip .k { text-align: center; color: #8fa3a0; font-size: 10px; letter-spacing: 0.12em; }
.stats-strip .poss { height: 6px; border-radius: 3px; background: var(--away); overflow: hidden; }
.stats-strip .poss i { display: block; height: 100%; width: 50%; background: var(--home); transition: width 0.4s ease-out; }

/* Event feed, down the right under the broadcaster's bug: the newest line at the bottom */
.feed { position: absolute; top: calc(5.5vh + 38px); right: 2.4vw; width: 300px; margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; justify-items: end; transform: scale(var(--hud-scale, 1)); transform-origin: top right; }
.feed li {
  display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 6px 12px 6px 10px;
  background: var(--tv); border-right: 3px solid var(--c, transparent); border-radius: 3px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: #f1f3f8;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35)); animation: feed-in 0.28s ease-out;
}
.feed .min { min-width: 26px; color: var(--c, #8fa3a0); font-variant-numeric: tabular-nums; }
@keyframes feed-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* Tactic tags, above the home card */
.tactics {
  position: absolute; bottom: calc(3.6vh + 58px); left: 2.4vw; display: flex; gap: 4px;
  transform: scale(var(--hud-scale, 1)); transform-origin: bottom left;
  background: var(--tv); border-radius: 4px; padding: 3px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.tactics span { padding: 4px 8px; border-radius: 3px; color: #8fa3a0; }
.tactics span.on { background: rgba(255, 255, 255, 0.92); color: #10131c; }

/* Radar and meters, bottom centre: a small dark pitch with a dot for each player */
.dock { position: absolute; bottom: 4.2vh; left: 50%; transform: translateX(-50%) scale(var(--hud-scale, 1)); transform-origin: bottom center; display: grid; justify-items: center; gap: 6px; }
.radar { background: rgba(8, 28, 16, 0.55); border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08); }
.meter { height: 5px; width: 168px; border-radius: 3px; background: rgba(10, 14, 14, 0.6); overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.16); }
.meter > i { display: block; height: 100%; width: 0; background: var(--c, var(--teal)); }
.meter.power { height: 8px; opacity: 0; transition: opacity 0.12s; }
.meter.power.on { opacity: 1; }
.meter.power > i { background: linear-gradient(90deg, var(--teal), #7be07b 55%, #ffd24d 85%, #ff6a3d); }
.meter.stamina { width: 100px; height: 4px; }

/* Event banner: a band across the screen, edged in the team colour */
.banner {
  position: absolute; top: 24%; left: 0; right: 0; display: flex; justify-content: center; opacity: 0; transform: scaleX(0.6);
  padding: 8px 0; background: linear-gradient(90deg, transparent, rgba(10, 14, 14, 0.7) 18%, rgba(10, 14, 14, 0.7) 82%, transparent);
  border-top: 2px solid var(--c, transparent); border-bottom: 2px solid var(--c, transparent);
  font-size: 40px; font-weight: 900; letter-spacing: 0.2em; text-transform: uppercase; white-space: nowrap;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); transition: opacity 0.18s, transform 0.22s;
}
.banner.small { font-size: 20px; padding: 5px 0; top: 18%; letter-spacing: 0.24em; }
.banner.on { opacity: 1; transform: scaleX(1); }

/* The key hint shows for the first seconds of a match and goes. */
.hint { position: absolute; bottom: 1.1vh; left: 50%; transform: translateX(-50%); font-size: 10px; color: rgba(255, 255, 255, 0.55); letter-spacing: 0.04em; animation: hint-out 1s ease 9s forwards; }
@keyframes hint-out { to { opacity: 0; } }

/* Broadcaster bug, top right */
.bug { position: absolute; top: 5.5vh; right: 2.4vw; transform: scale(var(--hud-scale, 1)); transform-origin: top right; display: flex; align-items: stretch; height: 26px; border-radius: 3px; overflow: hidden; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; }
.bug .name { display: flex; align-items: center; padding: 0 10px; background: var(--tv); color: #e9ecf3; }
.bug .live { display: flex; align-items: center; padding: 0 8px; background: #e2241b; color: #fff; }

/* Player cards, bottom corners: yours on the left, the other side's on the right. A club crest, a dark bar
   with the shirt number and surname and a thin teal line along its top for the sprint reserve, and a smaller
   bar under it for condition. */
.plate {
  position: absolute; bottom: 3.6vh; left: 2.4vw; display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 8px; row-gap: 3px; align-items: center;
  transform: scale(var(--hud-scale, 1)); transform-origin: bottom left; filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4));
}
.plate.away { left: auto; right: 2.4vw; transform-origin: bottom right; }
.plate .crest { grid-row: 1 / span 2; width: 30px; height: 30px; border-radius: 50%; background: var(--c); color: #fff; font-size: 13px; font-weight: 900; display: grid; place-items: center; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.92); }
.plate.away .crest { grid-column: 2; }
.plate.away .name-bar, .plate.away .sub { grid-column: 1; justify-self: end; }
.plate .name-bar { position: relative; display: flex; align-items: center; gap: 10px; width: 224px; height: 26px; padding: 0 10px; background: var(--tv); border-radius: 2px; }
.plate .stam { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: rgba(255, 255, 255, 0.18); }
.plate .stam i { display: block; height: 100%; width: 0; background: var(--teal); transition: width 0.1s; }
.plate .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 800; letter-spacing: 0.05em; white-space: pre; text-transform: uppercase; }
.plate.away .who { text-align: right; }
.plate .pad { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 2px; background: #2fe6ff; box-shadow: 0 0 6px rgba(47, 230, 255, 0.7); }
.plate .sub { display: flex; align-items: center; gap: 8px; width: 140px; height: 16px; padding: 0 8px; background: var(--tv); border-radius: 8px; }
.plate .sub .k { font-size: 9px; font-weight: 800; letter-spacing: 0.12em; color: #8fa3a0; }
.plate .sub .bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
.plate .sub .bar i { display: block; height: 100%; width: 0; background: #6fe36f; transition: width 0.2s; }

/* Over the controlled player's head: just their surname, as a small white tag, and the marker over whoever a
   switch would pick. The script lays each at the player's place on the page with a translate; the inner box
   centres on it. */
.namebar, .switch-marker { position: absolute; left: 0; top: 0; will-change: transform; }
.namebar .nb { transform: translate(-50%, -100%) scale(var(--hud-scale, 1)); transform-origin: bottom center; }
.namebar .nb-name { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 2px rgba(0, 0, 0, 0.8); }
.switch-marker .chevron {
  display: block; font-size: 11px; line-height: 1; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  transform: translate(-50%, -100%); animation: marker-bob 0.8s ease-in-out infinite alternate;
}
@keyframes marker-bob { from { transform: translate(-50%, -100%); } to { transform: translate(-50%, calc(-100% + 4px)); } }

/* Tactic popup, above the other side's card */
.toast { position: absolute; right: 2.4vw; bottom: calc(3.6vh + 58px); padding: 10px 16px; background: var(--tv); border-left: 3px solid var(--teal); border-radius: 3px; font-size: 14px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0; transform: translateX(12px); transition: opacity 0.18s, transform 0.18s; }
.toast.on { opacity: 1; transform: none; }

/* A larger overlay would put the cards and the radar on top of one another in a narrow window. */
@media (max-width: 900px) { .plate, .dock { --hud-scale: 1; } }

/* On a phone the bug narrows, the broadcaster tag and the hint go, and the cards drop their condition bar. */
@media (max-width: 720px) {
  .board { top: 8px; left: 8px; width: 222px; }
  .board .seg { height: 26px; padding: 0 8px; gap: 8px; font-size: 13px; }
  .board .score { font-size: 17px; }
  .board .badge { width: 34px; height: 34px; margin: -4px 0; font-size: 15px; }
  .bug, .hint { display: none; }
  .feed { top: 112px; right: 8px; width: 200px; }
  .plate { bottom: 8px; left: 8px; }
  .plate.away { left: auto; right: 8px; }
  .plate .name-bar { width: calc(50vw - 62px); }
  .plate .sub { display: none; }
  .dock { bottom: 56px; }
  .tactics { bottom: 66px; left: 8px; }
  .toast { bottom: 66px; right: 8px; }
}

/* High contrast: solid black panels with white edges and white text, for the overlay and the menus. */
#hud.contrast, #screens.contrast { --tv: #000; --tv-edge: #fff; --panel: #000; --line: #fff; --ink: #fff; --dim: #e8e8e8; --comp: #000; }
#hud.contrast .board .stats-strip, #hud.contrast .board .clocktab, #hud.contrast .board .you, #hud.contrast .plate .name-bar,
#hud.contrast .plate .sub, #hud.contrast .feed li, #hud.contrast .bug .name, #hud.contrast .tactics,
#hud.contrast .toast, #hud.contrast .namebar .nb-name { outline: 1px solid #fff; }
#hud.contrast .board .seg { outline: 1px solid #fff; background: #000; }
#hud.contrast .meter, #hud.contrast .radar { background: #000; border-color: #fff; }
#screens.contrast .card button, #screens.contrast .card .option { background: #111; border-color: #fff; }
#screens.contrast .card .option:focus-within { background: #222; border-color: var(--accent); }

/* Screens */
.screen {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: radial-gradient(ellipse at center, rgba(10, 30, 18, 0.55), rgba(5, 12, 8, 0.9));
}
.card {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; display: grid; gap: 14px;
}
.card h1 { margin: 0; font-size: 44px; font-weight: 900; letter-spacing: 0.12em; }
.card h2 { margin: 0; font-size: 24px; }
.card p { margin: 0; color: var(--dim); line-height: 1.45; }
.credits { display: grid; gap: 4px; font-size: 13px; overflow-wrap: anywhere; }
.credits p:not(:last-child) { margin-bottom: 10px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
/* Let the card's contents shrink to its width: without this a pair of selects keeps its own width and pushes
   past the card on a phone, and the card now scrolls rather than lets it spill. */
.card { grid-template-columns: minmax(0, 1fr); }
.row > *, .card label { min-width: 0; }
.card select, .card input:not([type='range']) { min-width: 0; width: 100%; }
.row.wrap { flex-wrap: wrap; }
.row.wrap > * { flex: 1 1 30%; }
.card label { display: grid; gap: 6px; font-size: 13px; color: var(--dim); }
.card .picker { display: grid; gap: 6px; }
.card select, .card input {
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 8px; padding: 10px;
}
.card input { text-transform: uppercase; letter-spacing: 0.2em; }
.card input[type='range'] { padding: 0; background: none; border: none; accent-color: var(--accent); }
.card .split { display: flex; justify-content: space-between; }
.card output { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.card button {
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 14px; cursor: pointer; font-weight: 600;
}
.card button:hover { background: rgba(255, 255, 255, 0.14); }
.card button.primary { background: var(--accent); color: #1b1a0c; border-color: transparent; }
.card button.primary:hover { filter: brightness(1.06); }
.card button.on { border-color: var(--accent); color: var(--accent); }
.card .error { color: #ff8a80; min-height: 1em; font-size: 13px; }
.card .code { font-size: 40px; font-weight: 900; letter-spacing: 0.3em; text-align: center; color: var(--accent); }
.divider { height: 1px; background: var(--line); margin: 4px 0; }

/* The settings screen, full screen as on the sports games: a dark green backdrop with faint diagonal shards, the
   groups as tabs along the top, the list on the left, a card for the focused option, an index of the sections on
   the right and the keys along the foot. White, slate and green only: the focus is a slate bar, not a colour. */
.screen:has(.card.wide) {
  background:
    linear-gradient(118deg, transparent 34%, rgba(46, 140, 96, 0.14) 34.2%, transparent 52%),
    linear-gradient(62deg, transparent 58%, rgba(30, 110, 80, 0.12) 58.2%, transparent 70%),
    radial-gradient(ellipse at 18% 28%, #0e3a29 0%, transparent 62%),
    linear-gradient(135deg, #050f0b, #0a2519 55%, #061510);
}
.card.wide { width: 100vw; height: 100vh; max-height: none; display: flex; flex-direction: column; gap: 14px; padding: 4vh 5vw 3vh; border: none; border-radius: 0; background: transparent; overflow: hidden; }
.settings-head { display: flex; align-items: center; gap: 18px; }
.settings-head .gear { display: inline-flex; color: #fff; }
.settings-head h2 { margin: 0; font-size: 22px; font-weight: 800; white-space: nowrap; }
.card button.filter { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; font-size: 13px; font-weight: 700; background: none; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 999px; }
.card button.filter.on { background: rgba(255, 255, 255, 0.92); border-color: transparent; color: #0a2519; }
.eye { display: inline-flex; align-items: center; color: rgba(255, 255, 255, 0.6); }
button.filter .eye { color: inherit; }
.tabbar { flex: 1; display: flex; align-items: flex-end; gap: 10px; min-width: 0; padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, 0.3); }
.tabbar .tabs { flex: 0 1 auto; display: flex; gap: 4px; min-width: 0; margin: 0; border: none; overflow-x: auto; }
.tabs button { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 14px; color: rgba(255, 255, 255, 0.6); font-size: 15px; font-weight: 700; white-space: nowrap; }
.tabs button:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.tabs button.on { color: #fff; border-bottom-color: #fff; }
.tabbar kbd, .desc-keys kbd, .settings-bar kbd { margin-right: 6px; padding: 2px 7px; font: inherit; font-size: 11px; font-weight: 800; color: #fff; white-space: nowrap; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 5px; }
.tabbar kbd { align-self: center; margin: 0; }
.settings-main { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 150px; gap: 3vw; }
.settings-body { min-height: 0; overflow-y: auto; padding: 0 10px 0 0; scrollbar-width: thin; }
.group { display: grid; gap: 0; margin-bottom: 14px; }
.group > h3 { margin: 14px 0 4px; font-size: 15px; font-weight: 900; letter-spacing: 0.03em; text-transform: uppercase; color: #fff; }
.tab-block > h2 { margin: 12px 0 4px; font-size: 20px; font-weight: 900; }
.option {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 46px; padding: 4px 16px;
  color: rgba(255, 255, 255, 0.8); background: transparent; border: 1.5px solid transparent; border-bottom-color: rgba(255, 255, 255, 0.16); border-radius: 0; outline: none;
}
.option:hover { background: rgba(255, 255, 255, 0.05); }
.option:focus-within {
  color: #fff; border-radius: 10px; border-color: rgba(214, 236, 255, 0.8);
  background: linear-gradient(180deg, rgba(122, 142, 164, 0.68), rgba(70, 88, 108, 0.68));
  box-shadow: 0 0 18px rgba(150, 205, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.option-name { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.selector { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; justify-self: end; }
.selector .value { font-size: 15px; font-weight: 800; text-align: right; text-transform: uppercase; letter-spacing: 0.02em; }
.card .selector .step { visibility: hidden; width: 22px; height: 22px; padding: 0; color: #fff; font-size: 12px; line-height: 1; background: none; border: none; border-radius: 4px; }
.option:focus-within .selector .step, .option:hover .selector .step { visibility: visible; }
.card .selector .step:hover { background: rgba(255, 255, 255, 0.2); }
.selector.stepper { width: 100%; max-width: 360px; }
.selector.stepper .slider { flex: 1; min-width: 0; }
.settings-body input[type='range'] { accent-color: #e8f1ff; }
.desc-card { align-self: start; margin-top: 8px; min-height: 280px; display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; background: rgba(28, 44, 66, 0.84); border-radius: 6px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); }
.desc-title { margin: 0; font-size: 15px; font-weight: 900; letter-spacing: 0.03em; text-transform: uppercase; }
.desc-tag { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: #3ee08a; }
.desc-tag .eye { color: inherit; }
.desc-text { margin: 0; flex: 1; font-size: 13.5px; line-height: 1.55; color: rgba(255, 255, 255, 0.9); }
.desc-keys { margin-top: auto; padding-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 12px; color: rgba(255, 255, 255, 0.7); border-top: 1px solid rgba(255, 255, 255, 0.14); }
.settings-index { display: grid; align-content: start; gap: 2px; padding-top: 8px; }
.card .settings-index button { padding: 7px 10px; text-align: left; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.55); background: none; border: none; border-left: 3px solid transparent; border-radius: 0; }
.card .settings-index button.on { color: #fff; font-weight: 800; border-left-color: #fff; }
.settings-bar { display: flex; align-items: center; gap: 26px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.card .settings-bar button { display: inline-flex; align-items: center; padding: 6px 4px; font-size: 14px; font-weight: 700; color: #fff; background: none; border: none; }
.card .settings-bar button:disabled { opacity: 0.35; cursor: default; }
/* The accessibility filter keeps only the rows that change what a viewer can see, and the groups that hold one. */
.filtered .option:not(.a11y), .filtered .settings-foot { display: none; }
.filtered .group:not(:has(.option.a11y)), .filtered .tab-block:not(:has(.option.a11y)) { display: none; }
.filtered .settings-index { visibility: hidden; }
.field { display: grid; grid-template-columns: 180px 1fr; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.field:last-child { border-bottom: none; }
.field-label { display: grid; gap: 2px; }
.field-label span { font-size: 14px; font-weight: 600; }
.field-label small { font-size: 12px; color: var(--dim); line-height: 1.3; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; justify-self: end; }
.seg button { padding: 7px 12px; font-size: 13px; border-radius: 6px; background: rgba(255, 255, 255, 0.06); }
.seg button.on { background: var(--accent); color: #1b1a0c; border-color: transparent; }
.slider { display: flex; align-items: center; gap: 12px; }
.slider input { flex: 1; min-width: 0; }
.slider output { min-width: 50px; text-align: right; font-size: 13px; }
.settings-foot { display: flex; justify-content: flex-end; padding-top: 10px; }
.settings-foot button { padding: 8px 14px; font-size: 13px; }
.desc-picture { position: relative; aspect-ratio: 800 / 370; overflow: hidden; border-radius: 6px; background: #0a1a14; }
.desc-picture svg, .desc-picture img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 900px) {
  .card.wide { padding: 12px 14px 10px; gap: 10px; }
  .settings-head { flex-wrap: wrap; gap: 8px 12px; }
  .tabbar { order: 3; flex: 1 0 100%; padding-left: 0; border-left: none; }
  .tabbar kbd { display: none; }
  .tabs button { padding: 8px 12px; }
  .settings-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 8px; }
  .settings-index, .desc-keys, .desc-picture { display: none; }
  .desc-card { align-self: stretch; margin: 0; min-height: 0; padding: 10px 14px; }
  .desc-text { font-size: 13px; line-height: 1.4; }
  .option { grid-template-columns: minmax(0, 1fr) auto; padding: 4px 10px; }
  .card button.filter { padding: 6px 10px; font-size: 0; gap: 0; }
}
@media (max-width: 560px) {
  .field { grid-template-columns: 1fr; gap: 8px; }
  .seg { justify-self: start; }
}

.stats { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.stats td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.stats td:first-child, .stats td:last-child { width: 25%; font-weight: 700; }
.stats td:last-child { text-align: right; }
.stats td:nth-child(2) { text-align: center; color: var(--dim); }

.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.keys kbd {
  font: inherit; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; white-space: nowrap; justify-self: start;
}
.keys span { color: var(--dim); }

/* Tactics */
.card.tactics-card { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; }
.tactics-body { min-height: 0; }
.tactics-label { margin: 10px 0 4px; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.seg.presets { justify-self: start; }
.tactics-split { display: grid; grid-template-columns: 240px 1fr; gap: 22px; align-items: start; }
.tactics-shape .seg { justify-self: start; margin-bottom: 10px; }
.tactics-shape .seg button { padding: 6px 9px; font-size: 12px; }
.tactics-fields .field { grid-template-columns: 1fr auto; padding: 7px 0; }
.tactics-fields .slider { min-width: 220px; }
.formation { width: 100%; height: auto; display: block; border-radius: 6px; }
.formation .dot { fill: var(--blue); stroke: #fff; stroke-width: 1.5; }
.formation .dot.keeper { fill: #f2c21b; }
.formation .num { fill: #fff; font-size: 10px; font-weight: 800; text-anchor: middle; }
.formation .pos { fill: #ffe14d; font-size: 7.5px; font-weight: 800; letter-spacing: 0.04em; text-anchor: middle; }
.formation .name { fill: rgba(255, 255, 255, 0.92); font-size: 7.5px; font-weight: 600; text-anchor: middle; }
.card .field button:disabled { opacity: 0.35; cursor: not-allowed; }
.squad { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.squad th { text-align: left; font-size: 11px; font-weight: 700; color: var(--dim); letter-spacing: 0.06em; padding: 6px 6px; border-bottom: 1px solid var(--line); }
.squad td { padding: 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); white-space: nowrap; }
.squad td.pos { font-weight: 800; color: var(--accent); }
.squad td.name { font-weight: 700; }
.squad td.style { color: var(--dim); }
.squad td.num { text-align: right; }
.squad td.hi { color: #7be07b; font-weight: 700; }
.squad td.lo { color: #ff8a80; }
.squad .cond { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); overflow: hidden; vertical-align: middle; }
.squad .cond i { display: block; height: 100%; }
.tactics-note { margin-top: 8px !important; font-size: 12px; }
@media (max-width: 720px) {
  .tactics-split { grid-template-columns: 1fr; }
  .squad td.style, .squad th:nth-child(4) { display: none; }
}

/* Frame time readout, Rust client only */
.fps {
  position: fixed; left: 8px; bottom: 34px; z-index: 10; pointer-events: none;
  padding: 4px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.6); color: #d8f3c4;
  font: 600 12px/1.3 ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums;
}
