:root {
  color-scheme: light;
  --paper: #f3efe4;
  --ink: #1d1914;
  --muted: #5e584e;
  --line: #ddd4c4;
  --green: #0f6e56;
  --green-deep: #0b5342;
  --card: #fffdf8;
  --warn: #8a3d12;
  --danger: #9b1c1c;
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
header, main { width: min(880px, calc(100% - 2rem)); margin: 0 auto; }
header { padding: 1.5rem 0 0.5rem; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
header p { color: var(--muted); margin: 0.2rem 0 0; }
h1, h2 { font-weight: 600; letter-spacing: -0.02em; }
a { color: var(--green-deep); }
button, input, select { font: inherit; }
button { background: var(--green); color: white; border: 0; border-radius: 999px; padding: 0.65rem 1rem; cursor: pointer; }
button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: 0.5; }
button.text-danger { background: transparent; color: var(--danger); border: 0; border-radius: 0; padding: 0.35rem 0; font-weight: 600; }
button.danger { background: var(--danger); }
.account-settings { display: flex; flex-direction: column; align-items: flex-start; }
.delete-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.8rem; }
.delete-list { margin: 0.4rem 0 0.8rem; padding-left: 1.15rem; }
label { display: grid; gap: 0.25rem; margin: 0.6rem 0; color: var(--muted); }
input, select { border: 1px solid var(--line); background: white; border-radius: 12px; padding: 0.7rem 0.8rem; color: var(--ink); }
.grid { display: grid; gap: 1rem; }
@media (min-width: 800px) { .grid.two { grid-template-columns: 1fr 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 1rem 1.1rem; }
.todo { display: flex; gap: 0.8rem; align-items: flex-start; padding: 0.75rem 0; border-top: 1px solid var(--line); }
.todo:first-child { border-top: 0; }
.todo button { border-radius: 12px; min-width: 4.5rem; }
.todo.done span { text-decoration: line-through; color: var(--muted); }
.meta { color: var(--muted); font-size: 0.92rem; }
.error { color: var(--warn); }
.pin { font-size: 2rem; letter-spacing: 0.2em; margin: 0.2rem 0; }
.kid-list { display: flex; flex-direction: column; gap: 0.4rem; }
.kid-list button { text-align: left; }
body.kid {
  min-height: 100vh;
  --purple: #5b4bdb;
  --done: #1f8a4c;
  --offline: #5c5954;
  --offline-bg: #e6e4e1;
  --reminder-bg: #f4f0ff;
  --reminder-border: #ddd6ff;
  --reminder-done-bg: #f3f1ee;
  padding-bottom: 5.5rem;
}
body.kid main { width: min(32rem, calc(100% - 1.25rem)); padding-top: 1.1rem; }
body.kid h1 { font-size: clamp(1.6rem, 7vw, 2.05rem); margin: 0; }
body.kid h2 { font-size: 1.25rem; margin: 0 0 0.6rem; }
.kid-name { margin: 0 0 0.6rem; color: var(--muted); }
.today-date { margin: 0.15rem 0 0.7rem; color: var(--muted); }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; }
.progress-count { margin: 0; font-weight: 600; }
.progress-track { height: 0.55rem; background: #e4e0f5; border-radius: 99px; overflow: hidden; margin-bottom: 0.8rem; }
.progress-fill { display: block; height: 100%; background: var(--purple); }
.segment { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.4rem 0 0.9rem; }
body.kid .segment button {
  background: transparent;
  color: #3d3654;
  border: 1px solid #d9d4ea;
  min-height: 48px;
  height: auto;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  padding: 0.55rem 1.1rem;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}
body.kid .segment button[aria-pressed="true"] { background: var(--purple); color: white; border-color: var(--purple); }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.2rem; margin-bottom: 0.8rem; }
body.kid .week-day {
  background: transparent;
  color: inherit;
  border: 1px solid transparent;
  border-radius: 12px;
  min-height: 64px;
  padding: 0.3rem 0.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}
body.kid .week-day.is-today { box-shadow: inset 0 0 0 2px var(--purple); }
body.kid .week-day.is-selected { background: #efeaff; }
.week-day .dow {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.15;
  max-width: 100%;
}
.week-day .num { font-size: 1rem; font-weight: 600; }
.dots { display: flex; gap: 0.12rem; min-height: 0.45rem; }
.dot { width: 0.38rem; height: 0.38rem; border-radius: 99px; display: block; }
.count { font-size: 0.72rem; background: #eceaf3; color: #3d3654; border-radius: 99px; min-width: 1.1rem; padding: 0 0.25rem; }
.task { display: flex; gap: 0.85rem; align-items: center; padding: 0.85rem 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
body.kid button.kid-check {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 50%;
  background: white;
  color: transparent;
  border: 2px solid var(--purple);
  display: grid;
  place-items: center;
}
body.kid .task.done button.kid-check { background: var(--done); border-color: var(--done); color: white; }
body.kid .task.pending.done button.kid-check { background: var(--offline); border-color: var(--offline); color: white; }
.task-copy { min-width: 0; }
.task-class { margin: 0; color: var(--purple); font-size: 0.92rem; font-weight: 600; }
.task-title {
  margin: 0.1rem 0;
  font-size: 1.15rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.reminder {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin: 0 0 0.65rem;
  padding: 0.85rem;
  background: var(--reminder-bg);
  border: 1px solid var(--reminder-border);
  border-radius: 16px;
}
.reminder.done {
  background: var(--reminder-done-bg);
  border-color: var(--line);
}
.reminder-copy { min-width: 0; flex: 1; }
.reminder-from {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.2rem;
  color: var(--purple);
  font-size: 0.92rem;
  font-weight: 600;
}
.reminder.done .reminder-from { color: var(--muted); }
.reminder-bell { flex: 0 0 auto; }
body.kid button.reminder-body {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: 8px;
  min-height: 0;
  font: inherit;
  font-size: 1.05rem;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
}
.reminder.is-expanded button.reminder-body {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}
.reminder.done .reminder-body { text-decoration: line-through; color: var(--muted); }
.reminder-due { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.95rem; }
body.kid .reminder.done button.kid-check { background: var(--done); border-color: var(--done); color: white; }
body.kid .reminder.pending.done button.kid-check { background: var(--offline); border-color: var(--offline); color: white; }
.week-heading { font-size: 1.25rem; margin: 0 0 0.7rem; }
.task-due, .waiting { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.95rem; }
.waiting { color: var(--offline); }
.offline-banner {
  margin: 0 0 0.8rem;
  padding: 0.75rem 0.9rem;
  background: var(--offline-bg);
  color: var(--offline);
  border: 1px solid #cfcbc4;
  border-radius: 14px;
}
.empty { text-align: center; color: var(--muted); padding: 0.6rem 0.4rem 0.2rem; }
.empty-mark { width: 4.5rem; height: 4.5rem; }
.empty-mark .empty-ring { color: var(--purple); }
.empty-mark .empty-tick { color: var(--done); }
.empty p { margin: 0.35rem 0 0.6rem; }
body.kid .snackbar {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  width: min(24rem, calc(100% - 1.5rem));
  max-width: calc(100% - 1.5rem);
  margin: 0;
  padding: 0.35rem 0.35rem 0.35rem 1rem;
  background: #2c2933;
  color: white;
  border-radius: 16px;
}
body.kid .snackbar span { overflow-wrap: anywhere; }
body.kid .snackbar button {
  background: transparent;
  color: #d9d4ff;
  min-height: 48px;
  height: auto;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  padding: 0.4rem 1.2rem;
  white-space: normal;
  overflow-wrap: anywhere;
}
body.kid .snackbar button:focus-visible { outline-color: #d9d4ff; }
body.kid button:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
body.kid { touch-action: manipulation; }
