:root {
  --bg: #07111f;
  --bg-soft: rgba(9, 19, 36, 0.82);
  --panel: rgba(15, 28, 50, 0.78);
  --text: #f4f7fb;
  --muted: #9fb0c9;
  --line: rgba(173, 197, 230, 0.15);
  --accent: #5ce1b6;
  --accent-strong: #1dd1a1;
  --accent-warm: #ffcf70;
  --leader: #ff8f5a;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(92, 225, 182, 0.18), transparent 28%),
    radial-gradient(circle at 85% 15%, rgba(255, 143, 90, 0.2), transparent 24%),
    linear-gradient(160deg, #050a13 0%, #08111f 45%, #0b1730 100%);
  color: var(--text);
}

body.leader-mode {
  background:
    radial-gradient(circle at top left, rgba(255, 143, 90, 0.22), transparent 30%),
    radial-gradient(circle at 88% 18%, rgba(255, 207, 112, 0.2), transparent 25%),
    linear-gradient(165deg, #190d08 0%, #231117 42%, #321f18 100%);
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.page-shell { position: relative; overflow: hidden; }

.ambient {
  position: fixed;
  width: 38rem;
  height: 38rem;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.3;
  pointer-events: none;
}

.ambient-one {
  top: -10rem;
  left: -12rem;
  background: #46dcb1;
  animation: drift 14s ease-in-out infinite;
}

.ambient-two {
  right: -14rem;
  top: 10rem;
  background: #ff9351;
  animation: drift 18s ease-in-out infinite reverse;
}

.topbar, main {
  width: min(1440px, calc(100% - 3rem));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark {
  width: 2.9rem;
  height: 2.9rem;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(92, 225, 182, 0.9), rgba(29, 209, 161, 0.4));
  color: #05261e;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  box-shadow: 0 15px 40px rgba(24, 209, 161, 0.25);
}

body.leader-mode .brand-mark {
  background: linear-gradient(135deg, rgba(255, 143, 90, 0.9), rgba(255, 207, 112, 0.46));
  color: #311104;
}

.brand strong, h1, h2, h3 { font-family: "Space Grotesk", sans-serif; }
.brand small { display: block; color: var(--muted); margin-top: 0.12rem; }

.topbar-actions, .hero-actions, .section-heading {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.primary-button, .ghost-button {
  border: 1px solid var(--line);
  padding: 0.9rem 1.2rem;
  border-radius: 999px;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #072319;
  font-weight: 800;
  border: none;
  box-shadow: 0 14px 30px rgba(29, 209, 161, 0.25);
}

body.leader-mode .primary-button {
  background: linear-gradient(135deg, var(--leader), var(--accent-warm));
  color: #301206;
  box-shadow: 0 14px 30px rgba(255, 143, 90, 0.25);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.primary-button:hover, .ghost-button:hover, .primary-button:focus-visible, .ghost-button:focus-visible, .close-button:hover, .close-button:focus-visible {
  transform: translateY(-2px);
}

main { padding: 3.6rem 0 6rem; }

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: center;
  padding: 4rem 0 2.4rem;
}

.hero h1 {
  font-size: clamp(3rem, 7vw, 5.8rem);
  line-height: 0.95;
  margin: 0.6rem 0 1rem;
  max-width: 12ch;
}

.hero-text, .feature-card p, .role-card p, .section-note, .helper-text, .modal-copy, .empty-state p, .accounts-list p, .resource-meta, .post-meta {
  color: var(--muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  color: var(--accent-warm);
  margin: 0;
}

body.leader-mode .eyebrow { color: #ffd7a6; }

.hero-panel, .panel, .modal-card, .hero-card, .leader-banner {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.hero-card, .panel, .leader-banner, .modal-card { border-radius: var(--radius); }
.hero-card, .panel { padding: 1.6rem; }
.floating-card { animation: float 5s ease-in-out infinite; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.status-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(92, 225, 182, 0.6);
  animation: pulse 1.8s infinite;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin: 1.2rem 0;
}

.stats-grid article, .session-card, .feature-card, .role-card, .forum-card, .resource-card, .empty-state, .account-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 18px;
}

.stats-grid article { padding: 1rem; }
.stats-grid strong { display: block; font-size: 2rem; margin-bottom: 0.35rem; }
.session-card { padding: 1rem; }

.content-grid, .leader-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.wide, .section, .leader-banner { margin-top: 1.5rem; }

.feature-grid, .role-list, .forum-grid, .resources-grid, .accounts-list {
  display: grid;
  gap: 1rem;
}

.feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.forum-grid, .resources-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  margin-top: 1.2rem;
}

.feature-card, .role-card, .forum-card, .resource-card, .empty-state, .account-card { padding: 1.1rem; }
.feature-card, .role-card, .forum-card, .resource-card, .empty-state, .account-card { min-height: 100%; }
.leader-card { border-color: rgba(255, 143, 90, 0.35); }

.stack-form {
  display: grid;
  gap: 0.9rem;
}

.form-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0 1.2rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.inline-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.stack-form label {
  display: grid;
  gap: 0.45rem;
  font-weight: 600;
}

.stack-form input, .stack-form textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  padding: 0.95rem 1rem;
  resize: vertical;
}

.stack-form input:focus, .stack-form textarea:focus {
  outline: 2px solid rgba(92, 225, 182, 0.25);
  border-color: rgba(92, 225, 182, 0.42);
}

body.leader-mode .stack-form input:focus, body.leader-mode .stack-form textarea:focus {
  outline-color: rgba(255, 143, 90, 0.25);
  border-color: rgba(255, 143, 90, 0.42);
}

.search-bar {
  margin-top: 1rem;
}

.search-bar input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  padding: 1rem 1.05rem;
}

.search-bar input:focus {
  outline: 2px solid rgba(92, 225, 182, 0.25);
  border-color: rgba(92, 225, 182, 0.42);
}

body.leader-mode .search-bar input:focus {
  outline-color: rgba(255, 143, 90, 0.25);
  border-color: rgba(255, 143, 90, 0.42);
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
}

.native-file-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.file-trigger {
  white-space: nowrap;
}

.file-name {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-section.hidden, .modal.hidden { display: none; }

.leader-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem;
  background: linear-gradient(135deg, rgba(255, 143, 90, 0.18), rgba(255, 207, 112, 0.1));
}

.leader-logout { align-self: flex-start; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 13, 0.68);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  width: min(480px, calc(100% - 1.4rem));
  margin: 6vh auto 0;
  padding: 1.4rem;
}

.close-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.3rem;
  height: 2.3rem;
  border: none;
  border-radius: 50%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-size: 1.4rem;
}

.helper-text { min-height: 1.25rem; margin: 0.2rem 0 0; }
.helper-text.success { color: var(--accent); }
.helper-text.error { color: #ff7d7d; }
.profile-card {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.forum-card h3, .resource-card h3 { margin-top: 0; margin-bottom: 0.6rem; }

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.2rem;
  margin-bottom: 1.2rem;
}

.tag {
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.85rem;
}

.download-link {
  display: inline-flex;
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 999px;
  background: rgba(92, 225, 182, 0.14);
  border: 1px solid rgba(92, 225, 182, 0.22);
}

body.leader-mode .download-link {
  background: rgba(255, 143, 90, 0.14);
  border-color: rgba(255, 143, 90, 0.22);
}

.danger-button {
  background: rgba(255, 82, 82, 0.14);
  color: #ffd4d4;
  border: 1px solid rgba(255, 82, 82, 0.28);
}

.reaction-button {
  position: relative;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.reaction-button::after {
  content: "";
  position: absolute;
  inset: auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
}

.reaction-button:hover,
.reaction-button:focus-visible {
  transform: translateY(-2px) scale(1.02);
}

.like-button {
  border-color: rgba(255, 99, 132, 0.24);
}

.like-button.active {
  background: rgba(255, 72, 106, 0.14);
  color: #ffd4dd;
  border-color: rgba(255, 72, 106, 0.36);
  box-shadow: 0 12px 24px rgba(255, 72, 106, 0.14);
}

.like-button.active .reaction-icon {
  animation: heartBeat 520ms ease;
}

.favorite-button {
  border-color: rgba(255, 205, 86, 0.24);
}

.favorite-button.active {
  background: rgba(255, 205, 86, 0.16);
  color: #ffe7a3;
  border-color: rgba(255, 205, 86, 0.4);
  box-shadow: 0 12px 24px rgba(255, 205, 86, 0.14);
}

.favorite-button.active .reaction-icon {
  animation: starPop 520ms ease;
}

.reaction-icon {
  display: inline-flex;
  margin-right: 0.45rem;
}

@keyframes heartBeat {
  0% { transform: scale(1); }
  30% { transform: scale(1.28); }
  55% { transform: scale(0.94); }
  100% { transform: scale(1); }
}

@keyframes starPop {
  0% { transform: scale(1) rotate(0deg); }
  35% { transform: scale(1.28) rotate(12deg); }
  70% { transform: scale(0.95) rotate(-8deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.hidden { display: none; }
.reveal { opacity: 0; transform: translateY(18px); animation: reveal 0.9s ease forwards; }
.delay-1 { animation-delay: 120ms; }
.delay-2 { animation-delay: 220ms; }

@keyframes reveal {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(40px, 24px); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(92, 225, 182, 0.55); }
  70% { box-shadow: 0 0 0 14px rgba(92, 225, 182, 0); }
  100% { box-shadow: 0 0 0 0 rgba(92, 225, 182, 0); }
}

@media (max-width: 900px) {
  .hero, .content-grid, .leader-tools, .feature-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar, main { width: min(100%, calc(100% - 1.2rem)); }
  .topbar-actions { width: 100%; }
  .topbar-actions button { flex: 1; }
  .hero h1 { max-width: none; }
  .leader-banner { align-items: flex-start; flex-direction: column; }
}
