* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}
#map { position: absolute; inset: 0; }

.ver { font-weight: 400; font-size: 11px; opacity: .8; }

/* HUD сверху */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 8px) 14px 8px;
  background: linear-gradient(180deg, rgba(15,81,50,.92), rgba(15,81,50,0));
  color: #fff; font-size: 14px; font-weight: 600;
  pointer-events: none; z-index: 10;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

/* Кнопки */
#controls {
  position: absolute; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 18px);
  display: flex; flex-direction: column; gap: 10px; z-index: 10;
}
#controls button {
  width: 52px; height: 52px; border: none; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.3);
  font-size: 22px; cursor: pointer;
}
#controls button:active { transform: scale(.94); }
#btn-test.active { background: #ffe08a; }

/* Маркеры */
.pin {
  width: 30px; height: 30px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4);
  cursor: pointer;
  background: #b0b0b0;            /* locked = серый */
}
.pin.unlocked { background: #2e9e4f; }   /* unlocked = зелёный */
.pin.unlocked::after {
  content: ""; position: absolute; inset: 6px;
  background: #fff; border-radius: 50%;
  transform: rotate(45deg);
}

/* Объект (музей и т.п.) — синий круглый пин с иконкой */
.opin {
  width: 30px; height: 30px; border-radius: 50%;
  background: #2b6cb0; border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; cursor: pointer; line-height: 1;
}

/* Описание в карточке */
#modal-desc { margin: 12px 0 0; font-size: 15px; line-height: 1.45; color: #2a3a30; white-space: pre-wrap; }
#modal-desc:empty { display: none; }

/* Метка пользователя */
.me {
  width: 18px; height: 18px; border-radius: 50%;
  background: #1a73e8; border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(26,115,232,.25);
}

/* Модалка */
#modal {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6); padding: 16px;
}
#modal.hidden, #toast.hidden { display: none; }
.modal-card {
  position: relative; background: #fff; border-radius: 16px;
  width: 100%; max-width: 420px; max-height: 86vh; overflow: auto;
  padding: 18px;
}
.modal-card h2 { margin: 0 36px 12px 0; font-size: 19px; }
.modal-card img {
  width: 100%; border-radius: 10px; display: block; background: #eee;
}
#modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px; border: none; border-radius: 50%;
  background: #eee; font-size: 16px; cursor: pointer;
}
.modal-audio { margin-top: 14px; }
#modal-replay {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: #0f5132; color: #fff; font-size: 16px; cursor: pointer;
}

/* Индикатор офлайна */
#offline-status {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top) + 42px); z-index: 11;
  background: #fff; border-radius: 20px; padding: 6px 14px;
  font-size: 13px; font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.25);
  cursor: pointer; max-width: 90%; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
#offline-status.ok { background: #cdeccd; color: #0f5132; }
#offline-status.warn { background: #fff4d6; color: #7a5b00; }
#offline-status.err { background: #f3d6d4; color: #8a1a14; }

/* Оверлей входа */
#login-overlay {
  position: absolute; inset: 0; z-index: 25;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6); padding: 16px;
}
#login-overlay.hidden { display: none; }
#login-overlay .modal-card { max-width: 360px; }
#login-overlay .muted { color: #6a7a70; font-size: 14px; margin: 4px 0 12px; }
#login-code {
  width: 100%; padding: 12px; font-size: 20px; text-align: center;
  letter-spacing: 2px; text-transform: uppercase; font-family: ui-monospace, monospace;
  border: 1px solid #cbd5d0; border-radius: 10px;
}
#login-submit {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: #0f5132; color: #fff; font-size: 16px; cursor: pointer;
}
#login-error { color: #b3261e; font-size: 14px; min-height: 18px; margin-top: 8px; text-align: center; }
.linklike { display: block; margin: 12px auto 0; background: none; border: none;
  color: #6a7a70; text-decoration: underline; cursor: pointer; font-size: 14px; }

/* Тост */
#toast {
  position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: rgba(0,0,0,.85); color: #fff; padding: 10px 16px;
  border-radius: 20px; font-size: 14px; z-index: 30; max-width: 80%;
  text-align: center;
}
