* {
  box-sizing: border-box;
}
:root {
  --view-height: 100vh;
  --ink: #293e33;
  --paper: #f7f4e9;
  --muted: #666b5b;
  --red: #d84e37;
  --line: #d4d1bf;
  --brown: #49362b;
  --cream: #fff8e6;
  font-family: 'Microsoft YaHei', 'PingFang SC', 'Noto Sans CJK SC', sans-serif;
  color: var(--ink);
  background: var(--paper);
}
@supports (height: 100dvh) {
  :root { --view-height: 100dvh; }
}
body {
  margin: 0;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  overscroll-behavior: none;
  user-select: none;
  background:
    radial-gradient(#84774711 0.7px, transparent 0.9px) 0 0/5px 5px,
    var(--paper);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  border: 0;
  background: none;
  font-weight: 750;
  touch-action: manipulation;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #237e87;
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.48;
  cursor: default;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button:hover:not(:disabled) {
  filter: brightness(0.95);
}
[hidden] {
  display: none !important;
}
.mast {
  height: 79px;
  border-bottom: 1px solid var(--line);
  background: #faf7ed;
}
.mast-inner,
.shell,
.editor-page {
  width: min(1360px, 91%);
  margin: auto;
}
.mast-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 5%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  text-align: left;
  white-space: nowrap;
}
.brand-art {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  background: var(--ink);
  border-radius: 11px;
  transform: rotate(-4deg);
}
.brand-art canvas {
  width: 34px;
  height: 34px;
}
.brand b {
  display: block;
  font-size: 20px;
  letter-spacing: 0.09em;
  line-height: 1.3;
}
.brand small,
.kicker,
.eyebrow,
.english-title,
.ammo-caption,
.hud-level small,
.footer-right,
.hero-tag {
  font-family: 'Arial Black', 'Microsoft YaHei', sans-serif;
  font-weight: 850;
}
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 0.17em;
  margin-top: 2px;
}
.mast nav {
  display: flex;
  gap: 28px;
  height: 100%;
}
.nav-tab {
  position: relative;
  font-size: 14px;
  padding: 2px 0 0;
  color: #727466;
}
.nav-tab.active {
  color: var(--ink);
}
.nav-tab.active:after {
  content: '';
  position: absolute;
  height: 3px;
  width: 20px;
  background: var(--red);
  bottom: 13px;
  left: calc(50% - 10px);
  border-radius: 3px;
}
.utility {
  margin-left: auto;
  display: flex;
  gap: 9px;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border: 1px solid #bfbfae;
  border-radius: 50%;
  background: #fffbef;
}
.icon-btn canvas {
  width: 19px;
  height: 19px;
}
.shell {
  padding: 30px 0 14px;
}
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  height: clamp(356px, 31vw, 460px);
  border: 2px solid var(--brown);
  border-radius: 16px;
  background: #faf1d9;
  box-shadow: 0 5px 0 #c7c0a7;
}
.hero > canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}
.hero-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0 4.4%;
}
.eyebrow {
  display: flex;
  gap: 9px;
  align-items: center;
  letter-spacing: 0.14em;
  font-size: 11px;
}
.eyebrow i,
.footer-right i {
  background: var(--red);
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.hero h1 {
  font-size: clamp(60px, 6.55vw, 106px);
  font-weight: 1000;
  line-height: 1.12;
  margin: 13px 0 0;
  letter-spacing: -0.085em;
  color: #304638;
  transform: skew(-5deg);
  -webkit-text-stroke: 1.4px currentColor;
  text-shadow:
    1px 3px 0 #faf1d9,
    2px 5px 0 #b5a985;
}
.hero h1 span,
.hero h1 em {
  color: var(--red);
}
.hero h1 em {
  font-family: Georgia, serif;
  font-style: italic;
  margin-left: 0.04em;
}
.english-title {
  font-size: clamp(15px, 1.5vw, 23px);
  letter-spacing: 0.19em;
  margin: 9px 0 0;
  font-weight: 950;
  font-style: italic;
}
.english-title span {
  font-style: normal;
  color: var(--red);
  font-size: 0.75em;
  vertical-align: middle;
  margin-left: 12px;
}
.hero p {
  font-size: clamp(14px, 1.14vw, 17px);
  line-height: 1.75;
  font-weight: 550;
  margin: 17px 0 22px;
  color: #5b604e;
}
.actions,
.edit-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.primary,
.secondary,
.edit-actions button,
.props button,
.edit-bar button,
.dialog-btn {
  border: 1.7px solid var(--brown);
  border-radius: 8px;
  padding: 11px 20px;
  min-height: 43px;
  background: #fff9e9;
  color: var(--brown);
  font-weight: 800;
}
.primary,
.edit-actions .primary {
  background: var(--red);
  color: #fff9e8;
  box-shadow: 0 3px 0 var(--brown);
}
.hero .primary,
.hero .secondary {
  min-width: 132px;
  font-size: 16px;
  min-height: 47px;
  box-shadow: 0 3px 0 var(--brown);
}
.secondary span {
  margin-left: 7px;
}
.play-icon {
  font-size: 0.85em;
  margin-right: 4px;
}
.hero-tag {
  position: absolute;
  right: 16px;
  bottom: 12px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #4f3928;
  background: #fbefd2;
  border: 1px solid #74583b;
  padding: 7px 13px;
  transform: rotate(-2deg);
}
.guide-heading,
.page-heading,
.editor-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.guide-heading {
  margin: 29px 0 16px;
}
.kicker {
  color: #8b5842;
  font-size: 10px;
  letter-spacing: 0.17em;
  display: block;
}
.guide-heading h2,
.page-heading h1,
.editor-head h1 {
  margin: 4px 0 0;
  line-height: 1.2;
  font-size: clamp(25px, 2.1vw, 34px);
  letter-spacing: 0.015em;
}
.text-btn {
  font-size: 13px;
  border-bottom: 1px solid #b6baa7;
  padding: 6px 1px;
}
.text-btn span {
  margin-right: 3px;
}
.guide-controls, .guide-switch, .chapter-switch {
  display: flex;
  align-items: center;
  gap: 12px;
}
.guide-switch {
  gap: 0;
  padding: 3px;
  background: #ebe8d9;
  border: 1px solid #c7c9b6;
  border-radius: 8px;
}
.guide-switch button, .chapter-switch button {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 5px;
}
.guide-switch [aria-pressed='true'], .chapter-switch [aria-pressed='true'] {
  background: var(--ink);
  color: var(--cream);
}
.catalog {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 13px;
}
.ammo-card {
  text-align: left;
  position: relative;
  overflow: hidden;
  min-height: 120px;
  border: 1.4px solid #acb29d;
  border-radius: 10px;
  padding: 15px 15px 13px;
  background: var(--card);
  display: flex;
  align-items: center;
  gap: 8px;
  transition:
    transform 0.18s,
    box-shadow 0.18s;
}
.ammo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 3px 0 #aaa793;
}
.ammo-card canvas {
  width: 43%;
  max-width: 83px;
  aspect-ratio: 1;
  transform: rotate(-9deg);
}
.ammo-card b,
.ammo-card small {
  display: block;
  white-space: nowrap;
}
.ammo-card b {
  font-size: clamp(14px, 1.34vw, 21px);
}
.ammo-card small {
  font-weight: 550;
  font-size: 12px;
  color: #565d4e;
  margin-top: 5px;
}
.ammo-card .no {
  position: absolute;
  top: 9px;
  right: 10px;
  color: #757963;
  font: 700 9px/1 monospace;
  letter-spacing: 0.08em;
}
footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 27px;
  padding: 15px 0 2px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: #6f7366;
}
footer b {
  padding: 0 4px;
  color: #a7a795;
}
.footer-dots {
  font-size: 8px;
  letter-spacing: 2px;
  color: #a69370;
}
.footer-right {
  margin-left: auto;
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 11px;
}
.footer-right i {
  background: #6c886b;
  width: 6px;
  height: 6px;
}
.page-heading {
  margin: 8px 0 22px;
}
.map-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.map-actions button { white-space: nowrap; }
#resetProgress { min-height: 44px; color: #923a2d; }
.map-status { margin: 0; font-size: 14px; }
.map-status:not(:empty) { margin-bottom: 14px; }
.stage-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.chapter-switch { margin: 0 0 16px; gap: 8px; }
.chapter-switch button { border: 1px solid #a9af9c; padding: 8px 14px; }
.chapter-switch small { margin-left: 8px; font-size: 11px; font-weight: 500; }
.stage {
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 1.5px solid var(--brown);
  border-radius: 10px;
  background: #f4efdf;
  text-align: left;
}
.stage:disabled {
  opacity: 1;
  border-color: #b6b6a3;
}
.stage:disabled .stage-preview { filter: saturate(.7); }
.stage.open {
  background: #fff8e7;
  box-shadow: 0 3px 0 var(--brown);
}
.stage-info { display: block; padding: 12px 15px; }
.stage-stock { display: block; color: #5e6757; font-size: 12px; font-weight: 500; }
.stage small {
  font: 700 12px monospace;
  letter-spacing: 0.12em;
}
.stage b {
  display: block;
  font-size: 21px;
  margin: 4px 0;
}
.stage em {
  display: block;
  padding-top: 9px;
  font-style: normal;
  font-size: 12px;
  color: #63705e;
}
.stage.open em { color: #92502e; }
.stage .stage-preview {
  display: block;
  width: 100%;
  height: auto;
  border-bottom: 1px solid #b8ac91;
}
.custom-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted);
}
.custom-list button {
  background: var(--cream);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
}
body[data-scene='game'],
body[data-scene='editor'] {
  overflow: hidden;
}
.game-page {
  position: relative;
  overflow: hidden;
  height: calc(var(--view-height) - 79px);
  background: #f1e5cd;
}
#field,
#editField {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.hud {
  position: absolute;
  pointer-events: none;
}
.hud button {
  pointer-events: auto;
}
.hud-top {
  top: 14px;
  left: 2%;
  right: 2%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.hud-level,
.scorebox,
.hud-tools button,
.ammo-caption,
#tip,
#queue button,
.edit-center,
.editor-layout aside {
  background: #fffae9ec;
  border: 1.5px solid #715e47;
  border-radius: 9px;
}
.hud-level,
.scorebox {
  padding: 9px 15px;
  box-shadow: 0 2px 0 #a68c67;
}
.hud-level small {
  display: block;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: #90654f;
  margin-bottom: 3px;
}
.hud-level b {
  font-size: 19px;
}
.scorebox {
  width: 158px;
}
.scorebox small {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
}
.scorebox strong {
  font: 900 21px monospace;
}
.meter {
  position: relative;
  background: #e0d9ba;
  border-radius: 4px;
  height: 12px;
  margin-top: 5px;
  overflow: hidden;
}
.meter i {
  position: absolute;
  background: #f5bc53;
  inset: 0 auto 0 0;
}
.meter b {
  display: flex;
  position: absolute;
  inset: 0;
  justify-content: space-between;
  align-items: center;
  color: #887953;
  font: 900 11px sans-serif;
}
.meter b span.lit {
  color: #7d461b;
  animation: pop 0.3s both;
}
.hud-tools {
  top: 91px;
  left: 2%;
  display: flex;
  gap: 6px;
}
.hud-tools button {
  font: 900 21px sans-serif;
  width: 40px;
  height: 40px;
  box-shadow: 0 2px 0 #ada17f;
}
.hud-bottom {
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 2%;
  right: 2%;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.ammo-caption {
  display: inline-block;
  padding: 3px 8px;
  color: var(--ink);
  font-size: 11px;
}
.ammo-rack {
  transform: translateY(-100%);
  text-align: center;
  touch-action: manipulation;
}
.rack-label {
  display: inline-block;
  margin-bottom: 4px;
  padding: 2px 6px;
  border: 1px solid #b6a483;
  border-radius: 4px;
  background: #fff7dfed;
  font-size: 11px;
  font-weight: 750;
  color: #564533;
  white-space: nowrap;
}
.round-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.round-choices button {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 5px;
  background: #f8efd9;
  border: 1px solid #b4a484;
  border-radius: 7px;
}
.round-choices [aria-pressed='true'] { background: #ffe2a0; border-color: #7a542d; }
.round-choices canvas { width: 36px; height: 36px; }
.round-choices b { font-size: 13px; }
.round-choices small { color: #625f4e; font-size: 10px; }
#queue {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), var(--cell, 44px));
  gap: 4px;
  pointer-events: auto;
  max-height: var(--rack-height);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #997a54 #e9dab9;
  overscroll-behavior: contain;
  touch-action: pan-y;
  border-bottom: 4px solid #ad8059;
  border-radius: 5px;
}
#queue button {
  width: var(--cell);
  height: calc(var(--cell) + 5px);
  padding: 1px 0 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: clamp(8px, calc(var(--cell) * .205), 10px);
  white-space: nowrap;
  line-height: 1;
  font-weight: 700;
  position: relative;
}
#queue canvas {
  width: calc(var(--cell) - 9px);
  height: calc(var(--cell) - 9px);
}
#queue button.current {
  background: #ffe2a0;
  border: 2px solid #7a542d;
}
#queue button.current::after {
  content: '✓';
  position: absolute;
  right: -2px;
  top: -3px;
  border-radius: 50%;
  background: #526b50;
  color: white;
  padding: 2px 3px;
  font-size: 10px;
}
#queue button:disabled {
  opacity: 0.87;
}
#tip {
  font-size: 12px;
  font-weight: 650;
  padding: 7px 12px;
  margin: auto;
  max-width: 44%;
  text-align: center;
}
#tip strong {
  display: block;
  margin-bottom: 2px;
  color: #714723;
}
#skip {
  margin-left: auto;
}
dialog {
  padding: 0;
  border: 2px solid var(--brown);
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  max-width: min(94vw, 560px);
  max-height: calc(var(--view-height) * .9);
  box-shadow: 0 5px 0 #5c4939;
}
dialog:not([open]) { display: none; }
.legacy-modal-open::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9;
  background: #27352bb3;
}
.legacy-modal-open dialog[open] {
  display: block;
  position: fixed;
  inset: 0;
  margin: auto;
  width: max-content;
  height: max-content;
  overflow: auto;
  z-index: 10;
}
dialog::backdrop {
  background: #27352bb3;
}
.modal-inner {
  padding: 28px;
  min-width: min(82vw, 392px);
  position: relative;
}
.modal-close {
  position: absolute;
  right: 11px;
  top: 7px;
  font-size: 26px;
}
.modal-inner h2 {
  margin: 8px 25px 15px 0;
  font-size: 27px;
}
.modal-inner p,
.modal-inner li {
  line-height: 1.65;
  font-size: 14px;
}
.modal-inner ol {
  padding-left: 20px;
}
.modal-inner .actions {
  flex-wrap: wrap;
}
.primary.reset-confirm { background: #a1382a; }
.play-guide {
  width: min(460px, calc(90vw - 56px));
}
.guide-diagram {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #b1baa1;
  border-radius: 9px;
}
.modal-inner .guide-steps {
  margin: 18px 0;
  padding-left: 28px;
}
.guide-steps li {
  padding-left: 4px;
  margin: 10px 0;
}
.guide-steps li::marker {
  color: #87512f;
  font-weight: 800;
  font-size: 18px;
}
.guide-steps strong {
  display: block;
  font-size: 19px;
}
.modal-inner .play-guide p {
  font-size: 17px;
  line-height: 1.5;
  margin: 2px 0 0;
}
.play-guide details {
  margin-bottom: 12px;
}
.play-guide summary {
  cursor: pointer;
  color: #566451;
  font-size: 14px;
}
.play-guide .primary {
  width: 100%;
  font-size: 17px;
}
@media (max-height: 520px) and (orientation: landscape),
       (max-width: 520px) and (orientation: portrait) and (pointer: coarse) {
  .play-guide {
    display: grid;
    grid-template-columns: 0.8fr 1.5fr;
    align-items: start;
    gap: 6px 14px;
  }
  .guide-diagram { grid-column: 1; grid-row: 1; }
  .play-guide .primary { grid-column: 1; grid-row: 2; font-size: 14px; padding: 6px; }
  .modal-inner .guide-steps { grid-column: 2; grid-row: 1 / 4; margin: 0; padding-left: 20px; }
  .guide-steps li { margin: 0 0 6px; }
  .guide-steps strong, .guide-steps li::marker { font-size: 16px; }
  .modal-inner .play-guide p { font-size: 14px; line-height: 1.4; }
  .play-guide details { grid-column: 1 / -1; grid-row: 4; }
}
.result-stars {
  font-size: 36px;
  letter-spacing: 4px;
  color: #c88a26;
}
.result-stars span {
  display: inline-block;
  animation: pop 0.38s backwards;
}
.result-stars span:nth-child(2) {
  animation-delay: 0.14s;
}
.result-stars span:nth-child(3) {
  animation-delay: 0.28s;
}
@keyframes pop {
  from {
    transform: scale(0.5);
  }
  70% {
    transform: scale(1.18);
  }
  to {
    transform: scale(1);
  }
}
.result-score {
  font: 900 33px monospace;
}
.modal-inner textarea {
  display: block;
  width: 100%;
  height: 135px;
  margin: 10px 0;
  user-select: text;
}
.modal-inner select,
.modal-inner input {
  max-width: 100%;
}
.modal-inner button {
  margin-top: 4px;
}
.mixer {
  display: grid;
  gap: 16px;
  margin: 16px 0 13px;
}
.mix-channel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 3px 10px;
  font-size: 14px;
  font-weight: 700;
}
.mix-channel output {
  font: 700 12px/1.2 monospace;
  color: #59644e;
}
.mix-channel input {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
  min-height: 22px;
  accent-color: #517158;
  cursor: pointer;
}
.mute-toggle { padding: 5px 12px; min-height: 34px; font-size: 13px; }
.mute-toggle + .actions { margin-top: 16px; }
#edAmmoCount { font: 700 11px monospace; margin-left: 5px; color: var(--muted); }
.ammo-detail {
  display: flex;
  gap: 15px;
  align-items: center;
}
.ammo-detail canvas {
  width: 80px;
  height: 80px;
}
.editor-page {
  padding: 12px 0;
  width: 96%;
}
.editor-head {
  margin-bottom: 12px;
  align-items: center;
}
.editor-head h1 {
  font-size: 24px;
}
.edit-actions button,
.props button,
.edit-bar button {
  padding: 5px 10px;
  min-height: 34px;
  font-size: 12px;
}
.editor-layout {
  display: grid;
  grid-template-columns: 150px minmax(150px, 1fr) 205px;
  gap: 10px;
  height: calc(var(--view-height) - 177px);
}
.editor-layout aside {
  padding: 12px;
  overflow: auto;
}
.editor-layout h3 {
  margin: 0 0 12px;
  font-size: 17px;
}
.editor-layout h4 {
  font-size: 13px;
  margin: 13px 0 6px;
}
.palette-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.palette-group button {
  border: 1px solid #b3ad94;
  border-radius: 4px;
  font-size: 12px;
  padding: 4px;
  background: #f8f1db;
}
.palette-group button.picked {
  background: #f4cd82;
  outline: 1px solid var(--brown);
}
.edit-center {
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.edit-bar {
  padding: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.edit-bar label {
  margin-left: auto;
}
#edStatus {
  min-height: 29px;
  margin: 0;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.props label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}
.props input,
.props select,
.modal-inner select {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid #b9b6a1;
  background: #fffdf4;
  padding: 5px 7px;
  border-radius: 4px;
  color: var(--ink);
  margin: 3px 0;
}
.two,
#edAmmo > div {
  display: flex;
  gap: 5px;
}
.two label {
  width: 50%;
}
.props p {
  font-size: 12px;
}
.props button {
  margin: 2px 0;
}
#edAmmo button {
  padding: 2px 8px;
}
.props input,
.modal-inner textarea {
  user-select: text;
}
.phone-hint { display: none; }
@media (min-width: 1550px) {
  .shell {
    padding-top: 40px;
  }
  .guide-heading {
    margin-top: 36px;
  }
  .ammo-card {
    min-height: 135px;
  }
}
@media (max-width: 1000px) {
  .mast-inner,
  .shell {
    width: 94%;
  }
  .mast {
    height: 64px;
  }
  .game-page {
    height: calc(var(--view-height) - 64px);
  }
  .mast nav {
    gap: 19px;
  }
  .catalog {
    gap: 8px;
    grid-template-columns: repeat(3, 1fr);
  }
  .ammo-card {
    padding: 11px 7px;
    min-height: 100px;
  }
  .ammo-card b {
    font-size: 17px;
  }
  .editor-layout {
    grid-template-columns: 109px minmax(150px, 1fr) 157px;
    height: calc(var(--view-height) - 151px);
  }
  .editor-layout aside {
    padding: 8px;
  }
}
@media (max-height: 600px) and (orientation: landscape) {
  .mast {
    height: 45px;
  }
  .mast-inner {
    width: 95%;
  }
  .brand-art {
    width: 29px;
    height: 29px;
  }
  .brand-art canvas {
    width: 25px;
    height: 25px;
  }
  .brand b {
    font-size: 14px;
  }
  .brand small {
    font-size: 7px;
  }
  .nav-tab {
    font-size: 12px;
  }
  .nav-tab.active:after {
    bottom: 3px;
  }
  .icon-btn {
    width: 33px;
    height: 33px;
  }
  .shell {
    padding-top: 12px;
  }
  .hero {
    height: clamp(216px, calc(var(--view-height) * .57), 310px);
    border-radius: 10px;
  }
  .hero h1 {
    font-size: clamp(45px, 6vw, 65px);
    margin-top: 5px;
  }
  .eyebrow {
    font-size: 9px;
  }
  .english-title {
    font-size: 13px;
    margin-top: 3px;
  }
  .hero p {
    font-size: 12px;
    margin: 8px 0 10px;
    line-height: 1.45;
  }
  .hero .primary,
  .hero .secondary {
    min-height: 33px;
    min-width: 96px;
    font-size: 13px;
    padding: 5px 10px;
  }
  .hero-tag {
    font-size: 11px;
    bottom: 6px;
  }
  .guide-heading {
    margin: 15px 0 8px;
  }
  .guide-heading h2 {
    font-size: 20px;
  }
  .kicker {
    font-size: 8px;
  }
  .ammo-card {
    min-height: 66px;
  }
  .ammo-card canvas {
    width: 35%;
  }
  .ammo-card b {
    font-size: 14px;
  }
  .ammo-card small {
    font-size: 10px;
  }
  .game-page {
    height: calc(var(--view-height) - 45px);
  }
  .hud-top {
    top: 6px;
  }
  .hud-level,
  .scorebox {
    padding: 4px 8px;
  }
  .hud-level b {
    font-size: 14px;
  }
  .hud-tools {
    top: 54px;
  }
  .hud-tools button {
    width: 32px;
    height: 32px;
  }
  .hud-bottom {
    bottom: max(5px, env(safe-area-inset-bottom));
  }
  .editor-layout {
    height: calc(var(--view-height) - 110px);
  }
  .editor-head h1 {
    font-size: 18px;
  }
  .edit-actions {
    gap: 5px;
  }
  .modal-inner {
    padding: 18px 23px;
  }
  .stage-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .stage {
    padding: 0;
  }
  .stage-info { padding: 7px 9px; }
  .stage b {
    font-size: 16px;
  }
  .mixer { gap: 5px; margin: 8px 0; }
  #tip {
    font-size: 10px;
  }
}
@media (max-width: 700px) and (orientation: portrait) {
  .mast nav {
    gap: 8px;
  }
  .nav-tab {
    font-size: 11px;
  }
  .mast-inner {
    gap: 3%;
  }
  .brand b {
    font-size: 14px;
  }
  .brand small {
    font-size: 7px;
  }
  .catalog,
  .stage-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero-content {
    background: linear-gradient(90deg, #faf1d9 45%, transparent 90%);
  }
  .editor-head, .edit-actions { flex-wrap: wrap; }
  body[data-scene='editor'] { overflow: auto; }
  .editor-layout { height: auto; grid-template-columns: minmax(0, 1fr); }
  .edit-center { height: 300px; }
}
/* The browser can keep a portrait viewport while the player is holding the phone sideways. */
@media (max-width: 600px) and (orientation: portrait) and (pointer: coarse) {
  .phone-hint {
    display: block;
    margin: 12px 2px 0;
    font-size: 12px;
    color: var(--muted);
  }
  body:not([data-scene='game']) .play-guide { display: block; }
  body[data-scene='game'] .mast { display: none; }
  .game-page {
    --field-quarter-turn: 1;
    position: fixed;
    top: env(safe-area-inset-top);
    left: calc(100% - env(safe-area-inset-right));
    width: calc(var(--view-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    height: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right));
    transform-origin: top left;
    transform: rotate(90deg);
  }
  body[data-scene='game'] dialog[open] {
    position: fixed;
    inset: 50% auto auto 50%;
    margin: 0;
    width: max-content;
    max-width: min(90vh, 560px);
    max-height: 92vw;
    transform: translate(-50%, -50%) rotate(90deg);
  }
  body[data-scene='game'] .modal-inner { min-width: min(72vh, 392px); padding: 16px 22px; }
  body[data-scene='game'] .play-guide { width: min(460px, calc(var(--view-height) * .9 - 52px)); }
  .hud-top { top: 6px; }
  .hud-level, .scorebox { padding: 4px 8px; }
  .hud-level b { font-size: 14px; }
  .hud-tools { top: 55px; }
  .hud-bottom { bottom: 5px; }
  #tip {
    position: fixed;
    top: 7px;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(var(--view-height) * .4);
    padding: 4px 8px;
    font-size: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:after {
    animation-duration: 0.001s !important;
    transition: none !important;
  }
}
@media (max-height: 600px) and (orientation: landscape) {
  #tip {
    position: fixed;
    top: 52px;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    max-width: 40vw;
    padding: 4px 8px;
  }
}
@media (min-width: 760px) and (min-height: 601px), (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .hud-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
  }
  .ammo-caption {
    justify-self: start;
    padding: 4px 10px;
    font-size: clamp(14px, 1.1vw, 17px);
  }
  #tip {
    grid-column: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    width: max-content;
    max-width: min(70vw, 1040px);
    padding: 9px 16px;
    background: #fff8e6;
    box-shadow: 0 2px 0 #8e7656;
    font-size: clamp(18px, 1.35vw, 22px);
    line-height: 1.45;
    text-align: left;
  }
  #tip strong {
    flex: none;
    margin: 0;
    padding-right: 12px;
    border-right: 1px solid #c6ae8b;
    font-size: clamp(20px, 1.5vw, 25px);
    line-height: 1.3;
  }
  #skip {
    grid-column: 3;
    justify-self: end;
  }
  .rack-label, .scorebox small {
    font-size: 14px;
  }
  #queue button {
    font-size: clamp(9px, calc(var(--cell) * .23), 12px);
  }
  .hud-level small {
    font-size: 12px;
  }
}
