/* ============================================================
   Armor Attack — Web Arena  ·  UI stylesheet
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0b0e12;
  --panel: rgba(16, 21, 27, 0.92);
  --panel-solid: #141a21;
  --line: rgba(140, 160, 180, 0.16);
  --text: #e8ecef;
  --dim: #9aa7b2;
  --accent: #4c9dff;
  --accent2: #ffe98a;
  --good: #57d967;
  --bad: #ff5c4c;
  --silver: #cdd7e0;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
}

#gl {
  position: fixed;
  inset: 0;
  display: block;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
}

#ui-root { position: fixed; inset: 0; pointer-events: none; }

/* ---------- Screens ---------- */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  pointer-events: auto;
  padding: 28px 20px 40px;
}
.screen.visible { display: flex; }

/* Generated hero art behind the title menu */
#screen-title {
  background:
    linear-gradient(180deg, rgba(11, 14, 18, 0.72) 0%, rgba(11, 14, 18, 0.88) 60%, rgba(11, 14, 18, 0.97) 100%),
    url("../assets/img/title-bg.jpg") center / cover no-repeat;
}

.screen h1.logo {
  font-size: clamp(38px, 7vw, 74px);
  font-weight: 900;
  letter-spacing: 3px;
  line-height: 1;
  margin-top: 6vh;
  background: linear-gradient(180deg, #fff 20%, #9fc4ff 60%, #4c9dff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 8px 40px rgba(76, 157, 255, 0.25);
}
.screen .logo-sub {
  color: var(--dim);
  letter-spacing: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
  text-transform: uppercase;
}

h2.screen-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.screen-sub { color: var(--dim); font-size: 13px; margin-bottom: 22px; }

/* ---------- Buttons ---------- */

.btn {
  pointer-events: auto;
  display: inline-block;
  background: linear-gradient(180deg, #2a3542, #1b232d);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: 600 16px "Segoe UI", system-ui, sans-serif;
  letter-spacing: 1px;
  padding: 13px 34px;
  cursor: pointer;
  transition: transform 0.08s, border-color 0.15s, box-shadow 0.15s;
}
.btn:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(76, 157, 255, 0.25);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary {
  background: linear-gradient(180deg, #3d7dd8, #2a5aa8);
  border-color: #5da2ff;
  font-size: 18px;
}
.btn.small { padding: 8px 16px; font-size: 13px; border-radius: 8px; }
.btn.tiny { padding: 3px 10px; font-size: 11px; border-radius: 6px; }
.btn.ghost { background: transparent; }

.menu-buttons { display: flex; flex-direction: column; gap: 14px; margin-top: 5vh; width: min(340px, 80vw); }
.menu-buttons .btn { width: 100%; text-align: center; }

.back-row { align-self: flex-start; margin-bottom: 10px; }

/* ---------- Cards ---------- */

.cards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  max-width: 1100px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  width: 250px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.card:hover { border-color: rgba(140, 170, 200, 0.45); transform: translateY(-2px); }
.card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 24px rgba(76, 157, 255, 0.3);
}
.card-icon { font-size: 34px; margin-bottom: 8px; }
.card-banner {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 10px;
  border: 1px solid rgba(0, 0, 0, 0.4);
  display: block;
}
.tab-icon {
  width: 20px; height: 20px;
  border-radius: 5px;
  vertical-align: -4px;
  margin-right: 4px;
  object-fit: cover;
}
.respawn-portrait {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
  display: block;
}
.card-title { font-size: 17px; font-weight: 800; letter-spacing: 0.5px; margin-bottom: 6px; }
.card-desc { font-size: 12.5px; color: var(--dim); line-height: 1.45; }

.map-card canvas {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 10px;
  border: 1px solid rgba(0, 0, 0, 0.4);
}

.launch-bar {
  margin-top: 26px;
  display: flex;
  gap: 14px;
  align-items: center;
}

section.pick { margin-bottom: 26px; display: flex; flex-direction: column; align-items: center; }
section.pick h3 {
  font-size: 13px; letter-spacing: 3px; color: var(--dim);
  text-transform: uppercase; margin-bottom: 12px;
}

/* ---------- Hangar ---------- */

.hangar-top {
  width: min(1100px, 96vw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.silver-chip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 700;
  color: var(--accent2);
}

#dropteam-bar {
  width: min(1100px, 96vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
#dropteam-bar h3 { font-size: 12px; letter-spacing: 3px; color: var(--dim); margin-bottom: 10px; }
#dropteam-slots { display: flex; gap: 10px; flex-wrap: wrap; }
.dt-slot {
  position: relative;
  width: 96px;
  background: #1b232d;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 8px 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
}
.dt-slot:hover { border-color: rgba(140, 170, 200, 0.5); }
.dt-slot.selected { border-color: var(--accent2); box-shadow: 0 0 14px rgba(255, 233, 138, 0.25); }
.dt-num {
  position: absolute; top: -8px; left: -6px;
  background: var(--accent); color: #fff;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 11px; font-weight: 800; line-height: 20px;
}
.dt-name { font-weight: 700; font-size: 14px; }
.dt-class { font-size: 15px; margin-top: 2px; }
.dt-class.dim { color: var(--dim); font-size: 12px; }
.dt-slot.locked { opacity: 0.85; border-style: dashed; cursor: default; }
.dt-buy { margin-top: 6px; }
#dropteam-hint { color: var(--dim); font-size: 12px; margin-top: 10px; }

/* ---------- Admin console ---------- */
.admin-panel { max-width: 620px; max-height: 86vh; overflow-y: auto; }
.admin-db-title {
  font-size: 12px; letter-spacing: 3px; color: var(--dim);
  margin: 18px 0 10px;
}
.admin-tablewrap { max-height: 260px; overflow-y: auto; margin-bottom: 14px; }
.set-row .dim { color: var(--dim); font-weight: 400; font-size: 12px; }

#faction-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; justify-content: center; }
.tab {
  pointer-events: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--dim);
  font: 700 14px "Segoe UI", system-ui, sans-serif;
  padding: 9px 22px;
  cursor: pointer;
}
.tab.active { color: var(--text); border-color: var(--fc, var(--accent)); box-shadow: 0 0 14px color-mix(in srgb, var(--fc, #4c9dff) 35%, transparent); }

#faction-blurb {
  width: min(1100px, 96vw);
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 16px;
}
#faction-blurb .dim { color: var(--dim); }

.unit-card { width: 320px; cursor: default; display: flex; flex-direction: column; }
.unit-card.locked { opacity: 0.85; }
.unit-card.owned { cursor: pointer; }
.unit-preview {
  width: 100%; height: 150px;
  object-fit: cover;
  background: radial-gradient(ellipse at center, #1d2630, #12181f);
  border-radius: 10px; border: 1px solid rgba(0,0,0,0.4);
  display: block;
}
.unit-head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; }
.unit-name { font-size: 18px; font-weight: 800; }
.unit-class { font-size: 11px; color: var(--dim); letter-spacing: 1px; }
.unit-desc { font-size: 12px; color: var(--dim); margin: 6px 0 10px; line-height: 1.4; min-height: 32px; }
.stat-row { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
.stat-row span { font-size: 10px; letter-spacing: 1.5px; color: var(--dim); width: 44px; }
.stat-row .bar { flex: 1; height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 3px; overflow: hidden; }
.stat-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, #3d7dd8, #6db2ff); border-radius: 3px; }
.unit-kit { font-size: 12px; color: var(--text); margin: 8px 0 10px; }
.unit-foot { border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.up-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.up-name { font-size: 12px; flex: 1; }
.pips { display: flex; gap: 3px; }
.pip { width: 9px; height: 9px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); display: inline-block; }
.pip.on { background: var(--accent2); }

/* ---------- Settings / Help ---------- */

.settings-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 28px;
  width: min(480px, 94vw);
}
.set-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.set-row label { font-size: 14px; font-weight: 600; }
.set-row input[type="range"] { width: 180px; accent-color: var(--accent); }
.set-row select, .set-row input[type="text"] {
  background: #1b232d; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font-size: 13px;
}
.set-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }

.help-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 30px;
  width: min(640px, 94vw);
  font-size: 14px;
  line-height: 1.7;
}
.help-panel h3 { margin: 14px 0 6px; font-size: 15px; color: var(--accent2); }
.help-panel kbd {
  background: #1b232d; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 7px; font-size: 12px; font-family: inherit;
}
.help-panel .dim { color: var(--dim); font-size: 12.5px; }

/* ---------- Overlays ---------- */

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(5, 8, 12, 0.65);
  backdrop-filter: blur(3px);
  pointer-events: auto;
  z-index: 10;
}
.overlay.visible { display: flex; }
.overlay h2 { font-size: clamp(21px, 6vw, 30px); font-weight: 900; letter-spacing: 2px; margin-bottom: 6px; }
.overlay .sub { color: var(--dim); margin-bottom: 20px; }

.respawn-card { width: 170px; text-align: center; }
.respawn-card.selected { border-color: var(--good); box-shadow: 0 0 20px rgba(87, 217, 103, 0.3); }

/* ---------- Results ---------- */

.results-banner { font-size: 54px; font-weight: 900; letter-spacing: 4px; margin-top: 4vh; }
.results-banner.win { color: var(--good); text-shadow: 0 0 40px rgba(87, 217, 103, 0.4); }
.results-banner.loss { color: var(--bad); text-shadow: 0 0 40px rgba(255, 92, 76, 0.4); }
.results-banner.draw { color: var(--silver); }
#results-sub { color: var(--dim); margin: 6px 0 14px; }
#results-rewards { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; justify-content: center; }
.reward {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 18px;
  font-weight: 700; color: var(--accent2); font-size: 14px;
}
.results-tablewrap {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 18px; margin-bottom: 20px;
  max-width: 94vw; overflow-x: auto;
}
table.scoreboard { border-collapse: collapse; font-size: 13.5px; }
table.scoreboard th {
  text-align: left; color: var(--dim); font-size: 11px; letter-spacing: 1.5px;
  padding: 6px 18px 6px 6px; border-bottom: 1px solid var(--line);
}
table.scoreboard td { padding: 5px 18px 5px 6px; }
table.scoreboard tr.team1 td:first-child { color: #7db2f0; }
table.scoreboard tr.team2 td:first-child { color: #f08d7d; }
table.scoreboard tr.me { background: rgba(76, 157, 255, 0.08); }
table.scoreboard tr.me td:first-child { color: var(--accent2); font-weight: 700; }

/* ---------- Touch controls ---------- */

#touch-controls { display: none; }
#touch-controls.visible { display: block; }
.touch-btn {
  position: fixed;
  pointer-events: auto;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(20, 26, 33, 0.55);
  color: var(--text);
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  z-index: 5;
  -webkit-tap-highlight-color: transparent;
}
#touch-fire { right: 26px; bottom: 120px; width: 86px; height: 86px; font-size: 15px; border-color: rgba(255, 120, 100, 0.6); }
#touch-ability { right: 128px; bottom: 76px; width: 62px; height: 62px; font-size: 24px; border-color: rgba(76, 201, 240, 0.6); }
#touch-target { right: 44px; bottom: 224px; width: 54px; height: 54px; font-size: 20px; }
#touch-mic { left: 20px; bottom: 224px; width: 54px; height: 54px; font-size: 20px; border-color: rgba(123, 241, 168, 0.55); }
#touch-mic.live { background: rgba(123, 241, 168, 0.35); border-color: #7bf1a8; }
#touch-pause { right: 16px; top: 70px; width: 42px; height: 42px; font-size: 16px; border-radius: 10px; }

/* ---------- Toast & misc ---------- */

#toast {
  position: fixed;
  left: 50%; bottom: 8vh;
  transform: translateX(-50%) translateY(20px);
  background: var(--panel-solid);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 12px 26px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 30;
}
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.title-stats {
  display: flex; gap: 14px; align-items: center; margin-top: 20px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 24px; flex-wrap: wrap; justify-content: center;
}
.title-stats .chip { font-size: 13px; color: var(--dim); }
.title-stats b { color: var(--text); }
.xp-wrap { width: 120px; height: 7px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
#title-xpbar { display: block; height: 100%; background: linear-gradient(90deg, #3d7dd8, #6db2ff); }

/* ---------- Account ---------- */

.account-row {
  display: flex; gap: 12px; align-items: center; margin-top: 14px;
  flex-wrap: wrap; justify-content: center;
}
.account-row .chip { font-size: 12px; color: var(--dim); }
.account-panel { max-width: 440px; }
.acct-tabs { display: flex; gap: 8px; margin: 14px 0 18px; }
.acct-error {
  color: var(--bad); font-size: 13px; min-height: 18px; margin-bottom: 10px;
}
#acct-user-line { color: var(--text); font-weight: 600; }
#acct-sync-line { font-size: 12px; }

/* ---------- Pre-match lobby (chat + private messages) ---------- */

.lobby-wrap {
  display: flex;
  gap: 16px;
  width: min(940px, 96vw);
  align-items: stretch;
}
.lobby-chat {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
}
#lobby-log {
  height: min(46vh, 420px);
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.55;
  padding: 4px 6px;
  user-select: text;
  -webkit-user-select: text;
}
#lobby-log .chat-line b { color: #7db2f0; margin-right: 7px; }
#lobby-log .chat-line.me b { color: var(--accent2); }
#lobby-log .pm { color: #d9b7ff; }
#lobby-log .pm i { font-style: normal; color: #b98aef; margin-right: 7px; }
#lobby-log .sys { color: var(--dim); font-size: 12.5px; }
#lobby-log .err { color: var(--bad); font-size: 12.5px; }
.lobby-inputrow { display: flex; gap: 8px; margin-top: 10px; }
#lobby-input {
  flex: 1;
  min-width: 0;
  background: #1b232d;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
}
#lobby-input:focus { outline: none; border-color: var(--accent); }
#lobby-input:disabled { opacity: 0.5; }
.lobby-hint { color: var(--dim); font-size: 11.5px; margin-top: 8px; }
.lobby-side {
  width: 210px;
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.lobby-side h3 { font-size: 11px; letter-spacing: 2px; color: var(--dim); margin-bottom: 10px; }
#lobby-roster { max-height: min(46vh, 420px); overflow-y: auto; }
.roster-user {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}
.roster-user:hover { background: rgba(76, 157, 255, 0.12); }
.roster-user.you { color: var(--accent2); cursor: default; }
.roster-empty { font-size: 12.5px; padding: 4px 2px; }
.chat-name.clickable { cursor: pointer; }
.chat-name.clickable:hover { text-decoration: underline; }
@media (max-width: 720px) {
  .lobby-wrap { flex-direction: column; }
  .lobby-side { width: 100%; }
  #lobby-roster { max-height: 120px; }
}

.rename-row { flex-wrap: wrap; }
.rename-row input { flex: 1; min-width: 150px; }

.footnote {
  margin-top: auto;
  padding-top: 26px;
  font-size: 11px;
  color: rgba(154, 167, 178, 0.55);
  text-align: center;
  line-height: 1.6;
  max-width: 560px;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: #2a3542; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }
