.soccer-challenge {
  --soccer-deep: #102b48;
  --soccer-accent: #0e5c45;
  --soccer-aim: 50%;
  --soccer-keeper: 50%;
  --soccer-reach: .49;
  --soccer-shot-x: calc(8% + var(--soccer-aim) * .84);
  width: min(100%, 680px);
  color: var(--soccer-deep);
}

.soccer-hud, .soccer-footer, .soccer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .6rem;
}

.soccer-hud {
  min-height: 36px;
  padding: 0 2px;
  margin-bottom: .5rem;
  font-weight: 850;
}

.soccer-score { display: flex; gap: .42rem; padding: 0; margin: 0; list-style: none; }
.soccer-score li {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 2px solid #c5ded9;
  border-radius: 50%;
  background: #eef8f3;
  font-size: .86rem;
  line-height: 1;
}
.soccer-score li[data-current] { border-color: #17875c; box-shadow: 0 0 0 3px #35c4843d; }
.soccer-score li[data-outcome="goal"] { border-color: #16724b; background: #bbf7ba; color: #174d32; }
.soccer-score li[data-outcome="goal"]::before { content: '✓'; }
.soccer-score li[data-outcome="saved"], .soccer-score li[data-outcome="wall"] { border-color: #ac5638; background: #ffe2be; color: #672b1a; }
.soccer-score li[data-outcome="saved"]::before, .soccer-score li[data-outcome="wall"]::before { content: '×'; }

.soccer-field {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  height: clamp(224px, 56vw, 320px);
  border: 1px solid #345e79;
  border-radius: 18px;
  background: linear-gradient(#14275b 0%, #1e5990 50%, #28ad91 76%);
  box-shadow: 0 5px 0 #102b4821;
}

.soccer-crowd {
  position: absolute;
  inset: 0 0 39%;
  background:
    radial-gradient(ellipse at 12% 3%, #ffeec9 0 2%, #9dfff450 4%, transparent 29%),
    radial-gradient(ellipse at 87% 3%, #fff2d2 0 2%, #bbfff052 4%, transparent 30%),
    radial-gradient(circle, #ffd5a8 0 1px, transparent 1.6px) 2px 0 / 11px 10px,
    radial-gradient(circle, #9cdcff 0 1.5px, transparent 2.2px) 5px 4px / 13px 12px,
    repeating-linear-gradient(0deg, #192b5c 0 6px, #244c86 7px 15px);
  opacity: .75;
}

.soccer-crowd::before {
  position: absolute;
  content: '';
  inset: 0;
  background: radial-gradient(ellipse at 50% 15%, #21376c 0 27%, transparent 75%);
}

.soccer-grass {
  position: absolute;
  inset: 58% -10% -24%;
  border-top: 3px solid #efffb49e;
  border-radius: 50% 50% 0 0 / 7% 7% 0 0;
  background: repeating-linear-gradient(90deg, transparent 0 13%, #f8ffb61c 13% 26%), linear-gradient(#179555, #63d662);
}

.soccer-grass::after {
  position: absolute;
  content: '';
  inset: 26% 18% -20%;
  border: 2px solid #efffc8a0;
  border-radius: 50%;
  transform: rotateX(44deg);
}

.soccer-goal {
  position: absolute;
  inset: 15% 8% 32%;
  overflow: hidden;
  border: clamp(4px, 1.1vw, 8px) solid #f2fffb;
  border-bottom-width: 3px;
  border-radius: 12px 12px 3px 3px;
  background:
    repeating-linear-gradient(0deg, #cffbff44 0 1px, transparent 1px 12px),
    repeating-linear-gradient(90deg, #cffbff44 0 1px, transparent 1px 12px),
    linear-gradient(#0c3157e6, #195760a1);
  box-shadow: 0 3px 0 #0c383a8a, inset 0 7px 14px #12254f95;
}

.soccer-angles { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.soccer-angle {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  border-inline-end: 1px solid #defcff2f;
  border-radius: 0;
  background: transparent;
  color: white;
  cursor: pointer;
}
.soccer-angle:last-child { border-inline-end: 0; }
.soccer-angle:focus-visible, .soccer-ball:focus-visible { z-index: 3; outline: 3px solid white; outline-offset: -5px; }
.soccer-angle[data-aim="true"] { background: linear-gradient(#ffed7832, #ffed7811); }
.soccer-angle[data-aim="true"] > .soccer-target { opacity: 1; color: #ffe47b; transform: scale(1.11); }
@media (hover: hover) { .soccer-angle:hover > .soccer-target { opacity: .96; } }
.soccer-target {
  position: relative;
  display: block;
  width: 42%;
  max-width: 37px;
  aspect-ratio: 1;
  border: 2px solid currentColor;
  border-radius: 50%;
  color: #edfafa;
  opacity: .48;
}
.soccer-target::before, .soccer-target::after { content: ''; position: absolute; background: currentColor; }
.soccer-target::before { inset: 49% -16%; }
.soccer-target::after { inset: -16% 49%; }

.soccer-wall {
  position: absolute;
  inset: 12% 13% 7%;
  border: 2px solid #ffd699;
  border-radius: 8px 8px 3px 3px;
  background: repeating-linear-gradient(145deg, #b94924 0 7px, #f7a94b 7px 14px);
  box-shadow: 0 3px 0 #7c351d, inset 0 0 10px #5e341733;
}

.soccer-keeper {
  position: absolute;
  z-index: 2;
  left: var(--soccer-keeper);
  bottom: 3%;
  width: max(12%, calc(var(--soccer-reach) * 40%));
  height: 66%;
  transform: translateX(-50%);
  pointer-events: none;
}

.soccer-keeper::before {
  position: absolute;
  content: '';
  inset: 22% 0 7%;
  border: 1px dashed #e9ed94d1;
  border-radius: 40%;
  background: #f6ea533e;
  box-shadow: 0 0 12px #ffe3743d;
}
.soccer-keeper-head {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 50%;
  width: 34%;
  max-width: 25px;
  min-width: 12px;
  aspect-ratio: 1.05;
  border-radius: 55% 55% 46% 46%;
  transform: translateX(-50%);
  background: radial-gradient(circle at 36% 60%, #39264d 0 5%, transparent 6%), radial-gradient(circle at 65% 60%, #39264d 0 5%, transparent 6%), linear-gradient(#334886 34%, #ffd599 35% 88%, #e9a671 100%);
  box-shadow: inset 0 -2px 0 #87454840;
}
.soccer-keeper-body {
  position: absolute;
  left: 50%;
  bottom: 2%;
  width: 45%;
  max-width: 33px;
  min-width: 15px;
  height: 66%;
  border-radius: 35% 35% 18% 18%;
  transform: translateX(-50%);
  background: linear-gradient(#ffe774, #ff9f3e 62%, #143560 63%);
  box-shadow: inset 0 2px 0 #fff7b2, 0 3px 2px #143c3f80;
}
.soccer-keeper-glove {
  position: absolute;
  top: 27%;
  width: 22%;
  max-width: 16px;
  min-width: 8px;
  aspect-ratio: .9;
  border-radius: 70% 62% 60% 52%;
  background: linear-gradient(#fffde3, #9ef5de);
  box-shadow: 0 2px 0 #318c87;
}
.soccer-keeper-glove-left { left: 4%; transform: rotate(-24deg); }
.soccer-keeper-glove-right { right: 4%; transform: rotate(24deg); }

.soccer-aim {
  position: absolute;
  z-index: 1;
  left: min(50%, var(--soccer-shot-x));
  width: max(2px, calc(max(50%, var(--soccer-shot-x)) - min(50%, var(--soccer-shot-x))));
  height: 21%;
  bottom: 13%;
  background: #fff2a6b5;
  clip-path: polygon(0 0, 5% 0, 100% 98%, 100% 100%, 95% 100%);
  pointer-events: none;
}
.soccer-challenge:has(.soccer-angle[data-aim="true"][data-soccer-angle="3"]) .soccer-aim,
.soccer-challenge:has(.soccer-angle[data-aim="true"][data-soccer-angle="4"]) .soccer-aim { transform: scaleX(-1); }

.soccer-ball {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 7%;
  display: grid;
  place-items: center;
  width: clamp(44px, 9vw, 56px);
  height: clamp(44px, 9vw, 56px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  transform: translateX(-50%);
  background: transparent;
  touch-action: none;
  cursor: grab;
}
.soccer-ball:active { cursor: grabbing; }
.soccer-ball-mark {
  display: block;
  width: 87%;
  height: 87%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 39% 31%, #fff9 0 10%, transparent 46%),
    radial-gradient(circle at 49% 47%, #25374c 0 15%, transparent 16%),
    radial-gradient(circle at 86% 20%, #283e4e 0 10%, transparent 12%),
    radial-gradient(circle at 17% 72%, #283e4e 0 12%, transparent 14%),
    radial-gradient(circle at 81% 73%, #23374e 0 13%, transparent 14%),
    linear-gradient(135deg, #fff, #dfebdf 67%, #88a4a1);
  box-shadow: 0 4px 0 #174e3f68, 0 6px 9px #1d613e91;
}
.soccer-challenge[data-shot] .soccer-ball {
  left: var(--soccer-shot-x);
  bottom: 43%;
  transform: translateX(-50%) scale(.48);
  animation: soccer-kick .42s cubic-bezier(.23, .69, .39, 1) both;
}
.soccer-challenge[data-shot] .soccer-aim { visibility: hidden; }
.soccer-challenge[data-shot="goal"] .soccer-goal { box-shadow: 0 0 21px #fff475, inset 0 0 38px #ffe5686e; }
.soccer-challenge[data-shot="saved"] .soccer-keeper::before { border-color: #fff4d6; background: #fff0a98a; }
.soccer-challenge[data-shot="wall"] .soccer-angle[data-aim="true"] .soccer-wall { filter: brightness(1.32); }
.soccer-challenge[data-shot="wall"] .soccer-ball, .soccer-challenge[data-shot="saved"] .soccer-ball {
  bottom: 27%;
  transform: translateX(-50%) scale(.66);
  animation: soccer-rebound .56s cubic-bezier(.25, .61, .42, .98) both;
}
@keyframes soccer-kick {
  from { left: 50%; bottom: 7%; transform: translateX(-50%) scale(1); }
  70% { left: var(--soccer-shot-x); bottom: 49%; transform: translateX(-50%) scale(.55) rotate(90deg); }
  to { left: var(--soccer-shot-x); bottom: 43%; transform: translateX(-50%) scale(.48) rotate(139deg); }
}
@keyframes soccer-rebound {
  from { left: 50%; bottom: 7%; transform: translateX(-50%) scale(1); }
  55% { left: var(--soccer-shot-x); bottom: 45%; transform: translateX(-50%) scale(.51) rotate(82deg); }
  to { left: var(--soccer-shot-x); bottom: 27%; transform: translateX(-50%) scale(.66) rotate(-95deg); }
}

.soccer-footer { margin-top: .7rem; }
.soccer-status { flex: 1 1 11rem; min-height: 1.5em; margin: 0; font-weight: 680; line-height: 1.45; word-break: keep-all; }
.soccer-shoot, .soccer-mode, .soccer-step { border-radius: 12px; cursor: pointer; font: inherit; }
.soccer-shoot {
  flex: 0 0 auto;
  min-width: 90px;
  min-height: 48px;
  padding: .45rem 1rem;
  border: 1px solid #0a563f;
  background: linear-gradient(#168e63, #0d694c);
  color: #fff;
  box-shadow: inset 0 1px 0 #b3ffe38c, 0 3px 0 #094e39;
  font-weight: 850;
}
.soccer-shoot[aria-disabled="true"], .soccer-mode[aria-disabled="true"], .soccer-step[aria-disabled="true"] { opacity: .75; cursor: default; }
.soccer-controls { justify-content: flex-start; margin-top: .45rem; }
.soccer-mode, .soccer-step {
  min-height: 44px;
  padding: .35rem .65rem;
  border: 1px solid #90b7ac;
  background: #f3fff6;
  color: var(--soccer-accent);
  font-weight: 660;
}
.soccer-step[hidden] { display: none; }
.soccer-shoot:focus-visible, .soccer-mode:focus-visible, .soccer-step:focus-visible { outline: 3px solid #1c7c96; outline-offset: 2px; }

.soccer-preview { width: 100%; pointer-events: none; }
.soccer-preview .soccer-field { height: clamp(98px, 17vw, 138px); border-radius: 12px; box-shadow: none; }
.soccer-preview .soccer-goal { border-width: 3px; border-radius: 7px 7px 2px 2px; }
.soccer-preview .soccer-target { border-width: 1px; width: 40%; max-width: 16px; }
.soccer-preview .soccer-ball { width: 24px; height: 24px; }
.soccer-preview .soccer-keeper-head { max-width: 12px; min-width: 8px; }
.soccer-preview .soccer-keeper-body { max-width: 19px; min-width: 9px; }
.soccer-preview .soccer-keeper-glove { max-width: 9px; min-width: 4px; }

@media (prefers-reduced-motion: reduce) {
  .soccer-challenge[data-shot] .soccer-ball { animation: none; }
}
