:root {
  color-scheme: light;
  --ink: #294b40;
  --paper: #f7f5ed;
  --green: #3f6c52;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
.page {
  width: min(1440px, calc(100% - 48px), calc((100svh - 145px) * 1.935));
  margin: 22px auto;
}
.controls {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
  margin-bottom: 18px;
}
.rules {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 14px;
  line-height: 1.7;
}
.rules b {
  font-size: 18px;
}
.rules small {
  width: 100%;
  color: #788878;
  font-size: 12px;
}
.camera-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
  max-width: 280px;
}
button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 24px;
  padding: 10px 18px;
  font-size: 12px;
}
button:hover {
  filter: brightness(0.95);
}
button:focus-visible,
canvas:focus-visible {
  outline: 3px solid #e8a567;
  outline-offset: 3px;
}
.primary {
  background: var(--green);
  color: white;
}
.secondary,
.restart {
  background: #edf4e8;
  color: var(--green);
  border: 1px solid #b5cbb5;
}
#camera-status {
  width: 100%;
  font-size: 11px;
  color: #748477;
  text-align: right;
  max-width: 280px;
  line-height: 1.5;
}
.game-shell {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: #d9eeec;
  border: 1px solid #cbded2;
  box-shadow: 0 4px 0 #dce1d3;
}
#game {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: grab;
}
#game:active {
  cursor: grabbing;
}
.game-top {
  position: absolute;
  left: 28px;
  right: 28px;
  top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.target-label {
  font-size: 12px;
  letter-spacing: 1px;
  color: #527767;
}
.stats {
  display: flex;
  align-items: center;
  gap: 26px;
}
.stats small {
  display: block;
  font-size: 10px;
  color: #648578;
  margin-bottom: 8px;
}
.stats strong {
  font-size: 22px;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}
#ammo {
  display: flex;
  gap: 7px;
  height: 25px;
  align-items: center;
}
#ammo span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #365e54;
}
#ammo span.used {
  opacity: 0.15;
}
.restart {
  pointer-events: auto;
}
.hint {
  position: absolute;
  left: 9%;
  top: 43%;
  font-size: 11px;
  color: #6d9182;
  pointer-events: none;
}
.hint.faded {
  opacity: 0;
}
.game-bottom {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #f0f5e6;
  font-size: 11px;
  gap: 16px;
}
.game-bottom b {
  font-weight: normal;
}
.camera-preview {
  position: absolute;
  left: 24px;
  top: 85px;
  width: 160px;
  aspect-ratio: 4/3;
  border: 2px solid #edf6e8;
  border-radius: 12px;
  overflow: hidden;
  background: #32493f;
  pointer-events: none;
}
.camera-preview video,
.camera-preview canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  transform: scaleX(-1);
}
.camera-preview span {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 5px 3px;
  font-size: 10px;
  color: white;
  background: #1c3428c4;
}
.camera-preview[hidden],
.result[hidden] {
  display: none;
}
.result {
  position: absolute;
  inset: 0;
  background: #d9eee9ab;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
}
.result-card {
  text-align: center;
  background: #faf9ef;
  border-radius: 22px;
  padding: 28px 45px;
  box-shadow: 0 12px 50px #345a4320;
}
.result-symbol {
  font-size: 42px;
  color: #ee8651;
}
.result h2 {
  font-size: 28px;
  margin: 12px 0;
}
.result p {
  font-size: 13px;
  color: #778775;
  line-height: 1.8;
}
.result button {
  margin-top: 9px;
}
dialog {
  border: 1px solid #dce1d3;
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  padding: 32px;
  max-width: 480px;
  width: calc(100% - 32px);
}
dialog::backdrop {
  background: #294e4855;
  backdrop-filter: blur(3px);
}
dialog h2 {
  font-size: 24px;
  margin-top: 0;
}
dialog p,
dialog li {
  font-size: 13px;
  line-height: 1.9;
  color: #627461;
}
dialog ol {
  padding-left: 22px;
}
.close {
  position: absolute;
  right: 8px;
  top: 7px;
  background: none;
  font-size: 24px;
  color: #829183;
  padding: 3px 10px;
}
@media (max-width: 800px) {
  .page {
    width: calc(100% - 24px);
    margin: 14px auto;
  }
  .controls {
    align-items: flex-start;
    gap: 12px;
  }
  .rules {
    font-size: 12px;
    gap: 4px 10px;
  }
  .rules b {
    font-size: 16px;
  }
  .rules small {
    font-size: 10px;
  }
  .camera-controls {
    max-width: 200px;
  }
  .game-top {
    left: 16px;
    right: 16px;
    top: 16px;
  }
  .stats {
    gap: 14px;
  }
  .stats strong {
    font-size: 17px;
  }
  .target-label {
    font-size: 10px;
  }
  .camera-preview {
    width: 105px;
    top: 70px;
    left: 16px;
  }
  .game-bottom {
    left: 16px;
    right: 16px;
    bottom: 14px;
    font-size: 10px;
  }
  .hint {
    font-size: 9px;
    top: 53%;
  }
}
@media (max-width: 520px) {
  .controls {
    display: block;
  }
  .camera-controls {
    max-width: none;
    margin-top: 12px;
    justify-content: flex-start;
    align-items: center;
  }
  #camera-status {
    width: auto;
    text-align: left;
    flex: 1;
    min-width: 120px;
  }
  .rules small {
    font-size: 11px;
  }
  .game-top {
    top: 10px;
    left: 12px;
    right: 12px;
  }
  .target-label {
    display: none;
  }
  .stats {
    width: 100%;
    justify-content: flex-end;
    gap: 15px;
  }
  .stats small {
    font-size: 8px;
    margin-bottom: 3px;
  }
  .stats strong {
    font-size: 14px;
  }
  #ammo {
    height: 18px;
    gap: 4px;
  }
  #ammo span {
    width: 8px;
    height: 8px;
  }
  .restart {
    padding: 6px 10px;
    font-size: 10px;
  }
  .camera-preview {
    top: 10px;
    left: 10px;
    width: 72px;
    border-width: 1px;
    border-radius: 6px;
  }
  .camera-preview span {
    font-size: 7px;
    padding: 3px 1px;
  }
  .hint {
    display: none;
  }
  .game-bottom {
    font-size: 8px;
    left: 10px;
    right: 10px;
    bottom: 10px;
  }
  .game-bottom #status {
    max-width: 75%;
    text-align: right;
  }
  .result-card {
    padding: 12px 20px;
  }
  .result-symbol {
    font-size: 20px;
  }
  .result h2 {
    font-size: 19px;
    margin: 5px 0;
  }
  .result p {
    font-size: 10px;
    margin: 6px 0;
  }
  .result button {
    padding: 7px 14px;
    margin-top: 3px;
  }
}
/* 更轻的界面比例：保留 starter 中的小角色和大飞行空间。 */
@font-face {
  font-family: Sling;
  src: url('./assets/fonts/fredoka-bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
body {
  min-height: 100svh;
  display: grid;
  place-items: center;
}
.page {
  width: min(1320px, calc(100% - 56px), calc((100svh - 154px) * 16 / 9));
  margin: 24px auto;
}
.brand-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
}
.brand {
  font-family: Sling, Arial, sans-serif;
  font-size: 30px;
  letter-spacing: -1.7px;
  text-decoration: none;
  color: var(--ink);
  line-height: 1;
}
.brand span {
  font-family: Arial, 'PingFang SC', sans-serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 2px;
  margin-left: 16px;
  color: #8b998b;
}
.world-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #8b998b;
  font-size: 10px;
  letter-spacing: 1px;
}
select {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid #d7dfce;
  border-radius: 20px;
  padding: 8px 30px 8px 14px;
  cursor: pointer;
  max-width: 190px;
}
.game-shell {
  border: 1px solid #d3e0d4;
  box-shadow: none;
  border-radius: 12px;
}
.game-top {
  top: 24px;
  left: 26px;
  right: 26px;
  align-items: flex-start;
}
.level-heading {
  display: grid;
  gap: 8px;
  color: #426d60;
  font-size: 12px;
  letter-spacing: 2px;
}
.level-heading small {
  font-size: 10px;
  letter-spacing: 1px;
  opacity: 0.65;
}
.stats {
  gap: 18px;
}
.stats small {
  font-size: 8px;
  margin-bottom: 4px;
  letter-spacing: 1.4px;
}
.stats strong {
  font:
    700 21px Sling,
    Arial,
    sans-serif;
  letter-spacing: 1px;
}
#ammo {
  height: 22px;
  gap: 5px;
}
#ammo span {
  width: 7px;
  height: 7px;
  background: #dca267;
}
.round {
  pointer-events: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  padding: 0;
  background: #fafbf1c9;
  color: #426d60;
  font-size: 20px;
}
.hint {
  top: 47%;
  left: 10%;
  font-size: 10px;
  opacity: 0.7;
}
.game-bottom {
  left: 26px;
  right: 26px;
  bottom: 20px;
  opacity: 0.9;
  font-size: 10px;
  letter-spacing: 0.5px;
}
.controls {
  margin: 18px 0 0;
  gap: 14px;
}
.rules {
  display: grid;
  gap: 5px;
}
.rules b {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2px;
}
.rules span {
  font-size: 10px;
  color: #8a9686;
}
.camera-controls {
  max-width: none;
  flex-wrap: nowrap;
  align-items: center;
  gap: 9px;
}
#camera-status {
  width: auto;
  max-width: 220px;
  font-size: 10px;
}
.controls button {
  font-size: 10px;
  padding: 9px 15px;
}
.secondary {
  background: transparent;
  border-color: #cdd8c6;
}
.primary {
  background: #3f6c52;
}
.camera-preview {
  width: 132px;
  top: 88px;
  left: 24px;
  z-index: 2;
}
.result-card {
  padding: 28px 38px;
  border: 1px solid #e2e7d8;
  box-shadow: none;
}
.result-symbol {
  font-size: 32px;
  letter-spacing: 5px;
  color: #e2b35f;
}
.result h2 {
  font-size: 24px;
}
.result-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.mobile-note {
  display: none;
}
@media (max-width: 700px) {
  .page {
    width: calc(100% - 24px);
    margin: 16px auto;
  }
  .brand-bar {
    margin-bottom: 12px;
  }
  .brand {
    font-size: 24px;
  }
  .brand span,
  .world-picker {
    font-size: 0;
  }
  .world-picker select {
    font-size: 10px;
    padding: 6px 18px 6px 9px;
  }
  .brand span {
    display: none;
  }
  .game-top {
    top: 12px;
    left: 13px;
    right: 13px;
  }
  .level-heading {
    font-size: 9px;
    letter-spacing: 1px;
  }
  .level-heading small {
    display: none;
  }
  .stats {
    width: auto;
    gap: 9px;
  }
  .stats strong {
    font-size: 15px;
  }
  .stats small {
    font-size: 7px;
  }
  .round {
    width: 25px;
    height: 25px;
    font-size: 16px;
  }
  .ammo-stat {
    display: block;
  }
  .game-bottom {
    left: 13px;
    right: 13px;
    bottom: 12px;
    font-size: 8px;
  }
  .hint {
    display: none;
  }
  .controls {
    display: flex;
    align-items: center;
    margin-top: 12px;
  }
  .rules span,
  #camera-status {
    display: none;
  }
  .rules b {
    font-size: 9px;
    letter-spacing: 0;
  }
  .camera-controls {
    margin: 0;
  }
  .controls button {
    font-size: 9px;
    padding: 8px 10px;
  }
  .camera-preview {
    top: 48px;
    left: 12px;
    width: 80px;
  }
  .mobile-note {
    display: block;
    text-align: center;
    font-size: 10px;
    color: #91a18c;
    margin-top: 22px;
  }
  .result-card {
    padding: 12px 22px;
  }
  .result-symbol {
    font-size: 20px;
  }
  .result h2 {
    font-size: 18px;
    margin: 7px;
  }
  .result p {
    font-size: 10px;
  }
  .result button {
    padding: 8px 12px;
  }
}
@media (max-height: 550px) and (orientation: landscape) {
  .page {
    width: min(calc(100% - 32px), calc((100svh - 100px) * 16 / 9));
    margin: 8px auto;
  }
  .brand-bar {
    margin-bottom: 8px;
  }
  .brand {
    font-size: 22px;
  }
  .brand span {
    display: none;
  }
  .controls {
    margin-top: 8px;
  }
  .rules span,
  .mobile-note,
  #camera-status {
    display: none;
  }
  .controls button {
    padding: 6px 10px;
  }
  .game-top {
    top: 12px;
  }
  .game-bottom {
    bottom: 12px;
  }
}
/* 参考录屏：地面压到下缘，说明不占用弹道空间。 */
.game-shell {
  background: #bee5f2;
  border-color: #d5e6df;
}
.game-bottom {
  color: #796b52;
  bottom: 18px;
}
.hint {
  top: 63%;
  left: 9%;
  color: #60858a;
}
.game-shell[data-world='1'] .game-bottom {
  color: #16495f;
  text-shadow: 0 1px 1px #d7f6ff;
}
.game-shell[data-world='0'] .game-bottom {
  bottom: 5px;
}
