/* Bit by Bit demo: the app's coral light theme (lib/ui/design.dart), drawn at 360 logical px and scaled to fit. */
@font-face {
  font-family: "BB Material Icons";
  src: url("/assets/bit-by-bit/demo/material-icons.otf") format("opentype");
  font-display: block;
}

/* ── Layout on the page ───────────────────────── */
.bb-stage {
  display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 440px); justify-content: center; align-items: center;
  gap: clamp(32px, 6vw, 88px); margin-top: clamp(36px, 4vw, 56px);
}
.bb-demo {
  --demo-bg: #faf7f5; --demo-fg: #2f2a29; --demo-soft: #857b78; --demo-accent: #d9563f; --demo-accent-fg: #fff; --demo-line: #eee4e0;
  --demo-radius: 44px;
  max-width: 320px; justify-self: center;
  /* the phone body, like the store screenshots */
  box-shadow: 0 0 0 9px #2a2321, 0 0 0 10.5px #57494530, 0 46px 80px -34px rgba(140, 50, 30, 0.5), 0 18px 36px -20px rgba(60, 20, 10, 0.35);
  margin: 11px;
}

/* ── The phone screen ─────────────────────────── */
.bb-screen { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.bb-phone {
  --bb-ink: #2f2a29; --bb-accent: #d9563f; --bb-paper: #faf7f5; --bb-muted: #857b78; --bb-line: #eee4e0; --bb-sage: #f7e8e3;
  --bb-surface: #fff; --bb-panel: #f8efec; --bb-hero: #d65a45; --bb-hero-text: #f6dbd6; --bb-hero-track: #df7e6e; --bb-hero-bar: #f8d1c4;
  --bb-terra: #d2463a; --bb-income: #2f72c0; --bb-bar-muted: #f5c3b2;
  position: absolute; left: 0; top: 0; width: 360px; height: 740px; overflow: hidden; transform-origin: 0 0;
  background: var(--bb-paper); color: var(--bb-ink); font-size: 14px; line-height: 1.25; text-align: left;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Helvetica Neue", "Hiragino Sans", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; letter-spacing: 0; word-break: normal;
}
html[lang="zh-TW"] .bb-phone, html[lang="zh-TW"] .bb-panel { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "PingFang TC", "Noto Sans TC", sans-serif; }
html[lang="ko"] .bb-phone, html[lang="ko"] .bb-panel { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; }
.bb-phone p { margin: 0; }
.bb-i { font-family: "BB Material Icons"; font-style: normal; font-weight: normal; font-size: 24px; line-height: 1; display: inline-block; flex: none; -webkit-font-feature-settings: "liga"; }

.bb-status { position: absolute; inset: 0 0 auto; height: 50px; z-index: 1; }
.bb-clock { position: absolute; left: 36px; top: 17px; font-size: 15px; font-weight: 600; }
.bb-island { position: absolute; left: 50%; top: 11px; width: 104px; height: 30px; margin-left: -52px; border-radius: 16px; background: #000; }
.bb-sys { position: absolute; right: 26px; top: 20px; width: 66px; height: 12px; fill: currentColor; color: var(--bb-ink); }

.bb-pages { position: absolute; inset: 50px 0 82px; overflow: hidden; }
.bb-page { position: absolute; inset: 0; }
.bb-analysis { opacity: 0; }
.bb-bar { display: flex; align-items: center; height: 52px; padding-left: 6px; }
.bb-bar .bb-i { width: 40px; text-align: center; }
.bb-bar span { font-size: 18px; font-weight: 600; }
.bb-body { padding: 2px 12px 0; }

/* overview hero */
.bb-hero { padding: 16px 18px 6px; border-radius: 14px; background: var(--bb-hero); color: #fff; }
.bb-hero-label { display: flex; align-items: center; gap: 9px; color: var(--bb-hero-text); font-size: 13px; }
.bb-hero-label .bb-i { font-size: 17px; }
.bb-hero-amt { margin-top: 4px !important; font-size: 34px; font-weight: 600; letter-spacing: -1.5px; line-height: 1.17; }
.bb-hero-sub {
  --glow: 0; margin-top: 2px !important; font-size: 12px; color: rgba(255, 255, 255, calc(0.7 + 0.3 * var(--glow)));
  font-weight: 400; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, calc(0.75 * var(--glow))); text-decoration-thickness: 1.5px; text-underline-offset: 3px;
}
.bb-hero-track { height: 6px; margin-top: 12px; border-radius: 5px; overflow: hidden; background: var(--bb-hero-track); }
.bb-hero-track i, .bb-line-track i { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(0); }
.bb-hero-track i { background: var(--bb-hero-bar); }
.bb-hero-foot { display: flex; align-items: center; justify-content: space-between; min-height: 36px; margin-top: 2px !important; font-size: 11px; color: var(--bb-hero-text); white-space: pre; }
.bb-hero-foot b { font-weight: 500; color: #fff; padding: 0 8px; }

.bb-card { border: 1px solid var(--bb-line); border-radius: 10px; background: var(--bb-surface); overflow: hidden; }
.bb-totals { display: flex; margin-top: 10px; }
.bb-totals p { flex: 1; min-width: 0; padding: 10px 6px 7.5px; text-align: center; }
.bb-totals p + p { border-left: 1px solid var(--bb-line); }
.bb-totals span { display: block; font-size: 11px; color: var(--bb-muted); white-space: nowrap; }
.bb-totals b { display: block; margin-top: 3px; font-size: 16px; font-weight: 600; white-space: nowrap; }
.bb-totals .is-income { color: var(--bb-income); }
.bb-totals .is-expense { color: var(--bb-terra); }

.bb-recent { margin-top: 12px; padding: 12px 0 6px; }
.bb-label { display: flex; align-items: center; justify-content: space-between; min-height: 30px; padding: 0 16px 6px; }
.bb-label span { font-size: 15px; font-weight: 700; }
.bb-label b { font-size: 11px; font-weight: 500; color: var(--bb-accent); padding: 0 4px; }
.bb-rows { display: flex; flex-direction: column; }
.bb-row { --fresh: 0; position: relative; overflow: hidden; flex: none; background: rgba(247, 232, 227, var(--fresh)); }
.bb-row + .bb-row::before { content: ""; position: absolute; top: 0; left: 14px; right: 14px; height: 1px; background: var(--bb-line); }
.bb-row-in { display: flex; align-items: center; gap: 8px; padding: 8px 14px; }
.bb-row-cat { display: flex; align-items: center; gap: 6px; width: 97px; flex: none; color: var(--bb-muted); font-size: 12px; }
.bb-row-cat span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-row-cat .bb-i { font-size: 15px; }
.bb-row-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bb-row-mid b { font-size: 14px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-row-mid small { font-size: 11px; color: var(--bb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-row-amt { font-size: 14px; font-weight: 600; color: var(--bb-terra); }

/* category colours on icons */
.bb-phone [data-cat="food"] .bb-i { color: #d59865; }
.bb-phone [data-cat="cafe"] .bb-i { color: #a57f68; }
.bb-phone [data-cat="daily"] .bb-i { color: #7d9b84; }
.bb-phone [data-cat="transport"] .bb-i { color: #7d9fa9; }
.bb-phone [data-cat="fun"] .bb-i { color: #ad94b0; }
.bb-phone [data-cat="home"] .bb-i { color: #b5a367; }

/* analysis */
.bb-usage { padding: 16px; }
.bb-usage .bb-label, .bb-six .bb-label { padding: 0 0 6px; min-height: 0; }
.bb-line { padding-bottom: 12px; }
.bb-line p { display: flex; align-items: baseline; }
.bb-line b { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-line span { font-size: 11px; color: var(--bb-muted); }
.bb-line em { width: 44px; text-align: right; font-style: normal; font-size: 12px; font-weight: 600; }
.bb-line-track { height: 7px; margin-top: 6px; border-radius: 4px; overflow: hidden; background: var(--bb-sage); }
.bb-six { margin-top: 12px; padding: 16px; }
.bb-six-bars { display: flex; align-items: flex-end; height: 160px; }
.bb-six-bars div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.bb-six-bars small { font-size: 9px; color: var(--bb-muted); white-space: nowrap; }
.bb-six-bars i { width: 44%; margin-top: 4px; border-radius: 7px 7px 0 0; background: var(--bb-bar-muted); }
.bb-six-bars i.is-now { background: var(--bb-accent); }
.bb-six-bars span { margin-top: 6px; font-size: 12px; color: var(--bb-muted); white-space: nowrap; }

/* FAB, snackbar and the navigation bar */
.bb-fab {
  position: absolute; right: 16px; bottom: 98px; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bb-accent); color: #fff; box-shadow: 0 2px 5px rgba(80, 30, 20, 0.28), 0 1px 2px rgba(80, 30, 20, 0.2);
}
.bb-fab .bb-i { font-size: 30px; }
.bb-snack {
  position: absolute; left: 15px; right: 15px; bottom: 166px; padding: 14px 16px; border-radius: 12px; opacity: 0;
  background: var(--bb-ink); color: var(--bb-paper); font-size: 14px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}
.bb-nav { position: absolute; inset: auto 0 0; height: 82px; display: flex; border-top: 1px solid var(--bb-line); background: var(--bb-paper); }
.bb-tab { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; padding-top: 12px; color: var(--bb-muted); }
.bb-tab .bb-i { position: relative; height: 32px; line-height: 32px; }
.bb-tab b { margin-top: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.bb-tab.is-on { color: var(--bb-ink); }
.bb-ind { position: absolute; top: 12px; left: 50%; width: 64px; height: 32px; margin-left: -32px; border-radius: 16px; background: var(--bb-sage); transform: scaleX(0); }
.bb-home { position: absolute; left: 50%; bottom: 7px; width: 128px; height: 5px; margin-left: -64px; border-radius: 3px; background: var(--bb-ink); }

/* the entry sheet */
.bb-scrim { position: absolute; inset: 0; background: #000; opacity: 0; }
.bb-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 24px 28px; border-radius: 28px 28px 0 0;
  background: var(--bb-paper); transform: translateY(110%);
}
.bb-handle { display: block; width: 36px; height: 4px; margin: 0 auto; border-radius: 8px; background: var(--bb-line); }
.bb-sheet-title { display: flex; align-items: center; justify-content: space-between; height: 48px; margin-top: 16px !important; }
.bb-sheet-title b { font-size: 22px; font-weight: 700; }
.bb-sheet-title .bb-i { width: 48px; text-align: center; margin-right: -12px; }
.bb-small { margin-top: 4px !important; font-size: 12px; color: var(--bb-muted); }
.bb-chips { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 8px; }
.bb-tpl { flex-wrap: nowrap; overflow: hidden; margin-right: -24px; }
.bb-kinds { margin-top: 12px; }
.bb-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; flex: none; border-radius: 10px;
  border: 1px solid var(--bb-line); background: var(--bb-surface); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.bb-chip .bb-i { font-size: 17px; margin-left: -2px; }
.bb-chip.is-action .bb-i { font-size: 16px; color: var(--bb-accent); }
.bb-chip.is-on { border: 1.4px solid var(--bb-accent); background: #f9e4e0; color: var(--bb-accent); }
.bb-chip.is-press, .bb-save.is-press, .bb-fab.is-press, .bb-key.is-press { filter: brightness(0.93); transform: scale(0.97); }
.bb-key.is-press { background: #b9bcc4; filter: none; transform: none; }
.bb-done b.is-press { opacity: 0.55; }
.bb-tab.is-press .bb-i { transform: scale(0.92); }
.bb-field {
  position: relative; display: flex; align-items: center; height: 66px; margin-top: 20px; padding: 0 12px 0 14px;
  border: 1px solid var(--bb-line); border-radius: 12px; background: var(--bb-surface);
}
.bb-field.is-focus { border: 1.5px solid var(--bb-accent); padding-left: 13.5px; }
.bb-field-label {
  position: absolute; left: 10px; top: -8px; padding: 0 4px; font-size: 12px; line-height: 14px; color: var(--bb-muted);
  background: linear-gradient(var(--bb-paper) 50%, var(--bb-surface) 50%);
}
.bb-field.is-focus .bb-field-label { color: var(--bb-accent); }
.bb-yen { font-size: 30px; color: var(--bb-muted); margin-right: 8px; }
.bb-amount, .bb-hint { font-size: 36px; font-weight: 600; letter-spacing: -0.5px; }
.bb-hint { color: #c9c0bd; font-weight: 400; }
.bb-caret { width: 2px; height: 38px; margin-left: 1px; background: var(--bb-accent); opacity: 0; }
.bb-calc { margin-left: auto; color: var(--bb-muted); }
.bb-cats { margin-top: 8px; }
.bb-sheet > .bb-small:nth-of-type(3) { margin-top: 20px !important; }
.bb-save {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 48px; margin-top: 16px; border-radius: 14px;
  background: var(--bb-accent); color: #fff; font-size: 14px; font-weight: 600;
}
.bb-save .bb-i { font-size: 18px; }

/* iOS number pad with the app's Done bar */
.bb-kb { position: absolute; left: 0; right: 0; bottom: 0; background: #d1d4da; transform: translateY(110%); }
.bb-done { display: flex; justify-content: flex-end; align-items: center; height: 44px; padding: 0 16px; border-top: 1px solid var(--bb-line); background: var(--bb-panel); }
.bb-done b { font-size: 16px; font-weight: 600; color: var(--bb-accent); padding: 6px 4px; border-radius: 8px; }
.bb-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px 6px; padding: 6px 6px 36px; background: #d1d4da; }
.bb-key { height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 5px; background: #fff; box-shadow: 0 1px 0 #8b8d92; color: #000; }
.bb-key b { font-size: 25px; font-weight: 400; line-height: 1; }
.bb-key small { font-size: 9px; font-weight: 700; letter-spacing: 2px; margin-top: 1px; }
.bb-key.is-blank { background: transparent; box-shadow: none; }
.bb-del svg { width: 24px; height: 18px; }

/* the touch indicator */
.bb-touch {
  --ring: 1; position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; border-radius: 50%; opacity: 0;
  background: rgba(70, 60, 58, 0.32); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: none;
}
.bb-touch i { position: absolute; inset: -2px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.9); opacity: calc(1 - var(--ring)); transform: scale(calc(1 + var(--ring) * 0.9)); }
.bb-veil { position: absolute; inset: 0; background: var(--bb-paper); opacity: 0; }

/* ── The panel beside the phone, in the app's list style ── */
.bb-panel {
  color: #2f2a29; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Helvetica Neue", "Hiragino Sans", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.bb-panel .bb-i { font-size: 22px; color: #857b78; margin-top: 1px; }
.bb-steps, .bb-facts { list-style: none; margin: 0; padding: 0; border: 1px solid #eee4e0; border-radius: 10px; background: #fff; overflow: hidden; }
.bb-step, .bb-facts li { position: relative; display: flex; gap: 14px; padding: 16px 18px; }
.bb-step + .bb-step::before, .bb-facts li + li::before { content: ""; position: absolute; top: 0; left: 18px; right: 18px; height: 1px; background: #eee4e0; }
.bb-step.is-on { background: #f7e8e3; }
.bb-step.is-on::before, .bb-step.is-on + .bb-step::before { background: transparent; }
.bb-step.is-on .bb-i { color: #d9563f; }
.bb-step-t { font-size: 15px; font-weight: 700; line-height: 1.35; }
.bb-step-s { margin-top: 4px; font-size: 13px; line-height: 1.55; color: #857b78; }
.bb-step:not(.is-on) .bb-step-t { color: #5c5452; font-weight: 600; }
.bb-step-bar { position: absolute; left: 18px; right: 18px; bottom: 0; height: 3px; border-radius: 2px; overflow: hidden; opacity: 0; background: #f3e3de; }
.bb-step-bar i { display: block; height: 100%; background: #d9563f; transform-origin: 0 50%; transform: scaleX(0); }
.bb-step.is-on .bb-step-bar { opacity: 1; }
.bb-facts { margin-top: 12px; background: #f8efec; }
.bb-facts .bb-step-t { font-size: 14px; font-weight: 600; }
.bb-facts .bb-step-s { font-size: 12px; margin-top: 2px; }

/* Phones: the phone first, then only the step that is playing */
@media (max-width: 760px) {
  .bb-stage { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .bb-demo { width: min(100% - 22px, 300px); }
  .bb-panel { width: 100%; max-width: 420px; justify-self: center; }
  .bb-step:not(.is-on) { display: none; }
  .bb-step.is-on::before { display: none; }
  .bb-step { min-height: 104px; }
  .bb-facts { display: grid; grid-template-columns: 1fr 1fr; }
  .bb-facts li { padding: 12px 14px; gap: 10px; }
  .bb-facts li + li::before { top: 12px; bottom: 12px; left: 0; right: auto; width: 1px; height: auto; }
  .bb-facts .bb-step-s { display: none; }
}
@media (prefers-reduced-motion: reduce) { .bb-step-bar { display: none; } }
