:root {
  --navy: #14346b;
  --navy-2: #1d4ed8;
  --bg: #fafafa;
  --card: #ffffff;
  --border: #dbdbdb;
  --text: #1f2937;
  --muted: #737373;
  --red: #e0245e;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
img, video { display: block; max-width: 100%; }
.boot { display: grid; place-items: center; min-height: 100vh; font-size: 28px; font-weight: 800; color: var(--navy); letter-spacing: .5px; }

/* ---- shell ---- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; max-width: 100%;
}
.logo { font-size: 22px; font-weight: 800; color: var(--navy); letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.logo svg { width: 26px; height: 26px; }
.top-actions { display: flex; gap: 14px; align-items: center; }
.top-actions a, .top-actions button { color: var(--navy); font-weight: 600; font-size: 14px; }
.page { max-width: 560px; margin: 0 auto; padding: 16px 12px 90px; }
.page.wide { max-width: 900px; }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--card); border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px 10px; }
.bottomnav a.active { color: var(--navy); font-weight: 700; }
.bottomnav svg { width: 24px; height: 24px; }

/* ---- auth ---- */
.auth-wrap { max-width: 380px; margin: 8vh auto; padding: 0 16px; }
.auth-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 28px 24px; }
.auth-card .logo { justify-content: center; font-size: 28px; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.field { margin-bottom: 12px; }
.field input, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; background: #f8fafc;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--navy-2); border-color: transparent; background: #fff; }
.btn {
  display: block; width: 100%; padding: 11px; border-radius: 8px;
  background: var(--navy); color: #fff; font-weight: 700; text-align: center;
}
.btn:disabled { opacity: .5; }
.btn.secondary { background: #eef2f7; color: var(--navy); }
.btn.small { width: auto; padding: 7px 16px; font-size: 14px; }
.auth-alt { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }
.auth-alt a { color: var(--navy-2); font-weight: 600; }
.error { color: var(--red); font-size: 14px; margin: 8px 0; text-align: center; }

/* ---- post card ---- */
.post {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 20px; overflow: hidden;
}
.post-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--navy);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; overflow: hidden; flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 84px; height: 84px; font-size: 32px; }
.post-head .who { flex: 1; min-width: 0; }
.post-head .who .uname { font-weight: 700; font-size: 14px; }
.post-head .who .time { font-size: 12px; color: var(--muted); }
.dotmenu { color: var(--muted); font-size: 20px; padding: 4px 8px; }
.post-media { background: #000; display: grid; place-items: center; }
.post-media img, .post-media video { width: 100%; max-height: 75vh; object-fit: contain; }
.post-actions { display: flex; align-items: center; gap: 14px; padding: 10px 12px 4px; }
.post-actions button { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 14px; }
.post-actions svg { width: 26px; height: 26px; }
.post-actions .liked svg { fill: var(--red); stroke: var(--red); }
.likes-line { padding: 0 12px; font-weight: 700; font-size: 14px; }
.caption { padding: 4px 12px; font-size: 14px; line-height: 1.45; }
.caption .uname { font-weight: 700; margin-right: 6px; }
.view-comments { padding: 4px 12px; color: var(--muted); font-size: 14px; }
.post-foot { padding: 8px 12px 12px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }

/* ---- comments ---- */
.comment { display: flex; gap: 10px; padding: 8px 0; font-size: 14px; align-items: flex-start; }
.comment .avatar { width: 30px; height: 30px; font-size: 13px; }
.comment .body { flex: 1; }
.comment .del { color: var(--muted); font-size: 12px; }
.comment-form { display: flex; gap: 8px; padding: 10px 0; }
.comment-form input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 999px; font: inherit; }
.comment-form button { color: var(--navy-2); font-weight: 700; }

/* ---- grids ---- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.grid a { position: relative; aspect-ratio: 1; background: #e5e7eb; overflow: hidden; }
.grid img, .grid video { width: 100%; height: 100%; object-fit: cover; }
.grid .vid-badge { position: absolute; top: 6px; right: 6px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.grid .vid-badge svg { width: 20px; height: 20px; }

/* ---- profile ---- */
.profile-head { display: flex; gap: 20px; align-items: center; padding: 12px 4px 16px; }
.profile-stats { display: flex; gap: 22px; flex: 1; justify-content: space-around; text-align: center; }
.profile-stats b { display: block; font-size: 17px; }
.profile-stats span { font-size: 13px; color: var(--muted); }
.profile-names { padding: 0 4px 14px; }
.profile-names .dn { font-weight: 700; }
.profile-names .bio { font-size: 14px; white-space: pre-wrap; }
.profile-actions { display: flex; gap: 8px; padding: 0 4px 16px; }
.profile-actions .btn { flex: 1; }

/* ---- upload ---- */
.upload-box { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.drop {
  border: 2px dashed var(--border); border-radius: 12px; min-height: 240px;
  display: grid; place-items: center; text-align: center; color: var(--muted); gap: 8px; padding: 20px;
}
.drop.has-media { border: none; padding: 0; min-height: 0; }
.drop img, .drop video { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 12px; background: #000; }
.pick-btn { color: var(--navy-2); font-weight: 700; font-size: 16px; }
.progress { height: 6px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin: 12px 0; }
.progress i { display: block; height: 100%; background: var(--navy); width: 0; transition: width .2s; }

/* ---- misc ---- */
.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.empty h2 { color: var(--text); font-size: 20px; margin-bottom: 8px; }
.menu-pop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50;
  display: grid; place-items: end center;
}
.menu-pop .sheet { background: #fff; width: 100%; max-width: 480px; border-radius: 16px 16px 0 0; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); }
.menu-pop button { display: block; width: 100%; text-align: center; padding: 15px; font-size: 16px; }
.menu-pop button.danger { color: var(--red); font-weight: 700; }
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 60;
}
.report-row { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.report-row .thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: #e5e7eb; }
.report-row .info { flex: 1; font-size: 13px; min-width: 0; }
.report-row .info b { font-size: 14px; }
@media (min-width: 720px) {
  .page { padding-top: 24px; }
}
