:root {
  --paper: #f3eee8;
  --ink: #2a221c;
  --muted: #8a7d72;
  --line: #ddd2c4;
  --clay: #c45c48;
  --serif: "Noto Serif SC", "Songti SC", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100svh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

main {
  width: min(720px, 100%);
  margin: 0 auto;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.mast {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
}

#name-input {
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  padding: 6px 0;
  outline: none;
}

#name-input:focus {
  border-bottom-color: var(--clay);
}

.date,
.cue,
.status,
.cal-head h2,
.cal-nav p,
.board h2,
.noscript {
  margin: 0;
}

.date,
.cue,
.status,
.cal-weekdays,
.board h2,
.cal-head h2 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.date {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

#back-today,
.share,
.cal-nav button {
  border: 0;
  background: none;
  padding: 4px 0;
}

#back-today,
.share {
  color: var(--clay);
}

.cue {
  min-height: 1.4em;
  margin: 22px 0 8px;
  color: var(--ink);
  font-size: 15px;
}

.status {
  color: var(--clay);
  font-size: 12px;
}

.pass {
  margin-top: 22px;
}

.pass h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
}

.pass .now {
  display: none;
  color: var(--clay);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
}

.pass.is-now .now {
  display: inline;
}

.pass.is-now h2 {
  text-decoration: underline;
  text-underline-offset: 6px;
}

.ritual {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.step {
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: none;
  padding: 0;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.step svg {
  width: 28px;
  height: 28px;
  margin: 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.step span {
  font-size: 13px;
}

.step.is-next:not(.is-done) {
  border-color: var(--ink);
}

.step.is-done {
  border-color: var(--ink);
}

.step.is-done span::after {
  content: " ✓";
}

.step:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.calendar {
  margin-top: 36px;
}

.cal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-nav p {
  min-width: 6.5em;
  text-align: center;
  color: var(--ink);
  font-size: 13px;
}

.cal-nav button {
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
}

.cal-nav button:disabled {
  opacity: 0.25;
  cursor: default;
}

.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-weekdays {
  margin-top: 12px;
  text-align: center;
  letter-spacing: 0.08em;
}

.cal-grid {
  margin-top: 8px;
  gap: 4px 2px;
}

.cal-pad {
  min-height: 72px;
}

.cal-day {
  display: grid;
  justify-items: stretch;
  gap: 4px;
  min-height: 72px;
  padding: 4px 2px 6px;
  border: 0;
  background: none;
}

.cal-day .num {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  line-height: 1;
  text-align: center;
}

.cal-day.is-today .num {
  font-weight: 700;
}

.cal-day.is-selected {
  box-shadow: inset 0 -2px 0 var(--ink);
}

.cal-day.is-future {
  color: var(--muted);
  cursor: default;
}

.cal-day:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.ticks {
  display: grid;
  gap: 3px;
}

.ticks .row {
  display: grid;
  grid-template-columns: 1.1em repeat(4, 8px);
  justify-content: center;
  align-items: center;
  gap: 3px;
}

.ticks em {
  font-style: normal;
  font-size: 10px;
  color: var(--muted);
  line-height: 1;
}

.ticks i {
  display: block;
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: transparent;
}

.ticks i.on {
  background: var(--ink);
}

.board {
  margin-top: 32px;
}

.board h2 {
  margin-bottom: 10px;
}

#people {
  list-style: none;
  margin: 0;
  padding: 0;
}

#people li {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
}

#people li.is-me .who {
  font-weight: 600;
}

#people .ticks i {
  width: 10px;
  height: 10px;
}

.noscript {
  padding: 24px;
  text-align: center;
}

@media (max-width: 520px) {
  .mast {
    grid-template-columns: 1fr auto;
  }

  .date {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .step {
    transition: none;
  }
}
