:root {
  color-scheme: dark;
  font-family: "Avenir Next Condensed", "Trebuchet MS", "Gill Sans", Verdana, sans-serif;
  background: #050807;
  color: #f5ffe8;
  --cyan: #58f1ff;
  --magenta: #ff4e91;
  --amber: #ffd45c;
  --ink: #071015;
  touch-action: none;
  user-select: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 48% 10%, rgba(255, 212, 92, 0.18), transparent 34%),
    radial-gradient(circle at 18% 70%, rgba(255, 78, 145, 0.12), transparent 36%),
    linear-gradient(180deg, #07091b 0%, #030407 100%);
}

button {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  width: min(100vw, 480px);
  height: 100dvh;
  max-height: 960px;
  overflow: hidden;
  background: #071015;
  box-shadow:
    0 0 0 1px rgba(88, 241, 255, 0.16),
    0 0 80px rgba(0, 0, 0, 0.62);
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hud {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr minmax(80px, 0.68fr) 1fr auto;
  gap: 8px;
  align-items: stretch;
  padding: 8px;
  border: 1px solid rgba(88, 241, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 78, 145, 0.1), transparent 22%, transparent 78%, rgba(88, 241, 255, 0.11)),
    linear-gradient(180deg, rgba(6, 13, 25, 0.9), rgba(5, 7, 14, 0.68));
  backdrop-filter: blur(14px);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.player-score,
.round-box {
  display: grid;
  align-content: center;
  min-width: 0;
}

.player-score {
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.rival-side {
  grid-template-columns: minmax(0, 1fr) 44px;
}

.score-stack {
  display: grid;
  min-width: 0;
}

.align-right {
  text-align: right;
}

.score-name,
.round-box span {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--amber);
}

.player-score strong {
  font-size: clamp(1.8rem, 9vw, 2.8rem);
  line-height: 0.86;
  color: #fffdf2;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.35),
    0 0 14px rgba(255, 212, 92, 0.35);
}

.hud-portrait {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.08)),
    url("../assets/characters.png");
  background-repeat: no-repeat;
  background-size: 210% auto;
  box-shadow:
    0 0 16px rgba(88, 241, 255, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.portrait-you {
  background-position: 9% 10%;
}

.portrait-rival {
  background-position: 90% 10%;
}

.round-box {
  justify-items: center;
  text-align: center;
  padding-inline: 6px;
  border-inline: 1px solid rgba(88, 241, 255, 0.18);
}

.round-box small {
  width: 100%;
  margin-top: 6px;
  overflow: hidden;
  color: #b7f7ff;
  font-size: 0.66rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meter {
  width: 100%;
  height: 5px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(237, 255, 213, 0.16);
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--amber), #ff7a31, var(--magenta));
  transition: width 140ms linear;
}

#rivalMeter {
  background: linear-gradient(90deg, var(--cyan), #4765ff, var(--magenta));
}

.hud-actions {
  display: flex;
  gap: 5px;
  align-items: center;
  pointer-events: auto;
}

.icon-button {
  width: 34px;
  height: 42px;
  border: 1px solid rgba(88, 241, 255, 0.24);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(88, 241, 255, 0.12), rgba(4, 8, 18, 0.82)),
    rgba(8, 19, 28, 0.78);
  color: #f9ffe9;
  font-size: 0.67rem;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.icon-button:active,
.shot-button:active,
.primary-button:active {
  transform: translateY(1px) scale(0.98);
}

.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px;
  pointer-events: none;
}

.stick-zone {
  position: relative;
  width: clamp(122px, 33vw, 154px);
  aspect-ratio: 1;
  border: 2px solid rgba(88, 241, 255, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(88, 241, 255, 0.14), rgba(255, 78, 145, 0.06)),
    rgba(5, 8, 18, 0.5);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.26),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  pointer-events: auto;
  touch-action: none;
}

.stick-ring {
  position: absolute;
  inset: 18%;
  border: 2px solid rgba(88, 241, 255, 0.48);
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(88, 241, 255, 0.16);
}

.stick-ring::before,
.stick-ring::after {
  content: "";
  position: absolute;
  background: rgba(245, 255, 238, 0.32);
}

.stick-ring::before {
  left: 50%;
  top: -20%;
  bottom: -20%;
  width: 2px;
}

.stick-ring::after {
  top: 50%;
  left: -20%;
  right: -20%;
  height: 2px;
}

.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border: 2px solid rgba(145, 229, 255, 0.85);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #ffffff, var(--cyan) 38%, #2344b7 70%, #0a1436);
  box-shadow:
    0 6px 20px rgba(38, 154, 225, 0.34),
    0 0 24px rgba(88, 241, 255, 0.28);
  transform: translate(0, 0);
}

.shot-buttons {
  display: flex;
  align-items: end;
  gap: 12px;
  pointer-events: auto;
}

.shot-button {
  position: relative;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: #fff9d4;
  font-weight: 1000;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(42, 15, 32, 0.52);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.34),
    inset 0 2px 0 rgba(255, 255, 255, 0.2);
}

.shot-button span {
  position: relative;
  z-index: 1;
  font-size: clamp(0.78rem, 3.2vw, 0.95rem);
}

.shot-button.swing {
  width: clamp(88px, 23vw, 112px);
  height: clamp(88px, 23vw, 112px);
  background:
    radial-gradient(circle at 34% 26%, #fff7b5 0 10%, transparent 11%),
    radial-gradient(circle at 50% 60%, rgba(255, 255, 255, 0.2), transparent 35%),
    conic-gradient(from 12deg, #ffcf48, #ff4e91, #ff7a31, #ffcf48, #ffcf48);
}

.shot-button.skill {
  width: clamp(64px, 17vw, 78px);
  height: clamp(64px, 17vw, 78px);
  background:
    radial-gradient(circle at 34% 26%, #d8ffff 0 12%, transparent 13%),
    radial-gradient(circle at 50% 58%, rgba(255, 255, 255, 0.22), transparent 35%),
    conic-gradient(from 200deg, #14256f, var(--cyan), #2456ff, var(--magenta), #14256f);
}

.shot-button.skill.locked {
  filter: grayscale(0.9) brightness(0.68);
}

.shot-button.ready {
  animation: pulse-ready 880ms ease-in-out infinite alternate;
}

.panel {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(5, 7, 17, 0.24), rgba(3, 4, 7, 0.78)),
    radial-gradient(circle at 50% 34%, rgba(255, 78, 145, 0.18), transparent 42%);
}

.panel.hidden {
  display: none;
}

.panel-card {
  width: min(100%, 360px);
  padding: 20px 18px 20px;
  border: 1px solid rgba(88, 241, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(12, 20, 43, 0.88), rgba(5, 8, 19, 0.84)),
    rgba(6, 14, 15, 0.84);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  text-align: center;
}

.panel-card span {
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
}

.versus-art {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 54px 1fr;
  align-items: end;
  height: 132px;
  margin: 8px 0 2px;
  overflow: hidden;
}

.portrait-card {
  display: block;
  align-self: stretch;
  background-image: url("../assets/characters.png");
  background-repeat: no-repeat;
  background-size: 205% auto;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.42));
}

.player-card {
  background-position: 4% 8%;
}

.rival-card {
  background-position: 98% 8%;
}

.versus-art b {
  align-self: center;
  color: #fff7c5;
  font-size: 1.55rem;
  line-height: 1;
  text-shadow:
    0 0 12px rgba(255, 212, 92, 0.6),
    0 2px 0 rgba(0, 0, 0, 0.5);
}

.panel-card h1 {
  margin: 6px 0 10px;
  color: #fffbe6;
  font-size: clamp(2.4rem, 13vw, 4.6rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.panel-card p {
  margin: 0 auto 22px;
  color: #c5f6ff;
  font-size: 0.98rem;
  line-height: 1.45;
}

.primary-button {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 7px;
  background:
    linear-gradient(90deg, var(--amber), #ff7a31 48%, var(--magenta));
  color: #190b13;
  font-weight: 1000;
  text-transform: uppercase;
  box-shadow:
    0 9px 0 #5f1736,
    0 20px 36px rgba(0, 0, 0, 0.36);
}

@keyframes pulse-ready {
  from {
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.34), 0 0 0 rgba(92, 224, 255, 0);
  }

  to {
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.34), 0 0 28px rgba(92, 224, 255, 0.78);
  }
}

@media (max-width: 370px) {
  .hud {
    grid-template-columns: 1fr 70px 1fr;
  }

  .hud-actions {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .icon-button {
    height: 28px;
  }
}
