* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: pan-x pan-y;
}

body {
  background: #e9edf3;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.site {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background: #fff;
  position: relative;
  display: flex;
  flex-direction: column;
}

#app-view {
  height: 100%;
  display: flex;
  flex-direction: column;
}
#app-view[hidden] { display: none; }

header.app {
  padding: 6px 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid #f0f0f0;
}
header.app .brand { display: flex; flex-direction: column; gap: 1px; }
header.app .logo {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(90deg,#ff6a88,#ff9a5a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
header.app .subtitle { font-size: 10.5px; color: #999; font-weight: 600; letter-spacing: 0.2px; }
header.app .icons { display: flex; gap: 14px; font-size: 18px; }

.screens {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.screen {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding-bottom: 80px;
}
.screen.active { display: block; }

/* ---- Auth ---- */
#auth-view {
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 30px 24px;
}
#auth-view[hidden] { display: none; }

.auth-card { display: flex; flex-direction: column; gap: 16px; }
.auth-card .logo {
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  background: linear-gradient(90deg,#ff6a88,#ff9a5a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-card .subtitle {
  text-align: center;
  font-size: 12px;
  color: #999;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.auth-tabs { display: flex; gap: 8px; background: #f2f2f6; border-radius: 14px; padding: 4px; }
.auth-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 0;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13.5px;
  color: #888;
  cursor: pointer;
  font-family: inherit;
}
.auth-tab.active { background: #fff; color: #ff6a88; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form[hidden] { display: none; }
.auth-form input {
  width: 100%;
  border: 1px solid #e4e4ea;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.auth-error {
  color: #ff5a5f;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
}
.auth-error[hidden] { display: none; }

.photo-upload { display: block; cursor: pointer; }
.photo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 110px;
  border-radius: 14px;
  border: 2px dashed #e4e4ea;
  color: #999;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.photo-preview.has-image { color: transparent; border-style: solid; }

/* ---- Discover / Card stack ---- */
#screen-discover.active { display: flex; flex-direction: column; }

.stack {
  flex: 1;
  position: relative;
  margin: 16px;
}

.empty-state[hidden] { display: none; }
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #888;
}
.empty-state p { font-size: 18px; font-weight: 700; color: #444; }

.card {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  background: #fff;
  transition: transform 0.35s ease, opacity 0.35s ease;
  touch-action: none;
  user-select: none;
}

.card .img-block {
  flex: 1;
  position: relative;
  background: #eee;
  overflow: hidden;
}
.card .img-block img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.card .img-block img.active { display: block; }
.card .img-tap-zone {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  z-index: 5;
}
.card .img-tap-zone.left { left: 0; }
.card .img-tap-zone.right { right: 0; }
.card .img-dots {
  position: absolute;
  top: 10px; left: 10px; right: 10px;
  display: flex;
  gap: 5px;
  z-index: 6;
}
.card .img-dots span {
  flex: 1;
  height: 3px;
  border-radius: 3px;
  background: rgba(255,255,255,0.45);
}
.card .img-dots span.active { background: #fff; }
.card .stamp {
  position: absolute;
  top: 24px;
  font-size: 26px;
  font-weight: 900;
  padding: 6px 14px;
  border-radius: 8px;
  border: 4px solid;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.stamp.like { left: 20px; color: #4cd964; border-color: #4cd964; transform: rotate(-18deg); }
.stamp.nope { right: 20px; color: #ff5a5f; border-color: #ff5a5f; transform: rotate(18deg); }

.card .text-block {
  padding: 14px 18px 18px;
  flex-shrink: 0;
}
.card .name-age { font-size: 19px; font-weight: 800; margin-bottom: 6px; }
.card .bio { font-size: 13.5px; color: #444; line-height: 1.5; margin-bottom: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: #f4f0ff;
  color: #6a4cff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 20px;
}

.actions {
  display: flex;
  justify-content: center;
  gap: 22px;
  padding: 14px 0 20px;
  flex-shrink: 0;
}
.actions button {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: none;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.btn-nope { background: #fff; color: #ff5a5f; border: 2px solid #ffe1e2; }
.btn-like { background: linear-gradient(135deg,#ff6a88,#ff9a5a); color: #fff; }

/* ---- Matches ---- */
.screen-title { padding: 18px 18px 6px; font-size: 20px; font-weight: 800; }
.match-list { list-style: none; padding: 6px 10px; }
.match-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 14px;
  cursor: pointer;
}
.match-list li:hover { background: #f6f6f9; }
.match-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.match-info b { font-size: 14.5px; display: block; }
.match-info span { font-size: 12.5px; color: #888; }
.hint { text-align: center; color: #999; font-size: 13px; padding: 30px 30px; }

/* ---- Chat ---- */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #f0f0f0;
  font-weight: 700;
  font-size: 15px;
}
.chat-back { background: none; border: none; font-size: 20px; cursor: pointer; }
.chat-view-profile { margin-left: auto; background: none; border: none; font-size: 18px; cursor: pointer; }
.chat-messages {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: calc(100% - 130px);
  overflow-y: auto;
}
.bubble {
  max-width: 70%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.4;
}
.bubble.them { background: #f0f0f4; align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.me { background: linear-gradient(135deg,#ff6a88,#ff9a5a); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

.chat-input {
  position: absolute;
  bottom: 66px;
  left: 0; right: 0;
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: #fff;
  border-top: 1px solid #f0f0f0;
}
.chat-input input {
  flex: 1;
  border: 1px solid #e4e4ea;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13.5px;
  outline: none;
}
.chat-input button {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg,#ff6a88,#ff9a5a);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

/* ---- Profile ---- */
.my-profile { padding: 10px 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.my-photos { display: flex; gap: 8px; }
.my-photo {
  width: 80px; height: 100px;
  border-radius: 12px;
  object-fit: cover;
  background: #eee;
}
.my-info { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.my-info b { font-size: 18px; }
.my-info span { font-size: 13px; color: #888; }
.save-btn {
  background: linear-gradient(135deg,#ff6a88,#ff9a5a);
  color: #fff;
  border: none;
  padding: 11px 0;
  width: 100%;
  border-radius: 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.logout-btn { background: #fff; color: #ff5a5f; border: 2px solid #ffe1e2; }

/* ---- Bottom nav ---- */
nav.bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 66px;
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: 6px;
  z-index: 15;
}
nav.bottom .item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 10px;
  color: #999;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
nav.bottom .item.active { color: #ff6a88; font-weight: 700; }
nav.bottom .item span.ic { font-size: 20px; }
