:root {
  --navy: #14346b;
  --navy-2: #1d4ed8;
  --blue: #3b82f6;
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e4e8f0;
  --text: #17203a;
  --muted: #6b7686;
  --red: #e0245e;
  --shadow-sm: 0 1px 2px rgba(16,24,64,.05), 0 1px 3px rgba(16,24,64,.07);
  --shadow-md: 0 2px 6px rgba(16,24,64,.06), 0 12px 28px rgba(16,24,64,.08);
  --shadow-lg: 0 24px 60px rgba(10,20,50,.25);
  --grad: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 55%, var(--blue) 100%);
}
* { 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;
  -webkit-font-smoothing: antialiased;
}
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: rgba(255,255,255,.82);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
}
.logo { font-size: 22px; font-weight: 800; color: var(--navy); letter-spacing: .2px; display: flex; align-items: center; gap: 9px; }
.logo svg, .logo img { width: 27px; height: 27px; }
.top-actions { display: flex; gap: 6px; align-items: center; }
.top-actions a, .top-actions button {
  color: var(--navy); font-weight: 600; font-size: 14px; padding: 7px 12px; border-radius: 999px;
  transition: background .15s;
}
.top-actions a:hover, .top-actions button:hover { background: #eef2fa; }
.top-actions a.active { background: var(--navy); color: #fff; }
.page { max-width: 560px; margin: 0 auto; padding: 18px 12px 96px; }
.page.wide { max-width: 900px; }
h1.page-title { font-size: 20px; font-weight: 800; letter-spacing: .2px; margin-bottom: 14px; }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: rgba(255,255,255,.88);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; padding: 6px 8px 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: 5px 14px; border-radius: 12px;
  transition: color .15s, background .15s;
}
.bottomnav a.active { color: var(--navy); font-weight: 700; background: #eef2fa; }
.bottomnav svg { width: 24px; height: 24px; }

/* ---- auth / landing ---- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(59,130,246,.45), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(29,78,216,.4), transparent 55%),
    linear-gradient(160deg, #0d2653 0%, #14346b 45%, #1d4ed8 100%);
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--card); border-radius: 22px;
  padding: 36px 30px 28px; box-shadow: var(--shadow-lg);
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .mark {
  width: 76px; height: 76px; border-radius: 20px; margin: 0 auto 14px;
  box-shadow: 0 10px 24px rgba(20,52,107,.35);
}
.auth-brand h1 { font-size: 30px; font-weight: 800; color: var(--navy); letter-spacing: .3px; }
.auth-brand p { color: var(--muted); font-size: 15px; margin-top: 6px; line-height: 1.45; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 12px;
  font: inherit; background: #f8fafc; transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--navy-2); background: #fff;
  box-shadow: 0 0 0 4px rgba(29,78,216,.12);
}
.btn {
  display: block; width: 100%; padding: 12px; border-radius: 12px;
  background: var(--grad); color: #fff; font-weight: 700; text-align: center;
  box-shadow: 0 6px 16px rgba(20,52,107,.28); transition: transform .12s, box-shadow .12s, opacity .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(20,52,107,.34); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; transform: none; box-shadow: none; }
.btn.secondary { background: #eef2fa; color: var(--navy); box-shadow: none; }
.btn.secondary:hover { background: #e3eaf7; }
.btn.small { width: auto; padding: 8px 18px; font-size: 14px; border-radius: 10px; }
.btn.danger-btn { background: var(--red); box-shadow: 0 6px 16px rgba(224,36,94,.25); }
.auth-alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-alt a { color: var(--navy-2); font-weight: 700; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 12.5px; color: var(--muted); }
.error { color: var(--red); font-size: 14px; margin: 8px 0; text-align: center; }

/* ---- post card ---- */
.post {
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow-sm);
  margin-bottom: 22px; overflow: hidden;
}
.post-head { display: flex; align-items: center; gap: 11px; padding: 12px 14px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--grad);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; overflow: hidden; flex: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #dbe4f5;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 88px; height: 88px; font-size: 32px; box-shadow: 0 0 0 3px #fff, 0 0 0 5px #dbe4f5; }
.post-head .who { flex: 1; min-width: 0; }
.post-head .who .uname { font-weight: 700; font-size: 14.5px; }
.post-head .who .time { font-size: 12px; color: var(--muted); }
.dotmenu { color: var(--muted); font-size: 20px; padding: 4px 10px; border-radius: 8px; }
.dotmenu:hover { background: #f1f4fa; }
.post-media { background: #0b1220; 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: 16px; padding: 10px 14px 4px; }
.post-actions button, .post-actions a { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 14px; font-weight: 600; }
.post-actions svg { width: 26px; height: 26px; }
.post-actions .liked { color: var(--red); }
.post-actions .liked svg { fill: var(--red); stroke: var(--red); animation: pop .25s; }
@keyframes pop { 50% { transform: scale(1.25); } }
.likes-line { padding: 2px 14px 0; font-weight: 700; font-size: 14px; }
.caption { padding: 5px 14px; font-size: 14.5px; line-height: 1.5; }
.caption .uname { font-weight: 700; margin-right: 6px; }
.view-comments { display: block; padding: 5px 14px; color: var(--muted); font-size: 14px; }
.post-foot { padding: 8px 14px 14px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* ---- comments ---- */
.comment { display: flex; gap: 10px; padding: 9px 0; font-size: 14.5px; align-items: flex-start; line-height: 1.45; }
.comment .avatar { width: 30px; height: 30px; font-size: 13px; box-shadow: none; }
.comment .body { flex: 1; }
.comment .del { color: var(--muted); font-size: 12px; font-weight: 600; }
.comment .del:hover { color: var(--red); }
.comment-form { display: flex; gap: 8px; padding: 12px 0 2px; }
.comment-form input {
  flex: 1; padding: 11px 16px; border: 1.5px solid var(--border); border-radius: 999px; font: inherit; background: #f8fafc;
}
.comment-form input:focus { outline: none; border-color: var(--navy-2); background: #fff; box-shadow: 0 0 0 4px rgba(29,78,216,.12); }
.comment-form button { color: var(--navy-2); font-weight: 700; padding: 0 6px; }
.card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow-sm); padding: 16px; }

/* ---- grids ---- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid a { position: relative; aspect-ratio: 1; background: #e8ecf4; overflow: hidden; border-radius: 10px; }
.grid img, .grid video { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.grid a:hover img, .grid a:hover video { transform: scale(1.04); }
.grid .vid-badge { position: absolute; top: 7px; right: 7px; 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: 22px; align-items: center; padding: 14px 6px 18px; }
.profile-stats { display: flex; gap: 22px; flex: 1; justify-content: space-around; text-align: center; }
.profile-stats b { display: block; font-size: 18px; }
.profile-stats span { font-size: 13px; color: var(--muted); }
.profile-names { padding: 0 6px 16px; }
.profile-names .dn { font-weight: 800; font-size: 16px; }
.profile-names .bio { font-size: 14.5px; white-space: pre-wrap; line-height: 1.5; }
.profile-actions { display: flex; gap: 8px; padding: 0 6px 18px; }
.profile-actions .btn { flex: 1; }

/* ---- upload ---- */
.upload-box { background: var(--card); border-radius: 18px; box-shadow: var(--shadow-sm); padding: 22px; }
.drop {
  border: 2px dashed #c8d2e4; border-radius: 14px; min-height: 240px;
  display: grid; place-items: center; text-align: center; color: var(--muted); gap: 8px; padding: 20px;
  background: #fafbfe; transition: border-color .15s, background .15s;
}
.drop:hover { border-color: var(--navy-2); background: #f4f7fd; }
.drop.has-media { border: none; padding: 0; min-height: 0; background: none; }
.drop img, .drop video { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 14px; background: #0b1220; }
.pick-btn { color: var(--navy-2); font-weight: 700; font-size: 16px; padding: 8px 18px; border-radius: 999px; }
.pick-btn:hover { background: #eef2fa; }
.progress { height: 6px; background: #e8ecf4; border-radius: 999px; overflow: hidden; margin: 14px 0; }
.progress i { display: block; height: 100%; background: var(--grad); width: 0; transition: width .2s; }

/* ---- admin ---- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); background: #eaeef6; }
.tabs a.active { background: var(--navy); color: #fff; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 8px; }
.stat-card { background: var(--card); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 16px; text-align: center; }
.stat-card b { display: block; font-size: 26px; color: var(--navy); }
.stat-card span { font-size: 13px; color: var(--muted); }
.admin-row {
  display: flex; gap: 12px; align-items: center; background: var(--card);
  border-radius: 14px; box-shadow: var(--shadow-sm); padding: 12px 14px; margin-bottom: 10px;
}
.admin-row .thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: #e8ecf4; flex: none; }
.admin-row .info { flex: 1; font-size: 13px; min-width: 0; line-height: 1.45; }
.admin-row .info b { font-size: 14.5px; }
.admin-row .actions { display: flex; gap: 8px; flex: none; }
.icon-btn {
  padding: 7px 14px; border-radius: 10px; font-size: 13px; font-weight: 700;
  background: #eef2fa; color: var(--navy);
}
.icon-btn:hover { background: #e3eaf7; }
.icon-btn.danger { background: #fdeef3; color: var(--red); }
.icon-btn.danger:hover { background: #fbdfe9; }
.inline-edit { background: #f8fafc; border-radius: 12px; padding: 12px; margin: -4px 0 10px; }

/* ---- search / save / tags ---- */
.searchbox {
  display: flex; align-items: center; gap: 10px; background: var(--card);
  border-radius: 999px; box-shadow: var(--shadow-sm); padding: 11px 18px; margin-bottom: 16px;
}
.searchbox svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.searchbox input { flex: 1; border: none; outline: none; font: inherit; background: none; }
.saveBtn.saved { color: var(--navy); }
.caption .tag { color: var(--navy-2); font-weight: 600; }

/* ---- misc ---- */
.empty { text-align: center; color: var(--muted); padding: 52px 20px; }
.empty h2 { color: var(--text); font-size: 20px; margin-bottom: 8px; }
.menu-pop {
  position: fixed; inset: 0; background: rgba(10,18,38,.45); z-index: 50;
  display: grid; place-items: end center;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.menu-pop .sheet { background: #fff; width: 100%; max-width: 480px; border-radius: 20px 20px 0 0; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); }
.menu-pop button { display: block; width: 100%; text-align: center; padding: 15px; font-size: 16px; }
.menu-pop button:hover { background: #f6f8fc; }
.menu-pop button.danger { color: var(--red); font-weight: 700; }
.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  background: #111c33; color: #fff; padding: 11px 20px; border-radius: 999px; font-size: 14px; z-index: 60;
  box-shadow: var(--shadow-md);
}
.report-row { display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 12px 14px; margin-bottom: 10px; }
.report-row .thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: #e8ecf4; }
.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: 26px; }
}
