body, html { margin:0; height:100%; }

#login {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
}

#loginCard {
  background: white;
  padding: 28px;
  border-radius: 16px;
  width: min(92vw, 360px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-family: sans-serif;
}

#loginCard h2 { text-align:center; margin: 0 0 6px; }

#loginCard input {
  font-size: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #ccc;
}

#loginBtn {
  margin-top: 8px;
  font-size: 18px;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: #222;
  color: white;
  cursor: pointer;
}

#loginBtn:hover { filter: brightness(1.05); }
#loginBtn:active { transform: scale(0.98); }

#error { color: red; text-align:center; min-height: 1.2em; }

.showPassword {
  font-size: 14px;
  color: #555;
  display:flex;
  align-items:center;
  gap:8px;
  margin-top: -6px;
}

#mapWrap{ position:fixed; inset:0; width:100%; height:100%; display:none; }
#map{ position:absolute; inset:0; width:100%; height:100%; z-index:0; }

#controls{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(32px + env(safe-area-inset-bottom));
  z-index: 2400;
  display:flex;
  gap: 36px;
}

#controls button{
  padding: 12px 18px;
  font-size: 16px;
  border: none;
  border-radius: 10px;
  background: white;
  color: black;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  box-shadow: 0 0 3px 3px rgba(0, 0, 0, .50);
}

#controls button:hover{ filter: brightness(0.98); }

#metaPanel{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 2400;
  display:flex;
  flex-direction:column;
  gap:8px;
  width: min(92vw, 420px);

  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);

  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 14px;
  padding: 10px;

  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

#metaPanel input{
  padding: 10px 12px;
  border-radius: 10px;
  border:1px solid #ccc;
  background:white;
}

#profileBtn{
  position:absolute;
  top:12px;
  right:12px;
  z-index:2500;
  border:none;
  border-radius:12px;
  padding:10px 12px;
  font-size:18px;
  background:#fff;
  box-shadow:0 8px 20px rgba(0,0,0,.15);
  cursor: pointer;
}

.panel{
  position:absolute;
  top:0; right:0;
  height:100%;
  width:min(86vw, 480px);
  background:#fff;
  z-index:2600;
  box-shadow:-10px 0 30px rgba(0,0,0,.18);
  transform:translateX(0);
  transition:transform .2s ease;
  display:flex;
  flex-direction:column;
  font-family: sans-serif;
}

.panel.hidden{ transform:translateX(110%); }

.panelHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px;
  border-bottom:1px solid #eee;
}

.panelClose{
  border:none;
  background:transparent;
  font-size:18px;
  padding:6px 8px;
  cursor: pointer;
}

.panelBody{ padding:14px; overflow:auto; }

.subNav {
  display:flex; 
  gap:8px; 
  margin-bottom:12px;
}

.subTab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
}

.changePwForm {
  display:block;
  font-weight:600;
  margin:10px 0 6px;
}

.changePwFill {
  width:90%;
  padding:10px 12px;
  border:1px solid #ddd;
  border-radius:12px;
  font-size:16px;
}

.changePwBtn {
  margin-top:12px;
  width:90%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid #ddd;
  background:#fff;
  cursor:pointer;
  font-weight:600;
}

.subTab.active {
  background: #f2f2f2;
}

.hidden{
  display: none
}

.colorMyRat {
  display:block;
  font-weight:600;
  margin-bottom:6px;
}

.colorPresets { 
  display:flex; 
  gap:10px; 
  margin-top:10px; 
  flex-wrap: wrap;

}
.preset{
  width:26px; height:26px;
  border-radius:50%;
  border:1px solid rgba(0,0,0,.15);
  cursor:pointer;
}

.muted{ margin-top:8px; font-size:12px; color:#666; }

#versionBadge {
  position: fixed;
  bottom: 8px;
  left: 8px;
  z-index: 9999;
  background: #fff;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 10px;
  opacity: 0.85;
}

.sheet {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
  overflow: hidden;

  /* animation */
  transition: transform 180ms ease;
  will-change: transform;

  /* default height behavior */
  max-height: 70%;
  display: flex;
  flex-direction: column;
}

.sheet__handle {
  padding: 10px 12px 8px;
  cursor: pointer;
  user-select: none;
  touch-action: none; /* important for drag */
}

.sheet__grab {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(0,0,0,.18);
  margin: 0 auto 8px auto;
}

.sheet__title {
  font-weight: 700;
  text-align: center;
}

.sheet__content {
  padding: 0 12px 12px;
  overflow: auto;
}

/* Collapsed: only show the handle area (approx) */
.sheet--collapsed {
  transform: translateY(calc(100% - 54px));
}

/* Expanded: show the full sheet */
.sheet--expanded {
  transform: translateY(0);
}

.aliveDeadControl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  /*margin: 8px 0;*/
  /*font-weight: 700;*/
  font-size: 14px;
  font-family: sans-serif;
}

.aliveDeadLabel {
  color: #222;
  user-select: none;
}

/* Container for the toggle */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 58px;
  height: 32px;
  flex: 0 0 auto;
}

/* Hide default checkbox */
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The track */
.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;

  background: #9b1c1c;
  border-radius: 999px;
  transition: 0.2s;
}

/* The circular slider */
.toggle-switch .slider::before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 4px;
  top: 4px;

  background: white;
  border-radius: 50%;
  transition: 0.2s;

  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* Toggled state */
.toggle-switch input:checked + .slider {
  background: #2A9D8F;
}

.toggle-switch input:checked + .slider::before {
  transform: translateX(26px);
}

/* Address the mobile rectangle highlight background of alivedead slider */
.aliveDeadControl,
.toggle-switch,
.toggle-switch input,
.toggle-switch .slider {
  -webkit-tap-highlight-color: transparent;
}

.toggle-switch,
.toggle-switch .slider {
  outline: none;
  box-shadow: none;
}

.toggle-switch input:focus,
.toggle-switch input:active,
.toggle-switch .slider:focus,
.toggle-switch .slider:active {
  outline: none;
  box-shadow: none;
}

/* Override old #controls map-positioning now that controls live inside metaPanel */
#metaPanel #controls,
#metaPanel .metaPanelActions {
  position: static;
  transform: none;

  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;

  width: 100%;
  margin-top: 4px;
}

#metaPanel .metaPanelActions button {
  border: none;
  border-radius: 10px;
  padding: 10px 12px;

  font-weight: 700;
  cursor: pointer;

  /*background: rgba(13, 128, 222, 0.95);*/
  color: rgba(13, 128, 222, 0.95);

  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.50);
}

#metaPanel .metaPanelActions button:hover {
  filter: brightness(0.95);
}

#metaPanel .metaPanelActions button:active {
  transform: translateY(1px);
}