:root {
  color-scheme: dark;
  --wa-green: #25d366;
  --wa-dark: #075e54;
  --bg-dark: #0b141a;
  --surface: #111b21;
  --surface-raised: #1c272e;
  --muted: #8696a0;
  --line: #26343c;
  --white: #e9edef;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg-dark);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: 0 0 248px;
  overflow-x: hidden;
  background: var(--bg-dark);
  color: var(--white);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.header {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  align-items: center;
  min-height: 49px;
  padding: 12px 15px;
  background: var(--wa-dark);
}

.header img {
  width: 25px;
  height: 25px;
  margin-right: 10px;
}

.header span {
  font-size: 1rem;
  font-weight: 700;
}

.radar-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 15px;
  border-bottom: 1px solid #222;
  background: var(--surface);
  font-size: 0.8125rem;
  line-height: 1.25rem;
}

#location-label {
  font-style: italic;
}

#city-label,
.online {
  color: var(--wa-green);
  font-weight: 700;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 15px 15px 20px;
}

.profile-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 0 0 8px;
  border: 1px solid #222;
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  text-align: center;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}

.profile-card:hover,
.profile-card:focus-visible {
  border-color: rgba(37, 211, 102, 0.65);
  outline: none;
  transform: translateY(-1px);
}

.profile-card:active {
  transform: scale(0.985);
}

.profile-card img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: cover;
}

.status-dot {
  position: absolute;
  z-index: 1;
  top: 5px;
  right: 5px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--wa-green);
}

.profile-name {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-distance {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1rem;
}

.login-drawer {
  position: fixed;
  z-index: 1000;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 18px 0 18px;
  border-top: 1px solid rgba(37, 211, 102, 0.3);
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, var(--surface-raised) 0%, var(--bg-dark) 100%);
  box-shadow: 0 -15px 35px rgba(0, 0, 0, 0.9);
  transition: border-color 300ms ease, box-shadow 300ms ease;
}

.login-drawer.highlight {
  border-top: 2px solid var(--wa-green);
  box-shadow: 0 -15px 40px rgba(37, 211, 102, 0.6);
}

.login-drawer.shake {
  animation: shake 500ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.login-inner {
  width: 88%;
  max-width: 420px;
  margin: 0 auto;
}

.login-copy {
  margin-bottom: 13px;
  text-align: center;
}

.login-copy h1 {
  margin: 0 0 5px;
  color: #fff;
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1.35;
}

.login-copy p {
  margin: 0;
  color: var(--wa-green);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.35;
}

.phone-field {
  display: flex;
  min-height: 50px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1.5px solid #3d4a52;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.phone-field:focus-within {
  border-color: var(--wa-green);
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.12);
}

.country-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 103px;
  padding: 0 11px;
  border: 0;
  border-right: 1px solid #3d4a52;
  background: rgba(255, 255, 255, 0.035);
  color: var(--wa-green);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.country-trigger:focus-visible {
  outline: 2px solid var(--wa-green);
  outline-offset: -3px;
}

.chevron {
  width: 0;
  height: 0;
  margin-left: auto;
  border-top: 5px solid #aebac1;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
}

#phone {
  min-width: 0;
  flex: 1;
  padding: 13px 14px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 1rem;
}

#phone::placeholder {
  color: #88979f;
}

.continue-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-height: 52px;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: var(--wa-green);
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
  color: #000;
  font-size: 1.0625rem;
  font-weight: 800;
  cursor: pointer;
  transition: filter 120ms ease, transform 120ms ease;
}

.continue-button:hover {
  filter: brightness(1.04);
}

.continue-button:active {
  transform: translateY(1px) scale(0.995);
}

.continue-button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.wa-mini {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 0.75rem;
}

.secure-note,
.matching-note {
  margin: 7px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.25rem;
}

.matching-note {
  margin-top: 1px;
}

.toast {
  position: fixed;
  z-index: 12000;
  top: 20px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 12px 22px;
  border-radius: 50px;
  background: rgba(250, 246, 27, 0.97);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  color: #000;
  font-size: 0.875rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -100px);
  transition: opacity 220ms ease, transform 400ms cubic-bezier(0.18, 0.89, 0.32, 1.28);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-icon {
  display: inline-grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 900;
}

.call-overlay,
.country-dialog {
  position: fixed;
  z-index: 10000;
  inset: 0;
}

.call-overlay[hidden],
.country-dialog[hidden] {
  display: none;
}

.call-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding: 7vh 20px 9vh;
  background: rgba(0, 0, 0, 0.95);
}

.caller-block {
  text-align: center;
}

.caller-avatar {
  display: block;
  width: 140px;
  height: 140px;
  margin: 0 auto;
  border: 4px solid var(--wa-green);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 8px rgba(37, 211, 102, 0.08);
}

.caller-block h2 {
  margin: 11px 0 0;
  color: #fff;
  font-size: 1.5rem;
}

.caller-block p {
  margin: 22px 0 0;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
}

.call-actions {
  display: flex;
  gap: 50px;
}

.call-button {
  display: grid;
  width: 60px;
  height: 60px;
  padding: 15px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.call-button svg {
  width: 30px;
  height: 30px;
  fill: white;
}

.call-button.decline {
  background: #ff4757;
}

.call-button.answer {
  background: var(--wa-green);
  animation: ring 500ms infinite;
}

.call-button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

.country-dialog {
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.86);
}

.country-panel {
  display: flex;
  width: min(500px, 92vw);
  max-height: min(700px, calc(100vh - 64px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--wa-green);
  border-radius: 12px;
  background: #1a1a1a;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.65);
}

.country-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px 8px;
}

.country-header h2 {
  margin: 0;
  font-size: 1rem;
}

.country-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

.country-search-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 6px 12px 10px;
  padding: 0 12px;
  border: 1px solid rgba(37, 211, 102, 0.45);
  border-radius: 7px;
  background: #252525;
  color: var(--muted);
}

.country-search-wrap:focus-within {
  border-color: var(--wa-green);
}

#country-search {
  width: 100%;
  height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 0.875rem;
}

.country-list {
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}

.country-option {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 45px;
  padding: 8px 14px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.country-option:hover,
.country-option:focus-visible,
.country-option.selected {
  outline: 0;
  background: rgba(37, 211, 102, 0.14);
}

.country-code {
  color: var(--wa-green);
  font-size: 0.8125rem;
  font-weight: 700;
}

.country-empty {
  margin: 0;
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

@keyframes ring {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@media (max-width: 420px) {
  body {
    padding-bottom: 260px;
  }

  .radar-bar {
    font-size: 0.75rem;
  }

  .profile-grid {
    gap: 8px;
    padding: 12px;
  }

  .profile-card img {
    height: clamp(108px, 33vw, 130px);
  }

  .login-drawer {
    padding-top: 16px;
  }

  .login-inner {
    width: calc(100% - 32px);
  }

  .country-dialog {
    padding: 18px 10px;
  }

  .country-panel {
    width: 94vw;
    max-height: calc(100vh - 36px);
  }
}

@media (min-width: 900px) {
  .profile-card img {
    height: 130px;
  }
}

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