/* ===========================================================================
   SengaMos — Telegram Mini App. Warm, premium matchmaking aesthetic.
   Garnet + gold on warm ivory, adapts to Telegram light/dark.
   =========================================================================== */

:root {
  --primary: #B11D3E;
  --primary-soft: #f6e2e7;
  --gold: #C8A046;
  --bg: #FBF7F2;
  --bg-elev: #F3ECE3;
  --card: #FFFFFF;
  --ink: #2A1E22;
  --muted: #7A6A6E;
  --line: #ECE3DC;
  --success: #1E8E5A;
  --danger: #C0392B;
  --shadow: 0 6px 24px rgba(58, 22, 30, 0.10);
  --shadow-sm: 0 2px 8px rgba(58, 22, 30, 0.07);
  --radius: 18px;
  --radius-sm: 12px;
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Manrope", system-ui, -apple-system, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme="dark"] {
  --primary: #E76A86;
  --primary-soft: #3a232b;
  --gold: #D8B25A;
  --bg: #16111A;
  --bg-elev: #1F1824;
  --card: #221A28;
  --ink: #F3E9EC;
  --muted: #A6929A;
  --line: #322637;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; letter-spacing: -0.01em; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }

/* ---------- App shell ---------- */
#app { min-height: 100vh; padding-bottom: calc(86px + var(--safe-bottom)); }
.screen { display: none; padding: 8px 16px 16px; max-width: 560px; margin: 0 auto; animation: fade .25s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Splash ---------- */
#splash {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(120% 80% at 50% 0%, var(--bg-elev), var(--bg));
}
.splash-logo { font-family: var(--font-display); font-size: 40px; color: var(--primary); }
.splash-logo span { color: var(--gold); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Top brand bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--font-display); font-size: 22px; color: var(--ink); }
.brand b { color: var(--primary); font-weight: 700; }
.lang-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 700; color: var(--ink);
  cursor: pointer; min-height: 38px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 24px; padding: 26px 22px;
  background: linear-gradient(135deg, var(--primary), #7d1330 70%);
  color: #fff; box-shadow: var(--shadow); margin-bottom: 18px;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(200,160,70,.45), transparent 70%);
}
.hero h1 { font-size: 27px; line-height: 1.15; margin-bottom: 8px; color: #fff; }
.hero p { margin: 0; opacity: .92; font-size: 15px; }
.hero .ornament { position: absolute; left: 14px; bottom: 8px; font-size: 40px; opacity: .25; }

/* ---------- Cards / sections ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); margin-bottom: 14px; }
.section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 6px 2px 10px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 0 18px;
  border: none; border-radius: 14px; font-size: 16px; font-weight: 700; cursor: pointer;
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-gold { background: var(--gold); color: #2A1E22; }
.btn-ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-soft { background: var(--bg-elev); color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: grid; gap: 10px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 2px 6px; }
.input, .textarea, select.input {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink);
  font-family: inherit; font-size: 16px; transition: border-color .15s ease;
}
.input:focus, .textarea:focus, select.input:focus { outline: none; border-color: var(--primary); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 2px 0; }

/* Segmented control (gender / language) */
.segmented { display: flex; background: var(--bg-elev); border-radius: 14px; padding: 4px; gap: 4px; }
.segmented button {
  flex: 1; min-height: 46px; border: none; background: transparent; border-radius: 11px;
  font-weight: 700; font-size: 15px; color: var(--muted); cursor: pointer;
}
.segmented button.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow-sm); }

/* collapsible */
.collapse-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding: 6px 0; font-weight: 700; }
.collapse-body { display: none; padding-top: 8px; }
.collapse.open .collapse-body { display: block; }
.collapse.open .chev { transform: rotate(180deg); }
.chev { transition: transform .2s ease; color: var(--muted); }

/* ---------- Photo uploader ---------- */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photo-thumb { position: relative; aspect-ratio: 3/4; border-radius: 12px; overflow: hidden; background: var(--bg-elev); border: 1px solid var(--line); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .rm { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 14px; }
.photo-add { display: flex; align-items: center; justify-content: center; aspect-ratio: 3/4; border: 1.5px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 28px; cursor: pointer; background: var(--bg-elev); }

/* ---------- Discovery grid ---------- */
.filters { margin-bottom: 12px; }
.profiles-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .1s ease; }
.pcard:active { transform: scale(.98); }
.pcard-photo { position: relative; aspect-ratio: 3/4; background: var(--bg-elev); }
.pcard-photo img { width: 100%; height: 100%; object-fit: cover; }
.pcard-photo.locked img { filter: blur(14px) brightness(.85); transform: scale(1.05); }
.pcard-noimg { display: flex; align-items: center; justify-content: center; height: 100%; font-family: var(--font-display); font-size: 46px; color: var(--primary); background: var(--primary-soft); }
.pcard-badge { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 999px; }
.pcard-lock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 30px; }
.pcard-body { padding: 10px 12px 12px; }
.pcard-name { font-weight: 800; font-size: 15px; display: flex; gap: 6px; align-items: baseline; }
.pcard-name .age { color: var(--muted); font-weight: 600; }
.pcard-region { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.badge.pending { background: #fdf1dc; color: #9a6a08; }
.badge.active { background: #e2f3ea; color: var(--success); }
.badge.blocked { background: #fae3e1; color: var(--danger); }
.badge.draft { background: var(--bg-elev); color: var(--muted); }
html[data-theme="dark"] .badge.pending { background:#3a2f15; } html[data-theme="dark"] .badge.active{background:#163a2a;} html[data-theme="dark"] .badge.blocked{background:#3a201d;}

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 48px 20px; }
.empty .ico { font-size: 48px; }
.empty h3 { font-size: 19px; margin: 12px 0 6px; }
.empty p { color: var(--muted); margin: 0 0 18px; }

/* ---------- Channel gate banner ---------- */
.gate { display: flex; gap: 12px; align-items: center; background: linear-gradient(135deg, var(--gold), #a9821f); color: #2A1E22; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.gate .g-ico { font-size: 26px; }
.gate .g-txt { flex: 1; font-size: 13.5px; font-weight: 600; }
.gate a { background: #2A1E22; color: #fff; padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: 13px; white-space: nowrap; }

/* ---------- Bottom nav ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + var(--safe-bottom));
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.nav button { flex: 1; background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; color: var(--muted); cursor: pointer; min-height: 52px; border-radius: 12px; }
.nav button .ni { font-size: 21px; }
.nav button .nl { font-size: 11px; font-weight: 700; }
.nav button.active { color: var(--primary); }

/* ---------- Modal / sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(20,10,14,.5); display: none; align-items: flex-end; justify-content: center; }
.sheet-backdrop.open { display: flex; animation: fade .2s ease; }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--card); border-radius: 22px 22px 0 0; padding: 18px 18px calc(20px + var(--safe-bottom));
  box-shadow: 0 -10px 40px rgba(0,0,0,.25); animation: slideup .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.sheet-grip { width: 40px; height: 4px; background: var(--line); border-radius: 999px; margin: 0 auto 14px; }
.sheet h2 { font-size: 22px; margin-bottom: 4px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--bg-elev); color: var(--ink); font-size: 16px; cursor: pointer; }

/* profile detail */
.pd-photo { width: 100%; aspect-ratio: 3/4; max-height: 360px; object-fit: cover; border-radius: 16px; background: var(--bg-elev); }
.pd-photo.locked { filter: blur(16px) brightness(.85); }
.pd-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.pd-row .l { color: var(--muted); }
.pd-row .v { font-weight: 600; text-align: right; }
.pd-row .v.locked { color: var(--gold); }

/* payment */
.pay-card { background: var(--bg-elev); border: 1px dashed var(--line); border-radius: 14px; padding: 14px; margin: 12px 0; }
.pay-num { font-size: 20px; font-weight: 800; letter-spacing: 1px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.copy-btn { border: none; background: var(--primary); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 700; cursor: pointer; }
.amount-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin: 10px 0; }
.amount-btn { border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px; cursor: pointer; text-align: center; }
.amount-btn.sel { border-color: var(--primary); background: var(--primary-soft); }
.amount-btn .a { font-weight: 800; font-size: 16px; }
.amount-btn .l2 { font-size: 12px; color: var(--muted); }
.receipt-prev { width: 100%; border-radius: 12px; margin-top: 10px; }

/* ---------- Toast ---------- */
#toasts { position: fixed; top: calc(14px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; width: 90%; max-width: 380px; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: 14px; text-align: center; box-shadow: var(--shadow); opacity: 0; transform: translateY(-8px); transition: all .25s ease; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--success); color: #fff; }

/* ---------- Skeleton ---------- */
.skeleton { background: linear-gradient(90deg, var(--bg-elev) 25%, var(--line) 37%, var(--bg-elev) 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 12px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- misc ---------- */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.faq-q { font-weight: 700; margin-top: 12px; }
.faq-a { color: var(--muted); font-size: 14px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.hidden { display: none !important; }
