html {
  color-scheme: light;
}

body.replay-index {
  margin: 0;
  background: #f5f1e6;
  color: #1e2b24;
  font-family: Arial, Helvetica, sans-serif;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 156px;
  height: auto;
  image-rendering: auto;
}

.home-button {
  border: 1px solid #173f86;
  border-radius: 4px;
  padding: 8px 12px;
  background: #245bb0;
  color: #fff;
  font-weight: bold;
  text-decoration: none;
  white-space: nowrap;
}

.home-button:hover,
.home-button:focus-visible {
  background: #173f86;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 20px;
}

.pill {
  border: 1px solid #9d8d55;
  background: #fff9df;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
}

.panel {
  border: 1px solid #b8ad82;
  background: #fffdf2;
  border-radius: 6px;
  padding: 14px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.section-title {
  margin-top: 18px !important;
}

.quick-links {
  display: grid;
  gap: 8px;
}

a {
  color: #123d89;
}

.quick-links a,
.route-row a {
  display: block;
  text-decoration: none;
}

.quick-links a {
  border: 1px solid #c9bd8f;
  background: #ffffff;
  border-radius: 4px;
  padding: 8px 10px;
  font-weight: bold;
}

.group-list {
  display: grid;
  gap: 6px;
}

.group-list button {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid #c9bd8f;
  background: #ffffff;
  border-radius: 4px;
  padding: 7px 9px;
  color: #123d89;
  font: inherit;
  font-weight: bold;
  text-align: left;
  cursor: pointer;
}

.group-list button:hover {
  background: #fff9df;
}

.group-list b {
  color: #5c553f;
  font-size: 12px;
}

.filter {
  display: flex;
  gap: 8px;
}

.filter-controls {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.sort-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sort-wrap label {
  color: #5c553f;
  font-size: 13px;
  font-weight: bold;
}

.sort-wrap select {
  border: 1px solid #a99f79;
  border-radius: 4px;
  padding: 7px 9px;
  background: #fff;
  color: #1e2b24;
  font: inherit;
}

.filter input {
  flex: 1;
  min-width: 0;
  border: 1px solid #a99f79;
  border-radius: 4px;
  padding: 8px 10px;
  font: inherit;
}

.route-list {
  max-height: 65vh;
  overflow: auto;
  border: 1px solid #d6cca4;
  background: #fff;
}

.teaser-list-wrap {
  max-height: none;
  overflow: visible;
  border: 0;
  background: transparent;
}

.teaser-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.teaser-card {
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 8px;
  border: 1px solid #c9bd8f;
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}

.teaser-thumb {
  display: block;
  border: 1px solid #c9bd8f;
  background: #f7f2da;
}

.teaser-thumb img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: cover;
}

.teaser-card h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.teaser-card p {
  margin: 0;
  color: #5c553f;
  font-size: 12px;
}

.teaser-open {
  font-size: 13px;
  font-weight: bold;
  text-decoration: none;
}

.teaser-loader,
.teaser-empty {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #c9bd8f;
  border-radius: 4px;
  background: #fff9df;
  color: #5c553f;
  font-size: 13px;
}

.teaser-sentinel {
  width: 100%;
  height: 1px;
}

.route-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #eee7cc;
  font-size: 14px;
}

.route-row:last-child {
  border-bottom: 0;
}

.route-path {
  overflow-wrap: anywhere;
}

.route-meta {
  color: #6b644f;
  white-space: nowrap;
  font-size: 12px;
}

.note {
  color: #5c553f;
  font-size: 13px;
  line-height: 1.4;
}

.yard-sale-scene {
  max-width: 650px;
  margin: 0 auto 16px;
  overflow: hidden;
  border: 1px solid #456a3e;
  background: #9ccf75;
}

.yard-sale-scene img {
  display: block;
  width: 100%;
  height: auto;
}

.yard-sale-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  border-bottom: 3px solid #47733e;
}

.yard-sale-heading h2 {
  margin-bottom: 4px;
}

.yard-sale-heading p {
  margin-top: 0;
}

.app-action {
  flex: none;
  border: 1px solid #31517f;
  border-radius: 4px;
  background: #e9f2ff;
  padding: 8px 10px;
  text-decoration: none;
  font-weight: bold;
}

.yard-sale-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

@media (max-width: 620px) {
  .yard-sale-heading {
    align-items: flex-start;
    flex-direction: column;
    padding-bottom: 10px;
  }
}

.session-links {
  font-size: 14px;
  font-weight: bold;
}

.account-form {
  display: grid;
  gap: 12px;
  width: min(420px, 100%);
  margin-top: 18px;
}

.account-form label {
  display: grid;
  gap: 5px;
  color: #3f3a2c;
  font-size: 13px;
  font-weight: bold;
}

.account-form input {
  min-width: 0;
  border: 1px solid #a99f79;
  border-radius: 4px;
  padding: 9px 10px;
  background: #fff;
  color: #1e2b24;
  font: inherit;
}

.account-form button {
  width: fit-content;
  border: 1px solid #173f86;
  border-radius: 4px;
  padding: 9px 18px;
  background: #245bb0;
  color: #fff;
  font: inherit;
  font-weight: bold;
  cursor: pointer;
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 24px;
  margin-top: 18px;
}

.account-stats {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 14px;
  margin: 14px 0;
}

.account-stats dt {
  color: #5c553f;
  font-weight: bold;
}

.account-stats dd {
  margin: 0;
}

.message,
.error-message {
  border: 1px solid;
  border-radius: 4px;
  padding: 9px 10px;
}

.message {
  border-color: #5b8a45;
  background: #eff9ea;
  color: #27551c;
}

.error-message {
  border-color: #b1534c;
  background: #fff0ee;
  color: #7c211b;
}

.home-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 18px 0;
}

.home-banner h2,
.home-banner p {
  margin: 0 0 4px;
}

.home-avatar {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 3px solid #1a3977;
  border-radius: 50%;
  background: #f3cc43;
  color: #1a3977;
  font-size: 32px;
  font-weight: bold;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.inventory-item {
  border: 1px solid #c9bd8f;
  border-radius: 4px;
  padding: 12px;
  background: #fff;
  text-align: center;
}

.inventory-item object {
  display: block;
  width: 100px;
  height: 100px;
  margin: 0 auto 8px;
}

.item-preview {
  display: grid;
  align-content: center;
  justify-items: center;
  margin: 0 auto 8px;
  border: 1px solid #9a8b52;
  background: #f3cc43;
  color: #173f86;
}

.item-preview span {
  font-size: 42px;
  font-weight: bold;
}

.item-preview small {
  font-size: 11px;
  font-weight: bold;
}

.inventory-item h2 {
  margin: 4px 0;
  font-size: 16px;
}

.inventory-item p {
  min-height: 36px;
  margin: 4px 0 10px;
  color: #5c553f;
  font-size: 12px;
}

.purchase-result {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 18px 0;
}

.purchase-result h2 {
  margin-top: 0;
}

.bank-actions {
  display: flex;
  gap: 8px;
}

.bank-balances dd {
  font-weight: bold;
}

.saved-list {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.saved-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #ddd4b3;
  padding: 8px 0;
}

.saved-list form {
  margin: 0;
}

.saved-list button {
  border: 1px solid #9d3c37;
  border-radius: 4px;
  padding: 5px 9px;
  background: #fff0ee;
  color: #7c211b;
  cursor: pointer;
}

.map-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0;
}

.map-tabs a {
  border: 1px solid #8e835e;
  border-radius: 4px;
  padding: 7px 11px;
  background: #fff;
  color: #173f86;
  font-weight: bold;
  text-decoration: none;
}

.map-tabs a.active {
  border-color: #173f86;
  background: #245bb0;
  color: #fff;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 600px) minmax(190px, 1fr);
  align-items: start;
  gap: 18px;
}

.map-stage {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid #8e835e;
  background: #b9d9ef;
}

.map-stage object,
.map-stage ruffle-player {
  display: block;
  width: 100%;
  max-width: 600px;
  height: auto;
  aspect-ratio: 1 / 1;
}

.map-canvas {
  position: relative;
  width: 100%;
  min-height: 500px;
  overflow: hidden;
  background: #83b868;
}

.map-road {
  position: absolute;
  z-index: 0;
  background: #e5d2a3;
  border: 2px solid #b79d67;
}

.road-horizontal {
  top: 42%;
  right: -4%;
  left: -4%;
  height: 58px;
  transform: rotate(-7deg);
}

.road-vertical {
  top: -5%;
  bottom: -5%;
  left: 48%;
  width: 56px;
  transform: rotate(11deg);
}

.map-marker {
  position: absolute;
  z-index: 1;
  width: 128px;
  border: 2px solid #6d4f20;
  border-radius: 4px;
  padding: 9px 8px;
  background: #fff9dc;
  color: #173f86;
  font-size: 13px;
  font-weight: bold;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 2px 4px rgb(41 55 31 / 25%);
}

.map-marker:hover,
.map-marker:focus-visible {
  background: #f3cc43;
}

.marker-1 { top: 8%; left: 7%; }
.marker-2 { top: 10%; right: 8%; }
.marker-3 { top: 36%; left: 8%; }
.marker-4 { top: 38%; right: 7%; }
.marker-5 { bottom: 17%; left: 15%; }
.marker-6 { right: 14%; bottom: 16%; }
.marker-7 { top: 23%; left: 39%; }
.marker-8 { bottom: 4%; left: 40%; }
.marker-9 { top: 61%; right: 4%; }

.load-map-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  border: 1px solid #173f86;
  border-radius: 4px;
  padding: 8px 11px;
  background: #245bb0;
  color: #fff;
  font: inherit;
  font-weight: bold;
  cursor: pointer;
}

.map-destinations h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.map-destinations > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
}

.map-destinations a {
  border: 1px solid #c9bd8f;
  border-radius: 4px;
  padding: 8px 10px;
  background: #fff;
  color: #173f86;
  text-decoration: none;
}

.map-destinations a:hover {
  background: #fff7d6;
  text-decoration: underline;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.game-card {
  display: flex;
  min-height: 122px;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  color: #17345f;
  text-decoration: none;
  background: linear-gradient(180deg, #fffef4 0%, #f3e5ad 100%);
  border: 2px solid #c79636;
  border-radius: 12px;
  box-shadow: 0 3px 8px rgb(77 51 13 / 18%);
}

.game-card:hover,
.game-card:focus-visible {
  color: #0b2447;
  border-color: #855b17;
  transform: translateY(-2px);
}

.game-card strong {
  font-size: 1.08rem;
}

.game-card span {
  color: #72521e;
  font-size: 0.88rem;
}

@media (max-width: 760px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-button {
    width: 100%;
    text-align: center;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }

  .purchase-result {
    align-items: flex-start;
    flex-direction: column;
  }

  .map-layout {
    grid-template-columns: 1fr;
  }

  .map-canvas {
    min-height: 430px;
  }

  .map-marker {
    width: 110px;
    padding: 7px 5px;
    font-size: 12px;
  }
}
