: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;
}

.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;
  }
  .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;
  }
}


.hero h1 {
  color: #effcf9;
  font-size: clamp(40px,6vw,78px);
  letter-spacing: .035em;
  line-height: 1.09;
  margin-bottom: 8px;
}
.hero-subtitle {
  color: #a9f5e7;
  font-size: clamp(1.3rem,3.2vw,2.1rem);
  font-weight: 760;
  letter-spacing: .12em;
  margin-bottom: 23px;
  text-shadow: 0 2px 16px #061320;
}
.hero p { max-width: 370px; }

.stage {
  --station-light: #6af1df;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(90deg,#11202beb,#10212cb3 55%,#14252e91),var(--art) 50% 48%/cover;
  border-top: 1px solid #3c525d;
  border-bottom: 1px solid #3c525d;
}
.stage[data-zone="0"] { --art: url(area-1.webp); }
.stage[data-zone="1"] { --art: url(area-2.webp); --station-light: #efb66d; }
.stage[data-zone="2"] { --art: url(area-3.webp); --station-light: #a3d9ff; }
.stage[data-zone="3"] { --art: url(area-4.webp); --station-light: #ffb58e; }
.visual {
  display: grid;
  gap: 10px;
  min-height: 235px;
  align-content: center;
  padding: 16px 20px;
}
.scene-caption {
  color: #e9f7ff;
  text-shadow: 0 2px 4px #001829;
  font-weight: 730;
  font-size: .875rem;
  margin: 0;
}
.water-rig {
  min-width: 0;
  width: min(100%,590px);
  background: linear-gradient(150deg,#112c3ce8,#142536bd);
  border: 1px solid #567582;
  border-radius: 11px;
  padding: 9px 14px 12px;
  box-shadow: 0 10px 27px #04141985;
}
.clock {
  display: block;
  color: #ffe0aa;
  font: 700 .82rem/1.5 system-ui,sans-serif;
  letter-spacing: .03em;
  margin-bottom: 5px;
}
.reservoir {
  display: flex;
  gap: 8px;
}
.tank-card {
  display: grid;
  grid-template-areas: "name" "vessel" "reading" "rate";
  grid-template-columns: 1fr;
  justify-items: stretch;
  min-width: 0;
  width: 50%;
  padding: 5px 27px 6px 7px;
  font-size: .74rem;
  color: #d8f5f6;
}
.tank-card:only-child { width: min(76%,232px); }
.tank-name {
  grid-area: name;
  align-self: end;
  justify-self: start;
  min-width: 25px;
  padding: 1px 7px;
  border: 1px solid #629baa;
  border-radius: 6px 6px 0 0;
  background: #1d424d;
  color: #e7fffc;
  letter-spacing: .04em;
}
.vessel {
  grid-area: vessel;
  position: relative;
  height: 98px;
  border: 2px solid #a4c5c9;
  border-radius: 0 8px 8px 8px;
  box-shadow: inset 0 0 13px #65d8e642,0 2px 8px #000a;
  background: linear-gradient(100deg,#3964776b,#1d374c95 30%,#284454a1);
}
.water {
  position: absolute;
  inset: auto 0 0;
  border-radius: 0 0 5px 5px;
  background: linear-gradient(180deg,#50e9e6,#1191a9 29%,#0b637a);
  box-shadow: inset 0 1px 2px #bcfff0;
}
.tank-card:nth-child(2) .water {
  background: linear-gradient(180deg,#9beac2,#22958e 33%,#0b5762);
}
.tank-marks {
  position: absolute;
  inset: 0;
  color: #c9e7eb;
  font-size: .62rem;
  font-variant-numeric: tabular-nums;
}
.tank-marks span {
  position: absolute;
  bottom: var(--tick);
  left: 100%;
  transform: translateY(50%);
  white-space: nowrap;
  display: flex;
  gap: 4px;
  align-items: center;
}
.tank-marks span::before {
  content: "";
  width: 5px;
  height: 1px;
  background: #83abb6;
}
.tank-reading {
  grid-area: reading;
  margin-top: 4px;
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
  color: white;
}
.tank-rate { grid-area: rate; color: #c0dce5; }
.stream {
  position: absolute;
  right: 11%;
  bottom: -16px;
  width: var(--stream-width,5px);
  height: 17px;
  opacity: 0;
  outline: 1px solid #5dc8df;
  background: repeating-linear-gradient(#83eee6 0 4px,#169bb5 4px 8px);
  border-radius: 4px;
}
.stream.running {
  opacity: .85;
  animation: water-run .3s linear infinite;
}
@keyframes water-run { to { background-position: 0 8px; } }
.time-meter {
  overflow: hidden;
  height: 5px;
  margin-top: 6px;
  border-radius: 6px;
  background: #2e4c5c;
}
.time-needle { height: 100%; background: #f6ba65; }
.portions,.console-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.portion,.console-module {
  display: grid;
  align-items: start;
  gap: 2px;
  padding: 5px 9px;
  background: #142f41ed;
  border: 1px solid #7893ab;
  border-radius: 7px;
  color: #e8f6ff;
  font-size: .73rem;
}
.portion strong,.console-module strong { color: #f9d6a2; font-size: .91rem; }
.portion {
  border-color: #62b7b3;
  background: linear-gradient(160deg,#164a5be8,#154149ec);
}
.motion .portion,.motion .console-module {
  animation: portion-in .32s var(--delay,0s) both;
}
@keyframes portion-in {
  from { opacity: .1; transform: translate(-8px,7px); }
  to { opacity: 1; transform: none; }
}
.half-scale {
  position: relative;
  display: flex;
  justify-content: space-between;
  max-width: 330px;
  padding: 4px 0 11px;
  color: #e8faff;
  font-size: .8rem;
  border-bottom: 2px solid #68949d;
}
.half-progress {
  position: absolute;
  left: 0;
  bottom: -2px;
  height: 3px;
  background: #56e8db;
}
.water-log { width: fit-content; background: #142939; }
.water-log td,.water-log th {
  min-width: 0;
  padding-inline: 9px;
  color: #e1f4ff;
}
.water-chart {
  min-width: 0;
  width: min(100%,540px);
  margin: 0;
  color: #dcecf5;
  font-size: .7rem;
}
.water-chart canvas {
  display: block;
  width: 100%;
  height: 150px;
  border: 1px solid #658f9c;
  border-radius: 7px;
  background: #102734ed;
}
.water-chart figcaption { margin-top: 3px; }
.analysis-pair {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 10px;
}
.analysis-panel { display: grid; align-content: start; gap: 6px; min-width: 0; }
.analysis-panel .water-rig { padding-inline: 5px; }
.analysis-panel .tank-card { padding-inline: 3px 21px; }
.analysis-panel .tank-rate { font-size: .65rem; }
.analysis-panel .water-log td,.analysis-panel .water-log th { padding-inline: 4px; }
.installation {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 47px;
  font-size: .84rem;
  color: var(--station-light);
}
.fixture {
  position: relative;
  width: 59px;
  height: 40px;
  flex: 0 0 59px;
  overflow: hidden;
  border: 2px solid #a68c67;
  border-radius: 6px;
  background: repeating-linear-gradient(90deg,#173447 0 12px,#203b48 12px 14px);
}
.mechanism,.mechanism-detail {
  position: absolute;
  border-radius: 3px;
  background: linear-gradient(135deg,#ffe0a4,#a88452 74%);
  box-shadow: 0 0 8px #ffd39578;
}
.mechanism-detail {
  width: 14px;
  height: 5px;
  left: 4px;
  bottom: 4px;
  background: var(--station-light);
}
.mechanism {
  width: 44px;
  height: 20px;
  left: 6px;
  top: 10px;
  animation: fixture-rise .8s cubic-bezier(.2,.8,.3,1) both;
}
.installation[data-station="2"] .mechanism,
.installation[data-station="11"] .mechanism { height: 7px; animation-name: fixture-lever; }
.installation[data-station="3"] .mechanism,
.installation[data-station="8"] .mechanism {
  width: 26px;
  height: 26px;
  top: 5px;
  left: 16px;
  border: 3px dashed #204751;
  border-radius: 50%;
  animation-name: fixture-wheel;
}
.installation[data-station="4"] .mechanism,
.installation[data-station="9"] .mechanism { animation-name: fixture-lower; }
.installation[data-station="5"] .mechanism { width: 17px; left: 24px; animation-name: fixture-fill; }
.installation[data-station="6"] .mechanism,
.installation[data-station="7"] .mechanism { animation-name: fixture-insert; }
.installation[data-station="10"] .mechanism { animation-name: fixture-flip; }
.installation[data-station="12"] .mechanism {
  background: repeating-linear-gradient(#ac9987 0 4px,#645c55 4px 7px);
  animation-name: fixture-rise;
}
.pipe-lights { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.pipe-lights span {
  width: 9px;
  height: 6px;
  border-radius: 3px;
  background: #73f5de;
  box-shadow: 0 0 5px #67e5df;
  animation: station-light .23s var(--delay) both;
}
@keyframes fixture-rise { from { transform: translateY(11px); } to { transform: translateY(-10px); } }
@keyframes fixture-lever { from { transform: rotate(-40deg); } to { transform: rotate(62deg); } }
@keyframes fixture-wheel { from { transform: rotate(0); } to { transform: rotate(430deg); } }
@keyframes fixture-lower { from { transform: translateY(-10px); } to { transform: translateY(10px); } }
@keyframes fixture-fill { from { transform: scaleY(.2); } to { transform: scaleY(1.12); } }
@keyframes fixture-insert { from { transform: translateX(-40px); } to { transform: translateX(6px); } }
@keyframes fixture-flip { from { transform: rotateX(89deg); } to { transform: none; } }
@keyframes station-light { from { opacity: .12; } to { opacity: 1; } }
.skip-motion .mechanism,.skip-motion .pipe-lights span { animation-duration: .01ms; animation-delay: 0ms; }

@media (max-width:700px) {
  .hero h1 { font-size: clamp(36px,8.5vw,57px); }
  .hero-subtitle { font-size: 1.3rem; margin-bottom: 15px; }
  .visual { padding: 12px; }
  .water-rig { padding-inline: 7px; }
  .tank-card { padding-right: 23px; }
  .analysis-pair { gap: 7px; }
  .analysis-panel .water-chart canvas { height: 118px; }
  .analysis-panel .tank-card { padding-right: 17px; }
  .analysis-panel .tank-marks { font-size: .52rem; }
  .analysis-panel .tank-marks span { gap: 2px; }
}
