:root, [data-theme="dark"] {
  --bg: #0B0B0B; --surface: #171717; --surface2: #222222; --line: #2C2C2C; --line2: #3A3A3A;
  --text: #F2F2F2; --text2: #D0D0D0; --muted: #A3A3A3; --nav: #111111;
  --accent: #FFD400; --on-accent: #0B0B0B; --accent-text: #FFD400; --danger: #FF8A7A;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F5F5F3; --surface: #FFFFFF; --surface2: #EFEFEC; --line: #E2E2DE; --line2: #D2D2CC;
  --text: #141414; --text2: #3D3D3D; --muted: #6B6B6B; --nav: #FFFFFF;
  --accent-text: #8A6500; --danger: #B3261E;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent-text); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.splash { min-height: 100vh; display: grid; place-items: center; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 20px Unbounded, sans-serif;
}
.logo-mark.big { width: 84px; height: 84px; border-radius: 24px; font-size: 46px; }
.display { font-family: Unbounded, sans-serif; font-weight: 700; }

/* каркас */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line);
}
.top-in { max-width: 1100px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.top-title { font: 700 19px Unbounded, sans-serif; }
.layout { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; display: flex; gap: 20px; padding: 12px 12px 96px; align-items: flex-start; }
.side { display: none; }
.main { flex: 1; min-width: 0; max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--nav); border-top: 1px solid var(--line);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a, .side a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 62px; color: var(--muted); font-size: 11px; font-weight: 700;
}
.tabbar a[aria-current="page"], .side a[aria-current="page"] { color: var(--accent-text); }
@media (min-width: 900px) {
  .tabbar { display: none; }
  .layout { padding-bottom: 40px; }
  .side { display: flex; flex-direction: column; gap: 2px; width: 210px; flex: none; position: sticky; top: 76px; }
  .side a { flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 42px; padding: 0 12px; border-radius: 10px; font-size: 14px; color: var(--text2); }
  .side a[aria-current="page"] { background: var(--surface); }
  .main { margin: 0; }
}

/* картки й елементи */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.label { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
.h2 { margin: 6px 4px 0; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface2);
  padding: 10px 12px; font-size: 15px; color: var(--text);
}
.textarea { resize: vertical; min-height: 72px; }
.row { display: flex; gap: 8px; align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.spacer { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--danger); font-size: 14px; font-weight: 600; }

.btn {
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--accent); color: var(--on-accent);
  font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn[disabled] { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.wide { width: 100%; min-height: 52px; font-size: 16px; }
.iconbtn {
  min-width: 40px; height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: var(--surface2);
  color: var(--muted); display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px;
}
.iconbtn.on { color: var(--accent-text); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--surface2); border-radius: 12px; padding: 4px; }
.seg button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--text2); font-weight: 700; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.avatar {
  width: 42px; height: 42px; flex: none; border-radius: 50%; background: var(--line); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
}
.avatar.xl { width: 88px; height: 88px; font: 700 28px Unbounded, sans-serif; color: var(--accent-text); }
.badge {
  width: 16px; height: 16px; flex: none; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: inline-flex; align-items: center; justify-content: center;
}
.name { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text); }

.post-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.comments { display: flex; flex-direction: column; gap: 8px; }
.comment { background: var(--surface2); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.comment p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.cover { height: 110px; background: var(--accent); border-radius: 16px 16px 0 0; margin: -14px -14px 0; }
.profile-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; margin-top: -48px; }
.profile-head > div { padding-top: 54px; }
.profile-head .avatar.xl { border: 4px solid var(--surface); }
.id-chip { font: 700 14px Unbounded, sans-serif; color: var(--accent-text); }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px 0 5px; border-radius: 13px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 800; }
.stat { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat div { background: var(--surface2); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.stat strong { font-size: 22px; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.tg-slot { min-height: 48px; display: flex; justify-content: center; }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 20; max-width: 90vw;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px;
}
