:root {
  --bg: #0a0a0a;
  --bg-elev: #121212;
  --bg-soft: #181818;
  --line: #2a2a2a;
  --text: #f2efe8;
  --muted: #8a857c;
  --gold: #c9a84c;
  --gold-dim: #9a7d35;
  --danger: #c45c4a;
  --ok: #6f9e7a;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Outfit", system-ui, sans-serif;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(201,168,76,0.08), transparent 55%),
    linear-gradient(180deg, #0c0c0c 0%, #080808 100%);
  min-height: 100dvh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button, a, .btn-gold, .btn-outline, .btn-ghost, .nav-item, .channels button, .msg-act, .msg-img-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--gold); }

.view { display: none; min-height: 100dvh; }
.view.active { display: block; }
.hidden { display: none !important; }

.brand-mark {
  margin: 0;
  letter-spacing: 0.42em;
  font-size: 0.72rem;
  color: var(--gold);
  font-weight: 500;
}
.brand-mark.sm { font-size: 0.62rem; letter-spacing: 0.36em; }

/* Auth */
.auth-hero {
  position: relative;
  padding: 72px 24px 40px;
  text-align: center;
  overflow: hidden;
}
.auth-grain {
  position: absolute; inset: 0;
  background:
    linear-gradient(160deg, rgba(201,168,76,0.12), transparent 50%),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.015) 3px);
  pointer-events: none;
}
.auth-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 12vw, 4rem);
  font-weight: 500;
  margin: 14px 0 8px;
  letter-spacing: 0.04em;
}
.auth-sub { color: var(--muted); margin: 0; font-size: 0.92rem; font-weight: 300; }
.auth-card {
  margin: 0 16px 24px;
  padding: 22px 18px 26px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}
.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-tab {
  flex: 1;
  padding: 10px;
  color: var(--muted);
  border-bottom: 1px solid transparent;
}
.auth-tab.active { color: var(--text); border-color: var(--gold); }
.auth-form label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.auth-form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  outline: none;
}
.auth-form input:focus { border-color: var(--gold-dim); }
.auth-forgot-wrap { margin: 4px 0 12px; text-align: right; }
.auth-link {
  background: none; border: none; padding: 0; color: var(--gold);
  font-size: 0.82rem; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
}
.auth-link:hover { color: var(--text); }
.auth-hint { color: var(--muted); font-size: 0.88rem; line-height: 1.5; margin: 0 0 14px; }
.form-msg { color: var(--ok); font-size: 0.85rem; min-height: 1.2em; line-height: 1.45; }
.form-error { color: var(--danger); font-size: 0.85rem; min-height: 1.2em; }
.btn-gold {
  width: 100%;
  margin-top: 6px;
  padding: 14px 18px;
  background: var(--gold);
  color: #0a0a0a;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.btn-gold:active { transform: scale(0.98); }
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  border: 1px solid var(--line);
  color: var(--text);
  letter-spacing: 0.06em;
  font-size: 0.78rem;
  text-transform: uppercase;
}
.btn-ghost {
  padding: 8px 12px;
  color: var(--gold);
  font-size: 0.8rem;
}
.install-pill {
  display: block;
  margin: 0 auto 40px;
  padding: 10px 18px;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

/* Onboarding */
.onboard-wrap, .center-msg {
  max-width: 420px;
  margin: 0 auto;
  padding: 72px 24px 40px;
  text-align: center;
}
.onboard-wrap h2, .center-msg h2 {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 500;
  margin: 18px 0 10px;
}
.onboard-body, .center-msg p { color: var(--muted); line-height: 1.6; }
.push-gate { padding-top: 56px; }
.push-gate .btn-gold,
.push-gate .btn-outline { width: 100%; margin-top: 10px; }
.push-gate .rank-meta strong { color: var(--gold); }
.progress-track {
  height: 2px;
  background: var(--line);
  margin: 28px 0 8px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  transition: width 0.45s cubic-bezier(.2,.8,.2,1);
}
.onboard-pct { color: var(--gold); font-size: 0.75rem; letter-spacing: 0.12em; }
.onboard-step { text-align: left; margin: 24px 0; }
.onboard-step label { display: block; margin-bottom: 12px; font-size: 0.8rem; color: var(--muted); }
.onboard-step input, .onboard-step textarea {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}
.rules-box {
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
  max-height: 220px;
  overflow: auto;
}

/* App shell */
#view-app.active {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + var(--safe-b));
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 18px 8px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(10,10,10,0.96), rgba(10,10,10,0.85) 70%, transparent);
  backdrop-filter: blur(8px);
}
.welcome {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 500;
}
.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  color: var(--text);
  position: relative;
  font-size: 1.1rem;
}
.dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
}
.main { flex: 1; padding: 8px 16px 24px; max-width: 720px; width: 100%; margin: 0 auto; }

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 8px 6px var(--safe-b);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(10,10,10,0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
  z-index: 40;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav-item span { font-size: 1rem; }
.nav-item.active { color: var(--gold); }

/* Cards / KPIs — interaction containers only */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 20px;
}
.kpi {
  padding: 14px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  animation: rise 0.5s ease both;
}
.kpi:nth-child(2) { animation-delay: 0.05s; }
.kpi:nth-child(3) { animation-delay: 0.1s; }
.kpi:nth-child(4) { animation-delay: 0.15s; }
.kpi:nth-child(5) { animation-delay: 0.2s; grid-column: 1 / -1; }
.kpi .label { display: block; color: var(--muted); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; }
.kpi .value {
  display: block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 1.85rem;
  color: var(--text);
}
.kpi.accent .value { color: var(--gold); }

.rank-panel {
  padding: 16px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(201,168,76,0.08), transparent 45%),
    var(--bg-elev);
}
.rank-panel h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
}
.rank-meta { color: var(--muted); font-size: 0.85rem; margin: 0 0 12px; }
.rank-bar {
  height: 3px;
  background: var(--line);
  overflow: hidden;
}
.rank-bar > i {
  display: block;
  height: 100%;
  background: var(--gold);
  transition: width 0.6s ease;
}

.section-title {
  margin: 22px 0 10px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.tools-list, .list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tool-row, .list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}
.tool-row strong, .list-row strong { font-weight: 500; font-size: 0.92rem; }
.tool-row span, .list-row span { color: var(--muted); font-size: 0.8rem; word-break: break-all; }
.tool-url { display: block; user-select: all; -webkit-user-select: all; }

.invite-block {
  margin: 0 0 18px;
  padding: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.copy-field {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin: 10px 0;
}
.copy-field input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 12px 10px;
  font-size: 0.82rem;
  color: var(--text);
  border-radius: 0;
  user-select: all;
  -webkit-user-select: all;
}
.copy-field .btn-gold {
  flex-shrink: 0;
  padding: 0 16px;
  white-space: nowrap;
}

.copy-sheet {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.copy-sheet-card {
  width: min(100%, 420px);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 20px 16px;
}
.copy-sheet-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
}
.copy-sheet-input {
  width: 100%;
  margin: 12px 0 16px;
  background: var(--bg);
  border: 1px solid var(--gold-dim);
  padding: 12px 10px;
  font-size: 0.85rem;
  color: var(--text);
  user-select: all;
  -webkit-user-select: all;
}
.copy-sheet-actions {
  display: flex;
  gap: 10px;
}
.copy-sheet-actions .btn-gold,
.copy-sheet-actions .btn-outline {
  flex: 1;
}
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 8px;
}
.quick-actions button {
  padding: 14px 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.quick-actions button:active { color: var(--gold); border-color: var(--gold-dim); }

.challenge-card {
  padding: 14px;
  border-left: 2px solid var(--gold);
  background: var(--bg-elev);
  margin-bottom: 8px;
}
.challenge-card h4 { margin: 0 0 4px; font-weight: 500; }
.challenge-card p { margin: 0; color: var(--muted); font-size: 0.85rem; }

.leaderboard { list-style: none; padding: 0; margin: 0; }
.leaderboard li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.leaderboard .place { color: var(--gold); font-family: var(--font-display); font-size: 1.1rem; }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding: 8px 0;
  margin-bottom: 8px;
}
.chart i {
  flex: 1;
  background: linear-gradient(180deg, var(--gold), rgba(201,168,76,0.2));
  min-height: 4px;
  opacity: 0.85;
  transform-origin: bottom;
  animation: grow 0.6s ease both;
}

.team-node {
  padding: 12px;
  border: 1px solid var(--line);
  margin: 6px 0 6px 0;
  background: var(--bg-elev);
}
.team-node .kids { margin-left: 14px; border-left: 1px solid var(--line); padding-left: 10px; }

.chat-wrap { display: flex; flex-direction: column; height: calc(100dvh - 180px); }
.channels {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: none;
}
.channels button {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
}
.channels button.active { color: var(--gold); border-color: var(--gold-dim); }
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 52vh;
}
.msg {
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  max-width: 92%;
  position: relative;
}
.msg.is-pinned {
  border-color: var(--gold-dim);
  background: rgba(201,168,76,0.06);
}
.msg .who { font-size: 0.72rem; color: var(--gold); margin-bottom: 4px; }
.msg .when { font-size: 0.65rem; color: var(--muted); margin-top: 6px; }
.msg-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.msg-actions { display: flex; gap: 4px; }
.msg-act {
  font-size: 0.78rem;
  opacity: 0.7;
  padding: 2px 6px;
  color: var(--muted);
}
.msg-act:hover { opacity: 1; color: var(--text); }
.msg-act.danger:hover { color: var(--danger); }
.pin-tag {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}
.msg-atts { margin-top: 8px; }
.msg-img-btn {
  display: block;
  padding: 0;
  width: 100%;
  text-align: left;
}
.msg-img {
  display: block;
  max-width: 100%;
  max-height: 220px;
  width: 100%;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.msg-file {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--gold);
}
.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.media-viewer-card {
  width: min(100%, 520px);
  max-height: 92dvh;
  overflow: auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 12px;
}
.media-viewer-img {
  display: block;
  width: 100%;
  max-height: 70dvh;
  object-fit: contain;
  background: #111;
}
.media-viewer-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.media-viewer-actions .btn-gold,
.media-viewer-actions .btn-outline {
  flex: 1;
}
.chat-toolbar { padding: 0 0 8px; }
.chat-toolbar input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  outline: none;
}
.chat-toolbar input:focus { border-color: var(--gold-dim); }
.chat-compose {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.chat-compose-main { flex: 1; min-width: 0; }
.chat-compose input {
  width: 100%;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.chat-compose > button {
  padding: 0 16px;
  height: 42px;
  background: var(--gold);
  color: #0a0a0a;
  font-weight: 600;
  font-size: 0.75rem;
}
.chat-attach {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  color: var(--gold);
  font-size: 1.2rem;
  flex-shrink: 0;
  cursor: pointer;
}
.chat-file-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}
.chat-file-preview img {
  max-height: 48px;
  max-width: 72px;
  object-fit: cover;
  border: 1px solid var(--line);
}
.chat-file-preview button {
  background: transparent;
  color: var(--danger);
  padding: 0 6px;
  font-size: 1rem;
}

.idea {
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  margin-bottom: 10px;
}
.idea h4 { margin: 0 0 6px; font-weight: 500; }
.idea p { margin: 0 0 10px; color: var(--muted); font-size: 0.88rem; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-pill {
  padding: 6px 10px;
  border: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 16px + var(--safe-b));
  transform: translateX(-50%) translateY(12px);
  background: var(--text);
  color: #0a0a0a;
  padding: 10px 16px;
  font-size: 0.82rem;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.notif-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.notif-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 70vh;
  overflow: auto;
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  padding: 18px 16px calc(24px + var(--safe-b));
}
.notif-sheet h3 { margin: 0 0 12px; font-family: var(--font-display); font-weight: 500; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes grow {
  from { transform: scaleY(0.2); opacity: 0.4; }
  to { transform: none; opacity: 0.85; }
}

@media (min-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi:nth-child(5) { grid-column: auto; }
  .auth-card { max-width: 420px; margin-left: auto; margin-right: auto; }
}

/* ——— Podium & celebrations ——— */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 20px;
  padding: 0 4px;
}
.podium-slot {
  flex: 1;
  max-width: 110px;
  text-align: center;
  padding: 12px 8px 14px;
  border-radius: 14px 14px 8px 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid var(--line);
  animation: rise 0.5s ease backwards;
}
.podium-slot.podium-1 {
  min-height: 120px;
  background: linear-gradient(180deg, rgba(212,175,55,0.22) 0%, rgba(212,175,55,0.06) 100%);
  border-color: rgba(212,175,55,0.45);
  transform: scale(1.05);
  z-index: 2;
}
.podium-slot.podium-2 { min-height: 96px; animation-delay: 0.08s; }
.podium-slot.podium-3 { min-height: 84px; animation-delay: 0.16s; }
.podium-slot.is-me {
  box-shadow: 0 0 0 2px var(--accent), 0 8px 24px rgba(0,0,0,0.35);
}
.podium-medal { font-size: 1.6rem; line-height: 1; margin-bottom: 6px; }
.podium-slot strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.podium-slot span { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.podium-slot em {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.72rem;
  font-style: normal;
  color: #7dcea0;
  font-weight: 600;
}

.winners-banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(212,175,55,0.15), rgba(255,255,255,0.04));
  border: 1px solid rgba(212,175,55,0.35);
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: center;
}
.winners-banner strong { color: var(--accent); }

.celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.3s ease;
}
.celebration-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  padding: 28px 22px 22px;
  border-radius: 20px;
  text-align: center;
  background: linear-gradient(160deg, #1a1a22 0%, #0d0d12 100%);
  border: 1px solid rgba(212,175,55,0.4);
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  animation: popIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.celebration-emoji { font-size: 3rem; margin-bottom: 8px; }
.celebration-card h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--accent);
}
.celebration-card p { margin: 0 0 18px; font-size: 0.92rem; line-height: 1.5; color: var(--muted); }
.celebration-card .btn { width: 100%; }

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 199;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to { opacity: 1; transform: none; }
}

/* ——— Community tabs ——— */
.community-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  border: 1px solid var(--line);
}
.community-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.community-tab.active {
  background: var(--accent);
  color: #0a0a0c;
}
.community-panel { animation: rise 0.25s ease; }

/* ——— Ideas top 3 ——— */
.idea-card {
  position: relative;
  padding: 14px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}
.idea-card.idea-top {
  border-color: rgba(212,175,55,0.45);
  background: linear-gradient(135deg, rgba(212,175,55,0.08), transparent);
}
.idea-rank {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 1.1rem;
}
.idea-card h4 { margin: 0 0 6px; font-size: 0.95rem; padding-right: 28px; }
.idea-card p { margin: 0 0 10px; font-size: 0.85rem; color: var(--muted); line-height: 1.45; }
.idea-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}
.idea-like {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.idea-like:active { transform: scale(0.95); }
.idea-like.liked { border-color: #e74c3c; color: #e74c3c; }

/* ——— Campaigns ——— */
.campaign-card {
  padding: 16px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}
.campaign-card.joined {
  border-color: rgba(125,206,160,0.5);
  background: linear-gradient(135deg, rgba(125,206,160,0.08), transparent);
}
.campaign-card h4 { margin: 0 0 6px; font-size: 1rem; }
.campaign-card p { margin: 0 0 12px; font-size: 0.85rem; color: var(--muted); line-height: 1.45; }
.campaign-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(125,206,160,0.2);
  color: #7dcea0;
  margin-bottom: 8px;
}

/* ——— Modals ——— */
.app-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(4px);
}
.app-modal {
  width: 100%;
  max-width: 400px;
  padding: 22px 20px;
  border-radius: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  animation: popIn 0.3s ease;
}
.app-modal h3 { margin: 0 0 12px; font-family: var(--font-display); font-size: 1.15rem; }
.app-modal label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.82rem;
  color: var(--muted);
}
.app-modal input,
.app-modal textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
.app-modal textarea { min-height: 88px; resize: vertical; }
.app-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.app-modal-actions .btn { flex: 1; }

/* ——— Notifications clickable ——— */
.notif-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.notif-row:last-child { border-bottom: none; }
.notif-row.unread { font-weight: 600; }
.notif-row:active { opacity: 0.7; }
.notif-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 0.78rem; font-weight: 400; }

/* ——— Chat polish ——— */
.msg-text { word-break: break-word; overflow-wrap: anywhere; }
.msg-bubble { animation: rise 0.2s ease; }

/* ——— Swipe hint ——— */
#main { touch-action: pan-y; }
