/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  color: var(--c-kicap);
  background: var(--c-surface-sunk);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
img { display: block; max-width: 100%; }

:focus-visible {
  outline: 3px solid var(--c-sambal);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── Phone shell ── */
.phone {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: var(--phone-max);
  margin: 0 auto;
  background: var(--c-santan);
  overflow: hidden;
}

/* On a desktop, frame the app like a phone so screenshots match real use. */
@media (min-width: 600px) and (min-height: 760px) {
  body { display: grid; place-items: center; }
  .phone {
    height: min(860px, 94dvh);
    width: 100%;
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lift);
  }
}

.screen-host {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* A screen fills the host and scrolls on its own. */
.screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: screen-in var(--dur-base) var(--ease-out);
}
.screen--back { animation-name: screen-in-back; }

@keyframes screen-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes screen-in-back {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: none; }
}

/* ── Top bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--topbar-h);
  padding: var(--sp-2) var(--sp-4);
  padding-top: max(var(--sp-2), env(safe-area-inset-top));
  background: var(--c-santan);
}
.topbar__title {
  flex: 1;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
}
.topbar__brand {
  flex: 1;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-black);
  letter-spacing: var(--tracking-display);
  color: var(--c-chilli);
}
.topbar__step {
  font-size: var(--fs-sm);
  color: var(--c-kicap-2);
}

/* ── Tab bar ── */
.tabbar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--c-surface);
  border-top: 1px solid var(--c-line);
}
.tabbar[hidden] { display: none; }
.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: var(--tap-min);
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--c-kicap-3);
  text-decoration: none;
}
.tabbar__item[aria-current="page"] { color: var(--c-kicap); }
.tabbar__icon {
  width: 24px; height: 24px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.tabbar__plus {
  display: grid;
  place-items: center;
  width: 52px; height: 40px;
  border-radius: var(--r-md);
  background: var(--c-chilli);
  transition: transform var(--dur-fast) var(--ease-out);
}
.tabbar__item--log:active .tabbar__plus { transform: scale(0.94); }
.tabbar__plus svg {
  width: 26px; height: 26px;
  fill: none; stroke: var(--c-on-brand); stroke-width: 2.4; stroke-linecap: round;
}
