:root {
  --bg: #050914;
  --bg-soft: #0a1020;
  --card: #0d1526;
  --card-2: #111b31;
  --line: #1e2a45;
  --text: #e8eefc;
  --muted: #93a1bd;
  --green: #34d399;
  --teal: #2dd4bf;
  --violet: #8b5cf6;
  --purple: #a855f7;
  --gold: #ffd700;
  --danger: #f87171;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
button, a { touch-action: manipulation; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 300px at 15% -5%, rgba(52, 211, 153, 0.14), transparent 70%),
    radial-gradient(700px 350px at 85% -5%, rgba(139, 92, 246, 0.16), transparent 70%),
    radial-gradient(500px 300px at 50% 110%, rgba(45, 212, 191, 0.08), transparent 70%);
  z-index: 0;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select {
  font-family: inherit; font-size: 15px; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--violet); border-color: var(--violet); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }

#topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 20px;
  background: rgba(5, 9, 20, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.wordmark { display: flex; align-items: center; gap: 9px; font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: 0.4px; }
.wordmark:hover { text-decoration: none; }
.orb {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--teal) 45%, var(--violet));
  box-shadow: 0 0 18px rgba(45, 212, 191, 0.55);
}
#topnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
#topnav a {
  color: var(--muted); padding: 7px 12px; border-radius: 999px; font-weight: 600; font-size: 14px;
}
#topnav a:hover { color: var(--text); text-decoration: none; background: var(--card); }
#topnav a.active { color: var(--text); background: var(--card-2); }
#topnav a .badge {
  background: var(--violet); color: #fff; font-size: 11px; border-radius: 999px;
  padding: 1px 7px; margin-left: 5px; font-weight: 700;
}
#authbox { display: flex; align-items: center; gap: 10px; }
#authbox .who { color: var(--muted); font-size: 14px; }
#authbox .who b { color: var(--text); }

#layout {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: 230px minmax(0, 640px) 300px;
  gap: 24px;
  max-width: 1220px;
  margin: 0 auto;
  padding: 20px;
  align-items: start;
}
#left, #right { position: sticky; top: 74px; }
#left .sidecard, #right .sidecard { margin-bottom: 16px; }
.sidecard {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.sidecard h3 { margin: 0 0 10px; font-size: 15px; }
.sidecard p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.sidecard .navlink {
  display: block; padding: 9px 10px; border-radius: 9px; color: var(--text);
  font-weight: 600; font-size: 14px;
}
.sidecard .navlink:hover { background: var(--card-2); text-decoration: none; }
.sidecard .navlink.active { background: var(--card-2); color: var(--teal); }
.sidecard .navlink small { color: var(--muted); font-weight: 400; display: block; }

#main { min-width: 0; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 6px; font-size: 20px; }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

.btn {
  display: inline-block; border: 0; border-radius: 999px;
  padding: 9px 18px; font-size: 14px; font-weight: 700; color: #04121a;
  background: linear-gradient(135deg, var(--green), var(--teal));
}
.btn:hover { filter: brightness(1.1); }
.btn.secondary { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.composer textarea { min-height: 64px; }
.composer .charcount { color: var(--muted); font-size: 12px; text-align: right; }

.post { padding: 16px; }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--teal), var(--violet));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; color: #fff; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 84px; height: 84px; font-size: 34px; border: 3px solid var(--bg); }
.post-head .who { line-height: 1.3; min-width: 0; }
.post-head .who b { color: var(--text); }
.post-head .who .handle { color: var(--muted); font-size: 13px; }
.post-head .time { color: var(--muted); font-size: 13px; margin-left: auto; white-space: nowrap; }
.repost-flag { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.community-flag { font-size: 13px; margin-bottom: 6px; }
.community-flag a { color: var(--green); font-weight: 700; }
.post-body { white-space: pre-wrap; word-wrap: break-word; font-size: 15px; }
.post-body img, .post-image { max-width: 100%; border-radius: 12px; margin-top: 10px; display: block; }
.post-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.action {
  background: none; border: 0; color: var(--muted); font-size: 14px;
  padding: 6px 10px; border-radius: 999px; font-weight: 600;
}
.action:hover { background: var(--card-2); color: var(--text); }
.action.on { color: var(--teal); }
.action.on.liked { color: #f472b6; }
.post .edited { color: var(--muted); font-size: 12px; }
.original { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; background: var(--bg-soft); }

.cover {
  height: 170px; border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(120deg, #0f766e, #6d28d9 55%, #065f46);
  background-size: cover; background-position: center;
}
.profile-head { padding: 0 16px 16px; margin-top: -42px; position: relative; }
.profile-head .row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.profile-head h2 { margin: 10px 0 0; }
.profile-head .handle { color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button {
  background: none; border: 0; color: var(--muted); font-weight: 700;
  padding: 10px 14px; font-size: 14px; border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--teal); }

.hero { padding: 40px 28px; text-align: center; }
.hero h1 {
  font-size: 42px; line-height: 1.1; margin: 0 0 12px;
  background: linear-gradient(90deg, var(--green), var(--teal) 40%, var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); font-size: 17px; max-width: 560px; margin: 0 auto 8px; }
.authgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.authgrid .card { text-align: left; margin-bottom: 0; }

.trend { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); }
.trend:last-child { border-bottom: 0; }
.trend .count { color: var(--muted); font-size: 13px; }

.convo { display: flex; gap: 10px; padding: 12px; border-radius: 10px; cursor: pointer; }
.convo:hover { background: var(--card-2); }
.convo .body { min-width: 0; }
.convo .body .preview { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unread-dot { background: var(--violet); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; }

.msg { max-width: 75%; padding: 10px 14px; border-radius: 16px; margin-bottom: 8px; white-space: pre-wrap; word-wrap: break-word; }
.msg.mine { margin-left: auto; background: linear-gradient(135deg, #0d9488, #7c3aed); }
.msg.theirs { background: var(--card-2); }
.msg .mtime { display: block; font-size: 11px; color: rgba(255,255,255,0.65); margin-top: 4px; }

.notif { display: flex; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: rgba(139, 92, 246, 0.08); border-radius: 10px; padding: 12px; }

.vault-note { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.vault-note:last-child { border-bottom: 0; }
.vault-open { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-top: 12px; white-space: pre-wrap; word-wrap: break-word; }

.error { color: var(--danger); font-size: 14px; margin-top: 8px; }
.success { color: var(--green); font-size: 14px; margin-top: 8px; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table td, .admin-table th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }

.vision-list { margin: 0; padding-left: 20px; }
.vision-list li { margin-bottom: 10px; }

/* Founding Members */
/* Founding Members — the badge is the Aurora orb logo */
.orb-icon {
  width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--green), var(--teal) 45%, var(--violet));
  display: inline-block; vertical-align: -2px; margin-right: 5px;
  box-shadow: 0 0 8px rgba(45, 212, 191, 0.6);
}
.orb-icon.after { margin-right: 0; margin-left: 5px; }
.founding-badge {
  display: inline-flex; align-items: center;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.16), rgba(139, 92, 246, 0.20));
  border: 1px solid rgba(45, 212, 191, 0.55);
  color: var(--text); font-size: 11px; font-weight: 800;
  border-radius: 999px; padding: 2px 9px; margin-left: 6px;
  white-space: nowrap; letter-spacing: 0.2px;
}
/* CEO badge — real metallic gold, never flat mustard.
   Layered gold gradient (bright highlight band + deep bronze edges)
   with a slow light sheen sweeping across it. */
.owner-badge {
  position: relative;
  overflow: hidden;
  display: inline-flex; align-items: center;
  background: linear-gradient(135deg,
    #b8860b 0%, #ffd700 22%, #fff6bf 38%,
    #daa520 55%, #b8860b 72%, #ffd700 88%, #8a6508 100%);
  border: 1px solid rgba(255, 215, 0, 0.85);
  color: #2a1e00; font-size: 11px; font-weight: 800;
  border-radius: 999px; padding: 2px 9px; margin-left: 6px;
  white-space: nowrap; letter-spacing: 0.2px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    inset 0 -1px 0 rgba(138, 101, 8, 0.55),
    0 0 14px rgba(255, 215, 0, 0.45);
}
.owner-badge::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(115deg,
    transparent 32%, rgba(255, 255, 255, 0.65) 50%, transparent 68%);
  transform: translateX(-120%);
  animation: gold-sheen 4.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes gold-sheen {
  0%, 55% { transform: translateX(-120%); }
  85%, 100% { transform: translateX(120%); }
}
@media (prefers-reduced-motion: reduce) {
  .owner-badge::after { animation: none; }
}
.owner-line {
  font-weight: 700; font-size: 14px;
  background: linear-gradient(90deg, #ffd700, #fff6bf 30%, #daa520 55%, #ffd700 80%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: #ffd700;
}
.founding-counter { color: var(--gold); font-weight: 700; }
.founding-line { color: var(--gold); font-weight: 700; font-size: 14px; }
.founding-list { margin-top: 10px; }
.founding-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.founding-row:last-child { border-bottom: 0; }
.founding-num { font-weight: 800; color: var(--gold); width: 34px; flex-shrink: 0; }
.kbd { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; font-family: monospace; font-size: 13px; }

/* ---------- music on posts ---------- */
.music-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.music-toggle { border: 1px solid var(--line); }
.music-chosen { font-weight: 700; color: var(--teal); }
.music-picker { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: var(--bg-soft); }
.track-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-radius: 10px; cursor: pointer; min-height: 48px;
}
.track-row:hover { background: var(--card-2); }
.track-row.selected { background: rgba(45, 212, 191, 0.14); outline: 1px solid rgba(45, 212, 191, 0.55); }
.track-preview {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; border: 0;
  background: linear-gradient(135deg, var(--green), var(--teal) 50%, var(--violet));
  color: #fff; font-size: 15px;
}
.track-name { font-weight: 700; }
.track-check { margin-left: auto; color: var(--teal); font-weight: 800; visibility: hidden; }
.track-row.selected .track-check { visibility: visible; }
.music-bar {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px 6px 6px;
}
.music-play {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; border: 0;
  background: linear-gradient(135deg, var(--green), var(--teal) 50%, var(--violet));
  color: #fff; font-size: 15px;
}
.music-title { font-weight: 700; font-size: 14px; }

/* Fresh post drops in without a reload */
.post.fresh { animation: post-in 0.35s ease-out; }
@keyframes post-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .post.fresh { animation: none; }
}

/* Bottom navigation — phones only, fixed to the bottom */
#bottomnav { display: none; }
#fab-compose { display: none; }
@media (max-width: 720px) {
  #bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: rgba(5, 9, 20, 0.94); backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    min-height: calc(56px + env(safe-area-inset-bottom, 0px));
  }
  #bottomnav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); font-size: 11px; font-weight: 700; padding: 4px 6px;
    border-radius: 10px; text-decoration: none; flex: 1; max-width: 90px;
    min-height: 48px;
  }
  #bottomnav a.active { color: var(--teal); }
  #bottomnav a:hover { text-decoration: none; }
  #bottomnav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  /* Thumb-reachable compose button, floating above the bottom nav */
  #fab-compose.show {
    display: flex; align-items: center; justify-content: center;
    position: fixed; right: 16px; z-index: 55;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    width: 56px; height: 56px; border-radius: 50%; border: 0;
    background: linear-gradient(135deg, var(--green), var(--teal) 50%, var(--violet));
    color: #fff; font-size: 32px; font-weight: 300; line-height: 1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 18px rgba(45, 212, 191, 0.4);
  }
  #fab-compose.show:active { transform: scale(0.94); }
}

@media (max-width: 1020px) {
  #layout { grid-template-columns: 200px minmax(0, 1fr); }
  #right { display: none; }
}
@media (max-width: 720px) {
  /* App-first phone layout: the top bar is just the brand + account;
     the bottom nav owns navigation. Content clears the bottom nav. */
  #layout { grid-template-columns: minmax(0, 1fr); padding: 12px 12px calc(96px + env(safe-area-inset-bottom, 0px)); }
  #left { display: none; }
  #topnav { display: none; }
  #topbar { padding: 10px 14px; gap: 10px; }
  #authbox .who { display: none; }
  .authgrid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
  .hero { padding: 28px 16px; }
  .wordmark-text { display: none; }
  /* 16px inputs stop iOS auto-zooming on focus — an app must never zoom on tap */
  input, textarea, select { font-size: 16px; }
  /* Thumb-sized targets: 44px minimum everywhere you tap */
  .action { min-height: 44px; padding: 10px 14px; }
  .tabs button { flex: 1; min-height: 44px; padding: 12px 8px; }
  .btn { min-height: 44px; }
  .composer .btn { flex: 1; }
  .card { padding: 14px; }
  .post-head .time { font-size: 12px; }
  /* Toasts sit above the bottom nav, never behind it */
  #toasts { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); width: calc(100% - 32px); align-items: center; }
  .toast { max-width: 100%; text-align: center; }
}

/* ---------- camera-roll photos ---------- */
.photo-pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-btn { border: 1px solid var(--line); }
.photo-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb button {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,0.65); color: #fff; font-size: 15px; line-height: 1;
}
.post-images { display: grid; gap: 6px; margin-top: 10px; }
.post-images.count-1 { grid-template-columns: 1fr; }
.post-images.count-2, .post-images.count-3, .post-images.count-4 { grid-template-columns: 1fr 1fr; }
.post-images .post-image { margin-top: 0; width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.post-images.count-2 .post-image, .post-images.count-3 .post-image, .post-images.count-4 .post-image { aspect-ratio: 1; }
.photo-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.photo-overlay img { max-width: 100%; max-height: 100%; object-fit: contain; }
.settings-preview { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin-top: 10px; display: block; }

/* ---------- music: one-tap rows + volume slider ---------- */
.track-state {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--green), var(--teal) 50%, var(--violet));
  color: #fff; font-size: 15px;
}
.music-volume {
  flex: 1; min-width: 60px; max-width: 140px; width: auto;
  padding: 0; background: transparent; border: 0; accent-color: var(--teal);
}
.view-count { cursor: default; }
