*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto 1fr auto;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.55 var(--f-body);
  position: relative;
  isolation: isolate;
}
/* Faded tread-plate pattern rising from the bottom-left, plus two soft glows. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--ink);
  opacity: 0.07;
  -webkit-mask: url('/pattern.svg') 0 0 / 36px 36px, linear-gradient(35deg, #000 0%, transparent 58%);
  -webkit-mask-composite: source-in;
  mask: url('/pattern.svg') 0 0 / 36px 36px, linear-gradient(35deg, #000 0%, transparent 58%);
  mask-composite: intersect;
  pointer-events: none;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(60vw 50vh at 0% 100%, color-mix(in srgb, var(--sig) 16%, transparent), transparent 70%),
    radial-gradient(50vw 50vh at 100% 0%, color-mix(in srgb, #3c6ea8 12%, transparent), transparent 70%);
  pointer-events: none;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--sig); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; font-family: var(--f-head); font-weight: 700; line-height: 1.02; letter-spacing: 0; }
p { margin: 0 0 0.8em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--sig); color: var(--sig-ink); padding: 8px 14px; font-weight: 700; }
.skip:focus { left: 8px; }
.mono { font-family: var(--f-mono); font-size: 0.82em; }

.wrap { width: min(100% - 2 * var(--gut), var(--wrap)); margin-inline: auto; }

/* Labels */
.col-h, .lbl {
  font: 600 12px/1.3 var(--f-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lbl { margin: 16px 0 6px; }
.code {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 22px;
  padding: 0 5px;
  background: var(--sig);
  color: var(--sig-ink);
  font: 600 12px/1 var(--f-mono);
  letter-spacing: 0.02em;
}

/* Buttons & fields */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: 600 14px/1 var(--f-body);
  letter-spacing: 0.02em;
  text-decoration: none;
  text-transform: uppercase;
}
.btn:hover { background: var(--ink); color: var(--sheet); }
.btn-sig { background: var(--sig); border-color: var(--sig); color: var(--sig-ink); }
.btn-sig:hover { background: var(--ink); border-color: var(--ink); color: var(--sig); }
.btn.block { width: 100%; justify-content: center; margin-top: 18px; }
.tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  min-width: 40px;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid currentColor;
  background: transparent;
  font: 500 14px/1 var(--f-body);
}
.tool:hover { background: var(--sig); color: var(--sig-ink); border-color: var(--sig); }
.tool kbd { font: 600 11px/1 var(--f-mono); border: 1px solid currentColor; padding: 2px 5px; opacity: 0.7; }
.link-btn { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; gap: 5px; color: inherit; }
.field {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1.5px solid var(--rule2);
  background: var(--sheet);
  border-radius: 0;
}
.field:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--sig); }
textarea.field { resize: vertical; line-height: 1.5; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 15px; }
.alert { background: color-mix(in srgb, var(--shelved) 14%, var(--sheet)); border-left: 4px solid var(--shelved); padding: 10px 12px; margin: 10px 0; font-size: 15px; }
.ico { flex: none; }

/* Rivets: four small dots in the corners of a plate. */
.rivets {
  --rv: radial-gradient(circle, var(--rule2) 0 2.6px, transparent 3.2px);
  background:
    var(--rv) left 3px top 3px / 14px 14px no-repeat,
    var(--rv) right 3px top 3px / 14px 14px no-repeat,
    var(--rv) left 3px bottom 3px / 14px 14px no-repeat,
    var(--rv) right 3px bottom 3px / 14px 14px no-repeat,
    var(--sheet);
  border: 1px solid var(--rule);
}

/* Status */
.st { display: inline-flex; align-items: center; gap: 6px; font: 600 11.5px/1 var(--f-mono); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink2); white-space: nowrap; }
.st i { width: 10px; height: 10px; background: var(--announced); flex: none; }
.st-building i { background: var(--building); }
.st-running i { background: var(--running); }
.st-shelved i { background: var(--shelved); }
.st-none i { background: var(--rule2); }

/* Toasts & tooltip */
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--navy); color: var(--on-navy); padding: 12px 16px; border-left: 5px solid var(--sig); font-size: 15px; max-width: 360px; animation: up 0.25s ease; }
#tip {
  position: absolute;
  z-index: 55;
  max-width: 300px;
  background: var(--navy);
  color: var(--on-navy);
  padding: 10px 12px 12px;
  border-top: 4px solid var(--sig);
  font-size: 14px;
  line-height: 1.3;
  pointer-events: none;
  display: grid;
  gap: 6px;
}
#tip b { font: 600 17px/1.1 var(--f-head); }
#tip .tip-place { font: 600 11px/1 var(--f-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--sig); }
#tip .st { color: var(--on-navy2); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

#main { padding-bottom: 72px; min-width: 0; }
#main.enter { animation: rise 0.35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
