:root {
  --turf: #2f8f3e;
  --turf-2: #277834;
  --bezel: #14130f;
  --chalk: #f4f3e9;
  --amber: #ffcf33;
  --lime: #7bff4d;
  --red: #e23b3b;
  --ink: #060806;
  --line: rgba(244, 243, 233, 0.2);
  --mono: "Courier New", Courier, monospace;
  --display: Impact, Haettenschweiler, "Arial Black", var(--mono);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--chalk);
  background: #050504;
  font-family: var(--mono);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }

.cab {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 14px;
  background: linear-gradient(180deg, #191913, #050504);
}
.screen {
  position: relative;
  width: 100%;
  max-width: 430px;
  background: var(--bezel);
  border-radius: 20px;
  padding: 10px;
  box-shadow: 0 0 0 2px #000, 0 22px 50px rgba(0,0,0,.6), inset 0 0 0 6px #2a2822;
}
.pitch {
  position: relative;
  min-height: calc(100vh - 48px);
  border-radius: 8px;
  overflow: hidden;
  padding: 14px;
  background:
    repeating-linear-gradient(90deg, var(--turf) 0 28px, var(--turf-2) 28px 56px);
}
.crt::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
.crt::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 61;
  background: transparent;
  animation: flick 4s infinite steps(40);
}
@keyframes flick {
  0%, 96% { opacity: 1; }
  97% { opacity: .9; }
  98% { opacity: 1; }
  99% { opacity: .94; }
}

.hud {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding: 9px 11px;
  color: var(--chalk);
  background: linear-gradient(#20201a, #0c0b08);
  border: 3px solid #000;
  box-shadow: 0 3px 0 #000;
}
.title, .headline {
  font-family: var(--display);
  letter-spacing: 0;
}
.title { font-size: 19px; text-shadow: 3px 3px 0 #000; }
.lbl, .eyebrow {
  font-family: var(--display);
  font-size: 10px;
  color: var(--chalk);
  letter-spacing: 0;
  text-transform: uppercase;
}
.lcd {
  font-family: var(--display);
  color: var(--amber);
  letter-spacing: 0;
  text-shadow: 0 0 6px rgba(255,207,51,.7);
}
.lcd.small { font-size: 13px; }
.glow-amber { color: var(--amber); text-shadow: 0 0 8px rgba(255,207,51,.85), 0 0 2px #000; }
.glow-lime { color: var(--lime); text-shadow: 0 0 7px rgba(123,255,77,.7); }

.stack {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.home-stack {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: calc(100vh - 94px);
  grid-template-rows: 1fr auto;
  gap: 16px;
}
.home-hero {
  display: grid;
  align-items: center;
  gap: 18px;
}
.home-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.home-kicker {
  color: var(--amber);
  font-family: var(--display);
  font-size: 12px;
  text-transform: uppercase;
}
.home-copy h1 {
  max-width: 390px;
  margin: 12px 0 24px;
  font-size: 58px;
}
.home-play {
  width: min(320px, 100%);
}
.home-pitch {
  position: relative;
  width: min(350px, 100%);
  aspect-ratio: 3 / 4;
  justify-self: center;
  overflow: hidden;
  border: 3px solid var(--chalk);
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 36px, rgba(0,0,0,.035) 36px 72px),
    rgba(3,36,11,.32);
  box-shadow: 7px 7px 0 rgba(0,0,0,.5);
}
.home-halfway,
.home-ten-line,
.home-22-line,
.home-try-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(244,243,233,.76);
}
.home-halfway { top: 50%; }
.home-ten-line {
  height: 1px;
  opacity: .62;
  background: repeating-linear-gradient(90deg, var(--chalk) 0 12px, transparent 12px 24px);
}
.home-ten-line-top { top: 42%; }
.home-ten-line-bottom { top: 58%; }
.home-22-line {
  height: 3px;
  background: var(--chalk);
}
.home-22-line-top { top: 28%; }
.home-22-line-bottom { top: 72%; }
.home-try-line-top { top: 10%; }
.home-try-line-bottom { top: 90%; }
.home-posts {
  position: absolute;
  left: 50%;
  width: 20%;
  height: 8%;
  border-right: 3px solid var(--chalk);
  border-left: 3px solid var(--chalk);
  transform: translateX(-50%);
}
.home-posts::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  top: 50%;
  height: 3px;
  background: var(--chalk);
  transform: translateY(-50%);
}
.home-posts-top { top: 1.5%; }
.home-posts-bottom { bottom: 1.5%; }
.home-player {
  position: absolute;
  left: var(--x);
  top: var(--y);
  display: flex;
  width: 84px;
  flex-direction: column;
  align-items: center;
  color: var(--chalk);
  transform: translate(-50%, -50%);
}
.home-player b {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #06270a;
  background: var(--chalk);
  border: 2px solid #000;
  border-radius: 50%;
  font-family: var(--display);
  font-size: 12px;
  box-shadow: 2px 2px 0 rgba(0,0,0,.7);
}
.home-player small {
  width: 100%;
  margin-top: 3px;
  overflow: hidden;
  font-family: var(--display);
  font-size: 8px;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 1px 1px 0 #000, 0 0 4px #000;
  white-space: nowrap;
}
.home-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  color: var(--chalk);
  background: rgba(3,18,6,.72);
  border-top: 2px solid rgba(244,243,233,.55);
  border-bottom: 2px solid rgba(244,243,233,.55);
}
.home-step {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px;
}
.home-step + .home-step {
  border-left: 2px solid rgba(244,243,233,.28);
}
.home-step b {
  color: var(--amber);
  font-family: var(--display);
  font-size: 25px;
}
.home-step i {
  flex: none;
  width: 32px;
  color: var(--chalk);
  font-family: var(--display);
  font-size: 25px;
  font-style: normal;
  line-height: 1;
  text-align: center;
}
.home-step > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
}
.home-step strong {
  font-family: var(--display);
  font-size: 16px;
  text-transform: uppercase;
}
.home-step small {
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.15;
  opacity: .72;
}

@media (max-width: 559px) {
  .home-step {
    min-height: 108px;
    flex-wrap: wrap;
    align-content: center;
    gap: 4px 7px;
    padding: 8px 5px;
  }
  .home-step b { font-size: 22px; }
  .home-step i {
    width: 26px;
    font-size: 22px;
  }
  .home-step > span {
    width: 100%;
    align-items: center;
    text-align: center;
  }
  .home-step strong { font-size: 13px; }
  .home-step small { font-size: 8px; }
}
.setup-head { margin: 4px 0 2px; }
h1 {
  margin: 6px 0 0;
  max-width: 360px;
  font-family: var(--display);
  font-size: 48px;
  line-height: .9;
  letter-spacing: 0;
  text-shadow: 4px 4px 0 #000;
}
.setup-label { margin-bottom: 6px; }
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tile {
  width: 100%;
  min-height: 54px;
  color: var(--chalk);
  background: rgba(6,18,8,.72);
  border: 2px solid #4a6b4a;
  padding: 10px;
  text-align: left;
  font-size: 20px;
  line-height: 1;
}
.tile[data-on="1"] {
  border-color: var(--amber);
  background: rgba(255,207,51,.12);
  box-shadow: 0 0 0 1px var(--amber), 0 0 10px rgba(255,207,51,.25);
}
.tile small {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  opacity: .72;
  line-height: 1.05;
}
.arcade-select, .arcade-input {
  width: 100%;
  min-height: 48px;
  color: var(--chalk);
  background: rgba(6,18,8,.82);
  border: 2px solid var(--chalk);
  padding: 8px 10px;
  outline: none;
}
.arcade-select:focus, .arcade-input:focus { border-color: var(--amber); }

.button-grid {
  display: grid;
  gap: 10px;
}
.btn {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 48px;
  border: 3px solid #000;
  padding: 13px 10px;
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: 0;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 #000;
  transition: transform .05s, box-shadow .05s, filter .1s;
}
.btn:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 #000;
}
.btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.btn-lime { background: var(--lime); color: #06270a; }
.btn-amber { background: var(--amber); color: #3a2a00; }
.btn-dark { background: #20201a; color: var(--chalk); }
.btn:hover { filter: brightness(1.1); }
.btn:disabled:hover { filter: none; }

.panel {
  position: relative;
  z-index: 1;
  padding: 10px;
  color: var(--chalk);
  background: rgba(6,18,8,.78);
  border: 2px solid var(--chalk);
}
.xv-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
}
.complete-panel {
  display: grid;
  gap: 12px;
}
.tile-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.tile-grid.compact .tile {
  min-height: 42px;
  padding: 8px;
  font-size: 16px;
}
.team-ratings-panel {
  padding: 8px;
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(244,243,233,.26);
}
.ratings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.ratings-overall {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--display);
}
.ratings-overall span {
  color: rgba(244,243,233,.74);
  font-size: 10px;
}
.ratings-overall b {
  color: var(--amber);
  font-size: 12px;
  line-height: 1;
  text-shadow: 0 0 6px rgba(255,207,51,.5);
}
.ratings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.rating-metric {
  display: grid;
  grid-template-columns: 42px 1fr 28px;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.rating-label {
  color: rgba(244,243,233,.78);
  font-family: var(--display);
  font-size: 10px;
}
.rating-bar {
  height: 5px;
  overflow: hidden;
  background: rgba(244,243,233,.18);
  border: 1px solid rgba(244,243,233,.16);
}
.rating-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--lime), var(--amber));
}
.rating-metric b {
  color: var(--amber);
  font-family: var(--display);
  font-size: 14px;
  line-height: 1;
  text-align: right;
  text-shadow: 0 0 5px rgba(255,207,51,.6);
}
.rugby-pitch {
  position: relative;
  height: clamp(560px, 148vw, 628px);
  min-height: clamp(560px, 148vw, 628px);
  overflow: hidden;
  border: 2px solid rgba(244,243,233,.82);
  background:
    linear-gradient(to bottom, rgba(244,243,233,.22) 0 2px, transparent 2px 11%, rgba(244,243,233,.42) 11% calc(11% + 2px), transparent calc(11% + 2px) 24%, rgba(244,243,233,.26) 24% calc(24% + 2px), transparent calc(24% + 2px) 50%, rgba(244,243,233,.36) 50% calc(50% + 2px), transparent calc(50% + 2px) 76%, rgba(244,243,233,.26) 76% calc(76% + 2px), transparent calc(76% + 2px) 89%, rgba(244,243,233,.42) 89% calc(89% + 2px), transparent calc(89% + 2px)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.03) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(90deg, var(--turf) 0 28px, var(--turf-2) 28px 56px);
}
.field-markings {
  position: absolute;
  inset: 18px;
  pointer-events: none;
  border: 2px solid rgba(244,243,233,.88);
}
.field-markings::before,
.field-markings::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  height: 2px;
  background: rgba(244,243,233,.88);
}
.field-markings::before { top: 16%; }
.field-markings::after { bottom: 16%; }
.goal-post {
  position: absolute;
  left: 50%;
  width: 58px;
  height: 24px;
  border-left: 4px solid rgba(244,243,233,.82);
  border-right: 4px solid rgba(244,243,233,.82);
  transform: translateX(-50%);
}
.goal-post-top {
  top: -24px;
  border-bottom: 4px solid rgba(41,87,190,.85);
}
.goal-post-bottom {
  bottom: -24px;
  border-top: 4px solid rgba(41,87,190,.85);
}
.pitch-slot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--chalk);
  transform: translate(-50%, -50%);
  transition: opacity .15s, border-color .15s, background .15s, box-shadow .15s, filter .15s;
}
.pitch-slot.empty {
  flex-direction: column;
  justify-content: center;
  width: clamp(42px, 13vw, 52px);
  min-height: clamp(38px, 11vw, 43px);
  padding: 4px;
  opacity: .48;
  background: rgba(6,18,8,.46);
  border: 2px solid rgba(244,243,233,.38);
}
.pitch-slot.empty:disabled {
  cursor: default;
  opacity: .48;
}
.pitch-slot.empty.eligible {
  opacity: .94;
  background: rgba(123,255,77,.14);
  border-color: var(--lime);
  box-shadow: 0 0 0 2px rgba(123,255,77,.18), 0 0 14px rgba(123,255,77,.34);
  cursor: pointer;
}
.pitch-slot:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}
.pitch-slot.empty.unavailable {
  opacity: .16;
  filter: saturate(.55);
}
.pitch-slot.filled {
  width: clamp(92px, 31vw, 128px);
  min-height: clamp(50px, 15vw, 60px);
  padding: 5px 5px;
  background: rgba(6,18,8,.86);
  border: 2px solid rgba(244,243,233,.55);
  box-shadow: 3px 3px 0 rgba(0,0,0,.62);
}
.pitch-number {
  flex: none;
  display: grid;
  place-items: center;
  width: clamp(23px, 7.5vw, 29px);
  height: clamp(23px, 7.5vw, 29px);
  color: #06270a;
  background: var(--chalk);
  border-radius: 999px;
  font-family: var(--display);
  font-size: clamp(14px, 4.6vw, 18px);
  line-height: 1;
}
.pitch-code {
  color: rgba(244,243,233,.76);
  font-family: var(--display);
  font-size: clamp(8px, 2.8vw, 10px);
  line-height: 1;
}
.pitch-player {
  min-width: 0;
  padding-right: clamp(10px, 4vw, 17px);
}
.pitch-player-name {
  display: -webkit-box;
  overflow: hidden;
  color: var(--chalk);
  font-size: clamp(10px, 3.1vw, 12px);
  line-height: 1.04;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.pitch-player small {
  display: block;
  overflow: hidden;
  max-width: 100%;
  opacity: .58;
  font-size: clamp(8px, 2.7vw, 10px);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pitch-rate {
  position: absolute;
  right: 5px;
  bottom: 4px;
  color: var(--amber);
  font-family: var(--display);
  font-size: 13px;
  line-height: 1;
  text-shadow: 0 0 5px rgba(255,207,51,.6);
}
.slot-tools {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  gap: 2px;
}
.slot-tools .mini {
  min-width: 17px;
  min-height: 16px;
  padding: 0 2px;
  font-size: 8px;
}
.pitch-kicker {
  position: absolute;
  right: 5px;
  bottom: 4px;
  color: #06270a;
  background: var(--amber);
  border: 1px solid #000;
  padding: 1px 4px;
  font-family: var(--display);
  font-size: 9px;
}
.pitch-slot.scoring {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(255,207,51,.25), 0 0 22px rgba(255,207,51,.78), 3px 3px 0 rgba(0,0,0,.62);
  animation: scorer-flash .52s ease-out 1;
}
.pitch-slot.scoring-try {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(255,207,51,.32), 0 0 24px rgba(255,207,51,.9), 3px 3px 0 rgba(0,0,0,.62);
}
.pitch-slot.scoring-pen,
.pitch-slot.scoring-dg {
  border-color: #d8dde2;
  box-shadow: 0 0 0 2px rgba(216,221,226,.28), 0 0 22px rgba(216,221,226,.7), 3px 3px 0 rgba(0,0,0,.62);
}
@keyframes scorer-flash {
  0% { transform: translate(-50%, -50%) scale(1); }
  22% { transform: translate(-50%, -50%) scale(1.1); }
  100% { transform: translate(-50%, -50%) scale(1); }
}
.sim-team-panel {
  padding: 8px;
}
.sim-pitch {
  height: clamp(330px, 92vw, 392px);
  min-height: clamp(330px, 92vw, 392px);
}
.sim-pitch .field-markings { inset: 12px; }
.sim-pitch .pitch-slot.filled {
  width: 78px;
  min-height: 39px;
  padding: 4px;
}
.sim-pitch .pitch-number {
  width: 22px;
  height: 22px;
  font-size: 14px;
}
.sim-pitch .pitch-player { padding-right: 0; }
.sim-pitch .pitch-player-name { font-size: 10px; }
.sim-pitch .pitch-player small,
.sim-pitch .slot-tools,
.sim-pitch .pitch-rate { display: none; }
.sim-pitch .pitch-kicker {
  right: 2px;
  bottom: 2px;
  font-size: 8px;
}
.error {
  position: relative;
  z-index: 2;
  margin-bottom: 12px;
  padding: 10px;
  color: #fff2ec;
  background: rgba(226,59,59,.18);
  border: 2px solid var(--red);
}
.unit { margin-bottom: 8px; }
.unit:last-child { margin-bottom: 0; }
.unit-label { margin-bottom: 4px; opacity: .68; }
.slot-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 31px;
  color: var(--chalk);
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(244,243,233,.16);
  padding: 3px 0;
  text-align: left;
  font-size: 19px;
}
.slot-row:last-child { border-bottom: 0; }
.slot-row.placeable {
  color: var(--lime);
  text-shadow: 0 0 7px rgba(123,255,77,.7);
}
.slot-row.blocked { opacity: .35; }
.num {
  flex: none;
  width: 30px;
  padding: 4px 0;
  color: #06270a;
  background: var(--chalk);
  font-family: var(--display);
  font-size: 11px;
  text-align: center;
}
.slot-open { opacity: .52; }
.slot-name, .pick-name, .opp, .event-who {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slot-name small {
  opacity: .55;
  font-size: 14px;
}
.rate {
  flex: none;
  min-width: 24px;
  margin-left: auto;
  color: var(--amber);
  font-family: var(--display);
  font-size: 16px;
  line-height: 1;
  text-align: right;
  text-shadow: 0 0 5px rgba(255,207,51,.6);
}
.mini {
  flex: none;
  min-width: 28px;
  min-height: 24px;
  color: var(--chalk);
  background: rgba(0,0,0,.25);
  border: 1px solid var(--line);
  padding: 0 5px;
}
.mini.on {
  color: #06270a;
  background: var(--amber);
  border-color: #000;
}

.roll-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 22px 10px;
}
.roll-button span { font-size: 30px; line-height: 1; }
.roll-panel {
  padding: 30px 10px;
  text-align: center;
}
.rolling-draw {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 76px;
  margin-bottom: 10px;
}
.rolling-flag {
  flex: none;
  width: 64px;
  font-size: 48px;
  line-height: 1;
  filter: drop-shadow(3px 3px 0 rgba(0,0,0,.55));
}
.rolling-team {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
}
.rolling-team strong {
  overflow: hidden;
  color: var(--chalk);
  font-family: var(--display);
  font-size: 28px;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rolling-team small {
  margin-top: 5px;
  color: var(--amber);
  font-family: var(--display);
  font-size: 15px;
}
.die {
  display: inline-block;
  color: var(--amber);
  font-size: 52px;
  line-height: 1;
  text-shadow: 0 0 14px rgba(255,207,51,.85);
}
@keyframes shake {
  0%, 100% { transform: rotate(-10deg) scale(1); }
  50% { transform: rotate(10deg) scale(1.08); }
}
.shake { animation: shake .16s infinite; }

@media (max-width: 520px) {
  .rolling-team strong { font-size: 22px; }
}

.draw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.reroll-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
}
.reroll-count {
  color: var(--amber);
  font-family: var(--display);
  font-size: 13px;
  line-height: 1;
  text-shadow: 0 0 7px rgba(255,207,51,.55);
  white-space: nowrap;
}
.draw-head em {
  color: var(--chalk);
  font-style: normal;
  opacity: .65;
}
.reroll-btn {
  width: auto;
  min-height: 32px;
  padding: 6px 8px;
  box-shadow: 2px 2px 0 #000;
  font-size: 12px;
}
@media (max-width: 720px) {
  .draw-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .reroll-actions {
    width: 100%;
  }
  .reroll-btn {
    flex: 1;
  }
}
.draft-prompt {
  margin-bottom: 8px;
  padding: 8px;
  color: var(--chalk);
  background: rgba(255,207,51,.10);
  border: 1px solid rgba(255,207,51,.45);
}
.pick-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 236px;
  overflow-y: auto;
}
.pickbtn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  color: var(--chalk);
  background: rgba(0,0,0,.28);
  border: 2px solid #4a6b4a;
  padding: 7px;
  text-align: left;
}
.pickbtn:hover, .pickbtn.selected {
  border-color: var(--lime);
  background: rgba(123,255,77,.12);
}
.pick-pos {
  flex: none;
  min-width: 46px;
  max-width: 150px;
  padding: 0 4px;
  color: var(--amber);
  font-family: var(--display);
  font-size: 10px;
  text-align: left;
  line-height: 1.05;
}
.footer-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.text-btn {
  color: var(--chalk);
  background: transparent;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.scorebar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
  padding: 12px 10px;
  color: var(--chalk);
  background: linear-gradient(#20201a, #0c0b08);
  border: 3px solid #000;
  box-shadow: 0 3px 0 #000;
}
.sb-team {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 17px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-team.right { text-align: right; }
.sb-score {
  color: var(--amber);
  font-family: var(--display);
  font-size: 26px;
  text-shadow: 0 0 9px rgba(255,207,51,.75);
}
.sb-clock {
  min-width: 44px;
  color: var(--lime);
  font-family: var(--display);
  font-size: 14px;
  text-align: center;
  text-shadow: 0 0 6px rgba(123,255,77,.6);
}
.kickoff-panel {
  padding: 24px 12px;
  text-align: center;
}
.versus {
  margin: 6px 0 18px;
  color: var(--chalk);
  font-size: 28px;
}
.event-list {
  display: flex;
  flex-direction: column;
  max-height: 264px;
  overflow-y: auto;
}
.quiet {
  padding: 22px;
  text-align: center;
  opacity: .62;
}
.event {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  color: var(--chalk);
  border-left: 3px solid transparent;
}
@keyframes event-in {
  from { opacity: 0; transform: translateX(-7px); }
  to { opacity: 1; transform: none; }
}
.event-you { border-left-color: var(--lime); }
.event-them {
  border-left-color: var(--red);
  background: rgba(226,59,59,.06);
}
.event-latest {
  animation: event-in .25s ease-out;
}
.event-you.event-latest {
  background: rgba(123,255,77,.08);
  box-shadow: inset 0 0 0 1px rgba(123,255,77,.16);
}
.event-them.event-latest {
  background: rgba(226,59,59,.12);
}
.event-sub {
  opacity: .68;
  font-size: 15px;
}
.event-min {
  flex: none;
  width: 34px;
  color: var(--amber);
  font-family: var(--display);
  font-size: 11px;
}
.event-kind {
  flex: none;
  width: 44px;
  font-family: var(--display);
  font-size: 10px;
}
.event-you .event-kind { color: var(--lime); }
.event-you.event-try .event-kind { color: var(--amber); }
.event-you.event-pen .event-kind,
.event-you.event-dg .event-kind { color: #d8dde2; }
.event-them .event-kind { color: var(--red); }
.event-pts {
  margin-left: auto;
  color: var(--amber);
}
.fulltime-panel {
  padding: 16px 12px;
  text-align: center;
}
.fulltime-panel .headline {
  margin: 10px 0;
  font-size: 24px;
}
.extra-note {
  margin: 0 0 10px;
  opacity: .74;
}

.match-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(244,243,233,.14);
  animation: pop .3s forwards;
}
.match-row:last-child { border-bottom: 0; }
@keyframes pop {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}
.stage {
  flex: none;
  width: 96px;
  font-size: 15px;
  opacity: .8;
}
.result-mark {
  flex: none;
  width: 22px;
  font-family: var(--display);
  font-size: 12px;
  text-align: center;
}
.win { color: var(--lime); }
.loss { color: var(--red); }
.summary-banner {
  position: relative;
  z-index: 1;
  padding: 14px;
  text-align: center;
  border: 3px solid #000;
}
.summary-banner.good { background: rgba(255,207,51,.15); }
.summary-banner.bad { background: rgba(226,59,59,.12); }
.summary-banner .headline {
  font-size: 22px;
  line-height: 1.35;
}
.summary-sub {
  margin-top: 4px;
  font-size: 18px;
}
.banner-win { animation: pulse 1.1s infinite; }
@keyframes pulse {
  0%, 100% { text-shadow: 0 0 8px rgba(255,207,51,.8), 0 0 2px #000; }
  50% { text-shadow: 0 0 20px rgba(255,207,51,1), 0 0 32px rgba(255,207,51,.6), 0 0 2px #000; }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,.65);
}
.modal.open { display: flex; }
.modal-card {
  width: min(390px, 100%);
  color: var(--chalk);
  background: var(--bezel);
  border: 3px solid #000;
  padding: 16px;
  box-shadow: 5px 5px 0 #000;
}
.modal-card h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 24px;
}
.modal-card p { margin: 0 0 12px; }
.modal-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

@media (min-width: 560px) {
  .screen {
    max-width: min(640px, calc(100vw - 28px));
  }
  .rugby-pitch {
    height: min(720px, calc(100dvh - 120px));
    min-height: 628px;
  }
  .pitch-slot.filled {
    width: 128px;
    min-height: 60px;
  }
  .sim-pitch {
    height: min(460px, calc(100dvh - 180px));
    min-height: 392px;
  }
}

@media (min-width: 920px) {
  .cab {
    align-items: flex-start;
    padding: clamp(14px, 2vw, 22px);
  }
  .screen {
    max-width: min(1180px, calc(100vw - 32px));
  }
  .pitch {
    min-height: calc(100dvh - 44px);
    padding: clamp(14px, 1.6vw, 22px);
  }
  .setup-stack,
  .summary-stack {
    width: min(560px, 100%);
    margin: 0 auto;
  }
  .home-stack {
    width: min(980px, 100%);
    min-height: calc(100dvh - 92px);
    margin: 0 auto;
  }
  .home-hero {
    grid-template-columns: minmax(380px, 1fr) minmax(350px, 430px);
    gap: 48px;
    padding: 12px 28px 0;
  }
  .home-copy h1 { font-size: 82px; }
  .home-pitch { width: min(410px, 100%); }
  .draft-stack {
    display: grid;
    grid-template-columns: minmax(420px, 520px) minmax(360px, 1fr);
    align-items: start;
    gap: 14px;
  }
  .draft-stack > .xv-panel {
    grid-column: 1;
    grid-row: 1 / span 3;
    position: sticky;
    top: 14px;
  }
  .draft-stack > .roll-button,
  .draft-stack > .roll-panel,
  .draft-stack > .draw-panel,
  .draft-stack > #simulate,
  .draft-stack > .complete-panel {
    grid-column: 2;
  }
  .draft-stack > .footer-actions {
    grid-column: 1 / -1;
  }
  .draft-stack .rugby-pitch {
    height: min(760px, calc(100dvh - 142px));
    min-height: 560px;
  }
  .draw-panel {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 140px);
  }
  .draw-panel .pick-list {
    flex: 1;
    max-height: none;
    min-height: 260px;
  }
  .roll-button {
    min-height: 128px;
  }
  .sim-stack {
    display: grid;
    grid-template-columns: minmax(420px, 520px) minmax(360px, 1fr);
    align-items: start;
    gap: 14px;
  }
  .sim-stack > .scorebar {
    grid-column: 1 / -1;
  }
  .sim-stack > .sim-team-panel {
    grid-column: 1;
    position: sticky;
    top: 14px;
  }
  .sim-stack > .fulltime-panel {
    grid-column: 1 / -1;
  }
  .sim-stack > .kickoff-panel,
  .sim-stack > .event-panel,
  .sim-stack > .previous-results-panel {
    grid-column: 2;
  }
  .sim-pitch {
    height: min(560px, calc(100dvh - 168px));
    min-height: 430px;
  }
  .sim-pitch .pitch-slot.filled {
    width: 92px;
    min-height: 44px;
  }
  .sim-pitch .pitch-player-name {
    font-size: 11px;
  }
  .event-list {
    max-height: calc(100dvh - 210px);
  }
}

@media (max-width: 430px) {
  .cab { padding: 0; }
  .screen {
    min-height: 100vh;
    border-radius: 0;
    padding: 8px;
  }
  .pitch {
    min-height: calc(100vh - 16px);
    padding: 10px;
    border-radius: 4px;
  }
  h1 { font-size: 42px; }
  .tile { font-size: 18px; }
  .field-markings { inset: 12px; }
  .pitch-slot.filled {
    padding: 4px;
  }
  .slot-tools {
    top: 1px;
    right: 1px;
  }
  .slot-tools .mini {
    min-width: 15px;
    min-height: 15px;
    font-size: 7px;
  }
  .pitch-rate {
    right: 3px;
    bottom: 3px;
    font-size: 11px;
  }
  .pickbtn {
    gap: 6px;
    padding: 6px;
  }
  .pick-pos {
    max-width: 120px;
    font-size: 9px;
  }
}

@media (max-width: 360px) {
  .pitch {
    padding: 8px;
  }
  .rugby-pitch {
    height: 548px;
    min-height: 548px;
  }
  .pitch-slot.filled {
    width: 88px;
    min-height: 48px;
  }
  .pitch-player-name {
    font-size: 9px;
  }
  .pitch-player small {
    font-size: 7px;
  }
  .sim-pitch .pitch-slot.filled {
    width: 68px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .crt::after, .shake, .event-latest, .match-row, .banner-win, .pitch-slot.scoring {
    animation: none;
  }
}
