:root {
  --bg: #0a1628;
  --bg-2: #0f1f38;
  --bg-3: #152a4a;
  --fg: #f1f1f1;
  --muted: #9db0c9;
  --line: #243656;
  --accent: #1877f2;
  --accent-2: #fe2c55;
  --ok: #3ea6ff;
  --radius: 8px;
  --radius-sm: 4px;
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --header-h: 56px;
}

html[data-theme='light'] {
  --bg: #e8eef6;
  --bg-2: #ffffff;
  --bg-3: #d9e4f2;
  --fg: #0a1628;
  --muted: #4a5d75;
  --line: #c5d3e5;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--ok); }
.muted { color: var(--muted); }
.error { color: #ff4e45; font-size: 13px; }
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--accent-2);
  color: #fff;
}
.badge-live { background: var(--accent-2); }
.badge-soft {
  background: var(--bg-3);
  color: var(--muted);
  text-transform: none;
  font-weight: 600;
}

/* —— Shell / nav —— */
.app-shell { display: flex; min-height: 100dvh; }
.side-nav {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 12px 10px;
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-nav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -.02em;
  padding: 10px 12px 18px;
  color: var(--fg);
}
.side-nav .brand img,
.brand-logo {
  height: 28px;
  width: auto;
  display: block;
  border-radius: 4px;
}
.feed-top .brand-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #fff;
  font-size: 16px;
}
.feed-top .brand-mini img { height: 24px; width: auto; border-radius: 3px; }
.mobile-bar .brand-inline {
  display: flex; align-items: center; gap: 8px; font-weight: 700;
}
.mobile-bar .brand-inline img { height: 24px; width: auto; border-radius: 3px; }
.auth-card .auth-logo {
  display: block; height: 48px; width: auto; margin: 0 auto 16px; border-radius: 6px;
}
.auth-taglines {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-taglines li {
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.auth-taglines .emoji { flex-shrink: 0; line-height: 1.35; }
.auth-method:hover { background: var(--bg-3); color: var(--fg); }
.side-nav a, .side-nav button.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.side-nav a:hover, .side-nav button.nav-item:hover,
.side-nav a.active { background: var(--bg-3); color: var(--fg); }
.side-nav .nav-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top-search {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 30;
}
.search-box {
  display: flex;
  width: min(520px, 100%);
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 40px;
  overflow: hidden;
}
.search-box input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--fg);
  padding: 10px 16px;
  font: inherit;
  outline: none;
}
.search-box button {
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--muted);
  padding: 0 18px;
  cursor: pointer;
  font-weight: 600;
}
.top-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.content { flex: 1; padding: 20px 24px 40px; max-width: 1200px; width: 100%; margin: 0 auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-3);
  color: var(--fg);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-danger { background: var(--accent-2); color: #fff; }
.btn-block { width: 100%; height: 44px; }
.btn-ghost { background: transparent; border-color: var(--line); }

.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--fg); font-size: 20px; cursor: pointer;
}

.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(80vw, 280px);
  background: var(--bg-2); z-index: 60; transform: translateX(-100%);
  transition: transform .2s; padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
  border-right: 1px solid var(--line);
}
.drawer.open { transform: translateX(0); }
.drawer a, .drawer button.linkish {
  display: block; width: 100%; text-align: left; padding: 12px;
  border: 0; border-radius: var(--radius); background: transparent;
  color: var(--fg); font: inherit; font-weight: 600; cursor: pointer;
}
.drawer .drawer-title { font-weight: 700; font-size: 18px; padding: 8px 12px 16px; margin: 0; }
.theme-row {
  margin-top: auto; padding: 12px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; font-weight: 600;
}
.switch {
  width: 44px; height: 24px; border-radius: 12px; border: 0; background: var(--line);
  position: relative; cursor: pointer;
}
.switch.on { background: var(--accent); }
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch.on::after { transform: translateX(20px); }

@media (max-width: 900px) {
  .side-nav { display: none; }
  .mobile-bar { display: flex; }
  .top-search { display: none; }
  .content { padding: 12px; }
}

/* —— Auth —— */
.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.auth-card {
  width: min(400px, 100%);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px 28px;
}
.auth-card h1 {
  margin: 0 0 24px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}
.auth-methods { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.auth-method {
  display: flex; align-items: center; gap: 12px;
  height: 48px; padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-3);
  color: var(--fg);
  font-weight: 600;
  font-size: 15px;
}
.auth-method:hover { background: var(--bg-3); color: var(--fg); }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 12px; margin: 16px 0;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 88px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 1px solid var(--accent); border-color: var(--accent);
}
.auth-foot {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
  text-align: center; color: var(--muted); font-size: 13px;
}
.auth-foot a { color: var(--accent-2); font-weight: 700; }

/* —— Publish —— */
.publish-page { max-width: 720px; margin: 0 auto; }
.publish-page h1 { font-size: 22px; font-weight: 700; margin: 0 0 6px; }
.publish-page .lead { color: var(--muted); margin: 0 0 24px; }
.publish-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}
@media (min-width: 800px) {
  .publish-grid { grid-template-columns: 240px 1fr; align-items: start; }
}
.dropzone {
  border: 1px dashed var(--line);
  background: var(--bg-2);
  border-radius: var(--radius);
  aspect-ratio: 9/16;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 16px;
  color: var(--muted);
  position: relative;
}
.dropzone strong { color: var(--fg); font-size: 14px; }
.dropzone input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.publish-fields {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.cat-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cat-option {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.cat-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(24, 119, 242, .12);
}
.cat-option input { accent-color: var(--accent); }
.publish-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px;
}

/* —— Feed —— */
.layout-feed .side-nav,
.layout-feed .top-search,
.layout-feed .mobile-bar,
.layout-feed .content { display: none !important; }
.layout-feed .app-shell { display: block; }
.feed-shell { height: 100dvh; position: relative; background: #000; }
.feed-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  background: linear-gradient(to bottom, rgba(0,0,0,.7), transparent);
}
.feed-top a, .feed-top button {
  color: #fff; background: transparent; border: 0; font: inherit; font-weight: 600; cursor: pointer;
}
.feed-track { height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory; }
.feed-item {
  position: relative; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always;
  background: #000; overflow: hidden;
}
.feed-video, .feed-placeholder { width: 100%; height: 100%; object-fit: cover; }
.feed-placeholder {
  display: grid; place-content: center; gap: 6px; text-align: center; color: #fff;
  background: linear-gradient(160deg, #1a2332, #0a0a0a 60%);
}
.feed-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.9) 12%, transparent 45%);
  pointer-events: none;
}
.feed-actions {
  position: absolute; right: 10px; bottom: 26%; z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.action-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: rgba(32,32,32,.72); color: #fff; font-size: 18px;
  display: grid; place-items: center; cursor: pointer; text-decoration: none;
}
.action-count { color: #fff; font-size: 12px; font-weight: 700; margin-top: -8px; }
.feed-meta {
  position: absolute; left: 14px; right: 64px; bottom: 88px; z-index: 3; color: #fff;
}
.feed-meta .title {
  font-size: 16px; font-weight: 700; margin: 0 0 8px; line-height: 1.3;
}
.feed-meta .author {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px;
}
.feed-meta .author a { color: #fff; font-weight: 700; }
.feed-meta .meta-line {
  color: rgba(255,255,255,.82); font-size: 13px; margin: 2px 0;
}
.feed-meta .meta-line b { color: #fff; font-weight: 600; }
.vote-box {
  margin-top: 10px; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius); padding: 8px;
}
.vote-bars { display: flex; height: 18px; border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 6px; }
.vote-bars .bar { font-size: 10px; font-weight: 700; display: flex; align-items: center; padding: 0 6px; }
.vote-bars .si { background: #2ea043; color: #062; }
.vote-bars .no { background: #da3633; color: #fff; }
.vote-forms { display: flex; gap: 6px; }
.vote-forms button {
  flex: 1; height: 32px; border: 0; border-radius: var(--radius-sm);
  background: #222; color: #fff; font-weight: 700; cursor: pointer;
}
.fab-camera {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  width: 56px; height: 56px; border-radius: 50%; background: var(--accent-2);
  display: grid; place-items: center; color: #fff; font-size: 22px;
  z-index: 6; box-shadow: 0 6px 20px rgba(254,44,85,.35);
}

/* —— Wall / profile grid —— */
.page-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.page-head h1 { margin: 0; font-size: 22px; font-weight: 700; }
.video-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 700px) { .video-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .video-grid { grid-template-columns: repeat(4, 1fr); } }
.video-tile {
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--fg);
}
.video-tile .thumb {
  aspect-ratio: 16/10;
  background: linear-gradient(145deg, #243044, #121212);
  position: relative;
}
.video-tile .thumb .dur {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(0,0,0,.8); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 4px; border-radius: 2px;
}
.video-tile .body { padding: 10px; }
.video-tile .body .t { font-weight: 650; font-size: 13px; margin: 0 0 4px; line-height: 1.3; }
.video-tile .body .s { color: var(--muted); font-size: 12px; }

.profile-hero {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
}
.profile-hero h1 { margin: 0 0 6px; font-size: 24px; }
.profile-stats { display: flex; gap: 28px; margin: 14px 0; }
.profile-stats strong { display: block; font-size: 18px; }
.profile-stats span { color: var(--muted); font-size: 12px; font-weight: 600; }

.dash-grid { display: grid; gap: 12px; }
@media (min-width: 900px) { .dash-grid { grid-template-columns: 1fr 1.4fr 1fr; } }
.dash-panel, .dash-map {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
}
.sent-bar { display: flex; height: 6px; border-radius: 2px; overflow: hidden; margin: 6px 0; background: var(--bg-3); }
.sent-bar .neg { background: #da3633; }
.sent-bar .neu { background: #6e7681; }
.sent-bar .pos { background: #2ea043; }
.map-list { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; }
.map-pin {
  text-align: left; background: var(--bg); border: 1px solid var(--line); color: var(--fg);
  border-radius: var(--radius-sm); padding: 10px; cursor: pointer;
}
.row-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.row-form input[type=text] {
  flex: 1; min-width: 160px; height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--fg);
}
.list { padding-left: 18px; }
.js-like { display: flex; flex-direction: column; align-items: center; margin: 0; }
.card { max-width: 480px; margin: 0 auto; }
.layout-feed .drawer-backdrop, .layout-feed .drawer { /* keep usable on feed */ }
