:root {
  color-scheme: light dark;
  --bg: light-dark(#ffffff, #14151d);
  --box: light-dark(#f6f6f9, #1d1f2a);
  --text: light-dark(#1b1d2a, #e9e9f0);
  --muted: light-dark(#565a70, #a6a9bd);
  --line: light-dark(#c9cbd8, #3b3e50);
  --top: light-dark(#ffd9e2, #43202c);
  --bar: light-dark(#1b1d2a, #f3d3dc);          /* the black bar over hidden data */
  --on-bar: light-dark(#ffffff, #241118);
  --focus: light-dark(#c2185b, #ff8fb3);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.5 system-ui, sans-serif; }
header { background: var(--top); padding: 24px max(20px, calc(50vw - 560px)) 30px; }
main, footer { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
h1 { font-size: clamp(1.8rem, 5.5vw, 2.9rem); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 12px; max-width: 22ch; text-wrap: balance; }
h2 { font-size: 1.4rem; line-height: 1.25; margin: 0 0 14px; }
p { margin: 0 0 12px; max-width: 68ch; }
header p { margin: 0; }
.name { font-weight: 700; margin-bottom: 18px; }
section, details { padding-top: 34px; }
.columns { display: grid; gap: 24px 32px; }
.columns > * { min-width: 0; }
@media (min-width: 800px) { .columns { grid-template-columns: 1fr 1fr; } }

label, .label { display: block; margin: 0 0 6px; font-weight: 600; }
button, textarea, .button { font: inherit; color: inherit; }
textarea, .box { display: block; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font: 0.95rem/1.6 ui-monospace, Consolas, monospace; }
textarea { resize: vertical; }
.box { background: var(--box); min-height: 12rem; max-height: 34rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.box:empty::before { content: attr(data-empty); color: var(--muted); font-family: system-ui, sans-serif; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
mark { background: var(--bar); color: var(--on-bar); padding: 1px 5px; border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 18px; }
button, .button { min-height: 46px; padding: 0 18px; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }
button:hover:enabled { border-color: var(--text); }
.main { background: var(--bar); border-color: var(--bar); color: var(--on-bar); font-weight: 600; }
button:disabled { opacity: 0.45; cursor: default; }
.check { display: flex; gap: 10px; align-items: baseline; font-weight: 400; }
.hint { color: var(--muted); font-size: 0.95rem; margin-top: 8px; }
.status:empty { display: none; }
.warning { font-weight: 600; }

.items { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--line); }
.items li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.items code { font: 0.95rem/1.5 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.items .tag { font-weight: 700; margin-right: 12px; }
.items .visible .tag { text-decoration: line-through; font-weight: 400; color: var(--muted); }
footer { margin-top: 36px; padding-top: 20px; padding-bottom: 32px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.93rem; }

/* tabs */
.tabs { display: flex; gap: 4px; margin: 26px 0 24px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 4px solid transparent; border-radius: 0; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected=true] { border-color: var(--bar); color: var(--text); }
fieldset { border: 0; margin: 16px 0 0; padding: 0; }
legend { padding: 0; margin-bottom: 6px; font-weight: 600; }
summary { cursor: pointer; font-weight: 600; margin-bottom: 16px; }
details .check { margin-bottom: 18px; }

/* PDF and pictures */
.away { position: absolute; opacity: 0; width: 1px; height: 1px; }
.button { display: inline-flex; align-items: center; margin: 0; }
.away:focus-visible + .button { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop { border: 2px dashed var(--line); border-radius: 8px; padding: 30px 20px; text-align: center; margin-bottom: 16px; }
.drop p { margin: 10px auto 0; color: var(--muted); }
.drop.over { border-color: var(--focus); background: var(--box); }
.work { display: grid; gap: 24px 32px; margin-top: 24px; }
.work > * { min-width: 0; }
@media (min-width: 900px) {
  .work { grid-template-columns: minmax(0, 1fr) 360px; }
  aside { position: sticky; top: 12px; align-self: start; max-height: calc(100vh - 24px); overflow: auto; padding: 4px; }
}
@media (max-width: 899px) { aside { order: -1; } .work .items { max-height: 16rem; overflow: auto; } }
.toolbar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 0; background: var(--bg); }
.touch { display: none; }
@media (pointer: coarse) { .touch { display: inline; } .mouse { display: none; } }
.items:empty { display: none; }
#draw { display: none; }
@media (any-pointer: coarse) { #draw { display: block; } }
#draw[aria-pressed=true] { border: 2px solid var(--focus); }
.page { position: relative; width: 100%; margin: 0 0 18px; background: #fff; border: 1px solid var(--line); cursor: crosshair; user-select: none; -webkit-user-select: none; overflow: hidden; }
.page canvas { display: block; width: 100%; height: 100%; }
.drawing .page { touch-action: none; }
/* the boxes are black in the dark theme too, because they are black in the downloaded file */
.cover, .sketch { position: absolute; min-height: 0; padding: 0; border: 0; border-radius: 0; background: #000; }
.cover:hover:enabled { outline: 2px solid #c2185b; }
.cover.off { background: none; outline: 2px dashed #c2185b; }
.sketch { opacity: 0.6; }
