:root {
  color-scheme: light;
  font: 100%/1.45 system-ui, sans-serif;
  color: #30271d;
  background: #e7dbc2;
  --paper: #fcf5e5;
  --line: #d6c5a8;
  --red: #883c32;
  --green: #294b3c;
  --muted: #695541;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background:
    repeating-linear-gradient(135deg, #68462906 0 1px, transparent 1px 7px),
    radial-gradient(ellipse at top, #f7ecd8, #e0cfad);
  min-height: 100vh;
}
.page { max-width: 690px; margin: auto; padding: clamp(10px, 4vw, 42px) clamp(8px, 3vw, 24px); }
.card, .shopping {
  background: var(--paper);
  border: 1px solid #a68c68;
  border-radius: 14px;
  box-shadow: 0 12px 40px #50371c24;
}
/* Display regions of the supplied PNG without altering the source artwork. */
.masthead { text-align: center; padding: 14px 12px 0; }
.signature { margin: 0 0 8px; color: var(--green); font-size: .8125rem; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
h1 { margin: 9px 0 8px; font-size: clamp(1rem, 3vw, 1.45rem); line-height: 1.15; color: var(--green); }
.art {
  aspect-ratio: var(--w) / var(--h);
  background-image: url("./original-scorecard-art.png");
  background-repeat: no-repeat;
  background-size: calc(406 / var(--w) * 100%) calc(597 / var(--h) * 100%);
  background-position: calc(var(--x) / (406 - var(--w)) * 100%) calc(var(--y) / (597 - var(--h)) * 100%);
}
.art-banner { --x: 5; --y: 0; --w: 396; --h: 101; max-width: 500px; margin: auto; border-radius: 6px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.section-heading h2 { margin: 0; }
.section-heading .art { flex: 0 0 clamp(70px, 27%, 160px); border-radius: 4px; }
.art-station { --x: 199; --y: 131; --w: 174; --h: 44; }
.art-cars { --x: 136; --y: 224; --w: 228; --h: 27; }
.art-engine { --x: 214; --y: 474; --w: 161; --h: 31; }
.art-footer { --x: 16; --y: 575; --w: 369; --h: 21; max-width: 545px; margin: -10px auto 10px; width: 92%; border-radius: 4px; }

.card-body { padding: 7px clamp(11px, 4vw, 29px) 18px; }
.player { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px 0 13px; }
label, button, th, .subtotal { font-size: .875rem; font-weight: 700; }
.muted, .hint { color: var(--muted); }
.muted { font-weight: 400; }
.card section { border-top: 1px solid var(--line); padding: 12px 0; }
h2 { margin: 0 0 6px; color: var(--red); font: 700 1.35rem/1.15 Georgia, serif; }
.hint { margin: 0 0 10px; font-size: .9rem; }
.tickets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: start; }
.ticket label { display: block; margin-bottom: 3px; color: var(--green); }
input:not([type="checkbox"]) {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #a49074;
  border-radius: 5px;
  background: #fff;
  color: inherit;
  padding: 5px 8px;
  font: inherit;
}
.ticket input, td input { text-align: center; font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid #125f58; outline-offset: 2px; }
input[aria-invalid="true"] { border-color: #a62d26; box-shadow: inset 0 0 0 1px #a62d26; }
.field-error { display: block; margin-top: 5px; color: #8e251e; font-size: .8125rem; line-height: 1.2; }
button { cursor: pointer; min-height: 44px; color: var(--green); }
.outline { padding: 0 10px; background: transparent; border: 1px solid #9b9277; border-radius: 5px; }
.outline:hover { background: #eee1c6; }
.remove, .clear { background: transparent; border: 0; padding: 0 4px; text-decoration: underline; }
.remove { color: var(--red); }
.clear { display: block; margin: 4px auto 0; }
.section-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.section-footer.right { justify-content: flex-end; }
.subtotal { display: flex; align-items: center; justify-content: flex-end; gap: 7px; min-width: 0; color: var(--green); }
output {
  display: block;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #eee5d1;
  color: var(--green);
  padding: 5px 6px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  overflow-wrap: anywhere;
}
.subtotal output, .bonus output { min-width: 48px; max-width: 120px; }
table { width: 100%; table-layout: fixed; border-collapse: collapse; }
thead { color: var(--muted); }
thead th:first-child { width: 27%; text-align: left; }
thead th:nth-child(2) { width: 25%; }
tbody th { color: var(--green); text-align: left; }
td { padding: 2px 3px; text-align: center; }
tbody tr + tr { border-top: 1px solid #e9dec9; }
.bonus { display: flex; justify-content: space-between; align-items: center; gap: 9px; }
.bonus label { display: flex; align-items: center; gap: 9px; min-height: 44px; cursor: pointer; }
.bonus input { flex-shrink: 0; width: 20px; height: 20px; margin: 0; accent-color: var(--green); }
.grand-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(75px, 39%);
  align-items: center;
  gap: 10px;
  border-radius: 7px;
  padding: 9px 11px;
  background: var(--green);
  color: #fff8e8;
  font: 700 clamp(1.3rem, 4vw, 1.75rem)/1.1 Georgia, serif;
}
.grand-total output { background: #fff8e8; font: 800 clamp(1.55rem, 5vw, 2.1rem)/1.15 system-ui, sans-serif; }
.shopping { margin-top: 14px; padding: 17px; }
.shop-links { display: flex; flex-wrap: wrap; gap: 8px; }
.shop-links a { background: var(--red); color: white; border-radius: 5px; padding: 11px 13px; font-weight: 700; }
.shop-links:not([hidden]) + .custom-piece { margin-top: 14px; }
#amazon ul { margin: 0; padding-left: 20px; }
#amazon a { color: var(--green); font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Railroad frame, route map, and station-style score sign. */
body {
  background:
    repeating-linear-gradient(135deg, #e9d1a609 0 1px, transparent 1px 8px),
    radial-gradient(ellipse at top, #36564a, #192f29 80%);
}
.page { max-width: 740px; }
.card {
  position: relative;
  border: 3px double #a47b43;
  border-radius: 5px;
  background: linear-gradient(105deg, #fbf4e2, #fff8e8 45%, #f4e6c9);
  box-shadow: 0 14px 38px #10231c88;
}
.masthead { padding-top: 15px; }
h1 { font: 700 clamp(1.4rem, 4vw, 2rem)/1.07 Georgia, serif; margin: 10px 0 5px; }
.edition { margin: 0; color: var(--muted); font-size: .9rem; }
.guide-jump { display: inline-flex; align-items: center; min-height: 44px; color: var(--green); font-size: .875rem; font-weight: 700; }
#guide-heading { scroll-margin-top: 16px; }
.rail-side {
  position: absolute;
  top: 16%;
  width: 19px;
  pointer-events: none;
}
.rail-left { --x: 0; --y: 102; --w: 21; --h: 395; left: 1px; }
.rail-right { --x: 385; --y: 99; --w: 21; --h: 401; right: 1px; }
.card-body { padding-inline: clamp(24px, 5vw, 42px); }
.card section { border-top: 3px double #baa47d; }
.route-section table {
  isolation: isolate;
  position: relative;
}
.route-section table::before {
  --w: 39;
  --h: 122;
  --x: 225;
  --y: 338;
  content: "";
  position: absolute;
  inset: 25px 5px 3px 0;
  z-index: -1;
  pointer-events: none;
  opacity: .22;
  background: url("./original-scorecard-art.png") no-repeat;
  background-size: calc(406 / var(--w) * 100%) calc(597 / var(--h) * 100%);
  background-position: calc(var(--x) / (406 - var(--w)) * 100%) calc(var(--y) / (597 - var(--h)) * 100%);
  mask-image: radial-gradient(ellipse at center, #000 32%, transparent 76%);
}
.grand-total {
  background: #233e32;
  color: #fff5da;
  border: 4px double #d5ad62;
  border-radius: 4px;
  box-shadow: 0 3px 0 #c7ab79;
  padding: 12px;
}
.grand-total output { background: #fff5da; border-color: #cfad6b; }
.shopping, .scoring-guide {
  margin-top: 16px;
  padding: clamp(14px, 4vw, 25px);
  border: 1px solid #b19561;
  border-radius: 5px;
  background: var(--paper);
}
.printable-art { display: grid; grid-template-columns: 68px minmax(0, 1fr); align-items: center; gap: 14px; margin-bottom: 10px; }
.printable-art img { display: block; width: 100%; height: auto; border: 1px solid var(--line); }
.shop-links a { text-decoration: none; }
.shop-links a:hover { text-decoration: underline; }
#amazon { border-top: 1px solid var(--line); padding-top: 12px; }
#amazon h2 { font: 700 1rem/1.2 system-ui, sans-serif; color: var(--green); }
.scoring-guide p { margin: 8px 0 0; }
.scoring-guide ol { padding-left: 1.4em; }
.scoring-guide li + li { margin-top: 6px; }
.scoring-guide a { color: var(--green); }
.worked-example { background: #eee2c4; padding: 10px; border-left: 3px solid var(--red); }

@media (max-width: 540px) {
  .rail-side { display: none; }
  .card-body { padding-inline: clamp(9px, 3vw, 16px); }
  .art-banner { max-width: none; }
}

.custom-piece { margin: 0 0 14px; padding: 10px 12px; border-left: 3px solid var(--red); background: #eee2c4; }
.custom-piece a { color: var(--green); }
.affiliate-group + .affiliate-group { margin-top: 16px; }
.affiliate-group h3 { margin: 0 0 7px; color: var(--red); font: 700 1.12rem/1.2 Georgia, serif; }
#amazon .affiliate-group ul { list-style: none; padding: 0; }
.affiliate-group li + li { margin-top: 10px; }
#amazon .affiliate-card {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3vw, 18px);
  padding: 12px;
  border: 1px solid #b99a62;
  border-radius: 5px;
  background: #f5ead0;
  text-decoration: none;
}
#amazon .affiliate-card:hover { background: #efe0bd; }
.affiliate-card img {
  width: clamp(64px, 19vw, 112px);
  height: auto;
  aspect-ratio: 1;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
}
.affiliate-card strong { display: block; font: 700 1.2rem/1.12 Georgia, serif; }
.affiliate-summary { display: block; margin-top: 4px; color: var(--muted); font-size: .875rem; font-weight: 400; }
.affiliate-action { display: inline-block; margin-top: 8px; padding: 6px 9px; border-radius: 4px; background: var(--green); color: #fff8e8; font-size: .875rem; }
