:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #101411;
  color: #eef6ed;
}

* {
  box-sizing: border-box;
}

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

body {
  background: #101411;
}

#viewport {
  display: block;
  width: 100%;
  height: 100%;
  cursor: none;
}

.hud {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  pointer-events: none;
  z-index: 5;
}

.stat {
  min-width: 94px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(8, 11, 9, 0.72);
  backdrop-filter: blur(10px);
}

.stat.wide {
  min-width: 180px;
}

.stat.wide strong {
  max-width: 220px;
  font-size: 13px;
  line-height: 1.15;
  white-space: normal;
}

.stat span {
  display: block;
  font-size: 11px;
  line-height: 1;
  color: #b6c7b5;
}

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
}

.battle-hud {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 204px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(8, 11, 9, 0.76);
  backdrop-filter: blur(10px);
  pointer-events: none;
  z-index: 5;
}

.minimap {
  display: block;
  width: 180px;
  height: 140px;
  border: 1px solid rgba(238, 246, 237, 0.22);
  border-radius: 4px;
  background: rgba(76, 91, 68, 0.72);
}

.team-panel {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.team-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 7px;
  align-items: center;
  min-height: 28px;
  padding: 6px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
}

.team-row span {
  font-size: 11px;
  color: #c7d4c4;
}

.team-row strong,
.team-row b {
  font-size: 12px;
  line-height: 1;
}

.team-row.red {
  border-left: 3px solid #b84a3e;
}

.team-row.blue {
  border-left: 3px solid #3e6fb8;
}

.capture-panel {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.capture-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 26px;
  padding: 6px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
}

.capture-row span {
  color: #c7d4c4;
  font-size: 11px;
}

.capture-row strong {
  font-size: 12px;
  line-height: 1;
}

.capture-row.red {
  border-left: 3px solid #b84a3e;
}

.capture-row.blue {
  border-left: 3px solid #3e6fb8;
}

.tank-hover-card {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 230px;
  padding: 10px 11px 11px;
  border: 1px solid rgba(238, 246, 237, 0.2);
  border-radius: 6px;
  background: rgba(8, 11, 9, 0.82);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  color: #eef6ed;
  opacity: 0;
  pointer-events: none;
  transform: none;
  transition: opacity 90ms ease;
  z-index: 7;
}

.tank-hover-card.visible {
  opacity: 1;
}

.tank-hover-card strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tank-hover-hp {
  height: 7px;
  margin-top: 6px;
  overflow: hidden;
  border: 1px solid rgba(238, 246, 237, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.tank-hover-hp span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #8fd16c;
}

.tank-hover-card small {
  display: block;
  margin-top: 4px;
  color: #c7d4c4;
  font-size: 11px;
  line-height: 1.15;
}

.tank-hover-modules {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 6px;
}

.tank-hover-modules span {
  height: 6px;
  border-radius: 2px;
  background: rgba(238, 246, 237, 0.12);
}

.battle-result {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 11, 9, 0.38);
  pointer-events: auto;
  z-index: 12;
}

.battle-result[hidden] {
  display: none;
}

.battle-result-panel {
  width: min(320px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid rgba(238, 246, 237, 0.24);
  border-radius: 6px;
  background: rgba(13, 18, 14, 0.94);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.42);
  text-align: center;
}

.battle-result-panel span {
  display: block;
  color: #b6c7b5;
  font-size: 12px;
}

.battle-result-panel strong {
  display: block;
  margin: 8px 0 18px;
  font-size: 28px;
  line-height: 1.1;
}

.battle-result-panel button {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: #d7e07c;
  color: #171b10;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  margin-top: 10px;
  background: #405647;
  color: #eef6ed;
}

.matchmaking-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.matchmaking-panel[hidden] {
  display: none;
}

.matchmaking-panel span,
.matchmaking-panel small {
  color: #b6c7b5;
}

.matchmaking-panel strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
  line-height: 1.15;
}

.matchmaking-panel small {
  grid-column: 1 / -1;
  font-size: 12px;
}

.matchmaking-panel button {
  grid-column: 1 / -1;
  justify-self: end;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #eef6ed;
  font: inherit;
  cursor: pointer;
}

.reticle {
  position: fixed;
  left: var(--aim-x, 50%);
  top: var(--aim-y, 50%);
  width: var(--aim-size, 28px);
  height: var(--aim-size, 28px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent calc(50% - 2px), rgba(8, 11, 9, 0.82) calc(50% - 2px), rgba(8, 11, 9, 0.82) calc(50% - 1px), transparent calc(50% - 1px)),
    conic-gradient(from -90deg, rgba(255, 226, 166, 0.96) var(--reload-deg, 360deg), rgba(238, 246, 237, 0.2) 0);
  box-shadow: inset 0 0 0 1px rgba(238, 246, 237, 0.72);
  pointer-events: none;
  z-index: 6;
  transition: background 140ms ease, box-shadow 140ms ease, height 180ms ease, opacity 140ms ease, width 180ms ease;
}

.reticle::before,
.reticle::after {
  position: absolute;
  content: "";
  background: rgba(238, 246, 237, 0.78);
  transition: background 140ms ease, height 140ms ease, left 140ms ease, top 140ms ease, width 140ms ease;
}

.reticle::before {
  left: 50%;
  top: -10px;
  width: 1px;
  height: 40px;
}

.reticle::after {
  left: -10px;
  top: 50%;
  width: 40px;
  height: 1px;
}

.sniper .reticle {
  box-shadow: inset 0 0 0 1px rgba(255, 226, 166, 0.92);
}

.target-locked .reticle {
  box-shadow: inset 0 0 0 1px rgba(130, 230, 110, 0.96), 0 0 0 2px rgba(130, 230, 110, 0.16);
}

.target-locked .reticle::before,
.target-locked .reticle::after {
  background: rgba(130, 230, 110, 0.9);
}

.sniper .reticle::before {
  top: -70px;
  height: 180px;
  background: rgba(255, 226, 166, 0.88);
}

.sniper .reticle::after {
  left: -70px;
  width: 180px;
  background: rgba(255, 226, 166, 0.88);
}

.sniper::after {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(circle at center, transparent 0 28%, rgba(0, 0, 0, 0.36) 64%, rgba(0, 0, 0, 0.56) 100%);
}

.artillery-mode .reticle {
  box-shadow:
    inset 0 0 0 1px rgba(255, 215, 128, 0.96),
    0 0 0 5px rgba(255, 215, 128, 0.12);
}

.artillery-mode .reticle::before,
.artillery-mode .reticle::after {
  background: rgba(255, 215, 128, 0.92);
}

.artillery-mode .reticle::before {
  top: -24px;
  height: 76px;
}

.artillery-mode .reticle::after {
  left: -24px;
  width: 76px;
}

.artillery-mode::after {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
  z-index: 4;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.24);
}

.main-menu {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 10, 8, 0.66);
  backdrop-filter: blur(7px);
  z-index: 8;
}

.main-menu.hidden {
  display: none;
}

.menu-panel {
  width: min(760px, 100%);
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(18, 23, 18, 0.92);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
}

.menu-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 18px;
}

.menu-header span,
.profile-form label,
.menu-card span,
.menu-card small {
  color: #b6c7b5;
}

.menu-header strong {
  font-size: 30px;
  line-height: 1;
}

.profile-form {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.profile-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.profile-row input,
.profile-form select {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #eef6ed;
  font: inherit;
}

.profile-form select {
  width: 100%;
}

.profile-row button,
.play-button {
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.profile-row button {
  background: #425147;
  color: #eef6ed;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.menu-card {
  min-height: 108px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.menu-card strong {
  display: block;
  margin: 8px 0 10px;
  font-size: 18px;
  line-height: 1.15;
}

.play-button {
  width: 100%;
  background: #d7e07c;
  color: #171b10;
}

.profile-row button:focus-visible,
.play-button:focus-visible,
.matchmaking-panel button:focus-visible,
.profile-row input:focus-visible,
.profile-form select:focus-visible {
  outline: 3px solid #eef6ed;
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .hud {
    right: 10px;
    left: 10px;
    top: 10px;
    gap: 6px;
  }

  .stat {
    flex: 1;
    min-width: 0;
    padding: 8px;
  }

  .stat.wide {
    min-width: 0;
  }

  .stat strong {
    font-size: 16px;
  }

  .battle-hud {
    right: 10px;
    bottom: 10px;
    width: 176px;
  }

  .tank-hover-card {
    left: 10px;
    bottom: 10px;
    width: 190px;
  }

  .minimap {
    width: 154px;
    height: 120px;
  }

  .team-row {
    grid-template-columns: 34px 1fr auto;
    gap: 5px;
    padding: 5px 6px;
  }

  .menu-grid,
  .profile-row,
  .matchmaking-panel {
    grid-template-columns: 1fr;
  }
}
