/* Keepers Scrapbook — the small app's own styles.
 *
 * Phone first and phone only: this is designed for one thumb, standing up,
 * holding a child. Nothing here assumes a mouse, a wide screen or patience.
 * It deliberately does not load app.css or book.css — the point of a second,
 * smaller app is that it starts instantly on a bad connection.
 */

:root {
  --sb-page: #F4F1EA;
  --sb-card: #FFFDF8;
  --sb-ink: #241F33;
  --sb-soft: #6A6280;
  --sb-line: #E2DCCD;
  --sb-gold: #C08F30;
  --sb-gold-lt: #E8C878;
  --sb-night: #241A5E;
  --sb-danger: #B3261E;
  --sb-r: 14px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--sb-page);
  color: var(--sb-ink);
  font: 16px/1.5 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* the home-screen app runs under the status bar and over the home indicator */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: rgba(36, 26, 94, 0.08);
}

img { max-width: 100%; height: auto; }

/* ------------------------------------------------------------------ bar -- */
.sb-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 6px;
  padding: 12px 16px calc(12px + env(safe-area-inset-top));
  margin-top: calc(-1 * env(safe-area-inset-top));
  background: linear-gradient(180deg, var(--sb-night), #1b1447);
  color: #FFFDF8;
}
.sb-bar h1 {
  margin: 0; flex: 1;
  font: 600 19px/1.2 'Baloo 2', 'Jost', system-ui, sans-serif;
  letter-spacing: 0.2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sb-back {
  appearance: none; border: 0; background: transparent; color: #FFFDF8;
  font-size: 30px; line-height: 1; padding: 0 10px 4px 0; cursor: pointer;
  min-width: 44px; min-height: 44px;                 /* a real thumb target */
}
.sb-sync { font-size: 12px; color: #C9C2E8; max-width: 40%; text-align: right; }

/* ---------------------------------------------------------------- cards -- */
.sb-card {
  background: var(--sb-card);
  border: 1px solid var(--sb-line);
  border-radius: var(--sb-r);
  margin: 16px;
  padding: 18px 16px;
}
.sb-card h2 { margin: 0 0 6px; font: 600 21px/1.25 'Baloo 2', 'Jost', sans-serif; }
.sb-lede { margin: 0 0 14px; color: var(--sb-soft); font-size: 15px; }
.sb-pad { padding: 0 16px; }
.sb-hint { color: var(--sb-soft); font-size: 13px; }
.sb-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

label { display: block; margin: 0 0 14px; }
.sb-lbl { display: block; font-size: 13px; font-weight: 500; color: var(--sb-soft); margin: 0 0 5px; }

input[type="text"], input[type="date"], textarea {
  width: 100%;
  font: 16px/1.45 inherit;                 /* 16px or iOS zooms the page on focus */
  color: var(--sb-ink);
  background: #fff;
  border: 1px solid var(--sb-line);
  border-radius: 10px;
  padding: 12px 12px;
}
textarea { resize: vertical; min-height: 110px; }
input:focus, textarea:focus { outline: 2px solid #6E5BC4; outline-offset: 1px; border-color: #6E5BC4; }

/* --------------------------------------------------------------- buttons -- */
.sb-btn {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 20px;
  font: 600 16px/1 'Jost', system-ui, sans-serif;
  color: #FFFDF8; background: var(--sb-night);
  border: 0; border-radius: 999px;
}
.sb-btn:active { transform: translateY(1px); }
.sb-btn-gold { background: linear-gradient(140deg, var(--sb-gold-lt), var(--sb-gold)); color: #2A2008; }
.sb-quiet { background: transparent; color: var(--sb-night); border: 1px solid var(--sb-line); }
.sb-danger { background: var(--sb-danger); }
.sb-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }
.sb-row .sb-btn { flex: 1 1 auto; }
.sb-save { position: sticky; bottom: 0; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(255,253,248,0), var(--sb-card) 30%); }
.sb-save .sb-btn { width: 100%; }
.sb-link-danger { appearance: none; border: 0; background: none; color: var(--sb-danger); font: inherit; text-decoration: underline; cursor: pointer; padding: 10px; }

/* --------------------------------------------------------------- actions -- */
.sb-actions { padding: 16px 16px 4px; display: grid; gap: 10px; }
.sb-big {
  appearance: none; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 18px 18px;
  border: 0; border-radius: var(--sb-r);
  background: linear-gradient(140deg, #2b2068, var(--sb-night));
  color: #FFFDF8;
  box-shadow: 0 6px 18px rgba(36, 26, 94, 0.22);
}
.sb-big:active { transform: translateY(1px); }
.sb-big-ico { font-size: 30px; line-height: 1; }
.sb-big strong { display: block; font: 600 18px/1.2 'Baloo 2', 'Jost', sans-serif; }
.sb-big-sub { display: block; font-size: 13px; color: #C9C2E8; margin-top: 3px; }

/* --------------------------------------------------------------- install -- */
.sb-install {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 16px 16px 0; padding: 14px 16px;
  background: #FFF6E0;
  border: 1px solid #EBD9AC;
  border-radius: var(--sb-r);
}
.sb-install-txt { flex: 1 1 190px; }
.sb-install strong { display: block; font: 600 16px/1.25 'Baloo 2', 'Jost', sans-serif; }
.sb-install span { font-size: 13px; color: #6B5A2E; }
.sb-install .sb-btn { flex: 0 0 auto; }

/* ------------------------------------------------------------------ kids -- */
.sb-kids { display: grid; gap: 10px; padding: 0 16px; }
.sb-kid {
  appearance: none; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; min-height: 64px;
  background: var(--sb-card); border: 1px solid var(--sb-line); border-radius: var(--sb-r);
  font: inherit; color: inherit;
}
.sb-kid-dot {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--sb-gold-lt), var(--sb-gold));
  color: #2A2008; font: 600 19px/1 'Baloo 2', sans-serif;
}
.sb-kid-name { font: 600 17px/1.2 'Baloo 2', 'Jost', sans-serif; }

/* ------------------------------------------------------------------ roll -- */
.sb-empty { margin: 22px 16px; color: var(--sb-soft); text-align: center; font-size: 15px; }
.sb-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 14px 16px; }
@media (min-width: 560px) { .sb-grid { grid-template-columns: repeat(3, 1fr); } }
.sb-tile {
  appearance: none; cursor: pointer; padding: 0; text-align: left;
  background: var(--sb-card); border: 1px solid var(--sb-line); border-radius: 12px;
  overflow: hidden; font: inherit; color: inherit;
  display: flex; flex-direction: column;
}
.sb-tile img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; }
.sb-tile-blank {
  width: 100%; aspect-ratio: 1 / 1; display: grid; place-items: center;
  background: #EFEADC; color: #A79C82; font-size: 30px;
}
.sb-tile-cap { padding: 8px 10px 10px; }
.sb-tile-date { display: block; font-size: 11px; letter-spacing: 0.3px; text-transform: uppercase; color: var(--sb-soft); }
.sb-tile-words {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 13px; margin-top: 2px;
}
.sb-tile-todo { font-size: 13px; margin-top: 2px; color: var(--sb-gold); font-weight: 500; }

/* ---------------------------------------------------------------- editor -- */
.sb-photo {
  margin: 0 0 12px; border-radius: 12px; overflow: hidden;
  background: #EFEADC; min-height: 120px;
  display: grid; place-items: center;
}
.sb-photo img { width: 100%; max-height: 46vh; object-fit: contain; display: block; }
.sb-photo-none { color: #A79C82; font-size: 14px; padding: 34px 0; }
.sb-age { margin: -8px 0 14px; font-size: 13px; color: var(--sb-gold); font-weight: 500; }

/* ----------------------------------------------------------------- modal -- */
.sb-modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(16, 11, 46, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
@media (min-width: 560px) { .sb-modal { align-items: center; padding: 20px; } }
.sb-sheet {
  width: 100%; max-width: 460px;
  background: var(--sb-card);
  border-radius: 18px 18px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
}
@media (min-width: 560px) { .sb-sheet { border-radius: 18px; } }
.sb-sheet h2 { margin: 0 0 6px; font: 600 20px/1.25 'Baloo 2', 'Jost', sans-serif; }
.sb-steps { margin: 0 0 14px; padding-left: 20px; }
.sb-steps li { margin: 0 0 10px; }
.sb-glyph { width: 19px; height: 19px; vertical-align: -4px; color: #0A7CFF; }
.sb-prog { height: 8px; border-radius: 4px; background: #EFEADC; overflow: hidden; }
.sb-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sb-gold-lt), var(--sb-gold)); transition: width 0.2s; }

/* ----------------------------------------------------------------- toast -- */
.sb-toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 80; max-width: calc(100vw - 32px);
  background: #241F33; color: #FFFDF8;
  padding: 12px 18px; border-radius: 999px;
  font-size: 15px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
  transition: opacity 0.4s;
}
.sb-toast.go { opacity: 0; }

/* ------------------------------------------------------------------ foot -- */
.sb-foot { margin: 20px 16px calc(28px + env(safe-area-inset-bottom)); text-align: center; font-size: 14px; }
.sb-foot a { color: var(--sb-night); }

.sb-boot { padding: 60px 24px; text-align: center; color: var(--sb-soft); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .sb-btn:active, .sb-big:active { transform: none; }
}
