:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #646b73;
  --line: #d9dfe5;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --accent: #276f73;
  --accent-strong: #18565a;
  --rose: #c45161;
  --gold: #b5791c;
  --shadow: 0 18px 42px rgba(39, 55, 67, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(39, 111, 115, 0.09), rgba(255, 255, 255, 0) 340px),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main,
.app-header {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 34px 0 22px;
}

.app-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.app-nav > a,
.app-nav > button {
  min-height: 40px;
  border: 1px solid rgba(32, 33, 36, 0.12);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent-strong);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  padding: 12px 14px;
  box-shadow: 0 8px 22px rgba(39, 55, 67, 0.08);
  cursor: pointer;
}

.app-nav > a:hover,
.app-nav > button:hover {
  border-color: rgba(39, 111, 115, 0.32);
  color: var(--accent);
}

.app-nav-group {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  overflow: hidden;
  border: 1px solid rgba(32, 33, 36, 0.12);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(39, 55, 67, 0.08);
}

.app-nav-group span,
.app-nav-group a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  padding: 0 12px;
}

.app-nav-group span {
  border-right: 1px solid rgba(32, 33, 36, 0.1);
  color: var(--muted);
}

.app-nav-group a + a {
  border-left: 1px solid rgba(32, 33, 36, 0.1);
}

.app-nav-group a:hover,
.app-nav-group a[aria-current="page"] {
  background: rgba(39, 111, 115, 0.1);
  color: var(--accent);
}

.app-header h1 {
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 5rem);
  line-height: 0.95;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 8px 0 18px;
}

.summary-card,
.chart-panel,
.details-panel,
.milestones,
.diaper-forecast {
  border: 1px solid rgba(32, 33, 36, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.summary-card {
  display: grid;
  gap: 6px;
  padding: 18px;
}

.summary-label,
.summary-card span:last-child {
  color: var(--muted);
  font-size: 0.86rem;
}

.summary-card strong {
  font-size: clamp(1.4rem, 4vw, 2.1rem);
}

.tracker-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.tracker-layout.single-column {
  grid-template-columns: 1fr;
}

.chart-panel,
.details-panel,
.milestones,
.diaper-forecast {
  padding: 20px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.45rem;
}

.growth-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tab-list {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}

.tab-button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 850;
  padding: 8px 12px;
}

.tab-button.active {
  background: var(--accent);
  color: #fff;
}

.growth-panel[hidden] {
  display: none;
}

.compact {
  align-items: start;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 15 / 7;
  min-height: 230px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.feed-cycles {
  margin-top: 18px;
}

.diaper-forecast {
  margin: 18px 0 36px;
}

.diaper-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.diaper-stat {
  border-top: 3px solid var(--accent);
  background: rgba(39, 111, 115, 0.07);
  padding: 10px 12px;
}

.diaper-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.diaper-stat strong {
  display: block;
  margin-top: 3px;
  font-size: 1.15rem;
}

.diaper-progress {
  margin-top: 14px;
}

.diaper-progress-label {
  align-items: baseline;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.diaper-progress-label span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.diaper-progress-label strong {
  font-size: 0.92rem;
}

.diaper-progress-track {
  background: rgba(39, 111, 115, 0.12);
  border: 1px solid rgba(39, 111, 115, 0.2);
  height: 16px;
  overflow: hidden;
}

.diaper-progress-track span {
  background: linear-gradient(90deg, var(--accent), var(--gold));
  display: block;
  height: 100%;
  min-width: 2px;
}

.table-wrap {
  max-height: 260px;
  overflow: auto;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.compact-table {
  max-height: 230px;
}

.confidence-low {
  background: rgba(181, 121, 28, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  background: #f6f8f8;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.empty-state {
  color: var(--muted);
  text-align: center;
}

.milestones {
  margin: 18px 0 36px;
}

.skill-tree {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.skill-path {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 10px 10px 12px 0;
}

.skill-path::before {
  position: absolute;
  top: 14px;
  bottom: 12px;
  left: 48px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(39, 111, 115, 0.28), rgba(196, 81, 97, 0.24), rgba(181, 121, 28, 0.26));
  content: "";
  transform: translateX(-50%);
}

.skill-time-group {
  --domain-color: var(--accent);
  --domain-soft: rgba(39, 111, 115, 0.14);
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.skill-time-marker {
  display: grid;
  place-items: center;
  justify-self: center;
  width: 46px;
  min-height: 30px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 950;
  box-shadow: 0 4px 12px rgba(39, 55, 67, 0.14);
}

.skill-time-content {
  min-width: 0;
  border-left: 1px solid var(--line);
  padding: 0 0 0 10px;
}

.skill-time-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 8px;
  margin-bottom: 4px;
}

.skill-time-heading strong {
  font-size: 0.84rem;
}

.skill-time-heading span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
  text-transform: uppercase;
}

.skill-node-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.skill-node {
  --domain-color: var(--accent);
  --domain-soft: rgba(39, 111, 115, 0.14);
  align-items: start;
  border: 1px solid var(--line);
  border-left: 4px solid var(--domain-color);
  border-radius: 8px;
  background: #fff;
  display: grid;
  gap: 7px;
  grid-template-columns: 18px minmax(0, 1fr);
  padding: 7px 9px;
}

.skill-check {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border: 2px solid var(--domain-color);
  border-radius: 4px;
  background: #fff;
}

.skill-node.done .skill-check {
  background: var(--domain-color);
}

.skill-node.done .skill-check::after {
  position: absolute;
  top: 1px;
  left: 4px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  content: "";
  transform: rotate(45deg);
}

.skill-title,
.skill-meta {
  display: block;
}

.skill-title {
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.15;
}

.skill-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
}

.skill-node.done {
  border-color: var(--domain-color);
  background: linear-gradient(90deg, var(--domain-soft), #fff 72%);
  box-shadow: inset 0 0 0 1px var(--domain-soft);
}

.skill-node.done .skill-title {
  color: var(--domain-color);
}

.skill-node.done .skill-meta {
  color: var(--domain-color);
}

.domain-social {
  --domain-color: #c45161;
  --domain-soft: rgba(196, 81, 97, 0.13);
}

.domain-language {
  --domain-color: #276f73;
  --domain-soft: rgba(39, 111, 115, 0.13);
}

.domain-thinking {
  --domain-color: #7b5ea7;
  --domain-soft: rgba(123, 94, 167, 0.13);
}

.domain-movement {
  --domain-color: #b5791c;
  --domain-soft: rgba(181, 121, 28, 0.14);
}

.domain-feeding {
  --domain-color: #4f7f45;
  --domain-soft: rgba(79, 127, 69, 0.14);
}

.domain-default {
  --domain-color: #566b7f;
  --domain-soft: rgba(86, 107, 127, 0.14);
}

.book-body {
  background:
    linear-gradient(180deg, rgba(196, 81, 97, 0.08), rgba(255, 255, 255, 0) 320px),
    #f5f4ef;
}

.book-header h1 {
  max-width: 780px;
  font-size: clamp(2.05rem, 6vw, 4.4rem);
}

.book-main {
  width: min(1180px, calc(100% - 32px));
}

.book-notes {
  margin: 6px 0 18px;
  border-left: 4px solid var(--accent);
  background: rgba(255, 255, 255, 0.82);
  padding: 12px 16px;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.45;
}

.book-notes p {
  margin: 0;
}

.booklet {
  display: grid;
  gap: 18px;
  margin-bottom: 42px;
}

.print-sheet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  aspect-ratio: 1.414 / 1;
  border: 1px solid #cfd4da;
  background: #fff;
  box-shadow: var(--shadow);
}

.book-page {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 24px;
  overflow: hidden;
  border-right: 1px dashed #aeb7bf;
  padding: 14mm 12mm;
  text-align: center;
}

.book-page:nth-child(2) {
  border-right: 0;
}

.book-page p,
.book-page h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  letter-spacing: 0;
}

.book-page p {
  max-width: 9em;
  font-size: clamp(1.45rem, 4.2vw, 3.8rem);
  font-weight: 900;
  line-height: 1;
}

.book-page h2 {
  max-width: 5.5em;
  font-size: clamp(2.2rem, 8vw, 6rem);
  line-height: 0.9;
}

.book-page .book-kicker {
  color: #32363a;
  font-size: clamp(1rem, 2.4vw, 2rem);
  text-transform: uppercase;
}

.page-light {
  background: #fffdf8;
  color: #111;
}

.page-dark {
  background: #050505;
  color: #fff;
}

.page-number {
  position: absolute;
  right: 7mm;
  bottom: 6mm;
  z-index: 2;
  width: 8mm;
  height: 8mm;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: inherit;
  font-size: 0.62rem;
  font-weight: 900;
  opacity: 0.52;
}

.shape {
  position: relative;
  width: min(48vw, 330px);
  max-width: 84%;
  aspect-ratio: 1;
}

.page-dark .shape {
  color: #fff;
}

.page-light .shape {
  color: #050505;
}

.face {
  width: min(42vw, 300px);
  border: 12px solid currentColor;
  border-radius: 50%;
}

.face::before,
.face::after,
.face span {
  position: absolute;
  display: block;
  content: "";
}

.face::before,
.face::after {
  top: 34%;
  width: 15%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: currentColor;
}

.face::before {
  left: 26%;
}

.face::after {
  right: 26%;
}

.face span:first-child {
  left: 28%;
  bottom: 24%;
  width: 44%;
  height: 20%;
  border-bottom: 10px solid currentColor;
  border-radius: 0 0 999px 999px;
}

.face span:last-child {
  left: 46%;
  top: 48%;
  width: 8%;
  height: 14%;
  border-radius: 999px;
  background: currentColor;
}

.rings {
  border: 18px solid currentColor;
  border-radius: 50%;
  box-shadow: inset 0 0 0 30px #fffdf8, inset 0 0 0 48px currentColor;
}

.circle {
  border-radius: 50%;
  background: currentColor;
}

.stripes {
  background: repeating-linear-gradient(90deg, currentColor 0 22px, transparent 22px 44px);
}

.page-dark .stripes {
  background: repeating-linear-gradient(90deg, currentColor 0 22px, transparent 22px 44px);
}

.stripes.soft {
  transform: rotate(90deg);
}

.big-eye {
  border: 16px solid currentColor;
  border-radius: 50% 0 50% 0;
  transform: rotate(45deg);
}

.big-eye::after {
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.checker {
  background:
    linear-gradient(45deg, currentColor 25%, transparent 25% 75%, currentColor 75%),
    linear-gradient(45deg, currentColor 25%, transparent 25% 75%, currentColor 75%);
  background-position: 0 0, 32px 32px;
  background-size: 64px 64px;
}

.window {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 16px;
}

.window::before,
.window::after {
  content: "";
}

.window,
.window::before,
.window::after {
  border: 14px solid currentColor;
}

.window::before {
  grid-column: 1;
  grid-row: 1;
}

.window::after {
  grid-column: 2;
  grid-row: 2;
}

.dots {
  background:
    radial-gradient(circle at 28% 30%, currentColor 0 20%, transparent 21%),
    radial-gradient(circle at 72% 70%, currentColor 0 32%, transparent 33%);
}

.blink {
  height: min(24vw, 150px);
  border-top: 18px solid currentColor;
  border-bottom: 18px solid currentColor;
  border-radius: 999px;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.pair::before,
.pair::after {
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.hands {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.hands::before,
.hands::after {
  border-radius: 52% 52% 42% 42%;
  background: currentColor;
  content: "";
}

.hands::before {
  transform: rotate(-18deg);
}

.hands::after {
  transform: rotate(18deg);
}

.moon {
  border-radius: 50%;
  background: currentColor;
}

.moon::after {
  position: absolute;
  inset: 0 0 0 28%;
  border-radius: 50%;
  background: #050505;
  content: "";
}

.page-light .moon::after {
  background: #fffdf8;
}

.arc {
  width: min(52vw, 380px);
  height: min(27vw, 190px);
  border-top: 26px solid currentColor;
  border-radius: 999px 999px 0 0;
}

.arc.flipped {
  transform: scaleX(-1);
}

@media (max-width: 980px) {
  .tracker-layout {
    grid-template-columns: 1fr;
  }

  .details-panel {
    order: 2;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

}

@media (max-width: 640px) {
  main,
  .app-header {
    width: min(100% - 20px, 1180px);
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .diaper-stats {
    grid-template-columns: 1fr;
  }

  .diaper-progress-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-panel,
  .details-panel,
  .milestones,
  .diaper-forecast {
    padding: 14px;
  }

  .skill-path {
    padding: 8px 8px 10px 0;
  }

  .skill-path::before {
    left: 28px;
  }

  .skill-time-group {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 6px;
  }

  .skill-time-marker {
    width: 40px;
    min-height: 28px;
    font-size: 0.68rem;
  }

  .skill-time-content {
    padding-left: 8px;
  }

  .skill-node-grid {
    grid-template-columns: 1fr;
  }

  th:nth-child(4),
  td:nth-child(4) {
    display: none;
  }

  .print-sheet {
    aspect-ratio: auto;
    grid-template-columns: 1fr;
  }

  .book-page {
    min-height: 70vw;
    border-right: 0;
    border-bottom: 1px dashed #aeb7bf;
  }

  .book-page:nth-child(2) {
    border-bottom: 0;
  }
}

@page {
  size: A4 landscape;
  margin: 0;
}

@media print {
  :root {
    --shadow: none;
  }

  html,
  body {
    width: 297mm;
    margin: 0;
    background: #fff;
  }

  .app-header,
  .book-notes {
    display: none;
  }

  .book-main {
    width: auto;
    margin: 0;
  }

  .booklet {
    display: block;
    margin: 0;
  }

  .print-sheet {
    width: 297mm;
    height: 210mm;
    break-after: page;
    page-break-after: always;
    border: 0;
    box-shadow: none;
  }

  .book-page {
    width: 148.5mm;
    min-height: 210mm;
    padding: 16mm 14mm;
    border-right: 0.35mm dashed #8d969f;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .book-page:nth-child(2) {
    border-right: 0;
  }

  .book-page p {
    font-size: 28pt;
  }

  .book-page h2 {
    font-size: 52pt;
  }

  .book-page .book-kicker {
    font-size: 17pt;
  }

  .shape {
    width: 88mm;
  }

  .arc {
    width: 98mm;
    height: 50mm;
  }
}
