:root {
  color-scheme: light;
  --bg: #f7f2e8;
  --ink: #14201d;
  --muted: #68736f;
  --line: rgba(20, 32, 29, 0.13);
  --card: rgba(255, 255, 255, 0.78);
  --green: #236b5b;
  --green-dark: #174c41;
  --lime: #d9ef73;
  --sun: #f6b756;
  --blue: #72b8d7;
  --shadow: 0 24px 80px rgba(20, 32, 29, 0.16);
}

* { box-sizing: border-box; }

html,
body,
#root {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  position: relative;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

@supports (overflow: clip) {
  html,
  body,
  #root,
  .app {
    overflow-x: clip;
  }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(34rem 34rem at 15% 10%, rgba(217, 239, 115, 0.62), transparent 72%),
    radial-gradient(34rem 34rem at 92% 18%, rgba(114, 184, 215, 0.42), transparent 72%),
    linear-gradient(145deg, #fff8e8 0%, var(--bg) 48%, #e5f0ea 100%);
  background-repeat: no-repeat;
  background-size: cover;
}

button,
input {
  font: inherit;
}

button,
.button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

.topbar {
  width: min(980px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 auto;
  z-index: 5;
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  font-weight: 950;
  letter-spacing: -0.03em;
}

.brand span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--green);
  box-shadow: 0 10px 24px rgba(35, 107, 91, 0.22);
}

.status-pill {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
  font-size: 0.84rem;
  font-weight: 800;
}

.status-pill span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sun);
}

.dot.ready { background: var(--green); }

.screen {
  width: min(980px, 100%);
  max-width: 100%;
  display: none;
  margin: 0 auto;
}

.screen.active { display: grid; }

.setup-screen {
  grid-template-columns: minmax(0, 0.92fr) minmax(320px, 0.72fr);
  gap: 28px;
  align-items: center;
  padding: 34px 0 12px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(3.4rem, 9vw, 7rem);
  line-height: 0.9;
  letter-spacing: -0.065em;
}

.lead {
  max-width: 560px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.55;
}

.panel {
  display: grid;
  gap: 14px;
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.avatar-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.avatar {
  width: 74px;
  height: 74px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: #fff;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.34), transparent 28%),
    linear-gradient(145deg, var(--blue), var(--green));
  font-size: 1.55rem;
  font-weight: 950;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  outline: none;
}

input:focus {
  border-color: rgba(35, 107, 91, 0.72);
  box-shadow: 0 0 0 4px rgba(35, 107, 91, 0.12);
}

.photo-input { display: none; }

.photo-controls {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-button,
.secondary-action {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--green-dark);
  background: rgba(255, 255, 255, 0.66);
  font-weight: 900;
}

.remove-photo {
  min-height: 44px;
}

.primary-action,
.button {
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--green);
  font-weight: 950;
  text-decoration: none;
  display: inline-grid;
  place-items: center;
  text-align: center;
}

.setup-actions {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.search-screen {
  position: relative;
  min-height: calc(100vh - 68px);
  min-height: calc(100dvh - 68px);
  grid-template-rows: auto 1fr auto;
  align-items: stretch;
  padding: 18px 0 8px;
}

.search-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.profile-summary {
  display: flex;
  min-width: 0;
  gap: 11px;
  align-items: center;
}

.profile-summary .avatar {
  width: 52px;
  height: 52px;
  font-size: 1.05rem;
}

.profile-summary b,
.profile-summary span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-summary span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.edit-profile {
  min-height: 40px;
  padding: 0 12px;
}

.activity-strip {
  display: flex;
  gap: 9px;
  width: 100%;
  min-width: 0;
  margin: 20px 0 0;
  padding: 0 0 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.activity-strip::-webkit-scrollbar { display: none; }

.chip {
  min-height: 42px;
  flex: 0 0 auto;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  font-weight: 900;
}

.chip[aria-pressed="true"] {
  border-color: rgba(35, 107, 91, 0.72);
  color: #fff;
  background: var(--green);
}

.custom-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  margin-top: 10px;
}

.custom-row button {
  min-height: 48px;
  padding: 0 14px;
}

.other-activity {
  min-height: 32px;
  margin-top: 8px;
  padding: 0;
  border: 0;
  color: var(--green-dark);
  background: transparent;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.search-core {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 0;
  padding: 26px 0 94px;
  text-align: center;
}

.selected-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.selected-activity {
  max-width: min(88vw, 560px);
  margin: 0;
  font-size: clamp(2rem, 8vw, 4.4rem);
  line-height: 0.94;
  font-weight: 950;
  letter-spacing: -0.055em;
}

.big-button-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: min(76vw, 360px);
  aspect-ratio: 1;
  margin: 28px 0 18px;
}

.pulse-ring {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: rgba(35, 107, 91, 0.18);
  opacity: 0;
  transform: scale(0.82);
}

.searching .pulse-ring {
  animation: pulse 1.55s ease-out infinite;
}

.main-button {
  position: relative;
  width: 82%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.45), transparent 24%),
    linear-gradient(145deg, #2d907b 0%, var(--green) 58%, var(--green-dark) 100%);
  box-shadow:
    0 28px 58px rgba(35, 107, 91, 0.32),
    inset 0 -12px 24px rgba(0, 0, 0, 0.14);
  font-size: clamp(1.55rem, 7vw, 2.55rem);
  font-weight: 950;
  letter-spacing: -0.04em;
  transition: transform 170ms ease, filter 170ms ease;
}

.main-button:active { transform: scale(0.97); }

.main-button:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.searching .main-button {
  animation: breathe 1.55s ease-in-out infinite;
}

.message {
  max-width: 480px;
  min-height: 46px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.stop-search {
  display: none;
  margin-top: 6px;
}

.searching .stop-search,
.has-sheet .stop-search {
  display: inline-flex;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(20, 32, 29, 0.18);
  z-index: 15;
}

.has-sheet .sheet-backdrop { display: block; }

.bottom-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(560px, 100vw);
  max-width: 100vw;
  display: grid;
  gap: 14px;
  padding: 10px 16px max(18px, env(safe-area-inset-bottom));
  border: 1px solid rgba(20, 32, 29, 0.1);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 -24px 70px rgba(20, 32, 29, 0.22);
  backdrop-filter: blur(22px);
  transform: translate(-50%, 110%);
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 20;
}

.has-sheet .bottom-sheet {
  transform: translate(-50%, 0);
}

.grabber {
  width: 48px;
  height: 5px;
  justify-self: center;
  border-radius: 999px;
  background: rgba(20, 32, 29, 0.18);
}

.sheet-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.peer-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  padding: 13px;
  border-radius: 16px;
  background: rgba(246, 183, 86, 0.18);
}

.peer-name {
  margin: 0 0 4px;
  font-size: 1.18rem;
  font-weight: 950;
}

.peer-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.candidate-message {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.candidate-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.connect-action[hidden],
.like-action[hidden],
.next-action[hidden] {
  display: none;
}

@keyframes pulse {
  0% {
    opacity: 0.7;
    transform: scale(0.82);
  }

  100% {
    opacity: 0;
    transform: scale(1.24);
  }
}

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

@media (min-width: 861px) {
  .app { padding: 22px; }
  .search-screen { min-height: calc(100vh - 80px); }

  .activity-strip {
    justify-content: center;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .search-core { padding-bottom: 110px; }
}

@media (max-width: 760px) {
  .app {
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(96px, auto);
    gap: 8px;
  }

  .mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .brand {
    gap: 8px;
    font-size: 0.98rem;
  }

  .setup-screen {
    grid-template-columns: 1fr;
    align-content: start;
    padding-top: 24px;
  }

  h1 { font-size: clamp(3.2rem, 16vw, 5.5rem); }
  .panel { border-radius: 18px; }

  .status-pill {
    justify-self: end;
    max-width: min(142px, 42vw);
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.72rem;
    line-height: 1.1;
  }

  .custom-row,
  .candidate-actions {
    grid-template-columns: 1fr;
  }

  .search-screen {
    min-height: calc(100dvh - 54px);
    padding-top: 10px;
  }

  .search-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .profile-summary {
    gap: 9px;
  }

  .profile-summary .avatar {
    width: 42px;
    height: 42px;
    font-size: 0.92rem;
  }

  .profile-summary b {
    font-size: 0.98rem;
  }

  .profile-summary span {
    font-size: 0.8rem;
  }

  .edit-profile {
    min-height: 38px;
    padding: 0 11px;
    border-radius: 12px;
  }

  .activity-strip {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 8px;
    margin-top: 12px;
    padding-bottom: 2px;
  }

  .chip {
    min-height: 38px;
    flex: 0 1 auto;
    padding: 0 13px;
    font-size: 0.96rem;
  }

  .custom-row {
    margin-top: 8px;
  }

  .custom-row input,
  .custom-row button {
    min-height: 42px;
  }

  .other-activity {
    min-height: 28px;
    margin-top: 6px;
    font-size: 0.88rem;
  }

  .search-core {
    align-content: start;
    padding-top: min(8vh, 54px);
    padding-bottom: 84px;
  }

  .selected-label {
    margin-bottom: 6px;
    font-size: 0.72rem;
  }

  .selected-activity {
    font-size: clamp(2rem, 12vw, 3.7rem);
  }

  .big-button-wrap {
    width: min(78vw, 330px);
    margin: 24px 0 16px;
  }

  .message {
    max-width: 330px;
    min-height: auto;
    font-size: 0.98rem;
  }
}

@media (max-width: 420px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) minmax(82px, auto);
  }

  .status-pill {
    max-width: 34vw;
    gap: 6px;
    padding: 0 8px;
  }

  .status-pill span:last-child {
    font-size: 0.68rem;
  }

  .search-head {
    align-items: center;
  }

  .edit-profile {
    min-width: 0;
    padding: 0 10px;
  }

  .chip {
    min-height: 36px;
    padding: 0 11px;
    font-size: 0.9rem;
  }

  .selected-activity {
    font-size: clamp(1.85rem, 11vw, 3.2rem);
  }
}
