
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  overscroll-behavior-y: contain; /* we handle pull-to-refresh ourselves */
  height: 100%;
}
h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
}
.mono { font-family: var(--font-mono); }
a { color: inherit; }
button { font-family: var(--font-body); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Top loading line ---------- */
#topbar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  z-index: 9999;
  transition: width 0.25s ease, opacity 0.4s ease;
  box-shadow: 0 0 8px var(--amber);
}
#topbar.done { transition: width 0.15s ease, opacity 0.5s ease 0.15s; opacity: 0; }

/* ---------- Splash screen ---------- */
#splash {
  position: fixed; inset: 0; z-index: 9998;
  background: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
#splash svg { width: 96px; height: 96px; }
#splash .brand { font-size: 1.6rem; letter-spacing: 0.08em; }
#splash .tag { color: var(--muted); font-size: 0.82rem; letter-spacing: 0.12em; text-transform: uppercase; }
.gauge-needle { transform-origin: 60px 60px; animation: sweep 1.1s ease-in-out infinite alternate; }
@keyframes sweep {
  from { transform: rotate(-40deg); }
  to   { transform: rotate(40deg); }
}



/* ---------- Pull-to-refresh indicator ---------- */
#ptr {
  position: fixed; top: 8px; left: 50%; transform: translate(-50%, -60px);
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  z-index: 60; transition: transform 0.15s ease;
}
#ptr svg { width: 16px; height: 16px; stroke: var(--amber); }
#ptr.spin svg { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ---------- Swipe edge hints ---------- */
.edge-hint {
  position: fixed; top: 0; bottom: 0; width: 48px; z-index: 55;
  display: flex; align-items: center; opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease;
}
.edge-hint.left { left: 0; justify-content: flex-start; padding-left: 6px; }
.edge-hint.right { right: 0; justify-content: flex-end; padding-right: 6px; }
.edge-hint.show { opacity: 1; }
.edge-hint svg { width: 20px; height: 20px; stroke: var(--text); opacity: 0.6; }



/* ---------- Install toast (recurring popup) ---------- */
#installToast {
  position: fixed; left: 16px; right: 16px; bottom: -500px;
  max-width: 420px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--amber-dim);
  border-radius: var(--radius); padding: 16px;
  display: flex; gap: 12px; align-items: center;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  z-index: 70; transition: bottom 0.35s cubic-bezier(.2,.9,.3,1.2);
}
#installToast.show { bottom: 150px; }
#installToast .ic { width: 30px; height: 30px; color: var(--amber); flex-shrink: 0; }
#installToast .body { flex: 1; }
#installToast .body strong { display: block; font-size: 0.88rem; }
#installToast .body span { font-size: 0.76rem; color: var(--muted); }
#installToast .actions { display: flex; flex-direction: column; gap: 6px; }
#installToast button { font-size: 0.78rem; padding: 8px 12px; border-radius: 8px; }
#installToast .close { background: transparent; color: var(--muted); border: none; padding: 4px; cursor: pointer; }

/* ---------- Offline page ---------- */
.offline-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.offline-wrap svg { width: 90px; height: 90px; color: var(--muted); margin-bottom: 18px; }
.offline-wrap h1 { font-size: 1.5rem; }
.offline-wrap p { color: var(--muted); max-width: 320px; margin: 10px 0 22px; font-size: 0.9rem; line-height: 1.6; }

footer.appfoot { text-align: center; padding: 22px; color: var(--muted); font-size: 0.72rem; }
