:root {
  --ink: #17140f;
  --paper: #f6ecd8;
  --muted: #cbbba0;
  --amber: #e2a23a;
  --true: #f3d56a;
  --other: #8a6b58;
  --glass: rgba(23, 20, 15, 0.82);
  --font-ui: "Atkinson Hyperlegible", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

#map {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--paper);
  background: var(--ink);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.leaflet-container {
  background: #1b2a24;
  font-family: var(--font-ui);
  width: 100%;
  height: 100%;
}

.overlay {
  position: fixed;
  z-index: 500;
  pointer-events: none;
}

.overlay > * {
  pointer-events: auto;
}

.bottom-bar {
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
}

.rank,
.queue {
  list-style: none;
  margin: 0;
  padding: 10px 14px;
  max-height: 28vh;
  overflow: auto;
  border-radius: 16px;
  background: rgba(15, 12, 10, 0.92);
  border: 1px solid rgba(246, 236, 216, 0.16);
}

.rank:empty,
.queue:empty {
  display: none;
}

.rank li,
.queue li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 15px;
}

.rank .miss {
  color: var(--muted);
}

.queue li.current span {
  color: var(--amber);
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  min-height: 48px;
  padding: 0 18px;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  background: var(--amber);
  color: var(--ink);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.ghost {
  background: transparent;
  color: var(--paper);
  border: 1px solid rgba(246, 236, 216, 0.28);
}

button.icon {
  min-height: 36px;
  min-width: 36px;
  padding: 0;
  background: transparent;
  color: var(--paper);
  font-size: 22px;
  line-height: 1;
}

.row {
  display: flex;
  gap: 8px;
}

.row button {
  flex: 1;
  padding: 0 10px;
}

.gate {
  position: fixed;
  z-index: 800;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
}

.gate input,
#address {
  flex: 1;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(246, 236, 216, 0.2);
  border-radius: 999px;
  background: var(--glass);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 16px;
}

.gate input:focus,
#address:focus {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}

#address-form {
  margin: 0;
  display: flex;
  gap: 8px;
}

#address-form button {
  min-width: 48px;
  padding: 0;
}

#address.miss {
  border-color: #c45c4a;
}

.current {
  margin: 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--glass);
  font-size: 14px;
  word-break: break-word;
}

.host-dock {
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: min(320px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pin {
  background: none !important;
  border: 0 !important;
  position: relative;
}

.pin-mark {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.pin-player .pin-mark {
  background: var(--amber);
  border: 2px solid #fff6e4;
}

.pin-true .pin-mark {
  background: var(--true);
  border: 3px solid #17140f;
  border-radius: 50%;
  transform: none;
}

.pin-other .pin-mark {
  background: var(--other);
  border: 2px solid #f6ecd8;
}

.pin-name {
  position: absolute;
  left: 50%;
  top: -22px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  padding: 2px 6px;
  border-radius: 999px;
}

body.present .rank {
  font-size: 22px;
  max-height: 36vh;
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .host-dock {
    top: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    width: auto;
    max-height: 46vh;
  }
}
