body {
  background: radial-gradient(ellipse at 70% 8%, #3b5951, transparent 64%), #1a3237;
}
.rail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(270px, 1fr);
  gap: 16px;
  align-items: start;
}
.town-map {
  position: relative;
  aspect-ratio: 3/2;
  overflow: hidden;
  border: 3px solid #d0b27e;
  border-radius: 13px;
  box-shadow: 0 4px 0 #74694d;
  background: #93bb86;
  isolation: isolate;
}
.town-map > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.tram-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  min-height: 32px;
  padding: 4px 10px;
  border: 2px solid #5b5545;
  box-shadow: 0 3px #5c5145;
  border-radius: 6px;
  background: #fff0bf;
  color: #373a31;
  text-decoration: none;
  font: 700 clamp(16px, 2vw, 23px)/1 var(--pixel);
  z-index: 2;
}
.tram-pin::after {
  content: '';
  position: absolute;
  bottom: -6px;
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  border-right: 2px solid #645b47;
  border-bottom: 2px solid #645b47;
  background: inherit;
}
.tram-pin[aria-current='location'] {
  background: #c7f1cb;
  outline: 3px solid #325c42;
  outline-offset: 2px;
}
.tram-pin:focus-visible {
  outline: 4px solid #233e63;
}
.pin-works {
  background: #d9ecff;
}
.pin-fair {
  background: #f8d2c4;
}
.pin-library {
  background: #dbedbe;
}
#cat-car {
  position: absolute;
  width: clamp(30px, 5vw, 55px);
  aspect-ratio: 1.6;
  transform: translate(-50%, -80%);
  background: linear-gradient(
    #c1ded5 0 12%,
    #346953 12% 23%,
    #dbb878 24% 68%,
    #45745e 68% 90%,
    #374333 90%
  );
  border: 2px solid #454e3d;
  border-radius: 6px 6px 4px 4px;
  box-shadow: 0 4px 0 #3e4b3755;
  pointer-events: none;
  z-index: 3;
}
#cat-car::before,
#cat-car::after {
  content: '';
  position: absolute;
  bottom: -14%;
  width: 18%;
  height: 23%;
  border-radius: 50%;
  background: #4d463d;
  border: 1px solid #d1bd92;
}
#cat-car::before {
  left: 10%;
}
#cat-car::after {
  right: 10%;
}
#cat-car i,
#cat-car b {
  position: absolute;
  top: 14%;
  width: 38%;
  height: 64%;
  background-color: #d6e9da;
  background-repeat: no-repeat;
  background-size: 400% 100%;
  border: 1px solid #577263;
  border-radius: 3px;
  image-rendering: pixelated;
}
#cat-car i {
  left: 8%;
  background-image: url(assets/michi-idle.webp);
}
#cat-car b {
  right: 7%;
  background-image: url(assets/koko-idle.webp);
}
.tram-status {
  font-weight: 850;
  color: #ffe9aa;
  margin: 7px 0;
}
.rail-controls {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}
.rail-controls a {
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid #7e9686;
  border-radius: 6px;
  text-decoration: none;
  background: #273f38;
}
.arrival-board,
.tram-notes,
.shift-cards a {
  border: 1px solid #7d978a;
  background: #294640;
  border-radius: 11px;
  padding: 13px;
}
.arrival-board {
  padding: 0;
  overflow: hidden;
}
.arrival {
  padding: 13px 15px;
  background: #eaddbe;
  color: #354136;
  border-bottom: 3px solid #b59a69;
}
.arrival h2,
.tram-notes h2,
.shift-cards strong,
.driver h2,
.driver h3 {
  font: 700 24px/1.1 var(--pixel);
  margin: 4px 0;
}
.arrival p,
.shift-cards p {
  margin: 3px 0;
}
.directory {
  padding: 8px;
}
.directory details {
  border-bottom: 1px dashed #738578;
  padding: 3px 0;
}
.directory summary,
.tram-notes summary {
  cursor: pointer;
  font-weight: 900;
  padding: 5px 0;
  color: #ffebbc;
}
.directory summary small {
  color: #d5e6d9;
}
.directory ul {
  list-style: none;
  margin: 3px 0 7px;
  padding: 0;
}
.game-door {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  font-size: 0.9rem;
  color: #f6f6dc;
  padding: 5px 3px;
  border-bottom: 1px solid #3c5a4c;
}
.game-door small {
  color: #c7dbc9;
  white-space: nowrap;
}
.game-door:hover span {
  text-decoration: underline;
}
.shift-cards,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.shift-cards a {
  color: #fff4d2;
  text-decoration: none;
  padding: 11px;
}
.shift-cards strong,
.shift-cards span,
.shift-cards small {
  display: block;
}
.shift-cards span,
.caption {
  font-size: 0.87rem;
}
.shift-cards small,
.ink-label {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 950;
}
.shift-cards small {
  color: #f0d298;
}
.driver {
  color: #273b36;
  background: #f4ecda;
  border: 3px solid #b79d72;
  border-radius: 13px;
  padding: clamp(12px, 1.7vw, 22px);
  box-shadow: 0 4px #69634f;
}
.driver p {
  margin: 7px 0;
}
.driver button {
  color: #2b463c;
  background: #fff8e6;
  border-color: #a99e82;
}
.driver button[aria-pressed='true'] {
  background: #3d6955;
  color: white;
}
.driver button.fare-button {
  color: #333d33;
  background: #f3ca78;
  border: 2px solid #ab874b;
}
.paper-job {
  border-left: 4px solid #ac8655;
  background: #fff9e8;
  padding: 9px 12px;
  margin: 0 0 10px;
}
.paper-job h2 {
  font-size: clamp(20px, 2vw, 27px);
}
.levers,
.readouts {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0;
}
.routed-slip,
.running-fare {
  padding: 8px 10px;
  background: #e0e9d3;
  border-left: 3px solid #61876e;
  border-radius: 3px;
}
.track-switch {
  position: relative;
  height: 78px;
  border: 1px solid #8f9d82;
  border-radius: 9px;
  background: #c9d5aa;
  overflow: hidden;
}
.rail-cat {
  position: absolute;
  width: 54px;
  height: 54px;
  top: 9px;
  left: 10px;
  background: url(assets/michi-idle.webp) 0 0/400% 100% no-repeat;
  image-rendering: pixelated;
}
.track-switch .line {
  position: absolute;
  left: 67px;
  right: 14px;
  height: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.track-switch .line.local {
  top: 12px;
}
.track-switch .line.express {
  bottom: 11px;
}
.line i {
  height: 8px;
  border-block: 2px solid #7e7966;
  flex: 1;
  background: repeating-linear-gradient(90deg, #997c5b 0 4px, transparent 4px 15px);
}
.line b {
  width: 64px;
}
.line.selected i {
  border-color: #27765c;
  background-color: #c3e7b4;
}
.line.selected b {
  color: #18583e;
}
.readouts > p {
  padding: 6px 9px;
  background: #254b43;
  color: #f5f4d8;
  border-radius: 6px;
  font-size: 0.8rem;
}
.readouts b {
  display: block;
  font: 700 24px var(--pixel);
}
.driver-note {
  border-top: 1px dashed #a39b82;
  padding-top: 8px;
}
.rail-stamp {
  background: #dce9c9;
  padding: 8px;
}
.rail-stamp a,
.next-shift {
  color: #285b43;
}
.next-shift {
  display: inline-block;
  padding: 5px 10px;
}
.shift-ledger {
  padding-left: 20px;
}
.shift-ledger li {
  margin: 5px 0;
}
.tram-notes details {
  margin-top: 12px;
}
.tram-notes h2 {
  display: flex;
  align-items: center;
  gap: 5px;
}
.tram-notes h2::before {
  content: '';
  width: 38px;
  height: 38px;
  background: url(assets/koko-idle.webp) 0 0/400% 100% no-repeat;
  image-rendering: pixelated;
}
.threshold {
  display: block;
  font-weight: 900;
}
.threshold input {
  display: block;
  width: 100%;
  accent-color: #376e53;
}
.cal-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 10px 0;
}
.cal-grid > div,
.comparison > article {
  border: 1px solid #a3ab91;
  background: #e8ecd8;
  border-radius: 7px;
  padding: 8px;
}
.cal-grid span {
  font: 700 17px var(--pixel);
  background: #d1dfbf;
  padding: 2px 8px;
  border-radius: 5px;
}
.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.comparison .readouts {
  gap: 4px;
}
.comparison .readouts p {
  margin: 0;
}
.comparison .readouts b {
  font-size: 20px;
}
.risk-board {
  padding: 11px;
  border: 1px solid #8ea68a;
  border-radius: 8px;
  background: #e4ebd7;
  margin: 10px 0;
}
.risk-board figcaption {
  font-weight: 900;
}
.risk-bars {
  display: flex;
  gap: 9px;
  align-items: flex-end;
  margin: 8px 0;
}
.risk-bars > div {
  flex: 1;
  text-align: center;
}
.risk-column {
  background: #c8d5bd;
  height: 65px;
  display: flex;
  align-items: flex-end;
}
.risk-column i {
  display: block;
  width: 100%;
  background: #93704e;
}
.risk-bars b,
.risk-bars small {
  display: block;
  font-size: 0.82rem;
}
.driver button:focus-visible,
.driver input:focus-visible {
  outline: 3px solid #925b23;
}
@media (max-width: 850px) {
  .rail-layout {
    grid-template-columns: 1fr;
  }
  .shift-cards strong {
    font-size: 19px;
  }
  .shift-cards {
    gap: 5px;
  }
  .shift-cards a {
    padding: 8px;
  }
  .tram-pin {
    min-height: 35px;
    min-width: 55px;
  }
  .driver button {
    min-height: 40px;
  }
  .comparison {
    grid-template-columns: 1fr;
  }
  .game-door {
    min-height: 38px;
  }
}
@media (max-width: 480px) {
  .shift-cards {
    grid-template-columns: 1fr;
  }
  .shift-cards a {
    display: grid;
    grid-template-columns: 83px 1fr;
    column-gap: 7px;
    align-items: center;
  }
  .shift-cards span {
    grid-column: 2;
  }
  .arrival-board {
    margin-top: -4px;
  }
  .heading {
    align-items: flex-start;
  }
  .heading > a {
    font-size: 0.85rem;
  }
  .tram-pin {
    padding: 3px 7px;
  }
}

.map-layout {
  grid-template-areas: 'map board' 'shifts board';
  row-gap: 6px;
}
.map-controls {
  grid-area: map;
}
.map-layout .arrival-board {
  grid-area: board;
}
.map-layout .shift-cards {
  grid-area: shifts;
}
.rail-cat.koko {
  background-image: url(assets/koko-idle.webp);
}
@media (max-width: 850px) {
  .map-layout {
    grid-template-areas: 'map' 'board' 'shifts';
    row-gap: 10px;
  }
}
