:root {
  color-scheme: light dark;
  /* Light (default) */
  --n: #1f3a5f; /* header, the app's navy */
  --t: #2a7f8e; /* buttons and accents (white text on it) */
  --l: #e8f1f4; /* soft tint: day boxes, the chosen tab, counts */
  --bg: #f6f8f9;
  --surface: #fff; /* cards, tabs, folds, dialogs */
  --text: #1a1d21;
  --heading: #1f3a5f;
  --accent: #2a7f8e; /* accent as text, on a surface */
  --muted: #5f6b78;
  --chevron: #8a94a3;
  --track: #dde1ea;
  --border: #ccd2dc;
  --shadow: #0002;
  --gray: #646e7b; /* secondary buttons (white text) */
  --warn: #e0a100; /* warning buttons (dark text) */
  --warn-text: #1a1d21;
  --danger: #c0392b;
  --err: #b8321f;
  --good: #1e7e46;
  --perfect-bg: #cdeedd;
  --perfect: #12633a;
  --ok-bg: #fff1c2;
  --ok: #7a5b00;
  --bad-bg: #f7d4d0;
  --bad: #9b2c20;
  --demo-bg: #fff4d6;
  --demo-line: #e8d49a;
  --offer-line: #c9dde3;
  --toast: #222;
  --dim: rgba(15, 30, 50, 0.35);
  --gold: #f5b82e; /* the star of the logo and the welcome's sparkles */
  --glass: rgba(255, 255, 255, 0.14); /* soft panels on the welcome's colors */
  --glow: rgba(0, 0, 0, 0.18);
  --sunrise: rgba(245, 184, 46, 0.45); /* the warm glow behind the welcome's stars */
}

/* Dark: follows the device's setting */
@media (prefers-color-scheme: dark) {
  :root {
    --n: #18304f;
    --l: #20333c;
    --bg: #101418;
    --surface: #1b2229;
    --text: #e6ebf0;
    --heading: #cfe2f5;
    --accent: #5fc4d4;
    --muted: #a0abb7;
    --chevron: #75818e;
    --track: #33404c;
    --border: #2d3742;
    --shadow: #0008;
    --gray: #5b6573;
    --err: #ff8f80;
    --good: #6fd39a;
    --perfect-bg: #1d4a33;
    --perfect: #a5e8c3;
    --ok-bg: #4a3d10;
    --ok: #f3d77a;
    --bad-bg: #57251f;
    --bad: #f7b8b0;
    --demo-bg: #3a3218;
    --demo-line: #5c4d22;
    --offer-line: #2e4752;
    --toast: #2d3742;
    --dim: rgba(0, 0, 0, 0.55);
  }
}

body {
  margin: 0;
  font:
    16px -apple-system,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 70px;
}

header {
  background: var(--n);
  color: #fff;
  padding: env(safe-area-inset-top) 14px 12px;
  text-align: center;
}

header b {
  font-size: 30px;
  display: block;
}

/* Progress bars */
.bar {
  height: 10px;
  background: var(--track);
  border-radius: 6px;
  overflow: hidden;
  margin: 6px 0;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--t);
}

/* Bottom tabs */
.tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabs button {
  flex: 1;
  border: 0;
  background: 0;
  padding: 6px 0 8px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: inherit;
}

.tabs i {
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  padding: 3px 14px;
  border-radius: 14px;
}

.tabs .on {
  color: var(--accent);
  font-weight: 700;
}

.tabs .on i {
  background: var(--l);
}

main {
  padding: 10px;
}

/* Cards and rows */
.card {
  background: var(--surface);
  border-radius: 12px;
  padding: 12px;
  margin: 8px 0;
  box-shadow: 0 1px 3px var(--shadow);
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.row > div:first-child {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.row > div:last-child:not(:first-child) {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

.row.stk {
  flex-wrap: wrap;
}

.row.stk > div:first-child {
  flex: 1 1 100%;
}

.row.stk > div:last-child {
  margin-left: auto;
}

small {
  color: var(--muted);
}

/* Buttons */
.b {
  white-space: nowrap;
  border: 0;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 15px;
  background: var(--t);
  color: #fff;
}

/* A button alone on its line (e.g. "Add a device for <long name>", longer in German) wraps
   instead of pushing the page sideways. */
p > .b {
  white-space: normal;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.b.r {
  background: var(--danger);
}

.b.w {
  background: var(--warn);
  color: var(--warn-text);
}

.b.g {
  background: var(--gray);
}

.b:disabled {
  opacity: 0.35;
}

/* Toast */
#toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(64px + env(safe-area-inset-bottom));
  background: var(--toast);
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  display: none;
  justify-content: space-between;
  align-items: center;
  z-index: 9;
  gap: 8px;
}

/* Reward celebration */
#party {
  position: fixed;
  inset: 0;
  background: #0008;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  text-align: center;
  font-size: 22px;
}

#party .party-card {
  animation: lw-bounce 0.7s ease-out both;
  background: var(--surface);
  border-radius: 18px;
  padding: 28px 36px;
  font-size: 24px;
}

#party .party-card > span {
  font-size: 64px;
  display: block;
  animation: pop 0.6s ease infinite alternate;
}

@keyframes pop {
  to {
    transform: scale(1.25) rotate(8deg);
  }
}

/* Week strip */
.strip {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.strip .d {
  flex: 1;
  border: 0;
  border-radius: 8px;
  padding: 6px 0;
  font-size: 13px;
  background: var(--l);
  color: var(--heading);
  text-align: center;
  line-height: 1.5;
  font-family: inherit;
}

.strip .perfect {
  background: var(--perfect-bg);
  color: var(--perfect);
}

.strip .ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.strip .bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.strip .fut {
  opacity: 0.4;
}

h3 {
  margin: 16px 4px 0;
  color: var(--heading);
}

.wnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: center;
}

.wnav .b {
  font-size: 22px;
  padding: 6px 16px;
}

/* Folded Settings sections */
.fold {
  margin: 8px 0;
}

.fold summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 1px 3px var(--shadow);
  font-weight: 700;
  color: var(--heading);
  font-size: 17px;
  cursor: pointer;
}

.fold summary::-webkit-details-marker {
  display: none;
}

.fold summary::after {
  content: "›";
  margin-left: auto;
  font-size: 24px;
  line-height: 1;
  color: var(--chevron);
  transition: transform 0.15s;
}

.fold[open] summary::after {
  transform: rotate(90deg);
}

.fold .cnt {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  background: var(--l);
  border-radius: 10px;
  padding: 1px 8px;
}

.fold[open] > summary {
  margin-bottom: 4px;
}

.fold > .b {
  margin: 4px 0 8px;
}

input {
  font-size: 20px;
  padding: 10px;
  width: 70%;
  text-align: center;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Classes that replace former inline style attributes */
.center {
  text-align: center;
}

.ringcard {
  display: flex;
  gap: 14px;
  align-items: center;
}

.back {
  text-align: center;
  margin: 4px;
}

.hint {
  margin: 4px;
}

.edit-title {
  margin: 0;
}

.p0 {
  margin: 0;
}

.p8 {
  margin: 8px 0 0;
}

/* Signed-out, setup, child picker, issued codes */
.lnk {
  display: inline-block;
  text-decoration: none;
}

.err {
  color: var(--err);
  margin: 4px 0;
}

select {
  font-size: 18px;
  padding: 8px;
}

.chk {
  display: flex;
  gap: 8px;
  align-items: center;
  text-align: left;
}

.chk input,
.radios input {
  width: auto;
  padding: 0;
}

.chips {
  display: flex;
  gap: 8px;
  padding: 10px 10px 0;
  overflow-x: auto;
}

.chip {
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  border-radius: 16px;
  padding: 6px 16px;
  font-size: 15px;
  white-space: nowrap;
}

.chip.on {
  background: var(--t);
  color: #fff;
  font-weight: 700;
}

.who {
  font-size: 14px;
  opacity: 0.85;
}

.code {
  font:
    700 30px ui-monospace,
    Menlo,
    monospace;
  letter-spacing: 2px;
  margin: 8px 0;
}

.link {
  font-size: 13px;
  width: 90%;
}

.note {
  color: var(--good);
  margin: 4px 0;
}

.legal {
  margin: 16px 0 0;
  color: var(--muted);
}

.legal a {
  color: inherit;
}

.card.danger {
  border: 1px solid var(--danger);
  margin-top: 12px;
}

.card.danger input {
  width: 100%;
  box-sizing: border-box;
}

.radios {
  border: 0;
  padding: 0;
  margin: 12px 0;
}

.radios legend {
  padding: 0;
  margin-bottom: 4px;
}

.radios label {
  margin-right: 16px;
}

.langs label {
  display: inline-block;
  margin: 2px 16px 2px 0;
}

/* Demo banner and the once-only tour offer */
.demo-bar,
.tour-offer {
  padding: 8px 12px;
  font-size: 14px;
  text-align: center;
}

.demo-bar {
  background: var(--demo-bg);
  border-bottom: 1px solid var(--demo-line);
}

.tour-offer {
  background: var(--l);
  border-bottom: 1px solid var(--offer-line);
}

.demo-bar p,
.tour-offer p {
  margin: 0 0 6px;
}

.demo-bar .btns,
.tour-offer .btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.demo-bar .b,
.tour-offer .b {
  padding: 6px 10px;
  font-size: 14px;
  white-space: normal;
}

.try {
  text-align: center;
}

/* Guided tour: an outline around the part a step explains (the rest dimmed), and a caption */
.tour-ring {
  position: absolute;
  z-index: 40;
  border: 3px solid #f5a623;
  border-radius: 10px;
  box-shadow: 0 0 0 9999px var(--dim);
  pointer-events: none;
  transition:
    top 0.25s,
    left 0.25s,
    width 0.25s,
    height 0.25s;
}

.tour-ring.fixed {
  position: fixed;
}

.tour-caption {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 41;
  max-width: 460px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 14px 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.tour-caption.top {
  bottom: auto;
  top: calc(12px + env(safe-area-inset-top));
}

.tour-caption:focus {
  outline: none;
}

.tour-caption h3 {
  margin: 2px 0 4px;
}

.tour-caption p {
  margin: 0 0 10px;
}

.tour-caption .tour-n {
  margin: 0;
  color: var(--muted);
}

.tour-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

@media (prefers-reduced-motion: reduce) {
  .tour-ring {
    transition: none;
  }
}

/* The tour video, over the page */
.player {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.85);
}

.player-box {
  width: 100%;
  max-width: 960px;
}

.player video {
  display: block;
  width: 100%;
  max-height: 80vh;
  background: #000;
}

/* The next-reward ring (SVG): colors from the theme */
.ring-track {
  stroke: var(--track);
}

.ring-value {
  stroke: var(--t);
}

.ring-text {
  fill: var(--heading);
}

/* Weekly review (parents): points by day, the last weeks side by side, and printing */
.row.rv-day > div.rv-d {
  flex: 0 0 5.5em;
}

.row.rv-day > div.rv-bar {
  flex: 1;
  min-width: 0;
}

.row.rv-day > div.rv-n {
  flex: 0 0 auto;
  min-width: 4.5em;
  justify-content: flex-end;
}

.rv-table table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
}

.rv-table th,
.rv-table td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}

.rv-table th:first-child,
.rv-table td:first-child {
  text-align: left;
}

@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --text: #000;
    --heading: #1f3a5f;
    --muted: #444;
    --l: #eef3f5;
    --track: #dde1ea;
    --border: #bbb;
    --shadow: transparent;
    --perfect-bg: #cdeedd;
    --perfect: #12633a;
    --ok-bg: #fff1c2;
    --ok: #7a5b00;
    --bad-bg: #f7d4d0;
    --bad: #9b2c20;
  }

  body {
    padding: 0;
  }

  .tabs,
  .chips,
  .demo-bar,
  .tour-offer,
  #toast,
  .noprint {
    /* biome-ignore lint/complexity/noImportantStyles: the toast is shown with an inline style */
    display: none !important;
  }

  .card {
    break-inside: avoid;
    border: 1px solid var(--border);
  }

  .bar,
  .bar i,
  .strip .d {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* Encouragement: a parent's message and the milestones, at the top of Today */
.msg {
  border-left: 4px solid var(--t);
}

.cheers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.cheer {
  background: var(--perfect-bg);
  color: var(--perfect);
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 14px;
  font-weight: 600;
}

/* The per-child notices switch in Settings -> Children */
.bell {
  margin-top: 6px;
  font-size: 13px;
  padding: 5px 10px;
}

/* The welcome on the sign-in page: the star, the name, a tagline and three reasons */
.landing {
  max-width: 480px;
  margin: 0 auto;
}

.hero {
  position: relative;
  overflow: hidden;
  margin: 6px 0 14px;
  padding: 26px 18px 20px;
  border-radius: 22px;
  color: #fff;
  background:
    radial-gradient(circle at 88% -8%, var(--sunrise), transparent 45%),
    linear-gradient(155deg, var(--n) 0%, var(--n) 35%, var(--t) 100%);
  box-shadow: 0 8px 24px var(--glow);
}

.hero h1 {
  margin: 8px 0 4px;
  font-size: 34px;
  letter-spacing: 0.5px;
  color: #fff;
}

.hero-logo {
  display: block;
  margin: 0 auto;
  border-radius: 20px;
  box-shadow: 0 6px 16px var(--glow);
  animation: lw-pop 0.7s ease-out both;
}

.tagline {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
}

.perks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  text-align: left;
}

.perks li {
  background: var(--glass);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 15px;
}

.sparkle {
  position: absolute;
  color: var(--gold);
  line-height: 1;
  opacity: 0.85;
  animation: lw-twinkle 3.2s ease-in-out infinite;
}

.sparkle.s1 {
  top: 14px;
  left: 18px;
  font-size: 18px;
}

.sparkle.s2 {
  top: 34px;
  right: 22px;
  font-size: 26px;
  animation-delay: 0.8s;
}

.sparkle.s3 {
  top: 96px;
  left: 30px;
  font-size: 12px;
  animation-delay: 1.6s;
}

.sparkle.s4 {
  top: 108px;
  right: 40px;
  font-size: 14px;
  animation-delay: 2.2s;
}

.sparkle.s5 {
  top: 8px;
  right: 46%;
  font-size: 10px;
  animation-delay: 1.2s;
}

@keyframes lw-twinkle {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 0.85;
  }

  50% {
    transform: scale(1.35) rotate(18deg);
    opacity: 0.35;
  }
}

@keyframes lw-pop {
  from {
    transform: scale(0.6) rotate(-12deg);
    opacity: 0;
  }

  to {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sparkle,
  .hero-logo {
    animation: none;
  }
}

/* Emoji: before a behavior's, reward's or child's name, and the picker in the edit form */
.emo {
  margin-right: 6px;
  font-size: 1.15em;
}

.emoji-input {
  width: 4em;
  font-size: 26px;
  padding: 4px;
}

.emoji-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}

.emj {
  font-size: 22px;
  line-height: 1;
  padding: 6px 7px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.emj.on {
  border-color: var(--accent);
  background: var(--l);
}

/* Celebrations: confetti for a reward, the child's points counting up, an almost-full ring, "+5" */
#party .confetti {
  position: absolute;
  top: -16px;
  width: 9px;
  height: 15px;
  border-radius: 2px;
  animation: lw-fall 2.6s linear both;
}

#party .c0 {
  background: var(--gold);
}

#party .c1 {
  background: var(--t);
}

#party .c2 {
  background: var(--good);
}

#party .c3 {
  background: var(--warn);
}

#party .c4 {
  background: var(--accent);
}

@keyframes lw-fall {
  to {
    transform: translateY(110vh) rotate(540deg);
  }
}

@keyframes lw-bounce {
  0% {
    transform: scale(0.5);
  }

  60% {
    transform: scale(1.08);
  }

  100% {
    transform: scale(1);
  }
}

#hdr.counting {
  color: var(--gold);
}

.ringcard.near .ring-value {
  animation: lw-glow 1.6s ease-in-out infinite;
}

@keyframes lw-glow {
  0%,
  100% {
    filter: drop-shadow(0 0 0 var(--gold));
  }

  50% {
    filter: drop-shadow(0 0 6px var(--gold));
  }
}

.plus-float {
  position: fixed;
  z-index: 20;
  transform: translate(-50%, 0);
  font-weight: 700;
  font-size: 20px;
  color: var(--good);
  pointer-events: none;
  animation: lw-float 0.9s ease-out forwards;
}

@keyframes lw-float {
  to {
    transform: translate(-50%, -48px);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  #party .party-card,
  #party .party-card > span,
  .ringcard.near .ring-value {
    animation: none;
  }
}

/* Stars to collect (the child's screens): gold stickers, the "won!" stamp, the star jar */
.strip .d.sticker {
  background: var(--gold);
  color: var(--warn-text);
  font-weight: 700;
  transform: rotate(-6deg);
  box-shadow: 0 2px 4px var(--shadow);
}

.strip .d.sticker:nth-child(even) {
  transform: rotate(5deg);
}

.stamp {
  display: inline-block;
  padding: 3px 10px;
  border: 2px solid var(--gold);
  border-radius: 8px;
  color: var(--heading);
  transform: rotate(-8deg);
  font-size: 14px;
}

.jar .jar-row {
  margin: 8px 0 4px;
  font-size: 26px;
  line-height: 1.3;
  letter-spacing: 2px;
}

.jar-star {
  color: var(--gold);
}

.jar-empty {
  color: var(--chevron);
}
