/* app.css — Spica's "on the go" phone app, served from the relay Worker.
   Self-contained: no external fonts, no CDN, no @import. The page's Content-Security-Policy
   (style-src 'self') forbids inline styles, so every rule the app needs lives here. Dark, one column,
   big taps, legible outdoors — the same visual language as the desktop companion, but standing alone. */

:root {
  --bg: #04060e;
  --bg2: #070b16;
  --card: rgba(16, 22, 40, 0.92);
  --card2: rgba(22, 30, 52, 0.72);
  --stroke: rgba(120, 165, 255, 0.16);
  --stroke2: rgba(130, 205, 255, 0.4);
  --text: #eef2fb;
  --muted: #9aa6c8;
  --faint: #6b7899;
  --cyan: #22d3ee;
  --green: #34d399;
  --gold: #f5c542;
  --red: #fb3b5c;
  --orange: #fb923c;
  --silver: linear-gradient(135deg, #ffffff 0%, #dbe0ea 38%, #9aa3b4 68%, #f0f4fb 100%);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body {
  background:
    radial-gradient(70% 40% at 50% -5%, rgba(34, 211, 238, 0.1), transparent 70%),
    radial-gradient(60% 40% at 90% 100%, rgba(225, 31, 38, 0.08), transparent 70%),
    var(--bg);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  /* Fill the whole screen so the background never stops short and leaves a seam above the bottom
     edge on a short page (seen in the 2026-10-09 screenshots). */
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
}

.wrap { max-width: 620px; margin: 0 auto; padding: 16px 16px 40px; }
.center { min-height: 84vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.hide { display: none !important; }

/* ---- orb + headings (shared with the pairing/no-room screens) ---- */
.orb {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 50% 40%, #eafcff 0%, #22d3ee 45%, #1f6feb 100%);
  box-shadow: 0 0 20px 2px rgba(34, 211, 238, 0.45);
}
.orb.big { width: 76px; height: 76px; margin: 0 auto 22px; box-shadow: 0 0 50px 6px rgba(34, 211, 238, 0.4); }
.orb.pulse { animation: float 6s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.center h1 {
  font-size: 16px; letter-spacing: 4px; text-transform: uppercase; margin: 0 0 8px;
  background: var(--silver); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.lead { color: var(--muted); font-size: 15px; margin: 0 auto 20px; max-width: 34ch; }

.explain {
  background: rgba(34, 211, 238, 0.05); border: 1px solid var(--stroke); border-left: 2px solid var(--cyan);
  border-radius: 12px; padding: 14px 16px; margin: 8px 0; font-size: 14px; line-height: 1.6; color: #d4ddf5;
  text-align: left; max-width: 40ch;
}
.explain b { color: #fff; }

/* ---- pairing code: the thing the human eyeballs ---- */
.codebox { margin-top: 28px; }
.codelabel { font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 10px; }
.paircode {
  font-family: var(--mono); font-size: 46px; font-weight: 800; letter-spacing: 8px; color: #fff;
  background: var(--bg2); border: 1px solid var(--stroke2); border-radius: 16px; padding: 18px 14px;
  box-shadow: 0 0 30px -10px var(--cyan); display: inline-block; min-width: 240px;
}
.codehint { color: var(--faint); font-size: 12.5px; margin-top: 12px; max-width: 34ch; line-height: 1.6; }

/* ---- header ---- */
.appbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 4px 18px;
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(180deg, var(--bg) 60%, transparent);
}
.appbar .title {
  font-weight: 800; letter-spacing: 3px; font-size: 15px; text-transform: uppercase;
  background: var(--silver); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.appbar .sub { font-size: 11px; color: var(--faint); letter-spacing: 1px; text-transform: uppercase; }
.appbar .spacer { flex: 1; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--green); box-shadow: 0 0 10px var(--green); }
.dot.warn { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.dot.bad { background: var(--red); box-shadow: 0 0 10px var(--red); }

/* ---- offline banner ---- */
.banner {
  background: rgba(251, 59, 92, 0.1); border: 1px solid rgba(251, 59, 92, 0.4); color: #ffd7de;
  border-radius: 12px; padding: 11px 14px; margin-bottom: 14px; font-size: 14px; font-weight: 600;
}

.updated { text-align: center; color: var(--faint); font-size: 11.5px; font-family: var(--mono); margin: 2px 0 16px; }

/* ---- cards ---- */
.card {
  background: var(--card); border: 1px solid var(--stroke); border-radius: 18px; padding: 18px;
  margin-bottom: 14px; backdrop-filter: blur(10px); box-shadow: 0 20px 50px -30px rgba(0, 0, 0, 0.8);
}
.card h2 {
  margin: 0 0 12px; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--faint);
  display: flex; align-items: center; gap: 8px;
}
.card h2 .count {
  margin-left: auto; font-size: 12px; color: var(--muted); background: var(--card2);
  border: 1px solid var(--stroke); border-radius: 20px; padding: 2px 10px; letter-spacing: 0;
}

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card2); border: 1px solid var(--stroke); border-radius: 14px; padding: 14px 10px; text-align: center; }
.stat .n { font-size: 26px; font-weight: 800; font-family: var(--mono); }
.stat .n.good { color: var(--green); }
.stat .n.bad { color: var(--red); }
.stat .n.gold { color: var(--gold); }
.stat .l { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }

.row { display: flex; align-items: flex-start; gap: 12px; padding: 13px 2px; border-top: 1px solid var(--stroke); }
.row:first-of-type { border-top: none; }
.row .rdot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--faint); }
.row .rdot.ok { background: var(--green); }
.row .rdot.bad { background: var(--red); }
.row .rdot.warn { background: var(--gold); }
.row .rdot.run { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.row .body { flex: 1; min-width: 0; }
.row .body .t { font-size: 15px; font-weight: 600; }
.row .body .d { font-size: 13px; color: var(--muted); margin-top: 2px; word-break: break-word; }
.row .body .meta { font-size: 11.5px; color: var(--faint); margin-top: 4px; font-family: var(--mono); }
.row .when { font-size: 11.5px; color: var(--faint); font-family: var(--mono); white-space: nowrap; }

.action { border-left: 3px solid var(--orange); }
.action .row .rdot.bad { background: var(--orange); }

.empty { color: var(--faint); font-size: 14px; padding: 8px 2px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 14px 18px; border: none; border-radius: 14px;
  font-family: var(--sans); font-size: 16px; font-weight: 700; cursor: pointer; transition: filter 0.15s, transform 0.05s;
  /* The primary look. Every button here used .ghost until the entry gate needed a real primary, so
     the base rule carried no fill at all — a primary button rendered as invisible text. */
  background: linear-gradient(100deg, #8be9ff, #22d3ee 55%, #6d8cf0);
  color: #04101a; text-decoration: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(0.985); }
.btn.ghost { background: var(--card2); border: 1px solid var(--stroke2); color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-row { display: flex; gap: 10px; margin-top: 8px; }
.btn-row .btn { width: auto; flex: 1; }

.footnote { text-align: center; color: var(--faint); font-size: 12.5px; margin-top: 20px; line-height: 1.6; }

/* ---- entry gate: sign in, or start an account ---- */
/* Sized for a thumb: full-width targets, stacked, nothing to hunt for. The gate is the first thing a
   store install shows, so it has to be readable at a glance and honest about needing the desktop. */
.gate-btns { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 340px; margin: 0 auto 18px; }
.gate-steps {
  text-align: left; max-width: 340px; margin: 0 auto 16px; padding-left: 22px;
  color: var(--muted); font-size: 14.5px; line-height: 1.65;
}
.gate-steps li { margin-bottom: 6px; }
.gate-steps b { color: #fff; }
.gate-input {
  width: 100%; max-width: 340px; margin: 0 auto 10px; display: block;
  background: var(--card2); border: 1px solid var(--stroke2); border-radius: 12px;
  padding: 14px 16px; color: var(--text); font-family: var(--sans); font-size: 15px; outline: none;
}
.gate-input:focus { border-color: rgba(34, 211, 238, 0.55); }
.gate-err { max-width: 340px; margin: 0 auto 10px; color: var(--orange); font-size: 13.5px; min-height: 18px; line-height: 1.5; }
#gateSignIn .btn, #gateSignUp .btn { max-width: 340px; margin: 0 auto; }
.gate-back {
  display: block; margin: 16px auto 0; background: none; border: none; cursor: pointer;
  color: var(--faint); font-family: var(--sans); font-size: 14px; text-decoration: underline;
}
.gate-back:active { color: var(--muted); }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: #0c1428; border: 1px solid var(--stroke2); color: var(--text);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 50; max-width: 90vw; text-align: center;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.9);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- 2026-10-09 polish pass ---------------------------------------------------------------- */

.tm { font-size: 0.55em; vertical-align: super; margin-left: 1px; letter-spacing: 0; -webkit-text-fill-color: currentColor; color: var(--muted); }

/* Replaces an inline style the strict style-src 'self' CSP was rejecting (a console error on every load). */
.explain.gate-gap { margin-bottom: 18px; }

/* The sticky header clears the notch in standalone mode (black-translucent status bar). */
.appbar { margin-top: calc(-1 * env(safe-area-inset-top)); padding-top: calc(10px + env(safe-area-inset-top)); }

/* "Can't reach your computer": calm amber, a title and a line, not a red error wall. */
.banner {
  background: linear-gradient(180deg, rgba(245, 197, 66, 0.10), rgba(245, 197, 66, 0.04));
  border: 1px solid rgba(245, 197, 66, 0.38); color: #ffe6a6; font-weight: 400; padding: 13px 16px;
}
.banner .bn-title { font-size: 15px; font-weight: 700; }
.banner .bn-text { font-size: 13px; color: #d9cfae; margin-top: 2px; line-height: 1.5; }
.brief-body { transition: opacity 0.25s; }
.brief-body.stale { opacity: 0.55; filter: saturate(0.6); }

/* Remind me: queues a note on the desktop, applies nothing. 44px tall like every tap target here. */
.qbtn {
  min-height: 44px; padding: 8px 14px; border-radius: 11px; font-size: 13px; font-weight: 700; flex: none;
  background: var(--card2); border: 1px solid var(--stroke2); color: var(--text); cursor: pointer; white-space: nowrap;
  font-family: var(--sans);
}
.qbtn:active { transform: scale(0.96); }
.qbtn.done { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.4); color: var(--green); }

.secure-line { text-align: center; color: var(--faint); font-size: 12px; margin: -10px 0 16px; }
.secure-line b { font-family: var(--mono); color: var(--muted); letter-spacing: 1px; }
.stale-box { margin-top: 24px; width: 100%; max-width: 340px; }
.gate-back { min-height: 44px; min-width: 88px; padding: 10px 16px; }

/* ---- install affordance ---- */

@media (prefers-reduced-motion: reduce) {
  .orb.pulse { animation: none; }
}

@media (min-width: 700px) {
  .wrap { padding-top: 24px; }
  .stats { gap: 14px; }
  .stat .n { font-size: 30px; }
}

/* ---- install card (the home-screen app is the product, so installing is spelled out) ---- */
.install-card { border-color: rgba(34, 211, 238, 0.35); box-shadow: 0 0 34px -18px var(--cyan), 0 20px 50px -30px rgba(0, 0, 0, 0.8); }
.install-card .ic-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.install-card .ic-icon {
  width: 42px; height: 42px; border-radius: 11px; flex: none;
  background: radial-gradient(circle at 50% 40%, #eafcff 0%, #22d3ee 45%, #1f6feb 100%);
  box-shadow: 0 0 16px 1px rgba(34, 211, 238, 0.45);
}
.install-card .ic-text { min-width: 0; }
.install-card .ic-title { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.3; }
.install-card .ic-sub { font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.install-card .ic-steps { list-style: none; counter-reset: icstep; margin: 0 0 12px; padding: 0; }
.install-card .ic-steps li {
  counter-increment: icstep; position: relative; padding: 9px 0 9px 38px; font-size: 14.5px; line-height: 1.5;
  color: var(--text); border-top: 1px solid var(--stroke);
}
.install-card .ic-steps li:first-child { border-top: none; }
.install-card .ic-steps li::before {
  content: counter(icstep); position: absolute; left: 0; top: 8px; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
  color: #04202a; background: linear-gradient(135deg, #7ef0ff, #22d3ee);
}
.install-card .ic-steps b { font-weight: 700; }
.install-card .ic-glyph {
  width: 20px; height: 20px; vertical-align: -4px; fill: none; stroke: var(--cyan); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.install-card .ic-glyph.dots { stroke-width: 3.2; }
.install-card .btn { width: 100%; margin-bottom: 6px; }
.install-card .ic-later {
  display: block; width: 100%; min-height: 44px; background: transparent; border: none; color: var(--muted);
  font-family: inherit; font-size: 14px; cursor: pointer; border-radius: 10px;
}
.install-card .ic-later:active { color: var(--text); }
