/* VNB Mini App — палитра и раскладка перенесены из макета «VNB Final».
   Тёмная тема — основная, светлая повторяет экран «Профиль · светлая тема». */

:root {
  --font-heading: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;

  --bg: #140f11;
  --bg-inner: #181113;
  --text: #f5e9ec;
  --text-60: rgba(245, 233, 236, .6);
  --text-45: rgba(245, 233, 236, .45);
  --accent: #f0bccd;
  --accent-strong: #e8a0b8;

  --surface: rgba(245, 233, 236, .05);
  --surface-2: rgba(245, 233, 236, .08);
  --border: rgba(245, 233, 236, .1);
  --hover: rgba(232, 160, 184, .16);
  --hover-border: rgba(232, 160, 184, .4);
  --active: rgba(232, 160, 184, .28);
  --tab-bg: rgba(17, 12, 14, .92);
  --tab-border: rgba(245, 233, 236, .08);
  --chip-bg: rgba(20, 15, 17, .55);
  --card-shadow: none;
  --veil-top: rgba(20, 15, 17, .55);
  --veil-mid: rgba(20, 15, 17, .05);
  --veil-bottom: #140f11;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-height: 62px;
}

body.theme-light {
  --bg: #f7eff2;
  --bg-inner: #f7eff2;
  --text: #2c2126;
  --text-60: rgba(44, 33, 38, .6);
  --text-45: rgba(44, 33, 38, .45);
  --accent: #b8617f;
  --accent-strong: #8f4460;

  --surface: #ffffff;
  --surface-2: #ffffff;
  --border: rgba(44, 33, 38, .07);
  --hover: #fbeef3;
  --hover-border: rgba(184, 97, 127, .35);
  --active: #f6e0e9;
  --tab-bg: rgba(255, 255, 255, .94);
  --tab-border: rgba(44, 33, 38, .07);
  --chip-bg: rgba(184, 97, 127, .14);
  --card-shadow: 0 3px 12px rgba(120, 70, 90, .07);
  --veil-top: rgba(247, 239, 242, .45);
  --veil-mid: rgba(247, 239, 242, .88);
  --veil-bottom: #f7eff2;
}

*, *::before, *::after { box-sizing: border-box; }

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

button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 600; margin: 0; line-height: 1.15; }
p { margin: 0; }
img { display: block; max-width: 100%; }

/* ── Загрузка и ошибка ─────────────────────────────────────────────────── */

.boot, .fatal {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 32px; text-align: center; background: var(--bg); z-index: 40;
}
.boot-mark {
  font-family: var(--font-heading); font-size: 40px; font-weight: 600;
  letter-spacing: .18em; color: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .45 } 50% { opacity: 1 } }
.boot-text, .fatal p { color: var(--text-60); font-size: 15px; }
.fatal-icon { font-size: 34px; }
.fatal h2 { font-size: 22px; }
.btn-primary {
  margin-top: 8px; padding: 13px 26px; border: 0; border-radius: 16px;
  background: var(--accent-strong); color: #201216; font-family: var(--font-heading); font-weight: 600;
}
body.theme-light .btn-primary { color: #fff; }

/* ── Каркас ────────────────────────────────────────────────────────────── */

.app { display: block; min-height: 100vh; }
.screen { position: relative; min-height: 100vh; }
.screen[hidden] { display: none; }

.cover { position: absolute; top: 0; left: 0; right: 0; height: 340px; overflow: hidden; }
.cover-short { height: 250px; }
.cover-image {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 78% 18%, rgba(240, 188, 205, .48), transparent 29%),
    radial-gradient(circle at 18% 42%, rgba(120, 57, 80, .72), transparent 34%),
    linear-gradient(150deg, #28151c 0%, #673347 40%, #a85d78 70%, #e8a0b8 100%);
  background-size: cover; background-position: center;
  filter: saturate(.8);
}
body.theme-light .cover-image { filter: saturate(.6) brightness(1.06); }
.cover-veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--veil-top) 0%, var(--veil-mid) 45%, var(--veil-bottom) 100%);
}
.cover-short + .cover-body .section-head { padding-top: 0; }

.screen-body {
  position: relative; z-index: 1;
  padding: 0 18px calc(var(--tabbar-height) + var(--safe-bottom) + 26px);
  display: flex; flex-direction: column; gap: 18px;
}
.cover-body { padding-top: 168px; }
.cover-body-short { padding-top: 96px; }
.detail-body { padding-top: 22px; }

/* ── Профиль ───────────────────────────────────────────────────────────── */

.hero { display: flex; flex-direction: column; gap: 10px; }
.hero-row { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 62px; height: 62px; flex: none; border-radius: 16px; overflow: hidden;
  background: var(--chip-bg); background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-size: 26px; font-weight: 600; color: var(--accent);
  box-shadow: 0 6px 18px rgba(120, 70, 90, .2);
}
.hero-name-block { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.hero-name {
  font-size: 30px; text-shadow: 0 2px 14px rgba(20, 15, 17, .6);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
body.theme-light .hero-name { text-shadow: none; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  font-size: 12px; padding: 4px 10px; border-radius: 99px;
  background: var(--chip-bg); color: var(--text-60);
}
.chip-accent { color: var(--accent); }
body.theme-light .chip-accent { color: var(--accent-strong); }

.menu { display: flex; flex-direction: column; gap: 9px; }
.menu-item {
  display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: 18px;
  background: var(--surface); color: var(--text); font-size: 16px; text-align: left;
  box-shadow: var(--card-shadow);
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.menu-item:hover { background: var(--hover); border-color: var(--hover-border); }
.menu-item:active { background: var(--active); transform: scale(.99); }
.menu-item .emoji { font-size: 17px; flex: none; }
.menu-item .label { flex: 1; min-width: 0; }
.menu-item .chevron { color: var(--accent); opacity: .78; }

.info-card {
  padding: 6px 0; border-radius: 20px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--card-shadow);
  display: flex; flex-direction: column;
}
.info-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; font-size: 14px;
}
.info-row .emoji { width: 20px; text-align: center; flex: none; }
.info-row .label { flex: 1; color: var(--text-60); }
.info-row .value { font-variant-numeric: tabular-nums; text-align: right; }

.footnote { font-size: 13px; color: var(--text-45); }

/* ── Заголовки разделов ────────────────────────────────────────────────── */

.section-head { display: flex; align-items: center; gap: 12px; }
.detail-head { margin-bottom: 4px; }
.section-title { font-size: 22px; }
.section-sub { font-size: 13px; color: var(--text-60); margin-top: 2px; }
.icon-btn {
  width: 36px; height: 36px; flex: none; border: 0; border-radius: 12px;
  background: var(--chip-bg); color: var(--text); font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { background: var(--active); }

/* ── Карточки, плитки, строки ──────────────────────────────────────────── */

.metric-card {
  padding: 18px; border-radius: 22px;
  background: linear-gradient(160deg, rgba(232, 160, 184, .2), rgba(232, 160, 184, .06));
  display: flex; gap: 22px;
}
body.theme-light .metric-card { background: #fff; box-shadow: var(--card-shadow); }
.metric { min-width: 0; }
.metric-label { font-size: 12px; color: var(--text-60); }
.metric-value { font-family: var(--font-heading); font-size: 28px; font-weight: 600; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  display: flex; align-items: center; gap: 10px; padding: 16px; min-height: 56px;
  border: 1px solid var(--border); border-radius: 18px; background: var(--surface-2);
  color: var(--text); font-size: 15px; text-align: left; box-shadow: var(--card-shadow);
  transition: background .15s ease, transform .1s ease;
}
.tile:hover { background: var(--hover); }
.tile:active { background: var(--active); transform: scale(.98); }
.tile .emoji { font-size: 18px; flex: none; }

.block { display: flex; flex-direction: column; gap: 12px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.block-title {
  font-family: var(--font-body); font-weight: 400;
  font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-45);
}

.rows { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 12px; font-size: 15px;
  padding: 12px 14px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--card-shadow);
}
.row-plain { background: transparent; border: 0; box-shadow: none; padding: 2px 0; }
.row .rank { width: 26px; color: var(--accent); flex: none; font-variant-numeric: tabular-nums; }
.row .grow { flex: 1; min-width: 0; }
.row .muted { color: var(--text-60); font-size: 13px; }
.row .trail { color: var(--text-60); font-variant-numeric: tabular-nums; white-space: nowrap; }

.event-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; }
.event-date { display: flex; flex-direction: column; align-items: center; min-width: 40px; flex: none; }
.event-day { font-family: var(--font-heading); font-size: 20px; font-weight: 600; }
.event-month { font-size: 11px; color: var(--text-45); }
.event-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.event-title { font-size: 15px; }
.event-meta { font-size: 12.5px; color: var(--text-60); }

.pill-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.pill-row::-webkit-scrollbar { display: none; }
.pill {
  flex: none; padding: 7px 14px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-60); font-size: 13px; white-space: nowrap;
}
.pill[aria-pressed="true"] { background: var(--active); color: var(--text); border-color: var(--hover-border); }

.empty { padding: 18px; text-align: center; color: var(--text-45); font-size: 14px; }

.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent-strong); border-radius: 99px; }

.badge { font-size: 11px; padding: 3px 9px; border-radius: 99px; background: var(--chip-bg); color: var(--text-60); flex: none; }
.badge-ok { color: #8fd6a8; }
.badge-warn { color: var(--accent); }

/* ── Формы ─────────────────────────────────────────────────────────────── */

.form { display: flex; flex-direction: column; gap: 10px; }
.input, .textarea {
  width: 100%; padding: 13px 15px; border-radius: 16px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-family: var(--font-body); font-size: 15px;
}
.textarea { min-height: 110px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-45); }
.input:focus, .textarea:focus { outline: none; border-color: var(--hover-border); }
.btn {
  padding: 14px 18px; border: 0; border-radius: 16px; background: var(--active);
  color: var(--text); font-family: var(--font-heading); font-weight: 600; font-size: 15px;
}
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .5; }
.btn-wide { width: 100%; }
.btn-soft { background: var(--surface-2); border: 1px solid var(--border); font-weight: 400; font-family: var(--font-body); }
.btn-mini { padding: 8px 14px; border-radius: 12px; font-size: 13px; flex: none; }

.switch { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--card-shadow); }
.switch .grow { flex: 1; min-width: 0; }
.switch-track {
  width: 48px; height: 28px; border-radius: 99px; background: var(--surface-2);
  border: 1px solid var(--border); position: relative; flex: none; transition: background .18s ease;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--text-45); transition: transform .18s ease, background .18s ease;
}
.switch[aria-checked="true"] .switch-track { background: var(--active); border-color: var(--hover-border); }
.switch[aria-checked="true"] .switch-track::after { transform: translateX(20px); background: var(--accent); }

.option {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 15px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 15px; text-align: left;
}
.option[aria-pressed="true"] { background: var(--active); border-color: var(--hover-border); }
.option .grow { flex: 1; min-width: 0; }
.option-bar { height: 6px; border-radius: 99px; background: var(--surface-2); margin-top: 7px; overflow: hidden; }
.option-bar span { display: block; height: 100%; background: var(--accent-strong); }

.msg { padding: 12px 14px; border-radius: 14px; font-size: 14px; background: var(--surface); border: 1px solid var(--border); }
.msg-admin { background: var(--hover); border-color: var(--hover-border); }
.msg-time { font-size: 11px; color: var(--text-45); margin-bottom: 4px; }

/* ── Нижняя навигация ──────────────────────────────────────────────────── */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  padding: 8px 6px calc(10px + var(--safe-bottom));
  background: var(--tab-bg); border-top: 1px solid var(--tab-border);
  backdrop-filter: blur(14px);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 10px; min-width: 56px; min-height: 46px; border: 0; background: none;
  font-size: 11px; color: var(--text-45); transition: color .15s ease;
}
.tab .emoji { font-size: 19px; }
.tab[aria-selected="true"] { color: var(--accent); }

/* ── Тост ──────────────────────────────────────────────────────────────── */

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 16px);
  z-index: 50; padding: 14px 16px; border-radius: 16px; font-size: 14px;
  background: rgba(30, 20, 24, .96); color: #f5e9ec; box-shadow: 0 12px 30px rgba(20, 12, 16, .4);
  animation: toast-in .2s ease;
}
body.theme-light .toast { background: #2c2126; }
.toast-error { background: #7c2740; color: #ffe8ef; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (min-width: 520px) {
  .screen-body { max-width: 480px; margin: 0 auto; }
  .cover-image, .cover-veil { max-width: 100%; }
}
