:root {
  --bg: #000000;
  --bar: #202329;
  --bar-hover: #2b3038;
  --border: #363d46;

  --ink: #f0f5fa;
  --muted: #a3b2c2;

  --accent: #67c8ff;
  --accent-hover: #8bd7ff;
  --accent-dark: #17618c;
}

/* =========================
   GLOBAL STYLES
   ========================= */

* {
  box-sizing: border-box;
}

html,
body,
button,
input,
select,
textarea,
a {
  font-family: "Rajdhani", sans-serif;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* =========================
   TOP NAVIGATION BAR
   ========================= */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 72px;
  z-index: 100;

  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 400px) minmax(0, 1fr);
  align-items: center;
  gap: 24px;

  padding: 0 28px;

  background: none;
  border: 0;
  box-shadow: none;
  pointer-events: none; /* empty space no longer blocks dragging the globe */
}

/* =========================
   BRAND
   ========================= */

.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 12px;

  min-width: 0;

  color: var(--ink);
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 42px;
  height: 42px;

  object-fit: contain;
  flex-shrink: 0;
}

.brand-name {
  font-size: 23px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.4px;
  white-space: nowrap;

  text-shadow: 0 2px 8px rgba(103, 200, 255, 0.12);
}

/* =========================
   SEARCH BAR
   ========================= */

.search-container {
  width: 100%;
  min-width: 0;
  height: 44px;

  display: flex;
  align-items: center;
  gap: 12px;

  padding: 0 15px;

  background: #15171b;
  border: 1px solid #41454f;
  border-radius: 7px;

  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.search-container:focus-within {
  border-color: var(--accent);
  background: #191d23;
  box-shadow: 0 0 0 3px rgba(103, 200, 255, 0.12);
}

.search-icon {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 20px;
  height: 20px;
  flex-shrink: 0;

  color: #8eabbf;
}

.search-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.search-container input {
  width: 100%;
  min-width: 0;

  padding: 0;
  border: 0;
  outline: 0;

  color: var(--ink);
  background: transparent;

  font-size: 16px;
  font-weight: 400;
  line-height: normal;
  letter-spacing: 0.2px;
}

.search-container input::placeholder {
  color: #858b97;
  opacity: 1;
}

.search-container input::-webkit-search-cancel-button {
  cursor: pointer;
}

/* NAVIGATION LINKS */

.nav-links {
  display: flex;
  align-items: center;
  justify-self: end;
  justify-content: flex-end;
  gap: 10px;

  min-width: 0;
  white-space: nowrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 48px;
  padding: 0 17px;

  color: #d4d7de;
  text-decoration: none;

  font-size: 19px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;

  border: 1px solid transparent;
  border-radius: 9px;

  transition:
    color 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.nav-link:hover {
  color: #ffffff;
  background: var(--bar-hover);
  border-color: var(--border);
}

/* Play icon */

.play-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 22px;
  height: 22px;
  flex-shrink: 0;

  font-family: Arial, sans-serif;
  font-size: 13px;
  line-height: 1;

  color: #ffffff;
  background: rgba(103,200,255,0.18);

  border-radius: 50%;
}

/* =========================
   BLACK SPACE BACKGROUND
   ========================= */

#space {
  position: fixed;
  inset: 0;
  z-index: 0;

  pointer-events: none;
  background: #000;
}

#space canvas,
#sky-meteors {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  pointer-events: none;
}

/* =========================
   GLOBE
   ========================= */

#globe {
  position: fixed;
  inset: 0;
  z-index: 1;

  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#globe:active {
  cursor: grabbing;
}

#globe canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* =========================
   RESPONSIVE: SMALL DESKTOP
   ========================= */

@media (max-width: 1450px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) minmax(190px, 320px) minmax(0, 1fr);
    gap: 12px;
    padding: 0 18px;
  }

  .brand {
    gap: 9px;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .brand-name {
    font-size: 20px;
  }

  .nav-links {
    gap: 2px;
  }

  .nav-link {
    padding: 0 7px;
    font-size: 13px;
  }
}

/* =========================
   RESPONSIVE: TABLETS
   ========================= */

@media (max-width: 1000px) {
  .topbar {
    grid-template-columns: auto minmax(150px, 1fr) auto;
    gap: 12px;
    padding: 0 14px;
  }

  .brand-name {
    font-size: 18px;
  }

  .search-container {
    height: 40px;
    padding: 0 10px;
    gap: 8px;
  }

  .search-container input {
    font-size: 14px;
  }

  .nav-link {
    padding: 0 6px;
    font-size: 12px;
  }
}

/* =========================
   RESPONSIVE: MOBILE
   ========================= */

@media (max-width: 760px) {
  .topbar {
    height: auto;
    min-height: 0;

    grid-template-columns: 1fr auto;
    gap: 12px;

    padding: 12px 14px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }

  .brand-name {
    font-size: 19px;
  }

  .search-container {
    grid-column: 1 / -1;
    grid-row: 2;

    height: 40px;
  }

  .nav-links {
    grid-column: 1 / -1;
    grid-row: 3;

    justify-self: stretch;
    justify-content: space-between;
    gap: 4px;
  }

  .nav-link {
    min-height: 36px;
    padding: 0 7px;
    font-size: 12px;
  }
}

/* =========================
   RESPONSIVE: SMALL PHONES
   ========================= */

@media (max-width: 380px) {
  .topbar {
    padding: 10px;
    gap: 9px;
  }

  .brand-logo {
    width: 29px;
    height: 29px;
  }

  .brand-name {
    font-size: 16px;
  }

  .nav-link {
    padding: 0 4px;
    font-size: 10px;
  }

  .search-container input {
    font-size: 13px;
  }
}

/* =========================
   REDUCED MOTION
   ========================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}






/* ==========================================
   SECRETSPHERE TOWNY SIDEBAR
   ========================================== */

#ss-town-panel {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;

  width: 340px !important;
  min-width: 300px !important;
  max-width: 88vw !important;
  height: 100vh !important;

  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;

  padding: 30px 26px;

  color: #ffffff;
  background: rgba(25, 29, 36, 0.985);

  border: none;
  border-left: 1px solid rgba(103, 200, 255, 0.22);
  border-radius: 0;

  box-shadow: -14px 0 45px rgba(0, 0, 0, 0.45);

  font-family: "Roboto", sans-serif !important;

  opacity: 0;
  transform: translateX(100%);
  pointer-events: none;

  z-index: 99999 !important;

  transition:
    opacity 240ms ease,
    transform 240ms ease;

  scrollbar-width: thin;
  scrollbar-color: #465565 transparent;
}

#ss-town-panel,
#ss-town-panel * {
  font-family: "Roboto", sans-serif !important;
}

#ss-town-panel.ss-visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

#ss-town-panel[hidden] {
  display: none !important;
}

/* Header */

#ss-town-panel .ss-town-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;

  padding: 35px 0 23px;
  margin-bottom: 22px;

  text-align: left;

  border-bottom: 1px solid rgba(255,255,255,0.12);
}

#ss-town-panel .ss-town-name {
  margin: 0;

  color: #ffffff;

  font-size: 29px;
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: -0.7px;

  overflow-wrap: anywhere;
}

/* Close button */

#ss-town-panel .ss-town-close {
  position: absolute;
  top: 16px;
  right: 16px;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 36px;
  height: 36px;

  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 7px;

  background: rgba(255,255,255,0.06);
  color: #ffffff;

  font-size: 25px;
  line-height: 1;

  cursor: pointer;

  transition:
    background 150ms ease,
    border-color 150ms ease;
}

#ss-town-panel .ss-town-close:hover {
  background: rgba(103, 200, 255, 0.15);
  border-color: rgba(103, 200, 255, 0.45);
}

/* Section headings */

#ss-town-panel .ss-town-section-title {
  margin: 25px 0 12px;
  padding-bottom: 9px;

  color: #83cfff;

  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;

  border-bottom: 1px solid rgba(103, 200, 255, 0.15);
}

/* Town information */

#ss-town-panel .ss-town-details {
  display: flex;
  flex-direction: column;
  gap: 0;

  padding-bottom: 12px;

  border-bottom: 1px solid rgba(255,255,255,0.1);
}

#ss-town-panel .ss-town-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;

  padding: 13px 0;

  font-size: 14px;
  line-height: 1.4;

  border-bottom: 1px solid rgba(255,255,255,0.055);
}

#ss-town-panel .ss-town-row:last-child {
  border-bottom: none;
}

/* Information labels: white */

#ss-town-panel .ss-town-row span {
  color: #ffffff;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

/* Information answers: gray and smaller */

#ss-town-panel .ss-town-row strong {
  color: #a3b2c2;
  text-align: left;
  overflow-wrap: anywhere;

  font-size: 13px;
  font-weight: 400;
}

/* Protection flags */

#ss-town-panel .ss-town-flags {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

#ss-town-panel .ss-town-flag {
  display: flex;
  flex-direction: column;
  gap: 5px;

  padding: 13px 14px;

  border: 1px solid rgba(255,255,255,0.075);
  border-radius: 7px;

  background: rgba(255,255,255,0.045);

  font-size: 14px;

  transition:
    background 150ms ease,
    border-color 150ms ease;
}

#ss-town-panel .ss-town-flag:hover {
  background: rgba(103, 200, 255, 0.07);
  border-color: rgba(103, 200, 255, 0.2);
}

/* Flag labels: white */

#ss-town-panel .ss-town-flag span {
  color: #ffffff;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Flag answers: gray and smaller */

#ss-town-panel .ss-town-flag strong {
  color: #a3b2c2;
  text-align: left;
  font-size: 13px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

/* Unknown values */

#ss-town-panel .ss-town-unknown {
  color: #8493a3 !important;
}

/* Errors */

#ss-town-panel .ss-town-error {
  margin-top: 14px;
  color: #fca5a5;
  font-size: 12px;
}

/* Tablet */

@media (max-width: 900px) {
  #ss-town-panel {
    width: 310px !important;
    min-width: 280px !important;
    max-width: 85vw !important;
    padding: 26px 22px;
  }

  #ss-town-panel .ss-town-name {
    font-size: 26px;
  }
}

/* Mobile */

@media (max-width: 560px) {
  #ss-town-panel {
    width: min(340px, 88vw) !important;
    min-width: 0 !important;
    max-width: 88vw !important;
    padding: 24px 19px;
  }

  #ss-town-panel .ss-town-name {
    font-size: 23px;
  }
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  #ss-town-panel {
    transition: none;
  }
}

/* Force Roboto throughout the Towny sidebar */
#ss-town-panel,
#ss-town-panel * {
  font-family: "Roboto", sans-serif !important;
}





/* ==========================================================================
   OVERLAY TOGGLE MENU  (left side bar)
   Simple on/off buttons. Hover labels need the updated overlay-toggles.js (data-tip).
   ========================================================================== */

#ss-overlay-toggles {
  position: fixed;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100000;

  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;

  /* same flat look as the search bar */
  background: #15171b;
  border: 1px solid #41454f;
  border-radius: 7px;
}

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

.ss-overlay-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;

  display: grid;
  place-items: center;

  /* OFF: dark button */
  background: #202329;
  border: 1px solid #363d46;
  border-radius: 5px;

  cursor: pointer;
  -webkit-tap-highlight-color: transparent;

  transition:
    background 120ms ease,
    border-color 120ms ease;
}

.ss-overlay-toggle img {
  display: block;
  width: 24px;
  height: 24px;

  object-fit: contain;
  pointer-events: none;

  /* OFF: gray icon */
  filter: brightness(0) invert(0.5);

  transition: filter 120ms ease;
}

.ss-overlay-toggle:hover {
  background: var(--bar-hover);
  border-color: #4a5461;
}

.ss-overlay-toggle:hover img {
  filter: brightness(0) invert(0.8);
}

/* ON: solid blue button, white icon */

.ss-overlay-toggle[aria-pressed="true"] {
  background: #1f7fb5;
  border-color: var(--accent);
}

.ss-overlay-toggle[aria-pressed="true"] img {
  filter: brightness(0) invert(1);
}

.ss-overlay-toggle[aria-pressed="true"]:hover {
  background: #2a8fc8;
}

.ss-overlay-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ss-overlay-toggle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- Hover label (desktop only) ---------- */

@media (hover: hover) {
  .ss-overlay-toggle[data-tip]::after {
    content: attr(data-tip);

    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);

    padding: 6px 10px;

    color: #ffffff;
    background: #15171b;
    border: 1px solid #41454f;
    border-radius: 5px;

    font-family: "Rajdhani", sans-serif;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;

    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
  }

  .ss-overlay-toggle[data-tip]:hover::after,
  .ss-overlay-toggle[data-tip]:focus-visible::after {
    opacity: 1;
  }
}

/* ---------- Mobile ---------- */

@media (max-width: 600px) {

  #ss-overlay-toggles {
    left: 8px;
    padding: 4px;
    gap: 4px;
  }

  .ss-overlay-toggle {
    width: 40px;
    height: 40px;
  }

  .ss-overlay-toggle img {
    width: 21px;
    height: 21px;
  }

}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  .ss-overlay-toggle,
  .ss-overlay-toggle img,
  .ss-overlay-toggle::after {
    transition: none;
  }
}





/* ==========================================================================
   TOP BAR: ONLY LOGO + SEARCH
   ========================================================================== */

/* Only the logo and the search box catch clicks */
.brand,
.search-container {
  pointer-events: auto;
}

/* Mobile: logo and search on one row, since the nav links are gone */
@media (max-width: 760px) {
  .topbar {
    height: 64px;
    grid-template-columns: auto minmax(0, 1fr);
    padding: 0 14px;
    gap: 12px;
  }

  .search-container {
    grid-column: auto;
    grid-row: auto;
  }
}


/* ==========================================================================
   FIXED COORDINATES DISPLAY (BOTTOM RIGHT)
   ========================================================================== */

#coords-display {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100000;

  min-width: 190px;
  padding: 9px 14px;

  color: #ffffff;
  background: rgba(23, 26, 31, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  font-family: "Roboto", sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;

  pointer-events: none; /* never blocks dragging the globe */
}

@media (max-width: 600px) {
  #coords-display {
    right: 8px;
    bottom: 8px;
    min-width: 0;
    font-size: 12px;
    padding: 7px 10px;
  }
}

/* Old floating cursor tooltip must never show: coordinates live in #coords-display */
#ss-coords {
  display: none !important;
}