/* Тиммейт — мини-приложение.
   Дизайн-система презентации: неогротеск-брутализм. Белый фон, чёрная сетка в обводках 3px,
   сверхжирный узкий заголовок капсом с точкой, акцентные заливки синим и жёлтым,
   никаких скруглений и теней. Тёмная тема — инверсия: бумага ↔ чернила, акценты те же. */

:root {
  --ink: #111111;
  --paper: #FFFFFF;
  --blue: #0A84FF;
  --yellow: #FFE000;
  --grey: #5E5E5E;
  --soft: #F2F2F2;
  --red: #E5281E;
  --on-accent: #111111;   /* текст на синем и жёлтом — всегда тёмный, как в презентации */
  --stroke: 3px;
  --pad: 14px;
  --tabbar-h: 60px;
  --actions-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --display: "Roboto Condensed", "Arial Narrow", Arial, sans-serif;
  --text: "Inter Tight", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F2F2F2; --paper: #111111; --grey: #A8A8A8; --soft: #1E1E1E;
  }
}
:root[data-theme="dark"] { --ink: #F2F2F2; --paper: #111111; --grey: #A8A8A8; --soft: #1E1E1E; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
  background: var(--paper); color: var(--ink);
  font: 16px/1.35 var(--text);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }

#app { min-height: 100vh; min-height: var(--tg-viewport-stable-height, 100vh); overflow-x: clip; }
.splash { min-height: 100vh; display: grid; place-items: center; }
.splash img { width: 72px; height: 72px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* ---------- типографика (как в deck.css) ---------- */

.display {
  font-family: var(--display); font-weight: 900; text-transform: uppercase;
  font-size: 54px; line-height: .86; letter-spacing: -2px;
}
.display.xl { font-size: 76px; letter-spacing: -3px; }
.display.md { font-size: 40px; letter-spacing: -1.2px; }
.display.sm { font-size: 30px; letter-spacing: -.8px; line-height: .9; }
.brand { font-family: var(--display); font-weight: 900; font-size: 22px; letter-spacing: -.5px; text-transform: uppercase; line-height: 1; }
.kick, .k {
  font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; line-height: 1.2;
}
.k { color: var(--grey); }
.lead { font-size: 17px; font-weight: 700; text-transform: uppercase; line-height: 1.22; letter-spacing: .2px; }
.sub { color: var(--grey); font-size: 15px; }
.n { font-family: var(--display); font-weight: 900; font-size: 38px; line-height: .88; letter-spacing: -1px; }
.v { font-size: 17px; font-weight: 600; word-break: break-word; }
.about { white-space: pre-wrap; word-break: break-word; }

/* ---------- сетка в обводках: соседние ячейки делят один штрих ---------- */

.grid { display: grid; border-left: var(--stroke) solid var(--ink); }
.grid.gt { border-top: var(--stroke) solid var(--ink); }
.cell {
  border-right: var(--stroke) solid var(--ink);
  border-bottom: var(--stroke) solid var(--ink);
  padding: var(--pad);
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: 1fr 1fr 1fr; }
.g-bar { grid-template-columns: auto 1fr auto; }
.mid { justify-content: center; }
.btm { justify-content: flex-end; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.blue { background: var(--blue); color: var(--on-accent); }
.yellow { background: var(--yellow); color: var(--on-accent); }
.black { background: var(--ink); color: var(--paper); }
.soft { background: var(--soft); }
.blue .k, .yellow .k { color: var(--on-accent); opacity: .75; }
.black .k { color: var(--paper); opacity: .6; }

/* ---------- страница ---------- */

.screen { max-width: 560px; margin: 0 auto; padding: 12px 12px calc(24px + var(--safe-b)); }
.screen.with-tabs { padding-bottom: calc(var(--tabbar-h) + 24px + var(--safe-b)); }
.screen.with-actions { padding-bottom: calc(var(--tabbar-h) + var(--actions-h) + 20px + var(--safe-b)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.gap-lg { gap: 18px; }

/* верхняя панель, как на каждом слайде: ТИММЕЙТ. | раздел | жёлтая ячейка */
.bar .cell { padding: 10px 12px; justify-content: center; }
.bar .pg { background: var(--yellow); color: var(--on-accent); min-width: 56px; align-items: center; }
.bar .pg .n { font-size: 22px; }

/* ---------- кнопки ---------- */

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 54px; padding: 0 16px;
  border: var(--stroke) solid var(--ink); border-radius: 0;
  background: var(--blue); color: var(--on-accent);
  font-size: 15px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  transition: transform .06s ease;
}
.btn:active { transform: translate(2px, 2px); }
.btn:disabled { background: var(--soft); color: var(--grey); }
.btn.yellow { background: var(--yellow); }
.btn.white { background: var(--paper); color: var(--ink); }
.btn.black { background: var(--ink); color: var(--paper); }
.btn.danger { background: var(--paper); color: var(--red); }
.btn.text { border-color: transparent; background: none; color: var(--ink); min-height: 44px; text-decoration: underline; text-underline-offset: 4px; }
.btn.sm { min-height: 40px; font-size: 13px; width: auto; padding: 0 12px; }

.icon-btn {
  width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center;
  border: var(--stroke) solid var(--ink); background: var(--paper); color: var(--ink);
}
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- формы ---------- */

.progress { height: 10px; border: var(--stroke) solid var(--ink); background: var(--paper); }
.progress > i { display: block; height: 100%; background: var(--blue); transition: width .25s ease; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field .hint { font-size: 13px; color: var(--grey); }
.field .error { font-size: 13px; font-weight: 700; color: var(--red); text-transform: uppercase; letter-spacing: .4px; }
.input, textarea.input {
  width: 100%; min-height: 52px; padding: 12px; border-radius: 0;
  border: var(--stroke) solid var(--ink); background: var(--paper); outline: none;
  font-size: 16px; /* меньше 16px — iOS зумит поле */
}
textarea.input { min-height: 120px; resize: vertical; line-height: 1.35; }
.input:focus { background: var(--soft); border-color: var(--blue); }
.field.invalid .input { border-color: var(--red); }
.counter { font-size: 12px; color: var(--grey); text-align: right; font-weight: 600; }
.code-input { font-family: var(--display); font-weight: 900; font-size: 30px; letter-spacing: 6px; text-transform: uppercase; text-align: center; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 2px solid var(--ink); background: var(--paper); border-radius: 0;
  padding: 8px 12px; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.chip.add { border-style: dashed; font-weight: 600; text-transform: none; letter-spacing: 0; }
.chip:disabled { opacity: .4; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  border: 2px solid currentColor; padding: 4px 8px; font-size: 14px; font-weight: 600;
}
.tag.shared { background: var(--yellow); color: var(--on-accent); border-color: var(--on-accent); }
.tag button { border: 0; background: none; padding: 0; font-size: 18px; line-height: 1; color: inherit; }

.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.check input {
  appearance: none; -webkit-appearance: none; margin: 0; flex: 0 0 26px; width: 26px; height: 26px;
  border: var(--stroke) solid var(--ink); background: var(--paper); display: grid; place-items: center;
}
.check input:checked { background: var(--blue); }
.check input:checked::after { content: "✓"; font-weight: 900; color: var(--on-accent); font-size: 16px; }
.check a { font-weight: 700; }

.form-footer {
  position: sticky; bottom: 0; z-index: 5;
  padding: 12px 0 calc(12px + var(--safe-b)); background: var(--paper);
}

/* ---------- карточка анкеты ---------- */

.pcard { position: relative; background: var(--paper); user-select: none; -webkit-user-select: none; }
.pcard.swipe { will-change: transform; transition: transform .22s ease, opacity .22s ease; touch-action: pan-y; }
.pcard.dragging { transition: none; }
.cover { position: relative; aspect-ratio: 16 / 9; max-height: 220px; padding: 0; overflow: hidden; display: grid; place-items: center; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover .initials { font-family: var(--display); font-weight: 900; font-size: 112px; letter-spacing: -4px; line-height: 1; color: var(--on-accent); }
.stamp {
  position: absolute; top: 16px; z-index: 2; padding: 6px 10px; opacity: 0;
  font-family: var(--display); font-weight: 900; font-size: 26px; text-transform: uppercase; letter-spacing: -.5px;
  border: var(--stroke) solid #111; color: #111;
}
.stamp.like { left: 14px; background: var(--yellow); transform: rotate(-8deg); }
.stamp.nope { right: 14px; background: #fff; transform: rotate(8deg); }
.reasons { display: flex; flex-direction: column; gap: 4px; }
.reasons div::before { content: "+ "; font-weight: 900; }

/* ---------- лента ---------- */

.filters .cell { padding: 0; }
.filters button {
  border: 0; background: none; min-height: 42px; width: 100%;
  font-size: 13px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--ink);
}
.filters .on { background: var(--ink); }
.filters .on button { color: var(--paper); }

.actions {
  position: fixed; left: 0; right: 0; z-index: 9;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  display: flex; justify-content: center; background: var(--paper);
}
.actions .grid { width: 100%; max-width: 560px; border-top: var(--stroke) solid var(--ink); }
.actions .cell { padding: 0; }
.actions button {
  border: 0; height: var(--actions-h); width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; background: none; color: inherit;
}
.actions button svg { width: 22px; height: 22px; }
.actions button:active { transform: translate(1px, 1px); }

/* ---------- таббар ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; background: var(--paper); padding-bottom: var(--safe-b);
}
.tabbar .grid { width: 100%; max-width: 560px; border-top: var(--stroke) solid var(--ink); }
.tabbar .cell { padding: 0; position: relative; }
.tabbar .cell:last-child { border-right: var(--stroke) solid var(--ink); }
.tab {
  border: 0; background: none; height: var(--tabbar-h); width: 100%;
  font-size: 13px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--ink);
}
.tabbar .on { background: var(--ink); }
.tabbar .on .tab { color: var(--paper); }
.badge {
  position: absolute; top: 6px; right: 6px; min-width: 22px; height: 22px; padding: 0 4px;
  background: var(--yellow); color: var(--on-accent); border: 2px solid #111;
  font-size: 12px; font-weight: 900; display: grid; place-items: center; pointer-events: none;
}

/* ---------- списки и мэтчи ---------- */

.avatar {
  flex: 0 0 56px; width: 56px; height: 56px; overflow: hidden;
  background: var(--blue); color: var(--on-accent); border: var(--stroke) solid var(--ink);
  display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 26px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xl { flex-basis: 110px; width: 110px; height: 110px; font-size: 54px; }
.item { cursor: pointer; flex-direction: row; align-items: center; gap: 12px; text-align: left; background: var(--paper); }
.item:active { background: var(--soft); }
.item .title { font-family: var(--display); font-weight: 900; font-size: 22px; text-transform: uppercase; line-height: 1; }
.item .meta { font-size: 14px; color: var(--grey); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .n { font-size: 26px; flex: 0 0 auto; }

.contact .value { font-size: 20px; font-weight: 800; word-break: break-all; }

/* ---------- шторка, тост ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 30; background: rgba(17,17,17,.55);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .12s ease;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--paper); border-top: var(--stroke) solid var(--ink);
  padding: 14px 12px calc(16px + var(--safe-b)); animation: up .18s ease-out;
}
.overlay.center { align-items: center; padding: 12px; }
.overlay.center .sheet { border: var(--stroke) solid var(--ink); box-shadow: 8px 8px 0 var(--ink); }

#toast {
  position: fixed; left: 12px; right: 12px; z-index: 40; max-width: 536px; margin: 0 auto;
  bottom: calc(var(--tabbar-h) + var(--actions-h) + 16px + var(--safe-b));
  background: var(--ink); color: var(--paper); border: var(--stroke) solid var(--ink);
  padding: 12px 14px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .15s ease, transform .15s ease;
}
#toast.show { opacity: 1; transform: none; }

@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); } }

@media (max-width: 360px) {
  .display { font-size: 46px; }
  .display.xl { font-size: 62px; }
  .cover .initials { font-size: 100px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- документы (согласие, политика) ---------- */

.doc { max-width: 760px; margin: 0 auto; padding: 12px 12px 40px; }
.doc h2 { font-family: var(--display); font-weight: 900; text-transform: uppercase; font-size: 22px; line-height: 1; letter-spacing: -.3px; }
/* Только абзацы без класса: иначе правило перебьёт .n, .brand, .lead (та же ловушка, что в deck.css). */
.doc p:not([class]), .doc li { font-size: 15px; line-height: 1.5; }
.doc ul, .doc ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.doc .todo { background: var(--yellow); color: var(--on-accent); padding: 0 3px; font-weight: 700; }
