/* ==========================================================================
   Views — styles scoped to a single screen. Anything reused twice should be
   promoted into components.css instead.
   ========================================================================== */

/* --- Welcome / onboarding ------------------------------------------------ */
.welcome__logo { font-size: 68px; text-align: center; animation: wiggle 3s var(--ease) infinite; }
.welcome__title { font-size: var(--fs-3xl); text-align: center; }
.welcome__tagline { text-align: center; color: var(--text-muted); max-width: 30ch; margin-inline: auto; }

.wizard__steps { display: flex; gap: 6px; justify-content: center; margin-bottom: var(--sp-5); }
.wizard__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); transition: all var(--dur) var(--ease); }
.wizard__dot[data-active='true'] { width: 24px; background: var(--brand-500); border-radius: var(--r-pill); }

.room-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.room-row__emoji { font-size: 26px; }

/* --- Profile picker (lock screen) ---------------------------------------- */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4) var(--sp-3);
}
.profile-grid__item {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  transition: transform var(--dur) var(--ease);
}
.profile-grid__item:active { transform: scale(.93); }
.profile-grid__name { font-size: var(--fs-sm); font-weight: var(--fw-bold); }

.pin-dots { display: flex; gap: var(--sp-3); justify-content: center; margin-block: var(--sp-5); }
.pin-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface-sunk);
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast);
}
.pin-dot[data-filled='true'] { background: var(--brand-500); transform: scale(1.12); }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); max-width: 280px; margin-inline: auto; }
.keypad__key {
  aspect-ratio: 1.35;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  transition: transform var(--dur-fast) var(--ease);
}
.keypad__key:active { transform: scale(.93); background: var(--surface-muted); }
.keypad__key--ghost { background: transparent; box-shadow: none; font-size: var(--fs-md); }

/* --- Home ---------------------------------------------------------------- */
.budget { display: flex; flex-direction: column; gap: var(--sp-2); }
.budget__figures { display: flex; align-items: baseline; justify-content: space-between; }
.budget__used { font-size: var(--fs-xl); font-weight: var(--fw-black); font-variant-numeric: tabular-nums; }

.streak-flames { font-size: var(--fs-lg); letter-spacing: -2px; }

/* --- Chore card ---------------------------------------------------------- */
.chore-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  border-left: 5px solid var(--accent, var(--brand-300));
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur);
}
.chore-card:active { transform: scale(.985); }
.chore-card__icon {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  flex: 0 0 auto;
  border-radius: var(--r-md);
  background: var(--surface-muted);
  background: color-mix(in srgb, var(--accent, var(--brand-300)) 18%, var(--surface));
  font-size: 24px;
}
.chore-card__title { font-weight: var(--fw-bold); }
.chore-card__meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chore-card--done { opacity: .6; }
.chore-card--done .chore-card__title { text-decoration: line-through; }
.chore-card--locked { opacity: .5; }

/* --- Chore detail sheet -------------------------------------------------- */
.photo-slot {
  position: relative;
  display: grid; place-items: center; gap: var(--sp-2);
  width: 100%;
  min-height: 150px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface-muted);
  color: var(--text-muted);
  overflow: hidden;
  cursor: pointer;
}
.photo-slot img { width: 100%; height: 100%; max-height: 260px; object-fit: cover; }
.photo-slot__emoji { font-size: 30px; }
.photo-slot__clear {
  position: absolute; top: var(--sp-2); right: var(--sp-2);
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff; font-size: 15px;
}
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.photo-pair .photo-slot { min-height: 118px; }

/* --- Leaderboard --------------------------------------------------------- */
.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}
.podium__slot { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); }
.podium__crown { font-size: 22px; }
.podium__block {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 2px;
  width: 100%;
  padding: var(--sp-2) var(--sp-1);
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: linear-gradient(180deg, var(--brand-300), var(--brand-500));
  color: #fff;
  font-weight: var(--fw-black);
}
.podium__slot[data-rank='1'] .podium__block { height: 92px; background: linear-gradient(180deg, var(--mango-400), var(--mango-500)); }
.podium__slot[data-rank='2'] .podium__block { height: 70px; background: linear-gradient(180deg, #CBD5E1, #94A3B8); }
.podium__slot[data-rank='3'] .podium__block { height: 56px; background: linear-gradient(180deg, #E0A87E, #C1794A); }
.podium__pts { font-size: var(--fs-lg); line-height: 1.1; }
.podium__name { font-size: var(--fs-xs); font-weight: var(--fw-bold); }

.rank-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.rank-row--me { box-shadow: 0 0 0 2px var(--brand-500), var(--shadow-sm); }
.rank-row__pos { width: 24px; text-align: center; font-weight: var(--fw-black); color: var(--text-faint); font-variant-numeric: tabular-nums; }
.rank-row__pts { font-weight: var(--fw-black); font-variant-numeric: tabular-nums; }

/* --- Rewards ------------------------------------------------------------- */
.reward-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.reward-card {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-1);
  padding: var(--sp-4) var(--sp-3);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: transform var(--dur-fast) var(--ease);
}
.reward-card:active { transform: scale(.97); }
.reward-card__emoji { font-size: 34px; }
.reward-card__title { font-weight: var(--fw-bold); font-size: var(--fs-sm); }
.reward-card--locked { opacity: .55; }

/* --- Admin / settings ---------------------------------------------------- */
.setting-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.setting-row:first-child { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.setting-row:last-child  { border-radius: 0 0 var(--r-lg) var(--r-lg); border-bottom: 0; }
.setting-row:only-child  { border-radius: var(--r-lg); }
.setting-row__icon { font-size: 20px; width: 28px; text-align: center; }

.fab {
  position: fixed;
  right: max(var(--sp-4), calc(50vw - var(--app-max) / 2 + var(--sp-4)));
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-4));
  z-index: var(--z-tabbar);
  display: flex; align-items: center; gap: var(--sp-2);
  height: 52px; padding-inline: var(--sp-5);
  border-radius: var(--r-pill);
  background: var(--brand-500);
  color: #fff;
  font-weight: var(--fw-bold);
  box-shadow: var(--shadow-brand);
  transition: transform var(--dur-fast) var(--ease);
}
.fab:active { transform: scale(.94); }

/* --- Boot failure notice (see the classic script in index.html) ---------- */
.boot-error { gap: var(--sp-4); }
.boot-error pre {
  margin: 0 auto;
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.boot-error code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: var(--fs-sm);
  white-space: pre;
}

/* --- Cloud mode ---------------------------------------------------------- */
.offline-banner {
  position: fixed;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  left: 50%;
  z-index: var(--z-tabbar);
  width: min(100%, var(--app-max));
  padding: var(--sp-2) var(--sp-4);
  transform: translateX(-50%);
  background: var(--warning-soft);
  color: #8A5B00;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  .offline-banner { color: var(--mango-400); }
}

.household-code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: var(--fs-2xl);
  font-weight: var(--fw-black);
  letter-spacing: .14em;
  text-align: center;
  color: var(--brand-500);
}

/* --- Appearance ---------------------------------------------------------- */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
}

.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--sp-2) 2px;
  border-radius: var(--r-md);
  transition: transform var(--dur-fast) var(--ease);
}
.theme-swatch:active { transform: scale(.94); }

.theme-swatch__dot {
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  background: var(--swatch);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .3);
  transition: box-shadow var(--dur) var(--ease);
}

.theme-swatch[aria-pressed='true'] .theme-swatch__dot {
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--swatch);
}

.theme-swatch__name {
  font-size: 10px;
  font-weight: var(--fw-bold);
  color: var(--text-muted);
}

/* The native colour input is the "wheel" — it opens the OS picker, which is a
   proper wheel on iOS and macOS, and is fully accessible for free. */
.theme-wheel {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.theme-wheel::-webkit-color-swatch-wrapper { padding: 0; }
.theme-wheel::-webkit-color-swatch { border: 0; border-radius: var(--r-md); }
.theme-wheel::-moz-color-swatch { border: 0; border-radius: var(--r-md); }
