:root {
  color-scheme: light;
  --ink: #19374d;
  --cream: #fff2d4;
  --blue: #214967;
  --gold: #ddb675;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #173b42;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
button, input, select { font: inherit; color: inherit; }
button, select { touch-action: manipulation; }
button { border: 1px solid #ae8355; border-radius: 10px; background: #f3dcb4; font-weight: 700; cursor: pointer; }
button:disabled { cursor: default; opacity: .65; }
:is(button, input, select, a):focus-visible { outline: 3px solid #194d70; outline-offset: 2px; }
#app { display: flex; flex-direction: column; height: 100svh; }
@supports (height: 100dvh) { #app { height: 100dvh; } }
.toolbar { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 3px 8px; background: #fff3dc; border-bottom: 1px solid #aa835d; }
.brand { display: inline-flex; align-items: center; gap: 7px; flex: none; min-width: 44px; min-height: 44px; color: inherit; text-decoration: none; font-weight: 800; }
.brand img { flex: none; }
#game-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; }
#language { min-width: 0; max-width: 123px; min-height: 44px; padding-inline: 6px; background: #fffaf0; border: 1px solid #bca38b; border-radius: 8px; }
#world-button { min-height: 44px; padding-inline: 8px; background: #214967; color: #fff2d4; font-size: .88rem; }
#world-button span + span { margin-inline-start: .32em; }
.icon-button { flex: none; min-inline-size: 44px; min-block-size: 44px; padding: 0; background: #fff0d6; font-size: 1.22rem; }
#sound-button[aria-pressed=false] { color: #6e635c; text-decoration: line-through; }
#stage { container-type: size; display: grid; place-items: center; flex: 1 1 auto; min-height: 0; overflow: hidden; background: radial-gradient(ellipse at center,#436459,#17343b 75%); }
.game {
  container-type: inline-size;
  position: relative;
  width: min(100%, 56.25svh, 520px);
  width: min(100cqw, 56.25cqh, 520px);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 12px 55px #0b26348c;
  user-select: none;
}
.cabinet-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
#cabinet-title { position: absolute; top: 6.1%; inset-inline: 17%; margin: 0; color: #fdf0d5; font: 800 clamp(14px, 5.6cqw, 28px)/1.1 Georgia, "Kaiti SC", serif; text-align: center; text-shadow: 0 1px 4px #061a33; }
.scoreboard { position: absolute; inset: 12.35% 16% auto; height: 4.7%; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 4px; white-space: nowrap; font-weight: 650; font-size: clamp(9px, 3.8cqw, 17px); }
.scoreboard strong { font-size: clamp(12px, 5.2cqw, 25px); font-variant-numeric: tabular-nums; line-height: 1; color: #172f45; }
#remaining.urgent { color: #a12b18; }
.tank-wrap { position: absolute; inset: 18.7% 6% auto; height: 59.1%; touch-action: none; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.flow, .challenge-hud, #feedback { position: absolute; border-radius: 7px; background: #0f3944c9; color: #fff3d3; font-size: clamp(10px, 3cqw, 14px); line-height: 1.25; padding: 3px 6px; pointer-events: none; }
.flow { top: 13%; left: 4%; }
.challenge-hud { top: 26%; left: 4%; }
#feedback { inset: auto 4% 3%; text-align: center; text-wrap: balance; }
#feedback:empty { display: none; }
.console { position: absolute; inset: 79% 8% auto; height: 13.5%; }
.instruction { position: absolute; left: 0; top: 5%; width: 56%; color: #17374d; font-size: clamp(9px, 3.1cqw, 16px); font-weight: 650; text-align: center; text-wrap: balance; }
.slider-wrap { position: absolute; inset: 19% auto 0 0; display: flex; align-items: center; width: 56%; }
#aim { width: 100%; height: 44px; margin: 0; accent-color: #844624; cursor: ew-resize; }
#dropButton {
  position: absolute;
  inset: 4% 0 auto auto;
  width: clamp(45px, 24cqw, 112px);
  aspect-ratio: 1;
  padding: 3px;
  border: 2px solid #975524;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 25%,#d96946,#b44028 56%,#752610 96%);
  box-shadow: 0 0 0 2px #f5c785,0 0 0 4px #b57937,inset 0 0 0 2px #efb981,0 4px 3px #79421b91;
  color: #fff1cf;
  font-weight: 800;
  font-size: clamp(9px, 4.3cqw, 21px);
  text-shadow: 0 1px #641f12;
  overflow-wrap: anywhere;
}
#dropButton:disabled { opacity: .85; }
.utility { position: absolute; inset: auto 35% 0 6%; display: grid; grid-template-columns: auto 1fr; gap: 3px; align-items: center; color: #fff6e1; text-shadow: 0 1px 2px #382312; }
.utility button, #pauseButton { min-width: 44px; min-height: 44px; color: #fff7e4; background: #483023dd; border-color: #b88651; }
#pauseButton { position: absolute; top: 2%; right: 3%; }
#levelsButton { padding: 2px 4px; font-size: clamp(9px, 2.7cqw, 14px); }
#best { font-size: clamp(9px, 2.6cqw, 14px); overflow-wrap: anywhere; text-align: center; font-weight: 650; }
.loading { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; background: #1d3c4df2; color: var(--cream); font-weight: 700; }
.loading span { font-size: 36px; color: var(--gold); }
dialog { inset: 0; max-block-size: calc(100dvh - 16px); width: min(448px, calc(100vw - 16px)); margin: auto; padding: 14px; overflow-y: auto; overscroll-behavior: contain; border: 2px solid #c29758; border-radius: 17px; color: #17354a; background: linear-gradient(145deg, #fff6df, #ead5b3); box-shadow: 0 16px 55px #09272d86; }
dialog::backdrop { background: #082c3d8c; }
dialog h2 { font-size: clamp(18px, 4.6vw, 26px); margin: 0; line-height: 1.23; overflow-wrap: anywhere; }
dialog p, dialog li { font-size: 14px; line-height: 1.42; }
dialog p { margin: 7px 0; }
dialog :is(button, input) { min-height: 44px; }
#menu-title { min-height: 44px; display: flex; align-items: center; padding-inline-end: 48px; }
.menu-close { position: absolute; inset-block-start: 9px; inset-inline-end: 10px; }
.mode-cards, .actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
.mode-cards { margin-block-start: 10px; }
.mode-cards .primary { grid-column: 1 / -1; }
.actions button, .mode-cards button { padding: 4px 6px; font-size: .86rem; overflow-wrap: anywhere; }
.primary { color: #fff4d6; background: linear-gradient(#355f7d,#213e5a); border-color: #254a61; }
#start-status:empty, #submit-status:empty { display: none; }
#help-panel ol { padding-inline-start: 24px; }
#help-panel li + li { margin-top: 5px; }
#help-done { width: 100%; }
.result-dialog { padding: 0; overflow: hidden; }
#result-panel { display: flex; flex-direction: column; min-height: 0; max-height: calc(100dvh - 20px); overflow: hidden; }
.result-heading { flex: none; display: flex; align-items: end; justify-content: space-between; gap: 10px; padding: 10px 13px 6px; }
.result-heading p { margin: 0 0 3px; font-size: 12px; }
.result-score { font-size: clamp(30px, 9vw, 54px); line-height: .98; color: #a54329; }
.result-body { flex: 1 1 auto; min-height: 0; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 0 13px 8px; }
.result-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; margin: 4px 0; }
.result-stats div { padding: 5px 3px; border-radius: 7px; background: #d8bd9177; text-align: center; }
.result-stats dt { font-size: 11px; line-height: 1.2; overflow-wrap: anywhere; }
.result-stats dd { margin: 2px 0 0; font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; }
#result-record { color: #8f412d; font-weight: 700; }
.catch-detail { color: #343c3a; font-variant-numeric: tabular-nums; }
.result-footer { flex: none; border-top: 1px solid #b49b72; padding: 7px 10px; }
.result-footer .actions { grid-template-columns: repeat(3,minmax(0,1fr)); }
.submit-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.submit-row input { flex: 1 1 126px; min-width: 0; padding: 0 8px; border: 1px solid #ae8355; border-radius: 8px; background: #fffaf0; font-size: 16px; }
.submit-row button { padding-inline: 9px; }
#result-panel > .end-game-share, #result-panel > .end-game-links { margin-inline: 13px; }
#result-panel > .end-game-links { margin-bottom: 8px; }
.world-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#world-list { list-style: none; margin: 10px 0; padding: 0; }
#world-list li { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 6px; align-items: center; padding: 5px; border-radius: 7px; }
#world-list li:nth-child(odd) { background: #dec69c70; }
#world-list li.is-me { background: #bcd5cd; }
#world-list bdi { overflow-wrap: anywhere; }
.world-position { display: grid; place-items: center; min-height: 25px; min-width: 25px; width: fit-content; padding-inline: 4px; }
.world-position.featured { border: 1px solid #9c733b; border-radius: 999px; background: #f0d894; color: #513810; }
#world-more { padding-inline: 12px; }
#privacy-link { color: #1b4e6a; }
@media (max-width: 465px) { .brand span,#game-name,#world-button span:nth-child(2) { display: none; } .toolbar { justify-content: space-between; } #world-button { min-width: 44px; } }
@container (max-width: 230px) { .utility { left: 4%; } .utility #best { padding-inline: 1px; } .flow { top: 17%; } .challenge-hud { top: 30%; } }
@media (orientation: landscape) and (max-height: 450px) {
  .game { width: min(100cqw, 95cqh * 2.75, 700px); height: min(100cqh, 400px); aspect-ratio: auto; background: radial-gradient(ellipse at 100% 23%,#e6ae73,#b77b45 75%); border-radius: 10px; }
  .cabinet-art { inset: -19% auto auto 0; width: 66%; height: 147%; }
  #cabinet-title { display: none; }
  .scoreboard { inset: 1% auto auto 9.5%; width: 46%; height: 6.9%; font-size: clamp(10px,2.8vh,16px); }
  .scoreboard strong { font-size: clamp(12px,4.7vh,20px); }
  .tank-wrap { inset: 8.5% auto auto 4%; width: 58%; height: 87%; }
  .flow, .challenge-hud, #feedback { font-size: clamp(10px,4vh,14px); }
  .console { inset: 2% 3% 24% 69%; height: auto; }
  .instruction { inset: 0 0 auto; width: 100%; font-size: clamp(10px,4vh,15px); }
  .slider-wrap { inset: 17% 0 auto; width: 100%; }
  #dropButton { inset: auto 50% 0 auto; transform: translateX(50%); width: clamp(45px, 25vh, 100px); font-size: clamp(10px, 4.4vh, 19px); }
  .utility { inset: auto calc(2% + 48px) 1% 67%; grid-template-columns: 1fr; }
  #pauseButton { inset: auto 2% 1% auto; }
  .utility #best { display: none; }
  #levelsButton { font-size: 11px; }
}
@media (max-height: 350px) {
  #result-panel > .end-game-home { margin-top: 3px; padding-block: 1px; font-size: 12px; }
  .result-heading { padding-block: 5px; align-items: center; }
  .result-heading h2 { font-size: 16px; }
  .result-score { font-size: 29px; }
}
