:root {
  --bg: #fbfaf6; --surface: #ffffff; --ink: #1b1d21; --muted: #5a6068; --line: #d9d6cc;
  --accent: #0b6e69; --accent-ink: #ffffff; --warn-bg: #fff4d6; --warn-ink: #5a3d00; --mark: #ffe9a8;
  --skel: #e9e6dc; --skel-hi: #f4f1e8; --focus: #0b57d0; --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a; --surface: #1c1f25; --ink: #eceae4; --muted: #a4a9b1; --line: #343841;
    --accent: #4fc3bb; --accent-ink: #06201e; --warn-bg: #3a2f10; --warn-ink: #f4dca0; --mark: #5a4a14;
    --skel: #262a31; --skel-hi: #303540; --focus: #8ab4f8;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
.wrap { max-width: 42rem; margin: 0 auto; padding: 0 16px; }
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-top: 12px; padding-bottom: 12px; }
h1 { font-size: 1.15rem; margin: 0; letter-spacing: .01em; }
h2 { font-size: 1.05rem; margin: 0 0 6px; }
main { padding-top: 16px; padding-bottom: 48px; }
.meters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .8rem; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; color: var(--muted); background: var(--bg); }
.chip b { color: var(--ink); font-variant-numeric: tabular-nums; }
.lede { font-size: 1.05rem; margin: 4px 0 16px; }
.muted { color: var(--muted); margin: 0 0 10px; }
code { font-size: .9em; word-break: break-all; }
.cards { display: grid; gap: 12px; }
.card, .panel, .beat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel { margin: 0 0 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row-end { text-align: right; margin: 20px 0 0; }
input[type=text] { flex: 1 1 12rem; min-width: 0; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 48px; }
.btn { font: inherit; font-weight: 600; min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.accent { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.btn.big { min-height: 64px; font-size: 1.3rem; grid-column: 1 / -1; }
.btn[disabled], .btn[aria-disabled=true] { opacity: .45; cursor: not-allowed; }
.file { position: relative; overflow: hidden; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file[aria-disabled=true] input { pointer-events: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.why { margin: 6px 0 0; font-size: .85rem; color: var(--muted); min-height: 1.3em; }
.note { border-radius: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); margin: 12px 0; }
.note.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
/* ---- job panel ---- */
.job-head { min-height: 4.2rem; }
.bar-track { height: 8px; border-radius: 99px; background: var(--skel); overflow: hidden; margin: 8px 0 12px; }
.bar-track i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform .35s ease; }
.bar-track.none { visibility: hidden; }
.counters { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 12px; min-height: 2.6rem; }
.counters div { display: flex; flex-direction: column; }
.counters dt { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.counters dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; border-radius: 6px; }
.counters dd.pulse { animation: pulse .7s ease-out; }
@keyframes pulse { 0% { background: var(--mark); } 100% { background: transparent; } }
.stage { height: 9.6rem; overflow: hidden auto; border: 1px dashed var(--line); border-radius: 10px; padding: 8px; position: relative; }
#arrivals { list-style: none; margin: 0; padding: 0; }
#arrivals li { padding: 6px 10px; margin-bottom: 6px; border-radius: 8px; background: var(--bg); border-left: 4px solid var(--accent); font-size: .92rem; }
#arrivals li.bad { border-left-color: #b3261e; }
#arrivals li.arrive { animation: slide .35s ease-out; }
@keyframes slide { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#skeletons[hidden] { display: none; }
.skel { height: 2.1rem; border-radius: 8px; margin-bottom: 6px; background: linear-gradient(90deg, var(--skel) 25%, var(--skel-hi) 50%, var(--skel) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.controls { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.controls li { display: grid; grid-template-columns: minmax(9rem, 12rem) 1fr; gap: 4px 12px; align-items: center; }
.controls .why { margin: 0; }
@media (max-width: 480px) { .controls li { grid-template-columns: 1fr; } }
/* ---- walk ---- */
.strip { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 6px 6px 6px 12px; font-size: .9rem; margin-bottom: 8px; min-height: 48px; }
.gap { font-weight: 700; margin: 8px 0; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.beat { min-height: 15rem; }
.beat.arrive { animation: slide .28s ease-out; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tag { font-size: .75rem; border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tag.ground { text-transform: none; letter-spacing: 0; border-color: var(--accent); color: var(--accent); }
.claim { font-size: 1.35rem; line-height: 1.35; margin: 4px 0 8px; font-weight: 600; overflow-wrap: anywhere; }
.origin { margin: 0 0 10px; font-size: .9rem; font-weight: 600; color: var(--warn-ink); background: var(--warn-bg); border-radius: 6px; padding: 2px 8px; display: inline-block; }
.origin:empty { display: none; }
.needs { font-size: .9rem; color: var(--muted); margin-bottom: 8px; }
.needs ul { margin: 4px 0 0; padding-left: 18px; }
.glosses { padding-left: 22px; margin: 8px 0; }
.glosses li { margin-bottom: 6px; }
details { margin-top: 8px; font-size: .92rem; }
summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
#cite-body { border-left: 3px solid var(--line); padding: 4px 0 4px 10px; overflow-wrap: anywhere; white-space: pre-wrap; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.pad { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.whylist { list-style: none; padding: 0; margin: 6px 0 0; font-size: .82rem; color: var(--muted); }
.ask { margin-top: 18px; }
.ask label { display: block; font-weight: 600; margin-bottom: 6px; }
.tag, .why { overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .skel { background: var(--skel); }
  #arrivals li:last-child { border-left-width: 8px; }   /* static equivalent of the slide-in: the newest item is marked */
  .counters dd.pulse { background: var(--mark); }        /* static equivalent of the pulse: a highlight until the next change */
  .beat.arrive { box-shadow: inset 4px 0 0 var(--accent); }
}
[hidden] { display: none !important; }
summary::before { content: "\25B8"; margin-right: 6px; color: var(--muted); }
details[open] > summary::before { content: "\25BE"; }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
