/* Spendly — warm friendly fintech */
:root {
  --bg: oklch(0.985 0.012 80);
  --bg-alt: oklch(0.97 0.018 75);
  --surface: #ffffff;
  --ink: oklch(0.22 0.02 60);
  --ink-soft: oklch(0.45 0.015 60);
  --ink-mute: oklch(0.62 0.012 60);
  --line: oklch(0.92 0.012 75);
  --line-soft: oklch(0.95 0.01 75);

  --coral: oklch(0.68 0.15 35);
  --coral-soft: oklch(0.93 0.045 40);
  --coral-ink: oklch(0.42 0.12 35);

  --sage: oklch(0.68 0.09 155);
  --sage-soft: oklch(0.94 0.03 155);
  --sage-ink: oklch(0.42 0.08 155);

  --butter: oklch(0.92 0.08 90);
  --sky: oklch(0.86 0.06 230);
  --lilac: oklch(0.86 0.06 310);
  --clay: oklch(0.85 0.05 50);

  --shadow-sm: 0 1px 2px rgba(60, 40, 20, 0.04);
  --shadow-md: 0 6px 24px -8px rgba(60, 40, 20, 0.10), 0 2px 6px rgba(60, 40, 20, 0.04);
  --shadow-lg: 0 24px 60px -20px rgba(60, 40, 20, 0.18), 0 4px 12px rgba(60, 40, 20, 0.06);

  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: #efe7dc;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.serif { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; letter-spacing: -0.01em; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* device shell */
.device {
  width: 390px; height: 820px;
  background: var(--bg);
  border-radius: 44px;
  border: 10px solid #1a1612;
  box-shadow: 0 40px 90px -20px rgba(40, 25, 10, 0.35), 0 0 0 1px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.device-row { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; justify-content: center; }
.device-label {
  font-size: 12px; color: oklch(0.45 0.015 60); text-align: center;
  margin-top: 14px; letter-spacing: 0.04em; text-transform: uppercase;
  font-weight: 600;
}

/* status bar */
.status-bar {
  height: 44px; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; font-weight: 600; color: var(--ink);
  flex-shrink: 0;
}
.status-icons { display: flex; gap: 6px; align-items: center; }

/* notch */
.notch {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 28px; background: #1a1612; border-radius: 16px; z-index: 10;
}

/* screen scroll area */
.screen {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }

/* home indicator */
.home-ind {
  height: 28px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.home-ind::after {
  content: ''; width: 130px; height: 4px; border-radius: 2px;
  background: var(--ink); opacity: 0.85;
}

/* tab bar */
.tabbar {
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 12px 4px;
  background: var(--bg);
  border-top: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 14px; border-radius: 14px;
  color: var(--ink-mute); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  border: none; background: transparent;
}
.tab.active { color: var(--ink); }
.tab.active .tab-icon { background: var(--ink); color: var(--bg); }
.tab-icon {
  width: 44px; height: 28px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; transition: all .2s;
}

/* fab voice button — special, raised */
.fab-voice {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--coral); color: white;
  display: flex; align-items: center; justify-content: center;
  margin-top: -22px; cursor: pointer;
  box-shadow: 0 10px 24px -6px oklch(0.68 0.15 35 / 0.5), 0 4px 8px rgba(0,0,0,0.08);
  border: 4px solid var(--bg);
  transition: transform .15s;
}
.fab-voice:active { transform: scale(0.94); }

/* shared bits */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--bg-alt); color: var(--ink-soft);
  border: 1px solid var(--line);
}
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* segmented control */
.segmented {
  display: flex; padding: 4px; background: var(--bg-alt);
  border-radius: 999px; gap: 2px;
  border: 1px solid var(--line);
}
.segmented button {
  flex: 1; padding: 8px 14px; border-radius: 999px;
  background: transparent; border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink-mute);
  font-family: inherit;
  transition: all .15s;
}
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* category dot */
.cat-dot {
  width: 38px; height: 38px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cat-dot svg { width: 20px; height: 20px; }

/* subtle pulse */
@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0; }
}
.pulse-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--coral);
  animation: pulse-ring 1.6s ease-out infinite;
}
@keyframes wave-bar {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

/* focus / hover */
button { font-family: inherit; }
button:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }

/* scroll snap horizontal */
.scroll-x {
  display: flex; gap: 12px; overflow-x: auto; padding: 0 20px 4px;
  scrollbar-width: none; scroll-snap-type: x mandatory;
}
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x > * { scroll-snap-align: start; flex-shrink: 0; }

/* ============================================================
   MOBILE — flatten the device frame and respect real safe areas
   Applied on real phones (narrow viewports). Desktop keeps the
   pretty device-frame preview look from above.
   ============================================================ */
@media (max-width: 599px) {
  body {
    padding: 0;
    background: var(--bg);
    display: block;
    align-items: stretch;
    justify-content: stretch;
    /* lock down system gestures from interfering with our scrolling */
    overscroll-behavior: none;
  }

  .device {
    width: 100vw;
    height: 100vh;            /* fallback for older mobile browsers */
    height: 100dvh;           /* preferred — dynamic viewport, accounts for browser chrome */
    border: none;
    border-radius: 0;
    box-shadow: none;
    /* keep content out from under the OS status bar (notch / punch hole) */
    padding-top: env(safe-area-inset-top);
  }

  /* hide the prototype's faked phone chrome — real phone has its own */
  .device .notch,
  .device .status-bar,
  .device .home-ind {
    display: none !important;
  }

  /* tabbar sits above the home-indicator / nav-gesture bar */
  .tabbar {
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
  }

  /* hide the desktop-only "Spendly · voice-first family expense tracker" label */
  .device + div[style*="position: fixed"] {
    display: none !important;
  }
}
