:root {
  --page: #efeee8;
  --panel: #f8f7f2;
  --ink: #1c2226;
  --muted: #5c6468;
  --line: #c3c6c0;
  --accent: #1d4f7a;
  --accent-ink: #f8f7f2;
  --flash: #dfe9f1;
  --bar-h: 76px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Times New Roman", Times, serif;
  font-size: 18px;
  line-height: 1.35;
  padding-bottom: var(--bar-h);
}

h1, h2, legend, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 22px; font-weight: bold; }
.demo-tag { color: var(--muted); font-size: 16px; }

.build {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 460px);
  gap: 40px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  align-items: start;
}

.left { position: sticky; top: 16px; }

.stage { background: var(--panel); border: 1px solid var(--line); }
#tank { display: block; width: 100%; height: min(46vh, 520px); }
.latest {
  min-height: 2.9em;
  padding: 10px 18px 12px;
  border-top: 1px solid var(--line);
  font-size: 19px;
}

.get {
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.get h2 { font-size: 22px; margin-bottom: 8px; }
.get li {
  padding: 7px 8px;
  border-top: 1px solid var(--line);
  transition: background-color 0.9s ease;
}
.get li.changed { background: var(--flash); transition: none; }
.scale-note { color: var(--muted); font-size: 16px; padding: 8px 8px 0; border-top: 1px solid var(--line); }

.options h1 { font-size: 34px; line-height: 1.1; margin-bottom: 22px; }

fieldset { border: 0; padding: 0; margin: 0 0 26px; min-width: 0; }
legend { font-size: 21px; font-weight: bold; padding: 0; margin-bottom: 10px; }

.choices { display: grid; gap: 8px; grid-template-columns: repeat(var(--n, 2), 1fr); }
.choices.sizes { gap: 6px; }
.choices.sizes .choice { padding: 6px 6px 8px; align-items: center; text-align: center; }
.thumb { display: block; width: 100%; height: auto; margin-bottom: 4px; }
.thumb .ln { stroke: #7d8581; stroke-width: 1; stroke-linejoin: round; vector-effect: non-scaling-stroke; }

.choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: 60px;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.choice .diff { color: var(--muted); font-size: 16px; }
.choice[aria-pressed="true"] {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}
.choice[aria-pressed="true"] .diff { color: var(--accent); }
.choice:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.source { color: var(--muted); font-size: 16px; }

.bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--panel);
  border-top: 1px solid var(--ink);
  z-index: 5;
}
.bar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 1320px;
  min-height: var(--bar-h);
  margin: 0 auto;
  padding: 10px 24px;
}
.total { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; }
.total-label { color: var(--muted); }
#total { font-size: 30px; }
.total-note { color: var(--muted); font-size: 16px; }

button.primary, button.plain {
  min-height: 48px;
  padding: 10px 22px;
  border-radius: 0;
  font: inherit;
  font-size: 19px;
  cursor: pointer;
  white-space: nowrap;
}
button.primary { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
button.plain { background: transparent; color: var(--ink); border: 1px solid var(--ink); }

dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 24px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
}
dialog::backdrop { background: rgba(28, 34, 38, 0.55); }
dialog h2 { font-size: 28px; margin-bottom: 12px; }
#summary-list li { padding: 7px 0; border-top: 1px solid var(--line); }
.summary-total { padding: 10px 0; border-top: 1px solid var(--ink); font-size: 20px; }
.summary-total strong { font-size: 26px; }
#summary-note { color: var(--muted); font-size: 16px; }
.fields { display: grid; gap: 10px; margin: 8px 0 10px; }
.fields label { display: grid; gap: 4px; }
.fields input {
  min-height: 46px;
  padding: 8px 10px;
  background: #fdfcf8;
  border: 1px solid var(--muted);
  border-radius: 0;
  font: inherit;
  color: var(--ink);
}
.error { color: #8c1d18; margin-bottom: 8px; }
.demo-line { color: var(--muted); font-size: 16px; margin-bottom: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
#summary-done p { margin-bottom: 16px; }
[hidden] { display: none !important; }
.noscript { padding: 24px; }

/* Tank drawing */
#tank * { vector-effect: non-scaling-stroke; }
#tank .ln { stroke: #7d8581; stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
#tank .thin { stroke: #9aa19c; stroke-width: 1; fill: none; stroke-linecap: round; }
#tank .dash { stroke: #9aa19c; stroke-width: 1; stroke-dasharray: 5 5; fill: none; }
#tank .part { animation: part-in 0.45s ease both; }
@keyframes part-in { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  #tank .part { animation: none; }
  .get li { transition: none; }
}

@media (min-width: 1180px) {
  .left {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    background: var(--panel);
    border: 1px solid var(--line);
  }
  .stage { border: 0; }
  #tank { height: min(70vh, 640px); }
  .latest { display: none; }
  .get { margin: 0; border-width: 0 0 0 1px; padding: 22px 18px; }
}

@media (max-width: 860px) {
  :root { --bar-h: 96px; }
  body { font-size: 17px; }
  .top { padding: 10px 16px; }
  .brand { font-size: 19px; }
  .build { display: flex; flex-direction: column; gap: 0; padding: 0 0 24px; }
  .left { display: contents; }
  .stage {
    position: sticky;
    top: 0;
    z-index: 4;
    order: 1;
    border-width: 0 0 1px;
    align-self: stretch;
  }
  #tank { height: 36vh; min-height: 230px; }
  .latest { min-height: calc(2.7em + 14px); padding: 6px 16px 8px; font-size: 16px; }
  .options { order: 2; padding: 18px 16px 0; }
  .options h1 { font-size: 26px; margin-bottom: 16px; }
  .get { order: 3; margin: 6px 16px 0; }
  fieldset { margin-bottom: 20px; }
  .bar-inner { padding: 8px 16px; gap: 10px; }
  #total { font-size: 24px; }
  .total-label { display: none; }
  .total-note { flex-basis: 100%; font-size: 14px; }
  button.primary, button.plain { padding: 10px 14px; font-size: 17px; }
  .choices.sizes .choice { padding: 6px 2px 8px; font-size: 15px; }
  .choices.sizes .diff { font-size: 13px; }
  dialog { padding: 18px; }
}
