:root {
  font-family: Inter, "Noto Sans", system-ui, sans-serif;
  color: #edf5fa;
  background: #050d16;
  --ink: #edf5fa;
  --muted: #9fb1bd;
  --panel: #0b1826e8;
  --line: #58718666;
  --cyan: #45d7d0;
  --amber: #f0bb4d;
  --coral: #ef6b62;
  --sky: #4da8e8;
  --violet: #9a7ae9;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
  background:
    radial-gradient(circle at 50% -10%, #193a4d 0, transparent 44rem),
    linear-gradient(145deg, #07111c, #030810);
}
button, select { font: inherit; }
button { cursor: pointer; }
.screen[hidden] { display: none !important; }
.game-page-info {
  width: min(100%, 920px) !important;
  max-width: 920px !important;
  margin-inline: auto;
}
.wp-shell-settings-row[hidden] { display: none !important; }
body:not([data-screen="main"]) > .game-page-info { display: none !important; }
.screen { width: min(100%, 920px); margin: auto; }
.main {
  min-height: 100svh;
  padding: max(14px, env(safe-area-inset-top)) clamp(16px, 3vw, 28px) 30px;
}
.main-header, .scene-header {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 112px;
  align-items: center;
  text-align: center;
}
.main-header { height: 58px; }
.return, .scene-header > button {
  justify-self: start;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid #6a8094;
  border-radius: 12px;
  background: #101e2c;
  color: #fff;
  text-decoration: none;
  font-size: 1.35rem;
}
.main-header > strong {
  font-size: .77rem;
  letter-spacing: .18em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.locale {
  justify-self: end;
  text-align: left;
  font-size: .66rem;
  font-weight: 800;
  display: grid;
  color: var(--muted);
}
.locale select {
  max-width: 112px;
  border: 1px solid #526879;
  border-radius: 8px;
  padding: 5px;
  background: #101e2c;
  color: #fff;
}
.hero {
  min-height: min(650px, calc(100svh - 86px));
  display: grid;
  grid-template-columns: minmax(300px, 490px) minmax(240px, 1fr);
  gap: clamp(25px, 5vw, 58px);
  align-items: center;
}
.hero > img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 28px;
  border: 1px solid #668095;
  box-shadow: 0 28px 70px #000b;
}
.eyebrow {
  margin: 0;
  color: var(--amber);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .15em;
}
.hero h1 {
  margin: .17em 0;
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  line-height: .94;
  letter-spacing: -.055em;
}
.hero p { color: #c9d5dc; line-height: 1.58; }
.primary {
  min-width: 180px;
  border: 1px solid #ffc85c;
  border-radius: 12px;
  padding: 14px 24px;
  background: linear-gradient(135deg, #e5a62e, #b86d16);
  color: #11161c;
  font-weight: 950;
  box-shadow: 0 10px 30px #e6a52f2d;
}
.guide {
  margin: 8px 0 30px;
  padding: 24px;
  border: 1px solid #52687a;
  border-radius: 20px;
  background: #0b1723;
}
.guide h2 { margin: 0 0 8px; }
.guide p, .guide li { color: #b9c8d1; line-height: 1.55; }
.guide ol { margin: 12px 0 0; padding-left: 1.35rem; display: grid; gap: 5px; }

.canvas {
  height: calc(100svh - 56px);
  min-height: 430px;
  overflow: hidden;
  background: #08131f;
}
.ad-reserve {
  width: min(100%, 920px);
  height: 56px;
  margin: auto;
  background: #030912;
}
.scene-header {
  height: 76px;
  padding: 10px 16px;
  background: #07131fee;
  border-bottom: 1px solid #60778c;
  color: #fff;
}
.scene-header h2 { margin: 2px 0 0; font-size: 1.13rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene-header > span { justify-self: end; font-size: .76rem; font-weight: 850; color: #d7e3e9; }

.stage {
  position: relative;
  display: grid;
  grid-template-rows: 76px minmax(0, 1fr) 56px;
  background: linear-gradient(#06101ac7, #06101ae8), var(--wp-stage-art) center / cover;
}
.stage-progress {
  position: absolute;
  z-index: 2;
  top: 84px;
  right: 12px;
  max-width: calc(100% - 24px);
  padding: 6px 10px;
  border: 1px solid #60778c;
  border-radius: 999px;
  background: #07131fee;
  color: #d7e3e9;
  font-size: .76rem;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}
.stage-grid {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-inline: calc(50% - 132px);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-y;
}
.stage-grid::-webkit-scrollbar { display: none; }
.stage-card {
  position: relative;
  top: -12%;
  width: 264px;
  min-width: 264px;
  height: 190px;
  scroll-snap-align: center;
  border: 1px solid #60778b;
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(160deg, #172839f2, #08131fed);
  color: #eef6fa;
  text-align: left;
  display: grid;
  align-content: end;
  gap: 8px;
  box-shadow: 0 16px 35px #0009;
}
.stage-card strong, .stage-card span { display: block; }
.stage-card strong { font-size: 1.25rem; }
.stage-card span { color: #a9bac5; font-size: .76rem; line-height: 1.4; }
.stage-card.selected, .stage-card.centered {
  border-color: #ffe09c;
  box-shadow: 0 0 0 3px #3ecdc7, 0 0 30px #3ecdc755;
}
.stage-card.locked {
  filter: none;
  color: #dce8ee;
  border-color: #52697a;
  background: linear-gradient(160deg, #152434f5, #091522f5);
}
.stage-card.locked span { color: #b9c8d1; }
.stage-tabs {
  height: 56px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-top: 1px solid #60778c;
  background: #07131ff2;
}
.stage-tab {
  grid-column: 2;
  width: 100%;
  height: 44px;
  border: 1px solid #ffe09c;
  border-radius: 11px;
  background: #12313d;
  color: #fff;
  font-size: .875rem;
  line-height: 1.2;
  font-weight: 800;
  box-shadow: 0 0 0 2px #3ecdc7, 0 0 20px #3ecdc755;
}

.main-header.wp-main-shell-header > .wp-shell-return {
  box-shadow: inset 0 -3px 0 #75431f !important;
}

.battle {
  display: grid;
  grid-template-rows: 76px minmax(0, 1fr);
  background:
    linear-gradient(#050b12ad, #050b12d4),
    url("../../assets/animal-bus-jam-terminal-general-v2.webp") center / cover;
}
.battle-content {
  min-height: 0;
  display: grid;
  grid-template-rows: 142px minmax(0, 1fr) 48px 28px;
  gap: 8px;
  padding: 10px 14px;
}
.convoy-panel, .holding-panel {
  min-width: 0;
  border: 1px solid #63778a;
  border-radius: 15px;
  background: #071421dc;
  backdrop-filter: blur(7px);
}
.convoy-panel { padding: 8px 10px 10px; }
.panel-label {
  min-height: 20px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #9eb0bc;
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .12em;
}
.buses {
  height: 100px;
  display: flex;
  gap: 8px;
  align-items: center;
  overflow: hidden;
}
.bus {
  --departing-bus-width: 156px;
  flex: 0 0 112px;
  height: 84px;
  position: relative;
  border: 1px solid color-mix(in srgb, var(--bus) 70%, white);
  border-radius: 12px;
  padding: 8px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--bus) 35%, #101d29), #07111b);
  color: #fff;
  opacity: .48;
  transform: scale(.92);
  transition:
    flex-basis 560ms cubic-bezier(.3, .72, .18, 1),
    opacity 220ms ease,
    transform 560ms cubic-bezier(.3, .72, .18, 1),
    box-shadow 220ms ease;
  will-change: flex-basis, transform, opacity;
  overflow: hidden;
}
.bus.active {
  flex-basis: 156px;
  opacity: 1;
  transform: none;
  box-shadow: 0 0 0 2px var(--bus), 0 0 24px color-mix(in srgb, var(--bus) 45%, transparent);
}
.bus.departing {
  flex-basis: var(--departing-bus-width);
  min-width: 0;
  opacity: 1;
  transform: none;
  pointer-events: none;
  animation: busDepartLeft 560ms cubic-bezier(.3, .72, .18, 1) forwards;
  animation-delay: calc(var(--departure-order, 0) * 90ms);
}
.bus-head { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.bus strong { font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bus-route { color: var(--bus); font-size: .6rem; font-weight: 950; }
.bus-shape {
  height: 27px;
  margin: 6px 0;
  border-radius: 8px 8px 5px 5px;
  background:
    linear-gradient(90deg, transparent 7%, #d9f7ffb8 8% 28%, transparent 29% 34%, #d9f7ffb8 35% 55%, transparent 56% 61%, #d9f7ffb8 62% 83%, transparent 84%),
    linear-gradient(var(--bus), color-mix(in srgb, var(--bus) 60%, #101820));
  box-shadow: inset 0 -4px #0005;
}
.seats { display: flex; gap: 4px; }
.seats i { width: 13px; height: 6px; border: 1px solid var(--bus); border-radius: 6px; }
.seats i.filled { background: var(--bus); box-shadow: 0 0 6px var(--bus); }

.dispatch-floor {
  min-height: 0;
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr);
  gap: 8px;
}
.holding-panel { width: min(100%, 610px); justify-self: center; padding: 7px 10px; }
.holding { display: flex; gap: 7px; min-height: 32px; align-items: center; }
.holding-slot {
  flex: 1;
  height: 30px;
  border: 1px dashed #647789;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #708392;
  font-size: .61rem;
}
.holding-slot.occupied {
  border-style: solid;
  border-color: var(--person);
  background: color-mix(in srgb, var(--person) 22%, #0a1520);
  color: #fff;
  box-shadow: inset 0 0 15px color-mix(in srgb, var(--person) 15%, transparent);
}
.queues {
  min-height: 0;
  width: min(100%, 760px);
  margin: auto;
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 8px;
}
.queue {
  min-width: 0;
  flex: 1;
  border: 1px solid #52677a;
  border-radius: 13px;
  background: #081522dc;
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
}
.queue-label {
  color: #8297a5;
  font-size: .6rem;
  font-weight: 900;
  letter-spacing: .1em;
}
.passenger {
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--person) 62%, #fff);
  border-radius: 8px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--person) 33%, #111d28), #0b1621);
  color: #eaf2f7;
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  text-align: left;
  font-size: .67rem;
  font-weight: 850;
}
.passenger:not(.front) { opacity: .55; pointer-events: none; }
.passenger.front {
  outline: 2px solid var(--person);
  box-shadow: 0 0 14px color-mix(in srgb, var(--person) 35%, transparent);
}
.passenger-token {
  width: 23px;
  height: 23px;
  border: 2px solid #fff9;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--person);
  color: #07111b;
  font-size: .62rem;
  font-weight: 1000;
}
.queue-empty { margin: auto; color: #677a88; }
.tools { display: flex; justify-content: center; gap: 8px; }
.tools button, dialog button {
  min-height: 42px;
  border: 1px solid #64798b;
  border-radius: 10px;
  background: #0d1c2b;
  color: #eaf3f8;
  padding: 8px 16px;
  font-weight: 850;
}
.tools button:disabled { opacity: .35; cursor: default; }
.status { margin: 0; text-align: center; color: #c9d6de; font-size: .78rem; font-weight: 800; }
.hint { animation: hintPulse .7s ease; }
.jam { animation: jamShake .35s ease; }
@keyframes hintPulse { 50% { filter: brightness(1.8); transform: translateY(-4px); } }
@keyframes jamShake { 25%, 75% { transform: translateX(6px); } 50% { transform: translateX(-6px); } }
@keyframes busDepartLeft {
  0% {
    flex-basis: var(--departing-bus-width);
    opacity: 1;
    transform: translateX(0);
  }
  55% {
    flex-basis: calc(var(--departing-bus-width) * .58);
    opacity: .58;
    transform: translateX(-92%) rotate(-1deg);
  }
  100% {
    flex-basis: 0;
    margin-right: -8px;
    padding-inline: 0;
    border-width: 0;
    opacity: 0;
    transform: translateX(-185%) rotate(-1deg);
  }
}

dialog {
  width: min(430px, calc(100% - 28px));
  border: 1px solid #6a7e90;
  border-radius: 20px;
  text-align: center;
  padding: 26px;
  color: #edf5fa;
  background: #091622;
  box-shadow: 0 28px 80px #000c;
}
dialog::backdrop { background: #02070dcc; backdrop-filter: blur(5px); }
.result-mark {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: auto auto 8px;
  background: #2a9d8f;
  color: #fff;
  font-size: 1.7rem;
  font-weight: 950;
}
.fail-mark { background: #b74f49; }
dialog h2 { margin: .2rem 0; }
dialog > p:not(.eyebrow) { color: #b6c5ce; line-height: 1.45; }
dialog > div:last-child { display: flex; justify-content: center; gap: 9px; margin-top: 18px; }
dialog > div.result-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.leave-actions {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.leave-actions button {
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
}
dialog .result-actions button {
  min-width: 0;
  padding-inline: 8px;
}
dialog button:disabled { opacity: .42; cursor: not-allowed; }

@media (max-width: 680px) {
  .main-header { grid-template-columns: 70px minmax(0, 1fr) 100px; }
  .hero { min-height: auto; grid-template-columns: 1fr; text-align: center; gap: 17px; padding: 12px 0 22px; }
  .hero > img { width: min(76vw, 330px); justify-self: center; }
  .hero h1 { font-size: clamp(2.45rem, 13vw, 4rem); }
  .guide { margin-top: 0; }
  .scene-header { grid-template-columns: 60px minmax(0, 1fr) 76px; padding-inline: 8px; }
  .scene-header h2 { margin: 0; font-size: 1rem; }
  .scene-header > span { font-size: .66rem; }
  .battle-content { padding-inline: 8px; }
  .battle-content { grid-template-rows: 142px minmax(0, 1fr) 44px 42px; }
  .bus { flex-basis: 92px; }
  .bus.active { flex-basis: 132px; }
  .bus.departing { --departing-bus-width: 132px; }
  .queues { gap: 5px; }
  .queue { padding: 5px; }
  .passenger { grid-template-columns: 20px minmax(0, 1fr); padding: 2px 4px; }
  .passenger-token { width: 19px; height: 19px; font-size: .53rem; }
  .status { align-self: center; font-size: .7rem; line-height: 1.25; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .stage-card { top: -3%; }

  .wp-standard-main-composition {
    grid-template-columns: 300px minmax(0, 1fr) !important;
    gap: 16px !important;
    padding: 4px 14px !important;
  }
  .wp-standard-main-poster {
    width: 300px !important;
    height: 300px !important;
  }
  #main .wp-standard-main-poster-media,
  #main .wp-standard-main-poster-media > img,
  #main .wp-standard-main-poster > img {
    width: 300px !important;
    min-width: 300px !important;
    max-width: 300px !important;
    height: 300px !important;
    min-height: 300px !important;
    max-height: 300px !important;
  }
  .wp-standard-main-copy { height: 300px !important; gap: 8px !important; }
  .canvas { min-height: 0; }
  .scene-header { height: 60px; padding: 6px 12px; }
  .stage { grid-template-rows: 60px minmax(0, 1fr) 56px; }
  .battle { grid-template-rows: 60px minmax(0, 1fr); }
  .battle-content { position: relative; grid-template-rows: 76px minmax(0, 1fr) 34px 18px; gap: 3px; padding: 4px 10px 22px; }
  .convoy-panel { padding: 4px 8px; }
  .panel-label { min-height: 14px; font-size: .52rem; }
  .buses { height: 57px; }
  .bus { height: 50px; flex-basis: 92px; padding: 3px 6px; }
  .bus.active { flex-basis: 118px; }
  .bus.departing { --departing-bus-width: 118px; }
  .bus-shape { height: 16px; margin: 3px 0; }
  .bus strong { font-size: .6rem; }
  .dispatch-floor { grid-template-columns: 116px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 5px; }
  .holding-panel { width: auto; height: 100%; padding: 4px 6px; }
  .holding-panel .panel-label { display: grid; text-align: center; }
  .holding { min-height: 0; height: calc(100% - 24px); flex-direction: column; gap: 4px; }
  .holding-slot { width: 100%; height: auto; min-height: 20px; }
  .queue { padding: 3px; gap: 2px; }
  .queue-label { font-size: .48rem; }
  .passenger { min-height: 23px; grid-template-columns: 16px minmax(0, 1fr); font-size: .55rem; padding: 1px 3px; }
  .passenger-token { width: 15px; height: 15px; font-size: .43rem; border-width: 1px; }
  .tools button { min-height: 32px; padding: 3px 12px; }
  .status { position: absolute; left: 10px; right: 10px; bottom: 5px; font-size: .56rem; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  dialog[open] { top: calc((100svh - 56px) / 2); bottom: auto; margin: 0 auto; transform: translateY(-50%); max-height: calc(100svh - 72px); padding: 12px 20px; overflow: auto; }
  .result-mark { width: 42px; height: 42px; font-size: 1.2rem; }
  dialog h2 { font-size: 1.15rem; }
  dialog > div:last-child { margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .bus.departing { animation-duration: 80ms; animation-delay: 0ms; }
}
