/* Reset + phone-first app shell. Lexend is used when available; otherwise the
   system-ui fallback keeps the layout identical (the showcase makes no external
   font request — self-contained + privacy-safe). */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: #ded7c9;                 /* desktop backdrop behind the phone frame */
  font-size: var(--fs-body);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[data-theme="dark"] body { background: #0e0d0a; }

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font: inherit; color: inherit; }
a { color: var(--green); text-decoration: none; }
ul { list-style: none; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }

/* ---- phone frame ---- */
.app-frame {
  position: relative;
  width: 100%;
  max-width: var(--frame-w);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (min-width: 440px) {
  body { padding: 24px 0; }
  .app-frame {
    min-height: min(880px, calc(100dvh - 48px));
    height: min(880px, calc(100dvh - 48px));
    border-radius: 28px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border);
  }
}

/* ---- a screen: optional top bar, scroll body, optional bottom nav ---- */
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.screen.dark-screen { background: #23221b; color: #fff; }

.screen-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.screen-scroll.tight { gap: 12px; }
.screen-scroll.flush { padding-left: 0; padding-right: 0; }

/* ---- top bar (pushed screens) ---- */
.topbar {
  flex: 0 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background: var(--bg);
}
.topbar__title { font-size: var(--fs-h); font-weight: 700; flex: 1; }
.topbar__title.center { text-align: center; }
.topbar .iconbtn { flex: 0 0 auto; }
.topbar__spacer { width: 40px; flex: 0 0 auto; }

/* ---- bottom nav ---- */
.bottomnav {
  flex: 0 0 auto;
  height: var(--nav-h);
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--border);
  background: var(--card);
  position: relative;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottomnav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.bottomnav__item.active { color: var(--green); }
.bottomnav__item svg { width: 22px; height: 22px; }
.bottomnav__fab {
  flex: 0 0 auto;
  width: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bottomnav__fab button {
  width: 56px; height: 56px;
  margin-top: -14px;
  border-radius: var(--r-pill);
  background: var(--green-solid);
  color: var(--on-green);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-fab);
}
.bottomnav__fab svg { width: 24px; height: 24px; }

/* ---- generic layout utilities ---- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.gap-8 { gap: 8px; }
.stack.gap-16 { gap: 16px; }
.stack.gap-20 { gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.strong { font-weight: 700; }
.green-text { color: var(--green); font-weight: 600; }
.danger-text { color: var(--danger); font-weight: 600; }
.hidden { display: none !important; }

.section-label {
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.screen-greeting { font-size: var(--fs-display); font-weight: 700; line-height: 1.15; }
.screen-sub { color: var(--muted); font-size: var(--fs-sm); }

.divider { height: 1px; background: var(--border); border: 0; }

/* subtle slide-in between screens (transform-only, so a mid-frame capture is
   never faint) */
@keyframes screen-in { from { transform: translateY(6px); } to { transform: none; } }
.screen { animation: screen-in 0.16s ease; }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } }
