/* ==================================================
   RRMAP — RESPONSIVE REAL-WORLD GAME INTERFACE
================================================== */

:root {
  --rr-gold: #ffd56f;
  --rr-gold-dark: #9b641c;
  --rr-purple: #8f2cff;
  --rr-green: #77ff5d;
  --rr-panel: rgba(13, 11, 28, 0.94);
  --rr-panel-2: rgba(29, 18, 53, 0.94);
  --rr-border: rgba(255, 207, 105, 0.58);
  --rr-shadow: 0 14px 34px rgba(0, 0, 0, 0.46);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body[data-page="map"] {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body[data-page="map"] {
  background: #081d33;
}

.rrmap-page,
.rrmap-main,
body[data-page="map"] #map,
body[data-page="map"] .map-core {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

.rrmap-page {
  overflow: hidden;
}

.rrmap-main {
  z-index: 1;
}

body[data-page="map"] .leaflet-container {
  background: #9fd0df;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-page="map"] .leaflet-tile-pane {
  filter: saturate(1.12) contrast(1.04) brightness(0.96);
}

body[data-page="map"] .leaflet-tile {
  outline: none !important;
}

/* ==================================================
   TOP HUD — DESKTOP
================================================== */

.rrmap-topbar {
  position: fixed;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 1500;
  height: 86px;
  pointer-events: none;
}

.rrmap-topbar > * {
  pointer-events: auto;
}

.rrmap-balance-panel,
.rrmap-daily-panel {
  position: absolute;
  top: 0;
  width: 250px;
  min-height: 78px;
  padding: 12px 15px;
  border: 1px solid var(--rr-border);
  border-radius: 20px;
  background: linear-gradient(145deg, var(--rr-panel-2), var(--rr-panel));
  box-shadow: var(--rr-shadow), inset 0 0 18px rgba(132, 48, 255, 0.08);
  backdrop-filter: blur(16px);
}

.rrmap-balance-panel {
  left: 0;
}

.rrmap-daily-panel {
  right: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.rrmap-main-balance {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rrmap-main-balance img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(255, 190, 50, 0.65));
}

.rrmap-main-balance > div {
  display: flex;
  flex-direction: column;
}

.rrmap-balance-label,
.rrmap-daily-content > span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
}

.rrmap-main-balance strong {
  color: white;
  font-size: 21px;
  line-height: 1.1;
}

.rrmap-bonus-balance {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.rrmap-bonus-balance strong {
  color: var(--rr-green);
}

.rrmap-brand {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  display: block;
  text-decoration: none;
}

.rrmap-logo {
  display: block;
  width: clamp(300px, 29vw, 470px);
  max-height: 82px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.34));
}

.rrmap-daily-icon {
  flex: 0 0 43px;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 13px;
  background: radial-gradient(circle, #ffcc45, #ff8a18 58%, #55136e);
  box-shadow: 0 0 16px rgba(255, 174, 37, 0.34);
}

.rrmap-daily-icon img {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.rrmap-daily-content {
  flex: 1;
  min-width: 0;
}

.rrmap-daily-content strong {
  display: block;
  color: white;
  font-size: 16px;
  white-space: nowrap;
}

.rrmap-progress-track {
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 212, 111, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.rrmap-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7427ff, #ce32ff 55%, #ffd146);
}

/* ==================================================
   LEFT TOOLBAR — DESKTOP
================================================== */

.rrmap-left-toolbar {
  position: fixed;
  top: 126px;
  left: 18px;
  bottom: 26px;
  z-index: 1450;
  display: flex;
  flex-direction: column;
  gap: 13px;
  pointer-events: none;
}

.rrmap-left-toolbar > * {
  pointer-events: auto;
}

.rrmap-tool-button {
  width: 88px;
  min-height: 82px;
  padding: 8px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid rgba(255, 206, 99, 0.5);
  border-radius: 18px;
  background: linear-gradient(150deg, rgba(29, 18, 54, 0.97), rgba(8, 8, 17, 0.95));
  box-shadow: var(--rr-shadow);
  color: white;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.rrmap-tool-button:hover,
.rrmap-tool-button:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.48), 0 0 20px rgba(151, 52, 255, 0.22);
  outline: none;
}

.rrmap-tool-button img {
  width: 43px;
  height: 43px;
  object-fit: contain;
  filter: drop-shadow(0 0 7px rgba(255, 188, 55, 0.38));
}

.rrmap-tool-button span {
  font-size: 10px;
  font-weight: 750;
}

.rrmap-tool-button:last-child {
  margin-top: auto;
}

/* ==================================================
   BOTTOM HUD
================================================== */

.rrmap-slogan {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 1400;
  transform: translateX(-50%);
  min-width: 390px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border: 1px solid var(--rr-border);
  border-radius: 18px;
  background: linear-gradient(135deg, var(--rr-panel-2), var(--rr-panel));
  box-shadow: var(--rr-shadow);
}

.rrmap-slogan img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.rrmap-slogan > div {
  display: flex;
  flex-direction: column;
}

.rrmap-slogan strong {
  color: #ffe29a;
  font-size: 16px;
}

.rrmap-slogan span {
  color: rgba(255, 255, 255, 0.64);
  font-size: 11px;
}

.rrmap-add-opportunity {
  position: fixed;
  right: 20px;
  bottom: 22px;
  z-index: 1450;
  min-width: 205px;
  min-height: 56px;
  padding: 9px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border: 1px solid rgba(255, 213, 117, 0.74);
  border-radius: 20px;
  background: linear-gradient(135deg, #42156f, #170b31);
  box-shadow: var(--rr-shadow), 0 0 22px rgba(168, 41, 255, 0.22);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.rrmap-add-icon {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border: 2px solid var(--rr-gold);
  border-radius: 50%;
  background: linear-gradient(145deg, #bd36ff, #6818ce);
  font-size: 25px;
  line-height: 1;
}

/* ==================================================
   ZOOM + ATTRIBUTION
================================================== */

body[data-page="map"] .leaflet-top.leaflet-left {
  top: 50%;
  left: auto;
  right: 18px;
  transform: translateY(-50%);
}

body[data-page="map"] .leaflet-control-zoom {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 205, 102, 0.52) !important;
  border-radius: 15px !important;
  box-shadow: var(--rr-shadow);
}

body[data-page="map"] .leaflet-control-zoom a {
  width: 39px;
  height: 39px;
  line-height: 39px;
  border: 0 !important;
  background: rgba(10, 9, 20, 0.94);
  color: var(--rr-gold);
  font-size: 22px;
}

body[data-page="map"] .leaflet-control-attribution {
  background: rgba(6, 6, 14, 0.68);
  color: rgba(255, 255, 255, 0.62);
}

body[data-page="map"] .leaflet-control-attribution a {
  color: var(--rr-gold);
}

/* ==================================================
   GAME MARKERS
================================================== */

.rr-game-marker {
  background: transparent !important;
  border: 0 !important;
}

.rr-game-marker-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s ease;
}

.rr-game-marker-inner:hover {
  transform: translateY(-3px) scale(1.04);
}

.rr-game-marker-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(255, 194, 56, 0.5));
}

.rr-game-marker-label {
  min-width: 112px;
  margin-top: 4px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 197, 61, 0.55);
  border-radius: 10px;
  background: rgba(13, 13, 18, 0.94);
  color: white;
  text-align: center;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.38);
}

.rr-game-marker-label strong {
  display: block;
  font-size: 11px;
  line-height: 1.2;
}

.rr-game-marker-label span {
  display: block;
  margin-top: 3px;
  color: var(--rr-green);
  font-size: 13px;
  font-weight: 800;
}

/* ==================================================
   POPUPS + PANELS
================================================== */

.hidden,
.rr-panel.hidden {
  display: none !important;
}

.rr-panel {
  position: fixed;
  top: 116px;
  right: 18px;
  bottom: 92px;
  z-index: 1700;
  width: min(380px, calc(100vw - 36px));
  overflow: auto;
  border: 1px solid var(--rr-border);
  border-radius: 22px;
  background: linear-gradient(155deg, rgba(29, 18, 53, 0.99), rgba(8, 8, 17, 0.99));
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.58);
}

.rr-panel-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: rgba(10, 8, 20, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rr-panel-header h2 {
  margin: 0;
  font-size: 19px;
}

.rr-panel-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 207, 105, 0.35);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--rr-gold);
  font-size: 23px;
}

.rr-panel-content {
  padding: 18px;
}

body[data-page="map"] .leaflet-popup-content-wrapper,
body[data-page="map"] .leaflet-popup-tip {
  color: white;
  background: linear-gradient(150deg, rgba(30, 18, 54, 0.99), rgba(8, 8, 17, 0.99));
}

body[data-page="map"] .leaflet-popup-content-wrapper {
  border: 1px solid rgba(255, 205, 101, 0.5);
  border-radius: 20px;
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.55);
}

.rr-popup-card {
  min-width: 210px;
  text-align: center;
}

.rr-popup-icon {
  width: 66px;
  height: 66px;
  object-fit: contain;
}

.rr-popup-card h3 {
  margin: 4px 0 8px;
}

.rr-popup-reward {
  color: var(--rr-green);
  font-size: 20px;
  font-weight: 800;
}

.rr-popup-button {
  display: inline-block;
  margin-top: 12px;
  padding: 9px 18px;
  border-radius: 11px;
  background: linear-gradient(135deg, #7135ff, #9d32ff);
  color: white;
  font-weight: 750;
  text-decoration: none;
}

/* ==================================================
   MOBILE NAVIGATION
================================================== */

.rrmap-mobile-nav {
  display: none;
}

/* ==================================================
   TABLET
================================================== */

@media (max-width: 1050px) {
  .rrmap-logo {
    width: clamp(250px, 30vw, 330px);
  }

  .rrmap-balance-panel,
  .rrmap-daily-panel {
    width: 220px;
  }

  .rrmap-tool-button {
    width: 80px;
  }

  .rrmap-slogan {
    min-width: 340px;
  }
}

/* ==================================================
   MOBILE — COMPACT, NO OVERLAPPING LABELS
================================================== */

@media (max-width: 700px) {
  .rrmap-topbar {
    top: calc(8px + env(safe-area-inset-top, 0px));
    left: 8px;
    right: 8px;
    height: 116px;
  }

  .rrmap-brand {
    top: 0;
  }

  .rrmap-logo {
    width: 168px;
    max-height: 42px;
  }

  .rrmap-balance-panel,
  .rrmap-daily-panel {
    top: 48px;
    width: calc(50% - 5px);
    min-height: 58px;
    padding: 8px 10px;
    border-radius: 16px;
  }

  .rrmap-main-balance img {
    width: 31px;
    height: 31px;
  }

  .rrmap-balance-label,
  .rrmap-daily-content > span {
    display: none;
  }

  .rrmap-main-balance strong {
    font-size: 16px;
  }

  .rrmap-bonus-balance {
    margin-top: 4px;
    padding-top: 4px;
    font-size: 9px;
  }

  .rrmap-daily-panel {
    gap: 7px;
  }

  .rrmap-daily-icon {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .rrmap-daily-icon img {
    width: 21px;
    height: 21px;
  }

  .rrmap-daily-content strong {
    font-size: 12px;
  }

  .rrmap-progress-track {
    height: 4px;
    margin-top: 5px;
  }

  .rrmap-left-toolbar,
  .rrmap-slogan {
    display: none;
  }

  .rrmap-add-opportunity {
    right: 10px;
    bottom: calc(83px + var(--safe-bottom));
    min-width: 0;
    min-height: 45px;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 11px;
  }

  .rrmap-add-icon {
    width: 29px;
    height: 29px;
    font-size: 20px;
  }

  body[data-page="map"] .leaflet-top.leaflet-left {
    top: 50%;
    right: 9px;
  }

  body[data-page="map"] .leaflet-control-zoom a {
    width: 36px;
    height: 36px;
    line-height: 36px;
  }

  .rr-game-marker-label {
    display: none;
  }

  .rr-game-marker-icon {
    width: 44px;
    height: 44px;
  }

  .rr-panel {
    top: calc(126px + env(safe-area-inset-top, 0px));
    right: 8px;
    bottom: calc(82px + var(--safe-bottom));
    width: calc(100vw - 16px);
  }

  .rrmap-mobile-nav {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(8px + var(--safe-bottom));
    z-index: 1600;
    min-height: 66px;
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    border: 1px solid rgba(255, 205, 101, 0.4);
    border-radius: 20px;
    background: linear-gradient(150deg, rgba(21, 14, 39, 0.98), rgba(7, 7, 15, 0.98));
    box-shadow: var(--rr-shadow);
  }

  .rrmap-mobile-nav a,
  .rrmap-mobile-nav button {
    min-width: 0;
    padding: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    border: 0;
    background: none;
    color: rgba(255, 255, 255, 0.68);
    text-decoration: none;
    font-size: 9px;
  }

  .rrmap-mobile-nav img {
    width: 27px;
    height: 27px;
    object-fit: contain;
  }

  .rrmap-mobile-nav .rrmap-mobile-main {
    transform: translateY(-8px);
    color: var(--rr-gold);
  }

  .rrmap-mobile-nav .rrmap-mobile-main img {
    width: 44px;
    height: 44px;
  }

  body[data-page="map"] .leaflet-control-attribution {
    display: none;
  }
}

/* ==================================================
   NATIVE RR CLUSTER
================================================== */

.rr-cluster-marker {
  background: transparent !important;
  border: 0 !important;
}

.rr-cluster-inner {
  position: relative;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 211, 102, 0.82);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(103, 35, 179, 0.96), rgba(12, 9, 25, 0.99));
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.48),
    0 0 22px rgba(255, 181, 42, 0.35);
}

.rr-cluster-inner img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.rr-cluster-inner span {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border: 2px solid #ffd56f;
  border-radius: 999px;
  background: #20102f;
  color: white;
  font-size: 12px;
  font-weight: 800;
}

/* OSM attribution is required; keep it tiny and unobtrusive. */
body[data-page="map"] .leaflet-control-attribution {
  right: 6px;
  bottom: 5px;
  padding: 1px 4px;
  border: 0;
  border-radius: 5px;
  background: rgba(8, 8, 17, 0.58);
  color: rgba(255, 255, 255, 0.5);
  font-size: 8px;
  line-height: 1.1;
  opacity: 0.7;
  box-shadow: none;
}

body[data-page="map"] .leaflet-control-attribution a {
  color: rgba(255, 221, 147, 0.72);
  text-decoration: none;
}

.rr-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.rr-legend-item img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.rr-legend-item strong,
.rr-legend-item span {
  display: block;
}

.rr-legend-item span {
  color: #77ff5d;
}

@media (max-width: 700px) {
  .rr-cluster-inner {
    width: 54px;
    height: 54px;
  }

  .rr-cluster-inner img {
    width: 46px;
    height: 46px;
  }

  body[data-page="map"] .leaflet-control-attribution {
    right: 4px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    font-size: 7px;
    opacity: 0.58;
  }
}

