/* ============================================================
   RED ALERT 2: YURI'S REVENGE — AUTHENTIC CLASSIC UI THEME
   Silver Beveled Steel Chrome • Crimson Red Glow • Yellow Text
   ============================================================ */
:root {
  --ra2-yellow: #ffe63b;
  --ra2-yellow-dim: #d4b82c;
  --ra2-red-bright: #e03018;
  --ra2-red: #a81c0c;
  --ra2-red-dark: #4c0904;
  --ra2-red-border: #b82514;
  --ra2-steel-hi: #cfd4da;
  --ra2-steel-mid: #6e747c;
  --ra2-steel-lo: #23262b;
  --accent: #cc2414;
  --accent-bright: #ff5636;
  --accent-dark: #540b05;
  --panel-border: #8d939b;
  --text-main: #ffe63b;
  --text-dim: #c9b97b;
  --gold: #ffe63b;
  --danger: #ff3b28;
  --ok: #5cff72;
}

body[data-faction="allied"] {
  --accent: #2f80ff;
  --accent-bright: #7ab3ff;
  --accent-dark: #102e5e;
}

body[data-faction="soviet"] {
  --accent: #d92616;
  --accent-bright: #ff6247;
  --accent-dark: #540c06;
}

body[data-faction="yuri"] {
  --accent: #a640e8;
  --accent-bright: #d48aff;
  --accent-dark: #441366;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000000;
  color: var(--ra2-yellow);
  font-family: "Trebuchet MS", "Segoe UI", Tahoma, Verdana, sans-serif;
}

.hidden {
  display: none !important;
}

/* ============================================================
   WESTWOOD SPLASH SCREEN
   ============================================================ */
.ra2-splash-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ra2-splash-box {
  position: relative;
  max-width: 94vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ra2-splash-box img {
  display: block;
  max-width: 92vw;
  max-height: 86vh;
  width: auto;
  height: auto;
  border: 2px solid #222;
  box-shadow: 0 0 60px rgba(210, 45, 10, 0.35);
}

.ra2-splash-hint {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--ra2-yellow);
  text-transform: uppercase;
  text-shadow: 0 1px 4px #000;
  animation: pulseOpacity 1.1s infinite alternate;
}

@keyframes pulseOpacity {
  from { opacity: 0.45; }
  to   { opacity: 1; }
}

/* ============================================================
   OVERLAYS & AUTHENTIC RA2 2-COLUMN SHELL
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  padding: 10px;
}

.ra2-shell {
  width: min(1040px, 98vw);
  height: min(690px, 95vh);
  display: flex;
  align-items: stretch;
  gap: 6px;
  background: #000;
}

/* LEFT: SILVER BEVELED STEEL MAIN VIEWPORT */
.ra2-main-frame {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #0a0202;
  border: 5px solid #8a9099;
  border-top-color: #d6dbe2;
  border-left-color: #bfc5ce;
  border-right-color: #4a4f57;
  border-bottom-color: #3a3f46;
  box-shadow:
    inset 0 0 0 2px #14161a,
    inset 0 0 0 4px #5e636b,
    inset 0 0 40px rgba(0, 0, 0, 0.85),
    0 12px 40px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.ra2-main-inner {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
  background:
    linear-gradient(180deg, rgba(16, 2, 2, 0.72) 0%, rgba(10, 1, 1, 0.82) 100%),
    url("/assets/ui/menu_map_bg.jpg") center / cover no-repeat;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ra2-screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ra2-red-border);
}

.ra2-screen-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--ra2-yellow);
  letter-spacing: 0.6px;
  text-shadow: 0 2px 4px #000;
}

.ra2-screen-title.center {
  text-align: center;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(184, 37, 20, 0.55);
}

/* RIGHT: CLASSIC RA2 METALLIC SLOTTED SIDEBAR */
.ra2-menu-sidebar {
  width: 176px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(90deg, #3c4047 0%, #868c94 14%, #5c6169 50%, #7d838c 86%, #292c31 100%);
  border-left: 2px solid #9da3ab;
  border-right: 2px solid #2b2e33;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.ra2-sdtp {
  position: relative;
  width: 100%;
  flex-shrink: 0;
  line-height: 0;
}

.ra2-sdtp img {
  display: block;
  width: 100%;
  height: auto;
}

.ra2-sdtp-title {
  position: absolute;
  top: 4.5%;
  left: 14%;
  right: 14%;
  height: 14%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--ra2-yellow);
  text-shadow: 0 1px 3px #000;
  letter-spacing: 0.4px;
  pointer-events: none;
}

.ra2-slot-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2px 6px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.45) 0px,
      rgba(0, 0, 0, 0.45) 4px,
      transparent 4px,
      transparent 168px
    );
}

.ra2-slot {
  flex: 1;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 5px;
  border-top: 1px solid #9fa5ad;
  border-bottom: 1px solid #1e2126;
  background: linear-gradient(180deg, #5e636b 0%, #3a3e44 50%, #2a2d32 100%);
  position: relative;
}

/* Metallic side rivets */
.ra2-slot::before,
.ra2-slot::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #dfe4ea, #33373d);
}
.ra2-slot::before { left: 2px; }
.ra2-slot::after  { right: 2px; }

.ra2-slot-empty {
  background: linear-gradient(180deg, #52575f 0%, #33373d 48%, #272a2f 100%);
}

.ra2-slot-bottom {
  margin-top: auto;
}

.ra2-sdbtm {
  width: 100%;
  flex-shrink: 0;
  line-height: 0;
}

.ra2-sdbtm img {
  display: block;
  width: 100%;
  height: auto;
}

/* AUTHENTIC RA2 GLOWING RED BUTTON */
.ra2-btn {
  width: 100%;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--ra2-yellow);
  text-shadow: 0 1px 3px #000, 0 0 6px rgba(0, 0, 0, 0.8);
  background: radial-gradient(ellipse at 50% 45%, #d62d14 0%, #8f1407 65%, #3d0502 100%);
  border: 2px solid #180302;
  box-shadow:
    inset 0 1px 0 rgba(255, 165, 110, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.85),
    0 0 0 1px #6a1a10;
  border-radius: 0;
  cursor: pointer;
  transition: filter 0.1s ease;
}

.ra2-btn:hover:not(:disabled) {
  filter: brightness(1.22);
  color: #fff68a;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 140, 0.8),
    0 0 10px rgba(255, 70, 30, 0.65);
}

.ra2-btn:active:not(:disabled) {
  filter: brightness(0.9);
  transform: translateY(1px);
}

.ra2-btn:disabled {
  opacity: 0.42;
  cursor: wait;
  filter: grayscale(0.6);
}

.ra2-btn.active,
.ra2-btn.auth-tab.active {
  background: radial-gradient(ellipse at 50% 45%, #ff451f 0%, #b81d0a 68%, #520802 100%);
  box-shadow:
    inset 0 0 8px rgba(255, 230, 59, 0.45),
    0 0 0 1px var(--ra2-yellow);
  color: #fff9b0;
}

.ra2-btn-sm {
  width: auto;
  padding: 5px 12px;
  font-size: 12px;
}

.ra2-btn-ok {
  width: 148px;
  padding: 7px 14px;
  font-size: 14px;
}

/* ============================================================
   CLASSIC RA2 DIALOG BOX (AUDIO PERMISSION / END SCREEN)
   ============================================================ */
.ra2-dialog-frame {
  width: min(560px, 94vw);
  border: 5px solid #8a9099;
  border-top-color: #dce1e8;
  border-left-color: #c2c8d1;
  border-right-color: #464b52;
  border-bottom-color: #363a40;
  box-shadow:
    inset 0 0 0 2px #14161a,
    0 20px 60px rgba(0, 0, 0, 0.95);
  background: #0d0403;
}

.ra2-dialog-body {
  padding: 26px 28px 20px;
  background:
    linear-gradient(180deg, rgba(24, 6, 4, 0.78) 0%, rgba(10, 2, 2, 0.92) 100%),
    url("/assets/ui/menu_map_bg.jpg") center / cover no-repeat;
}

.ra2-dialog-text {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ra2-yellow);
  text-shadow: 0 2px 4px #000;
}

.ra2-dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 26px;
}

/* ============================================================
   SETUP / FORM CONTROLS (RA2 RED-BORDERED BLACK INPUTS)
   ============================================================ */
.setup-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 12px;
}

@media (max-width: 780px) {
  .ra2-shell {
    flex-direction: column;
    height: 96vh;
  }
  .ra2-menu-sidebar {
    width: 100%;
    flex-direction: row;
    height: auto;
  }
  .ra2-sdtp, .ra2-sdbtm, .ra2-slot-empty {
    display: none;
  }
  .ra2-slot-stack {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .setup-grid {
    grid-template-columns: 1fr;
  }
}

.setup-card {
  background: rgba(6, 1, 1, 0.62);
  border: 1px solid var(--ra2-red-border);
  padding: 12px 14px;
}

.setup-card > label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--ra2-yellow);
  margin-bottom: 9px;
  text-shadow: 0 1px 2px #000;
}

.faction-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.country-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.faction-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  position: relative;
  padding: 5px 8px;
  background: rgba(12, 2, 2, 0.78);
  border: 1px solid var(--ra2-red-border);
  color: var(--ra2-yellow);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
}

.country-flag {
  width: 47px;
  height: 23px;
  flex-shrink: 0;
  image-rendering: pixelated;
  display: block;
}

.country-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.country-meta strong {
  font-size: 12px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.country-meta small {
  font-size: 10px;
  color: #e6d28a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-flag {
  height: 15px;
  width: auto;
  vertical-align: -3px;
  margin-right: 4px;
  image-rendering: pixelated;
}

.faction-btn:hover {
  background: rgba(168, 28, 12, 0.45);
}

.faction-btn.active {
  background: linear-gradient(180deg, #e03218 0%, #a31b0a 100%);
  border-color: var(--ra2-yellow);
  color: #fff6a8;
  box-shadow: inset 0 1px 0 rgba(255, 220, 140, 0.4);
}

.faction-btn strong {
  font-size: 13px;
  letter-spacing: 0.8px;
}

.faction-btn small {
  font-size: 11px;
  color: #e6d28a;
  margin-top: 2px;
}

.f-dot {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 11px;
  height: 11px;
  border: 1px solid #000;
}
.f-dot.allied { background: #3b8eff; box-shadow: 0 0 6px #3b8eff; }
.f-dot.soviet { background: #ff3824; box-shadow: 0 0 6px #ff3824; }
.f-dot.yuri   { background: #b44cff; box-shadow: 0 0 6px #b44cff; }

.ra2-form-row {
  display: grid;
  grid-template-columns: 112px 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.field-lbl {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ra2-yellow);
}

select,
input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  padding: 6px 9px;
  background: rgba(4, 0, 0, 0.82);
  color: var(--ra2-yellow);
  border: 1px solid var(--ra2-red-border);
  border-radius: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

select:focus,
input:focus {
  border-color: var(--ra2-yellow);
  box-shadow: 0 0 6px rgba(224, 48, 24, 0.55);
}

select option {
  background: #140302;
  color: var(--ra2-yellow);
}

.controls-hint {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(184, 37, 20, 0.5);
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.35;
}
.controls-hint b { color: var(--ra2-yellow); }

.load-status {
  font-size: 11px;
  font-weight: 700;
  color: var(--ok);
}

.player-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid var(--ra2-red-border);
  color: var(--ra2-yellow);
  font-size: 12px;
  cursor: pointer;
}
.player-pill:hover {
  background: rgba(168, 28, 12, 0.45);
  border-color: var(--ra2-yellow);
}
.player-pill small { color: var(--text-dim); font-size: 10px; }

.user-dot {
  width: 8px;
  height: 8px;
  background: var(--ra2-yellow);
}
.user-dot.reg { background: var(--ok); box-shadow: 0 0 6px var(--ok); }

/* ============================================================
   AUTH / LOGIN SCREEN (MATCHES RA2 LOGIN REFERENCE)
   ============================================================ */
.ra2-auth-inner {
  justify-content: flex-start;
  padding: 20px 32px;
}

.auth-pane {
  max-width: 520px;
  width: 100%;
  margin: 8px auto 0;
}

.ra2-field-line {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 10px;
}

.ra2-field-line > label {
  text-align: right;
  font-size: 13px;
  font-weight: 800;
  color: var(--ra2-yellow);
}

.ra2-form-submit {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}
.ra2-form-submit .ra2-btn {
  width: auto;
  min-width: 160px;
}

.auth-notice {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}
.auth-notice.ok {
  background: rgba(20, 90, 32, 0.55);
  border: 1px solid var(--ok);
  color: #baffc4;
}
.auth-notice.error {
  background: rgba(160, 18, 10, 0.55);
  border: 1px solid #ff5544;
  color: #ffd0cc;
}
.auth-warn {
  padding: 7px 10px;
  margin-bottom: 8px;
  background: rgba(180, 120, 10, 0.25);
  border: 1px solid var(--ra2-yellow);
  color: var(--ra2-yellow);
  font-size: 12px;
}

.prof-summary {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid var(--ra2-red-border);
  padding: 10px 12px;
  margin-bottom: 14px;
}
.prof-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(184, 37, 20, 0.35);
}
.prof-row:last-child { border-bottom: none; }
.prof-row span { color: var(--text-dim); }

.auth-section h4 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ra2-yellow);
  text-shadow: 0 1px 2px #000;
}
.auth-desc {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.45;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-with-btn {
  display: flex;
  gap: 6px;
}
.input-with-btn input { flex: 1; }
.input-with-btn button { white-space: nowrap; }

/* ============================================================
   ONLINE LOBBY & ROOM 2..8
   ============================================================ */
.lobby-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 12px;
}
@media (max-width: 760px) { .lobby-grid { grid-template-columns: 1fr; } }

.lobby-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.room-list-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
}

.room-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-dim);
  font-size: 12px;
  border: 1px dashed rgba(184, 37, 20, 0.6);
}

.room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(10, 2, 2, 0.8);
  border: 1px solid var(--ra2-red-border);
}
.room-row:hover {
  background: rgba(168, 28, 12, 0.35);
}

.room-row-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.room-row-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
}

.room-code-tag {
  font-family: "Courier New", monospace;
  font-weight: 900;
  font-size: 12px;
  color: var(--ra2-yellow);
  background: rgba(168, 28, 12, 0.5);
  border: 1px solid var(--ra2-yellow);
  padding: 2px 6px;
  letter-spacing: 1px;
}
.room-code-tag.big { font-size: 15px; padding: 4px 10px; }

.room-meta-pill {
  font-size: 10px;
  font-weight: 800;
  color: var(--ok);
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--ra2-red-border);
  padding: 2px 6px;
  text-transform: uppercase;
}

.btn-join-room {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 800;
  color: var(--ra2-yellow);
  background: radial-gradient(ellipse at 50% 45%, #d62d14 0%, #7d1106 100%);
  border: 1px solid var(--ra2-yellow);
  cursor: pointer;
}
.btn-join-room:disabled { opacity: 0.4; cursor: not-allowed; }

.room-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--ra2-red-border);
}

.room-meta-line {
  font-size: 12px;
  color: var(--text-dim);
  margin-left: 8px;
}

.room-countdown {
  font-family: "Courier New", monospace;
  font-size: 15px;
  font-weight: 900;
  color: var(--ok);
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid var(--ok);
  padding: 3px 9px;
}
.room-countdown.warn { color: var(--ra2-yellow); border-color: var(--ra2-yellow); }
.room-countdown.danger { color: #ff5544; border-color: #ff5544; animation: pulseReady 0.6s infinite alternate; }

.room-body-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 12px;
}
@media (max-width: 780px) { .room-body-grid { grid-template-columns: 1fr; } }

.room-slots-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  align-content: start;
}

.slot-card {
  background: rgba(8, 1, 1, 0.78);
  border: 1px solid var(--ra2-red-border);
  padding: 8px 9px;
}
.slot-card.ready { border-color: var(--ok); }
.slot-card.empty { border-style: dashed; background: rgba(6, 1, 1, 0.45); }

.slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}
.slot-ready-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--ra2-red-border);
  color: var(--text-dim);
}
.slot-ready-badge.ok { border-color: var(--ok); color: var(--ok); }

.slot-controls {
  display: flex;
  gap: 5px;
  align-items: center;
}
.slot-controls select {
  padding: 3px 5px;
  font-size: 11px;
}

.bot-invite-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.bot-lbl { font-size: 11px; color: var(--text-dim); margin-right: 2px; }
.btn-bot {
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 800;
  color: var(--ra2-yellow);
  background: #2b0805;
  border: 1px solid var(--ra2-red-border);
  cursor: pointer;
}
.btn-bot:hover { background: #8f1407; border-color: var(--ra2-yellow); }
.btn-kick {
  padding: 3px 7px;
  font-size: 11px;
  background: #4c0904;
  border: 1px solid #ff4433;
  color: #ffb8b0;
  cursor: pointer;
}
.slot-wait-txt { font-size: 11px; color: var(--text-dim); font-style: italic; }

.room-chat-panel {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid var(--ra2-red-border);
  padding: 9px;
  height: 290px;
}
.chat-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--ra2-yellow);
  margin-bottom: 5px;
}
.room-chat-log {
  flex: 1;
  overflow-y: auto;
  font-size: 12px;
  color: #f4e6b0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-line { line-height: 1.35; word-break: break-word; }
.chat-line.sys { color: var(--ok); font-style: italic; }

.room-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--ra2-red-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.room-footer .ra2-btn { width: auto; min-width: 130px; }

/* ============================================================
   LEADERBOARD
   ============================================================ */
.lb-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.lb-tabs, .lb-pills {
  display: flex;
  gap: 5px;
}

.lb-tabs button, .lb-pills button {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(8, 1, 1, 0.8);
  border: 1px solid var(--ra2-red-border);
  color: var(--text-dim);
  cursor: pointer;
}
.lb-tabs button.active,
.lb-pills button.active {
  background: linear-gradient(180deg, #e03018 0%, #991709 100%);
  border-color: var(--ra2-yellow);
  color: var(--ra2-yellow);
}

.lb-rule-note {
  font-size: 11px;
  color: var(--text-dim);
}

.lb-table-wrap {
  flex: 1;
  min-height: 220px;
  max-height: 410px;
  overflow-y: auto;
  border: 1px solid var(--ra2-red-border);
  background: rgba(4, 0, 0, 0.78);
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.lb-table th {
  position: sticky;
  top: 0;
  background: #3d0804;
  color: var(--ra2-yellow);
  font-size: 11px;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--ra2-red-border);
}

.lb-table td {
  padding: 7px 10px;
  color: #f5e6a8;
  border-bottom: 1px solid rgba(184, 37, 20, 0.28);
}

.lb-empty { text-align: center; padding: 24px !important; color: var(--text-dim); }
.lb-rank { font-weight: 900; color: var(--ra2-yellow); }
.lb-guest-tag {
  font-size: 10px;
  color: var(--text-dim);
  background: rgba(168, 28, 12, 0.35);
  border: 1px solid var(--ra2-red-border);
  padding: 1px 5px;
}
.lb-wl .w, .w { color: var(--ok); font-weight: 800; }
.lb-wl .l, .l { color: #ff5b4a; font-weight: 800; }
.lb-elo { font-family: "Courier New", monospace; font-weight: 800; color: var(--ra2-yellow); }

.wr-wrap { display: flex; align-items: center; gap: 8px; }
.wr-bar { width: 64px; height: 7px; background: #260604; border: 1px solid var(--ra2-red-border); }
.wr-fill { height: 100%; background: linear-gradient(90deg, #2fb85d, #66ff99); }

.lb-my-rank {
  padding: 8px 12px;
  background: rgba(168, 28, 12, 0.35);
  border: 1px solid var(--ra2-yellow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}

/* ============================================================
   END MODAL
   ============================================================ */
.end-panel {
  max-width: 520px;
  text-align: center;
}
.end-panel h2 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: 1.5px;
  color: var(--ra2-yellow);
  text-shadow: 0 2px 6px #000;
}
.end-panel p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
}
.end-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
  text-align: left;
}
.stat-box {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid var(--ra2-red-border);
  padding: 8px 10px;
}
.stat-box span { display: block; font-size: 11px; color: var(--text-dim); }
.stat-box strong { font-size: 17px; color: var(--ra2-yellow); }
.end-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.end-actions .ra2-btn { width: auto; min-width: 120px; }

/* ============================================================
   IN-GAME HUD & CLASSIC METALLIC RA2 SIDEBAR
   ============================================================ */
.game-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
}

#viewport-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* Top Tactical Bar */
.top-hud {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.hud-pill {
  pointer-events: auto;
  background: linear-gradient(180deg, #5c0f08, #240402);
  border: 2px solid #8a9099;
  border-top-color: #cfd4da;
  border-bottom-color: #363a40;
  color: var(--ra2-yellow);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 10px;
  white-space: nowrap;
}

.eva-ticker {
  flex: 1;
  background: rgba(6, 2, 2, 0.85);
  border: 1px solid var(--ra2-red-border);
  color: var(--ra2-yellow);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-actions {
  display: flex;
  gap: 4px;
  pointer-events: auto;
}

.hud-actions button {
  background: linear-gradient(180deg, #5e636b 0%, #2c3036 100%);
  border: 1px solid #9da3ab;
  border-bottom-color: #1c1e22;
  color: var(--ra2-yellow);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
  cursor: pointer;
}
.hud-actions button:hover {
  background: linear-gradient(180deg, #c92512, #6b0f06);
  border-color: var(--ra2-yellow);
}

/* Bottom-left selection bar */
.selection-bar {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(8, 2, 2, 0.92);
  border: 2px solid #8a9099;
  border-top-color: #cfd4da;
  padding: 6px 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.75);
}

.selection-bar img {
  width: 52px;
  height: 42px;
  object-fit: cover;
  border: 1px solid var(--ra2-red-border);
  background: #000;
}

.sel-name { font-size: 13px; font-weight: 800; color: var(--ra2-yellow); }
.sel-stats { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.sel-actions { display: flex; gap: 6px; margin-left: 8px; }
.sel-actions button {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  background: linear-gradient(180deg, #c92512, #6b0f06);
  border: 1px solid var(--ra2-yellow);
  color: var(--ra2-yellow);
  cursor: pointer;
}

/* CLASSIC METALLIC RA2 IN-GAME SIDEBAR */
.sidebar {
  width: 218px;
  flex-shrink: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(90deg, #4b5058 0%, #686e77 12%, #3a3e45 50%, #5c616a 88%, #25282d 100%);
  border-left: 4px solid #9fa5ad;
  box-shadow: inset 2px 0 0 #22252a, -4px 0 18px rgba(0, 0, 0, 0.8);
  z-index: 10;
}

.credits-box {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: #050202;
  border-bottom: 3px solid #6d737c;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.9);
  font-family: "Courier New", Consolas, monospace;
  font-size: 20px;
  font-weight: 900;
  color: var(--ra2-yellow);
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(255, 230, 59, 0.45);
}

.radar-section {
  display: flex;
  align-items: stretch;
  padding: 6px;
  gap: 6px;
  background: linear-gradient(180deg, #32363c, #1d2024);
  border-bottom: 3px solid #6d737c;
}

.power-bar-wrap {
  width: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.power-bar-track {
  position: relative;
  width: 14px;
  flex: 1;
  background: #050202;
  border: 2px solid #595e66;
  overflow: hidden;
}

.power-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(180deg, #43f07c, #1ca648);
  transition: height 0.2s ease, background 0.2s ease;
}
.power-bar-fill.warn { background: linear-gradient(180deg, #ffe63b, #cc8a14); }
.power-bar-fill.low  { background: linear-gradient(180deg, #ff4433, #a31208); }

.power-bar-drain {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #fff;
  box-shadow: 0 0 4px #fff;
  bottom: 30%;
}

.power-text {
  font-size: 9px;
  font-weight: 800;
  color: var(--ra2-yellow);
  text-align: center;
  line-height: 1.1;
}

.radar-frame {
  position: relative;
  flex: 1;
  height: 140px;
  background: #040608;
  border: 3px solid #595e66;
  border-top-color: #25282e;
  border-left-color: #25282e;
  border-right-color: #9ba1a9;
  border-bottom-color: #9ba1a9;
  overflow: hidden;
}

#minimap-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.radar-offline {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(0deg, rgba(16,4,4,0.92), rgba(16,4,4,0.92) 3px, rgba(40,10,8,0.92) 3px, rgba(40,10,8,0.92) 6px);
  color: var(--ra2-yellow);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  pointer-events: none;
}

.tool-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 6px;
  background: #2c3036;
  border-bottom: 2px solid #5c616a;
}

.tool-btn {
  padding: 5px 4px;
  font-size: 11px;
  font-weight: 800;
  color: var(--ra2-yellow);
  background: linear-gradient(180deg, #5e636b 0%, #34383e 100%);
  border: 2px solid #8a9099;
  border-bottom-color: #1f2226;
  border-right-color: #1f2226;
  cursor: pointer;
}
.tool-btn:hover { background: linear-gradient(180deg, #b82110, #610d05); }
.tool-btn.active {
  background: linear-gradient(180deg, #ffe63b, #c29b0e);
  color: #111;
  border-color: #fff6b0;
}

.tabs-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #1b1e23;
  border-bottom: 3px solid #6d737c;
}

.tab-btn {
  padding: 7px 0;
  font-size: 16px;
  background: linear-gradient(180deg, #52575f, #2e3238);
  border: none;
  border-right: 1px solid #1a1d22;
  border-top: 1px solid #8b9199;
  color: #cfd4da;
  cursor: pointer;
}
.tab-btn:last-child { border-right: none; }
.tab-btn:hover { background: linear-gradient(180deg, #757b84, #42474f); }
.tab-btn.active {
  background: radial-gradient(ellipse at 50% 45%, #e03018 0%, #7a1005 100%);
  color: var(--ra2-yellow);
  box-shadow: inset 0 -2px 0 var(--ra2-yellow);
}

.cameo-grid {
  flex: 1;
  overflow-y: auto;
  padding: 7px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  align-content: start;
  background: #16181c;
}

.cameo-card {
  position: relative;
  aspect-ratio: 60 / 48;
  background: #000;
  border: 2px solid #757b84;
  border-right-color: #25282d;
  border-bottom-color: #25282d;
  overflow: hidden;
  cursor: pointer;
}
.cameo-card:hover { border-color: var(--ra2-yellow); }
.cameo-card.locked { opacity: 0.35; filter: grayscale(0.85); cursor: not-allowed; }
.cameo-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cameo-cost {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.78);
  color: var(--ra2-yellow);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  padding: 1px 2px;
  line-height: 1.2;
}
.cameo-progress { position: absolute; inset: 0; pointer-events: none; }
.cameo-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.88);
  color: var(--ra2-yellow);
  font-size: 10px;
  font-weight: 900;
  padding: 1px 4px;
  border: 1px solid var(--ra2-red-border);
}
.cameo-ready {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 180, 70, 0.28);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  text-shadow: 0 1px 4px #000;
  animation: pulseReady 0.9s infinite alternate;
}

@keyframes pulseReady {
  from { background: rgba(20, 180, 70, 0.18); }
  to   { background: rgba(45, 220, 100, 0.45); }
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: #0a0404;
  border-top: 2px solid #6d737c;
  font-size: 11px;
  color: var(--ra2-yellow);
}
.music-now { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 136px; }
.match-timer { font-family: "Courier New", monospace; font-weight: 800; color: var(--ra2-yellow); }

/* Cameo Hover Tooltip */
.cameo-tooltip {
  position: fixed;
  z-index: 40;
  width: 210px;
  background: rgba(10, 2, 2, 0.96);
  border: 2px solid var(--ra2-yellow);
  padding: 8px 10px;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.85);
  font-size: 11px;
}
.cameo-tooltip h4 { margin: 0 0 4px; font-size: 13px; color: var(--ra2-yellow); }
.cameo-tooltip .tt-cost { color: var(--ok); font-weight: 800; margin-bottom: 4px; }
.cameo-tooltip .tt-desc { color: #e8d99c; line-height: 1.35; }

/* Auto-Reload Deploy Banner */
.update-banner {
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  background: rgba(14, 2, 2, 0.96);
  border: 2px solid var(--ra2-yellow);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85);
  font-size: 12px;
  color: var(--ra2-yellow);
}
.update-banner button {
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 800;
  background: linear-gradient(180deg, #e03018, #8f1407);
  color: var(--ra2-yellow);
  border: 1px solid var(--ra2-yellow);
  cursor: pointer;
}
.update-banner button:hover { filter: brightness(1.2); }
