/* E~Sphere — identical theme to the app and the plan page.
   White ground, deep forest green writing, sky blue accents, red plasma,
   green lightning logo, futuristic layer: grid, glass header, orbit ring,
   live-sync pulse, mono HUD readouts. */
:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #EFF7FA;
  --ink: #0B3B2C;
  --ink-2: #33594A;
  --ink-3: #5C7A68;
  --line: #D8E9F0;
  --sky: #1B9BD8;
  --sky-strong: #0A6EAD;
  --sky-soft: #E1F2FB;
  --plasma: #E5322D;
  --plasma-soft: #FDEAE8;
  --green: #1C7A43;
  --green-soft: #E0F3E6;
  --chip-bg: #EFF7FA;
  --shadow: 0 1px 2px rgba(11,59,44,.07), 0 8px 24px rgba(11,59,44,.07);
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image:
    linear-gradient(rgba(27,155,216,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27,155,216,.05) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  font: 16px/1.55 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--sky-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--ink); line-height: 1.25; margin: 0 0 .5em; }
p { margin: 0 0 .75em; }
small, .muted { color: var(--ink-3); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; letter-spacing: .04em; }

/* Glass header */
header.site {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.navwrap { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--ink); }
.brand img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #fff; }
.brand span { letter-spacing: .02em; }
nav.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
nav.tabs a {
  padding: 7px 12px; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: 14px;
  border: 1px solid transparent;
}
nav.tabs a:hover { text-decoration: none; background: var(--sky-soft); }
nav.tabs a.active { background: var(--sky-strong); color: #fff; }
.me-chip { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.me-chip button { cursor: pointer; }

main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 80px; }

/* HUD strip + live sync */
.hud {
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--radius); padding: 8px 14px; margin-bottom: 16px;
  color: var(--ink-2);
}
.pulse { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink); }
.pulse::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--plasma);
  box-shadow: 0 0 0 0 rgba(229,50,45,.5); animation: pulse 2s infinite;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229,50,45,.45); } 70% { box-shadow: 0 0 0 9px rgba(229,50,45,0); } 100% { box-shadow: 0 0 0 0 rgba(229,50,45,0); } }
@media (prefers-reduced-motion: reduce) { .pulse::before, .satellite { animation: none !important; } }

/* Hero with orbit ring */
.hero { text-align: center; padding: 26px 0 8px; }
.orbit-wrap { position: relative; width: 190px; height: 190px; margin: 0 auto 10px; }
.orbit-wrap img.logo { width: 190px; height: 190px; border-radius: 50%; object-fit: cover; background: #fff; }
.orbit-ring {
  position: absolute; inset: -14px; border-radius: 50%;
  border: 1px solid rgba(27,155,216,.35);
  animation: spin 24s linear infinite;
}
.satellite {
  position: absolute; top: -6px; left: 50%; width: 12px; height: 12px; margin-left: -6px;
  border-radius: 50%; background: var(--plasma);
  box-shadow: 0 0 12px 3px rgba(229,50,45,.55);
}
@keyframes spin { to { transform: rotate(360deg); } }
.hero h1 { font-size: 34px; margin: 6px 0 4px; }
.hero .tag { color: var(--ink-2); font-size: 17px; }

/* Status banner (honest backend state) */
.status {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin: 16px 0; background: var(--surface-2);
}
.status.ok { background: var(--green-soft); border-color: #BFE3CC; }
.status.wait { background: #FFF8E6; border-color: #F2D98C; }
.status h3 { margin: 0 0 4px; font-size: 15px; }
.status p { margin: 0; color: var(--ink-2); font-size: 14px; }

/* Pulse totals */
.pulse-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 16px 0;
}
.pulse-cell { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); padding: 12px; text-align: center; }
.pulse-cell b { display: block; font-size: 24px; color: var(--ink); }
.pulse-cell span { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }

/* Profile pictures */
.avatar { border-radius: 50%; object-fit: cover; background: var(--sky-soft); flex: none; }
.avatar-ph { display: inline-flex; align-items: center; justify-content: center; background: var(--sky-strong); color: #fff; font-weight: 800; }

/* Private messaging */
.msg-badge { background: var(--plasma); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 12px; font-weight: 800; }
.msg-row { cursor: pointer; }
.msg-row:hover { background: var(--surface-2); }
.msg-list { display: flex; flex-direction: column; gap: 4px; }
.msg { max-width: 78%; padding: 9px 13px; border-radius: 14px; margin: 6px 0; white-space: pre-wrap; word-wrap: break-word; }
.msg.mine { margin-left: auto; background: var(--sky-strong); color: #fff; }
.msg.theirs { background: var(--surface-2); border: 1px solid var(--line); }
.msg .msg-time { display: block; font-size: 11px; margin-top: 4px; opacity: .75; }
.msg-composer { display: flex; gap: 8px; margin-top: 12px; }
.msg-composer textarea { flex: 1; min-height: 48px; }
.post-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.me-chip .avatar { vertical-align: middle; }

/* Cards, posts */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
.post-head b { color: var(--ink); }
.post-head .handle { color: var(--ink-3); font-size: 14px; }
.post-head time { color: var(--ink-3); font-size: 13px; margin-left: auto; }
.edited { font-size: 12px; color: var(--ink-3); font-style: italic; }
.post-body { white-space: pre-wrap; word-wrap: break-word; margin: 8px 0; }
.post-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 8px 0; }
.post-photos img { width: 100%; border-radius: 10px; display: block; }
audio { width: 100%; margin: 8px 0; }
.post-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.post-actions button { cursor: pointer; }

/* Buttons, inputs */
button, .btn {
  font: inherit; font-weight: 600; color: var(--sky-strong);
  background: #fff; border: 1px solid var(--sky); border-radius: 999px; padding: 7px 14px;
}
button:hover, .btn:hover { background: var(--sky-soft); }
button.primary, .btn.primary { background: var(--sky-strong); color: #fff; border-color: var(--sky-strong); }
button.primary:hover { background: var(--sky); }
button.danger { color: var(--plasma); border-color: var(--plasma); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.on { background: var(--plasma); border-color: var(--plasma); color: #fff; }
input, textarea, select {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--sky); outline-offset: 1px; }
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 4px; color: var(--ink-2); }
textarea { min-height: 90px; resize: vertical; }

/* Views, chips, grids */
.viewbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.chip {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--chip-bg); color: var(--ink-2); font-weight: 600; font-size: 14px; cursor: pointer;
}
.chip.active { background: var(--sky-strong); color: #fff; border-color: var(--sky-strong); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.land { cursor: pointer; }
.land h3 { margin-bottom: 2px; }
.land .counts { color: var(--ink-3); font-size: 14px; }
.empty { text-align: center; color: var(--ink-3); padding: 34px 12px; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty img { width: 110px; height: 110px; border-radius: 50%; opacity: .9; display: block; margin: 0 auto 12px; }
footer.site { border-top: 1px solid var(--line); padding: 22px 16px 40px; text-align: center; color: var(--ink-3); font-size: 14px; }
footer.site img { width: 34px; height: 34px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }
footer.site a { margin: 0 8px; }
.err { color: var(--plasma); font-weight: 600; }
.ledger { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--surface-2); margin-bottom: 14px; }
.ledger b { font-size: 20px; }

/* 1:1 voice and video calls — full-screen overlay over the app */
.call-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(11,59,44,.96); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 20px; text-align: center;
}
.call-overlay h2 { color: #fff; margin: 0; }
.call-overlay .muted { color: rgba(255,255,255,.75); }
.call-stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 760px; width: 100%; }
.call-remote { width: min(92vw, 680px); aspect-ratio: 4/3; background: #06231A; border-radius: var(--radius); object-fit: cover; }
.call-local {
  width: 120px; aspect-ratio: 4/3; background: #06231A; border-radius: 10px; object-fit: cover;
  position: absolute; right: 8px; bottom: 92px; border: 2px solid rgba(255,255,255,.7);
}
.call-controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.call-controls button { min-width: 96px; }
.call-controls .danger { background: var(--plasma); color: #fff; border-color: var(--plasma); }
.call-duration { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 18px; }
.call-overlay .avatar-ph { font-size: 48px; }
