@import url('../global.css');

:root {
  --title-color: var(--color-dodgeball);
  --dodgeball-background: var(--surface-base);
  --dodgeball-background-glow: color-mix(in srgb, var(--color-dodgeball) 15%, var(--surface-base));
  --dodgeball-grid: color-mix(in srgb, var(--line) 42%, transparent);
  --dodgeball-arena-edge: color-mix(in srgb, var(--color-dodgeball) 65%, var(--line-strong));
  --dodgeball-player-glow: color-mix(in srgb, var(--color-dodgeball) 72%, transparent);
  --dodgeball-dash: var(--accent);
  --dodgeball-projectile: var(--accent);
  --dodgeball-projectile-glow: color-mix(in srgb, var(--dodgeball-projectile) 78%, transparent);
}

.dodgeball-board[data-visual-theme='arcade'] {
  --dodgeball-background: #2a0e26;
  --dodgeball-background-glow: color-mix(in srgb, #ff4fd8 15%, #2a0e26);
  --dodgeball-grid: rgb(255 79 216 / 12%);
  --dodgeball-arena-edge: #a4348e;
}

.dodgeball-board[data-visual-theme='midnight'] {
  --dodgeball-background: #050c1a;
  --dodgeball-background-glow: color-mix(in srgb, #38bdf8 15%, #050c1a);
  --dodgeball-grid: rgb(56 189 248 / 12%);
  --dodgeball-arena-edge: #2b6f96;
}

.dodgeball-board[data-visual-theme='daylight'] {
  --dodgeball-background: #241640;
  --dodgeball-background-glow: color-mix(in srgb, #a78bfa 15%, #241640);
  --dodgeball-grid: rgb(124 58 237 / 16%);
  --dodgeball-arena-edge: #6d4bb0;
}

.dodgeball-board[data-visual-theme='amber'] {
  --dodgeball-background: #1a1004;
  --dodgeball-background-glow: color-mix(in srgb, #fbbf24 15%, #1a1004);
  --dodgeball-grid: rgb(251 191 36 / 12%);
  --dodgeball-arena-edge: #a3701e;
}

.dodgeball-board {
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 0;
  background: var(--dodgeball-background);
  border: 1px solid var(--dodgeball-arena-edge);
  border-radius: var(--border-radius-lg);
  isolation: isolate;
  touch-action: none;
  box-shadow:
    inset 0 0 0 3px rgb(42 19 29 / 76%),
    inset 0 0 32px rgb(7 6 15 / 42%),
    0 0 28px color-mix(in srgb, var(--color-dodgeball) 18%, transparent);
}

.dodgeball-canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  touch-action: none;
  user-select: none;
}

.dodgeball-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  background: linear-gradient(
    180deg,
    transparent 72%,
    color-mix(in srgb, var(--black-color) 48%, transparent)
  );
  pointer-events: none;
}

.dodgeball-hint {
  max-width: 14rem;
  margin: 0;
  color: var(--ink-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  line-height: 1.35;
  text-shadow: 0 1px 2px var(--black-color);
}

.dodgeball-dash-button {
  min-width: 7.5rem;
  min-height: var(--tap-target-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  border: 1px solid color-mix(in srgb, var(--dodgeball-dash) 68%, var(--white-color));
  border-radius: var(--border-radius-md);
  background: color-mix(in srgb, var(--surface-1) 86%, var(--dodgeball-dash));
  color: var(--ink);
  font: inherit;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 0 18px color-mix(in srgb, var(--dodgeball-dash) 24%, transparent);
  transition:
    background var(--ease-ui),
    border-color var(--ease-ui),
    transform var(--ease-ui),
    opacity var(--ease-ui);
}

.dodgeball-dash-button:hover,
.dodgeball-dash-button:focus-visible,
.dodgeball-dash-button.is-ready {
  background: color-mix(in srgb, var(--dodgeball-dash) 30%, var(--surface-1));
  border-color: var(--dodgeball-dash);
}

.dodgeball-dash-button:active {
  transform: scale(0.96);
}

.dodgeball-dash-status {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .dodgeball-overlay {
    padding: var(--spacing-sm);
  }

  .dodgeball-hint {
    max-width: 8rem;
  }

  .dodgeball-dash-button {
    min-width: 6.7rem;
  }
}
