:root {
  color-scheme: light;
  --bg: #f3efe6;
  --ink: #1c1916;
  --muted: #5c564c;
  --faint: #7d766a;
  --line: #ddd4c6;
  --accent: #8f2d2d;
  --paper: #fbf8f2;
  --warn: #f8f1e6;
  --info: #eef3f4;
  --tokyo: #2451a3;
  --fuji: #0f6e78;
  --kyoto: #6b3f86;
  --nara: #2f6b45;
  --transit: #6b6560;
  --osaka: #8a5428;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141311;
  --ink: #f3efe6;
  --muted: #c8c0b4;
  --faint: #9c9588;
  --line: #3a342c;
  --accent: #f0a8a0;
  --paper: #1e1b17;
  --warn: #2a231c;
  --info: #1a2426;
  --tokyo: #9ebcf0;
  --fuji: #7ec8cf;
  --kyoto: #d2b3e4;
  --nara: #8fcea4;
  --transit: #b7b0a6;
  --osaka: #e0b089;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.15rem 1.1rem 4.5rem;
}

a { color: var(--accent); text-underline-offset: 0.16em; }
a:hover { text-decoration-thickness: 2px; }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus {
  left: 0.8rem;
  top: 0.8rem;
  z-index: 20;
  background: var(--paper);
  color: var(--ink);
  padding: 0.4rem 0.7rem;
}

.mast {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.export-bar {
  margin: 0.85rem 0;
}

.export-btn {
  appearance: none;
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
  padding: 0.95rem 0.75rem;
  cursor: pointer;
}

:root[data-theme="dark"] .export-btn { color: #1c1916; }

.export-btn:disabled { opacity: 0.65; cursor: wait; }

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 650;
}

h1 {
  margin: 0.15rem 0 0.45rem;
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -0.02em;
}

h2 {
  margin: 2.15rem 0 0.75rem;
  font-size: 1.35rem;
  line-height: 1.25;
  font-weight: 650;
}

h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
  font-weight: 650;
}

.lede, .note, .detail, .sleep { color: var(--muted); }
.lede { margin: 0; max-width: 40rem; }
.note { font-size: 0.92rem; margin: 0.7rem 0 0; }
.sleep { font-size: 0.92rem; margin: 0.2rem 0 0.55rem; }

.theme-btn, .pills button, .check {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.theme-btn {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
}

.daynav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 0.1rem;
  overflow-x: auto;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  margin: 0 -1.1rem 1.2rem;
  padding: 0 0.7rem;
  scrollbar-width: none;
}
.daynav::-webkit-scrollbar { display: none; }

.daynav a {
  flex: 0 0 auto;
  padding: 0.7rem 0.62rem 0.55rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.84rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.daynav a.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.daynav a[data-today="true"] { font-weight: 700; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1.2rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.1rem;
}
.stats strong {
  display: block;
  font-size: 1.12rem;
  font-weight: 650;
}
.stats span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.bar {
  display: flex;
  height: 0.5rem;
  gap: 3px;
  margin: 0.15rem 0 0.65rem;
}
.seg { display: block; min-width: 0; }
.seg.tokyo, .dot.tokyo { background: var(--tokyo); }
.seg.fuji, .dot.fuji { background: var(--fuji); }
.seg.kyoto, .dot.kyoto { background: var(--kyoto); }
.seg.nara, .dot.nara { background: var(--nara); }
.seg.transit, .dot.transit { background: var(--transit); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.1rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.legend li, .kicker { display: flex; align-items: center; gap: 0.4rem; }

.dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex: 0 0 auto;
}

.callout {
  margin: 0.9rem 0;
  padding: 0.75rem 0.9rem;
  background: var(--warn);
  border-left: 3px solid var(--accent);
}
.callout.info { background: var(--info); border-left-color: var(--tokyo); }
.callout p { margin: 0.25rem 0 0; }
.callout-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.98rem;
}

.table-wrap { overflow-x: auto; margin: 0.3rem 0 0.2rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
caption {
  text-align: left;
  font-size: 0.82rem;
  color: var(--faint);
  padding: 0 0 0.4rem;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.48rem 0.55rem;
  border-bottom: 1px solid var(--line);
}
th {
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--ink) 4%, transparent); }
td.num, th.num { text-align: right; white-space: nowrap; }

.pills { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.2rem 0 0.7rem; }
.pills button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-size: 0.92rem;
}
.pills button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.day {
  scroll-margin-top: 3.1rem;
  padding-top: 0.4rem;
}
.day + .day { border-top: 1px solid var(--line); margin-top: 1.6rem; }
.day.is-today { box-shadow: inset 3px 0 0 var(--accent); padding-left: 0.75rem; }

.kicker {
  margin: 1rem 0 0.25rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.blocks { list-style: none; padding: 0; margin: 0.8rem 0 0; }
.blocks li {
  position: relative;
  margin: 0;
  padding: 0 0 1.15rem 1rem;
  border-left: 2px solid var(--line);
}
.blocks li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0.4rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.detail { margin: 0.3rem 0 0; }
.explain {
  margin: 0.55rem 0 0;
  padding-left: 0.15rem;
}
.explain p { margin: 0.4rem 0 0; font-size: 0.95rem; }
.explain-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}
.food { margin: 0.45rem 0 0; font-size: 0.9rem; color: var(--faint); }

.tips { margin: 0.2rem 0 0.4rem; padding-left: 1.1rem; color: var(--muted); font-size: 0.92rem; }
.tips li + li { margin-top: 0.3rem; }

.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
}
.split h3 { margin-bottom: 0.35rem; }

details {
  border-top: 1px solid var(--line);
  padding: 0.75rem 0;
}
details p { margin: 0.45rem 0 0; }
summary {
  cursor: pointer;
  font-weight: 650;
}
summary:hover { color: var(--accent); }

.checks { margin-top: 0.4rem; }
.check {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.8rem 0.1rem;
}
.box {
  width: 1.15rem;
  height: 1.15rem;
  border: 1.5px solid var(--muted);
  border-radius: 3px;
  flex: 0 0 auto;
  margin-top: 0.15rem;
  display: grid;
  place-items: center;
}
.check[aria-pressed="true"] .label {
  color: var(--faint);
  text-decoration: line-through;
}
.check[aria-pressed="true"] .box {
  background: var(--accent);
  border-color: var(--accent);
}
.check[aria-pressed="true"] .box::after {
  content: "";
  width: 0.28rem;
  height: 0.52rem;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.prep-bar {
  height: 0.35rem;
  background: var(--line);
  margin: 0.55rem 0 0.2rem;
}
.prep-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.footer {
  margin-top: 2rem;
  color: var(--faint);
  font-size: 0.88rem;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .split { grid-template-columns: 1fr 1fr; gap: 1.6rem; }
  h1 { font-size: 2.35rem; }
}

@page { margin: 14mm; }

@media print {
  .daynav, .theme-btn, .pills, .skip, .export-bar, .prep-bar { display: none !important; }
  body { background: white; color: black; font-size: 12pt; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; word-break: break-all; }
  .day { break-before: page; }
  h2, h3 { break-after: avoid; }
  tr, .callout { break-inside: avoid; }
  article[hidden], p[hidden], div[hidden], aside[hidden] { display: block !important; }
  tr[hidden] { display: table-row !important; }
  .check[hidden] { display: flex !important; }
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
