/*
 * Mobile-first, iOS-flavoured: system typography, generous touch targets,
 * grouped-inset cards on a tinted background, and a bottom tab bar. Desktop
 * gets the same layout centred in a phone-width column rather than a second
 * design to maintain.
 *
 * Every colour, font, radius and shadow is a variable defined in
 * config/design.yml; see docs/design.md.
 */

:root {
  /* Colours, fonts, radii and shadows come from config/design.yml, written
     into the page by the layout. Only layout geometry is fixed here. */
  --tap: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(64px + var(--safe-bottom));
}

.shell {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Large title, the way a native list screen opens */
.page-header {
  padding: calc(12px + var(--safe-top)) 0 8px;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.page-header .subtitle {
  color: var(--label-secondary);
  font-size: 15px;
  margin-top: 2px;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--label-secondary);
  margin: 24px 4px 8px;
}

/* Grouped inset list */
.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.card + .card { margin-top: 12px; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--separator);
}

.row:last-child { border-bottom: none; }

.row-main { flex: 1; min-width: 0; }

.row-title {
  font-size: 17px;
  font-weight: 500;
  margin: 0;
}

.row-meta {
  font-size: 13px;
  color: var(--label-secondary);
  margin-top: 2px;
}

.row-trailing {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.strike .row-title {
  text-decoration: line-through;
  color: var(--label-tertiary);
}

/* Hero summary */
.hero {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 20px;
  text-align: center;
}

.hero-points {
  font-family: var(--font-mono);
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero-label {
  color: var(--label-secondary);
  font-size: 15px;
}

/* Today's obligations, one dot each, counting down to the bonus tier. */
.today-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px 10px;
}

.today-dots { display: flex; gap: 8px; }

.today-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--control-border);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.today-dot[data-state="submitted"],
.today-dot[data-state="approved"] {
  background: var(--success);
  border-color: var(--success);
  animation: pop-in 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.today-dot[data-state="rejected"] { border-color: var(--sent-back); }

.today-countdown {
  margin: 0;
  font-size: 15px;
  color: var(--label-secondary);
  text-align: right;
}

.today-unlocked {
  font-size: 15px;
  font-weight: 600;
  color: var(--unlocked);
  text-decoration: none;
  text-align: right;
  animation: pop-in 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {
  .today-dot, .today-unlocked { animation: none !important; }
}

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--label-secondary);
  white-space: nowrap;
}


.pill-points { color: var(--points); }
.pill-money { color: var(--money); }
.pill-waiting { color: var(--waiting); }
.pill-done { color: var(--success); }
.pill-back { color: var(--sent-back); }

/* Buttons */
/* The same whether it is a <button> or a link: the label sits in the middle
   of the tap target, and a link does not read as a link. */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--radius-control);
  background: var(--tint);
  color: var(--on-tint);
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

.btn:active { transform: scale(0.97); opacity: 0.85; }

.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.btn-block { display: flex; width: 100%; }

.btn-secondary {
  background: var(--fill);
  color: var(--tint);
}


.btn-quiet {
  background: transparent;
  color: var(--danger);
  padding: 0 10px;
}

.btn-small {
  min-height: 36px;
  font-size: 15px;
  padding: 0 14px;
  border-radius: var(--radius-compact);
}

/* Circular tick, the tap target a child actually aims at */
.tick {
  appearance: none;
  border: 2px solid var(--control-border);
  background: transparent;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 17px;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.tick:active { transform: scale(0.88); }

.tick[data-state="submitted"] {
  border-color: var(--waiting);
  color: var(--waiting);
}

.tick[data-state="approved"] {
  background: var(--success);
  border-color: var(--success);
  color: var(--on-success);
}

/* Empty state */
.empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--label-secondary);
}

.empty-emoji { font-size: 40px; display: block; margin-bottom: 8px; }

/* Banner */
.banner {
  border-radius: var(--radius-panel);
  padding: 14px 16px;
  font-size: 15px;
  margin-top: 12px;
}

.banner-locked {
  background: color-mix(in srgb, var(--locked) 12%, transparent);
  color: var(--locked);
}

.banner-open {
  background: color-mix(in srgb, var(--unlocked) 12%, transparent);
  color: var(--unlocked);
}

/* Flash */
.flash {
  border-radius: var(--radius-panel);
  padding: 12px 16px;
  margin: 12px 0;
  font-size: 15px;
  font-weight: 500;
}

.flash-notice { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.flash-alert { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* Bottom tab bar */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
  padding-bottom: var(--safe-bottom);
  z-index: 10;
}

.tabbar a {
  flex: 1;
  text-align: center;
  padding: 8px 0 6px;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  color: var(--label-tertiary);
  min-height: var(--tap);
}

.tabbar a[aria-current="page"] { color: var(--tint); }

.tabbar .tab-icon { display: block; font-size: 22px; line-height: 1.2; }

/* Locale switch */
.locale-switch {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  padding-top: calc(8px + var(--safe-top));
}

.locale-switch a {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--label-tertiary);
  padding: 4px 10px;
  border-radius: 999px;
}

.locale-switch a[aria-current="true"] {
  color: var(--tint);
  background: var(--surface);
}

/* Sign-in */
.auth {
  max-width: 400px;
  margin: 0 auto;
  padding: 48px 20px;
}

.auth h1 { font-family: var(--font-display); font-size: 28px; margin-bottom: 20px; }

.field {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 16px;
  margin-bottom: 12px;
  font: inherit;
  color: var(--label);
  background: var(--surface);
  border: none;
  border-radius: var(--radius-control);
}

.field:focus {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.link {
  display: inline-block;
  margin-top: 16px;
  color: var(--tint);
  text-decoration: none;
  font-size: 15px;
}

.muted { color: var(--label-secondary); font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- Forms ---- */
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--label-secondary);
  margin: 12px 2px 6px;
}

.form-label:first-child { margin-top: 0; }

.form-hint {
  font-size: 13px;
  color: var(--label-tertiary);
  margin: -4px 2px 4px;
}

select.field {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--label-tertiary) 50%),
                    linear-gradient(135deg, var(--label-tertiary) 50%, transparent 50%);
  background-position: calc(100% - 20px) 20px, calc(100% - 15px) 20px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.weekday-picker {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.weekday {
  flex: 1;
  text-align: center;
  position: relative;
}

.weekday input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.weekday span {
  display: grid;
  place-items: center;
  height: 40px;
  border-radius: var(--radius-compact);
  background: var(--fill);
  font-size: 12px;
  font-weight: 600;
  color: var(--label-secondary);
  transition: background 140ms ease, color 140ms ease;
}

.weekday input:checked + span {
  background: var(--tint);
  color: var(--on-tint);
}

.choice-group { display: grid; gap: 8px; }

.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-control);
  background: var(--fill);
  cursor: pointer;
  min-height: var(--tap);
}

.choice input { margin-top: 3px; accent-color: var(--tint); width: 20px; height: 20px; }
.choice strong { display: block; font-size: 15px; font-weight: 600; }
.choice em { display: block; font-style: normal; font-size: 13px; color: var(--label-secondary); margin-top: 2px; }


/* ---- Gamified feedback ---- */
@keyframes pop-in {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes rise-fade {
  0% { transform: translateY(0) scale(0.9); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translateY(-46px) scale(1.15); opacity: 0; }
}

@keyframes cheer-in {
  0% { transform: translateY(24px) scale(0.92); opacity: 0; }
  55% { transform: translateY(-4px) scale(1.03); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes confetti-fall {
  0% { transform: translate(0, -10px) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx, 0), 60vh) rotate(var(--spin, 360deg)); opacity: 0; }
}

@keyframes ring-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 50%, transparent); }
  100% { box-shadow: 0 0 0 18px color-mix(in srgb, var(--success) 0%, transparent); }
}

.tick.is-celebrating {
  animation: pop-in 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
  background: var(--success);
  border-color: var(--success);
  color: var(--on-success);
}

.tick.is-celebrating::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  animation: ring-pulse 620ms ease-out;
}

.points-float {
  position: absolute;
  right: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--success);
  pointer-events: none;
  animation: rise-fade 900ms ease-out forwards;
  z-index: 5;
}

.row { position: relative; }
.tick { position: relative; }

.cheer {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--label);
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 600;
  box-shadow: var(--shadow-float);
  animation: cheer-in 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 20;
  max-width: calc(100% - 32px);
  text-align: center;
}

.confetti-piece {
  position: fixed;
  top: 18vh;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 15;
  animation: confetti-fall var(--fall, 1500ms) cubic-bezier(0.25, 0.6, 0.4, 1) forwards;
}

.sound-toggle {
  background: none;
  border: none;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--label-tertiary);
  min-height: 32px;
}

@media (prefers-reduced-motion: reduce) {
  .tick.is-celebrating,
  .points-float,
  .cheer,
  .confetti-piece { animation: none !important; }
  .confetti-piece { display: none; }
}

/* ---- Glossary ---- */
.glossary-row { align-items: flex-start; }

.glossary-definition {
  font-size: 15px;
  line-height: 1.5;
  color: var(--label-secondary);
  margin-top: 4px;
}

.glossary-definition strong { color: var(--label); font-weight: 600; }

.help-link {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--label-tertiary);
  padding: 4px 10px;
  border-radius: 999px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.help-link[aria-current="page"] { color: var(--tint); background: var(--surface); }

/* ---- Review: rating and comment ---- */
.review-item {
  padding: 12px 16px 14px;
  border-bottom: 0.5px solid var(--separator);
}

.review-item:last-child { border-bottom: none; }
.review-item .row { padding-left: 0; padding-right: 0; }

.review-form { margin-top: 6px; }

/* Stars are laid out in reverse so CSS can light up the hovered one and
   every star before it without any JavaScript. */
.stars {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: center;
  border: none;
  margin: 0;
  padding: 0;
  gap: 2px;
}

.stars input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.stars label {
  font-size: 28px;
  line-height: 1;
  color: var(--control-border);
  cursor: pointer;
  padding: 2px 3px;
  transition: color 120ms ease, transform 120ms ease;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.stars input:checked ~ label,
.stars label:hover,
.stars label:hover ~ label { color: var(--star); }

.stars label:active { transform: scale(1.2); }

.stars input:focus-visible + label { outline: 2px solid var(--focus); border-radius: 4px; }

.stars-note {
  order: -1;
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--label-secondary);
}

.review-comment {
  margin: 8px 0 0;
  font-size: 15px;
  min-height: 40px;
  padding: 8px 12px;
  background: var(--fill);
}


.review-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.review-actions .btn { flex: 1; }
.review-send-back { flex: 0 0 auto; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The rating a child reads back */
.star-readout { color: var(--star); letter-spacing: 1px; }
.star-praise { font-weight: 600; color: var(--label); }

/* ---- Locked bonus jobs ---- */
/* Visibly out of reach without being invisible: a child can still read what
   is waiting for them, which is the point of showing the list at all. */
.row.is-locked .row-title,
.row.is-locked .row-meta {
  color: var(--label-tertiary);
}

.row.is-locked .pill {
  opacity: 0.45;
  filter: grayscale(1);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(1);
}

.lock {
  font-size: 13px;
  margin-right: 4px;
  vertical-align: 1px;
}

.banner-locked .lock { margin-right: 6px; }

/* ---- Landing ---- */
.landing {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(24px + var(--safe-top)) 20px 40px;
}

.landing-hero { text-align: center; }

/* The brand mark from config/design.yml. A monochrome one is inlined, so it
   paints in the design's logo colour and follows the scheme; anything else is
   an image, given the same box. */
.brand-mark {
  display: block;
  width: fit-content;
  margin: 0 auto 14px;
  color: var(--logo);
  line-height: 0;
}

img.brand-mark, .brand-mark img { border-radius: var(--radius-card); }

.brand-mark-hero { margin-bottom: 18px; }

.landing-hero h1 {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

.landing-sub {
  color: var(--label-secondary);
  font-size: 17px;
  margin: 0 auto 24px;
  max-width: 34ch;
}

.landing-actions { display: grid; gap: 10px; margin-bottom: 36px; }

.landing-points { display: grid; gap: 14px; }

.landing-point {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 16px;
}

.landing-point-icon { font-size: 26px; line-height: 1.2; }
.landing-point h2 { font-size: 16px; margin: 0 0 3px; }
.landing-point p { font-size: 15px; color: var(--label-secondary); margin: 0; }

.landing-note {
  margin-top: 24px;
  font-size: 14px;
  color: var(--label-tertiary);
  text-align: center;
  line-height: 1.5;
}

.landing-footer { margin-top: 28px; text-align: center; }
.landing-footer a { color: var(--label-tertiary); font-size: 14px; text-decoration: none; }

/* ---- Onboarding ---- */
.persona-choice { display: grid; gap: 12px; margin: 20px 0; }

.persona {
  display: block;
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 18px;
  text-decoration: none;
  color: inherit;
  transition: transform 120ms ease;
}

.persona:active { transform: scale(0.98); }
.persona-icon { font-size: 30px; display: block; margin-bottom: 6px; }
.persona strong { display: block; font-size: 18px; }
.persona em { display: block; font-style: normal; font-size: 15px; color: var(--label-secondary); margin-top: 3px; }

/* The honeypot: off-screen for people, present for machines. */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.invite-link {
  font-family: var(--font-mono);
  font-size: 12px;
  word-break: break-all;
  color: var(--tint);
}
