/* Матильда — mini app. Base colors come from the Telegram theme,
   the warm pink accent comes from the approved mockup. */
:root {
  --bg: var(--tg-theme-bg-color, oklch(0.22 0.02 330));
  --bg-2: var(--tg-theme-secondary-bg-color, oklch(0.27 0.025 330));
  --text: var(--tg-theme-text-color, oklch(0.95 0.01 330));
  --hint: var(--tg-theme-hint-color, oklch(0.7 0.03 330));
  --link: var(--tg-theme-link-color, oklch(0.72 0.17 355));
  --accent: oklch(0.66 0.19 355);
  --accent-text: oklch(0.98 0.01 355);
  --line: color-mix(in oklch, var(--text) 10%, transparent);
  --soft: color-mix(in oklch, var(--accent) 16%, var(--bg-2));
  --radius: 14px;
  --display: "Unbounded", "Manrope", system-ui, sans-serif;
  --body: "Manrope", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--body);
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(22px, 6vw, 28px); line-height: 1.15; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--hint); font-weight: 500; }

.page { padding: 18px 16px 24px; animation: rise 0.35s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page { animation: none; } }

.head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.head small { color: var(--hint); }

/* Search */
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search input {
  flex: 1; min-width: 0; border: 0; border-radius: var(--radius); padding: 12px 14px;
  background: var(--bg-2); color: var(--text); font: inherit;
}
.search input:focus-visible { outline: 2px solid var(--accent); }
.ask {
  border: 0; border-radius: var(--radius); padding: 0 14px; font: 700 14px var(--body);
  background: var(--soft); color: var(--text); white-space: nowrap;
}
.ask:disabled { opacity: 0.6; }

/* Sphere chips */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 0 -16px 10px; padding-inline: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 0; border-radius: 999px; padding: 7px 12px; font: 500 13px var(--body);
  background: var(--bg-2); color: var(--text);
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

.note { color: var(--hint); font-size: 13px; margin: 4px 0 10px; }

/* People list: rows, not cards */
.people { list-style: none; margin: 0; padding: 0; }
.person {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer;
}
.person:first-child { border-top: 0; }
.person:active { opacity: 0.7; }
.who { min-width: 0; }
.name { font-weight: 700; }
.meta { color: var(--hint); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank { font-size: 18px; }

.ava {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font: 700 17px var(--display); color: var(--accent-text); background: var(--accent); overflow: hidden;
}
.ava img { width: 100%; height: 100%; object-fit: cover; }
.ava.big { width: 84px; height: 84px; font-size: 32px; }

.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--soft); }

/* Empty state */
.empty { padding: 28px 4px; }
.empty p { color: var(--hint); margin: 8px 0 16px; }

/* Profile */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin: 6px 0 18px; }
.hero .meta { white-space: normal; }
.badge-rank { display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 999px; background: var(--soft); font-size: 13px; }
.section { padding: 14px 0; border-top: 1px solid var(--line); }
.section h2 { margin-bottom: 6px; }
.section p { margin: 0; white-space: pre-line; }
.back { border: 0; background: none; color: var(--link); font: 500 15px var(--body); padding: 0; margin-bottom: 12px; }

.btn {
  display: block; width: 100%; border: 0; border-radius: var(--radius); padding: 14px;
  background: var(--accent); color: var(--accent-text); font: 700 15px var(--body); margin-top: 18px;
}
.btn.ghost { background: var(--bg-2); color: var(--text); }
.btn:disabled { opacity: 0.6; }

/* Form */
.form label { display: block; margin-top: 14px; font-weight: 500; font-size: 14px; }
.form label span { display: block; color: var(--hint); font-weight: 400; font-size: 12px; margin-top: 2px; }
.form input, .form textarea, .form select {
  width: 100%; margin-top: 6px; border: 0; border-radius: 12px; padding: 11px 12px;
  background: var(--bg-2); color: var(--text); font: inherit;
}
.form textarea { min-height: 84px; resize: vertical; }
.form input:focus-visible, .form textarea:focus-visible, .form select:focus-visible { outline: 2px solid var(--accent); }
.switch { display: flex !important; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--soft); }
.switch input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex: none; }
.error { color: oklch(0.7 0.18 25); font-size: 13px; margin-top: 6px; }
.saved { color: oklch(0.75 0.14 150); font-size: 13px; margin-top: 8px; text-align: center; }

/* Soon */
.soon { padding: 48px 16px; }
.soon .big { font-size: 44px; }
.soon p { color: var(--hint); }

/* Bottom tabs */
#tabs {
  position: fixed; inset: auto 0 0 0; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg-2); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
#tabs button {
  border: 0; background: none; color: var(--hint); font: 500 11px var(--body);
  padding: 8px 0 10px; display: grid; gap: 2px; justify-items: center;
}
#tabs button .i { font-size: 20px; line-height: 1; }
#tabs button[aria-current="page"] { color: var(--accent); }

.blocked { padding: 64px 24px; }
.blocked p { color: var(--hint); }
