/* Google Fonts are bundled locally; no CDN requests are used. */
@font-face {
  font-family: Barlow;
  src: url("../assets/fonts/heading.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: Rajdhani;
  src: url("../assets/fonts/ui.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ink: #0d1215;
  --panel: #151e23;
  --white: #eff0e9;
  --muted: #94a0a1;
  --line: #ffffff20;
  --accent: #d8eb55;
  --cyan: #83ced6;
  --red: #df726a;
  --hud-scale: 1;
  --hud-opacity: 1;
  --touch-scale: 1;
  --touch-opacity: 0.65;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #0b1013;
  color: var(--white);
  font-family: Rajdhani, Arial, sans-serif;
  font-weight: 500;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: wait;
  opacity: 0.45;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

button:active {
  filter: brightness(0.9);
}

svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.svg-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1,
h2,
h3,
h4,
strong,
b {
  font-weight: 600;
}

h1,
h2,
h3,
h4,
.heading {
  font-family: Barlow, Impact, sans-serif;
  letter-spacing: 0.025em;
}

small {
  font-size: 11px;
}

kbd {
  font:
    11px Rajdhani,
    Arial,
    sans-serif;
  border: 1px solid #ffffff50;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 21px;
  min-height: 19px;
  padding: 0 5px;
  color: #d9dfdc;
}

.hidden {
  display: none !important;
}

.screen {
  position: absolute;
  inset: 0;
}

.micro,
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.19em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
}

.eyebrow > span {
  width: 18px;
  height: 2px;
  background: currentColor;
}

.tiny-square {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--accent);
}

#app,
#render-surface {
  position: absolute;
  inset: 0;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

#render-surface {
  background: #0b1114 url("../assets/ui/combat/compound.webp") center/cover
    no-repeat;
}

#app.in-game #render-surface {
  background: #77858b;
}

.screen-grain {
  position: absolute;
  inset: 0;
  opacity: 0.1;
  pointer-events: none;
  background-image: url("../assets/images/noise.svg");
}

#loader {
  z-index: 40;
  background: #05090b;
}

.loader-city {
  position: absolute;
  inset: -3%;
  background:
    linear-gradient(0deg, #030708b8, transparent 65%),
    url("../assets/ui/combat/combat.webp") center/cover;
  animation: city-drift 28s ease-in-out infinite alternate;
}

.loader-haze {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 60%, #8aa6a308, transparent 65%);
  animation: haze 10s ease-in-out infinite alternate;
}

.loader-top {
  position: absolute;
  top: 5%;
  left: 4%;
  right: 4%;
  display: flex;
  justify-content: space-between;
  color: #b0b9b7;
  font-size: 9px;
}

.loader-center {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  width: min(650px, 65vw);
  text-align: center;
}

.loader-center img {
  width: 100%;
  filter: drop-shadow(0 15px 24px #0009);
  animation: logo-in 1.2s cubic-bezier(0.2, 0.6, 0.2, 1) both;
}

.start-button {
  margin: 34px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: Barlow, sans-serif;
  letter-spacing: 0.16em;
  font-size: 15px;
  min-width: 190px;
  padding: 15px;
}

.start-dot {
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.start-button:not(:disabled) .start-dot {
  box-shadow: 0 0 12px #d7ff7a;
  animation: pulse 2s infinite;
}

.loader-bottom {
  position: absolute;
  left: 50%;
  bottom: 6%;
  transform: translateX(-50%);
  width: min(390px, 70vw);
}

.loader-progress {
  height: 2px;
  background: #ffffff1c;
  width: 100%;
  overflow: hidden;
}

.loader-progress > div {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.25s;
}

.loader-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.12em;
  margin-top: 12px;
  color: #b9c2bd;
}

.loader-bottom p {
  font-size: 9px;
  letter-spacing: 0.13em;
  color: #6e7b7b;
  text-align: center;
  margin-top: 24px;
}

.loader-bottom p span {
  padding: 0 12px;
}

.icon-button {
  position: relative;
  width: 45px;
  height: 46px;
  display: grid;
  place-items: center;
  background: linear-gradient(#ffffff0e, #10181d80);
  border: 1px solid #ffffff13;
  transition: 0.2s;
}

.icon-button:hover {
  background: #ffffff22;
  color: var(--accent);
}

.notification-dot {
  position: absolute;
  right: 10px;
  top: 9px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.close-button {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #b0bdbb;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.close-button:hover {
  color: var(--accent);
}

.close-button svg {
  width: 20px;
  margin-left: 10px;
}

.accent-button,
.dark-button {
  height: 50px;
  padding: 0 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  letter-spacing: 0.09em;
  font-family: Barlow, sans-serif;
  font-size: 16px;
  border: 1px solid #ffffff28;
}

.accent-button {
  background: var(--accent);
  color: #171d17;
  border-color: var(--accent);
}

.accent-button:hover {
  background: #e9fa85;
}

.accent-button svg {
  width: 18px;
}

.dark-button {
  background: #151e25b0;
}

.dark-button:hover {
  background: #253038;
}

.text-button {
  font-size: 12px;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #a5b0ad;
}

.text-button:hover {
  color: var(--accent);
}

.overlay {
  background: linear-gradient(110deg, #0e1519f5, #1c2730eb 60%, #0b1115fa);
  backdrop-filter: blur(15px);
  z-index: 22;
}

.page-shell {
  max-width: 1600px;
  height: 100%;
  margin: auto;
  padding: 4vh 5vw;
  display: flex;
  flex-direction: column;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3vh;
}

.page-header .eyebrow {
  font-size: 10px;
}

.page-header h2 {
  font-size: 40px;
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.page-header h2 svg {
  width: 30px;
  height: 30px;
}

.page-header h2:after {
  content: "";
  display: inline-block;
  width: 45px;
  height: 3px;
  margin-left: 15px;
  background: var(--accent);
}

#page-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #697772 #11191e;
}

#toast {
  position: fixed;
  right: max(28px, env(safe-area-inset-right));
  bottom: max(28px, env(safe-area-inset-bottom));
  transform: translateY(8px);
  background: linear-gradient(110deg, #101922ec, #101922c9);
  border: 0;
  padding: 14px 16px;
  z-index: 99;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  max-width: min(350px, calc(100vw - 40px));
  text-align: left;
}

#toast.visible {
  opacity: 1;
  transform: translateY(0);
}

#fatal-error {
  position: fixed;
  z-index: 100;
  inset: 0;
  background: #0d161d;
  padding: 15vh 12vw;
  font-size: 20px;
  white-space: pre-line;
  line-height: 1.7;
  border-top: 3px solid var(--accent);
}

#match-loading {
  z-index: 30;
  background: #111a20;
}

.loading-art {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #0e171def, transparent),
    url("../assets/ui/combat/compound.webp") center/cover;
}

.loading-content {
  position: absolute;
  left: 7%;
  top: 26%;
  width: min(520px, 75vw);
}

.loading-content h2 {
  font-size: clamp(64px, 9vw, 120px);
  line-height: 1.1;
  margin: 16px 0;
}

.loading-content p {
  letter-spacing: 0.18em;
  font-size: 12px;
  color: #bdc7c3;
}

.loading-rule {
  width: 60px;
  height: 3px;
  background: var(--accent);
  margin: 30px 0;
}

.loading-content strong {
  display: block;
  font-family: Barlow, sans-serif;
  font-size: 24px;
}

.loading-content small {
  display: block;
  color: #a9b4b0;
  margin: 18px 0 35px;
  font-size: 14px;
}

.loading-content > span:last-child {
  display: block;
  font-size: 10px;
  letter-spacing: 0.16em;
  margin-top: 12px;
  color: var(--accent);
}

.loading-brand {
  position: absolute;
  right: 5%;
  bottom: 6%;
}

.pause-shell {
  position: absolute;
  left: 9%;
  top: 15%;
  width: min(440px, 80vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pause-shell h2 {
  font-size: 64px;
  line-height: 1;
  margin: 14px 0;
}

.pause-shell p {
  color: #a9b4b3;
  letter-spacing: 0.2em;
  font-size: 12px;
  margin-bottom: 24px;
}

.pause-shell .text-button {
  padding: 20px 0;
}

.pause-shell small {
  font-size: 12px;
  color: #718383;
  margin-top: 15px;
}

.pause-shell .dark-button {
  justify-content: flex-start;
}

.pause-shell .accent-button {
  justify-content: space-between;
}

#pause {
  background: linear-gradient(90deg, #0e161bee, #17242b96);
  z-index: 19;
}

#death-screen {
  z-index: 15;
  pointer-events: none;
  background: none;
  display: grid;
  place-items: center;
  text-align: center;
}

#death-screen h2 {
  font-size: 60px;
  margin: 10px 0;
  text-shadow: 0 2px 20px #000;
}

#death-screen .eyebrow {
  justify-content: center;
  color: #fb9790;
}

#death-screen p {
  letter-spacing: 0.15em;
}

#death-screen b {
  font-size: 28px;
  margin-left: 10px;
}

.scoreboard-shell {
  width: min(900px, 90%);
  margin: 8vh auto;
  background: #0b1319ad;
  border-top: 3px solid var(--accent);
  padding: 30px;
}

.scoreboard-shell h2 {
  font-size: 40px;
  margin: 10px 0 30px;
}

.scoreboard-shell > small {
  display: block;
  margin-top: 25px;
  color: #8a9b98;
  letter-spacing: 0.12em;
}

.board-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.board-table th {
  text-align: left;
  color: #8eaaa9;
  font-size: 11px;
  letter-spacing: 0.15em;
  padding: 14px;
}

.board-table td {
  padding: 12px 14px;
  border-top: 1px solid #ffffff12;
}

.board-table th:not(:first-child),
.board-table td:not(:first-child) {
  text-align: center;
}

.board-table tr.player-row {
  background: #d8eb5510;
  color: var(--accent);
}

.board-team {
  font-size: 12px;
  letter-spacing: 0.15em;
  border-left: 3px solid var(--cyan);
  background: #75d9e00c;
  padding: 10px 12px;
  margin: 20px 0 0;
}

.board-team.red {
  border-color: var(--red);
  background: #e6736b0c;
}

.results-shell {
  max-width: 950px;
  margin: 5vh auto;
  text-align: center;
  padding: 25px;
  max-height: 92vh;
  overflow: auto;
}

.results-shell > .eyebrow {
  justify-content: center;
}

.results-shell h2 {
  font-size: 92px;
  color: var(--accent);
  line-height: 1.2;
  letter-spacing: 0.12em;
}

.results-shell > p {
  letter-spacing: 0.15em;
  color: #a4b4af;
  font-size: 13px;
}

.result-score {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  margin: 20px 0;
}

.result-score b {
  font-size: 48px;
  color: var(--cyan);
  font-family: Barlow, sans-serif;
}

.result-score b:last-child {
  color: var(--red);
}

#result-stats {
  display: flex;
  justify-content: center;
  margin: 20px auto 30px;
}

#result-stats > div {
  padding: 0 30px;
  border-right: 1px solid #ffffff20;
}

#result-stats > div:last-child {
  border: 0;
}

#result-stats b {
  display: block;
  font-family: Barlow, sans-serif;
  font-size: 32px;
}

#result-stats small {
  font-size: 10px;
  letter-spacing: 0.15em;
  color: #a7b5ae;
}

#result-board {
  max-height: 30vh;
  overflow: auto;
  text-align: left;
  margin-bottom: 25px;
}

.results-shell > .dark-button {
  margin-left: 12px;
}

.results-shell .board-table td {
  padding: 7px 14px;
}

@keyframes city-drift {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.055) translateX(-0.5%);
  }
}

@keyframes haze {
  from {
    opacity: 0.3;
    transform: translateX(-3%);
  }

  to {
    opacity: 0.85;
    transform: translateX(3%);
  }
}

@keyframes logo-in {
  from {
    opacity: 0;
    transform: scale(0.93) translateY(12px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 800px) {
  .page-shell {
    padding: 3vh 4vw;
  }

  .page-header h2 {
    font-size: 30px;
  }

  .page-header {
    margin-bottom: 2vh;
  }

  .page-header .eyebrow {
    font-size: 8px;
  }

  .close-button {
    font-size: 10px;
  }

  .loader-center {
    width: 75vw;
  }

  .pause-shell {
    top: 8%;
    gap: 8px;
  }

  .pause-shell h2 {
    font-size: 42px;
  }

  .pause-shell .dark-button,
  .pause-shell .accent-button {
    height: 40px;
  }

  .pause-shell p {
    margin-bottom: 8px;
  }

  .pause-shell small {
    margin-top: 0;
  }

  .results-shell {
    margin: 2vh auto;
    padding: 12px;
  }

  .results-shell h2 {
    font-size: 55px;
  }

  .result-score {
    margin: 5px 0;
  }

  .result-score b {
    font-size: 30px;
  }

  #result-stats {
    margin: 12px 0;
  }

  #result-stats > div {
    padding: 0 20px;
  }

  #result-stats b {
    font-size: 24px;
  }

  .board-table td {
    padding: 8px;
    font-size: 12px;
  }

  .scoreboard-shell {
    margin: 4vh auto;
    padding: 15px;
  }

  .results-shell > .accent-button,
  .results-shell > .dark-button {
    height: 40px;
    padding: 0 15px;
    font-size: 12px;
  }
}

.loader-bottom {
  pointer-events: none;
}

.loader-center {
  z-index: 1;
}

@media (max-height: 550px) {
  .loader-center {
    width: min(500px, 53vw);
    top: 44%;
  }

  .loader-center img {
    max-height: 42vh;
    object-fit: contain;
  }

  .start-button {
    margin: 15px auto 0;
    padding: 8px;
    font-size: 12px;
  }

  .loader-bottom {
    bottom: 4%;
    width: 280px;
  }

  .loader-bottom p {
    display: none;
  }

  .loader-meta {
    font-size: 7px;
    margin-top: 8px;
  }

  .loader-top .micro {
    font-size: 7px;
  }

  .pause-shell {
    top: 7%;
    gap: 7px;
  }

  .pause-shell h2 {
    font-size: 40px;
    margin: 8px 0;
  }

  .pause-shell p {
    margin-bottom: 10px;
  }

  .pause-shell .accent-button,
  .pause-shell .dark-button {
    height: 37px;
  }

  .pause-shell .text-button {
    padding: 10px 0;
  }
}
