:root {
  color-scheme: dark;
  --background: #171715;
  --paper: #f2eee4;
  --muted: #b6ac99;
  --gold: #e6ba78;
  --line: #4c4234;
  font-family: system-ui, sans-serif;
  color: var(--paper);
  background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.shell {
  display: grid;
  grid-template-columns: minmax(0, clamp(240px, 31vw, 390px)) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: clamp(20px, 3vw, 48px);
  height: 100vh;
  height: 100dvh;
  margin-inline: auto;
  max-width: 1600px;
  padding: clamp(16px, 2.6vw, 36px);
}
.sidebar { min-height: 0; overflow-y: auto; padding: 4px 12px 8px 4px; }
.masthead { border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.intro { margin: clamp(22px, 4vh, 42px) 0 24px; }
.timeline-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.timeline-head, .timeline-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.timeline-head { justify-content: space-between; }
.brand { color: var(--paper); text-decoration: none; font: 700 26px Georgia, serif; letter-spacing: -.05em; }
.brand span, .quiet span { color: var(--gold); }
.quiet { background: #25211b; border: 1px solid var(--line); color: var(--paper); border-radius: 6px; padding: 9px 12px; font-size: .78rem; white-space: nowrap; }
.quiet span { margin-left: 6px; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: Georgia, serif; font-weight: normal; }
h1 { font-size: clamp(2.35rem, 4.1vw, 4.2rem); letter-spacing: -.065em; line-height: .95; }
.intro p, #timeline-help, .foot, #counter-note { color: var(--muted); }
.intro p { margin: 15px 0 19px; line-height: 1.55; max-width: 36ch; }
.intro .privacy-note { margin: 12px 0 0; font-size: .8rem; }
form label { display: block; font-size: .82rem; margin-bottom: 7px; }
.form-controls { display: flex; flex-wrap: wrap; gap: 8px; }
input { min-width: 0; width: 156px; border: 1px solid var(--line); color: var(--paper); background: #221f1a; border-radius: 6px; padding: 9px; }
.primary { background: var(--gold); color: #221a12; border: 1px solid var(--gold); border-radius: 6px; font-weight: 700; padding: 9px 14px; }
.primary:hover { background: #f4ce95; }
.text-button { background: transparent; color: var(--gold); border: 0; padding: 8px 0 0; font-size: .8rem; text-decoration: underline; text-underline-offset: 3px; }
.counter { background: radial-gradient(ellipse at top, #3d3021, #211e18 75%); border: 1px solid #675239; padding: clamp(16px, 2vw, 28px); border-radius: 10px; min-width: 0; }
.caption { color: var(--gold); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; }
output { display: block; font: clamp(2.7rem, 5.2vw, 5rem)/1 Georgia, serif; letter-spacing: -.065em; margin: 9px 0 12px; overflow-wrap: anywhere; }
#counter-note { font-size: .86rem; }
h2 { font-size: clamp(1.8rem, 3.3vw, 2.45rem); letter-spacing: -.04em; }
#timeline-help { font-size: .84rem; margin: 5px 0 0; }
.instrument {
  display: grid;
  grid-template-columns: clamp(23px, 3vw, 46px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 14px;
  background: #211e1a;
}
.ruler { position: relative; border-right: 1px solid var(--line); background: #28221b; }
.ruler::before { content: ''; position: absolute; inset: 0 7px 0 auto; width: 9px; background: linear-gradient(to bottom, transparent 11px, #8e7450 11px) 0 var(--tick-offset, 0px) / 100% 12px repeat-y; }
.ruler span { position: absolute; inset: 50% 5px auto auto; border-block: 6px solid transparent; border-left: 8px solid var(--gold); transform: translateY(-50%); }
.dial { min-height: 0; overflow-y: auto; overflow-anchor: none; overscroll-behavior-y: contain; scrollbar-color: #98794e #211e1a; }
.dial:focus-visible { outline-offset: -3px; }
#timeline { position: relative; padding: 0; margin: 0; list-style: none; }
.row { position: absolute; inset-inline: 0; height: var(--row-height); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto); align-items: center; gap: 12px; padding: 8px clamp(10px, 2.8vw, 26px); border-bottom: 1px solid #3c3328; }
.row.even { background: #25211b; }
.row strong { display: block; font: normal clamp(1.04rem, 2.4vw, 1.32rem)/1.12 Georgia, serif; overflow-wrap: anywhere; }
.row > div:first-child > :is(strong, small) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.row strong a { color: inherit; text-decoration-color: var(--muted); text-underline-offset: .16em; }
.row strong a:focus-visible { outline-offset: -2px; }
.row strong a:hover { color: var(--gold); }
.row small { display: block; color: var(--muted); font-size: .77rem; margin-top: 3px; }
.row .value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .9rem; }
.row .value small { white-space: normal; }
.row.marker, .row.match { background: #48371f; color: #ffd999; }
.row.marker { border-block: 1px solid #9d7c4a; }
.foot { font-size: .75rem; margin-top: 10px; }
@media (max-width: 730px) {
  .shell { display: block; height: auto; }
  .sidebar { overflow: visible; padding: 0; }
  .timeline-panel { margin-top: 24px; }
  .instrument { flex: none; height: max(280px, 70vh); height: max(280px, 70dvh); }
  .counter { padding: 16px 18px; }
  output { margin: 4px 0 7px; }
  .row .value { max-width: 43vw; }
}
