/* Colours. Light is the default (best in sunlight); dark follows the phone's
   setting unless the coach picks a theme with the button in the top bar. */
:root {
  color-scheme: light;
  --bg: #f1eee8;
  --card: #ffffff;
  --text: #141821;
  --muted: #5d6472;
  --line: #dedad2;
  --green: #1b7f3b;
  --on-green: #ffffff;
  --green-soft: #e2f2e6;
  --red: #b3261e;
  --red-soft: #fce4e2;
  --amber: #7d5200;
  --amber-soft: #fff1d1;
  --toast-bg: #141821;
  --toast-text: #ffffff;
  --shadow: 0 1px 1px rgb(20 24 33 / 0.04), 0 10px 30px rgb(20 24 33 / 0.08);
  --backdrop: rgb(10 14 24 / 0.45);
  --glass: rgb(255 255 255 / 0.62); /* the panels' own colour */
  --glass-strong: rgb(255 255 255 / 0.8); /* popups */
  --glass-edge: rgb(255 255 255 / 0.9); /* rim light around an edge */
  --glass-line: rgb(20 24 33 / 0.08); /* outer hairline, so white glass shows on a light page */
  --glass-shine: rgb(255 255 255 / 0.95); /* bright line along the top */
  --glow-a: rgb(76 197 116 / 0.32); /* green, the accent */
  --glow-b: rgb(255 140 60 / 0.24); /* warm orange */
  --glow-c: rgb(56 140 255 / 0.22); /* blue */
  --pitch: rgb(26 118 58 / 0.9); /* field view: tinted glass */
  --pitch-line: rgb(255 255 255 / 0.55);
  --chip: rgb(8 64 30 / 0.62); /* player markers: deep green glass, so white text reads well */
  --chip-edge: rgb(255 255 255 / 0.55);
  --chip-text: #ffffff;
  --chip-pos: #e3ffe9;
  --chip-gk: #ffe3a6;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0f1c;
    --card: #161e30;
    --text: #eef1f6;
    --muted: #97a0b3;
    --line: #26304a;
    --green: #4cc574;
    --on-green: #07190d;
    --green-soft: #173326;
    --red: #ff8a80;
    --red-soft: #3b1f26;
    --amber: #f3c46f;
    --amber-soft: #3a2d12;
    --toast-bg: #eef1f6;
    --toast-text: #0a0f1c;
    --shadow: 0 12px 34px rgb(0 0 0 / 0.35);
    --backdrop: rgb(0 0 0 / 0.55);
    --glass: rgb(30 40 64 / 0.5);
    --glass-strong: rgb(34 45 72 / 0.85);
    --glass-edge: rgb(255 255 255 / 0.1);
    --glass-line: rgb(255 255 255 / 0.06);
    --glass-shine: rgb(255 255 255 / 0.16);
    --glow-a: rgb(76 197 116 / 0.22);
    --glow-b: rgb(255 140 60 / 0.16);
    --glow-c: rgb(56 140 255 / 0.24);
    --pitch: rgb(30 110 60 / 0.45);
    --pitch-line: rgb(255 255 255 / 0.32);
    --chip: rgb(6 36 20 / 0.72);
    --chip-edge: rgb(255 255 255 / 0.3);
    --chip-text: #ffffff;
    --chip-pos: #a8f0bf;
    --chip-gk: #f6d38a;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0f1c;
  --card: #161e30;
  --text: #eef1f6;
  --muted: #97a0b3;
  --line: #26304a;
  --green: #4cc574;
  --on-green: #07190d;
  --green-soft: #173326;
  --red: #ff8a80;
  --red-soft: #3b1f26;
  --amber: #f3c46f;
  --amber-soft: #3a2d12;
  --toast-bg: #eef1f6;
  --toast-text: #0a0f1c;
  --shadow: 0 12px 34px rgb(0 0 0 / 0.35);
  --backdrop: rgb(0 0 0 / 0.55);
  --glass: rgb(30 40 64 / 0.5);
  --glass-strong: rgb(34 45 72 / 0.85);
  --glass-edge: rgb(255 255 255 / 0.1);
  --glass-line: rgb(255 255 255 / 0.06);
  --glass-shine: rgb(255 255 255 / 0.16);
  --glow-a: rgb(76 197 116 / 0.22);
  --glow-b: rgb(255 140 60 / 0.16);
  --glow-c: rgb(56 140 255 / 0.24);
  --pitch: rgb(30 110 60 / 0.45);
  --pitch-line: rgb(255 255 255 / 0.32);
  --chip: rgb(6 36 20 / 0.72);
  --chip-edge: rgb(255 255 255 / 0.3);
  --chip-text: #ffffff;
  --chip-pos: #a8f0bf;
  --chip-gk: #f6d38a;
}

/* Fonts are stored with the app, so they work offline at the pitch. */
@font-face { font-family: Inter; src: url("./fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("./fonts/barlow-condensed-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  margin: 0;
  font: 17px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
/* Soft colour glow behind the see-through glass panels. It stays still, to save battery during a match. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(55% 40% at 15% 10%, var(--glow-a), transparent 72%),
    radial-gradient(50% 38% at 92% 22%, var(--glow-b), transparent 72%),
    radial-gradient(55% 40% at 85% 85%, var(--glow-c), transparent 72%),
    radial-gradient(45% 35% at 10% 75%, var(--glow-a), transparent 72%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px 0;
}
.brand { display: flex; align-items: center; gap: 10px; }
/* The domain after the name, as in PrimeTime */
.tld { font-size: 0.6em; font-weight: 600; text-transform: none; letter-spacing: 0; margin-left: 2px; opacity: 0.6; }
.logo { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 4px 14px color-mix(in srgb, var(--green) 35%, transparent); }
.topbar h1 { margin: 0; font: 700 30px/1 "Barlow Condensed", system-ui, sans-serif; letter-spacing: 0.01em; text-transform: uppercase; }
.tagline { max-width: 560px; margin: 6px auto 0; padding: 0 16px; color: var(--muted); }
/* The match screen needs the room for the clock. */
body:has(#screen-match:not([hidden])) .tagline { display: none; }
.topbar button.theme {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
}

main { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(48px + env(safe-area-inset-bottom)); }
h2 { margin: 4px 0 16px; }
h3 {
  margin: 24px 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Controls */
button, input, select {
  font: inherit;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
}
button {
  padding: 0 16px;
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.08s ease, background-color 0.15s ease, filter 0.15s ease;
}
button:active:not(:disabled) { transform: scale(0.97); filter: brightness(0.95); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
input:focus { border-color: var(--green); }
button.primary { background: var(--green); border-color: var(--green); color: var(--on-green); font-weight: 700; box-shadow: var(--shadow); }
button.big { width: 100%; min-height: 56px; font-size: 18px; margin-top: 16px; }
button.danger { width: 100%; margin-top: 32px; background: transparent; color: var(--red); border-color: currentColor; }
button.icon { min-width: 48px; padding: 0; background: transparent; border-color: transparent; color: var(--muted); font-size: 20px; }
button.link { background: transparent; border: 0; color: var(--green); font-weight: 600; padding: 0; }
input, select { width: 100%; padding: 0 12px; }

.row { display: flex; gap: 8px; margin: 12px 0; }
.row input { flex: 1; }
.grow { flex: 1; }
.share-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.share-links button.link { min-height: 48px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.controls button { padding: 0 8px; box-shadow: var(--shadow); font-weight: 600; }

/* Lists */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.list:empty { display: none; }
.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 52px;
  padding: 0 4px 0 16px;
  border-top: 1px solid var(--line);
}
.list li:first-child { border-top: 0; }
/* The name in the team list: tap to rename. Looks like plain text. */
.list li button.rename { flex: 1; min-width: 0; min-height: 52px; padding: 0; border: 0; background: transparent; box-shadow: none; text-align: left; font: inherit; color: var(--text); overflow-wrap: anywhere; }
.list li.player { padding: 0; }
.player button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  text-align: left;
  background: transparent;
}
.player.field { box-shadow: inset 5px 0 var(--green); }
.player.gk { box-shadow: inset 5px 0 var(--amber); }
.player button:active:not(:disabled) { transform: none; background: var(--green-soft); }
.player.out .name { color: var(--muted); text-decoration: line-through; }
.stint { margin-left: auto; padding-right: 12px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.mins { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.player.field .mins, .player.gk .mins { color: var(--text); }

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}
.badge.gk { background: var(--amber-soft); color: var(--amber); }
.badge.paused { background: var(--amber-soft); color: var(--amber); }

/* Setup form */
label.field { display: block; margin: 16px 0; font-weight: 500; }
label.field input { margin-top: 6px; }
fieldset {
  min-width: 0;
  margin: 16px 0;
  padding: 0 16px 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
}
/* The heading sits inside the box (float takes the legend off the border line). */
legend { float: left; width: 100%; padding: 14px 0 6px; font-weight: 600; }
legend + * { clear: both; }
.choices label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 4px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
  cursor: pointer;
}
.choices input {
  flex: none;
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 2px solid var(--muted);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.choices input[type="radio"] { border-radius: 50%; }
.choices input:checked { border-color: var(--green); background-color: var(--green); }
.choices input::after { content: ""; opacity: 0; transition: opacity 0.15s ease; }
.choices input:checked::after { opacity: 1; }
/* A tick for checkboxes, a dot for the goalkeeper choice */
.choices input[type="checkbox"]::after { width: 7px; height: 13px; margin-top: -3px; border: solid var(--on-green); border-width: 0 3px 3px 0; transform: rotate(45deg); }
.choices input[type="radio"]::after { width: 10px; height: 10px; border-radius: 50%; background: var(--on-green); }
.choices input:disabled { opacity: 0.4; cursor: not-allowed; }
.choices label.disabled { color: var(--muted); }
.choices label .sub { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; }
.positions:not(:empty) { padding-bottom: 12px; }
.pos-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 8px; }
.pos-row input { min-width: 0; }
.badge.pos { background: var(--green-soft); color: var(--green); font-weight: 600; }
.badge.last { padding: 0 7px; border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.error { color: var(--red); min-height: 1.4em; margin: 8px 0; }
.note { margin: -4px 0 16px; color: var(--green); font-weight: 500; }
.note button.link { min-height: 44px; }
.warning { background: var(--amber-soft); color: var(--amber); padding: 12px 16px; border-radius: 12px; }

/* Match clock */
.clock {
  text-align: center;
  padding: 16px 20px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.clock { position: relative; }
.clock button.restart { position: absolute; top: 4px; right: 4px; min-height: 48px; border-radius: 50%; }
.clock button.restart svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.countdown {
  font-size: 76px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.countdown.due { color: var(--red); }
.clock.due { background: var(--red-soft); border-color: var(--red); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { box-shadow: 0 0 0 6px var(--red-soft); } }

/* How far we are towards the next substitution */
.progress {
  height: 8px;
  margin: 10px 0 12px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.progress > div {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.5s linear;
}
.clock.due .progress > div { background: var(--red); }
.clock.paused .progress > div { background: var(--amber); }

/* Dialogs */
dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 20px;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 20px 50px rgb(0 0 0 / 0.3);
}
dialog[open] { animation: pop-in 0.18s ease-out; }
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(2px); }
@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
dialog h2 { margin-top: 0; }

.swap-row {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 8px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.swap-row .pick { display: flex; flex-direction: column; gap: 8px; }
.pick-row { display: flex; align-items: center; gap: 8px; }
/* The button that opens the player list */
button.picker {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  text-align: left;
}
button.picker::after { content: ""; flex: none; width: 8px; height: 8px; margin: -4px 2px 0 0; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); }
button.picker:disabled::after { display: none; }
.pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pick-list { margin-top: 4px; max-height: 60dvh; overflow-y: auto; }
#pick-list button.chosen { background: var(--green-soft); box-shadow: inset 5px 0 var(--green); font-weight: 700; }
#ask-dialog input { margin: 4px 0 8px; }
#ask-text { margin: 0 0 8px; }
button.danger-fill { background-color: var(--red); border-color: var(--red); color: var(--card); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3), 0 6px 18px color-mix(in srgb, var(--red) 35%, transparent); }
.tag {
  flex: 0 0 44px;
  padding: 4px 0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.tag.off { background: var(--red-soft); color: var(--red); }
.tag.on { background: var(--green-soft); color: var(--green); }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--toast-bg);
  color: var(--toast-text);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
  animation: pop-in 0.18s ease-out;
}

/* ---------- Glass (like PrimeTime and ProQuiz) ----------
   Frosted, see-through panels with a bright top edge, a rim light and a fine outer line, over a soft glow.
   Real blur (backdrop-filter) only on the big panels and the popups; buttons and inputs fake it with a
   translucent fill and a highlight, which is cheaper for the phone. */
.list,
fieldset,
.clock,
dialog {
  background-color: var(--glass);
  background-image: linear-gradient(180deg, rgb(255 255 255 / 0.14), rgb(255 255 255 / 0.03) 40%, transparent 75%);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-shine), inset 0 0 0 1px var(--glass-edge), var(--shadow);
}
.list, fieldset { border-radius: 14px; }
.clock { border-radius: 18px; }
dialog {
  background-color: var(--glass-strong);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 var(--glass-shine), inset 0 0 0 1px var(--glass-edge), 0 24px 60px rgb(0 0 0 / 0.3);
}
dialog::backdrop { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

button:not(.primary, .danger, .icon, .link),
input, select {
  background-color: var(--glass);
  background-image: linear-gradient(180deg, rgb(255 255 255 / 0.12), transparent 60%);
  border-color: var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-shine), inset 0 0 0 1px var(--glass-edge), var(--shadow);
}
.list .player button,
.list li button.icon { box-shadow: none; background: transparent; }
.topbar button.theme { border-radius: 999px; }
button.primary {
  background-image: linear-gradient(180deg, rgb(255 255 255 / 0.22), transparent 60%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), 0 6px 18px color-mix(in srgb, var(--green) 35%, transparent);
}
.choices input { box-shadow: none; background-image: none; }
.choices input:not(:checked) { background-color: transparent; }
.clock.due { background-color: var(--red-soft); border-color: var(--red); }
.progress { background: color-mix(in srgb, var(--text) 10%, transparent); }
.countdown { font-family: "Barlow Condensed", system-ui, sans-serif; font-weight: 700; font-size: 96px; line-height: 1; letter-spacing: 0; }
h2 { font: 700 28px/1.1 "Barlow Condensed", system-ui, sans-serif; text-transform: uppercase; letter-spacing: 0.01em; }

/* Install card on the team screen */
.install-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding: 12px 4px 12px 14px;
  border: 1px solid var(--glass-line);
  border-radius: 14px;
  background-color: var(--glass);
  background-image: linear-gradient(180deg, rgb(255 255 255 / 0.14), transparent 60%);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: inset 0 1px 0 var(--glass-shine), inset 0 0 0 1px var(--glass-edge), var(--shadow);
}
.install-card img { flex: none; width: 44px; height: 44px; border-radius: 11px; }
.install-card .grow { min-width: 0; line-height: 1.3; }
.install-card .icon { min-width: 40px; font-size: 16px; }
.steps { margin: 0 0 8px; padding-left: 22px; }
.steps li { margin: 10px 0; padding-left: 4px; }
/* Safari's share symbol: a box with an arrow up */
.share-icon {
  display: inline-block;
  position: relative;
  width: 14px;
  height: 14px;
  margin: 0 2px -1px;
  border: 2px solid var(--green);
  border-top-color: transparent;
  border-radius: 2px;
}
.share-icon::before { content: ""; position: absolute; left: 4px; top: -8px; width: 2px; height: 12px; background: var(--green); }
.share-icon::after { content: ""; position: absolute; left: 1px; top: -8px; width: 6px; height: 6px; border: solid var(--green); border-width: 2px 0 0 2px; transform: rotate(45deg); }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

/* Match screen pages: the list, and (swipe left) the field view. Native
   scroll snapping does the swiping. */
.pages {
  display: flex;
  align-items: flex-start;
  margin: 0 -16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.pages::-webkit-scrollbar { display: none; }
.pages.locked { overflow-x: hidden; } /* while a marker is dragged, the page mustn't swipe */
.page { flex: 0 0 100%; min-width: 0; padding: 0 16px; scroll-snap-align: start; }
.page-dots { display: flex; justify-content: center; gap: 4px; margin: -8px 0 4px; }
.page-dots button { min-height: 24px; min-width: 24px; padding: 0; border: 0; background: transparent; box-shadow: none; display: grid; place-items: center; }
.page-dots button::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: background-color 0.2s ease, width 0.2s ease; }
.page-dots button.active::after { width: 20px; border-radius: 4px; background: var(--green); }

/* Field view */
/* The small clock above the field view: the list's clock, made compact. */
.clock.mini { margin-bottom: 10px; padding: 10px 16px 4px; text-align: left; }
.clock.mini .mini-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.clock.mini .mini-labels { display: flex; flex-direction: column; gap: 4px; }
.clock.mini .countdown { font-size: 52px; }
.clock.mini .progress { margin: 8px 0; }
.field-wrap { display: flex; flex-direction: column; gap: 10px; }
/* Tinted glass, like the other panels: real blur, a sheen from the top and a rim light. */
.pitch {
  position: relative;
  aspect-ratio: 10 / 13; /* matches the drawing's viewBox */
  border-radius: 18px;
  background-color: var(--pitch);
  background-image: linear-gradient(160deg, rgb(255 255 255 / 0.22), rgb(255 255 255 / 0.04) 35%, transparent 60%);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--chip-edge), inset 0 0 0 1px rgb(255 255 255 / 0.12), var(--shadow);
  overflow: hidden;
}
.pitch-lines { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: var(--pitch-line); stroke-width: 2; }
.pitch .marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 34%;
  min-height: 0;
  padding: 5px 10px 6px;
  border: 1px solid var(--chip-edge);
  border-radius: 14px;
  background-color: var(--chip);
  background-image: linear-gradient(180deg, rgb(255 255 255 / 0.2), rgb(255 255 255 / 0.03) 55%, transparent);
  color: var(--chip-text);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.5), 0 4px 14px rgb(0 0 0 / 0.22);
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
  line-height: 1.15;
  text-align: center;
}
.pitch .marker .marker-pos { font-size: 11px; font-weight: 600; color: var(--chip-pos); white-space: nowrap; }
.pitch .marker .marker-name { max-width: 100%; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pitch .marker.gk .marker-pos { color: var(--chip-gk); }
.pitch .marker.empty .marker-name { opacity: 0.6; font-weight: 500; }
.pitch .marker { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; transition: box-shadow 0.15s ease, scale 0.15s ease; }
/* Arranging: the positions wiggle like app icons on an iPhone. */
@keyframes wiggle { from { rotate: -2deg; } to { rotate: 2deg; } }
.pitch.arranging .marker { touch-action: none; cursor: grab; animation: wiggle 0.14s ease-in-out infinite alternate; }
.pitch.arranging .marker:nth-child(2n) { animation-duration: 0.16s; animation-delay: -0.07s; }
.pitch.arranging .marker:nth-child(3n) { animation-duration: 0.15s; animation-delay: -0.03s; }
@media (prefers-reduced-motion: reduce) { .pitch.arranging .marker { animation: none; } }
.pitch .marker.lifted { animation: none; scale: 1.12; cursor: grabbing; z-index: 1; outline: 2px dashed var(--chip-edge); outline-offset: 3px; box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.5), 0 10px 24px rgb(0 0 0 / 0.35); }
.field-tip { margin: 10px 0 0; text-align: center; }
.pitch .field-done {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--chip-edge);
  border-radius: 999px;
  background-color: var(--chip);
  background-image: linear-gradient(180deg, rgb(255 255 255 / 0.35), transparent);
  color: var(--chip-text);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.5), 0 4px 14px rgb(0 0 0 / 0.22);
}
.pitch .marker:active { transform: translate(-50%, -50%); }
.field-bench { padding: 8px 10px 10px; border-radius: 12px; background: var(--glass); border: 1px solid var(--glass-line); }
.field-bench-title { margin-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
#field-bench { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
#field-bench li { flex: 0 1 auto; min-width: 0; }
#field-bench button {
  min-height: 44px;
  max-width: 160px;
  padding: 4px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  font-size: 13px;
  font-weight: 600;
}
#field-bench .bench-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#field-bench .bench-last { font-size: 11px; font-weight: 500; color: var(--muted); }
