/* nungaaverse client — theme layer over Pure (purecss.io).
 * Mobile-first: designed at 375px (iPhone SE), scales up to a centered
 * column. Look borrowed from the kongosa design references: near-black
 * ground, violet accent, pill action chips, capsule bottom nav.
 */
:root {
  --bg: #0d0d12;
  --surface: #17171f;
  --surface-2: #20202b;
  --line: #262633;
  --text: #ecebf3;
  --muted: #8d8b9e;
  --accent: #6c5ce7;
  --accent-soft: #8d7bff;
  --heart: #ff4d7d;
  --radius: 16px;
  --tabbar-h: 62px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
a { color: var(--accent-soft); text-decoration: none; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: rgba(13, 13, 18, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 21px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.brand span { color: var(--accent-soft); }
.whoami { display: flex; align-items: center; gap: 10px; }

/* Capsule bottom nav */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 4px;
  background: rgba(23, 23, 31, .96);
  border: 1px solid var(--line);
  border-radius: 999px; padding: 6px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
  z-index: 20;
}
.tab {
  display: flex; flex-direction: column; align-items: center;
  min-width: 74px; padding: 6px 10px; border-radius: 999px;
  color: var(--muted); font-size: 11px; font-weight: 600;
}
.tab-icon { font-size: 18px; line-height: 1.2; }
.tab-active { background: var(--accent); color: #fff; }
.tab-soon { opacity: .4; cursor: default; }

/* Layout */
.page { max-width: 560px; margin: 0 auto; padding: 14px 12px 24px; }

/* Buttons and chips */
.pure-button { border-radius: 999px; font-weight: 700; }
.btn-primary {
  background: var(--accent); color: #fff; border: 0; padding: 10px 22px;
}
.btn-primary:disabled { opacity: .5; }
.chip {
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line); padding: 6px 14px; font-size: 13px;
}
.chip:hover { color: var(--text); }

/* Icons (Lucide inline SVGs) */
svg.lucide { width: 18px; height: 18px; stroke-width: 2; vertical-align: -3px; }
.tab svg.lucide { width: 20px; height: 20px; margin-bottom: 2px; }
.btn-icon { display: inline-flex; align-items: center; gap: 7px; }
.btn-icon svg.lucide { width: 16px; height: 16px; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); cursor: pointer; flex: none;
}
.icon-button:hover { color: var(--text); }
.icon-button:active { transform: scale(.94); }
.icon-button-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.icon-button-accent:hover { color: #fff; }
.action svg.lucide { width: 17px; height: 17px; }
.like-btn.liked svg.lucide { fill: var(--heart); stroke: var(--heart); }

/* Avatars — image when the user has one, initials otherwise */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--heart));
  color: #fff; font-weight: 800; font-size: 15px;
  flex: none; text-transform: uppercase; overflow: hidden;
  border: 2px solid var(--surface-2);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }

/* Auth */
.auth-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 20px;
  max-width: 380px; margin: 8vh auto 0;
}
.auth-card h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.02em; }
.auth-card .pure-form { display: grid; gap: 12px; margin-top: 18px; }
.auth-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.auth-card input {
  background: var(--surface-2) !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  padding: 12px 14px !important;
  color: var(--text) !important;
  font-size: 16px !important;      /* 16px stops iOS zoom-on-focus */
  box-shadow: none !important;
  width: 100%;
}
.auth-card input:focus { border-color: var(--accent) !important; }
.form-error { color: var(--heart); font-size: 13px; margin: 0; }
.muted { color: var(--muted); font-size: 13px; }

/* Composer */
.composer {
  display: flex; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; margin-bottom: 14px;
}
.composer textarea {
  flex: 1; resize: none; border: 0; background: transparent;
  color: var(--text); font: inherit; font-size: 16px; outline: none;
  min-height: 44px;
}
.composer-side { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; }

/* Feed */
.feed-list { display: grid; gap: 12px; }
.post-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.post-head { display: flex; gap: 10px; align-items: center; }
.post-author { font-weight: 700; display: block; font-size: 15px; }
.post-time { font-size: 12px; }
.post-body { margin: 10px 0 4px; white-space: pre-wrap; word-break: break-word; }
.post-media { display: grid; gap: 6px; margin: 10px 0 4px; }
.post-media img {
  width: 100%; max-height: 420px; object-fit: cover;
  border-radius: 12px; display: block; background: var(--surface-2);
}
.post-actions { display: flex; gap: 8px; margin-top: 8px; }
.action {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px;
  color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 600;
}
.action:active { transform: scale(.96); }
.like-btn.liked { color: var(--heart); border-color: rgba(255, 77, 125, .35); }

/* Comments */
.comments { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.comment-list { display: grid; gap: 8px; margin-bottom: 10px; }
.comment { font-size: 14px; }
.comment b { color: var(--accent-soft); font-weight: 700; }
.comment-form { display: flex; gap: 8px; }
.comment-input {
  flex: 1; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 14px; color: var(--text); font-size: 16px;
}
.load-more { display: block; margin: 16px auto 0; }

/* Chat */
.thread-list { display: grid; gap: 8px; }
.thread-row {
  display: flex; gap: 12px; align-items: center; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; color: var(--text);
  cursor: pointer; width: 100%; font: inherit;
}
.thread-meta { display: grid; }
.thread-name { font-weight: 700; }
.thread-last {
  max-width: 240px; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis;
}
.thread-head {
  display: flex; gap: 10px; align-items: center; margin-bottom: 10px;
}
.thread-title { font-weight: 800; font-size: 17px; }
.message-list {
  display: grid; gap: 8px; align-content: start;
  min-height: 45vh; max-height: 62vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; margin-bottom: 10px;
}
.bubble {
  justify-self: start; max-width: 85%;
  background: var(--surface-2); border-radius: 14px 14px 14px 4px;
  padding: 8px 12px; font-size: 14px; display: grid;
}
.bubble b { color: var(--accent-soft); font-size: 12px; }
.bubble-mine {
  justify-self: end; background: var(--accent);
  border-radius: 14px 14px 4px 14px;
}
.bubble-mine b { color: rgba(255, 255, 255, .8); }

/* Gifts */
.gift-sheet {
  margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px;
  display: grid; gap: 8px;
}
.gift-options { display: flex; flex-wrap: wrap; gap: 8px; }
.gift-option svg.lucide { color: var(--heart); }

/* Wallet */
.section-title { font-size: 15px; font-weight: 800; margin: 18px 0 8px; }
.balance-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.balance-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; display: grid; gap: 2px;
}
.balance-card strong { font-size: 28px; letter-spacing: -.02em; }
.pack-list, .transaction-list, .plan-list, .alert-list { display: grid; gap: 8px; }
.pack {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; color: var(--text);
  cursor: pointer; font: inherit;
}
.pack-name { font-weight: 700; }
.pack-credits { grid-column: 1; }
.pack-price { grid-column: 2; grid-row: 1 / span 2; font-weight: 800; color: var(--accent-soft); }
.transaction {
  display: flex; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; font-size: 14px;
}
.transaction-amount { font-weight: 700; color: #4cd4a0; }
.transaction-amount.debit { color: var(--heart); }

/* Plans */
.plan {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.plan-meta { display: grid; }
.plan-name { font-weight: 700; }

/* Alerts */
.bell { position: relative; }
.badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px;
  border-radius: 999px; background: var(--heart); color: #fff;
  font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  padding: 0 5px;
}
.alert-row {
  display: grid; gap: 2px; text-align: left; width: 100%; font: inherit;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; color: var(--text);
  cursor: pointer;
}
.alert-row.unread { border-color: var(--accent); }
.alert-title { font-weight: 700; }

/* Streaming */
.stream-row .post-head { align-items: center; }
.stream-row .stream-join { margin-left: auto; }
.video-grid {
  display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px; min-height: 40vh;
}
.video-grid video, .video-grid audio {
  width: 100%; border-radius: 12px; background: #000;
}
.video-grid video:only-of-type { grid-column: 1 / -1; }
