:root {
  --bg: var(--tg-theme-bg-color, #0f1115);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #181b22);
  --text: var(--tg-theme-text-color, #f2f3f5);
  --hint: var(--tg-theme-hint-color, #8b919c);
  --link: var(--tg-theme-link-color, #6ab3f3);
  --button: var(--tg-theme-button-color, #5b8def);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --accent: #ff5d73;
  --green: #36c98d;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body, #app { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

.app { max-width: 520px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.screen { flex: 1; padding: 16px; display: flex; flex-direction: column; }
.center { align-items: center; justify-content: center; text-align: center; gap: 16px; }

h1 { font-size: 24px; margin: 8px 0; }
h2 { font-size: 19px; margin: 4px 0 12px; }
.hint { color: var(--hint); font-size: 14px; }

.card {
  background: var(--secondary-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

button {
  font: inherit; border: none; border-radius: 12px; padding: 14px 18px;
  background: var(--button); color: var(--button-text); cursor: pointer;
  transition: transform .08s ease, opacity .15s ease;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: var(--secondary-bg); color: var(--text); border: 1px solid rgba(255,255,255,.12); }
button.ghost { background: transparent; color: var(--hint); }
button.full { width: 100%; }
.row { display: flex; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }

input, textarea, select {
  font: inherit; width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 12px 14px; outline: none;
}
textarea { min-height: 90px; resize: vertical; }
label { font-size: 14px; color: var(--hint); margin-bottom: 4px; display: block; }
.field { margin-bottom: 14px; }

.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice button { flex: 1; min-width: 90px; }
.choice button.active { outline: 2px solid var(--button); }

.deck { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.gate-q { font-size: 20px; font-weight: 600; text-align: center; margin: 10px 0 6px; }
.photo-wrap { position: relative; width: 100%; aspect-ratio: 3/4; border-radius: var(--radius); overflow: hidden; background: #222; }
.photo-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-hidden { display: flex; align-items: center; justify-content: center; color: var(--hint); font-size: 48px; height: 100%; }
.compat-badge {
  position: absolute; top: 12px; right: 12px; background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px); padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 14px;
}
.cand-meta { display:flex; align-items:baseline; gap:8px; margin-top: 10px; }
.cand-meta .name { font-size: 22px; font-weight: 700; }

.swipe-row { display: flex; gap: 14px; }
.swipe-row button { flex: 1; font-size: 18px; padding: 16px; }
.btn-pass { background: var(--secondary-bg); color: var(--text); }
.btn-like { background: var(--accent); color: #fff; }

.understand { margin: 4px 0 14px; }
.bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--button), var(--green)); }

.tabs { display: flex; border-top: 1px solid rgba(255,255,255,.1); }
.tabs button { flex: 1; background: transparent; color: var(--hint); border-radius: 0; padding: 12px; font-size: 13px; }
.tabs button.active { color: var(--text); }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; }

.match-list .item { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--secondary-bg); border-radius: 12px; margin-bottom: 10px; }
.match-list .item img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; }
.avatar-fallback { width:56px; height:56px; border-radius:12px; background:#333; display:flex; align-items:center; justify-content:center; font-size:24px; }
.spinner { color: var(--hint); }
a { color: var(--link); text-decoration: none; }
