:root {
  --primary: #ff2d78;
  --secondary: #7c3aed;
  --accent: #f472b6;
  --bg: #0b0b10;
  --bg-2: #12121a;
  --surface: #181824;
  --surface-2: #222233;
  --text: #f5f5f7;
  --muted: #9aa0b4;
  --line: rgba(255,255,255,.08);
  --danger: #fb7185;
  --ok: #34d399;
  --radius: 18px;
  --nav-h: 64px;
  --top-h: 58px;
  --shadow: 0 18px 50px rgba(0,0,0,.35);
  --grad: linear-gradient(135deg, var(--primary), var(--secondary));
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { min-height: 100dvh; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.app-shell { padding-bottom: calc(var(--nav-h) + 18px); }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  min-height: var(--top-h); padding: 8px 16px;
  background: rgba(11,11,16,.86); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; letter-spacing: .3px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.search-wrap { flex: 1; position: relative; }
.search-wrap input {
  width: 100%; border: 0; border-radius: 999px; background: var(--surface);
  padding: 12px 44px 12px 16px; min-height: 44px; outline: none;
}
.search-wrap .voice-btn, .icon-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn { position: relative; right: auto; transform: none; }
.coin-chip, .avatar-mini {
  min-height: 44px; min-width: 44px; border-radius: 999px;
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  padding: 0 12px; font-weight: 700; font-size: 13px;
}
.avatar-mini { overflow: hidden; padding: 0; }
.avatar-mini img { width: 44px; height: 44px; object-fit: cover; }
.hero {
  margin: 14px 16px 8px; border-radius: 24px; overflow: hidden;
  min-height: 210px; position: relative; background: var(--surface);
}
.hero img { width: 100%; height: 240px; object-fit: cover; }
.hero .overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 20px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.78));
}
.hero h2 { margin: 0 0 6px; font-size: 1.45rem; }
.section { margin: 18px 0 8px; }
.section-head { display: flex; justify-content: space-between; align-items: center; padding: 0 16px 10px; }
.section-head h3 { margin: 0; font-size: 1.05rem; }
.carousel { display: flex; gap: 12px; overflow-x: auto; padding: 0 16px 8px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.carousel::-webkit-scrollbar { display: none; }
.card {
  min-width: 132px; scroll-snap-align: start; background: var(--surface);
  border-radius: var(--radius); overflow: hidden;
}
.card.lg { min-width: 168px; }
.cover { width: 100%; aspect-ratio: 3/4; object-fit: cover; background: var(--surface-2); }
.card .meta { padding: 10px; }
.card .meta p { margin: 0; font-size: 13px; font-weight: 650; }
.card .meta span { color: var(--muted); font-size: 12px; }
.chip-row { display: flex; gap: 10px; overflow-x: auto; padding: 0 16px; }
.chip, .round-chip {
  min-width: 72px; min-height: 44px; border-radius: 999px; background: var(--surface);
  display: flex; align-items: center; justify-content: center; padding: 0 14px; white-space: nowrap;
}
.round-chip { flex-direction: column; min-width: 86px; height: 86px; border-radius: 50%; gap: 4px; font-size: 12px; }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: var(--nav-h); display: flex; background: rgba(18,18,26,.94);
  border-top: 1px solid var(--line); backdrop-filter: blur(18px);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; color: var(--muted); gap: 3px; min-height: 44px;
}
.bottom-nav a.active { color: var(--primary); }
.desktop-nav { display: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border: 0; border-radius: 14px; cursor: pointer; font-weight: 700;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; }
.btn-ghost { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.auth-wrap, .page, .panel {
  width: min(1120px, 100%); margin: 0 auto; padding: 18px 16px 32px;
}
.auth-card, .surface-card {
  background: var(--surface); border-radius: 24px; padding: 22px; box-shadow: var(--shadow);
}
label { display: block; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  width: 100%; margin-top: 6px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; min-height: 44px; outline: none;
}
textarea { min-height: 120px; resize: vertical; }
.alert { padding: 12px 14px; border-radius: 14px; margin-bottom: 12px; }
.alert-error { background: rgba(251,113,133,.15); color: #fecdd3; }
.alert-ok { background: rgba(52,211,153,.12); color: #bbf7d0; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.feed-card { background: var(--surface); border-radius: 20px; padding: 14px; margin-bottom: 12px; }
.feed-card .head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.actions { display: flex; gap: 8px; margin-top: 10px; }
.empty { text-align: center; padding: 42px 16px; color: var(--muted); }
.skeleton { background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface)); background-size: 200% 100%; animation: shine 1.2s infinite; border-radius: 16px; }
@keyframes shine { to { background-position: -200% 0; } }
.reader {
  max-width: 720px; margin: 0 auto; padding: 16px 18px 90px;
  line-height: 1.7; font-size: 18px;
}
.reader.theme-sepia { background: #f4ecd8; color: #3b2f1c; }
.reader.theme-light { background: #fafafa; color: #111; }
.player-bar {
  position: sticky; bottom: var(--nav-h); background: var(--surface); border-top: 1px solid var(--line);
  padding: 10px 16px; display: flex; align-items: center; gap: 10px;
}
.admin-layout { display: grid; grid-template-columns: 1fr; min-height: 100dvh; }
.admin-side {
  background: #101018; padding: 16px 10px 28px; border-bottom: 1px solid var(--line);
}
.admin-side a { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: 12px; color: var(--muted); }
.admin-side a.active, .admin-side a:hover { background: var(--surface); color: var(--text); }
.admin-main { padding: 16px; }
.table-wrap { overflow: auto; background: var(--surface); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 12px; background: var(--surface-2); }
.install-body { min-height: 100dvh; }
.install-shell { display: grid; min-height: 100dvh; }
.install-side { padding: 28px 22px; background: linear-gradient(180deg, #140b16, #0b0b10); }
.install-main { padding: 24px 18px 40px; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center;
  background: var(--grad); font-weight: 800; margin-bottom: 16px;
}
.install-steps { list-style: none; padding: 0; }
.install-steps li { display: flex; gap: 10px; align-items: center; color: var(--muted); margin: 10px 0; }
.install-steps li span {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line);
}
.install-steps .current { color: var(--text); }
.install-steps .current span, .install-steps .done span { background: var(--grad); border: 0; }
.req-list { list-style: none; padding: 0; }
.req-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.req-list .ok strong { color: var(--ok); }
.req-list .fail strong { color: var(--danger); }
.ok-text { color: var(--ok); }
.error-body { min-height: 100dvh; display: grid; place-items: center; }
.error-card { text-align: center; }
.error-code { font-size: 64px; margin: 0; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.toc a { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
.msg-list a { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); min-height: 44px; }
.bubble { background: var(--surface); padding: 10px 12px; border-radius: 16px; margin: 8px 0; max-width: 80%; }
.bubble.me { margin-left: auto; background: var(--secondary); }
.ad-slot { margin: 12px 16px; border-radius: 16px; overflow: hidden; min-height: 0; }
.ad-slot:empty { display: none; }
[dir="rtl"] { text-align: right; }
@media (min-width: 900px) {
  .bottom-nav { display: none; }
  .desktop-nav { display: flex; gap: 18px; align-items: center; margin-left: 24px; }
  .app-shell { padding-bottom: 24px; }
  .hero { min-height: 320px; }
  .hero img { height: 360px; }
  .admin-layout { grid-template-columns: 250px 1fr; }
  .admin-side { border-bottom: 0; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100dvh; overflow: auto; }
  .install-shell { grid-template-columns: 320px 1fr; }
  .card { min-width: 160px; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 899px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .desktop-only { display: none; }
}
