/* Tutor: soft green wash, rounded type, Apple-system greens and reds.
   Motion follows up's: pages rise in, lists stagger, sheets slide up,
   verdicts pop, and a thumbs up throws confetti. All of it calms down
   under prefers-reduced-motion. */

:root {
  --cream: #EEF9F0;
  --cream-deep: #D8F2DE;
  --paper: #FBFEFB;
  --ink: #1D3B26;
  --ink-soft: #5E7D66;
  --faint: #8FA896;
  --green: #34C759;
  --green-mid: #2FB552;
  --green-deep: #248A3D;
  --red: #FF3B30;
  --red-deep: #D70015;
  --red-wash: #FFF1F0;
  --orange: #FF9500;
  --orange-wash: #FFF6E8;
  --blue: #4D96FF;
  --edge: #CDEBD4;
  --edge-soft: rgba(36, 138, 61, 0.12);
  --shadow: 0 1px 2px rgba(29, 59, 38, 0.06), 0 8px 24px rgba(29, 59, 38, 0.07);
  --shadow-lift: 0 2px 4px rgba(29, 59, 38, 0.08), 0 14px 34px rgba(29, 59, 38, 0.12);
  --r: 22px;
  --r-sm: 14px;
  --col: 42rem;
  --col-wide: 62rem;
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  --display: "Baloo 2", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  overscroll-behavior: none;
  background: #E1F5E6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 78% at 10% -12%, rgba(52, 199, 89, 0.3), transparent 58%),
    radial-gradient(120% 92% at 104% 112%, rgba(36, 138, 61, 0.2), transparent 55%),
    linear-gradient(180deg, #F3FBF4 0%, #E1F5E6 100%);
}

button, input, textarea, select { font: inherit; color: inherit; font-size: 16px; }
button { background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
button:disabled { opacity: 0.5; cursor: default; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: 0.005em; line-height: 1.12; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }
p { margin: 0; }
ul { margin: 0; padding: 0; }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }

.muted { color: var(--ink-soft); }
.small { font-size: 0.9rem; }
.tiny { font-size: 0.78rem; }
.center { text-align: center; }
.grow { flex: 1; }
.min0 { min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { color: var(--green-deep); font-weight: 800; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: rgba(36, 138, 61, 0.3); }
.link:hover { text-decoration-color: var(--green-deep); }
.error-text { color: var(--red-deep); font-weight: 800; margin-top: 8px; }
.top-gap { margin-top: 18px; }

/* ------------------------------------------------------------ layout */

.app { position: fixed; inset: 0; display: flex; flex-direction: column; }

.topbar {
  flex: none;
  z-index: 20;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: linear-gradient(180deg, rgba(251, 254, 251, 0.92), rgba(251, 254, 251, 0.7));
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--edge);
}
.topbar-inner { max-width: var(--col-wide); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 9px; transition: transform 0.2s var(--spring); }
.brand:active { transform: scale(0.96); }
.brand-icon { width: 38px; height: 38px; border-radius: 12px; box-shadow: 0 4px 12px rgba(36, 138, 61, 0.25); }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 1.55rem; color: var(--green-deep); line-height: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-bottom: calc(var(--safe-b) + 40px);
}
.has-tabs .main { padding-bottom: calc(var(--tabbar) + var(--safe-b) + 32px); }

.page {
  max-width: var(--col);
  margin: 0 auto;
  padding: 22px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: rise 0.36s var(--ease) both;
}
.page.wide { max-width: var(--col-wide); }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes pop-soft { 0% { transform: scale(0.94); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes slideup { from { transform: translateY(110%); } to { transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-6px) rotate(1.5deg); } }
@keyframes bounce-dot { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-5px); opacity: 1; } }
@keyframes scan { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes confetti {
  0% { transform: translate(-50%, -50%) rotate(0) scale(0.4); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(calc(-50% + cos(var(--a)) * var(--d)), calc(-50% + sin(var(--a)) * var(--d) + 60px)) rotate(var(--r)) scale(1); opacity: 0; }
}

/* Lists come in one row after another. */
.rows > *, .landing-steps > *, .picker > *, .mistakes > li, .suggestions > *, .grid2 > *, #members > .member, .price-grid > *, .pages > .page-tile, #invites .list-row {
  animation: rise 0.42s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.float { animation: float 4.5s ease-in-out infinite; }

.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head-col { display: flex; flex-direction: column; gap: 4px; }
.center-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.center-head p { max-width: 30rem; }
.narrow { width: 100%; max-width: 24rem; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

.section-label {
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.card {
  background: rgba(251, 254, 251, 0.92);
  border: 1px solid var(--edge);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card h3 { margin-bottom: 4px; }

.banner {
  display: block;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  background: var(--orange-wash);
  border: 1px solid rgba(255, 149, 0, 0.35);
  font-weight: 800;
  font-size: 0.92rem;
  animation: rise 0.4s var(--ease) both;
}
.banner.bad { background: var(--red-wash); border-color: rgba(255, 59, 48, 0.35); color: var(--red-deep); }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 40px 12px; }
.empty .btn { margin-top: 8px; }
.empty-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 18px; }
.empty-card .btn { margin-top: 6px; }

.blob { border-radius: 26%; }
.blob-md { width: 64px; height: 64px; }
.blob-lg { width: 88px; height: 88px; }

.spinner-wrap { display: flex; justify-content: center; padding: 60px 0; animation: fade 0.4s 0.15s both; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--edge); border-top-color: var(--green); animation: spin 0.8s linear infinite; }

.dots { display: inline-flex; gap: 4px; align-items: center; vertical-align: middle; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: bounce-dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(180deg, var(--green) 0%, var(--green-mid) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 6px 16px rgba(36, 138, 61, 0.28);
  transition: transform 0.18s var(--spring), box-shadow 0.18s ease, filter 0.15s ease;
  text-align: center;
}
.btn:hover:not(:disabled) { filter: brightness(1.04); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 8px 20px rgba(36, 138, 61, 0.34); }
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn.ghost { color: var(--green-deep); background: rgba(251, 254, 251, 0.9); border: 1.5px solid var(--edge); box-shadow: none; }
.btn.ghost:hover:not(:disabled) { background: #fff; border-color: rgba(52, 199, 89, 0.55); }
.btn.danger { background: linear-gradient(180deg, #FF5247, var(--red)); box-shadow: 0 6px 16px rgba(255, 59, 48, 0.28); }
.btn.big { min-height: 56px; font-size: 1.1rem; padding: 0 26px; border-radius: 18px; }
.btn.wide { width: 100%; }
.btn.small-btn { min-height: 36px; padding: 0 12px; border-radius: 12px; font-size: 0.88rem; }
.btn.approve { background: linear-gradient(180deg, var(--green), var(--green-deep)); }
.btn.reject { background: #fff; color: var(--red-deep); border: 1.5px solid rgba(255, 59, 48, 0.45); box-shadow: none; }
.btn.push { margin-left: auto; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--green-deep);
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid var(--edge);
  transition: transform 0.18s var(--spring), background 0.15s ease;
}
.pill:active { transform: scale(0.95); }
.pill:hover { background: #fff; }
.pill.solid { background: var(--green-deep); color: #fff; border-color: var(--green-deep); }
.link-btn { font-weight: 800; color: var(--ink-soft); padding: 8px 10px; }

.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft); transition: background 0.15s ease, transform 0.18s var(--spring); }
.icon-btn:hover { background: rgba(52, 199, 89, 0.12); }
.icon-btn.danger:hover { background: var(--red-wash); color: var(--red-deep); }
.icon-btn:active { transform: scale(0.9); }

.round-btn { width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 1.2rem; transition: background 0.15s ease, transform 0.18s var(--spring); }
.round-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.28); }
.round-btn:active:not(:disabled) { transform: scale(0.9); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions:empty { display: none; }

/* ------------------------------------------------------------- forms */

.form { display: flex; flex-direction: column; gap: 14px; }
.form.tight { gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.88rem; font-weight: 800; color: var(--ink-soft); }
.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--edge);
  background: #fff;
  font-weight: 700;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
textarea.input { resize: vertical; min-height: 64px; line-height: 1.4; }
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.18); }
.input::placeholder { color: var(--faint); font-weight: 600; }
.input:disabled, .input[readonly] { background: var(--cream); color: var(--ink-soft); }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form .input { flex: 1 1 12rem; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); font-size: 0.88rem; font-weight: 800; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1.5px; background: var(--edge); }

.auth-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.mail-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.mail-emoji { font-size: 2.6rem; display: inline-block; animation: wiggle 0.8s 0.3s ease-in-out 2; }
.pop-in { animation: pop-soft 0.35s var(--spring) both; }

.segmented { display: inline-flex; padding: 3px; border-radius: 13px; background: var(--cream); border: 1px solid var(--edge); gap: 2px; align-self: flex-start; }
.seg { padding: 7px 13px; border-radius: 10px; font-weight: 800; font-size: 0.88rem; color: var(--ink-soft); transition: background 0.2s var(--ease), color 0.2s ease, box-shadow 0.2s ease; }
.seg.on { background: #fff; color: var(--green-deep); box-shadow: 0 1px 4px rgba(29, 59, 38, 0.14); }

/* ------------------------------------------------------------- badges */

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 0.76rem; font-weight: 800; background: var(--cream-deep); color: var(--ink-soft); white-space: nowrap; vertical-align: middle; }
.badge.pass { background: rgba(52, 199, 89, 0.16); color: var(--green-deep); }
.badge.fail { background: rgba(255, 59, 48, 0.12); color: var(--red-deep); }
.badge.wait { background: rgba(255, 149, 0, 0.16); color: #B35F00; }

.avatar {
  --hue: 140;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-family: var(--display);
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, hsl(var(--hue), 70%, 60%), hsl(calc(var(--hue) + 25), 65%, 45%));
  box-shadow: 0 3px 8px hsla(var(--hue), 60%, 40%, 0.3);
}
.avatar.sm { width: 26px; height: 26px; font-size: 0.85rem; }
.avatar.lg { width: 44px; height: 44px; font-size: 1.2rem; }
.avatar.xl { width: 84px; height: 84px; font-size: 2.3rem; }
.avatar.star { background: linear-gradient(145deg, #FFD166, #FF9F1C); box-shadow: none; }

/* ------------------------------------------------------------- tab bar */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 6px 10px calc(var(--safe-b) + 6px);
  background: rgba(251, 254, 251, 0.88);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--edge);
}
.tabbar-inner { max-width: 32rem; margin: 0 auto; display: flex; justify-content: space-around; }
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0 4px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--faint);
  transition: color 0.2s ease;
}
.tab-icon { font-size: 1.35rem; display: inline-flex; padding: 3px 16px; border-radius: 999px; transition: background 0.25s var(--ease), transform 0.25s var(--spring); }
.tab.on { color: var(--green-deep); }
.tab.on .tab-icon { background: rgba(52, 199, 89, 0.16); transform: translateY(-1px); }
.tab:active .tab-icon { transform: scale(0.9); }

/* ------------------------------------------------------------- work list */

.kid-hero { display: flex; align-items: center; gap: 14px; }
.kid-hero h1 { font-size: 2.1rem; }

.snap-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 76px;
  border-radius: 24px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.45rem;
  color: #fff;
  background: linear-gradient(135deg, #3FD467 0%, var(--green-deep) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 12px 28px rgba(36, 138, 61, 0.35);
  transition: transform 0.2s var(--spring), box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}
.snap-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%); background-size: 200% 100%; animation: shimmer 3.5s ease-in-out infinite; }
.snap-hero:active { transform: scale(0.97); }
.snap-emoji { font-size: 1.8rem; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 5px;
  border-radius: 999px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid var(--edge);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.18s var(--spring), color 0.2s ease;
}
.chip:active { transform: scale(0.95); }
.chip.on { background: var(--green-deep); border-color: var(--green-deep); color: #fff; }
.chip .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--orange); color: #fff; font-size: 0.75rem; display: inline-flex; align-items: center; justify-content: center; animation: pop 0.4s var(--spring) both; }

.rows { display: flex; flex-direction: column; gap: 10px; }
.work-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 10px;
  border-radius: 18px;
  background: rgba(251, 254, 251, 0.95);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow);
  transition: transform 0.2s var(--spring), box-shadow 0.2s ease, border-color 0.2s ease;
}
.work-row:hover { box-shadow: var(--shadow-lift); border-color: rgba(52, 199, 89, 0.5); }
.work-row:active { transform: scale(0.98); }
.work-row:hover .chev { transform: translateX(3px); }
.chev { transition: transform 0.2s var(--ease); }
.thumb { position: relative; flex: none; width: 58px; height: 58px; border-radius: 14px; overflow: hidden; background: var(--cream-deep); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-scan { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(52, 199, 89, 0.55), transparent); width: 50%; animation: scan 1.4s ease-in-out infinite; }
.row-title { font-family: var(--display); font-weight: 700; font-size: 1.08rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { margin-top: 3px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--ink-soft); font-weight: 700; }

/* ------------------------------------------------------------- one work */

.back { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; margin: -8px 0 -6px -6px; padding: 6px 10px 6px 4px; border-radius: 999px; font-weight: 800; color: var(--green-deep); transition: background 0.15s ease, transform 0.2s var(--spring); }
.back:hover { background: rgba(52, 199, 89, 0.12); }
.back:active { transform: translateX(-3px); }
.work-head h1 { font-size: 1.8rem; overflow-wrap: anywhere; }
.work-head .row-meta { margin-top: 6px; font-size: 0.88rem; }

.result-host { display: contents; }
.result {
  position: relative;
  padding: 18px;
  border-radius: var(--r);
  background: #fff;
  border: 1.5px solid var(--edge);
  box-shadow: var(--shadow);
  animation: pop-soft 0.4s var(--spring) both;
  overflow: visible;
}
.result.is-passed { background: linear-gradient(180deg, #F2FCF4, #fff 70%); border-color: rgba(52, 199, 89, 0.55); }
.result.is-needs_work { background: linear-gradient(180deg, #FFF6F5, #fff 70%); border-color: rgba(255, 59, 48, 0.35); }
.result.is-error { background: linear-gradient(180deg, var(--orange-wash), #fff 70%); border-color: rgba(255, 149, 0, 0.4); }
.result.is-checking { overflow: hidden; }
.result-head { display: flex; align-items: flex-start; gap: 14px; }
.verdict { flex: none; font-size: 2.6rem; line-height: 1; animation: pop 0.55s var(--spring) both; animation-delay: 0.08s; }
.is-checking .verdict { animation: wiggle 1.4s ease-in-out infinite; }
.result-title { font-family: var(--display); font-weight: 800; font-size: 1.35rem; line-height: 1.15; }
.summary { margin-top: 4px; }
.scan-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--cream-deep); overflow: hidden; }
.scan-bar::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--green), transparent); animation: scan 1.3s ease-in-out infinite; }
.issues { margin-top: 12px; padding-left: 20px; font-size: 0.92rem; display: flex; flex-direction: column; gap: 4px; }
.answers { margin-top: 14px; padding: 12px 14px; border-radius: 16px; background: rgba(238, 249, 240, 0.7); border: 1px solid var(--edge); }
.answers-line { font-weight: 800; font-size: 0.95rem; }
.mistakes { list-style: none; margin-top: 8px; display: flex; flex-direction: column; gap: 8px; font-size: 0.94rem; }
.mistakes li { padding-left: 14px; position: relative; }
.mistakes li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.wrong { color: var(--red-deep); font-weight: 800; text-decoration: line-through; text-decoration-color: rgba(215, 0, 21, 0.45); }
.right { color: var(--green-deep); font-weight: 800; background: rgba(52, 199, 89, 0.14); padding: 0 5px; border-radius: 6px; }
.steps { margin-top: 12px; padding-left: 20px; font-size: 0.92rem; display: flex; flex-direction: column; gap: 3px; }
.result .tiny { margin-top: 10px; }

.confetti { position: absolute; left: 50%; top: 34px; width: 0; height: 0; pointer-events: none; z-index: 5; }
.result .confetti { left: 38px; }
.confetti i { position: absolute; left: 0; top: 0; width: 9px; height: 14px; border-radius: 2px; background: var(--c); animation: confetti 1.5s cubic-bezier(0.15, 0.6, 0.4, 1) both; animation-delay: var(--t); }
.confetti i:nth-child(3n) { width: 8px; height: 8px; border-radius: 50%; }

.parent-note { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 16px; font-weight: 800; background: var(--red-wash); border: 1.5px solid rgba(255, 59, 48, 0.3); animation: rise 0.4s var(--ease) both; }
.parent-note.approved { background: #F3FCF5; border-color: rgba(52, 199, 89, 0.5); }
.note-emoji { font-size: 1.3rem; line-height: 1.2; }

.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.page-tile {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  overflow: hidden;
  background: var(--cream-deep);
  border: 1.5px solid var(--edge);
  box-shadow: var(--shadow);
  transition: transform 0.2s var(--spring), box-shadow 0.2s ease;
  padding: 0;
}
button.page-tile:hover, .page-tile img:hover { cursor: zoom-in; }
button.page-tile:active { transform: scale(0.96); }
.page-tile img { width: 100%; height: 100%; object-fit: cover; }
.page-num { position: absolute; left: 6px; bottom: 6px; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: rgba(29, 59, 38, 0.78); color: #fff; font-size: 0.78rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.page-num.bad { background: var(--red); }
.page-num.new { background: var(--green); animation: pop 0.4s var(--spring) both; }
.page-remove { position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; border-radius: 50%; background: rgba(29, 59, 38, 0.7); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 0.85rem; transition: transform 0.18s var(--spring), background 0.15s ease; }
.page-remove:hover { background: var(--red); }
.page-remove:active { transform: scale(0.85); }
.page-retake { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.95); color: var(--green-deep); font-size: 0.8rem; font-weight: 800; box-shadow: var(--shadow); cursor: pointer; white-space: nowrap; transition: transform 0.18s var(--spring); }
.page-retake:active { transform: translate(-50%, -50%) scale(0.92); }
.page-tile.retaking { border-color: var(--green); box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.25); }
.page-tile.uploading { display: flex; align-items: center; justify-content: center; color: var(--green-deep); background: linear-gradient(90deg, var(--cream), #fff, var(--cream)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.page-progress { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(52, 199, 89, 0.28); transition: height 0.25s var(--ease); }

.capture-wrap { display: flex; flex-direction: column; gap: 18px; }
.capture { display: flex; flex-direction: column; gap: 14px; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.snap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.snap-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 60px;
  border-radius: 18px;
  font-weight: 800;
  font-size: 1.02rem;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #3FD467, var(--green-deep));
  box-shadow: 0 8px 20px rgba(36, 138, 61, 0.3);
  transition: transform 0.18s var(--spring);
  -webkit-user-select: none;
  user-select: none;
}
.snap-btn .icon { font-size: 1.25rem; }
.snap-btn:active { transform: scale(0.95); }
.snap-btn.secondary { color: var(--green-deep); background: #fff; border: 1.5px solid var(--edge); box-shadow: none; }
.capture-actions { display: flex; gap: 10px; }
.check-btn { min-height: 54px; }
.last-check { opacity: 0.85; }

.review { display: flex; flex-direction: column; gap: 10px; }
.flag { margin-top: 6px; padding-top: 14px; border-top: 1.5px dashed var(--edge); }
.flag-form { display: flex; flex-direction: column; gap: 6px; }
.flag-row { display: flex; gap: 8px; }
.flag-row .input { flex: 1; min-width: 0; }
.flag .link { background: none; border: 0; cursor: pointer; padding: 0; }

.chat-card { display: flex; flex-direction: column; gap: 12px; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-weight: 650;
  animation: bubble 0.32s var(--spring) both;
}
@keyframes bubble { from { opacity: 0; transform: translateY(8px) scale(0.96); } to { opacity: 1; transform: none; } }
.bubble.kid { align-self: flex-end; background: linear-gradient(135deg, #3FD467, var(--green-mid)); color: #fff; border-bottom-right-radius: 6px; transform-origin: bottom right; }
.bubble.tutor { align-self: flex-start; background: var(--cream); border: 1px solid var(--edge); border-bottom-left-radius: 6px; transform-origin: bottom left; }
.bubble.streaming { animation: none; }
.bubble.streaming::after { content: "▍"; color: var(--green); animation: fade 0.8s ease-in-out infinite alternate; }
#chat-thinking { color: var(--ink-soft); padding: 14px 18px; }
.hello { display: flex; align-items: flex-end; gap: 8px; }
.hello-icon { width: 36px; height: 36px; border-radius: 12px; flex: none; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.suggest { padding: 8px 14px; border-radius: 999px; background: #fff; border: 1.5px solid var(--edge); color: var(--green-deep); font-weight: 800; font-size: 0.9rem; transition: transform 0.18s var(--spring), background 0.15s ease; }
.suggest:hover { background: rgba(52, 199, 89, 0.1); }
.suggest:active { transform: scale(0.95); }
.composer { display: flex; gap: 8px; }
.composer .input { flex: 1; border-radius: 999px; padding-left: 18px; }
.send { flex: none; width: 48px; height: 48px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--green); color: #fff; font-size: 1.2rem; box-shadow: 0 6px 14px rgba(36, 138, 61, 0.28); transition: transform 0.2s var(--spring), background 0.15s ease; }
.send:active:not(:disabled) { transform: scale(0.88) rotate(-10deg); }
.send:disabled { background: var(--edge); box-shadow: none; opacity: 1; }
.demo-chat { margin-top: 14px; }

/* ------------------------------------------------------------- picker */

.picker-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding-top: 10px; }
.picker-head h1 { font-size: 2.2rem; }
.picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.picker-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 12px 20px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--edge);
  box-shadow: var(--shadow);
  transition: transform 0.25s var(--spring), box-shadow 0.2s ease, border-color 0.2s ease;
}
.picker-tile:hover:not(:disabled) { transform: translateY(-4px); box-shadow: var(--shadow-lift); border-color: rgba(52, 199, 89, 0.55); }
.picker-tile:hover:not(:disabled) .avatar { transform: scale(1.06) rotate(-4deg); }
.picker-tile:active:not(:disabled) { transform: scale(0.95); }
.picker-tile .avatar { transition: transform 0.3s var(--spring); }
.picker-tile.current { border-color: var(--green); }
.picker-tile.picked { border-color: var(--green); box-shadow: 0 0 0 6px rgba(52, 199, 89, 0.22), var(--shadow-lift); transform: scale(1.04); opacity: 1; }
.picker-tile.picked .avatar { animation: pop 0.5s var(--spring); }
.picker-tile:disabled:not(.picked) { opacity: 0.5; }
.picker-name { font-family: var(--display); font-weight: 800; font-size: 1.3rem; }

/* ------------------------------------------------------------- family */

.member { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--edge-soft); flex-wrap: wrap; }
#members > .member:first-of-type { border-top: 0; }
.member-name { font-weight: 800; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.sublist { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--edge-soft); }
.device-on { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; margin-top: 10px; }
.ok-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--green); margin-right: 8px; box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.2); }
#devices h3 { display: flex; align-items: center; gap: 6px; }
#devices .inline-form { margin-top: 12px; }

/* ------------------------------------------------------------- pricing */

.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.price-card { position: relative; display: flex; flex-direction: column; gap: 6px; transition: transform 0.25s var(--spring), box-shadow 0.2s ease; }
.price-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.price-card.featured { border-color: rgba(52, 199, 89, 0.6); background: linear-gradient(180deg, #F2FCF4, #fff); }
.price-card .btn { margin-top: 8px; }
.price { font-family: var(--display); font-weight: 800; font-size: 2.4rem; line-height: 1.1; color: var(--green-deep); }
.per { font-size: 1rem; color: var(--ink-soft); font-family: var(--font); }
.ribbon { position: absolute; top: 14px; right: 14px; padding: 3px 10px; border-radius: 999px; background: var(--green); color: #fff; font-size: 0.75rem; font-weight: 800; }
.table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 0.94rem; }
.table th { text-align: left; color: var(--ink-soft); font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; padding: 6px 4px; }
.table td { padding: 8px 4px; border-top: 1px solid var(--edge-soft); vertical-align: top; }
.table .num { text-align: right; white-space: nowrap; }
.checklist { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist .icon { color: var(--green); margin-top: 2px; }

/* ------------------------------------------------------------- landing */

.landing-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 20px 0 10px; }
.landing-blob { width: 150px; height: 150px; border-radius: 28%; filter: drop-shadow(0 18px 30px rgba(36, 138, 61, 0.3)); }
.landing-title { font-size: clamp(2.6rem, 9vw, 4rem); line-height: 1; }
.landing-title em { font-style: normal; color: var(--green-deep); background: linear-gradient(180deg, transparent 62%, rgba(52, 199, 89, 0.3) 62%); padding: 0 4px; }
.landing-sub { max-width: 34rem; font-size: 1.12rem; color: var(--ink-soft); }
.cta-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 6px; }
.landing-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.step { display: flex; flex-direction: column; gap: 6px; transition: transform 0.25s var(--spring); }
.step:hover { transform: translateY(-3px) rotate(-0.4deg); }
.step-emoji { font-size: 2rem; }
.landing-demo { display: flex; flex-direction: column; gap: 10px; }
.landing-demo .result { animation: none; }
.landing-family { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 10px 0; }
.landing-family p { max-width: 30rem; }
.footer { text-align: center; color: var(--ink-soft); font-size: 0.88rem; font-weight: 700; padding: 12px 0 8px; }
.footer a:hover { color: var(--green-deep); }

.prose { display: flex; flex-direction: column; gap: 12px; }
.prose h2 { font-size: 1.25rem; margin-top: 8px; }
.prose ul { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.prose p, .prose li { font-weight: 600; }

/* ------------------------------------------------------------- admin */

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.grid2 .span2 { grid-column: 1 / -1; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.kpi-value { font-family: var(--display); font-weight: 800; font-size: 1.8rem; color: var(--green-deep); line-height: 1.1; }
.bar { height: 5px; margin-top: 5px; border-radius: 999px; background: var(--cream-deep); overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--green), var(--green-deep)); border-radius: 999px; animation: grow 0.8s var(--ease) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.plain-list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-top: 8px; font-size: 0.94rem; }

/* ------------------------------------------------------------- overlays */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(29, 59, 38, 0.32);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.18s ease-out;
}
.sheet {
  width: 100%;
  max-width: 30rem;
  margin: 0 10px calc(var(--safe-b) + 10px);
  padding: 10px 20px 20px;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 -10px 40px rgba(29, 59, 38, 0.22);
  animation: slideup 0.34s var(--spring);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sheet h3 { text-align: center; }
.sheet-grab { width: 40px; height: 5px; border-radius: 999px; background: var(--edge); align-self: center; }
.sheet-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 640px) { .sheet-backdrop { align-items: center; } .sheet { margin: 0; animation: pop-soft 0.3s var(--spring); } }

.toast-host { position: fixed; left: 0; right: 0; top: calc(var(--safe-t) + 70px); z-index: 60; display: flex; justify-content: center; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto;
  max-width: 28rem;
  padding: 12px 18px;
  border-radius: 18px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(29, 59, 38, 0.3);
  cursor: pointer;
  animation: toast 0.42s var(--spring) both;
}
.toast.bad { background: var(--red-deep); }
@keyframes toast { from { opacity: 0; transform: translateY(-16px) scale(0.95); } to { opacity: 1; transform: none; } }

.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(10, 22, 14, 0.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(var(--safe-t) + 56px) 12px calc(var(--safe-b) + 90px); animation: fade 0.2s ease-out; }
.lightbox-stage { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.lightbox-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); animation: zoom-in 0.32s var(--spring) both; }
@keyframes zoom-in { from { opacity: 0; transform: scale(0.88); } to { opacity: 1; transform: none; } }
.lightbox-bar { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-b) + 20px); display: flex; align-items: center; justify-content: center; gap: 18px; color: #fff; }
.lightbox-count { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; min-width: 7rem; text-align: center; }
.lightbox-close { position: absolute; top: calc(var(--safe-t) + 12px); right: 12px; }

/* ------------------------------------------------------ setup wizard */

/* One page for every step: the dots stretch to the current step, and each
   step slides in from the side it came from (back slides in from the left). */
.wizard { display: flex; flex-direction: column; gap: 18px; }
.wizard-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; }
.wizard-top-gap { width: 40px; flex: none; }
.progress-dots { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 0 auto; }
.narrow > .progress-dots { margin-bottom: -6px; }
.pdot { width: 9px; height: 9px; border-radius: 999px; background: var(--edge); transition: width 0.45s var(--spring), background 0.3s ease; }
.pdot.on { background: var(--green); }
.pdot.now { width: 28px; background: var(--green-deep); }
.wizard-host { display: grid; overflow-x: clip; }
.wizard-step { grid-area: 1 / 1; display: flex; flex-direction: column; gap: 16px; animation: step-in 0.42s var(--ease) both; }
.wizard-step.back { animation-name: step-back; }
@keyframes step-in { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
@keyframes step-back { from { opacity: 0; transform: translateX(-36px); } to { opacity: 1; transform: none; } }
.wizard-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 4px 8px 0; }
.wizard-emoji { font-size: 3rem; line-height: 1; animation: pop 0.5s var(--spring) 0.1s both; }
.wizard-body { display: flex; flex-direction: column; gap: 16px; }
.wizard-kids { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.wizard-kid { display: flex; align-items: center; gap: 12px; padding: 6px 4px; animation: pop-soft 0.35s var(--spring) both; animation-delay: calc(var(--i, 0) * 45ms); }
.wizard-ok { display: flex; align-items: center; font-weight: 800; color: var(--green-deep); animation: pop-soft 0.35s var(--spring) both; }
.wizard-choices { display: flex; gap: 10px; flex-wrap: wrap; }
.wizard-choices > * { flex: 1 1 12rem; }
.wizard-choices.stack { flex-direction: column; }
.wizard-choices.stack > * { flex: none; }
.wizard-howto { margin: 4px 0 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; }
.mini-picker { display: flex; flex-direction: column; align-items: center; gap: 10px; background: linear-gradient(180deg, #fff, var(--cream)); }
.mini-picker-title { font-family: var(--display); font-weight: 700; font-size: 1.2rem; }
.mini-picker-tiles { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.mini-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; animation: pop 0.45s var(--spring) both; animation-delay: calc(200ms + var(--i, 0) * 90ms); }
.btn.fake { pointer-events: none; }
.wizard-flow { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.flow-step { position: relative; display: flex; align-items: flex-start; gap: 14px; animation: rise 0.42s var(--ease) both; animation-delay: calc(var(--i, 0) * 110ms); }
.flow-num { position: absolute; top: -8px; left: -8px; width: 24px; height: 24px; border-radius: 50%; background: var(--green-deep); color: #fff; font-size: 0.78rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.flow-emoji { font-size: 2rem; line-height: 1; flex: none; }
.setup-estimate { margin-top: 10px; }
.wizard-done { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding-top: 8px; }
.wizard-done .confetti { top: 70px; }
.checklist li.todo { color: var(--ink-soft); }
.todo-dot { width: 12px; height: 12px; margin: 5px 3px 0; border-radius: 50%; border: 2px solid var(--faint); flex: none; }

/* ------------------------------------------------------------- sizes */

@media (min-width: 700px) {
  .page { padding-top: 32px; gap: 22px; }
  h1 { font-size: 2.3rem; }
  .card { padding: 22px; }
}

@media (max-width: 380px) {
  .snap-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; animation-delay: 0ms !important; }
  .confetti { display: none; }
}
[hidden] { display: none !important; }
