:root {
  color-scheme: light;
  font-family: "Work Sans", system-ui, "Hiragino Sans", "Yu Gothic", sans-serif;
  color: #222720;
  background: #f4f1e8;
  --paper: #fffdf7;
  --ink: #222720;
  --muted: #585c51;
  --line: #d7d3c5;
  --accent: #a23824;
  --focus: #a23824;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.wrap { max-width: 72rem; margin: auto; padding-inline: clamp(1rem, 4vw, 3rem); }
.masthead { border-bottom: 1px solid var(--line); }
.masthead .wrap { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-block: 1rem; }
.masthead h1 { margin: 0; font-size: clamp(1.25rem, 5vw, 1.8rem); letter-spacing: -.055em; line-height: 1.2; }
.masthead p { margin: .28rem 0 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }
#logout { flex: none; font-size: .75rem; padding-inline: .35rem; border: 0; text-decoration: underline; text-underline-offset: .25em; }
main { padding-bottom: 3rem; }
main > .panel { max-width: 33rem; margin: 2rem auto; padding: clamp(1rem, 5vw, 2rem); border: 1px solid var(--line); background: var(--paper); }
#mission { display: grid; gap: clamp(1.4rem, 4vw, 2.5rem); }
.page-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 clamp(.65rem, 3vw, 1.5rem); margin-bottom: -1.25rem; }
.page-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: .79rem; font-weight: 680; text-decoration: none; }
.page-nav a:first-child { color: var(--accent); }
.page-nav a:hover { text-decoration: underline; text-underline-offset: .25em; }
.panel { min-width: 0; padding-block: 1rem; border-top: 1px solid var(--ink); scroll-margin-top: 1rem; }
.columns { display: grid; gap: clamp(1.4rem, 4vw, 2.5rem); }
.record-panel { border-top: 3px solid var(--accent); padding: clamp(1rem, 3.5vw, 1.7rem); background: var(--paper); }
@media (min-width: 740px) {
  .columns { grid-template-columns: minmax(0, 1.06fr) minmax(0, .94fr); align-items: start; }
}
h2 { font-size: clamp(1.2rem, 4vw, 1.55rem); line-height: 1.4; letter-spacing: -.04em; margin: 0 0 .9rem; }
h3 { font-size: .98rem; margin: 1.2rem 0 .5rem; }
p { line-height: 1.55; }
.small { color: var(--muted); font-size: .82rem; }

.moon-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(1rem, 4.7vw, 3.1rem);
  background: #151914;
  color: #f8f5e9;
  --focus: #ffab87;
}
.moon-art {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: url("/moon-mosaic.png") no-repeat right -5rem center / clamp(21rem, 57%, 40rem) auto;
}
.moon-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #151914 37%, #151914cc 52%, #15191414 86%);
}
.moon-content { max-width: 42rem; }
.countdown { color: #ffd0b7; margin: 0 0 .7rem; font-size: .78rem; font-weight: 720; }
#moon-title { font-size: clamp(1.45rem, 4.25vw, 2.75rem); line-height: 1.17; margin: 0; }
#moon-title span { display: inline-block; }
.moon-label { color: #ddd9c9; font-size: .76rem; margin: 1.05rem 0 .2rem; }
.moon-totals { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .65rem; color: #e1dacc; margin: 0 0 .55rem; }
.moon-totals strong { font-size: clamp(1.65rem, 6.5vw, 3.1rem); font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -.055em; }
.moon-totals span { font-size: .82rem; }
.moon-footer { display: flex; align-items: center; gap: .6rem; max-width: 28rem; color: #e1dacc; font-size: .72rem; }
.moon-footer span { flex: none; }
progress { width: 100%; height: .38rem; appearance: none; display: block; border: 0; border-radius: 0; background: var(--track, #ddd8cc); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--track, #ddd8cc); }
progress::-webkit-progress-value { background: var(--fill, var(--accent)); }
progress::-moz-progress-bar { background: var(--fill, var(--accent)); }
#moon-progress { --track: #696a5f; --fill: #ffa47d; }
@media (max-width: 610px) {
  .moon-art { background-position: right -6rem top -2.7rem; background-size: clamp(16rem, 67vw, 21rem) auto; }
  .moon-art::after { background: linear-gradient(90deg, #151914 0%, #151914bd 42%, #15191429 100%), linear-gradient(0deg, #151914 0%, #15191400 78%); }
}

form { display: grid; gap: .82rem; }
label { display: grid; gap: .3rem; font-size: .84rem; font-weight: 650; min-width: 0; }
input, select, textarea, button { font: inherit; min-height: 44px; }
input, select, textarea { color: inherit; border: 1px solid #a8a99b; border-radius: .23rem; padding: .58rem .65rem; width: 100%; min-width: 0; background: #fffef9; font-size: 1rem; }
input[type=date] { appearance: none; }
input[type=date]::-webkit-date-and-time-value { text-align: left; }
textarea { resize: vertical; }
button { cursor: pointer; color: inherit; background: transparent; border: 1px solid #a8a99b; border-radius: .22rem; padding: .5rem .8rem; font-weight: 680; }
button:hover { background: #ece7da; }
button:disabled { cursor: wait; opacity: .65; }
:where(a, button, input, textarea, select, summary):focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.primary { background: var(--accent); border-color: var(--accent); color: #fffaf1; }
.primary:hover { background: #832e1d; }
.quiet, .link { background: transparent; color: var(--muted); }
.link { border: 0; padding-left: 0; text-decoration: underline; text-underline-offset: .2em; }
.danger { color: #fff; background: #993622; border-color: #993622; }
.danger:hover { background: #792819; }
.measure { display: flex; gap: .65rem; }
.measure > label { flex: 1; }
#measure-hint { margin: -.3rem 0 0; }
.weekly-mission { background: var(--paper); border-top: 2px solid var(--accent); padding: 1rem clamp(1rem, 3.5vw, 1.7rem); }
.weekly-mission h2 { margin-bottom: .55rem; }
.mission-label { margin: 0 0 .4rem; color: var(--accent); font-weight: 700; }
#mission-end { margin-left: .6rem; color: var(--muted); font-weight: 500; }
.mission-goals { padding: 0; margin: .7rem 0; display: grid; gap: .65rem; list-style: none; }
.mission-goals li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .35rem .8rem; font-size: .88rem; }
.mission-goals progress { grid-column: 1 / -1; }
#mission-result { margin: .55rem 0 0; }
.reaction-count { display: inline-block; align-self: center; padding-block: .2rem; color: var(--muted); }
.mission-source { color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: .55rem; }
#notice { background: #fae5dc; border-left: 3px solid var(--accent); padding: .7rem; margin: .85rem 0 0; }
#code { display: block; padding: .8rem; overflow-wrap: anywhere; background: #eeebdd; margin-bottom: 1rem; }
#member { margin: -.4rem 0 .85rem; overflow-wrap: anywhere; }
.stats, .week { display: grid; gap: .46rem; margin: .5rem 0; }
.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--line); padding-block: .74rem; }
.stats div { min-width: 0; padding-right: .35rem; }
.stats div + div { border-left: 1px solid var(--line); padding-left: .65rem; }
.stats dt { color: var(--muted); font-size: .73rem; }
.stats dd { margin: .23rem 0 0; font-weight: 780; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.week div { display: flex; gap: .5rem; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: .35rem; }
.week dd { text-align: right; margin: 0; }
#altitude { font-size: .87rem; }
.entry { border-top: 1px solid var(--line); padding: .85rem 0; overflow-wrap: anywhere; }
.entry p { margin: .35rem 0; white-space: pre-wrap; }
.entry .entry-title { font-weight: 760; }
.entry .actions { margin-top: .45rem; }
.entry button[aria-pressed=true] { color: var(--accent); border-color: var(--accent); background: #fae5dc; }
#more { margin-top: .5rem; }
details { border-top: 1px solid var(--line); }
summary { cursor: pointer; min-height: 44px; padding-block: .62rem; }
dialog { color: inherit; background: var(--paper); border: 1px solid var(--line); padding: 1.25rem; max-width: min(35rem, calc(100% - 2rem)); max-height: 85dvh; overflow: auto; }
dialog::backdrop { background: #161713aa; }
