html, body, #map {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  background: var(--pageBg, #2b2f31);
}

#hud{
  position: absolute;
  top: 12px;
  left: 60px;
  z-index: 999;
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 10px 12px;
  border-radius: 10px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  backdrop-filter: blur(6px);
}

#hud .title{
  font-weight: 700;
  margin-bottom: 4px;
}

.map-switch-control.leaflet-control {
  margin-top: 10px;
  margin-right: 10px;
}

.top-right-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.map-switch-btn {
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 999px;
  background: rgba(0,0,0,0.58);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.28);
  transition: transform 160ms ease, background 160ms ease;
}

.map-switch-btn:hover {
  transform: scale(1.05);
  background: rgba(0,0,0,0.68);
}

.map-switch-btn:active {
  transform: scale(0.96);
}

.map-switch-btn svg {
  width: 30px;
  height: 30px;
  stroke: currentColor;
  stroke-width: 2.05;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.player-panel-shell.leaflet-control {
  width: min(360px, calc(100vw - 18px));
  position: relative;
  overflow: visible;
  margin-top: 10px;
  margin-left: 10px;
  transform: translateX(0);
  transition: transform 220ms ease;
}

.player-panel-shell.collapsed {
  transform: translateX(calc(-100% + 56px));
}

.player-panel {
  background: rgba(0,0,0,0.62);
  color: #fff;
  padding: 14px 12px 12px;
  border-radius: 14px;
  backdrop-filter: blur(6px);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  max-height: min(60vh, 560px);
  overflow: auto;
  box-shadow: 0 8px 22px rgba(0,0,0,0.26);
}

.player-panel-toggle {
  position: absolute;
  top: 12px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
}

.player-panel-toggle:hover {
  background: rgba(255,255,255,0.22);
}

.player-panel-toggle .chevron {
  font-size: 18px;
  line-height: 1;
  transition: transform 220ms ease;
}

.player-panel-shell.collapsed .player-panel-toggle .chevron {
  transform: rotate(180deg);
}

.player-panel .title {
  font-weight: 800;
  margin-bottom: 10px;
  padding-right: 42px;
  font-size: 16px;
}

.player-panel #player-list {
  margin-top: 14px;
}

.player-panel .row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-radius: 10px;
}

.player-panel .row:hover {
  background: var(--rowTintBg, rgba(255,255,255,0.08));
}

.player-panel .name {
  flex: 1;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-panel input.visibility-toggle,
.player-panel input.trail-toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 32px;
  height: 28px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.42);
  background: rgba(255,255,255,0.15);
  display: grid;
  place-items: center;
  cursor: pointer;
  margin: 0;
}

.player-panel input.visibility-toggle::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid #04131f;
  border-bottom: 2px solid #04131f;
  transform: rotate(-45deg) translateY(-1px) scale(1.05);
  opacity: 0;
}

.player-panel input.visibility-toggle:checked {
  background: #54d1ff;
  border-color: #54d1ff;
}

.player-panel input.visibility-toggle:hover,
.player-panel input.trail-toggle:hover {
  background: rgba(255,255,255,0.22);
}

.player-panel input.visibility-toggle:checked::after {
  opacity: 1;
}

.player-panel input.trail-toggle::after {
  content: "∿";
  font-size: 18px;
  line-height: 1;
  color: rgba(255,255,255,0.6);
  transform: translateY(-0.5px);
}

.player-panel input.trail-toggle:checked {
  background: rgba(84, 209, 255, 0.3);
  border-color: #54d1ff;
}

.player-panel input.trail-toggle:checked::after {
  color: #8be1ff;
}

.player-panel .eye {
  width: 32px;
  height: 28px;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  background: rgba(255,255,255,0.15);
  color: #fff;
  display: grid;
  place-items: center;
}

.player-panel .eye svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 2.05;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateY(0.5px);
}

.player-panel .eye:hover {
  background: rgba(255,255,255,0.22);
}

.player-panel .eye.active {
  background: rgba(0,170,255,0.35);
}

.game-time-panel-shell.leaflet-control {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  margin: 0;
  pointer-events: none;
}

.game-time-panel {
  background: rgba(0,0,0,0.62);
  color: #fff;
  border-radius: 14px;
  backdrop-filter: blur(6px);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  box-shadow: 0 8px 22px rgba(0,0,0,0.26);
  border: 1px solid rgba(255,255,255,0.18);
  padding: 7px 12px;
  min-width: 96px;
  text-align: center;
}

.game-time-panel .value {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
}

@media (max-width: 768px) {
  .map-switch-btn {
    width: 56px;
    height: 56px;
  }

  .map-switch-btn svg {
    width: 26px;
    height: 26px;
  }

  .player-panel-shell.leaflet-control {
    width: min(320px, calc(100vw - 14px));
    margin-left: 7px;
    margin-top: 7px;
  }

  .player-panel-shell.collapsed {
    transform: translateX(calc(-100% + 52px));
  }

  .game-time-panel-shell.leaflet-control {
    top: 7px;
  }

  .game-time-panel {
    min-width: 88px;
    padding: 6px 10px;
  }

  .game-time-panel .value {
    font-size: 12px;
  }
}

#settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.42);
  backdrop-filter: blur(4px);
}

#settings-overlay[hidden] {
  display: none;
}

.settings-modal {
  width: min(420px, calc(100vw - 24px));
  background: rgba(8, 18, 28, 0.92);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  color: #fff;
  box-shadow: 0 16px 34px rgba(0,0,0,0.35);
  padding: 14px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.settings-title {
  font-size: 18px;
  font-weight: 800;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}

.settings-field select {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: #fff;
  padding: 10px 12px;
  outline: none;
}

.map-cycle-inline {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  padding: 5px;
}

.map-nav-btn {
  width: 36px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}

.map-nav-btn:hover {
  background: rgba(255,255,255,0.24);
}

.map-cycle-name {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #fff;
}

.settings-check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.settings-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 19px;
  height: 19px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.42);
  background: rgba(255,255,255,0.09);
  display: grid;
  place-items: center;
  cursor: pointer;
  margin: 0;
}

.settings-check input[type="checkbox"]::after {
  content: "";
  width: 10px;
  height: 5px;
  border-left: 2px solid #04131f;
  border-bottom: 2px solid #04131f;
  transform: rotate(-45deg) translateY(-1px);
  opacity: 0;
}

.settings-check input[type="checkbox"]:checked {
  background: #54d1ff;
  border-color: #54d1ff;
}

.settings-check input[type="checkbox"]:checked::after {
  opacity: 1;
}

.settings-subtitle {
  margin-top: 2px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  opacity: 0.86;
}

.settings-slider-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.settings-slider-value {
  min-width: 52px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.9;
}

.settings-slider-row input[type="range"] {
  width: 100%;
  accent-color: #54d1ff;
}

.settings-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.settings-actions .btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  color: #fff;
  font-weight: 700;
}

.settings-actions .btn.ghost {
  background: rgba(255,255,255,0.15);
}

.settings-actions .btn.ghost:hover {
  background: rgba(255,255,255,0.24);
}

.settings-actions .btn.solid {
  background: rgba(0,170,255,0.45);
}

.settings-actions .btn.solid:hover {
  background: rgba(0,170,255,0.58);
}

html, body {
  background: #2b2f31;
}

#map {
  background: var(--pageBg, #2b2f31);
}

/* optional: darken Leaflet UI to match */
.leaflet-control-zoom a {
  background: #2b2f31;
  color: #fff;
  border-color: rgba(255,255,255,0.15);
}
.leaflet-control-zoom a:hover {
  background: #353a3d;
}

/* ---------------- Pointer / SVG styling ---------------- */

.player-arrow {
  fill: currentColor;   
  stroke: #000;  
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  transform-origin: 50% 50%;
  will-change: transform;
  transform: scale(var(--pointerScale, 1));
  position: relative; /* needed for wanted-level overlay */
}

/* Base SVG behaviour */
.player-arrow svg {
  fill: currentColor;  
  stroke: #000;   
  width: 100%;
  height: 100%;
  display: block;
  transform: translateY(calc(var(--arrowSize, 52px) * var(--pivotY, -0.47)));
  transform-origin: 50% 50%;
  stroke-width: 2;
  paint-order: stroke fill;
}

/* Force all inner shapes to follow our colors.
   (Works even if the SVG file uses paths/circles/etc.) */
.player-arrow svg * {
  fill: currentColor !important;
  stroke: #000000 !important;
  stroke-width: 2 !important;
  paint-order: stroke fill;
  vector-effect: non-scaling-stroke;
}

/* Wanted state:
   - stroke becomes player's normal color
   - fill animates between siren colors */
.player-arrow.wanted svg * {
  stroke: var(--playerColor) !important;
  stroke-width: 2 !important;
  paint-order: stroke fill;
  fill: #b51616 !important;
  animation: sirenFill var(--sirenDur, 0.9s) steps(1, end) infinite;
}

/* Wanted level number overlay */
.wanted-level {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;

  font-weight: 900;
  color: #000;
  pointer-events: none;
  user-select: none;

  font-size: calc(var(--arrowSize, 52px) * 0.52);
  line-height: 1;
  animation: sirenFill var(--sirenDur, 0.9s) steps(1, end) infinite;

  /* Tune this to move the number up/down without affecting pointer */
  transform: translateY(calc(var(--arrowSize, 52px) * -0.08));
}

/* ---------------- Tooltip / nametag styling ---------------- */

.leaflet-tooltip.player-nametag {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

html.hide-nametags .leaflet-tooltip.player-nametag {
  display: none !important;
}

.player-nametag .tag-box {
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;

  font-size: calc(var(--arrowSize, 28px) * 0.62);
  padding: calc(var(--arrowSize, 28px) * 0.12) calc(var(--arrowSize, 28px) * 0.26);

  border-radius: 10px;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 8px rgba(0,0,0,0.35);
  line-height: 1.1;

  transform: translateY(var(--stackY, 0px));
  will-change: transform;
}

.player-nametag .tag-text {
  white-space: nowrap;
}

/* ---------------- Passkey overlay ---------------- */

#passkey-overlay{
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
}

#passkey-overlay .pk-card{
  width: min(420px, 92vw);
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  padding: 18px;
  color: #fff;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

#passkey-overlay .pk-title{
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 8px;
}

#passkey-overlay .pk-sub{
  font-size: 13px;
  opacity: 0.85;
  line-height: 1.35;
  margin-bottom: 12px;
}

#passkey-overlay .pk-input{
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #fff;
  outline: none;
}

#passkey-overlay .pk-btn{
  margin-top: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(0,170,255,0.35);
  color: #fff;
  font-weight: 800;
}

#passkey-overlay .pk-btn:hover{
  background: rgba(0,170,255,0.45);
}

#passkey-overlay .pk-err{
  display: none;
  margin-top: 10px;
  font-size: 13px;
  color: #ffb3b3;
}

/* Siren animation (brightened a bit) */
@keyframes sirenFill {
  0%   { fill: #b51616; }
  50%  { fill: #1a7e95; }
  100% { fill: #b51616; }
}
