:root {
  color-scheme: dark;
  --bg: #101522;
  --panel: #192232;
  --line: #364353;
  --text: #f8f4ea;
  --muted: #b8c3d1;
  --amber: #ffbf5c;
  --cyan: #67ebd1;
  font-family: "Noto Sans TC","Noto Sans CJK TC",system-ui,sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(ellipse at 52% 0,#1e293c 0,#101522 58%);
  color: var(--text);
  min-height: 100vh;
}

[hidden] {
  display: none!important;
}

button,input,a {
  font: inherit;
}

button,a {
  touch-action: manipulation;
}

a {
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: .58;
  cursor: wait;
}

button:focus-visible,a:focus-visible,input:focus-visible,summary:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.shell {
  max-width: 1200px;
  margin: auto;
  padding: 0 26px;
}

.top {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #ffffff17;
  margin-bottom: 22px;
}

.wordmark,.tools,.input-row,.hud,.hud-right,.controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.wordmark b {
  background: #d99736;
  color: #172133;
  border-radius: 10px;
  padding: 5px 8px;
  font-size: 21px;
}

.wordmark span {
  font-weight: 850;
  letter-spacing: .08em;
}

.wordmark small {
  margin-left: 9px;
  font-weight: 600;
  color: #bfccd9;
  letter-spacing: .04em;
}

.subtle,.primary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 41px;
  border-radius: 8px;
  padding: 7px 13px;
  text-decoration: none;
  font-weight: 750;
  line-height: 1.35;
}

.subtle {
  background: #ffffff0b;
  border: 1px solid #93a8bd48;
  color: #e0e8f0;
}

.subtle:hover {
  background: #ffffff1c;
}

.primary {
  color: #202132;
  background: #ffbd5b;
  border: 1px solid #ffd387;
  box-shadow: 0 3px 0 #925c1f;
}

.primary:hover {
  background: #ffcf84;
}

.hero {
  min-height: 535px;
  border: 1px solid #7b684e;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  background: #121b28 linear-gradient(145deg,#080e19,#334456);
  isolation: isolate;
  display: flex;
  align-items: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,#0c1321 0%,#0b1321ef 25%,#0b13216b 57%,#0b13210a 100%),url(hero.webp) 58% 49%/cover no-repeat;
  z-index: -1;
}

.hero-content {
  padding: 44px 54px;
  max-width: 570px;
}

.hero h1 {
  font-size: clamp(47px,7vw,88px);
  letter-spacing: .035em;
  line-height: 1.035;
  margin: 17px 0 21px;
  text-shadow: 0 4px 28px #000;
  max-width: 6.4em;
  font-weight: 900;
}

.hero-eyebrow,.station-id {
  font-size: .79rem;
  font-weight: 820;
  letter-spacing: .16em;
  color: #ffd287;
}

.hero-eyebrow::before {
  display: inline-block;
  content: "";
  width: 24px;
  border-top: 2px solid var(--amber);
  margin: 0 9px 4px 0;
}

.hero p {
  color: #e0e7ed;
  line-height: 1.65;
  font-size: 1.05rem;
  max-width: 350px;
  margin: 0 0 24px;
}

.hero label {
  display: block;
  font-size: .78rem;
  color: #e4eaf1;
  margin-bottom: 6px;
}

.hero input {
  background: #101725cc;
  border: 1px solid #6b7c90;
  border-radius: 8px;
  padding: 9px 10px;
  min-height: 43px;
  width: min(178px,45%);
  color: #fff;
}

.home-bottom {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 10px;
  margin: 14px 0;
}

.zone,details {
  border: 1px solid #344252;
  background: #172130;
  border-radius: 11px;
  padding: 12px 15px;
}

.zone {
  border-top: 3px solid var(--zone);
}

.zone strong {
  display: block;
  font-size: .92rem;
}

.zone span,.zone small {
  color: #b1bdce;
  font-size: .74rem;
}

.zone small {
  display: block;
  margin-top: 6px;
}

details {
  margin-top: 14px;
  color: #e1eaf2;
}

summary {
  cursor: pointer;
}

.rank-list {
  display: grid;
  gap: 8px;
  padding-left: 26px;
}

.rank-list li {
  padding: 3px;
}

footer {
  padding: 22px 0;
  text-align: center;
  color: #acb7c9;
  font-size: .78rem;
}

footer a {
  text-underline-offset: 3px;
}

footer span {
  margin: 0 8px;
}

#game,.finish,.error {
  max-width: 920px;
  margin: 0 auto;
}

.hud {
  justify-content: space-between;
  font-weight: 750;
  padding: 0 2px 10px;
}

.hud-right {
  color: #d5e5ed;
  font-variant-numeric: tabular-nums;
}

.hud-right span+span::before {
  content: "·";
  margin-right: 10px;
  color: #96aabf;
}

.hud-right span:empty {
  display: none;
}

.map {
  display: grid;
  grid-template-columns: repeat(12,1fr);
  gap: 5px;
  margin: 0 0 11px;
}

.map-item {
  display: grid;
  place-items: center;
  min-height: 28px;
  border-radius: 5px;
  border: 1px solid #324156;
  background: #182333;
  color: #a7b7ca;
  font-size: .7rem;
  font-weight: 800;
}

.map-item.active {
  color: #171c29;
  background: var(--amber);
  border-color: #ffe3a2;
}

.map-item.built {
  color: #102b2b;
  background: #80dfc8;
  border-color: #a0ffed;
}

.map-item.built::after {
  content: " ✓";
  white-space: pre;
  display: inline;
}

.map-item {
  display: flex;
  justify-content: center;
}

.game-card,.finish {
  background: #182232;
  border: 1px solid #465567;
  border-radius: 14px;
  overflow: hidden;
}

.brief,.interaction,.finish {
  padding: 15px 20px;
}

.brief h1,.finish h1 {
  margin: 4px 0 6px;
  font-size: clamp(1.3rem,4vw,1.95rem);
}

.brief p {
  margin: 0;
  line-height: 1.55;
}

.brief p::after {
  content: none;
}

table {
  margin-top: 7px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

td,th {
  min-width: 55px;
  padding: 3px 8px;
  border: 1px solid #536279;
  text-align: center;
  font-size: .82rem;
}

th {
  background: #26384a;
  color: #dbedf2;
}

.stage {
  --highlight: #ffbb62;
  position: relative;
  min-height: 230px;
  isolation: isolate;
  overflow: hidden;
  border-block: 1px solid #56617565;
  background: radial-gradient(ellipse at 29% 25%,#74603b66,transparent 45%),linear-gradient(#101b2ac9,#141d2cec),url(hero.webp) 88% 45%/cover;
}

.stage[data-zone="1"] {
  --highlight: #80ecd1;
}

.stage[data-zone="2"] {
  --highlight: #9ad7ff;
}

.stage[data-zone="3"] {
  --highlight: #ffa479;
}

.stage::after {
  position: absolute;
  content: "";
  inset: auto 0 0;
  height: 39px;
  z-index: -1;
  background: repeating-linear-gradient(112deg,#e59a4450 0 9px,#211f281a 9px 18px) top/100% 6px no-repeat,linear-gradient(#354352,#1b2634);
}

.machine {
  position: absolute;
  left: 21px;
  top: 48px;
  bottom: 23px;
  width: 100px;
  display: grid;
  align-items: end;
  justify-items: center;
  pointer-events: none;
}

.device {
  position: relative;
  width: 80px;
  height: 87px;
  background: linear-gradient(135deg,#556b79,#263748 54%,#172434);
  border: 2px solid #9e8a6d;
  border-radius: 13px 13px 5px 5px;
  box-shadow: -6px 5px 0 #131a26,0 9px 9px #0008;
  transform-origin: 50% 90%;
}

.device::before {
  content: "";
  position: absolute;
  inset: 10px 11px 36px;
  border-radius: 5px;
  background: radial-gradient(circle at 30% 55%,var(--highlight) 0 3px,transparent 4px),radial-gradient(circle at 70% 55%,var(--cyan) 0 3px,transparent 4px),linear-gradient(#121f2e,#283e48);
  border: 1px solid #607d8b;
}

.device::after {
  content: "";
  position: absolute;
  inset: auto 10px 11px;
  height: 10px;
  background: repeating-linear-gradient(90deg,#111e2d 0 4px,#5a6266 4px 7px);
  border-radius: 2px;
}

.machine .part,.machine .part2 {
  position: absolute;
  z-index: 1;
  background: linear-gradient(140deg,#e9bb72,#815730);
  border: 2px solid #ebc185;
  box-shadow: 0 3px 7px #0008;
}

.part {
  width: 85px;
  height: 13px;
  bottom: 16px;
  border-radius: 4px;
}

.part2 {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  bottom: 4px;
  right: 12px;
  display: none;
}

[data-level="2"] .part {
  width: 10px;
  height: 60px;
  bottom: 25px;
  border-radius: 4px;
  transform-origin: 50% 90%;
}

[data-level="3"] .part,[data-level="3"] .part2 {
  display: block;
  width: 41px;
  height: 12px;
  bottom: 16px;
  border-radius: 2px;
  left: 0;
  transform: translateX(-7px) rotate(-24deg);
  transform-origin: left;
}

[data-level="3"] .part2 {
  right: 0;
  left: auto;
  transform: translateX(7px) rotate(24deg);
  transform-origin: right;
}

[data-level="4"] .part {
  bottom: 7px;
  width: 60px;
  height: 19px;
  background: repeating-linear-gradient(120deg,#d99a40 0 8px,#453525 8px 16px);
}

[data-level="5"] .part {
  bottom: 35px;
  width: 64px;
  height: 37px;
  background: #29646690;
  border-color: #87c6c3;
}

[data-level="6"] .part {
  bottom: 42px;
  width: 38px;
  height: 22px;
  transform: translateY(-47px);
  background: #cde5de;
  border-color: #77b9ba;
}

[data-level="7"] .part,[data-level="8"] .part,[data-level="11"] .part {
  bottom: 13px;
  width: 34px;
  height: 34px;
  border: 5px dashed #a78157;
  background: #243747;
  border-radius: 50%;
}

[data-level="8"] .part2,[data-level="11"] .part2 {
  display: block;
  bottom: 25px;
  right: -5px;
  width: 25px;
  height: 16px;
  border-radius: 3px;
  background: #4c9997;
}

[data-level="9"] .part {
  width: 9px;
  height: 48px;
  border-radius: 1px 1px 6px 6px;
  bottom: 29px;
  transform: translateY(-24px);
}

[data-level="10"] .part {
  width: 59px;
  height: 22px;
  background: repeating-linear-gradient(90deg,#214055 0 5px,#54869a 6px 8px);
  bottom: 20px;
  border-color: #5c8ca5;
}

[data-level="12"] .part {
  bottom: 8px;
  width: 62px;
  height: 49px;
  background: repeating-linear-gradient(#465a62 0 8px,#30414b 8px 10px);
  border-color: #8499a2;
}

.stage.built .device {
  box-shadow: -6px 5px 0 #131a26,0 0 18px color-mix(in srgb,var(--highlight),transparent 45%);
}

.built[data-level="1"] .part {
  transform: translateY(-27px);
}

.built[data-level="2"] .part {
  transform: rotate(76deg);
}

.built[data-level="3"] .part,.built[data-level="3"] .part2 {
  transform: none;
}

.built[data-level="4"] .part {
  transform: translateY(-43px);
}

.built[data-level="5"] .part {
  transform: translateY(-25px);
  border-color: #84f3cc;
}

.built[data-level="6"] .part,.built[data-level="9"] .part {
  transform: none;
}

.built[data-level="7"] .part,.built[data-level="8"] .part {
  transform: rotate(280deg);
  border-color: var(--highlight);
}

.built[data-level="8"] .part2 {
  transform: translateX(15px) scaleX(1.5);
}

.built[data-level="10"] .part {
  background: repeating-linear-gradient(90deg,#214055 0 5px,#80f3d1 6px 8px);
}

.built[data-level="11"] .part {
  transform: rotate(-90deg) translateX(9px);
}

.built[data-level="11"] .part2 {
  transform: translateX(-16px);
}

.built[data-level="12"] .part {
  transform: translateY(-45px);
  border-color: #7be1cd;
}

.part,.part2,.device {
  transition: transform 1.13s cubic-bezier(.22,.8,.28,1),border-color .85s,background .85s,box-shadow .85s;
}

.visual {
  padding: 14px 15px 26px 131px;
  min-height: 230px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.scene-caption {
  font-size: .77rem;
  font-weight: 750;
  color: #dce8ef;
  margin: 0;
  text-shadow: 0 2px 5px #000;
}

.scene-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: stretch;
}

.pallet {
  display: grid;
  align-content: center;
  min-height: 43px;
  min-width: 55px;
  padding: 5px 7px;
  color: #f5f0de;
  background: #18232c;
  border: 1px solid #a47640;
  border-bottom: 4px solid #94622e;
  border-radius: 5px;
  font-size: .72rem;
  font-weight: 750;
  text-align: center;
}

.pallet.output {
  border-color: #4d938e;
  border-bottom-color: #5abbac;
  background: #12343a;
}

.pallet.ghost {
  border-style: dashed;
  background: #182431;
  color: #d1d9e2;
  min-width: 70px;
}

.pallet.ghost strong {
  font-size: 1.35rem;
}

.pallet b {
  font-size: .92rem;
  font-variant-numeric: tabular-nums;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 3px;
  flex-wrap: wrap;
  margin-bottom: 2px;
  max-width: 65px;
}

.dots i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: #f6ae61;
}

.output .dots i {
  background: #79e7cf;
}

.slot-dot i {
  background: #475666;
  border: 1px solid #9aadb8;
}

.motion .pallet,.motion .graph,.motion .measure .material,.motion .wires,.motion .lane-fill,.motion .stage-log {
  animation: arrive .64s cubic-bezier(.16,.75,.21,1) both;
  animation-delay: var(--delay,0s);
}

.split .pallet:first-child {
  --shift: 30px;
}

.split .pallet:last-child {
  --shift: -24px;
}

@keyframes arrive {
  from {
    opacity: .14;
    transform: translateX(var(--shift,-23px));
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.stage-log {
  background: #122237;
  margin: 0;
}

.stage-log th {
  color: #fff;
}

.measure {
  height: 61px;
  position: relative;
  max-width: 540px;
  margin-bottom: 8px;
}

.material {
  height: 14px;
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 4px;
  background: repeating-linear-gradient(130deg,#e0bb76 0 8px,#bb8d47 8px 15px);
  width: var(--portion);
  transform-origin: left;
}

.measure .rule {
  position: absolute;
  inset: 23px 0 auto;
  height: 28px;
  background: repeating-linear-gradient(90deg,#b3bfc8 0 1px,transparent 1px var(--interval)) top/100% 8px no-repeat;
  border-top: 2px solid #d5dee4;
}

.rule span {
  font-size: .65rem;
  position: absolute;
  top: 10px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.measure .needle {
  position: absolute;
  top: 0;
  height: 43px;
  width: 2px;
  background: var(--cyan);
  left: var(--portion);
  box-shadow: 0 0 7px #8eefd9;
}

.graph {
  width: min(100%,550px);
  height: 175px;
  background: #111d2be8;
  border: 1px solid #5a7886;
  border-radius: 8px;
}

.motion .graph {
  --shift: 0px;
}

.wires {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.wires i {
  height: 3px;
  width: 30px;
  background: #81b5ae;
  flex: 0 1 30px;
}

.wires .pallet {
  min-width: 47px;
}

.lanes {
  display: grid;
  gap: 7px;
}

.lane {
  display: grid;
  grid-template-columns: 25px 1fr;
  gap: 7px;
  align-items: center;
}

.lane b {
  color: #ffcf96;
}

.lane:nth-child(2) b {
  color: #72e9d5;
}

.lane-inner {
  position: relative;
  min-height: 27px;
  background: #111c29;
  border: 1px solid #637587;
  border-radius: 5px;
  padding: 3px 7px;
  overflow: hidden;
}

.lane-inner em {
  position: relative;
  font-size: .72rem;
  font-style: normal;
  color: #fff;
}

.lane-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--portion);
  background: #73492b;
}

.lane:nth-child(2) .lane-fill {
  background: #205a58;
}

.ship-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.ship-row span {
  width: 17px;
  height: 9px;
  border: 1px solid #4d9d8e;
  background: #224f4c;
  border-radius: 2px;
}

.ship-row.flow span {
  background: #86ebcb;
  animation: flow .48s both;
  animation-delay: var(--delay);
}

@keyframes flow {
  from {
    transform: translateX(-12px);
    opacity: .18;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.interaction {
  min-height: 125px;
}

.interaction form {
  display: grid;
  gap: 10px;
}

.interaction form>.primary {
  justify-self: start;
}

fieldset {
  padding: 0;
  border: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 39px;
  background: #233145;
  border: 1px solid #485c72;
  border-radius: 7px;
  padding: 5px 9px;
  cursor: pointer;
  color: #eef5fa;
}

.choice:has(input:checked) {
  border-color: #ffd184;
  background: #574127;
}

.choice input {
  accent-color: #ffb853;
}

.letter {
  font-size: .72rem;
  color: #c2d1df;
}

.controls {
  flex-wrap: wrap;
}

.controls button {
  margin: 3px 0;
}

#feedback {
  line-height: 1.5;
  margin-bottom: 7px;
}

#feedback:empty {
  display: none;
}

.notice {
  font-weight: 750;
  color: var(--cyan);
  margin: 0 0 3px;
}

.notice.wrong {
  color: #ffd0a7;
}

.reason {
  margin: 2px 0 9px;
  color: #e5edf3;
}

.finish p {
  color: #cbd7e5;
}

.finish h1 {
  color: #ffd78d;
}

.finish #again {
  margin-top: 10px;
}

.error {
  background: #522932;
  color: #ffe4d8;
  border: 1px solid #bc707a;
  border-radius: 8px;
  padding: 10px 13px;
  margin-top: 10px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  white-space: nowrap;
  overflow: hidden;
}

@media(max-width:700px) {
  .shell {
    padding: 0 13px;
  }
  .top {
    height: 56px;
    margin-bottom: 12px;
  }
  .hero {
    min-height: 530px;
    align-items: end;
  }
  .hero::before {
    background: linear-gradient(0deg,#0c1321 4%,#0c1321f7 36%,#0c132143 66%,#0c132114 100%),url(hero.webp) 68% top/auto 75% no-repeat;
  }
  .hero-content {
    padding: 21px 24px 29px;
  }
  .hero h1 {
    margin: 10px 0 13px;
    font-size: clamp(43px,9vw,65px);
  }
  .hero p {
    margin-bottom: 15px;
  }
  .home-bottom {
    grid-template-columns: repeat(2,1fr);
  }
  .brief,.interaction,.finish {
    padding: 12px;
  }
  .machine {
    left: 8px;
    width: 65px;
  }
  .device {
    width: 59px;
    height: 76px;
  }
  .machine .part {
    max-width: 68px;
  }
  .visual {
    padding-left: 82px;
    padding-right: 12px;
  }
  .map {
    gap: 3px;
  }
  .hud {
    font-size: .84rem;
  }
  .map-item {
    font-size: .62rem;
  }
  .map-item.built::after {
    content: none;
  }
}

@media(max-width:480px) {
  fieldset {
    grid-template-columns: 1fr;
  }
  .wordmark small {
    font-size: .65rem;
    margin-left: 4px;
  }
  .tools {
    gap: 5px;
  }
  .tools .subtle {
    padding: 6px 8px;
    font-size: .78rem;
  }
  .hero {
    min-height: 475px;
  }
  .measure .rule span:nth-child(2n) {
    display: none;
  }
  .graph {
    height: 150px;
  }
}

@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after {
    animation-duration: .01ms!important;
    animation-delay: 0ms!important;
    transition-duration: .01ms!important;
  }
}

.stage.skip-motion .part,.stage.skip-motion .part2,.stage.skip-motion .device {
  transition: none;
}

.stage.skip-motion .ship-row span {
  animation: none;
}

.hero h1 {
  font-size: clamp(41px,6vw,72px);
  max-width: none;
  white-space: nowrap;
  letter-spacing: .025em;
}

html[lang="en"] .hero h1 {
  white-space: normal;
  max-width: 8.5em;
  text-wrap: balance;
}

.built[data-level="3"] .part {
  transform: translateX(10px);
}

.built[data-level="3"] .part2 {
  transform: translateX(-10px);
}

.built[data-level="4"] .part {
  transform: translateY(-43px);
}

.motion .pallet {
  --shift: -48px;
}

.motion .split .pallet:nth-child(n+2) {
  --shift: 32px;
}

.motion .measure .material {
  animation-name: unroll;
  --start: .03;
}

.motion .measure .needle {
  animation: measure-needle .64s cubic-bezier(.16,.75,.21,1) both;
}

@keyframes unroll {
  from {
    transform: scaleX(var(--start,.03));
    opacity: .7;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

@keyframes measure-needle {
  from {
    left: var(--from,0%);
  }
  to {
    left: var(--portion);
  }
}

.ship-row.flow .dispatch-crate {
  width: 29px;
  height: 18px;
  margin-left: 8px;
  border-color: #ffd693;
  background: linear-gradient(135deg,#f1bb70,#a87140);
  box-shadow: 0 1px 5px #0008;
  animation: dispatch .9s .23s both;
}

@keyframes dispatch {
  from {
    transform: translateX(-101px);
    opacity: .15;
  }
  to {
    transform: translateX(25px);
    opacity: 1;
  }
}

@media(max-width:700px) {
  .hero h1 {
    font-size: clamp(36px,8.6vw,56px);
  }
}

@media(max-width:340px) {
  .hero-content {
    padding-inline: 17px;
  }
  .hero h1 {
    font-size: 34px;
  }
}

.stage {
  background-image: linear-gradient(90deg,#16203074,#121b2bb5 36%,#131b2a8c),var(--art);
  background-position: center,50% 52%;
  background-size: cover;
}

.stage[data-zone="0"] {
  --art: url(area-1.webp);
}

.stage[data-zone="1"] {
  --art: url(area-2.webp);
}

.stage[data-zone="2"] {
  --art: url(area-3.webp);
}

.stage[data-zone="3"] {
  --art: url(area-4.webp);
}

.visual .scene-caption {
  padding: 3px 0;
  text-shadow: 0 1px 6px #000,0 1px 2px #000;
}

.pallet.reserve {
  border-style: dashed;
}
