:root {
  color-scheme: light;
  --paper: #f7f1e3;
  --ink: #202a2f;
  --muted: #687277;
  --panel: #fffdf7;
  --line: rgba(32, 42, 47, .14);
  --belt: #34434b;
  --belt-edge: #1f292f;
  --red: #d94b45;
  --blue: #3578bc;
  --green: #2f996f;
  --gold: #d99a32;
  --shadow: 0 18px 44px rgba(29, 42, 49, .16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(217, 154, 50, .18), transparent 34%),
    linear-gradient(215deg, rgba(53, 120, 188, .14), transparent 38%),
    var(--paper);
}

.shell {
  width: min(1080px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 40px;
}

.top-links {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.top-links a {
  color: var(--ink);
  background: rgba(255, 255, 255, .72);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  font-weight: 850;
  text-decoration: none;
}

.hero {
  margin: 0 auto 18px;
  max-width: 820px;
  text-align: center;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: 6px 0 10px;
  font-size: clamp(2.35rem, 7vw, 5.1rem);
  line-height: .92;
}

.lede {
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.45;
}

.panel {
  margin: 16px 0;
  padding: 18px;
  background: rgba(255, 253, 247, .9);
  border: 2px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.scoreboard div {
  min-height: 78px;
  padding: 13px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
}

.scoreboard strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.35rem, 5vw, 2rem);
}

.game-panel { overflow: hidden; }

.depot {
  position: relative;
  height: min(62vw, 520px);
  min-height: 360px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,.06) 1px, transparent 1px),
    #d7d1c3;
  background-size: 38px 38px;
  border: 4px solid rgba(32, 42, 47, .18);
  overflow: hidden;
}

.belt {
  position: absolute;
  background: repeating-linear-gradient(90deg, var(--belt) 0 24px, #40525b 24px 48px);
  border: 5px solid var(--belt-edge);
  box-shadow: inset 0 9px 0 rgba(255,255,255,.08), inset 0 -9px 0 rgba(0,0,0,.16);
}

.main-belt {
  left: 4%;
  top: 44%;
  width: 46%;
  height: 54px;
}

.upper-belt {
  left: 49%;
  top: 24%;
  width: 24%;
  height: 54px;
  transform: rotate(-28deg);
  transform-origin: left center;
}

.lower-belt {
  left: 49%;
  top: 58%;
  width: 31%;
  height: 54px;
  transform: rotate(24deg);
  transform-origin: left center;
}

.blue-belt {
  left: 70%;
  top: 21%;
  width: 20%;
  height: 54px;
}

.junction {
  position: absolute;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #fff8e5;
  border: 6px solid var(--gold);
  font-weight: 950;
  font-size: .8rem;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}

.j1 { left: 45%; top: calc(44% - 10px); }
.j2 { left: 67%; top: calc(24% - 10px); }

.switch {
  position: absolute;
  z-index: 4;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 1.4rem;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 8px 0 rgba(0,0,0,.18);
}

.switch:focus-visible,
button:focus-visible {
  outline: 4px solid #ffe08a;
  outline-offset: 3px;
}

.switch-one { left: 44%; top: 63%; }
.switch-two { left: 66%; top: 7%; }

.van {
  position: absolute;
  display: grid;
  place-items: center;
  width: 116px;
  height: 72px;
  border-radius: 8px;
  color: white;
  font-weight: 950;
  letter-spacing: .08em;
  border: 4px solid rgba(0,0,0,.18);
  box-shadow: 0 10px 18px rgba(0,0,0,.16);
}

.van::after {
  content: "";
  position: absolute;
  bottom: -14px;
  left: 18px;
  right: 18px;
  height: 18px;
  background: radial-gradient(circle, #1f292f 0 9px, transparent 10px) left center / 50% 100% no-repeat,
              radial-gradient(circle, #1f292f 0 9px, transparent 10px) right center / 50% 100% no-repeat;
}

.van.red { right: 5%; top: 15%; background: var(--red); }
.van.blue { right: 5%; top: 36%; background: var(--blue); }
.van.green { right: 5%; bottom: 16%; background: var(--green); }

.parcel {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 46px;
  height: 34px;
  border-radius: 6px;
  color: white;
  font-weight: 950;
  border: 3px solid rgba(0,0,0,.18);
  box-shadow: 0 10px 16px rgba(0,0,0,.2);
  translate: -50% -50%;
}

.parcel::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 4px;
  translate: -50% 0;
  background: rgba(255,255,255,.38);
}

.parcel.red { background: var(--red); }
.parcel.blue { background: var(--blue); }
.parcel.green { background: var(--green); }

.feed {
  position: absolute;
  left: 5%;
  top: 35%;
  width: 150px;
  min-height: 48px;
  padding: 7px;
  border-radius: 8px;
  background: rgba(255,255,255,.72);
  border: 2px solid var(--line);
}

.feed-chip {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 22px;
  margin: 2px;
  border-radius: 5px;
  color: white;
  font-size: .72rem;
  font-weight: 950;
}

.message {
  margin: 13px 4px 0;
  color: var(--muted);
  text-align: center;
  font-weight: 750;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  min-width: 126px;
  padding: 13px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font: inherit;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 8px 0 rgba(113, 83, 28, .22);
}

button.secondary {
  background: #fff;
  border: 2px solid var(--line);
}

button:disabled {
  opacity: .52;
  cursor: not-allowed;
  box-shadow: none;
}

.manifest h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

.manifest-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.manifest-card {
  min-height: 52px;
  padding: 9px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 850;
}

.manifest-card span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}

@media (max-width: 760px) {
  .scoreboard { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 13px; }
  .depot {
    height: 560px;
    min-height: 560px;
  }
  .main-belt { left: 4%; top: 47%; width: 43%; }
  .upper-belt { left: 45%; top: 29%; width: 32%; transform: rotate(-35deg); }
  .lower-belt { left: 45%; top: 60%; width: 36%; transform: rotate(31deg); }
  .blue-belt { left: 66%; top: 25%; width: 26%; }
  .j1 { left: 40%; top: calc(47% - 10px); }
  .j2 { left: 61%; top: calc(29% - 10px); }
  .switch-one { left: 38%; top: 66%; }
  .switch-two { left: 60%; top: 10%; }
  .van { right: 3%; width: 88px; height: 62px; font-size: .78rem; }
  .van.red { top: 17%; }
  .van.blue { top: 39%; }
  .van.green { bottom: 17%; }
  .feed { width: 126px; }
}
