/* Дейтинг-мини-апп — светлый premium editorial: тёплая бумага, чернила, вермильон. */
:root {
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --ink: #1A1614;
  --muted: #8A8178;
  --border: #EBE4DA;
  --accent: #E4573D;
  --accent-rgb: 228, 87, 61;
  --accent-mid: #F2A48E;
  --accent-soft: #FBE9E4;
  --radius: 20px;
  --shadow: 0 10px 30px rgba(26, 22, 20, .08);
}
/* нетворкинг — тот же светлый premium, но спокойный тил вместо вермильона */
body.kind-networking {
  --accent: #17756A;
  --accent-rgb: 23, 117, 106;
  --accent-mid: #7FB8AE;
  --accent-soft: #E2F1ED;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
/* атрибут hidden должен побеждать любые display-правила (иначе скрытый img выталкивает заглушку из круга) */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  padding-top: env(safe-area-inset-top);
}
#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; }

.screen { display: none; min-height: 100dvh; }
.screen.active { display: block; }

.center-col {
  min-height: 80dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  gap: 14px; padding: 32px 28px;
}
.center-col.slim { min-height: 40dvh; }
.wrap { padding: 28px 22px 40px; }
.pad { padding: 0 22px 14px; }

.display {
  font-family: Unbounded, Inter, sans-serif;
  font-weight: 800; font-size: 44px; line-height: 1.04;
  letter-spacing: -.01em;
}
.display.sm { font-size: 32px; margin-bottom: 22px; }
.eyebrow {
  font-family: Unbounded, sans-serif; font-weight: 400;
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent);
}
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.err { color: #C0392B; font-size: 14px; min-height: 20px; margin-top: 10px; }
.big-emoji { font-size: 44px; }

.pulse-heart { font-size: 56px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.18);} }

/* кнопки */
.btn {
  border: 0; cursor: pointer; font: inherit; font-weight: 600;
  border-radius: 999px; padding: 14px 28px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 8px 24px rgba(var(--accent-rgb), .35);
}
.btn-big { width: 100%; padding: 16px; font-size: 17px; margin-top: 10px; }
.chip {
  border: 1.5px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 10px 16px; font: inherit; font-size: 14px;
  font-weight: 500; cursor: pointer; color: var(--ink);
}
.chip:active { background: var(--accent-soft); }

/* код комнаты */
.code-form { display: flex; gap: 10px; margin-top: 8px; }
#code-input {
  width: 150px; text-align: center; font-family: Unbounded, monospace;
  font-size: 24px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  border: 2px solid var(--border); border-radius: var(--radius);
  padding: 12px 10px; background: var(--surface); color: var(--ink); outline: none;
}
#code-input:focus { border-color: var(--accent); }

/* онбординг */
.avatar-block { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; }
.avatar-ring {
  width: 132px; height: 132px; border-radius: 50%; position: relative;
  background: conic-gradient(from 20deg, var(--accent), var(--accent-mid), var(--accent));
  padding: 4px;
}
.avatar-ring img, .avatar-ph {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  font-size: 52px; border: 3px solid var(--bg);
}
.avatar-btns { display: flex; gap: 10px; }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; font: inherit; font-size: 17px;
  border: 2px solid var(--border); border-radius: 16px;
  padding: 13px 16px; background: var(--surface); color: var(--ink); outline: none;
}
.field input:focus { border-color: var(--accent); }
.seg { display: flex; gap: 10px; }
.seg-btn {
  flex: 1; border: 2px solid var(--border); background: var(--surface);
  border-radius: 16px; padding: 13px; font: inherit; font-size: 15px; font-weight: 600;
  color: var(--muted); cursor: pointer; transition: border-color .12s, background .12s, color .12s;
}
.seg-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* поиск по участникам */
.search-wrap { padding: 0 22px 12px; }
#search {
  width: 100%; font: inherit; font-size: 15px;
  border: 2px solid var(--border); border-radius: 999px;
  padding: 11px 18px; background: var(--surface); color: var(--ink); outline: none;
}
#search:focus { border-color: var(--accent); }

/* комната */
.room-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 22px 12px;
}
.room-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.me-avatar {
  width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--accent);
  overflow: hidden; background: var(--surface); cursor: pointer; font-size: 22px;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.me-avatar img { width: 100%; height: 100%; object-fit: cover; }

.tabs { display: flex; gap: 8px; padding: 8px 22px 14px; }
.tab {
  flex: 1; border: 1.5px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 10px; font: inherit; font-weight: 600; font-size: 14px;
  color: var(--muted); cursor: pointer;
}
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.badge {
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 11px; padding: 1px 7px; margin-left: 4px;
}
.tab-pane { display: none; padding-bottom: 40px; }
.tab-pane.active { display: block; }

.grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 0 22px;
}
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; position: relative;
  animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px);} to { opacity: 1; transform: none;} }
.card .ph {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
  background: var(--accent-soft);
}
.card .ph-empty {
  width: 100%; aspect-ratio: 1; display: flex; align-items: center;
  justify-content: center; font-size: 44px; background: var(--accent-soft);
}
.card .num {
  position: absolute; top: 10px; left: 10px;
  font-family: Unbounded, sans-serif; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.92); border-radius: 999px; padding: 4px 10px;
}
.card .meta { padding: 10px 12px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.like-btn {
  border: 2px solid var(--accent); background: var(--surface); color: var(--accent);
  border-radius: 50%; width: 44px; height: 44px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), .20);
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.like-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.like-btn.liked {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 4px 14px rgba(var(--accent-rgb), .45);
  animation: pop .3s ease;
}
.like-btn.liked svg { fill: currentColor; }
@keyframes pop { 50% { transform: scale(1.35);} }
.card.is-me { outline: 2px solid var(--accent); outline-offset: -2px; }
.card .you-tag { font-size: 12px; color: var(--accent); font-weight: 600; }

.match-list { padding: 0 22px; display: flex; flex-direction: column; gap: 12px; }
.match-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px;
}
.match-row img, .match-row .ph-empty {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 26px;
  flex-shrink: 0;
}
.match-row .info { flex: 1; min-width: 0; }
.match-row .name { font-weight: 600; }
.match-row .uname { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.match-row a.btn { padding: 10px 16px; font-size: 14px; text-decoration: none; display: inline-block; }

/* пустая аватарка — классический серый силуэт (тёплый тон под палитру) */
.avatar-ph, .card .ph-empty, .match-row .ph-empty, #me-avatar-ph {
  background-color: #D8D3CB;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='37' r='16' fill='%23FFFFFF'/%3E%3Cpath d='M50 59c-19 0-31 12-33 26l-1 15h68l-1-15C81 71 69 59 50 59z' fill='%23FFFFFF'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
}
#me-avatar-ph { display: block; width: 100%; height: 100%; border-radius: 50%; }

/* кроп фото */
.crop-overlay {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  overflow-y: auto; padding: env(safe-area-inset-top) 0 24px;
}
.crop-overlay[hidden] { display: none; }
.crop-inner { max-width: 520px; margin: 0 auto; padding: 28px 22px; }
.crop-frame {
  width: min(340px, 100%); aspect-ratio: 1; margin: 18px auto 0;
  border-radius: var(--radius); overflow: hidden; position: relative;
  background: #EDE8E0; box-shadow: var(--shadow), 0 0 0 2px var(--accent);
  touch-action: none; cursor: grab;
}
.crop-frame:active { cursor: grabbing; }
.crop-frame img {
  position: absolute; left: 0; top: 0; max-width: none; max-height: none;
  user-select: none; -webkit-user-select: none; pointer-events: none;
}
.crop-hint { text-align: center; margin-top: 12px; }
#crop-zoom {
  display: block; width: min(340px, 100%); margin: 14px auto 0;
  accent-color: var(--accent);
}
.crop-btns {
  display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 18px;
}
.crop-btns .btn { padding: 13px 34px; }
