﻿:root {
  --bg: #121212;
  --panel: #1e1e1e;
  --panel-soft: rgba(30, 30, 30, 0.85);
  --ink: #f7f7f7;
  --muted: #b2b2b2;
  --accent: #83d55c;
  --accent-dark: #4b8f2c;
  --danger: #f26d6d;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  overscroll-behavior: none;
}

body {
  touch-action: manipulation;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
}

.screen.active {
  display: block;
}

#authScreen {
  background: #121212;
  overflow: hidden;
}

.auth-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(131, 213, 92, 0.12), transparent 30%),
    radial-gradient(circle at 84% 82%, rgba(131, 213, 92, 0.1), transparent 26%),
    linear-gradient(120deg, #151515, #101010);
}

.auth-card {
  position: relative;
  z-index: 2;
  width: min(480px, calc(100vw - 24px));
  margin: clamp(16px, 10vh, 90px) auto;
  border-radius: 16px;
  background: rgba(24, 24, 24, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: clamp(16px, 4vw, 28px);
}

.auth-card h1 {
  margin: 0;
  font-size: clamp(30px, 6vw, 44px);
  text-transform: uppercase;
}

.auth-subtitle {
  margin: 10px 0 16px;
  color: var(--muted);
}

.auth-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.auth-status {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 14px;
  color: #ff9d9d;
}

#mainMenu {
  overflow: hidden;
  background:
    radial-gradient(circle at 14% 20%, rgba(131, 213, 92, 0.11), transparent 33%),
    radial-gradient(circle at 85% 84%, rgba(131, 213, 92, 0.1), transparent 32%),
    repeating-linear-gradient(
      90deg,
      rgba(45, 95, 44, 0.1) 0px,
      rgba(45, 95, 44, 0.1) 1px,
      transparent 1px,
      transparent 72px
    ),
    linear-gradient(130deg, #151515, #0f1012);
}

.menu-shell {
  position: relative;
  width: 100%;
  height: 100%;
  padding: clamp(8px, 1vw, 18px);
}

.menu-canvas {
  position: relative;
  width: 100%;
  height: 100%;
}

.menu-topbar {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 11.5%;
  min-height: 68px;
  max-height: 116px;
  border-radius: 0 0 25px 25px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(30, 30, 30, 0.92);
  padding: 1.6% 1.5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-topbar h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 84px);
  line-height: 0.9;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.2);
}

.topbar-level {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.56);
  font-size: clamp(16px, 1.25vw, 24px);
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-level strong {
  color: var(--accent);
  font-size: clamp(20px, 1.75vw, 34px);
  font-weight: 900;
}



.menu-server-panel {
  position: absolute;
  left: 80.75%;
  top: 51.9%;
  width: 19.25%;
  height: 45.1%;
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(30, 30, 30, 0.94);
  display: flex;
  flex-direction: column;
  padding: clamp(10px, 1.05vw, 16px);
  gap: clamp(6px, 0.55vw, 10px);
}

.menu-server-panel h3 {
  margin: 0;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(28px, 2.85vw, 70px);
  line-height: 0.86;
}

.server-group-label {
  color: rgba(255, 255, 255, 0.45);
  font-size: clamp(12px, 1.15vw, 18px);
  font-weight: 700;
  text-transform: lowercase;
}

.server-btn {
  width: 100%;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #1a1a1a;
  color: rgba(255, 255, 255, 0.84);
  font-size: clamp(15px, 1.35vw, 28px);
  font-weight: 700;
  min-height: 38px;
  padding: 7px 10px;
  cursor: pointer;
  line-height: 1;
}

.server-btn.selected {
  box-shadow: inset 0 0 0 3px rgba(131, 213, 92, 0.92);
}

.server-list {
  display: grid;
  gap: 6px;
  max-height: clamp(92px, 18vh, 180px);
  overflow-y: auto;
  padding-right: 2px;
}

.server-list::-webkit-scrollbar {
  width: 6px;
}

.server-list::-webkit-scrollbar-thumb {
  background: rgba(131, 213, 92, 0.55);
  border-radius: 999px;
}

.menu-play-btn {
  margin-top: auto;
  width: calc(100% + clamp(20px, 2.1vw, 34px));
  margin-left: calc(clamp(10px, 1.05vw, 17px) * -1);
  margin-right: calc(clamp(10px, 1.05vw, 17px) * -1);
  margin-bottom: calc(clamp(10px, 1.05vw, 17px) * -1);
  min-height: clamp(74px, 11vh, 104px);
  border: none;
  border-radius: 0 0 25px 25px;
  background: var(--accent);
  color: #1a2610;
  font-weight: 900;
  font-size: clamp(44px, 3.9vw, 80px);
  line-height: 1;
  cursor: pointer;
}

.menu-bottom-nav {
  position: absolute;
  left: 0;
  bottom: clamp(12px, 1.2vh, 22px);
  display: flex;
  gap: clamp(7px, 0.45vw, 10px);
  width: max-content;
  padding: clamp(10px, 0.6vw, 12px) clamp(10px, 0.6vw, 12px) clamp(8px, 0.5vw, 10px);
  border-radius: 0 25px 25px 0;
  background: rgba(131, 213, 92, 0.85);
}

.menu-icon {
  width: clamp(56px, 4.4vw, 78px);
  height: clamp(56px, 4.35vw, 77px);
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(30, 30, 30, 0.9);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

#menuPlayTabBtn {
  background: #1e1e1e;
  border-color: rgba(255, 255, 255, 0.2);
}

.menu-icon.inactive {
  opacity: 0.42;
}

.menu-icon img {
  width: clamp(29px, 2.2vw, 38px);
  height: clamp(29px, 2.2vw, 38px);
  opacity: 0.72;
  filter: grayscale(1) brightness(1.2);
}

.menu-icon.is-active img {
  opacity: 1;
  filter: brightness(0) saturate(100%) invert(72%) sepia(23%) saturate(889%) hue-rotate(52deg)
    brightness(94%) contrast(86%);
}

.menu-icon:hover,
.menu-icon:focus-visible,
.menu-play-btn:hover,
.menu-play-btn:focus-visible,
.server-btn:hover,
.server-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(131, 213, 92, 0.4);
}

.menu-toast {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(22, 22, 22, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  z-index: 12;
}

.menu-toast.hidden {
  display: none;
}
.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  background: #2f2f2f;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease, opacity 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.btn-primary {
  background: var(--accent);
  color: #18220f;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.btn.small {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 10px;
}

.name-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

#nameInput {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-size: 16px;
  margin-bottom: 14px;
}

#nameInput:focus {
  outline: 2px solid rgba(131, 213, 92, 0.5);
  outline-offset: 1px;
}

kbd {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12px;
}

#gameScreen {
  background: #161616;
  overflow: hidden;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.game-panel-art {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: min(300px, 34vw);
  max-height: min(320px, 32vh);
  opacity: 0.7;
  pointer-events: none;
  filter: saturate(0.95);
}

#hud {
  position: absolute;
  left: 14px;
  top: 14px;
  width: min(290px, calc(100vw - 28px));
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px;
  z-index: 5;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.hud-row strong {
  color: var(--ink);
  font-size: 14px;
}

.bar-group {
  margin-top: 10px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

#hpBar,
#xpBar {
  width: 0;
  height: 100%;
}

#hpBar {
  background: linear-gradient(90deg, #ff6f6f, #e03f3f);
}

#xpBar {
  background: linear-gradient(90deg, #97ee69, #5daf39);
}

#statusLine {
  position: absolute;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  text-align: center;
  z-index: 6;
  min-width: 240px;
}

.floating-actions {
  position: absolute;
  right: 14px;
  top: 14px;
  display: flex;
  gap: 8px;
  z-index: 6;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(540px, 100%);
  background: rgba(26, 26, 26, 0.96);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 20px;
}

.slim-card {
  width: min(460px, 100%);
}

.modal-card h2 {
  margin: 0 0 8px;
}

.modal-card p {
  color: var(--muted);
  margin: 0 0 12px;
}

.modal-list {
  margin: 0 0 14px;
  padding-left: 20px;
  color: var(--muted);
}

.modal-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
}

.upgrade-options {
  display: grid;
  gap: 10px;
  margin: 12px 0 14px;
}

.upgrade-btn {
  text-align: left;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

#profileScreen {
  background:
    radial-gradient(circle at 14% 20%, rgba(131, 213, 92, 0.11), transparent 33%),
    radial-gradient(circle at 85% 84%, rgba(131, 213, 92, 0.1), transparent 32%),
    repeating-linear-gradient(
      90deg,
      rgba(45, 95, 44, 0.1) 0px,
      rgba(45, 95, 44, 0.1) 1px,
      transparent 1px,
      transparent 72px
    ),
    linear-gradient(130deg, #151515, #0f1012);
  overflow: hidden;
}

.profile-shell {
  position: relative;
  width: 100%;
  height: 100%;
  padding: clamp(8px, 1vw, 18px);
}

.profile-canvas {
  position: relative;
  width: 100%;
  height: 100%;
}

.profile-left-card {
  position: absolute;
  left: 23.8%;
  top: 25.5%;
  width: 18.8%;
  height: 50%;
  border-radius: 25px 0 0 25px ;
  background: #1e1e1e;
  overflow: hidden;
  padding: clamp(10px, 0.9vw, 14px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 0.7vw, 10px);
}

.profile-avatar-frame {
  border-radius: 25px;
  background: #d9d9d9;
  border: none;
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.5);
  font-weight: 700;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 10px;
  text-align: center;
  align-self: start;
  max-height: 38%;
}

#profileAvatarHint {
  font-size: clamp(11px, 0.75vw, 13px);
  background: rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  padding: 5px 10px;
}

.hidden-file-input {
  display: none;
}

.profile-left-info h2 {
  margin: 0 0 6px;
  font-size: clamp(20px, 1.8vw, 34px);
  color: #f6f6f6;
  text-transform: uppercase;
}

.profile-left-info {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.profile-left-info::-webkit-scrollbar {
  width: 6px;
}

.profile-left-info::-webkit-scrollbar-thumb {
  background: rgba(131, 213, 92, 0.55);
  border-radius: 999px;
}

.profile-left-info p {
  margin: 4px 0;
  color: #f0f0f0;
  font-size: clamp(11px, 0.8vw, 13px);
  line-height: 1.25;
}

.profile-progress-track {
  height: clamp(20px, 2.8vh, 26px);
  border-radius: 999px;
  background: #1a1a1a;
}

.profile-progress-fill {
  width: 38%;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.profile-right-card {
  position: absolute;
  left: 42.56%;
  top: 25.5%;
  width: 33.56%;
  height: 50%;
  border-radius: 0 25px 25px 0;
  background: #1e1e1e;
  padding: 12px 12px 13px 4px;
}

.profile-right-inner {
  width: 100%;
  height: 100%;
  border-radius: 25px;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: clamp(16px, 1.6vw, 22px);
}

.profile-right-text {
  max-width: 90%;
}

.profile-right-text p {
  margin: 0 0 8px;
  color: #767676;
  font-size: clamp(13px, 1.05vw, 17px);
  line-height: 1.35;
}

.profile-actions {
  position: absolute;
  left: 23.8%;
  top: 77.2%;
  width: 52.32%;
  z-index: 4;
  display: flex;
  gap: 8px;
  justify-content: left;
}

.admin-card {
  position: relative;
  z-index: 2;
  width: min(620px, calc(100vw - 24px));
  margin: clamp(14px, 8vh, 80px) auto;
  border-radius: 16px;
  background: rgba(24, 24, 24, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: clamp(16px, 2.1vw, 24px);
}

.admin-card h2 {
  margin: 0 0 14px;
  text-transform: uppercase;
}

.admin-subtitle {
  margin: 14px 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.admin-form-grid {
  display: grid;
  gap: 6px;
  margin: 10px 0 10px;
}

.admin-form-grid input,
.admin-form-grid select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.admin-match-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.admin-match-controls select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.admin-match-stats {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(26, 26, 26, 0.86);
  padding: 8px 10px;
  margin-bottom: 8px;
}

.admin-match-stats p {
  margin: 0 0 4px;
  font-size: 13px;
  color: #d7d7d7;
}

.admin-spectate-canvas {
  width: 100%;
  height: 220px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #101113;
  margin-bottom: 8px;
}

.admin-nearby-list {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(20, 20, 20, 0.86);
  padding: 8px 10px;
  max-height: 190px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.admin-nearby-list p {
  margin: 0 0 5px;
  font-size: 12px;
  color: #d4d4d4;
}

.admin-server-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  margin: 10px 0;
  padding-right: 2px;
}

.admin-server-row {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(26, 26, 26, 0.86);
  padding: 10px;
}

.admin-server-row p {
  margin: 0 0 3px;
  color: #d7d7d7;
  font-size: 13px;
}

.admin-server-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.hidden {
  display: none;
}

.profile-tab-nav {
  position: absolute;
  left: 0;
  bottom: clamp(12px, 1.2vh, 22px);
  display: flex;
  gap: clamp(7px, 0.45vw, 10px);
  width: max-content;
  padding: clamp(10px, 0.6vw, 12px) clamp(10px, 0.6vw, 12px) clamp(8px, 0.5vw, 10px);
  border-radius: 0 25px 25px 0;
  background: rgba(131, 213, 92, 0.85);
  z-index: 3;
}

#mobileControls {
  display: none;
}

#joystickBase {
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  touch-action: none;
}

#joystickStick {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: rgba(131, 213, 92, 0.9);
  position: absolute;
  left: 34px;
  top: 34px;
}

.rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  background: rgba(8, 8, 8, 0.96);
  color: #ebebeb;
  font-size: clamp(20px, 4vw, 32px);
  font-weight: 700;
  text-transform: uppercase;
}

.rotate-overlay.hidden {
  display: none;
}

@media (pointer: coarse), (max-width: 900px) {
  .menu-shell {
    padding: 8px;
  }

  .menu-topbar {
    border-radius: 18px;
    min-height: 60px;
  }


  .menu-server-panel {
    left: 77.2%;
    width: 22.8%;
    top: 48.6%;
    height: 48.3%;
    padding: 8px;
    border-radius: 18px;
  }

  .menu-server-panel h3 {
    font-size: clamp(21px, 5vw, 38px);
  }

  .server-group-label {
    font-size: clamp(11px, 2.5vw, 14px);
  }

  .server-btn {
    min-height: 34px;
    font-size: clamp(13px, 2.8vw, 18px);
    padding: 6px 8px;
  }

  .menu-play-btn {
    min-height: clamp(56px, 9.2vh, 74px);
    font-size: clamp(30px, 5.9vw, 48px);
    border-radius: 0 0 18px 18px;
  }

  .menu-icon {
    width: max(44px, 9.2vw);
    height: max(44px, 9vw);
  }

  .profile-left-card {
    left: 8px;
    top: 13.3%;
    width: calc(42% - 10px);
    height: 56%;
    border-radius: 18px;
  }

  .profile-right-card {
    left: 42%;
    top: 13.3%;
    width: calc(58% - 8px);
    height: 56%;
    border-radius: 18px;
    padding: 8px;
  }

  .profile-right-inner {
    border-radius: 16px;
    padding: 10px;
  }

  .profile-actions {
    left: 8px;
    top: 71.5%;
    width: calc(100% - 16px);
  }

  .profile-tab-nav {
    bottom: 8px;
  }

  .floating-actions {
    top: auto;
    bottom: 150px;
    left: 12px;
    right: 12px;
    justify-content: center;
    flex-wrap: wrap;
  }

  #statusLine {
    top: 10px;
    min-width: 180px;
    max-width: calc(100vw - 24px);
  }

  .game-panel-art {
    width: min(230px, 45vw);
    opacity: 0.45;
  }

  #mobileControls {
    display: flex;
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    justify-content: space-between;
    align-items: flex-end;
    z-index: 10;
    pointer-events: none;
  }

  #mobileControls > * {
    pointer-events: auto;
  }

  #mobileBuildBtn {
    min-width: 120px;
    height: 50px;
    margin-bottom: 10px;
  }
}
