:root {
  --bg: #07111f;
  --bg-2: #0a1628;
  --card: #102238;
  --card-2: #14304a;
  --text: #f7fbff;
  --muted: #91a4b9;
  --green: #37e891;
  --green-dim: rgba(55, 232, 145, 0.15);
  --red: #ff5f6d;
  --red-dim: rgba(255, 95, 109, 0.15);
  --border: rgba(145, 164, 185, 0.18);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font-display: "Sora", "Segoe UI", sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --nav-h: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(55, 232, 145, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(255, 95, 109, 0.08), transparent 45%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  line-height: 1.55;
}
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.container { width: min(1100px, calc(100% - 2rem)); margin-inline: auto; }
.container-sm { width: min(560px, calc(100% - 2rem)); margin-inline: auto; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(7, 17, 31, 0.82);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 64px; gap: 1rem;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.15rem; color: var(--text);
  letter-spacing: -0.02em; text-decoration: none;
}
.brand span { color: var(--green); }
.top-actions { display: flex; align-items: center; gap: .65rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 1px solid transparent; border-radius: 999px;
  padding: .75rem 1.25rem; font-weight: 700; cursor: pointer;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--green); color: #042214; box-shadow: 0 10px 30px rgba(55,232,145,.25); }
.btn-primary:hover { background: #4ef0a0; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-danger { background: var(--red); color: #2a0610; }
.btn-danger-outline { background: var(--red-dim); border-color: rgba(255,95,109,.45); color: #ffd6db; }
.btn-block { width: 100%; }
.btn-sm { padding: .45rem .85rem; font-size: .9rem; }

.panel {
  background: linear-gradient(180deg, rgba(20,48,74,.55), rgba(16,34,56,.9));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 1rem; }

.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  display: grid;
  align-items: end;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(7,17,31,.25) 0%, rgba(7,17,31,.92) 70%, var(--bg) 100%),
    radial-gradient(circle at 70% 30%, rgba(55,232,145,.18), transparent 40%),
    url('../images/hero-texture.svg') center/cover;
}
.hero-content {
  position: relative; z-index: 1;
  padding: 4rem 0 5rem;
  max-width: 720px;
  animation: rise .8s ease both;
}
.brand-hero {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  font-weight: 800; letter-spacing: -0.04em; line-height: 1.02;
  margin: 0 0 .85rem;
}
.brand-hero em { font-style: normal; color: var(--green); }
.hero-lead {
  color: var(--muted); font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  max-width: 36ch; margin: 0 0 1.5rem;
}
.hero-ctas { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.free-badge {
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--muted); font-size: .95rem;
  border-left: 3px solid var(--green); padding-left: .75rem;
}

.section { padding: 4rem 0; }
.section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -0.03em; margin: 0 0 .5rem;
}
.section p.lead { color: var(--muted); margin: 0 0 1.5rem; max-width: 50ch; }

.feature-list { display: grid; gap: 1rem; }
@media (min-width: 768px) {
  .feature-list { grid-template-columns: repeat(3, 1fr); }
}
.feature-item h3 { margin: 0 0 .35rem; font-family: var(--font-display); font-size: 1.15rem; }
.feature-item p { margin: 0; color: var(--muted); }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: .4rem; font-weight: 600; }
.form-control {
  width: 100%;
  background: rgba(7,17,31,.55);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .85rem 1rem;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.form-control:focus {
  border-color: rgba(55,232,145,.55);
  box-shadow: 0 0 0 3px rgba(55,232,145,.12);
}
textarea.form-control { min-height: 120px; resize: vertical; }
.help { color: var(--muted); font-size: .88rem; margin-top: .35rem; }
.checkbox { display: flex; align-items: center; gap: .55rem; }

.alert {
  border-radius: 14px; padding: .9rem 1rem; margin-bottom: 1rem;
  border: 1px solid var(--border);
}
.alert-success { background: var(--green-dim); border-color: rgba(55,232,145,.35); }
.alert-error { background: var(--red-dim); border-color: rgba(255,95,109,.35); }

.counter-board {
  text-align: center; padding: 1.5rem 1rem 1.25rem;
  background:
    radial-gradient(600px 200px at 50% 0%, rgba(55,232,145,.16), transparent 60%),
    linear-gradient(180deg, rgba(20,48,74,.7), rgba(16,34,56,.95));
  border: 1px solid var(--border); border-radius: 24px;
  animation: fadeIn .6s ease both;
}
.counter-board .label { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; }
.counter-digits {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem;
  margin: 1rem 0 1.25rem;
}
.digit-box {
  background: rgba(7,17,31,.45); border-radius: 16px; padding: .75rem .25rem;
  border: 1px solid var(--border);
}
.digit-box strong {
  display: block; font-family: var(--font-display);
  font-size: clamp(1.4rem, 5vw, 2.2rem); letter-spacing: -0.03em;
}
.digit-box span { color: var(--muted); font-size: .75rem; }
.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem;
}
@media (min-width: 700px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
.stat-tile {
  background: rgba(7,17,31,.35); border: 1px solid var(--border);
  border-radius: 16px; padding: 1rem;
}
.stat-tile .k { color: var(--muted); font-size: .85rem; }
.stat-tile .v {
  font-family: var(--font-display); font-size: 1.35rem; font-weight: 700;
  color: var(--green); margin-top: .2rem;
}

.mood-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.mood-row label {
  flex: 1; min-width: 52px; text-align: center;
  border: 1px solid var(--border); border-radius: 14px; padding: .65rem .35rem;
  cursor: pointer; background: rgba(7,17,31,.35);
}
.mood-row input { display: none; }
.mood-row input:checked + span,
.mood-row label:has(input:checked) {
  border-color: var(--green); background: var(--green-dim);
}

.post {
  border: 1px solid var(--border); border-radius: 18px;
  padding: 1rem 1.1rem; background: rgba(16,34,56,.75);
  margin-bottom: 1rem; scroll-margin-top: 90px;
}
.post.crisis { border-color: rgba(255,95,109,.45); box-shadow: 0 0 0 1px rgba(255,95,109,.15); }
.post-meta { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .9rem; margin-bottom: .55rem; }
.post-body { white-space: pre-wrap; margin: 0 0 .85rem; }
.reactions { display: flex; flex-wrap: wrap; gap: .35rem; }
.reaction-btn {
  border: 1px solid var(--border); background: rgba(7,17,31,.4);
  border-radius: 999px; padding: .3rem .65rem; cursor: pointer;
}
.reaction-btn.active { border-color: var(--green); background: var(--green-dim); }
.comment-box { margin-top: .85rem; display: flex; gap: .5rem; }
.comment-box .form-control { flex: 1; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(7,17,31,.92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: .35rem .25rem calc(.35rem + var(--safe-bottom));
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  color: var(--muted); font-size: .68rem; font-weight: 600; padding: .4rem .15rem;
  text-decoration: none;
}
.bottom-nav a.active, .bottom-nav a:hover { color: var(--green); }
.bottom-nav .icon { font-size: 1.15rem; line-height: 1; }
.bottom-nav .crisis-link { color: var(--red); }
.bottom-nav .crisis-link.active { color: #ff8a94; }

.page-main { flex: 1; padding: 1.25rem 0 calc(var(--nav-h) + 1.5rem); }
@media (min-width: 960px) {
  .app-with-side { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
  .side-nav {
    position: sticky; top: 0; height: 100vh;
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem; background: rgba(7,17,31,.55);
  }
  .side-nav a {
    display: flex; align-items: center; gap: .65rem;
    padding: .7rem .85rem; border-radius: 12px; color: var(--muted);
    text-decoration: none; margin-bottom: .25rem; font-weight: 600;
  }
  .side-nav a.active, .side-nav a:hover { background: var(--green-dim); color: var(--green); }
  .bottom-nav { display: none; }
  .page-main { padding-bottom: 2rem; }
}

.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0 calc(2rem + var(--safe-bottom));
  color: var(--muted); font-size: .9rem;
}
.footer strong { color: var(--text); }
.disclaimer {
  margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border);
  font-size: .82rem; max-width: 70ch;
}

.timer-ring {
  width: min(220px, 70vw); aspect-ratio: 1; margin: 1rem auto;
  border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at center, rgba(7,17,31,.9) 58%, transparent 59%),
    conic-gradient(var(--green) calc(var(--p, 0) * 1%), rgba(145,164,185,.2) 0);
}
.timer-ring strong { font-family: var(--font-display); font-size: 2rem; }

.badge-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: rgba(55,232,145,.1); border: 1px solid rgba(55,232,145,.25);
  border-radius: 999px; padding: .35rem .7rem; font-size: .85rem; margin: .2rem;
}

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .7rem; border-bottom: 1px solid var(--border); font-size: .92rem; }
.muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; gap: .75rem; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.stack > * + * { margin-top: .75rem; }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
