* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(6px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
  background: #181210;
  color: #fff4e6;
  font:
    1rem system-ui,
    sans-serif;
}
main {
  max-width: 100%;
}
.panel {
  background: #2c211b;
  border-radius: 18px;
  padding: clamp(16px, 5vw, 36px);
  width: min(450px, 100%);
}
h1 {
  margin: 0.6em 0 0.2em;
}
a {
  color: #ffc47e;
}
button {
  border: 0;
  border-radius: 10px;
  background: #ff9d00;
  color: #221309;
  font: inherit;
  font-weight: 750;
  padding: 0.55em 0.9em;
  min-height: 36px;
  cursor: pointer;
}
.panel button {
  margin: 4px 0;
}
input {
  display: block;
  width: 100%;
  font: inherit;
  margin: 5px 0;
}
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}
#red {
  color: #ff6976;
}
#blue {
  color: #77adff;
}
#arena {
  position: relative;
}
canvas {
  display: block;
  width: min(
    800px,
    calc(
      100dvw - max(8px, env(safe-area-inset-left)) -
        max(8px, env(safe-area-inset-right))
    ),
    max(
      180px,
      calc(
        (
            100dvh - 88px - env(safe-area-inset-top) -
              env(safe-area-inset-bottom)
          ) *
          2
      )
    )
  );
  height: auto;
  border-radius: 10px;
}
#result {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  background: #181210db;
  border-radius: 10px;
}
#rotate,
#touch {
  display: none;
}
#keyboard {
  margin: 4px 0 0;
  text-align: center;
  font-size: 0.85rem;
}
@media (any-pointer: coarse) {
  #keyboard {
    display: none;
  }
  #touch {
    display: flex;
    position: absolute;
    inset: auto 8px 8px;
    justify-content: space-between;
    align-items: end;
    pointer-events: none;
  }
  #touch button {
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    border-radius: 50%;
  }
  #stick {
    display: grid;
    place-items: center;
    width: 74px;
    height: 74px;
    padding: 0;
    background: #15181bc9;
    border: 2px solid #fff9;
  }
  #stick span {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    pointer-events: none;
  }
  #kick {
    width: 60px;
    height: 60px;
  }
}
@media (any-pointer: coarse) and (orientation: portrait) {
  #rotate {
    display: block;
    text-align: center;
  }
}

/* Keep browser gestures off the controls without disabling page zoom. */
html {
  touch-action: manipulation;
}
#arena,
#kick,
#stick {
  touch-action: none;
}
#kick {
  background: linear-gradient(155deg, #ffe29d, #ff9d38);
  box-shadow:
    0 3px 0 #9a470d,
    0 4px 14px #0008;
}
#kick:active {
  box-shadow: 0 1px 0 #9a470d;
}
#goal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: clamp(2.5rem, 12vmin, 6rem);
  font-weight: 950;
  font-style: italic;
  color: #fff;
  text-shadow:
    0 3px 3px #000,
    0 0 22px var(--team-color);
  background: radial-gradient(ellipse, var(--team-color), transparent 65%);
  animation: goal-cheer 950ms both;
}
#goal[data-team="red"] {
  --team-color: #ed2e51bb;
}
#goal[data-team="blue"] {
  --team-color: #287bffbb;
}
@keyframes goal-cheer {
  0% {
    opacity: 0;
    transform: scale(0.82);
  }
  18% {
    opacity: 1;
    transform: scale(1);
  }
  72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  #goal {
    animation: none;
  }
}

.foot-menu {
  background:
    linear-gradient(115deg, #090f19aa, #07110f77),
    #172820 url("/foot-stadium.webp") center / cover no-repeat;
}
.panel {
  background: #121a23e8;
  border: 1px solid #ffffff32;
  box-shadow: 0 16px 50px #0007;
}
.panel button,
.panel .menu-action {
  transition:
    transform 0.2s ease,
    opacity 0.2s ease,
    box-shadow 0.25s ease;
}
.panel button:hover,
.panel .menu-action:hover {
  transform: translateY(-2px);
  opacity: 0.92;
  box-shadow: 0 6px 16px #ff9d002e;
}
.panel button:active,
.panel .menu-action:active {
  transform: scale(0.95);
}
.panel .impulsion {
  animation: impulsion-bouton 0.32s ease;
}
.menu-action {
  display: inline-block;
  border-radius: 10px;
  padding: 0.5em 0.75em;
}
.scoreline {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.score-red,
.score-blue {
  display: inline-flex;
  gap: 5px;
  min-width: 0;
}
.score-red {
  color: #ff6976;
}
.score-blue {
  color: #77adff;
}
#red-name,
#blue-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(18vw, 10em);
}
@media (prefers-reduced-motion: reduce) {
  .panel button,
  .panel .menu-action {
    transition: none;
  }
}
