/* Инкогнито — мини-приложение. Цвета берутся из темы Telegram, акценты — фирменные. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --card: var(--tg-theme-section-bg-color, var(--bg));
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --link: var(--tg-theme-link-color, #6246ea);
  --sep: rgba(127, 127, 127, .18);
  --brand1: #6246EA;
  --brand2: #EC4899;
  --brand: linear-gradient(135deg, var(--brand1), var(--brand2));
  --danger: #E5484D;
  --ok: #2EAE6B;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(40, 20, 90, .08);
}
:root[data-scheme="dark"] { --sep: rgba(255,255,255,.08); --shadow: 0 6px 24px rgba(0,0,0,.35); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg2); color: var(--text); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  padding: 12px 16px calc(84px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
body.no-tabs { padding-bottom: 24px; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.spacer { height: 8px; }

/* ---------- cards */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.hero {
  background: var(--brand); color: #fff; border-radius: 24px; padding: 20px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%;
  right: -70px; top: -90px; background: rgba(255,255,255,.14);
}
.hero .who { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.hero .logo { width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 22px; overflow: hidden; }
.hero .logo img { width: 100%; height: 100%; display: block; }
.hero h1 { font-size: 26px; font-weight: 800; line-height: 1.1; position: relative; z-index: 1; margin-top: 14px; }
.hero .sub { opacity: .9; margin-top: 6px; position: relative; z-index: 1; }

.linkbox {
  display: flex; align-items: center; gap: 8px; background: var(--bg2); border-radius: 14px; padding: 10px 10px 10px 14px;
}
.linkbox code { flex: 1; font: 600 14px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

/* ---------- buttons */
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 14px 16px; border-radius: 14px; font-weight: 700; font-size: 16px;
  background: var(--bg2); color: var(--text); transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 8px 22px rgba(98,70,234,.28); }
.btn.white { background: #fff; color: #2a1b5c; }
.btn.ghost { background: transparent; color: var(--link); }
.btn.danger { background: rgba(229,72,77,.12); color: var(--danger); }
.btn.sm { padding: 9px 12px; font-size: 14px; border-radius: 12px; width: auto; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.iconbtn { padding: 8px 12px; border-radius: 10px; background: var(--card); font-weight: 700; color: var(--link); font-size: 14px; }

/* ---------- segmented / tabs */
.seg { display: flex; background: var(--bg2); border-radius: 12px; padding: 3px; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1; padding: 9px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--hint); white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--bg);
  border-top: 1px solid var(--sep); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10;
}
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--hint); position: relative; padding: 4px 0; }
.tabs button .ti { font-size: 20px; line-height: 1.1; filter: grayscale(1); opacity: .7; }
.tabs button.on { color: var(--brand1); font-weight: 600; }
.tabs button.on .ti { filter: none; opacity: 1; }
.dot { position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand2); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* ---------- lists */
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list .item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; width: 100%; text-align: left; }
.list .item + .item { border-top: 1px solid var(--sep); }
.list .item .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: var(--bg2); flex: none; }
.list .item .t { flex: 1; min-width: 0; }
.list .item .chev { color: var(--hint); }

/* ---------- questions */
.q { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); text-align: left; width: 100%; display: block; }
.q .lbl { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--brand1); display: flex; justify-content: space-between; }
.q .lbl .time { color: var(--hint); font-weight: 600; letter-spacing: 0; text-transform: none; }
.q .txt { margin-top: 6px; font-weight: 600; font-size: 17px; line-height: 1.3; white-space: pre-wrap; word-break: break-word; }
.q .ans { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg2); font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.q .ans b { display: block; font-size: 11px; color: var(--hint); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.q.new { border-left: 4px solid var(--brand2); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(98,70,234,.12); color: var(--brand1); }
.pill.ok { background: rgba(46,174,107,.14); color: var(--ok); }

textarea, input, select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg2); border: 1.5px solid transparent;
  border-radius: 14px; padding: 12px 14px; outline: none; resize: none;
}
textarea:focus, input:focus, select:focus { border-color: var(--brand1); }
textarea { min-height: 110px; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--hint); font-weight: 600; }
.counter { text-align: right; font-size: 12px; color: var(--hint); }

/* ---------- progress */
.bar { height: 12px; border-radius: 6px; background: var(--bg2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--brand); transition: width .4s ease; }
.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 10px; border-radius: 5px; background: var(--bg2); }
.steps i.on { background: var(--brand); }

/* ---------- tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--card); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.tile .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.tile .k { font-size: 12px; color: var(--hint); margin-top: 2px; }

/* ---------- plans */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan { background: var(--card); border-radius: 18px; padding: 16px 12px; text-align: center; box-shadow: var(--shadow); border: 2px solid transparent; position: relative; }
.plan.best { border-color: var(--brand2); }
.plan .days { font-size: 30px; font-weight: 800; }
.plan .price { font-weight: 700; margin: 2px 0 10px; }
.plan .tag { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 11px; font-weight: 800; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }

/* ---------- captcha */
.cap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cap button { font-size: 36px; padding: 14px 0; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.cap button:active { transform: scale(.95); }

/* ---------- ad */
.ad { border: 1.5px dashed var(--sep); border-radius: var(--radius); padding: 14px 16px; background: var(--card); }
.ad .lbl { font-size: 11px; color: var(--hint); margin-top: 8px; }

/* ---------- chart */
.chart { width: 100%; height: 150px; display: block; }
.chart .b { fill: var(--brand1); }
.chart .b:hover, .chart .b.hl { fill: var(--brand2); }
.chart text { fill: var(--hint); font-size: 10px; }
.chart .grid { stroke: var(--sep); stroke-width: 1; }
.tip { font-size: 13px; min-height: 18px; color: var(--text); font-weight: 600; }

/* ---------- empty / misc */
.empty { text-align: center; padding: 36px 16px; color: var(--hint); }
.empty .e { font-size: 48px; }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 20;
  background: rgba(20, 18, 32, .92); color: #fff; padding: 12px 16px; border-radius: 14px; font-weight: 600; text-align: center;
}
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--sep); border-top-color: var(--brand1); animation: sp 0.8s linear infinite; margin: 40px auto; }
@keyframes sp { to { transform: rotate(360deg); } }
.fade { animation: fd .18s ease; }
@keyframes fd { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.switch { width: 50px; height: 30px; border-radius: 15px; background: var(--sep); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch.on { background: var(--brand1); }
.switch.on::after { transform: translateX(20px); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--hint); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
