:root {
  --sage: #93ac74;
  --sage-deep: #2a3b1e;
  --ink: #241f18;
  --muted: #6d675e;
  --past: #9c978f;
  --line: #efe8de;
  --sheet: #fffdf9;
  --cream: #f6f1e7;
  --peach: #f0b592;
  --shadow: 0 16px 40px rgba(70, 42, 16, 0.12);
  --radius: 28px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--peach);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", "Heiti SC", sans-serif;
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

button:focus { outline: none; }

button:focus-visible {
  outline: 3px solid #e07a1f;
  outline-offset: 2px;
}

.noscript {
  max-width: 480px;
  margin: 24px auto;
  padding: 0 20px;
  font-size: 20px;
}

.app {
  width: min(480px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--cream);
  display: flex;
  flex-direction: column;
}

@media (min-width: 560px) {
  body { padding: 28px 16px; }
  .app {
    min-height: calc(100dvh - 56px);
    border-radius: 36px;
    box-shadow: var(--shadow);
  }
  .top { border-radius: 36px 36px 0 0; }
}

.top {
  background: var(--sage);
  color: var(--sage-deep);
  padding: calc(12px + env(safe-area-inset-top)) 16px 10px;
}

.top h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.clock {
  margin: 6px 0 0;
  font-size: 17px;
  font-weight: 700;
  color: #31421f;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 10px;
  padding: 4px;
  border-radius: 16px;
  background: rgba(36, 52, 22, 0.12);
}

.tabs button {
  height: 46px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--sage-deep);
  font-size: 18px;
  font-weight: 800;
}

.tabs button[aria-selected="true"] {
  background: var(--sheet);
  box-shadow: 0 2px 8px rgba(40, 50, 20, 0.12);
}

main {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
}

.cal-panel {
  background: var(--sage);
  padding: 0 8px 20px;
}

.cal-nav,
.week-nav,
.proj-month {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 4px;
}

.cal-nav h2,
.week-range,
.proj-month h2 {
  margin: 0;
  text-align: center;
  font-size: 24px;
  line-height: 1.3;
  font-weight: 800;
}

.nav-btn {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 253, 249, 0.45);
  color: var(--sage-deep);
  font-size: 32px;
  line-height: 1;
  padding: 0;
}

.week-nav .nav-btn,
.proj-month .nav-btn {
  background: #fff;
  box-shadow: 0 4px 14px rgba(70, 42, 16, 0.06);
  color: var(--ink);
}

.wd,
.days,
.prows {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.wd {
  margin-top: 4px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  color: rgba(27, 40, 18, 0.72);
}

.day {
  position: relative;
  height: 52px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
}

.day.is-selected:not(.is-today) {
  background: rgba(255, 252, 245, 0.38);
  border-radius: 16px;
}

.day .rings {
  position: absolute;
  inset: 1px;
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  pointer-events: none;
}

.day .num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
  pointer-events: none;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--sage-deep);
}

.day.is-out .num { color: rgba(27, 40, 18, 0.38); }
.day.is-out .rings { opacity: 0.55; }

.day.is-today .num {
  font-size: 26px;
  font-weight: 800;
  color: #1b2812;
}

.day.is-today:not(.has-ring) .num { color: #fff; }
.day.is-today .rings { opacity: 1; }
.day.has-ring .num { font-size: 18px; }
.day.has-ring.is-today .num { font-size: 22px; font-weight: 800; color: #1b2812; }
.day.is-crowded .num { font-size: 16px; }
.day.is-crowded.is-today .num { font-size: 18px; color: #1b2812; }

.app.is-month .cal-panel { padding-bottom: 28px; }
.app.is-month .sheet { margin-top: -20px; }

.sheet {
  position: relative;
  z-index: 1;
  margin-top: -26px;
  border-radius: 30px 30px 0 0;
  background: var(--sheet);
  box-shadow: 0 -10px 28px rgba(40, 50, 20, 0.06);
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
}

.plain {
  margin-top: 0;
  border-radius: 0;
  background: var(--cream);
  box-shadow: none;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

.sel-head,
.week-nav,
.section-label {
  padding-left: 18px;
  padding-right: 18px;
}

.sel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-top: 22px;
  padding-bottom: 6px;
}

.kicker {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.2;
}

.sel-head h2 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
}

.sel-head h2.is-main {
  margin: 0;
  font-size: 26px;
  color: var(--ink);
}

.today-link,
.ghost-btn {
  border: 0;
  background: #eaf2df;
  color: #31481c;
  font-size: 16px;
  font-weight: 800;
  border-radius: 999px;
  min-height: 44px;
  padding: 8px 14px;
  flex: none;
}

.timeline {
  padding: 4px 18px 4px;
}

.t-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
}

.rail { position: relative; }

.t-item:not(:last-child) .rail::after {
  content: "";
  position: absolute;
  top: 22px;
  bottom: -14px;
  left: 50%;
  border-left: 2px dashed #e4d9c8;
}

.dot {
  width: 16px;
  height: 16px;
  margin: 6px auto 0;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 4px var(--sheet);
  display: block;
}

.t-body { padding: 0 0 12px; }

.t-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pname {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}

.t-text,
.what {
  margin: 2px 0 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.past-tag,
.next-flag {
  flex: none;
  font-size: 16px;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 10px;
}

.past-tag {
  color: var(--past);
  background: #f3efe8;
}

.next-flag {
  color: #31481c;
  background: #eaf2df;
}

.is-past .dot { background: #c8c3bb; }
.is-past .pname,
.is-past .t-text,
.is-past .what,
.is-past .when { color: var(--past); }

.empty,
.hint {
  margin: 4px 18px 16px;
  font-size: 20px;
  font-weight: 700;
  color: var(--muted);
}

.hint {
  margin-top: -6px;
  font-size: 16px;
  font-weight: 600;
}

.legend {
  margin-top: 8px;
  position: sticky;
  bottom: 0;
  padding: 6px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--sheet);
}

.legend h3 {
  margin: 4px 0 8px;
  font-size: 16px;
  font-weight: 800;
  color: var(--muted);
}

.legend-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

.legend-item svg { flex: none; }

.week-nav {
  padding-top: 16px;
  padding-bottom: 8px;
}

.week-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.day-block {
  margin: 0 16px 14px;
  padding: 16px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(70, 42, 16, 0.06);
}

.day-block.is-today {
  box-shadow: 0 0 0 2.5px #6e8b46, 0 10px 28px rgba(70, 42, 16, 0.08);
}

.day-block.is-past { background: #f3f1ec; }

.day-block-h {
  display: flex;
  align-items: center;
  gap: 12px;
}

.big-num {
  width: 64px;
  font-size: 40px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.day-block.is-past .big-num { color: var(--past); }

.day-block-title {
  font-size: 20px;
  font-weight: 800;
}

.day-block.is-past .day-block-title { color: var(--past); }

.mini-task {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--c) 14%, #fff);
}

.mini-task.is-past { background: #eeece7; }

.bar {
  width: 8px;
  border-radius: 8px;
  background: var(--c);
  flex: none;
}

.mini-task.is-past .bar { background: #c8c3bb; }

.none {
  margin: 10px 0 0;
  font-size: 18px;
  font-weight: 700;
  color: #b0aaa2;
}

.proj-card {
  margin: 16px 16px 8px;
  padding: 16px 14px 14px;
  border-radius: 24px;
  background: color-mix(in srgb, var(--c) 12%, #fff);
  border-top: 8px solid var(--c);
  box-shadow: 0 10px 28px rgba(70, 42, 16, 0.06);
  touch-action: pan-y;
}

.proj-nav {
  display: grid;
  grid-template-columns: 96px 1fr 96px;
  align-items: center;
  gap: 6px;
}

.proj-name {
  margin: 0;
  text-align: center;
  font-size: 28px;
  line-height: 1.25;
  font-weight: 800;
  color: var(--ink-c, var(--ink));
}

.pnav {
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(70, 42, 16, 0.06);
}

.dots {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 10px;
}

.dots button {
  width: 28px;
  height: 28px;
  border: 0;
  padding: 0;
  background: transparent;
  position: relative;
}

.dots button::before {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  margin: 9px auto 0;
  border-radius: 99px;
  background: #ddd6cc;
}

.dots button[aria-current="true"]::before {
  width: 20px;
  margin-top: 9px;
  background: var(--c);
}

.swipe-hint,
.subnote,
.when {
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
}

.swipe-hint,
.subnote { margin: 8px 0 0; text-align: center; }

.upcoming {
  margin: 10px 0 0;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}

.proj-cal {
  margin: 8px 16px 0;
  padding: 8px 8px 12px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(70, 42, 16, 0.05);
}

.proj-cal .wd {
  color: #8a847a;
  margin-top: 0;
}

.pcell {
  position: relative;
  height: 46px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 0;
}

.pcell.is-today { font-size: 22px; font-weight: 800; }
.pcell.is-out { color: #c8c2b8; }

.pcell .blob {
  position: absolute;
  top: 6px;
  bottom: 6px;
  z-index: 0;
  background: var(--blob);
}

.pcell.single .blob { left: 5px; right: 5px; border-radius: 999px; }
.pcell.start .blob { left: 5px; right: -1px; border-radius: 999px 0 0 999px; }
.pcell.mid .blob { left: -1px; right: -1px; }
.pcell.end .blob { left: -1px; right: 5px; border-radius: 0 999px 999px 0; }

.pcell .n { position: relative; z-index: 1; }

.section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 18px 0 4px;
}

.section-label h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.section-label span {
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
}

.seq {
  list-style: none;
  margin: 0;
  padding: 0 18px calc(24px + env(safe-area-inset-bottom));
}

.seq li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.idx {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--c);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.seq li.is-past .idx {
  background: #d5d0c8;
  color: #fff;
}

.when { margin: 0; }
.what { margin: 4px 0 0; }
