/* ALPHA-11 FIGHT shell: true fullscreen landscape. Canvas owns the viewport. */
:root {
  --bg: #0b0b0c;
  --accent: #e8ff47;
  --pink: #ff8bd1;
  --text: #f4f1ea;
  --muted: rgba(244, 241, 234, 0.42);
  --card: #141418;
  --line: rgba(244, 241, 234, 0.1);
  --pad-safe-t: env(safe-area-inset-top, 0px);
  --pad-safe-r: env(safe-area-inset-right, 0px);
  --pad-safe-b: env(safe-area-inset-bottom, 0px);
  --pad-safe-l: env(safe-area-inset-left, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body,
.fight-shell,
.game-wrapper,
#game-container,
.game-content {
  margin: 0;
  padding: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  overflow: hidden;
  background: var(--bg);
}

html,
body {
  color: var(--text);
  font-family: Outfit, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

body {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  position: fixed;
  inset: 0;
}

.fight-shell,
.game-wrapper,
#game-container,
.game-content {
  position: fixed;
  inset: 0;
  display: block;
  aspect-ratio: auto;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  max-height: none;
  object-fit: fill;
  background: #101014;
  border: 0;
  border-radius: 0;
  touch-action: none;
}

.fight-sr,
#player1-controls,
#player2-controls,
.game-title,
.pause-instruction {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.fight-hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(6px + var(--pad-safe-t)) calc(10px + var(--pad-safe-r)) 0 calc(10px + var(--pad-safe-l));
  pointer-events: none;
}

.fight-hud a,
.fight-hud button {
  pointer-events: auto;
}

.fight-back,
.fight-pause,
.fight-fs {
  border: 1px solid rgba(244, 241, 234, 0.18);
  background: rgba(11, 11, 12, 0.42);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-decoration: none;
  min-height: 32px;
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.fight-hud-actions {
  display: flex;
  gap: 6px;
}

.fight-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.14em;
  color: var(--accent);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.fight-brand svg {
  width: 14px;
  height: 14px;
  display: block;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 11, 12, 0.45);
  display: none;
  z-index: 8;
}

#menu-overlay,
#pause-menu,
#game-over-menu {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92%, 320px);
  padding: 18px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
  z-index: 9;
  text-align: center;
  color: var(--text);
}

#menu-overlay,
#pause-menu,
#game-over-menu {
  display: none;
}

.input-group,
#single-player-inputs,
#multiplayer-inputs {
  display: none;
}

.menu-button,
.player-name-input {
  display: block;
  width: 100%;
  max-width: 220px;
  margin: 8px auto;
  padding: 10px 12px;
  border-radius: 999px;
  border: 0;
  font: inherit;
  font-weight: 800;
}

.menu-button {
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
}

.back-button {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.player-name-input {
  background: #17171c;
  color: var(--text);
  border: 1px solid var(--line);
  text-align: center;
}

.input-label,
.pause-title,
#winner-message,
.winner-text {
  color: var(--text);
  margin: 0 0 12px;
}

.fight-pad {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 0 calc(12px + var(--pad-safe-r)) calc(10px + var(--pad-safe-b)) calc(12px + var(--pad-safe-l));
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

html.fight-playing .fight-pad {
  opacity: 1;
  visibility: visible;
}

html.fight-playing .fight-brand {
  display: none;
}

.fight-cluster {
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.fight-cluster-move {
  grid-template-columns: repeat(3, minmax(56px, 8vw));
  grid-template-areas:
    '. up .'
    'left down right';
}

.fight-cluster-act {
  grid-template-columns: repeat(3, minmax(56px, 8vw));
}

.fight-key {
  pointer-events: auto;
  min-height: 52px;
  min-width: 52px;
  border: 1px solid rgba(244, 241, 234, 0.16);
  border-radius: 18px;
  background: rgba(23, 23, 28, 0.46);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(244, 241, 234, 0.08);
  touch-action: none;
  cursor: pointer;
}

.fight-key[data-key='w'] {
  grid-area: up;
}

.fight-key[data-key='a'] {
  grid-area: left;
}

.fight-key[data-key='s'] {
  grid-area: down;
}

.fight-key[data-key='d'] {
  grid-area: right;
}

.fight-key-acc {
  background: rgba(255, 139, 209, 0.55);
  color: #1a0b14;
}

.fight-key-fire {
  background: rgba(232, 255, 71, 0.62);
  color: var(--bg);
}

.fight-key.is-down,
.fight-key:active {
  transform: scale(0.97);
  filter: brightness(1.16);
}

.fight-rotate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(255, 139, 209, 0.12), transparent 56%),
    #0b0b0c;
}

html.fight-portrait .fight-rotate {
  display: grid;
}

.fight-rotate-card {
  width: min(92vw, 360px);
  text-align: center;
}

.fight-phone {
  width: 42px;
  height: 72px;
  margin: 0 auto 18px;
  border: 3px solid var(--accent);
  border-radius: 10px;
  animation: fight-tilt 1.4s ease-in-out infinite;
}

.fight-rotate-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.fight-rotate-copy {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.45;
}

.fight-rotate-btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--accent);
  color: var(--bg);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

@keyframes fight-tilt {
  0%,
  100% {
    transform: rotate(0deg);
  }
  40% {
    transform: rotate(90deg);
  }
}

@media (orientation: portrait) and (max-width: 900px) {
  .fight-rotate {
    display: grid;
  }

  .fight-pad,
  .fight-hud {
    visibility: hidden;
  }
}

@media (max-height: 420px) {
  .fight-key {
    min-height: 46px;
    min-width: 46px;
    font-size: 10px;
  }

  .fight-cluster-move,
  .fight-cluster-act {
    grid-template-columns: repeat(3, minmax(46px, 7vw));
  }

  .fight-brand span {
    display: none;
  }
}
