:root {
  --gap: 12px;
  --radius: 14px;
  --emergency: #c0392b;
  --emergency-hi: #e04434;
  --rejection: #e67e22;
  --rejection-hi: #f28c33;
  --depression: #8e44ad;
  --depression-hi: #a259c4;
  --relapsed: #16a085;
  --relapsed-hi: #1abc9c;
  --bg: #10141a;
  --fg: #f4f6f8;
  --muted: #9aa4b2;
  --card: #1a212b;
  --border: #2b3442;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- Landing (3a mobile stack + responsive web layout) ---------- */

@keyframes sosGlow {
  0%, 100% { box-shadow: 0 12px 26px rgba(0,0,0,.4), 0 0 0 0 rgba(255,96,84,0); }
  50%      { box-shadow: 0 12px 26px rgba(0,0,0,.4), 0 0 36px 3px rgba(255,96,84,.55); }
}
@keyframes sosGlowInset {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(255,120,110,0); }
  50%      { box-shadow: inset 0 0 90px 0 rgba(255,150,140,.35); }
}

.landing {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #0c0c0f;
  font-family: 'Instrument Sans', system-ui, sans-serif;
}

/* Mobile: phone-width full-bleed column, centered; sides fall back to dark bg. */
.stack {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
}
/* Mobile: the three cards behave as direct stack items (flush vertical blocks). */
.cat-row { display: contents; }

/* Non-urgent states: flush color blocks, icon + title + one-line subtitle. */
.cat-btn {
  flex: 1;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 26px;
  text-align: left;
  font-family: 'Bricolage Grotesque', system-ui, sans-serif;
  transition: filter .16s ease, background .16s ease;
}
.cat-btn:hover { filter: brightness(1.07); }
.cat-btn:disabled, .cat-btn.is-loading { filter: brightness(0.85); cursor: pointer !important; }
.cat-btn:focus-visible { outline: 3px solid #fff; outline-offset: -4px; }

.cat-icon { flex-shrink: 0; }
.cat-text { display: flex; flex-direction: column; gap: 2px; }
.cat-title { font-weight: 800; font-size: 26px; letter-spacing: .04em; }
.cat-sub {
  font-family: 'Instrument Sans', system-ui, sans-serif;
  font-weight: 500;
  font-size: 14px;
  opacity: .9;
}

.btn-rejection  { background: #25AE5F; }
.btn-depression { background: #2980B9; }
.btn-relapsed   { background: #9854B4; }

/* First block clears the top notch / status bar. */
.btn-rejection { padding-top: max(24px, env(safe-area-inset-top)); }

/* Emergency: bottom of the thumb zone, larger, centered, gently pulsing.
   Softer red at rest, pure #FF0201 on hover/press. */
.btn-emergency {
  flex: 1.55;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-align: center;
  background: #e74c3c;
  position: relative;
  z-index: 1;
  animation: sosGlow 2.6s ease-in-out infinite;
}
.btn-emergency:hover { filter: none; background: #FF0201; }
.btn-emergency:focus-visible { outline-offset: -5px; }
.cat-emergency-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.btn-emergency .cat-title { font-size: 40px; letter-spacing: .06em; line-height: 1; }
.btn-emergency .cat-sub { font-size: 15px; opacity: .95; }

/* Suggest a link: quiet dark footer bar (mobile). */
.suggest-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 0;
  padding-bottom: max(30px, env(safe-area-inset-bottom));
  background: #141418;
  color: #8b8b96;
  font-family: 'Instrument Sans', system-ui, sans-serif;
  font-weight: 500;
  font-size: 13px;
  text-decoration: none;
}
.suggest-link:hover { color: #fff; }
.suggest-link:focus-visible { outline: 2px solid #6b6b76; outline-offset: -3px; }

/* Status: transient pill overlaid at the top; hidden when empty. */
#status {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(0,0,0,.78);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-family: 'Instrument Sans', system-ui, sans-serif;
  font-size: 13px;
}
#status:empty { display: none; }
#status.error { background: rgba(200,40,30,.92); }

/* Web (wide screens): three cards across the top, full-width Emergency bar
   below, suggest link floats as a top-right pill. */
@media (min-width: 720px) {
  .stack { max-width: none; }

  .cat-row { display: flex; flex-flow: row wrap; flex: 1 1 auto; }

  .cat-btn {
    flex: 1 1 240px;
    min-height: clamp(170px, 26vh, 360px);
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    padding: 44px 28px;
    text-align: center;
  }
  .cat-btn:focus-visible { outline: 4px solid #fff; outline-offset: -7px; }
  .cat-text { align-items: center; gap: 8px; }
  .cat-icon { width: clamp(34px, 3.2vw, 54px); height: clamp(34px, 3.2vw, 54px); }
  .cat-title { font-size: clamp(30px, 3.4vw, 56px); letter-spacing: .02em; line-height: 1; }
  .cat-sub { font-size: clamp(14px, 1.2vw, 20px); opacity: .92; }
  .btn-rejection { padding-top: 44px; } /* no notch on desktop */

  .btn-emergency {
    flex: 1.3 1 auto;
    min-height: clamp(280px, 48vh, 600px);
    flex-direction: column;
    gap: clamp(12px, 1.6vw, 22px);
    padding: 48px 28px;
    animation: sosGlowInset 2.8s ease-in-out infinite;
  }
  .btn-emergency:focus-visible { outline: 5px solid #fff; outline-offset: -10px; }
  .cat-emergency-head {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(16px, 2.2vw, 36px);
  }
  .btn-emergency .cat-icon { width: clamp(52px, 6vw, 116px); height: clamp(52px, 6vw, 116px); }
  .btn-emergency .cat-title { font-size: clamp(54px, 9vw, 158px); letter-spacing: .01em; line-height: .92; }
  .btn-emergency .cat-sub {
    font-size: clamp(16px, 1.5vw, 25px);
    max-width: 34ch;
    margin: 0 auto;
  }

  .suggest-link {
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 20;
    width: auto;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(18,18,24,0.66);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #d3d3da;
    font-size: 14px;
    border: 1px solid rgba(255,255,255,0.14);
    white-space: nowrap;
  }
  .suggest-link:hover { background: rgba(32,32,40,0.92); color: #fff; }
}

/* ---------------- Forms (suggestor / admin) ---------------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  flex-wrap: wrap;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 20px;
}
.wrap.wide { max-width: 860px; }

h1 { font-size: 1.6rem; margin: 0 0 8px; }
p.lead { color: var(--muted); margin: 0 0 24px; line-height: 1.5; }

label { display: block; font-weight: 600; margin: 16px 0 6px; }
input[type="url"], input[type="email"], input[type="password"], textarea, select {
  width: 100%;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--relapsed-hi); border-color: transparent; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--relapsed);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 20px;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.secondary { background: var(--card); border: 1px solid var(--border); }
.btn.danger { background: var(--emergency); }
.btn.small { padding: 7px 12px; font-size: 0.85rem; margin-top: 0; }

.msg { margin-top: 16px; min-height: 1.2em; font-size: 0.95rem; }
.msg.ok { color: #7bed9f; }
.msg.error { color: #ff8a80; }

.back { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.back:hover { color: var(--fg); }

/* ---------------- Admin table ---------------- */

table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 0.92rem; }
th { color: var(--muted); font-weight: 600; }
td.url { word-break: break-all; }
td a { color: var(--relapsed-hi); }
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hidden { display: none; }
