@font-face {
  font-family: "MrTomato Pixel";
  src: url("../../assets/fonts/fusion-pixel-10px-mrtomato-ui.woff") format("woff");
  font-display: swap;
  font-weight: 400;
  font-style: normal;
}

:root {
  --ink: #2b1b14;
  --ink-deep: #160d09;
  --wood-deep: #67301b;
  --wood-mid: #8c4022;
  --wood-light: #b25d32;
  --cream: #f0c27a;
  --cream-hi: #fff2d6;
  --amber: #f4a33a;
  --tomato: #b94732;
  --tomato-hi: #d96645;
  --teal: #1f4e4b;
  --teal-mid: #4f7a76;
  --leaf: #4e7138;
  --muted: #b99569;
  font-family: "MrTomato Pixel", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.formal-ui {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  color: var(--cream-hi);
  font-family: inherit;
  text-rendering: geometricPrecision;
  pointer-events: none;
}

.formal-ui button, .formal-ui label { pointer-events: auto; }

.battle-hud {
  position: absolute;
  inset:
    max(12px, var(--safe-area-inset-top, env(safe-area-inset-top, 0px)))
    max(12px, var(--safe-area-inset-right, env(safe-area-inset-right, 0px)))
    auto
    max(12px, var(--safe-area-inset-left, env(safe-area-inset-left, 0px)));
  z-index: 30;
  height: 116px;
  pointer-events: none;
}

.hud-stack {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 228px;
  gap: 4px;
}

.instrument {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 7px 4px 5px;
  border: 3px solid var(--ink);
  background: var(--wood-deep);
  box-shadow: 4px 4px 0 var(--ink-deep);
}

.instrument::after {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 8px;
  height: 8px;
  border-top: 3px solid var(--ink);
  border-left: 3px solid var(--ink);
  background: var(--wood-mid);
  content: "";
}

.instrument-icon {
  position: relative;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin-right: 7px;
  border: 2px solid var(--ink);
  background: var(--wood-mid);
}

.pixel-heart::before {
  position: absolute;
  inset: 4px 3px 3px;
  background: var(--tomato-hi);
  clip-path: polygon(0 17%,17% 17%,17% 0,42% 0,50% 17%,58% 0,83% 0,83% 17%,100% 17%,100% 50%,83% 50%,83% 67%,67% 67%,67% 83%,50% 83%,50% 100%,42% 100%,42% 83%,25% 83%,25% 67%,8% 67%,8% 50%,0 50%);
  content: "";
}

.pixel-flame::before {
  position: absolute;
  inset: 3px 5px 3px 4px;
  background: var(--amber);
  clip-path: polygon(53% 0,73% 20%,73% 38%,93% 25%,100% 57%,87% 88%,67% 100%,27% 100%,7% 82%,0 50%,20% 30%,27% 62%,47% 47%);
  content: "";
}

.pixel-shield::before {
  position: absolute;
  inset: 3px 4px;
  background: var(--teal-mid);
  clip-path: polygon(50% 0,100% 20%,100% 60%,83% 60%,83% 80%,50% 100%,17% 80%,17% 60%,0 60%,0 20%);
  content: "";
}

.instrument-body { display: grid; flex: 1; gap: 2px; min-width: 0; }
.instrument-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  min-width: 0;
  color: var(--cream-hi);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}
.instrument-line b { color: var(--cream); font-weight: 400; font-variant-numeric: tabular-nums; }

.segment-meter {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0,1fr);
  gap: 2px;
  height: 9px;
  background: transparent;
}
.segment-meter > i {
  position: relative;
  display: block;
  min-width: 3px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: var(--ink-deep);
}
.segment-meter > i::before {
  position: absolute;
  inset: 0;
  width: var(--segment-fill,0%);
  background: var(--segment-color,var(--cream));
  content: "";
  transition: width 120ms steps(4,end);
}
.segment-meter-hp { --segment-color: var(--tomato-hi); }
.segment-meter-heat { --segment-color: var(--amber); }
.segment-meter-armor { --segment-color: var(--teal-mid); }

.wave-instrument {
  position: absolute;
  top: 0;
  left: 50%;
  display: grid;
  min-width: 152px;
  padding: 5px 18px 6px;
  border: 3px solid var(--ink);
  background: var(--wood-deep);
  box-shadow: 4px 4px 0 var(--ink-deep);
  text-align: center;
  transform: translateX(-50%);
}
.wave-instrument::before, .wave-instrument::after {
  position: absolute;
  top: 8px;
  width: 7px;
  height: 22px;
  background: var(--wood-mid);
  content: "";
}
.wave-instrument::before { left: -7px; border: 3px solid var(--ink); border-right: 0; }
.wave-instrument::after { right: -7px; border: 3px solid var(--ink); border-left: 0; }
.wave-label { color: var(--cream); font-size: 12px; line-height: 1.2; }
.wave-instrument strong {
  color: var(--cream-hi);
  font-size: 21px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  line-height: 1.05;
  text-shadow: 2px 2px 0 var(--ink-deep);
}
.wave-notch {
  position: absolute;
  bottom: -7px;
  left: 50%;
  width: 24px;
  height: 7px;
  border: 3px solid var(--ink);
  border-top: 0;
  background: var(--wood-mid);
  transform: translateX(-50%);
}

.map-status-strip {
  position: absolute;
  top: 120px;
  left: 0;
  display: flex;
  min-height: 32px;
  padding: 4px 8px;
  border: 3px solid var(--ink);
  gap: 8px;
  align-items: center;
  background: var(--wood-deep);
  box-shadow: 4px 4px 0 var(--ink-deep);
  color: var(--cream-hi);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}
.map-status-name { color: var(--cream-hi); }
.map-status-luck { padding-left: 8px; border-left: 2px solid var(--wood-light); color: var(--amber); font-variant-numeric: tabular-nums; }
@container game-stage (max-height: 430px) or (max-width: 760px) {
  .map-status-strip { top: 54px; left: 50%; transform: translateX(-50%); }
}

.hud-actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  pointer-events: auto;
}
.egg-counter {
  display: flex;
  align-items: center;
  min-width: 82px;
  height: 44px;
  margin-top: 2px;
  padding: 4px 9px 4px 6px;
  border: 3px solid var(--ink);
  background: var(--wood-deep);
  box-shadow: 4px 4px 0 var(--ink-deep);
}
.egg-counter img { width: 23px; height: 28px; object-fit: contain; image-rendering: pixelated; }
.egg-counter span {
  min-width: 3ch;
  color: var(--cream-hi);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  line-height: 1;
  text-align: right;
}

.pixel-medallion { position: relative; width: 56px; height: 56px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.medallion-face {
  position: absolute;
  inset: 2px;
  display: grid;
  place-items: center;
  background: var(--ink);
  clip-path: polygon(10px 0,42px 0,42px 3px,49px 3px,49px 10px,52px 10px,52px 42px,49px 42px,49px 49px,42px 49px,42px 52px,10px 52px,10px 49px,3px 49px,3px 42px,0 42px,0 10px,3px 10px,3px 3px,10px 3px);
  filter: drop-shadow(4px 4px 0 var(--ink-deep));
  transition: transform 80ms steps(2, end), filter 80ms steps(2, end);
}
.medallion-face::before {
  position: absolute;
  inset: 4px;
  background: var(--teal);
  clip-path: polygon(8px 0,36px 0,36px 3px,41px 3px,41px 8px,44px 8px,44px 36px,41px 36px,41px 41px,36px 41px,36px 44px,8px 44px,8px 41px,3px 41px,3px 36px,0 36px,0 8px,3px 8px,3px 3px,8px 3px);
  box-shadow: inset 0 0 0 3px var(--teal-mid);
  content: "";
}
.medallion-face::after { position: absolute; inset: 10px; border: 2px solid var(--cream); opacity: .45; content: ""; }
.pixel-medallion:active .medallion-face, .pixel-medallion.is-pressed .medallion-face {
  filter: drop-shadow(1px 1px 0 var(--ink-deep)); transform: translate(2px,2px);
}
.pixel-medallion:focus-visible, .pixel-button:focus-visible, .text-button:focus-visible,
.upgrade-card:focus-visible, .shop-card button:focus-visible, .board-slot:focus-visible,
.inventory-item button:focus-visible, .review-toolbar button:focus-visible {
  outline: 3px solid var(--amber); outline-offset: 3px;
}
.pause-glyph { position: relative; z-index: 2; width: 20px; height: 24px; }
.pause-glyph::before, .pause-glyph::after {
  position: absolute; top: 2px; width: 7px; height: 20px; border: 2px solid var(--ink); background: var(--cream-hi); content: "";
}
.pause-glyph::before { left: 0; }
.pause-glyph::after { right: 0; }
.gear-glyph {
  position: relative;
  z-index: 2;
  width: 26px;
  height: 26px;
  background: var(--cream-hi);
  clip-path: polygon(8px 0,18px 0,18px 3px,22px 3px,22px 7px,26px 7px,26px 19px,22px 19px,22px 23px,18px 23px,18px 26px,8px 26px,8px 23px,4px 23px,4px 19px,0 19px,0 7px,4px 7px,4px 3px,8px 3px);
  filter: drop-shadow(2px 2px 0 var(--ink));
}
.gear-glyph::before { position: absolute; inset: 6px; border: 3px solid var(--ink); background: var(--amber); content: ""; }
.gear-glyph::after { position: absolute; inset: 11px; background: var(--ink); content: ""; }

.touch-joystick {
  --joystick-x: 0px;
  --joystick-y: 0px;
  --joystick-base-x: 199px;
  --joystick-base-y: 399px;
  position: absolute;
  top: calc(var(--joystick-base-y) - 43px);
  left: calc(var(--joystick-base-x) - 43px);
  z-index: 34;
  display: none;
  width: 86px;
  height: 86px;
  place-items: center;
  opacity: .82;
  pointer-events: none;
  transition: opacity 80ms steps(2,end);
}
.game-shell[data-runtime-target="xhs"] .touch-joystick.is-visible,
.game-shell[data-preview-mode="iphone"] .touch-joystick.is-visible { display: grid; }
@media (pointer: coarse) {
  .touch-joystick.is-visible { display: grid; }
}
.touch-joystick-frame {
  position: absolute;
  inset: 0;
  background: var(--ink);
  clip-path: polygon(18px 0,68px 0,68px 4px,78px 4px,78px 12px,84px 12px,84px 68px,78px 68px,78px 78px,68px 78px,68px 84px,18px 84px,18px 80px,8px 80px,8px 74px,2px 74px,2px 16px,8px 16px,8px 8px,18px 8px);
  filter: drop-shadow(4px 4px 0 var(--ink-deep));
}
.touch-joystick-frame::before {
  position: absolute;
  inset: 6px;
  background: rgb(103 48 27 / 88%);
  clip-path: polygon(14px 0,58px 0,58px 4px,68px 4px,68px 12px,74px 12px,74px 60px,68px 60px,68px 68px,58px 68px,58px 74px,14px 74px,14px 70px,6px 70px,6px 62px,0 62px,0 14px,6px 14px,6px 6px,14px 6px);
  box-shadow: inset 0 0 0 4px var(--wood-light);
  content: "";
}
.touch-joystick-cross {
  position: absolute;
  width: 50px;
  height: 50px;
  opacity: .52;
}
.touch-joystick-cross::before,
.touch-joystick-cross::after {
  position: absolute;
  background: var(--cream);
  content: "";
}
.touch-joystick-cross::before { top: 22px; left: 0; width: 50px; height: 6px; }
.touch-joystick-cross::after { top: 0; left: 22px; width: 6px; height: 50px; }
.touch-joystick-cap {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  background: var(--ink);
  clip-path: polygon(8px 0,26px 0,26px 3px,31px 3px,31px 8px,34px 8px,34px 26px,31px 26px,31px 31px,26px 31px,26px 34px,8px 34px,8px 31px,3px 31px,3px 26px,0 26px,0 8px,3px 8px,3px 3px,8px 3px);
  filter: drop-shadow(3px 3px 0 var(--ink-deep));
  transform: translate(var(--joystick-x), var(--joystick-y));
  transition: transform 35ms steps(2,end), filter 35ms steps(2,end);
}
.touch-joystick-cap::before {
  position: absolute;
  inset: 5px;
  background: var(--teal-mid);
  clip-path: polygon(5px 0,19px 0,19px 3px,24px 3px,24px 19px,19px 19px,19px 24px,5px 24px,5px 21px,0 21px,0 5px,5px 5px);
  content: "";
}
.touch-joystick-cap i {
  position: relative;
  z-index: 1;
  width: 8px;
  height: 8px;
  background: var(--cream-hi);
}
.touch-joystick.is-active { opacity: 1; }
.touch-joystick.is-active .touch-joystick-cap { filter: drop-shadow(1px 1px 0 var(--ink-deep)); }

.modal-scrim { position: absolute; inset: 0; z-index: 40; background: rgb(22 13 9 / 70%); }
.ui-modal {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 74px 18px 18px;
  pointer-events: none;
}
.ui-modal > * { pointer-events: auto; }
.start-modal { padding-top: 18px; }
.pixel-panel {
  position: relative;
  width: min(92%, 420px);
  padding: 24px 28px;
  border: 4px solid var(--ink);
  background: var(--wood-mid);
  box-shadow: 7px 7px 0 var(--ink-deep);
  text-align: center;
  clip-path: polygon(10px 0,calc(100% - 10px) 0,calc(100% - 10px) 4px,100% 4px,100% calc(100% - 10px),calc(100% - 4px) calc(100% - 10px),calc(100% - 4px) 100%,10px 100%,10px calc(100% - 4px),4px calc(100% - 4px),4px calc(100% - 10px),0 calc(100% - 10px),0 10px,4px 10px,4px 4px,10px 4px);
}
.pixel-panel::before { position: absolute; inset: 7px; border: 2px solid var(--cream); opacity: .38; pointer-events: none; content: ""; }
.panel-corners::before, .panel-corners::after {
  position: absolute; top: 14px; width: 7px; height: 7px; border: 2px solid var(--ink); background: var(--amber); content: "";
}
.panel-corners::before { left: 14px; }
.panel-corners::after { right: 14px; }
.panel-start { width: min(88%,440px); padding: 27px 38px 24px; background: var(--wood-deep); }
.sign-kicker, .modal-kicker { margin: 0 0 7px; color: var(--amber); font-size: 12px; letter-spacing: 2px; }
.sign-kicker { display: flex; align-items: center; justify-content: center; gap: 8px; }
.sign-kicker span:not([data-i18n]) { width: 18px; height: 3px; background: var(--amber); }
.panel-start h1, .pixel-panel h2 { margin: 0; color: var(--cream-hi); font-weight: 400; text-shadow: 3px 3px 0 var(--ink-deep); }
.panel-start h1 { color: #f36b48; font-size: clamp(38px,6.2vw,58px); letter-spacing: 5px; line-height: 1; }
.title-en { margin: 5px 0 0; color: var(--cream); font-size: 13px; letter-spacing: 5px; }
.title-divider { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px auto 11px; }
.title-divider i { width: 52px; height: 3px; background: var(--wood-light); }
.title-divider b { width: 9px; height: 9px; border: 2px solid var(--ink); background: var(--leaf); transform: rotate(45deg); }
.start-copy, .modal-copy { margin: 0 0 16px; color: var(--cream); font-size: 12px; line-height: 1.65; }

.pixel-button, .upgrade-card, .shop-card button {
  position: relative;
  min-height: 48px;
  border: 3px solid var(--ink);
  border-radius: 0;
  background: var(--wood-deep);
  box-shadow: 4px 4px 0 var(--ink-deep);
  color: var(--cream-hi);
  cursor: pointer;
  font-family: inherit;
  font-weight: 400;
  transition: translate 70ms steps(2,end), box-shadow 70ms steps(2,end);
}
.pixel-button::before, .shop-card button::before {
  position: absolute; inset: 3px; border: 2px solid rgb(255 242 214 / 24%); pointer-events: none; content: "";
}
.pixel-button:active, .shop-card button:active { box-shadow: 1px 1px 0 var(--ink-deep); translate: 2px 2px; }
.primary-button { background: var(--tomato); }
.secondary-button { background: var(--teal); }
.start-button { width: min(100%,230px); min-height: 58px; color: var(--cream-hi); font-size: 19px; letter-spacing: 2px; }
.button-spark { display: inline-block; width: 9px; height: 9px; margin-right: 10px; border: 2px solid var(--ink); background: var(--amber); transform: rotate(45deg); }
.text-button {
  min-width: 88px; min-height: 44px; border: 0; background: transparent; color: var(--cream); cursor: pointer;
  font-family: inherit; font-size: 12px; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px;
}
.control-hint { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.panel-compact { width: min(86%,360px); }
.pixel-panel h2 { font-size: 28px; letter-spacing: 2px; }
.button-column { display: grid; width: min(100%,240px); gap: 9px; margin: 18px auto 0; }
.panel-settings { width: min(90%,430px); }
.settings-list { display: grid; gap: 7px; margin: 17px 0 16px; text-align: left; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 8px 11px;
  border: 3px solid var(--ink); background: var(--wood-deep); box-shadow: 3px 3px 0 var(--ink-deep); cursor: pointer;
}
.setting-row > span:first-child { display: grid; gap: 4px; }
.setting-row b { color: var(--cream-hi); font-size: 13px; font-weight: 400; }
.setting-row small { color: var(--muted); font-size: 12px; }
.setting-row input { position: absolute; opacity: 0; }
.pixel-switch { position: relative; flex: 0 0 48px; width: 48px; height: 26px; border: 3px solid var(--ink); background: var(--wood-mid); }
.pixel-switch i { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border: 2px solid var(--ink); background: var(--cream); transition: left 100ms steps(3,end),background 100ms steps(2,end); }
.setting-row input:checked + .pixel-switch { background: var(--teal); }
.setting-row input:checked + .pixel-switch i { left: 25px; background: var(--amber); }
.setting-row:focus-within { outline: 3px solid var(--amber); outline-offset: 2px; }

.panel-wide { width: min(94%,720px); }
.modal-heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 17px; text-align: left; }
.pause-stamp {
  padding: 5px 8px; border: 2px solid var(--ink); background: var(--teal); color: var(--cream-hi);
  font-size: 12px; white-space: nowrap; box-shadow: 2px 2px 0 var(--ink-deep);
}
.upgrade-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; }
.upgrade-card { display: block; min-height: 150px; padding: 4px; overflow: hidden; background: var(--wood-deep); }
.upgrade-card:active { box-shadow: 4px 4px 0 var(--ink-deep); translate: 0; }
.upgrade-card-face {
  display: grid;
  min-height: 136px;
  padding: 8px 5px 10px;
  justify-items: center;
  align-content: start;
  gap: 7px;
  background: var(--wood-deep);
  box-shadow: inset 0 -3px 0 var(--ink-deep), inset 0 0 0 2px rgb(255 242 214 / 24%);
  transition: box-shadow 70ms steps(2,end);
}
.upgrade-card:active .upgrade-card-face {
  transform: translateY(2px);
  box-shadow: inset 0 -1px 0 var(--ink-deep), inset 0 0 0 2px rgb(255 242 214 / 24%);
}
@media (hover: hover) and (pointer: fine) {
  .upgrade-card:hover .upgrade-card-face {
    box-shadow: inset 0 -3px 0 var(--ink-deep), inset 0 0 0 2px var(--amber);
  }
  .upgrade-card:active .upgrade-card-face {
    box-shadow: inset 0 -1px 0 var(--ink-deep), inset 0 0 0 2px var(--amber);
  }
}
.upgrade-sigil { display: grid; width: 46px; height: 46px; place-items: center; border: 3px solid var(--ink); background: var(--teal); box-shadow: 3px 3px 0 var(--ink-deep); color: var(--amber); }
.upgrade-icon { position: relative; display: block; width: 28px; height: 28px; overflow: hidden; }
.upgrade-icon i, .upgrade-icon i::before, .upgrade-icon i::after { position: absolute; display: block; box-sizing: border-box; content: ""; }
.upgrade-icon--speed i {
  top: 6px; left: 7px; width: 18px; height: 16px; background: var(--ink);
  clip-path: polygon(6px 0,12px 0,12px 4px,18px 4px,18px 10px,14px 10px,14px 14px,4px 14px,4px 16px,0 16px,0 10px,6px 8px);
}
.upgrade-icon--speed i::before {
  top: 2px; left: 2px; width: 14px; height: 12px; background: var(--amber);
  clip-path: polygon(4px 0,10px 0,10px 4px,14px 4px,14px 8px,10px 8px,10px 10px,2px 10px,2px 12px,0 12px,0 8px,4px 6px);
}
.upgrade-icon--speed i::after { top: 1px; left: -6px; width: 4px; height: 3px; background: var(--cream-hi); box-shadow: 0 6px 0 var(--cream-hi), 2px 12px 0 var(--cream-hi); }
.upgrade-icon--damage i {
  top: 2px; left: 2px; width: 24px; height: 24px; background: var(--ink);
  clip-path: polygon(10px 0,14px 0,14px 4px,18px 2px,22px 4px,18px 8px,24px 10px,24px 14px,18px 16px,22px 20px,18px 22px,14px 20px,14px 24px,10px 24px,10px 20px,6px 22px,2px 20px,6px 16px,0 14px,0 10px,6px 8px,2px 4px,6px 2px,10px 4px);
}
.upgrade-icon--damage i::before { top: 5px; left: 5px; width: 14px; height: 14px; background: var(--amber); clip-path: polygon(7px 0,10px 4px,14px 7px,10px 10px,7px 14px,4px 10px,0 7px,4px 4px); }
.upgrade-icon--damage i::after { top: 10px; left: 10px; width: 4px; height: 4px; background: var(--cream-hi); }
.upgrade-icon--dodge i { top: 3px; left: 3px; width: 12px; height: 4px; background: var(--cream-hi); box-shadow: 4px 4px 0 var(--cream-hi), 8px 8px 0 var(--cream-hi); }
.upgrade-icon--dodge i::before { top: 14px; left: 4px; width: 16px; height: 4px; background: var(--amber); box-shadow: -4px 4px 0 var(--amber); }
.upgrade-icon--dodge i::after { top: 4px; left: 0; width: 4px; height: 4px; background: var(--ink); box-shadow: 16px 12px 0 var(--ink); }
.upgrade-icon--max-health i {
  top: 3px; left: 3px; width: 22px; height: 22px; background: var(--ink);
  clip-path: polygon(2px 0,8px 0,11px 3px,14px 0,20px 0,22px 2px,22px 10px,20px 10px,20px 14px,18px 14px,18px 16px,14px 16px,14px 18px,11px 22px,8px 18px,8px 16px,4px 16px,4px 14px,2px 14px,2px 10px,0 10px,0 2px);
}
.upgrade-icon--max-health i::before {
  top: 3px; left: 3px; width: 16px; height: 15px; background: var(--tomato-hi);
  clip-path: polygon(0 0,5px 0,8px 3px,11px 0,16px 0,16px 7px,14px 7px,14px 10px,11px 10px,11px 12px,8px 15px,5px 12px,5px 10px,2px 10px,2px 7px,0 7px);
}
.upgrade-icon--max-health i::after { top: 3px; left: 14px; width: 3px; height: 9px; background: var(--cream-hi); box-shadow: -3px 3px 0 var(--cream-hi), 3px 3px 0 var(--cream-hi); }
.upgrade-icon--attack-speed i {
  top: 4px; left: 4px; width: 20px; height: 22px; background: var(--ink);
  clip-path: polygon(4px 0,16px 0,16px 2px,18px 2px,18px 4px,20px 4px,20px 18px,18px 18px,18px 20px,16px 20px,16px 22px,4px 22px,4px 20px,2px 20px,2px 18px,0 18px,0 4px,2px 4px,2px 2px,4px 2px);
}
.upgrade-icon--attack-speed i::before { top: 4px; left: 4px; width: 12px; height: 14px; background: var(--amber); clip-path: polygon(2px 0,10px 0,12px 2px,12px 12px,10px 14px,2px 14px,0 12px,0 2px); }
.upgrade-icon--attack-speed i::after { top: 7px; left: 9px; width: 3px; height: 7px; background: var(--cream-hi); box-shadow: 3px 4px 0 var(--cream-hi), -3px -9px 0 var(--amber), 0 -9px 0 var(--amber), 3px -9px 0 var(--amber); }
.upgrade-icon--armor i {
  top: 2px; left: 3px; width: 22px; height: 24px; background: var(--ink);
  clip-path: polygon(4px 0,18px 0,18px 2px,22px 4px,22px 14px,20px 14px,20px 18px,18px 18px,18px 20px,11px 24px,4px 20px,4px 18px,2px 18px,2px 14px,0 14px,0 4px,4px 2px);
}
.upgrade-icon--armor i::before { top: 4px; left: 4px; width: 14px; height: 16px; background: var(--teal-mid); clip-path: polygon(0 0,14px 0,14px 9px,12px 9px,12px 12px,7px 16px,2px 12px,2px 9px,0 9px); }
.upgrade-icon--armor i::after { top: 7px; left: 9px; width: 4px; height: 4px; background: var(--cream-hi); box-shadow: 0 6px 0 var(--amber); }
.upgrade-icon--crit i { top: 8px; left: 8px; width: 12px; height: 12px; border: 3px solid var(--cream-hi); background: var(--ink); }
.upgrade-icon--crit i::before { top: -7px; left: 1px; width: 4px; height: 6px; background: var(--amber); box-shadow: 0 20px 0 var(--amber); }
.upgrade-icon--crit i::after { top: 1px; left: -7px; width: 6px; height: 4px; background: var(--amber); box-shadow: 20px 0 0 var(--amber); }
.upgrade-icon--pickup-radius i {
  top: 2px; left: 3px; width: 22px; height: 24px; background: var(--ink);
  clip-path: polygon(0 0,8px 0,8px 14px,10px 16px,12px 16px,14px 14px,14px 0,22px 0,22px 16px,20px 16px,20px 20px,16px 24px,6px 24px,2px 20px,2px 16px,0 16px);
}
.upgrade-icon--pickup-radius i::before { top: 3px; left: 3px; width: 16px; height: 18px; background: var(--amber); clip-path: polygon(0 0,4px 0,4px 12px,6px 14px,10px 14px,12px 12px,12px 0,16px 0,16px 14px,12px 18px,4px 18px,0 14px); }
.upgrade-icon--pickup-radius i::after { top: 0; left: 3px; width: 5px; height: 4px; background: var(--cream-hi); box-shadow: 11px 0 0 var(--cream-hi); }
.upgrade-icon--unknown i { top: 3px; left: 8px; width: 12px; height: 4px; background: var(--cream-hi); box-shadow: 8px 4px 0 var(--cream-hi), 8px 8px 0 var(--cream-hi), 4px 12px 0 var(--cream-hi), 4px 21px 0 var(--amber); }
.upgrade-card b { color: var(--cream-hi); font-size: 14px; font-weight: 400; }
.upgrade-card strong { color: var(--amber); font-size: 13px; font-weight: 400; }
.upgrade-card small { color: var(--muted); font-size: 12px; line-height: 1.5; }

.modal-scrim.is-intermission { background: rgb(174 91 51 / 18%); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .modal-scrim.is-intermission {
    background: rgb(174 91 51 / 12%);
    -webkit-backdrop-filter: blur(3px) saturate(.9);
    backdrop-filter: blur(3px) saturate(.9);
  }
}
.intermission-modal { padding: 0; place-items: stretch; }
.intermission-shell {
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(0,1fr) auto;
  overflow: hidden;
  border: 4px solid var(--ink);
  background: rgb(103 48 27 / 38%);
  box-shadow: inset 0 0 0 3px rgb(255 242 214 / 18%);
  text-align: left;
}
.intermission-main {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: 65fr 35fr;
}
.shop-zone, .core-zone { min-width: 0; min-height: 0; padding: 10px 12px; }
.shop-zone {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  gap: 8px;
  border-right: 4px solid var(--ink);
  background: rgb(140 64 34 / 70%);
}
.core-zone {
  display: grid;
  grid-template-rows: auto auto minmax(0,1fr) auto;
  gap: 5px;
  background: rgb(103 48 27 / 76%);
}
.shop-zone-header {
  display: grid;
  min-height: 58px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.intermission-title h2, .core-zone-header h2 { margin: 0; color: var(--cream-hi); font-size: 24px; font-weight: 400; line-height: 1; text-shadow: 2px 2px 0 var(--ink-deep); }
.intermission-title .modal-kicker, .core-zone-header .modal-kicker { margin-bottom: 4px; }
.shop-balance { display: grid; justify-items: center; color: var(--cream); font-size: 12px; }
.shop-balance strong, .reroll-button strong { display: flex; align-items: center; gap: 4px; color: var(--amber); font-weight: 400; font-variant-numeric: tabular-nums; }
.shop-balance strong { font-size: 22px; }
.shop-balance img, .reroll-button img { width: 18px; height: 22px; object-fit: contain; image-rendering: pixelated; }
.shop-balance b, .reroll-button b { font-weight: 400; }
.reroll-button { justify-self: end; display: grid; min-width: 92px; min-height: 48px; padding: 4px 8px; place-items: center; background: var(--teal); font-size: 12px; }
.reroll-button strong { font-size: 12px; }
.pixel-button:disabled, .shop-card button:disabled, .board-slot:disabled, .inventory-item button:disabled { background: var(--ink); box-shadow: 2px 2px 0 var(--ink-deep); color: var(--muted); cursor: not-allowed; opacity: .76; }

.shop-grid {
  position: absolute;
  top: 50vh;
  right: 12px;
  left: 12px;
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: 6px;
  align-items: stretch;
  transform: translateY(-50%);
}
.shop-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 204px;
  padding: 5px;
  border: 3px solid var(--ink);
  grid-template-rows: 44px minmax(0,1fr) 44px;
  justify-items: center;
  align-content: start;
  gap: 4px;
  background: var(--wood-deep);
  box-shadow: 3px 3px 0 var(--ink-deep);
  text-align: center;
}
.shop-card.is-locked { box-shadow: inset 0 0 0 3px var(--amber), 3px 3px 0 var(--ink-deep); }
.shop-card.is-bought { background: #395b35; }
.shop-card-top { display: flex; width: 100%; min-width: 0; max-width: 100%; min-height: 44px; align-items: center; justify-content: space-between; gap: 2px; overflow: hidden; }
.shop-kind { color: var(--cream); font-size: 12px; white-space: nowrap; }
.offer-lock-button { min-width: 44px; min-height: 44px; padding: 2px; border: 2px solid var(--ink); background: var(--wood-mid); color: var(--cream-hi); cursor: pointer; font-family: inherit; font-size: 12px; }
.shop-card-select {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 104px;
  padding: 3px;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
}
.shop-card-select::before { display: none; }
.shop-card-select:active { box-shadow: inset 0 0 0 2px var(--amber); translate: 0; }
.shop-art { display: grid; width: 48px; height: 48px; place-items: center; border: 3px solid var(--ink); background: var(--wood-mid); box-shadow: 2px 2px 0 var(--ink-deep); }
.shop-stat-art { background: var(--teal); }
.shop-art img { max-width: 38px; max-height: 38px; object-fit: contain; image-rendering: pixelated; }
.shop-name { overflow: hidden; max-width: 100%; color: var(--cream-hi); font-size: 14px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.quality-badge { padding: 2px 4px; border: 2px solid var(--ink); background: #756555; color: var(--cream-hi); font-size: 12px; line-height: 1.1; white-space: nowrap; }
.shop-price { display: flex; align-items: center; gap: 3px; color: var(--amber); font-size: 12px; white-space: nowrap; }
.shop-price img { width: 15px; height: 18px; object-fit: contain; image-rendering: pixelated; }
.offer-purchase-button { display: flex; width: 100%; min-width: 0; max-width: 100%; min-height: 44px; margin-top: auto; padding: 4px 6px; align-items: center; justify-content: space-between; gap: 5px; overflow: hidden; border: 3px solid var(--ink); background: var(--teal); box-shadow: inset 0 -2px 0 var(--ink-deep), 3px 3px 0 var(--ink-deep); color: var(--cream-hi); cursor: pointer; font-family: inherit; font-size: 12px; }
.offer-purchase-button > span:first-child { overflow: hidden; min-width: 0; flex: 1 1 auto; text-overflow: ellipsis; white-space: nowrap; }
.offer-purchase-button > .shop-price { min-width: 0; flex: 0 0 auto; }
.shop-card.is-bought .offer-purchase-button { background: var(--leaf); }
.shop-empty { grid-column: 1 / -1; place-self: center; margin: 0; color: var(--cream); font-size: 13px; }
.intermission-feedback { min-height: 20px; margin: 0; color: var(--cream); font-size: 12px; line-height: 1.4; }
.intermission-feedback.has-message { color: var(--amber); }
.shop-zone > .intermission-feedback { align-self: end; }

.shop-card.quality-normal, .quality-badge.quality-normal, .board-cell.quality-normal, .inventory-item.quality-normal { --quality-accent: #c9c2b6; }
.shop-card.quality-rare, .quality-badge.quality-rare, .board-cell.quality-rare, .inventory-item.quality-rare { --quality-accent: #4d83bd; }
.shop-card.quality-epic, .quality-badge.quality-epic, .board-cell.quality-epic, .inventory-item.quality-epic { --quality-accent: #8d5bb7; }
.shop-card.quality-legendary, .quality-badge.quality-legendary, .board-cell.quality-legendary, .inventory-item.quality-legendary { --quality-accent: #d8792e; }
.shop-card.quality-mythic, .quality-badge.quality-mythic, .board-cell.quality-mythic, .inventory-item.quality-mythic { --quality-accent: #d84d36; }
.shop-card[data-quality], .board-cell[data-quality], .inventory-item[data-quality] { border-color: var(--quality-accent); }
.quality-badge[data-quality] { border-color: var(--quality-accent); box-shadow: inset 0 -2px 0 var(--quality-accent); }

.core-zone-header { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 6px; }
.quality-placeholder { padding: 4px 5px; border: 2px solid var(--ink); background: #756555; color: var(--cream-hi); font-size: 12px; white-space: nowrap; }
.board-grid { display: grid; grid-template-columns: repeat(3,66px); grid-template-rows: repeat(3,66px); gap: 4px; justify-content: center; }
.board-cell {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: 2px;
  place-items: center;
  border: 3px solid var(--ink);
  background: var(--wood-mid);
  box-shadow: inset 0 -2px 0 var(--ink-deep), 3px 3px 0 var(--ink-deep);
  color: var(--cream-hi);
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  text-align: center;
}
.board-cell img { max-width: 46px; max-height: 42px; object-fit: contain; image-rendering: pixelated; }
.board-cell > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-core { border-color: var(--amber); background: var(--teal); }
.board-slot { cursor: pointer; }
.board-slot.is-equipped { background: var(--wood-mid); }
.board-slot.is-empty { color: var(--muted); }
.board-slot.is-selectable { background: var(--teal); box-shadow: inset 0 0 0 2px var(--amber), 3px 3px 0 var(--ink-deep); }
.slot-plus { color: var(--amber); font-size: 20px; }

.inventory-zone { min-width: 0; min-height: 0; overflow: hidden; }
.inventory-heading { display: flex; height: 24px; align-items: center; justify-content: space-between; }
.inventory-heading h3 { margin: 0; color: var(--cream-hi); font-size: 15px; font-weight: 400; }
.inventory-heading span { color: var(--cream); font-size: 12px; }
.inventory-list { display: flex; min-width: 0; min-height: 60px; gap: 5px; overflow-x: auto; padding: 2px 4px 4px 1px; scrollbar-color: var(--amber) var(--ink); }
.inventory-item { display: grid; flex: 0 0 188px; min-width: 0; padding: 3px; border: 2px solid var(--ink); grid-template-columns: minmax(0,1fr) 64px; gap: 4px; background: var(--wood-mid); box-shadow: 2px 2px 0 var(--ink-deep); }
.inventory-item.is-selected { box-shadow: inset 0 0 0 2px var(--amber), 2px 2px 0 var(--ink-deep); }
.inventory-identity { display: flex; min-width: 0; min-height: 48px; padding: 2px; align-items: center; gap: 5px; border: 0; background: transparent; color: inherit; cursor: pointer; font-family: inherit; text-align: left; }
.inventory-identity img { flex: 0 0 30px; width: 30px; height: 28px; object-fit: contain; image-rendering: pixelated; }
.inventory-identity span { display: grid; min-width: 0; gap: 2px; }
.inventory-identity b { overflow: hidden; color: var(--cream-hi); font-size: 12px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.inventory-identity small { overflow: hidden; color: var(--cream); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.inventory-sell-button { min-width: 0; min-height: 48px; padding: 2px; border: 2px solid var(--ink); background: var(--tomato); color: var(--cream-hi); cursor: pointer; font-family: inherit; font-size: 12px; }
.inventory-empty { margin: 10px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.board-feedback { min-height: 20px; }

.intermission-dock {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0,1fr) minmax(190px,35%);
  gap: 8px;
  padding: 6px 8px 8px;
  border-top: 4px solid var(--ink);
  background: rgb(43 27 20 / 92%);
}
.info-card {
  display: grid;
  min-width: 0;
  min-height: 64px;
  padding: 6px 8px;
  border: 3px solid var(--ink);
  grid-template-columns: minmax(180px,1.15fr) minmax(210px,1fr);
  gap: 10px;
  background: rgb(103 48 27 / 94%);
  box-shadow: inset 0 0 0 2px rgb(255 242 214 / 18%);
}
.info-copy { display: grid; min-width: 0; grid-template-columns: auto minmax(0,1fr); align-content: center; gap: 2px 8px; }
.info-kicker { color: var(--amber); font-size: 12px; white-space: nowrap; }
.info-copy strong { overflow: hidden; color: var(--cream-hi); font-size: 14px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.info-copy p { display: -webkit-box; grid-column: 1 / -1; overflow: hidden; margin: 0; color: var(--cream); font-size: 12px; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.info-facts { display: grid; min-width: 0; margin: 0; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; }
.info-facts div { display: grid; min-width: 0; align-content: center; gap: 2px; padding-left: 6px; border-left: 2px solid var(--wood-light); }
.info-facts dt { color: var(--muted); font-size: 12px; white-space: nowrap; }
.info-facts dd { overflow: hidden; margin: 0; color: var(--cream-hi); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.continue-button { width: 100%; min-height: 64px; font-size: 15px; white-space: nowrap; }

.panel-result { width: min(90%,480px); }
.result-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 18px 0; }
.result-stats span { display: grid; gap: 6px; padding: 10px 6px; border: 3px solid var(--ink); background: var(--wood-deep); }
.result-stats small { color: var(--muted); font-size: 12px; }
.result-stats b { color: var(--amber); font-size: 18px; font-weight: 400; font-variant-numeric: tabular-nums; }

.countdown-layer { position: absolute; top: 70px; left: 50%; z-index: 35; display: grid; min-width: 132px; justify-items: center; transform: translateX(-50%); }
.countdown-kicker { padding: 4px 8px; border: 2px solid var(--ink); background: var(--wood-deep); color: var(--cream); font-size: 12px; }
.countdown-layer strong { color: var(--amber); font-size: 76px; font-weight: 400; line-height: .95; text-shadow: 5px 5px 0 var(--ink); animation: countdown-pop 680ms steps(4,end) both; }
@keyframes countdown-pop { 0%{scale:.65;translate:0 7px} 50%{scale:1.08;translate:0 -2px} 100%{scale:1;translate:0 0} }

.spawn-review-layer { position: absolute; inset: 0; z-index: 25; }
.spawn-warning { position: absolute; width: 58px; height: 36px; transform: skewX(-12deg); animation: spawn-cross-blink 200ms steps(1,end) infinite; }
.spawn-warning i::before, .spawn-warning i::after {
  position: absolute; border: 3px solid var(--ink); background: #f03727; content: "";
}
.spawn-warning i::before { top: 13px; left: 0; width: 52px; height: 7px; transform: rotate(20deg); }
.spawn-warning i::after { top: 14px; left: 8px; width: 43px; height: 8px; transform: rotate(-28deg); }
.spawn-a { top: 42%; left: 28%; }
.spawn-b { right: 20%; bottom: 24%; animation-delay: -100ms; }
@keyframes spawn-cross-blink { 0%,49%{opacity:1} 50%,100%{opacity:.32} }

.review-toolbar {
  position: absolute; right: 8px; bottom: 8px; left: 8px; z-index: 100; display: flex; align-items: center; gap: 8px;
  padding: 5px 7px; border: 3px solid var(--ink); background: rgb(43 27 20 / 95%); box-shadow: 3px 3px 0 var(--ink-deep);
}
.review-toolbar > span { flex: 0 0 auto; color: var(--amber); font-size: 12px; }
.review-toolbar > div { display: flex; flex: 1; gap: 4px; overflow-x: auto; }
.review-toolbar button { flex: 0 0 auto; min-width: 44px; min-height: 44px; border: 2px solid var(--ink); background: var(--wood-deep); color: var(--cream); cursor: pointer; font-size: 12px; }
.review-toolbar button.is-active { background: var(--teal); color: var(--cream-hi); }

html[data-reduced-motion="true"] *, html[data-reduced-motion="true"] *::before, html[data-reduced-motion="true"] *::after {
  animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 1ms !important;
}
html[data-reduced-motion="true"] .spawn-warning { animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .spawn-warning { animation: none !important; }
}

@container game-stage (max-width: 760px) or (max-height: 430px) {
  .battle-hud { inset: 8px 8px auto; }
  .hud-stack { width: 188px; gap: 2px; }
  .instrument { min-height: 30px; padding-block: 2px; }
  .instrument-icon { flex-basis: 22px; width: 22px; height: 22px; margin-right: 4px; }
  .instrument-line { font-size: 12px; }
  .wave-instrument { min-width: 124px; padding-inline: 12px; }
  .wave-instrument strong { font-size: 17px; }
  .egg-counter { min-width: 68px; padding-inline: 4px 6px; }
  .egg-counter img { width: 19px; height: 24px; }
  .egg-counter span { font-size: 14px; }
  .hud-actions { gap: 4px; }
  .pixel-panel { padding: 14px 18px; }
  .panel-start { padding: 19px 30px 16px; }
  .panel-start h1 { font-size: 37px; }
  .control-hint { display: none; }
  .ui-modal { padding: 8px 12px; }
  .intermission-modal { padding: 0; }
  .settings-list { gap: 4px; margin: 10px 0; }
  .setting-row { min-height: 48px; padding: 5px 9px; }
  .upgrade-grid { gap: 5px; }
  .upgrade-card { min-height: 128px; padding: 3px; }
  .upgrade-card-face { min-height: 118px; padding: 4px 2px 6px; gap: 4px; }
  .upgrade-sigil { width: 38px; height: 38px; }
  .shop-zone, .core-zone { padding: 4px 6px; }
  .shop-zone { gap: 5px; }
  .core-zone { gap: 3px; }
  .shop-zone-header { min-height: 48px; }
  .intermission-title h2, .core-zone-header h2 { font-size: 19px; }
  .shop-balance strong { font-size: 17px; }
  .reroll-button { min-width: 80px; }
  .shop-grid { right: 6px; left: 6px; gap: 4px; }
  .shop-card { min-height: 160px; padding: 3px; gap: 3px; }
  .shop-card-top { min-height: 44px; }
  .shop-card-select { min-height: 66px; gap: 2px; }
  .shop-art { width: 36px; height: 36px; border-width: 2px; }
  .shop-art img { max-width: 30px; max-height: 28px; }
  .shop-name { font-size: 12px; }
  .offer-purchase-button { padding-inline: 2px; gap: 2px; }
  .board-grid { grid-template-columns: repeat(3,clamp(48px,6.45vw,60px)); grid-template-rows: repeat(3,clamp(48px,6.45vw,60px)); gap: 3px; }
  .board-cell img { max-width: 34px; max-height: 31px; }
  .inventory-heading { height: 20px; }
  .inventory-list { min-height: 50px; padding-bottom: 2px; }
  .inventory-item { flex-basis: 190px; grid-template-columns: minmax(0,1fr) 60px; align-items: center; }
  .inventory-identity { display: flex; min-height: 44px; }
  .inventory-identity img { flex-basis: 25px; width: 25px; height: 25px; }
  .inventory-identity small { display: none; }
  .inventory-sell-button { min-height: 44px; }
  .board-feedback { min-height: 18px; overflow: hidden; line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; }
  .intermission-dock { grid-template-columns: minmax(0,65fr) minmax(154px,35fr); gap: 5px; padding: 4px 5px 5px; }
  .info-card { min-height: 58px; padding: 4px 5px; grid-template-columns: minmax(0,1.35fr) minmax(0,.65fr); gap: 5px; }
  .info-copy { gap: 1px 5px; }
  .info-copy p { max-width: 100%; }
  .info-facts { grid-template-columns: 1fr; align-content: center; gap: 0; }
  .info-facts div { display: flex; min-width: 0; padding-left: 3px; align-items: baseline; gap: 3px; }
  .info-facts dt { flex: 0 0 24px; }
  .info-facts dt, .info-facts dd { overflow: hidden; text-overflow: ellipsis; }
  .continue-button { min-height: 58px; }
}

@container game-stage (max-width: 760px) and (orientation: landscape) {
  .shop-card-top { justify-content: flex-end; }
  .shop-kind, .quality-badge { display: none; }
  .core-zone-header .modal-kicker { display: none; }
  .quality-placeholder { max-width: 60px; white-space: normal; text-align: center; }
  .board-cell { border-width: 2px; box-shadow: inset 0 -2px 0 var(--ink-deep), 2px 2px 0 var(--ink-deep); }
  .board-cell > span:last-child { display: none; }
  .info-kicker { display: none; }
  .info-copy strong { grid-column: 1 / -1; }
}

/* TASK-042: preserve UI A while locking equal geometry and the approved 70/30 intermission. */
.panel-upgrade { width: min(96%,820px); }
.upgrade-card {
  width: 100%;
  height: 166px;
  min-height: 166px;
}
.upgrade-card-face {
  width: 100%;
  height: 152px;
  min-height: 152px;
  grid-template-rows: 46px 30px 24px minmax(0,1fr);
  align-content: stretch;
}
.upgrade-sigil { width: 46px; height: 46px; }
.upgrade-card b, .upgrade-card strong, .upgrade-card small {
  display: grid;
  width: 100%;
  min-width: 0;
  place-items: center;
  overflow: hidden;
  text-align: center;
}
.upgrade-card b { height: 30px; line-height: 1.25; }
.upgrade-card strong { height: 24px; line-height: 1.2; white-space: nowrap; }
.upgrade-card small {
  height: 32px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.intermission-shell { grid-template-rows: minmax(0,1fr) 142px; }
.intermission-main { grid-template-columns: 70fr 30fr; }
.shop-zone, .core-zone { padding: 0 6px; }
.shop-zone-header {
  min-height: 68px;
  padding: 2px 4px;
  gap: 10px;
}
.intermission-title h2 { font-size: 31px; }
.intermission-title .modal-kicker { font-size: 15px; }
.shop-balance { font-size: 15px; }
.shop-balance strong { font-size: 28px; }
.shop-balance img, .reroll-button img { width: 23px; height: 28px; }
.reroll-button { min-width: 118px; min-height: 60px; font-size: 15px; }
.reroll-button strong { font-size: 15px; }
.shop-grid { top: calc(50% + 44px); right: 8px; left: 8px; }

.core-zone {
  position: relative;
  grid-template-rows: 28px 228px 188px 0;
  gap: 0;
}
.core-zone-header { min-height: 28px; height: 28px; }
.core-zone-header h2 { font-size: 20px; }
.core-zone-header .modal-kicker { display: none; }
.quality-placeholder {
  min-width: 50px;
  padding: 3px 5px;
  border-color: var(--quality-accent,var(--ink));
  box-shadow: inset 0 -2px 0 var(--quality-accent,var(--ink));
  text-align: center;
}
.board-grid {
  grid-template-columns: repeat(3,74px);
  grid-template-rows: repeat(3,74px);
  gap: 3px;
  align-self: start;
}
.board-cell { overflow: hidden; }
.board-cell img { max-width: 48px; max-height: 44px; }
.board-cell > span:last-of-type { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-core { cursor: pointer; }
.board-core > span:not(.board-quality-label) {
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 2;
  padding: 1px 2px;
  background: var(--ink-deep);
  color: var(--cream-hi);
  line-height: 1;
}
.board-core img { max-width: 44px; max-height: 38px; }
.board-quality-label {
  position: absolute;
  right: 2px;
  bottom: 2px;
  padding: 1px 2px;
  border: 1px solid var(--ink);
  background: var(--ink-deep);
  color: var(--quality-accent,var(--cream));
  font-size: 12px;
  line-height: 1;
}

.shop-card.quality-normal, .quality-badge.quality-normal, .board-cell.quality-normal, .inventory-item.quality-normal, .quality-placeholder.quality-normal { --quality-accent: #d8c8a8; }
.shop-card.quality-rare, .quality-badge.quality-rare, .board-cell.quality-rare, .inventory-item.quality-rare, .quality-placeholder.quality-rare { --quality-accent: #4f88c7; }
.shop-card.quality-epic, .quality-badge.quality-epic, .board-cell.quality-epic, .inventory-item.quality-epic, .quality-placeholder.quality-epic { --quality-accent: #8d5ac4; }
.shop-card.quality-legendary, .quality-badge.quality-legendary, .board-cell.quality-legendary, .inventory-item.quality-legendary, .quality-placeholder.quality-legendary { --quality-accent: #e58a2b; }
.shop-card.quality-mythic, .quality-badge.quality-mythic, .board-cell.quality-mythic, .inventory-item.quality-mythic, .quality-placeholder.quality-mythic { --quality-accent: #d94832; --quality-secondary: #f2c14e; }
.quality-mythic[data-quality] { box-shadow: inset 0 0 0 2px var(--quality-secondary), 3px 3px 0 var(--ink-deep); }

.inventory-zone {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 44px 136px;
  overflow: hidden;
}
.inventory-heading {
  height: 44px;
  padding-right: 102px;
  align-items: center;
}
.inventory-heading > span { display: grid; min-width: 42px; gap: 1px; color: var(--cream); font-size: 12px; }
.inventory-heading b { font-weight: 400; white-space: nowrap; }
.inventory-list {
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 136px;
  padding: 0;
  grid-template-columns: repeat(4,minmax(0,1fr));
  grid-template-rows: repeat(3,44px);
  gap: 2px;
  overflow: hidden;
}
.inventory-item {
  position: relative;
  display: grid;
  flex: none;
  width: auto;
  min-width: 0;
  min-height: 44px;
  padding: 1px;
  border: 2px solid var(--quality-accent,var(--ink));
  grid-template-columns: minmax(0,1fr);
  gap: 0;
  background: var(--wood-mid);
  box-shadow: inset 0 -2px 0 var(--ink-deep);
}
.inventory-item.is-empty { border-color: var(--ink); background: rgb(43 27 20 / 48%); color: var(--muted); }
.inventory-empty-slot { place-self: center; font-size: 12px; }
.inventory-item.is-selected { box-shadow: inset 0 0 0 2px var(--amber), inset 0 -2px 0 var(--ink-deep); }
.inventory-item.is-equipped::before {
  position: absolute;
  top: 1px;
  left: 1px;
  z-index: 2;
  padding: 1px 2px;
  background: var(--leaf);
  color: var(--cream-hi);
  font-size: 12px;
  line-height: 1;
  content: "装";
}
.inventory-item.is-core::before { content: "锅"; background: var(--teal); }
.inventory-identity {
  display: grid;
  width: 100%;
  min-height: 44px;
  padding: 1px;
  grid-template-columns: 24px minmax(0,1fr);
  grid-template-rows: 1fr 1fr;
  align-items: center;
  gap: 0 2px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.inventory-identity img { grid-row: 1 / 3; width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; }
.inventory-identity b, .inventory-identity small {
  overflow: hidden;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inventory-identity small { color: var(--quality-accent,var(--cream)); }
.inventory-pagination {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(2,48px);
  gap: 2px;
}
.inventory-pagination button, .info-action-button {
  min-width: 44px;
  min-height: 44px;
  padding: 2px;
  border: 2px solid var(--ink);
  background: var(--teal);
  box-shadow: inset 0 -2px 0 var(--ink-deep);
  color: var(--cream-hi);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
}
.inventory-pagination button:disabled { background: var(--ink); color: var(--muted); cursor: not-allowed; }
.inventory-empty { position: absolute; right: 0; bottom: 54px; left: 0; z-index: 3; margin: 0; text-align: center; pointer-events: none; }

.intermission-dock {
  min-height: 88px;
  grid-template-columns: minmax(0,70fr) minmax(190px,30fr);
  padding: 4px 6px 6px;
}
.info-card {
  position: relative;
  min-height: 78px;
  padding: 5px 8px;
  grid-template-columns: minmax(0,1.35fr) minmax(190px,.75fr) 86px;
  gap: 7px;
}
.info-copy { grid-template-rows: 18px 20px 18px 18px; align-content: center; }
.info-copy p { display: block; overflow: hidden; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.info-effect { color: var(--amber) !important; }
.info-action-button { align-self: center; background: var(--tomato); }
.continue-button {
  display: grid;
  min-height: 78px;
  padding: 8px;
  place-items: center;
  gap: 5px;
  white-space: normal;
}
.continue-button strong { font-size: 16px; font-weight: 400; }
.continue-button span { color: var(--cream); font-size: 12px; line-height: 1.3; }

@container game-stage (max-height: 430px) or (max-width: 760px) {
  .upgrade-card { height: 148px; min-height: 148px; }
  .upgrade-card-face {
    height: 136px;
    min-height: 136px;
    padding: 4px 2px 5px;
    grid-template-rows: 46px 25px 22px minmax(0,1fr);
  }
  .upgrade-sigil { width: 46px; height: 46px; }
  .upgrade-card b { height: 25px; }
  .upgrade-card strong { height: 22px; }
  .upgrade-card small { height: 28px; }
  .intermission-shell { grid-template-rows: minmax(0,1fr) 82px; }
  .intermission-title h2 { font-size: 25px; }
  .intermission-title .modal-kicker { font-size: 12px; }
  .shop-zone-header { min-height: 58px; }
  .shop-balance { font-size: 12px; }
  .shop-balance strong { font-size: 22px; }
  .shop-balance img, .reroll-button img { width: 19px; height: 24px; }
  .reroll-button { min-width: 92px; min-height: 52px; font-size: 12px; }
  .shop-card { min-height: 160px; }
  .shop-grid { top: calc(50% + 41px); }
  .intermission-main { position: relative; }
  .core-zone { grid-template-rows: 28px 44px minmax(0,1fr) 0; }
  .core-zone-header { grid-row: 1; }
  .board-grid, .inventory-zone { grid-row: 3; }
  .board-grid {
    grid-template-columns: repeat(3,clamp(48px,7.7vw,54px));
    grid-template-rows: repeat(3,clamp(48px,7.7vw,54px));
    align-self: center;
  }
  .inventory-zone { width: max(100%,190px); justify-self: end; align-self: center; grid-template-rows: 44px 136px; background: rgb(103 48 27 / 96%); }
  .board-feedback { display: none; }
  .intermission-dock { min-height: 82px; grid-template-columns: minmax(0,70fr) minmax(170px,30fr); }
  .info-card { min-height: 72px; grid-template-columns: minmax(0,1fr) minmax(118px,.62fr) 68px; padding: 3px 5px; }
  .info-copy { grid-template-rows: 16px 18px 17px 17px; gap: 0 4px; }
  .info-kicker { display: none; }
  .info-copy strong { grid-column: 1 / -1; }
  .info-facts { grid-template-columns: 1fr; align-content: center; gap: 0; }
  .info-facts div { display: flex; min-width: 0; padding-left: 3px; align-items: baseline; gap: 3px; }
  .info-facts dt { flex: 0 0 24px; }
  .info-action-button { min-width: 64px; }
  .continue-button { min-height: 72px; padding: 4px; }
  .continue-button strong { font-size: 14px; }
}

/* TASK-046: UI A backpack, paginated pantry, and MrTomato closing ledger. */
.backpack-glyph {
  position: relative;
  z-index: 2;
  width: 24px;
  height: 21px;
  border: 3px solid var(--ink);
  background: var(--cream-hi);
  box-shadow: inset 0 -5px 0 var(--amber);
}
.backpack-glyph::before {
  position: absolute;
  top: -9px;
  left: 4px;
  width: 10px;
  height: 7px;
  border: 3px solid var(--ink);
  border-bottom: 0;
  content: "";
}
.backpack-glyph::after {
  position: absolute;
  top: 6px;
  left: 5px;
  width: 8px;
  height: 5px;
  border: 2px solid var(--ink);
  background: var(--tomato);
  content: "";
}

.panel-backpack {
  display: grid;
  width: min(94%,860px);
  height: min(78%,410px);
  min-height: 360px;
  padding: 16px 20px;
  grid-template-rows: 48px minmax(0,1fr) 48px;
  gap: 8px;
  text-align: left;
}
.panel-backpack > .panel-corners, .panel-result > .panel-corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.backpack-heading-row { min-width: 0; }
.backpack-heading-row h2 { font-size: 24px; }
.backpack-view-tabs { display: none; }
.backpack-layout {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: minmax(0,58fr) minmax(250px,42fr);
  gap: 10px;
}
.backpack-stats-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px;
}
.backpack-stat-group, .backpack-equipment-panel {
  min-width: 0;
  min-height: 0;
  padding: 8px;
  border: 3px solid var(--ink);
  background: rgb(103 48 27 / 94%);
  box-shadow: inset 0 0 0 2px rgb(255 242 214 / 14%), 3px 3px 0 var(--ink-deep);
}
.backpack-stat-group h3, .backpack-equipment-panel h3, .result-stat-panel h3, .result-build-panel h3 {
  margin: 0 0 7px;
  color: var(--amber);
  font-size: 16px;
  font-weight: 400;
}
.backpack-stat-list {
  display: grid;
  min-width: 0;
  margin: 0;
  grid-template-columns: minmax(0,1fr) auto;
  align-content: start;
  gap: 4px 7px;
}
.backpack-stat-list dt, .backpack-stat-list dd { min-width: 0; margin: 0; font-size: 12px; line-height: 1.25; }
.backpack-stat-list dt { color: var(--cream); }
.backpack-stat-list dd { overflow: hidden; color: var(--cream-hi); font-variant-numeric: tabular-nums; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.backpack-equipment-panel { display: grid; grid-template-rows: auto minmax(0,1fr) auto; align-items: center; }
.backpack-core-line { display: grid; min-width: 0; grid-template-columns: auto minmax(0,1fr); gap: 2px 7px; align-items: baseline; }
.backpack-core-line span { color: var(--muted); font-size: 12px; }
.backpack-core-line strong { overflow: hidden; color: var(--cream-hi); font-size: 14px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.backpack-core-line small { grid-column: 1 / -1; overflow: hidden; color: var(--cream); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.backpack-inventory-summary, .result-build-panel > p { margin: 5px 0 0; color: var(--cream); font-size: 12px; text-align: center; }
.backpack-close-button { width: min(100%,240px); min-height: 48px; justify-self: center; }

.summary-board {
  display: grid;
  grid-template-columns: repeat(3,52px);
  grid-template-rows: repeat(3,52px);
  place-content: center;
  gap: 3px;
}
.summary-board-cell {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: 2px;
  place-items: center;
  border: 2px solid var(--quality-accent,var(--ink));
  grid-template-rows: minmax(0,1fr) auto;
  background: var(--wood-deep);
  box-shadow: inset 0 -2px 0 var(--ink-deep), 2px 2px 0 var(--ink-deep);
  color: var(--muted);
  font-size: 12px;
}
.summary-board-cell.is-core { background: var(--teal); }
.summary-board-cell img { max-width: 31px; max-height: 29px; object-fit: contain; image-rendering: pixelated; }
.summary-board-cell small { overflow: hidden; max-width: 100%; color: var(--cream-hi); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.summary-board-cell b { position: absolute; right: 1px; bottom: 1px; padding: 1px; background: var(--ink-deep); color: var(--quality-accent,var(--cream)); font-size: 12px; font-weight: 400; line-height: 1; }

.core-zone { grid-template-rows: 28px 44px minmax(0,1fr) 0; }
.backpack-view-tabs button {
  min-width: 44px;
  min-height: 44px;
  border: 2px solid var(--ink);
  background: var(--teal);
  box-shadow: inset 0 -2px 0 var(--ink-deep);
  color: var(--cream-hi);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
}
.backpack-view-tabs button.is-active { border-color: var(--amber); background: var(--wood-mid); }
.board-grid, .inventory-zone { grid-row: 3; }
.board-grid { align-self: center; }
.inventory-zone {
  width: 100%;
  height: 232px;
  align-self: center;
  grid-template-rows: 44px 136px 48px;
  overflow: visible;
  background: rgb(103 48 27 / 78%);
}
.inventory-heading { height: 44px; padding: 0; gap: 4px; }
.inventory-heading h3 { display: flex; min-width: 0; align-items: baseline; gap: 5px; }
.inventory-heading h3 b { color: var(--cream); font-size: 12px; font-weight: 400; white-space: nowrap; }
.inventory-heading .info-action-button {
  flex: 0 0 84px;
  min-width: 84px;
  min-height: 44px;
  padding: 2px 4px;
  background: var(--tomato);
}
.inventory-heading .info-action-button:disabled { background: var(--ink); color: var(--muted); cursor: not-allowed; }
.inventory-footer {
  display: grid;
  min-width: 0;
  min-height: 48px;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 4px;
}
.inventory-footer > p { margin: 0; color: var(--cream); font-size: 12px; line-height: 1.25; }
.inventory-pagination {
  position: static;
  display: grid;
  grid-template-columns: 44px 34px 44px;
  align-items: stretch;
  gap: 2px;
}
.inventory-pagination span { display: grid; min-width: 0; place-items: center; color: var(--amber); font-size: 12px; font-variant-numeric: tabular-nums; }
.inventory-pagination button { min-width: 44px; min-height: 44px; padding: 2px; }
.inventory-empty { bottom: 54px; }
.inventory-empty { display: none; }
.board-feedback { display: none; }

.info-card {
  grid-template-columns: minmax(0,1.35fr) minmax(220px,.65fr);
  gap: 8px;
}
.info-copy { grid-template-rows: 20px 18px 18px; grid-template-columns: minmax(0,1fr); align-content: center; }
.info-copy strong { grid-column: 1; }
.info-facts {
  position: relative;
  grid-template-columns: repeat(2,minmax(0,1fr));
  align-content: center;
  gap: 5px;
  padding-left: 12px;
}
.info-facts::before {
  position: absolute;
  top: 50%;
  left: 2px;
  width: 2px;
  height: 34px;
  background: var(--wood-light);
  transform: translateY(-50%);
  content: "";
}
.info-facts div {
  display: grid;
  min-width: 0;
  min-height: 48px;
  padding: 4px 5px;
  align-content: center;
  gap: 2px;
  border: 2px solid var(--ink);
  background: var(--wood-deep);
  box-shadow: inset 0 -2px 0 var(--wood-light), 2px 2px 0 var(--ink-deep);
}
.info-facts dt, .info-facts dd { overflow: hidden; min-width: 0; text-overflow: ellipsis; white-space: nowrap; }

.panel-result {
  display: grid;
  width: min(95%,900px);
  height: min(80%,420px);
  min-height: 390px;
  padding: 16px 20px;
  grid-template-rows: 50px minmax(0,1fr) 48px;
  gap: 8px;
  text-align: left;
}
.result-heading { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 10px; }
.result-heading h2 { overflow: hidden; font-size: 25px; text-overflow: ellipsis; white-space: nowrap; }
.result-stamp { flex: 0 0 auto; padding: 6px 8px; border: 2px solid var(--ink); background: var(--leaf); box-shadow: 2px 2px 0 var(--ink-deep); color: var(--cream-hi); font-size: 12px; }
.result-ledger { display: grid; min-width: 0; min-height: 0; grid-template-columns: minmax(0,58fr) minmax(230px,42fr); gap: 9px; }
.result-stat-panel, .result-build-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: 8px;
  border: 3px solid var(--ink);
  background: rgb(103 48 27 / 94%);
  box-shadow: inset 0 0 0 2px rgb(255 242 214 / 14%);
}
.result-stat-panel { grid-template-rows: auto minmax(0,1fr); }
.result-stat-scroll { min-height: 0; overflow-y: auto; scrollbar-color: var(--amber) var(--ink); }
.result-stat-grid { display: grid; min-width: 0; margin: 0; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; }
.result-stat-grid div { min-width: 0; padding: 5px; border: 2px solid var(--ink); background: var(--wood-deep); box-shadow: inset 0 -2px 0 var(--ink-deep); }
.result-stat-grid dt { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.result-stat-grid dd { overflow: hidden; margin: 3px 0 0; color: var(--amber); font-size: 13px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.result-receipt-row { display: grid; margin-top: 5px; grid-template-columns: auto repeat(4,minmax(0,1fr)); align-items: center; gap: 3px; }
.result-receipt-row h4, .result-damage-sources h4 { margin: 0; color: var(--cream-hi); font-size: 12px; font-weight: 400; }
.result-receipt-row span { min-width: 0; padding: 3px; border-left: 2px solid var(--wood-light); color: var(--muted); font-size: 12px; white-space: nowrap; }
.result-receipt-row b { color: var(--cream-hi); font-weight: 400; }
.result-damage-sources { display: grid; margin-top: 5px; grid-template-columns: auto minmax(0,1fr); align-items: start; gap: 6px; }
.result-damage-sources ol { display: grid; min-width: 0; margin: 0; padding: 0; gap: 2px; list-style: none; }
.result-damage-sources li { display: flex; min-width: 0; justify-content: space-between; gap: 6px; color: var(--cream); font-size: 12px; }
.result-damage-sources b { color: var(--amber); font-weight: 400; }
.result-build-panel { grid-template-rows: auto auto minmax(0,1fr) auto; }
.result-core-line { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 6px; }
.result-core-line strong { overflow: hidden; color: var(--cream-hi); font-size: 14px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.result-core-line span { flex: 0 0 auto; padding: 2px 4px; border: 2px solid var(--ink); background: var(--wood-deep); color: var(--amber); font-size: 12px; }
.result-board { align-self: center; }
.result-actions { display: grid; grid-template-columns: minmax(0,1fr) minmax(190px,1fr) minmax(0,1fr); gap: 6px; }
.result-actions > * { min-width: 0; min-height: 44px; margin: 0; }
.result-actions .text-button { display: grid; place-items: center; }

.upgrade-icon--range i { top: 2px; left: 2px; width: 24px; height: 24px; background: var(--ink); clip-path: polygon(6px 0,18px 0,18px 2px,22px 2px,22px 6px,24px 6px,24px 18px,22px 18px,22px 22px,18px 22px,18px 24px,6px 24px,6px 22px,2px 22px,2px 18px,0 18px,0 6px,2px 6px,2px 2px,6px 2px); }
.upgrade-icon--range i::before { top: 4px; left: 4px; width: 16px; height: 16px; background: var(--teal); clip-path: polygon(4px 0,12px 0,12px 2px,16px 2px,16px 14px,12px 14px,12px 16px,4px 16px,4px 14px,0 14px,0 2px,4px 2px); }
.upgrade-icon--range i::after { top: 9px; left: 9px; width: 6px; height: 6px; background: var(--amber); box-shadow: 2px 2px 0 var(--cream-hi); }
.upgrade-icon--crit-multiplier i {
  top: 2px; left: 2px; width: 24px; height: 24px; background: var(--ink);
  clip-path: polygon(10px 0,14px 0,14px 4px,18px 2px,22px 4px,18px 8px,24px 10px,24px 14px,18px 16px,22px 20px,18px 22px,14px 20px,14px 24px,10px 24px,10px 20px,6px 22px,2px 20px,6px 16px,0 14px,0 10px,6px 8px,2px 4px,6px 2px,10px 4px);
}
.upgrade-icon--crit-multiplier i::before { top: 3px; left: 3px; width: 18px; height: 18px; background: var(--tomato); clip-path: polygon(7px 0,11px 0,11px 4px,15px 2px,18px 5px,14px 9px,18px 13px,15px 16px,11px 14px,11px 18px,7px 18px,7px 14px,3px 16px,0 13px,4px 9px,0 5px,3px 2px,7px 4px); }
.upgrade-icon--crit-multiplier i::after { top: 6px; left: 6px; width: 3px; height: 3px; background: var(--cream-hi); box-shadow: 3px 3px 0 var(--cream-hi), 6px 6px 0 var(--cream-hi), 9px 9px 0 var(--cream-hi), 9px 0 0 var(--cream-hi), 6px 3px 0 var(--cream-hi), 3px 6px 0 var(--cream-hi); }
.upgrade-icon--armor-penetration i {
  top: 2px; left: 3px; width: 22px; height: 24px; background: var(--ink);
  clip-path: polygon(4px 0,18px 0,18px 2px,22px 4px,22px 14px,20px 14px,20px 18px,18px 18px,18px 20px,11px 24px,4px 20px,4px 18px,2px 18px,2px 14px,0 14px,0 4px,4px 2px);
}
.upgrade-icon--armor-penetration i::before { top: 4px; left: 4px; width: 14px; height: 16px; background: var(--teal-mid); clip-path: polygon(0 0,14px 0,14px 9px,12px 9px,12px 12px,7px 16px,2px 12px,2px 9px,0 9px); }
.upgrade-icon--armor-penetration i::after { top: 15px; left: 2px; width: 4px; height: 4px; background: var(--cream-hi); box-shadow: 4px -4px 0 var(--cream-hi), 8px -8px 0 var(--cream-hi), 12px -12px 0 var(--cream-hi), 12px -8px 0 var(--cream-hi), 16px -12px 0 var(--cream-hi); }
.upgrade-icon--projectile-speed i { top: 7px; left: 12px; width: 14px; height: 14px; background: var(--ink); clip-path: polygon(4px 0,10px 0,10px 2px,12px 2px,12px 4px,14px 4px,14px 10px,12px 10px,12px 12px,10px 12px,10px 14px,4px 14px,4px 12px,2px 12px,2px 10px,0 10px,0 4px,2px 4px,2px 2px,4px 2px); }
.upgrade-icon--projectile-speed i::before { top: 2px; left: 2px; width: 10px; height: 10px; background: var(--amber); clip-path: polygon(3px 0,7px 0,7px 2px,9px 2px,9px 4px,10px 4px,10px 7px,8px 7px,8px 9px,6px 9px,6px 10px,3px 10px,3px 8px,1px 8px,1px 6px,0 6px,0 3px,2px 3px,2px 1px); }
.upgrade-icon--projectile-speed i::after { top: 1px; left: -10px; width: 8px; height: 3px; background: var(--cream-hi); box-shadow: -2px 5px 0 var(--cream-hi), 0 10px 0 var(--cream-hi); }
.upgrade-icon--heat-xp-gain i { top: 1px; left: 4px; width: 20px; height: 26px; background: var(--ink); clip-path: polygon(8px 0,12px 0,12px 4px,16px 8px,16px 12px,20px 10px,20px 18px,18px 18px,18px 22px,14px 22px,14px 24px,10px 26px,6px 24px,6px 22px,2px 22px,2px 18px,0 18px,0 12px,4px 8px,4px 14px,8px 10px); }
.upgrade-icon--heat-xp-gain i::before { top: 5px; left: 4px; width: 12px; height: 18px; background: var(--amber); clip-path: polygon(5px 0,8px 4px,8px 8px,12px 7px,12px 13px,10px 13px,10px 16px,6px 18px,2px 16px,2px 13px,0 13px,0 9px,4px 5px,4px 10px,6px 7px); }
.upgrade-icon--heat-xp-gain i::after { top: 11px; left: 8px; width: 4px; height: 10px; background: var(--tomato); }
.upgrade-icon--heal i { top: 3px; left: 3px; width: 22px; height: 22px; background: var(--ink); clip-path: polygon(7px 0,15px 0,15px 7px,22px 7px,22px 15px,15px 15px,15px 22px,7px 22px,7px 15px,0 15px,0 7px,7px 7px); }
.upgrade-icon--heal i::before { top: 3px; left: 3px; width: 16px; height: 16px; background: var(--cream-hi); clip-path: polygon(5px 0,11px 0,11px 5px,16px 5px,16px 11px,11px 11px,11px 16px,5px 16px,5px 11px,0 11px,0 5px,5px 5px); }
.upgrade-icon--heal i::after { top: 9px; left: 9px; width: 4px; height: 4px; background: var(--tomato-hi); }
.upgrade-icon--life-steal i {
  top: 1px; left: 4px; width: 20px; height: 26px; background: var(--ink);
  clip-path: polygon(8px 0,12px 0,12px 4px,14px 4px,14px 8px,16px 8px,16px 12px,18px 12px,18px 16px,20px 16px,20px 22px,18px 22px,18px 24px,14px 24px,14px 26px,6px 26px,6px 24px,2px 24px,2px 22px,0 22px,0 16px,2px 16px,2px 12px,4px 12px,4px 8px,6px 8px,6px 4px,8px 4px);
}
.upgrade-icon--life-steal i::before { top: 4px; left: 4px; width: 12px; height: 18px; background: var(--tomato); clip-path: polygon(5px 0,7px 0,7px 4px,9px 4px,9px 8px,11px 8px,11px 12px,12px 12px,12px 16px,10px 18px,2px 18px,0 16px,0 12px,1px 12px,1px 8px,3px 8px,3px 4px,5px 4px); }
.upgrade-icon--life-steal i::after { top: 8px; left: 5px; width: 3px; height: 7px; background: var(--cream-hi); box-shadow: 3px 7px 0 var(--amber); }
.upgrade-icon--luck i {
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: var(--ink);
  clip-path: polygon(8px 0,14px 0,14px 5px,19px 5px,19px 8px,22px 8px,22px 14px,19px 14px,19px 19px,14px 19px,14px 22px,8px 22px,8px 19px,3px 19px,3px 14px,0 14px,0 8px,3px 8px,3px 5px,8px 5px);
}
.upgrade-icon--luck i::before {
  top: 4px;
  left: 4px;
  width: 14px;
  height: 14px;
  background: var(--amber);
  clip-path: polygon(5px 0,9px 0,9px 4px,14px 4px,14px 9px,9px 9px,9px 14px,5px 14px,5px 9px,0 9px,0 4px,5px 4px);
}
.upgrade-icon--luck i::after { top: 9px; left: 9px; width: 4px; height: 4px; background: var(--cream-hi); }

@container game-stage (max-height: 430px) or (max-width: 760px) {
  .panel-backpack, .panel-result {
    width: min(98%,720px);
    height: calc(100% - 12px);
    min-height: 0;
    padding: 8px 10px;
    grid-template-rows: 42px 44px minmax(0,1fr) 44px;
    gap: 4px;
  }
  .backpack-heading-row h2, .result-heading h2 { font-size: 19px; }
  .backpack-view-tabs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px; }
  .backpack-layout { display: block; min-height: 0; }
  #backpackModal[data-backpack-view="stats"] [data-backpack-panel="equipment"],
  #backpackModal[data-backpack-view="equipment"] [data-backpack-panel="stats"] { display: none; }
  #backpackModal[data-backpack-view="stats"] [data-backpack-panel="stats"],
  #backpackModal[data-backpack-view="equipment"] [data-backpack-panel="equipment"] { display: grid; height: 100%; }
  .backpack-stats-panel { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .backpack-stat-group, .backpack-equipment-panel { padding: 5px 7px; }
  .backpack-stat-group h3, .backpack-equipment-panel h3 { margin-bottom: 4px; }
  .backpack-stat-list { gap: 2px 6px; }
  .backpack-close-button { min-height: 44px; }
  .summary-board { grid-template-columns: repeat(3,48px); grid-template-rows: repeat(3,48px); }

  .core-zone { grid-template-rows: 28px 44px minmax(0,1fr) 0; }
  .core-zone-header { display: flex; grid-row: 1; }
  .board-grid, .inventory-zone { grid-row: 3; }
  .inventory-zone { width: 100%; height: 232px; grid-template-rows: 44px 136px 48px; align-self: center; }
  .inventory-footer > p { max-width: 74px; }
  .inventory-heading .info-action-button { flex-basis: 78px; min-width: 78px; }

  .info-card { grid-template-columns: minmax(0,1fr) minmax(132px,.58fr); padding: 3px 5px; }
  .info-copy { grid-template-rows: 18px 17px 17px; gap: 0; }
  .info-facts { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px; padding-left: 9px; }
  .info-facts::before { left: 1px; height: 30px; }
  .info-facts div { display: grid; min-height: 44px; padding: 2px 3px; }

  .panel-result { grid-template-rows: 42px minmax(0,1fr) 44px; }
  .result-ledger { grid-template-columns: minmax(0,58fr) minmax(190px,42fr); gap: 5px; }
  .result-stat-panel, .result-build-panel { padding: 5px; }
  .result-stat-panel h3, .result-build-panel h3 { margin-bottom: 3px; }
  .result-stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px; }
  .result-stat-grid div { padding: 3px; }
  .result-receipt-row { grid-template-columns: auto repeat(2,minmax(0,1fr)); }
  .result-receipt-row h4 { grid-row: 1 / 3; }
  .result-actions { grid-template-columns: minmax(0,1fr) minmax(168px,1fr) minmax(0,1fr); gap: 3px; }
  .result-actions > * { min-height: 44px; font-size: 12px; }
}

@container game-stage (max-width: 600px) and (orientation: landscape) {
  .hud-stack { width: 160px; }
  .wave-instrument { min-width: 92px; padding-inline: 3px; }
  .hud-actions { gap: 0; }
  .egg-counter { min-width: 52px; padding-inline: 1px 2px; }
  .pixel-medallion { width: 44px; height: 44px; }
  .pixel-medallion .medallion-face { inset: 0; transform: scale(.82); transform-origin: top left; }
  .pixel-medallion:active .medallion-face, .pixel-medallion.is-pressed .medallion-face { transform: translate(2px,2px) scale(.82); }
  .intermission-shell {
    border-width: 2px;
    grid-template-rows: minmax(0,1fr) 44px;
  }
  .intermission-dock {
    min-height: 44px;
    height: 44px;
    padding: 0;
    border-top: 0;
    gap: 3px;
    box-shadow: inset 0 2px 0 var(--ink);
  }
  .info-card {
    min-height: 44px;
    height: 44px;
    padding: 2px 3px;
    border-width: 2px;
    grid-template-columns: minmax(0,1fr) minmax(122px,.7fr);
    gap: 3px;
  }
  .info-copy { grid-template-rows: 14px 13px 13px; }
  .info-copy strong, .info-copy p { line-height: 1; }
  .info-facts { padding-left: 6px; gap: 2px; }
  .info-facts::before { left: 0; height: 28px; }
  .info-facts div { min-height: 40px; padding: 1px 2px; }
  .continue-button { min-height: 44px; height: 44px; padding: 1px 2px; }
  .continue-button strong, .continue-button span { font-size: 12px; line-height: 1.1; }
  .panel-backpack {
    height: 100%;
    padding: 4px 6px;
    grid-template-rows: 36px 44px minmax(0,1fr) 44px;
    gap: 2px;
  }
  .panel-backpack .backpack-heading-row h2 { font-size: 16px; }
  .panel-backpack .backpack-stat-group, .panel-backpack .backpack-equipment-panel { padding: 3px 5px; }
  .panel-backpack .backpack-stat-group {
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: var(--amber) var(--ink);
  }
  .panel-backpack .backpack-stat-group h3, .panel-backpack .backpack-equipment-panel h3 { margin-bottom: 2px; }
  .panel-backpack .backpack-stat-list { gap: 1px 4px; }
  .panel-backpack .backpack-stat-list dt, .panel-backpack .backpack-stat-list dd { line-height: 1.1; }
  .panel-result {
    height: 100%;
    padding: 4px 6px;
    grid-template-rows: 36px minmax(0,1fr) 44px;
    gap: 2px;
  }
  .panel-result .result-heading h2 { font-size: 16px; }
  .panel-result .result-stat-panel, .panel-result .result-build-panel { padding: 3px; }
  .panel-result .result-build-panel h3 { display: none; }
  .panel-result .result-board {
    grid-template-columns: repeat(3,34px);
    grid-template-rows: repeat(3,34px);
  }
  .panel-result .summary-board-cell small, .panel-result .summary-board-cell b { display: none; }
  .result-ledger { grid-template-columns: minmax(0,58fr) minmax(172px,42fr); }
  .result-actions { grid-template-columns: minmax(0,1fr) minmax(154px,1fr) minmax(0,1fr); }
}

/* TASK-072: formal UI refinement and real run-continuation affordances. */
html,
body,
button,
input,
select,
textarea,
.formal-ui,
.formal-ui *,
.formal-ui *::before,
.formal-ui *::after {
  font-family: "MrTomato Pixel", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.active-run-actions {
  display: grid;
  width: min(100%,360px);
  margin: 2px auto 6px;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 5px;
}
.active-run-actions[hidden] { display: none; }
.active-run-actions p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--amber);
  font-size: 12px;
  line-height: 1.25;
}
.active-run-actions .pixel-button { min-height: 44px; padding: 4px 8px; font-size: 12px; }
.active-run-actions .pixel-button:only-of-type { grid-column: 1 / -1; }
.start-modal.has-active-run .title-divider,
.start-modal.has-active-run .start-copy,
.start-modal.has-active-run .control-hint { display: none; }

.wave-reward-toast {
  position: absolute;
  top: 84px;
  left: 50%;
  z-index: 70;
  max-width: min(86%,540px);
  margin: 0;
  padding: 9px 13px;
  border: 3px solid var(--ink);
  background: var(--teal);
  box-shadow: 4px 4px 0 var(--ink-deep), inset 0 0 0 2px rgb(255 242 214 / 20%);
  color: var(--cream-hi);
  font-size: 14px;
  line-height: 1.25;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  transform: translate(-50%,-10px);
}
.wave-reward-toast:not([hidden]) { display: flex; }
.wave-reward-toast strong { color: var(--amber); font-weight: 400; }
.wave-reward-toast img { width: 18px; height: 22px; object-fit: contain; image-rendering: pixelated; }
.wave-reward-toast.is-showing { animation: task072-wave-reward 240ms steps(5,end) both; }
@keyframes task072-wave-reward {
  from { opacity: 0; transform: translate(-50%,-10px); }
  to { opacity: 1; transform: translate(-50%,0); }
}

.panel-upgrade .upgrade-card { border-color: var(--upgrade-quality-color,var(--quality-accent,var(--ink))); }
.panel-upgrade .upgrade-card-face { position: relative; padding-top: 7px; padding-bottom: 20px; }
.upgrade-quality-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 3;
  max-width: calc(100% - 6px);
  padding: 1px 3px;
  border: 1px solid var(--ink);
  background: var(--ink-deep);
  color: var(--upgrade-quality-color,var(--quality-accent,var(--cream)));
  font-size: 12px;
  line-height: 1.1;
  white-space: nowrap;
}
.upgrade-condition {
  position: absolute;
  right: 3px;
  bottom: 3px;
  left: 3px;
  height: 13px !important;
  overflow: hidden;
  color: var(--cream) !important;
  font-size: 12px !important;
  line-height: 1.2 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upgrade-card.quality-normal { --quality-accent: #d8c8a8; }
.upgrade-card.quality-rare { --quality-accent: #4f88c7; }
.upgrade-card.quality-epic { --quality-accent: #8d5ac4; }
.upgrade-card.quality-legendary { --quality-accent: #e58a2b; }
.upgrade-card.quality-mythic { --quality-accent: #d94832; }

.info-copy { grid-template-rows: 18px repeat(3,17px); }
.info-condition { color: var(--muted) !important; }

.board-cell > img,
.board-core > img,
.board-cell > .board-item-visual,
.summary-board-cell img,
.summary-board-cell .summary-item-visual {
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
}
.board-cell > img,
.board-core > img,
.board-cell > .board-item-visual { max-width: 34px; max-height: 26px; }
.summary-board-cell img,
.summary-board-cell .summary-item-visual { max-width: 30px; max-height: 25px; }

.result-ledger { grid-template-columns: minmax(0,65fr) minmax(260px,35fr); }
.result-build-panel { grid-template-rows: auto minmax(0,1fr); gap: 4px; }
.result-build-panel .result-core-line,
.result-build-panel > p { display: none; }
.result-board {
  grid-template-columns: repeat(3,64px);
  grid-template-rows: repeat(3,64px);
  gap: 4px;
}
.result-build-panel .result-board {
  width: calc(100% - 8px);
  justify-self: center;
  grid-template-columns: repeat(3,minmax(0,1fr));
  grid-template-rows: none;
  grid-auto-rows: auto;
  place-content: stretch;
}
.result-build-panel .result-board .summary-board-cell { aspect-ratio: 1; }
.panel-result .result-board .summary-board-cell img,
.panel-result .result-board .summary-item-visual { max-width: 40px; max-height: 34px; }

html[data-reduced-motion="true"] .wave-reward-toast.is-showing { animation: none; transform: translate(-50%,0); }
@media (prefers-reduced-motion: reduce) {
  .wave-reward-toast.is-showing { animation: none; transform: translate(-50%,0); }
}

@container game-stage (max-height: 430px) or (max-width: 760px) {
  .active-run-actions { margin: 0 auto 2px; }
  .start-modal.has-active-run .difficulty-feedback { display: none; }
  .active-run-actions p { display: block; text-align: center; white-space: nowrap; }
  .active-run-actions .pixel-button { min-height: 44px; }
  .wave-reward-toast { top: 60px; font-size: 12px; }
  .info-copy { grid-template-rows: repeat(4,14px); }
  .result-board { grid-template-columns: repeat(3,50px); grid-template-rows: repeat(3,50px); }
  .panel-result .result-board .summary-board-cell img,
  .panel-result .result-board .summary-item-visual { max-width: 30px; max-height: 25px; }
}

/* TASK-049: large modal geometry and one-page intermission board/inventory flow. */
#backpackModal,
#upgradeModal,
#resultModal {
  padding: 8px;
}

.panel-backpack,
.panel-upgrade,
.panel-result {
  width: min(96%,920px);
  height: 88%;
  min-height: 0;
  max-height: none;
}

.panel-upgrade {
  display: grid;
  padding: 14px 18px;
  grid-template-rows: 52px minmax(0,1fr);
  gap: 8px;
}
.panel-upgrade > .panel-corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.panel-upgrade .modal-heading-row { min-height: 44px; margin: 0; }
.panel-upgrade .upgrade-grid {
  width: 100%;
  height: min(250px,100%);
  min-height: 0;
  align-self: center;
}
.panel-upgrade .upgrade-card,
.panel-upgrade .upgrade-card-face {
  height: 100%;
  min-height: 0;
}
.panel-upgrade .upgrade-card-face {
  grid-template-rows: 46px 30px 24px minmax(0,1fr);
}

.panel-backpack {
  grid-template-rows: 48px minmax(0,1fr) 48px;
}
.panel-backpack .backpack-stat-group {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--amber) var(--ink);
}

.panel-result {
  grid-template-rows: 50px minmax(0,1fr) 48px;
}

.core-zone {
  min-width: 0;
  grid-template-rows: 28px auto auto 0;
  align-content: start;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--amber) var(--ink);
}
.core-zone .board-grid,
.core-zone .inventory-zone {
  display: grid;
  grid-row: auto;
}
.core-zone .board-grid {
  grid-template-columns: repeat(3,64px);
  grid-template-rows: repeat(3,64px);
  align-self: start;
}
.core-zone .inventory-zone {
  width: 100%;
  height: 220px;
  min-height: 220px;
  grid-template-rows: 44px 132px 44px;
  align-self: start;
  overflow: visible;
}
.core-zone .inventory-list {
  height: 132px;
  min-height: 132px;
  grid-template-rows: repeat(3,44px);
}
.core-zone .inventory-heading { height: 44px; }
.core-zone .inventory-footer { min-height: 44px; }

@container game-stage (max-height: 430px) or (max-width: 760px) {
  #backpackModal,
  #upgradeModal,
  #resultModal {
    padding: 6px;
  }
  .panel-backpack,
  .panel-upgrade,
  .panel-result {
    width: 98%;
    height: calc(100% - 12px);
  }
  .panel-upgrade {
    padding: 8px 10px;
    grid-template-rows: 44px minmax(0,1fr);
    gap: 4px;
  }
  .panel-upgrade .upgrade-grid { height: 100%; }
  .panel-upgrade .upgrade-card-face {
    padding: 3px 2px 4px;
    gap: 2px;
    grid-template-rows: 42px 30px 24px minmax(0,1fr);
  }
  .panel-upgrade .upgrade-card small { line-height: 1.15; }

  .intermission-shell { grid-template-rows: minmax(0,1fr) 44px; }
  .intermission-dock {
    min-height: 44px;
    height: 44px;
    padding: 0;
    border-top-width: 2px;
  }
  .shop-grid { top: calc(50% + 22px); }
  .info-card,
  .continue-button {
    min-height: 44px;
    height: 44px;
  }
  .core-zone {
    grid-template-rows: 24px auto auto 0;
    gap: 0;
  }
  .core-zone-header { min-height: 24px; height: 24px; }
  .core-zone .board-grid {
    grid-template-columns: repeat(3,48px);
    grid-template-rows: repeat(3,48px);
    gap: 2px;
  }
  .core-zone .inventory-zone {
    width: max(100%,182px);
    min-width: 182px;
  }
  .core-zone .inventory-list {
    width: 182px;
    grid-template-columns: repeat(4,44px);
    gap: 0 2px;
  }
  .core-zone .inventory-item,
  .core-zone .inventory-identity {
    min-width: 44px;
    min-height: 44px;
  }

  .panel-backpack {
    grid-template-rows: 42px 44px minmax(0,1fr) 44px;
  }
  .panel-result {
    grid-template-rows: 42px minmax(0,1fr) 44px;
  }
}

@container game-stage (max-width: 600px) and (orientation: landscape) {
  .panel-backpack,
  .panel-upgrade,
  .panel-result {
    width: 100%;
    height: 100%;
  }
  .panel-upgrade { padding: 4px 6px; }
  .panel-upgrade .modal-heading-row h2 { font-size: 16px; }
  .panel-upgrade .upgrade-card { padding: 2px; }
  .panel-upgrade .upgrade-card-face {
    padding: 3px 2px 4px;
    gap: 2px;
    grid-template-rows: 38px 30px 24px minmax(0,1fr);
  }
  .panel-upgrade .upgrade-sigil { width: 38px; height: 38px; }
  .panel-upgrade .upgrade-card small { height: auto; }

  .core-zone {
    position: relative;
    width: auto;
    padding: 0 5px;
    border-left: 0;
    background: transparent;
  }
  .core-zone .board-grid {
    grid-template-columns: repeat(3,44px);
    grid-template-rows: repeat(3,44px);
    gap: 0;
  }
}

/* TASK-055: formal difficulty entry, final-wave Boss HUD, and result unlock receipt. */
.panel-start {
  width: min(94%,900px);
  padding: 15px 20px 13px;
}
.panel-start .sign-kicker { margin-bottom: 3px; }
.panel-start h1 { font-size: clamp(34px,5.2vw,52px); }
.panel-start .title-en { margin-top: 2px; }
.panel-start .title-divider { margin: 7px auto 6px; }
.panel-start .start-copy { margin-bottom: 7px; }
.difficulty-picker { display: grid; width: 100%; gap: 5px; margin-bottom: 7px; text-align: left; }
.difficulty-heading { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; }
.difficulty-heading h2 { color: var(--amber); font-size: 15px; letter-spacing: 1px; text-shadow: none; }
.difficulty-heading span {
  overflow: hidden;
  color: var(--cream);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.difficulty-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 5px; }
.difficulty-card {
  position: relative;
  display: grid;
  min-width: 44px;
  min-height: 112px;
  padding: 6px 5px;
  border: 3px solid var(--ink);
  grid-template-rows: auto auto minmax(0,1fr) auto;
  align-content: start;
  gap: 3px;
  background: var(--wood-mid);
  box-shadow: inset 0 -3px 0 var(--ink-deep), 3px 3px 0 var(--ink-deep);
  color: var(--cream-hi);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.difficulty-card::before { position: absolute; inset: 3px; border: 1px solid rgb(255 242 214 / 20%); pointer-events: none; content: ""; }
.difficulty-card.is-selected { border-color: var(--amber); background: var(--teal); box-shadow: inset 0 0 0 2px var(--cream), 3px 3px 0 var(--ink-deep); }
.difficulty-card.is-locked { background: var(--ink-deep); color: var(--muted); cursor: not-allowed; }
.difficulty-card-title { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 3px; }
.difficulty-card-title strong { color: inherit; font-size: 14px; font-weight: 400; white-space: nowrap; }
.difficulty-card-status { color: var(--amber); font-size: 12px; white-space: nowrap; }
.difficulty-card.is-locked .difficulty-card-status { color: var(--muted); }
.difficulty-multipliers { display: grid; min-width: 0; grid-template-columns: 1fr auto; gap: 1px 3px; }
.difficulty-multipliers span, .difficulty-multipliers b { overflow: hidden; font-size: 12px; font-weight: 400; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.difficulty-multipliers span { color: var(--cream); }
.difficulty-multipliers b { color: var(--cream-hi); font-variant-numeric: tabular-nums; text-align: right; }
.difficulty-card.is-locked .difficulty-multipliers span, .difficulty-card.is-locked .difficulty-multipliers b { color: var(--muted); }
.difficulty-unlock-copy { min-height: 28px; color: var(--cream); font-size: 12px; line-height: 1.15; }
.difficulty-card.is-locked .difficulty-unlock-copy { color: var(--amber); }
.difficulty-feedback { min-height: 14px; margin: 0; color: var(--amber); font-size: 12px; line-height: 1.15; text-align: center; }
.panel-start .start-button { min-height: 48px; }

.boss-hud {
  position: absolute;
  top: 70px;
  left: 50%;
  display: grid;
  width: min(370px,40vw);
  gap: 3px;
  transform: translateX(-50%);
  pointer-events: none;
}
.boss-objective {
  margin: 0;
  padding: 3px 6px;
  border: 2px solid var(--ink);
  background: rgb(43 27 20 / 92%);
  box-shadow: 2px 2px 0 var(--ink-deep);
  color: var(--amber);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
}
.boss-hud-list { display: grid; gap: 3px; }
.boss-row {
  display: grid;
  min-width: 0;
  min-height: 40px;
  padding: 4px 6px;
  border: 3px solid var(--ink);
  grid-template-columns: minmax(90px,.8fr) minmax(120px,1.2fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 6px;
  background: rgb(103 48 27 / 95%);
  box-shadow: 3px 3px 0 var(--ink-deep);
}
.boss-row.is-defeated { background: rgb(43 27 20 / 92%); color: var(--muted); }
.boss-name { overflow: hidden; color: var(--cream-hi); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.boss-health-text { color: var(--cream); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.boss-phase { grid-row: 1 / 3; grid-column: 3; color: var(--amber); font-size: 12px; white-space: nowrap; }
.boss-row.is-defeated .boss-name, .boss-row.is-defeated .boss-health-text, .boss-row.is-defeated .boss-phase { color: var(--muted); }
.boss-segment-meter {
  display: grid;
  height: 10px;
  grid-column: 1 / 3;
  grid-template-columns: repeat(12,minmax(0,1fr));
  gap: 2px;
}
.boss-segment-meter i { position: relative; overflow: hidden; border: 1px solid var(--ink); background: var(--ink-deep); }
.boss-segment-meter i::before { position: absolute; inset: 0; width: var(--segment-fill,0%); background: var(--tomato-hi); content: ""; }
.boss-row[data-boss-id="bottomless-table"] .boss-segment-meter i::before { background: var(--teal-mid); }
.boss-row.is-defeated .boss-segment-meter i::before { width: 0; }

.result-stamps { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; }
.result-difficulty {
  padding: 6px 8px;
  border: 2px solid var(--ink);
  background: var(--teal);
  box-shadow: 2px 2px 0 var(--ink-deep);
  color: var(--cream-hi);
  font-size: 12px;
  white-space: nowrap;
}
.difficulty-unlocked-notice {
  margin: 0;
  padding: 4px 8px;
  border: 2px solid var(--ink);
  background: var(--amber);
  box-shadow: 2px 2px 0 var(--ink-deep);
  color: var(--ink-deep);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
}
.panel-result { grid-template-rows: 50px auto minmax(0,1fr) 48px; }

@container game-stage (max-height: 430px) or (max-width: 760px) {
  .panel-start { width: 98%; max-height: calc(100% - 10px); padding: 6px 9px; }
  .panel-start .sign-kicker { margin-bottom: 1px; }
  .panel-start h1 { font-size: 30px; letter-spacing: 3px; }
  .panel-start .title-en { font-size: 12px; letter-spacing: 3px; }
  .panel-start .title-divider { display: none; }
  .panel-start .start-copy { margin: 2px 0 3px; line-height: 1.2; }
  .difficulty-picker { gap: 3px; margin-bottom: 3px; }
  .difficulty-heading h2 { font-size: 13px; }
  .difficulty-grid { gap: 2px; }
  .difficulty-card { min-height: 96px; padding: 3px; border-width: 2px; gap: 1px; box-shadow: inset 0 -2px 0 var(--ink-deep), 2px 2px 0 var(--ink-deep); }
  .difficulty-card-title strong { font-size: 12px; }
  .difficulty-unlock-copy { min-height: 26px; }
  .difficulty-feedback { min-height: 12px; }
  .panel-start .start-button { min-height: 44px; font-size: 14px; }
  .panel-start #startSettingsButton { min-height: 44px; }
  .panel-start .control-hint { display: none; }
  .boss-hud { top: 124px; width: min(420px,calc(100% - 24px)); }
  .boss-row { min-height: 36px; padding: 3px 5px; grid-template-columns: minmax(86px,.8fr) minmax(110px,1.2fr) auto; gap: 1px 4px; }
  .boss-objective { padding-block: 2px; }
  .panel-result { grid-template-rows: 42px auto minmax(0,1fr) 44px; }
}

@container game-stage (max-width: 600px) and (orientation: landscape) {
  .panel-start { height: calc(100% - 8px); overflow: hidden; }
  .panel-start .sign-kicker, .panel-start .start-copy { display: none; }
  .panel-start h1 { font-size: 25px; line-height: 1; }
  .difficulty-heading { min-height: 16px; }
  .difficulty-card { min-height: 91px; }
  .difficulty-card-title { display: grid; gap: 0; }
  .difficulty-card-status { line-height: 1; }
  .difficulty-unlock-copy { min-height: 25px; line-height: 1.05; }
  .panel-start .start-button { min-height: 44px; }
  .boss-hud { top: 124px; width: min(420px,calc(100% - 20px)); }
  .boss-row { grid-template-columns: minmax(80px,.75fr) minmax(108px,1.25fr) auto; }
  .panel-result { grid-template-rows: 36px auto minmax(0,1fr) 44px; }
  .result-difficulty, .result-stamp { padding: 3px 4px; }
}

/* TASK-059: seventh-round formal UI, consuming Snapshot / Event / Controller v3. */
.panel-upgrade {
  grid-template-rows: 52px minmax(0,1fr) 60px;
}
.upgrade-reroll-dock {
  display: grid;
  min-width: 0;
  min-height: 60px;
  grid-template-columns: minmax(0,1fr) minmax(180px,230px);
  align-items: stretch;
  gap: 8px;
}
.upgrade-reroll-copy {
  display: grid;
  min-width: 0;
  padding: 5px 8px;
  border: 2px solid var(--ink);
  grid-template-columns: auto auto;
  align-content: center;
  justify-content: start;
  gap: 2px 12px;
  background: var(--wood-deep);
  box-shadow: inset 0 -2px 0 var(--ink-deep);
  text-align: left;
}
.upgrade-reroll-copy strong { color: var(--amber); font-size: 13px; font-weight: 400; }
.upgrade-reroll-copy span { color: var(--cream-hi); font-size: 13px; white-space: nowrap; }
.upgrade-reroll-copy small { grid-column: 1 / -1; overflow: hidden; color: var(--cream); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.upgrade-reroll-copy small.has-message { color: var(--amber); }
.upgrade-reroll-button {
  display: flex;
  min-width: 180px;
  min-height: 48px;
  padding: 5px 10px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--teal);
}
.upgrade-reroll-button > span { text-align: left; }
.upgrade-reroll-button strong { display: flex; align-items: center; gap: 4px; color: var(--amber); font-weight: 400; white-space: nowrap; }
.upgrade-reroll-button img { width: 18px; height: 22px; object-fit: contain; image-rendering: pixelated; }
.upgrade-reroll-button b { color: inherit; font-weight: 400; }
.upgrade-reroll-button.is-exhausted:disabled { border-color: var(--muted); opacity: .64; }

.shop-card > .quality-badge {
  display: block;
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 4;
}
.attachment-placeholder {
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  background: var(--teal);
  color: var(--amber);
  font-size: 12px;
  line-height: 1;
}
.shop-art .attachment-placeholder { width: 34px; height: 34px; }
.shop-card-top { padding-right: 48px; }
.shop-card-top .offer-lock-button { flex: 0 0 44px; order: -1; }
.shop-card-top .shop-kind { overflow: hidden; min-width: 0; flex: 1 1 auto; text-overflow: ellipsis; }

.board-quality-label {
  top: 2px;
  right: 2px;
  bottom: auto;
  z-index: 4;
}
.board-cell .board-item-name,
.board-cell.board-core > span.board-item-name {
  position: absolute;
  top: auto;
  right: 2px;
  bottom: 2px;
  left: 2px;
  z-index: 3;
  display: block;
  overflow: hidden;
  width: calc(100% - 4px);
  height: 14px;
  min-height: 0;
  padding: 1px 2px;
  box-sizing: border-box;
  background: var(--ink-deep);
  color: var(--cream-hi);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-cell > img,
.board-core > img,
.board-cell > .board-item-visual {
  position: absolute;
  top: 20px;
  left: 50%;
  max-width: 34px;
  max-height: 26px;
  transform: translateX(-50%);
}
.board-cell > .board-item-visual { width: 26px; height: 26px; }

.inventory-quality-label {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 4;
  padding: 0 1px;
  border: 1px solid var(--ink);
  background: var(--ink-deep);
  color: var(--quality-accent,var(--cream));
  line-height: 1;
}
.inventory-item.is-equipped::before {
  display: grid;
  width: 12px;
  height: 12px;
  padding: 0;
  place-items: center;
}
.inventory-identity img,
.inventory-identity .inventory-item-visual {
  position: absolute;
  bottom: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
}
.inventory-identity .inventory-item-visual { width: 20px; height: 20px; }
.inventory-identity .inventory-item-name {
  position: absolute;
  right: 2px;
  bottom: 3px;
  left: 27px;
  line-height: 1;
  white-space: nowrap;
}

.summary-board-cell img,
.summary-board-cell .summary-item-visual {
  position: absolute;
  top: 18px;
  left: 3px;
  max-width: 26px;
  max-height: 17px;
}
.summary-board-cell .summary-item-visual { width: 22px; height: 17px; }
.summary-board-cell small {
  position: absolute;
  right: 2px;
  bottom: 2px;
  left: 2px;
  line-height: 1;
}
.summary-board-cell b {
  top: 1px;
  right: 1px;
  bottom: auto;
  z-index: 3;
  border: 1px solid var(--ink);
}

.difficulty-card { grid-template-rows: auto auto minmax(0,1fr) auto auto; }
.difficulty-clear-count {
  color: var(--amber);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
}
.difficulty-card.is-locked .difficulty-clear-count { color: var(--muted); }

.boss-hud { top: 62px; width: min(440px,46vw); }
.boss-hud.is-dual { width: min(460px,48vw); }
.boss-hud.is-dual .boss-hud-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
.boss-row {
  grid-template-columns: minmax(0,1fr) auto;
  grid-template-rows: auto auto auto;
}
.boss-name { grid-row: 1; grid-column: 1; }
.boss-phase { grid-row: 1; grid-column: 2; }
.boss-health-text { grid-row: 2; grid-column: 1 / -1; text-align: left; }
.boss-segment-meter { grid-row: 3; grid-column: 1 / -1; }

#resultTitle { font-family: "MrTomato Pixel", "PingFang SC", "Microsoft YaHei", sans-serif; }
.result-attribute-section { margin-top: 7px; }
.result-attribute-section h4 { margin: 0 0 3px; color: var(--cream-hi); font-size: 12px; font-weight: 400; }
.result-attribute-list {
  display: grid;
  margin: 0;
  grid-template-columns: auto minmax(0,1fr);
  gap: 2px 6px;
}
.result-attribute-list dt,
.result-attribute-list dd { overflow: hidden; min-width: 0; font-size: 12px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.result-attribute-list dt { color: var(--muted); }
.result-attribute-list dd { margin: 0; color: var(--amber); font-variant-numeric: tabular-nums; }
.result-actions { width: min(100%,660px); justify-self: center; }

.modal-scrim.is-result { animation: task059-result-dim 300ms steps(6,end) both; }
#resultModal:not([hidden]) .panel-result {
  transform-origin: center;
  animation: task059-result-panel 220ms steps(6,end) 300ms both;
}
@keyframes task059-result-dim {
  from { background-color: rgb(22 13 9 / 0%); }
  to { background-color: rgb(22 13 9 / 70%); }
}
@keyframes task059-result-panel {
  from { opacity: 0; transform: translateY(18px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes task059-result-panel-reduced {
  from { opacity: 0; transform: none; }
  to { opacity: 1; transform: none; }
}
html[data-reduced-motion="true"] .modal-scrim.is-result { animation-duration: 300ms !important; }
html[data-reduced-motion="true"] #resultModal:not([hidden]) .panel-result {
  animation-name: task059-result-panel-reduced !important;
  animation-duration: 1ms !important;
  animation-delay: 300ms !important;
  transform: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .modal-scrim.is-result { animation-duration: 300ms !important; }
  #resultModal:not([hidden]) .panel-result {
    animation-name: task059-result-panel-reduced !important;
    animation-duration: 1ms !important;
    animation-delay: 300ms !important;
    transform: none !important;
  }
}

@container game-stage (max-height: 430px) or (max-width: 760px) {
  .panel-upgrade { grid-template-rows: 44px minmax(0,1fr) 52px; }
  .upgrade-reroll-dock { min-height: 52px; grid-template-columns: minmax(0,1fr) minmax(154px,190px); gap: 4px; }
  .upgrade-reroll-copy { padding: 2px 5px; gap: 0 8px; }
  .upgrade-reroll-copy strong, .upgrade-reroll-copy span { font-size: 12px; }
  .upgrade-reroll-button { min-width: 154px; min-height: 44px; padding: 3px 6px; }
  .shop-card-top { padding-right: 42px; }
  .shop-card .shop-kind { display: none; }
  .board-cell > img, .board-core > img, .board-cell > .board-item-visual { top: 18px; max-width: 28px; max-height: 18px; }
  .boss-hud.is-dual { width: calc(100% - 24px); }
  .boss-hud.is-dual .boss-row { padding: 3px 4px; }
  .difficulty-unlock-copy { min-height: 14px; }
  .result-actions { width: min(100%,610px); }
}

@container game-stage (max-width: 600px) and (orientation: landscape) {
  .panel-upgrade { grid-template-rows: 38px minmax(0,1fr) 48px; }
  .upgrade-reroll-dock { min-height: 48px; grid-template-columns: minmax(0,1fr) 150px; }
  .upgrade-reroll-copy { grid-template-columns: 1fr; }
  .upgrade-reroll-copy span { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
  .upgrade-reroll-copy small { display: none; }
  .upgrade-reroll-button { min-width: 150px; }
  .panel-result .summary-board-cell b { display: block; }
  .panel-result .summary-board-cell img { top: 16px; max-width: 18px; max-height: 12px; }
  .difficulty-card { min-height: 96px; }
  .difficulty-unlock-copy { display: none; }
  .boss-hud.is-dual { width: calc(100% - 20px); }
  .boss-hud.is-dual .boss-hud-list { gap: 2px; }
  .boss-hud.is-dual .boss-objective { font-size: 12px; }
}

/* TASK-074: quality/name badges are independent overlays; never use them to offset the item artwork. */
.board-cell > img,
.board-core > img,
.board-cell > .board-item-visual,
.summary-board-cell img,
.summary-board-cell .summary-item-visual,
.panel-result .summary-board-cell img,
.panel-result .summary-board-cell .summary-item-visual {
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
}

/* TASK-075: one start-action rail, a compact upgrade reroll, and one centered result art box. */
.start-action-row {
  display: grid;
  width: min(100%,660px);
  margin: 2px auto 4px;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 6px;
}
.start-action-row button {
  width: 100%;
  min-width: 44px;
  min-height: 48px;
  margin: 0;
  padding: 4px 8px;
  font-size: 14px;
  letter-spacing: 1px;
}
.start-action-row button > * { pointer-events: none; }
.start-action-row .start-button { width: 100%; }
.start-action-row .settings-action-button { background: var(--wood-deep); }
.start-modal:not(.has-active-run) .start-action-row {
  width: min(100%,440px);
  grid-template-columns: minmax(0,2fr) minmax(88px,1fr);
}

.upgrade-reroll-dock {
  display: flex;
  min-height: 52px;
  align-items: stretch;
  justify-content: flex-end;
}
.upgrade-reroll-button {
  display: grid;
  min-width: 230px;
  min-height: 52px;
  grid-template-columns: minmax(0,1fr) auto;
  grid-template-rows: 1fr 1fr;
  align-items: center;
  gap: 0 8px;
}
.upgrade-reroll-button > span:first-child { grid-row: 1 / -1; text-align: left; }
.upgrade-reroll-button > strong { grid-column: 2; justify-self: end; }
.upgrade-reroll-button > small {
  grid-column: 2;
  color: var(--cream-hi);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.summary-board-cell .summary-art-box {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 36px;
  height: 30px;
  place-items: center;
  transform: translate(-50%,-50%);
  pointer-events: none;
}
.panel-result .summary-board-cell .summary-art-box { width: 48px; height: 40px; }
.summary-board-cell .summary-art-box img,
.panel-result .summary-board-cell .summary-art-box img,
.summary-board-cell .summary-art-box .summary-item-visual,
.panel-result .summary-board-cell .summary-art-box .summary-item-visual {
  position: static;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center;
  transform: none;
}

@container game-stage (max-height: 430px) or (max-width: 760px) {
  .start-action-row { gap: 3px; }
  .start-action-row button { min-height: 44px; padding: 2px 4px; font-size: 12px; letter-spacing: 0; }
  .start-action-row .button-spark { display: none; }
  .upgrade-reroll-button { min-width: 210px; min-height: 48px; }
  .panel-result .summary-board-cell .summary-art-box { width: 44px; height: 36px; }
}

/* TASK-075: contract-driven shop themes, one 4x4 inventory, and the full battle backpack. */
.shop-card[data-offer-theme="attachment"] {
  background: #6f351d;
  box-shadow: inset 0 0 0 2px #9b5830, 3px 3px 0 var(--ink-deep);
}
.shop-card[data-offer-theme="attachment"] .shop-card-select { background: #4f291b; }
.shop-card[data-offer-theme="attachment"] .shop-art { background: #d6a55e; border-color: #f1cf83; }
.shop-card[data-offer-theme="stat-upgrade"] {
  background: #205c59;
  box-shadow: inset 0 0 0 2px #4f9b8d, 3px 3px 0 var(--ink-deep);
}
.shop-card[data-offer-theme="stat-upgrade"] .shop-card-select { background: #173f43; }
.shop-card[data-offer-theme="stat-upgrade"] .upgrade-sigil {
  background: #326f68;
  border-color: #9bd4b5;
}
.shop-card[data-offer-theme="wok-core"] {
  background: #493b5b;
  box-shadow: inset 0 0 0 2px #806b99, 3px 3px 0 var(--ink-deep);
}

.core-zone .inventory-zone {
  height: 226px;
  grid-template-rows: 44px 182px;
}
.core-zone .inventory-list {
  display: grid;
  min-height: 182px;
  overflow: hidden;
  grid-template-columns: repeat(4,minmax(0,1fr));
  grid-template-rows: repeat(4,44px);
}

.panel-backpack {
  width: min(96%,920px);
  height: 86%;
  min-height: 0;
  grid-template-rows: 48px minmax(0,1fr) 48px;
  gap: 5px;
  padding: 10px 12px;
}
.backpack-layout {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0,1fr) 300px;
  gap: 8px;
}
.backpack-stats-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px;
}
.panel-backpack .backpack-stat-group,
.panel-backpack .backpack-equipment-panel { min-width: 0; padding: 7px 8px; }
.backpack-stat-list dt { font-size: 14px; line-height: 1.35; }
.backpack-stat-list dd { font-size: 15px; line-height: 1.35; }
.panel-backpack .backpack-equipment-panel {
  display: grid;
  min-height: 0;
  /* TASK-152: cap the board by this column's available inline size. */
  container-type: inline-size;
  grid-template-rows: auto minmax(0,1fr) auto;
  overflow: hidden;
}
.panel-backpack .summary-board {
  /* Use the shorter available axis; independent grid stretching distorted cells. */
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100cqw;
  aspect-ratio: 1;
  min-height: 0;
  margin: 0;
  align-self: center;
  justify-self: center;
  grid-template-columns: repeat(3,minmax(0,1fr));
  grid-template-rows: repeat(3,minmax(0,1fr));
  gap: 4px;
}
.panel-backpack .summary-board-cell { width: auto; height: auto; min-width: 0; min-height: 0; }
.panel-backpack .summary-board-cell small {
  position: absolute;
  right: 2px;
  bottom: 22px;
  left: 2px;
  text-align: center;
}
.panel-backpack .summary-board-cell b { top: auto; right: 2px; bottom: 2px; left: 2px; text-align: center; }
.panel-backpack .summary-board-cell .summary-art-box {
  top: 2px;
  width: 56%;
  height: calc(100% - 42px);
  grid-template-columns: minmax(0,1fr);
  grid-template-rows: minmax(0,1fr);
  transform: translateX(-50%);
}

@container game-stage (max-height: 430px) or (max-width: 760px) {
  .panel-backpack {
    width: 97%;
    height: 88%;
    padding: 7px 8px;
    grid-template-rows: 40px minmax(0,1fr) 44px;
  }
  .backpack-layout { display: grid; grid-template-columns: minmax(0,1fr) 240px; gap: 5px; }
  .backpack-stats-panel { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; }
  .panel-backpack .backpack-stat-group,
  .panel-backpack .backpack-equipment-panel { padding: 3px 4px; }
  .backpack-stat-list dt { font-size: 12px; line-height: 1.15; }
  .backpack-stat-list dd { font-size: 13px; line-height: 1.15; }
  .panel-backpack .summary-board { grid-template-columns: repeat(3,minmax(0,1fr)); grid-template-rows: repeat(3,minmax(0,1fr)); }
  .panel-backpack .summary-board-cell small { bottom: 20px; font-size: 12px; }
  .panel-backpack .summary-board-cell b { font-size: 12px; }
  .core-zone .inventory-zone { height: 226px; grid-template-rows: 44px 182px; }
  .core-zone .inventory-list { min-height: 182px; grid-template-rows: repeat(4,44px); }
}

/* TASK-075: pausing is retained beneath a full-stage, hard-edged resume countdown. */
.countdown-layer[data-countdown-kind="resume"] {
  inset: 0;
  z-index: 90;
  min-width: 0;
  place-content: center;
  gap: 8px;
  border: 4px solid var(--ink);
  background: rgb(43 27 20 / 76%);
  box-shadow: inset 0 0 0 4px rgb(255 242 214 / 18%), inset 0 0 0 8px rgb(103 48 27 / 48%);
  transform: none;
}
.countdown-layer[data-countdown-kind="resume"]::before {
  position: absolute;
  top: calc(50% - 82px);
  left: calc(50% - 74px);
  width: 148px;
  height: 164px;
  border: 4px solid var(--ink);
  background: var(--wood-deep);
  box-shadow: inset 0 0 0 3px var(--wood-light), 6px 6px 0 var(--ink-deep);
  content: "";
}
.countdown-layer[data-countdown-kind="resume"] .countdown-kicker,
.countdown-layer[data-countdown-kind="resume"] strong { position: relative; z-index: 1; }
.countdown-layer[data-countdown-kind="resume"] .countdown-kicker {
  min-width: 112px;
  text-align: center;
}
.countdown-layer[data-countdown-kind="resume"] strong {
  min-width: 96px;
  padding: 8px 12px 12px;
  border: 4px solid var(--ink);
  background: var(--tomato);
  box-shadow: inset 0 -6px 0 var(--tomato-deep), 5px 5px 0 var(--ink-deep);
  text-align: center;
}
html[data-reduced-motion="true"] .countdown-layer[data-countdown-kind="resume"] strong { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .countdown-layer[data-countdown-kind="resume"] strong { animation: none !important; }
}

/* TASK-077: result thumbnails share one optical slot without rewriting assets. */
.panel-result .summary-board-cell:not(.is-core) .summary-art-box[data-catalog-id] {
  overflow: hidden;
  isolation: isolate;
}
.panel-result .summary-board-cell:not(.is-core) .summary-art-box[data-catalog-id] .summary-item-visual {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  transform: scale(var(--result-thumbnail-scale,1));
  transform-origin: center;
}

/* The left info region exposes exactly effect, flavor, and condition. */
.info-copy {
  grid-template-rows: repeat(3,minmax(0,1fr));
}
@container game-stage (max-height: 430px) or (max-width: 760px) {
  .info-copy { grid-template-rows: repeat(3,minmax(0,1fr)); }
  .result-build-panel .result-board {
    width: min(calc(100% - 8px),117px);
    height: min(calc(100% - 8px),117px);
    align-self: center;
  }
  .panel-result .summary-board-cell .summary-art-box { width: 33px; height: 27px; }
}

/* TASK-087: XHS keeps a canonical 960x540 internal stage, so phone density cannot rely on viewport queries. */
.game-shell[data-runtime-target="xhs"] .result-build-panel .result-board,
.game-shell[data-preview-mode="iphone"] .result-build-panel .result-board {
  width: 192px;
  height: 192px;
  align-self: center;
}
.game-shell[data-runtime-target="xhs"] .panel-result .summary-board-cell .summary-art-box,
.game-shell[data-preview-mode="iphone"] .panel-result .summary-board-cell .summary-art-box {
  width: 36px;
  height: 30px;
}

/* TASK-081: every normal wok thumbnail uses the same uncropped, centered fit profile. */
.wok-core-visual {
  aspect-ratio: 281 / 126;
  object-fit: contain;
  object-position: 50% 50%;
  image-rendering: pixelated;
  transform-origin: 50% 50%;
}
.shop-art > .wok-core-visual {
  width: 78%;
  height: auto;
  max-width: none;
  max-height: none;
}
.board-core > .wok-core-visual {
  top: 50%;
  left: 50%;
  width: 78%;
  height: auto;
  max-width: none;
  max-height: none;
  transform: translate(-50%,-50%);
}
.inventory-identity > .wok-core-visual {
  top: 50%;
  bottom: auto;
  left: 3px;
  width: 24px;
  height: auto;
  transform: translateY(-50%);
}
.summary-board-cell.is-core .summary-art-box { overflow: visible; }
.summary-board-cell.is-core .summary-art-box > .wok-core-visual,
.panel-result .summary-board-cell.is-core .summary-art-box > .wok-core-visual {
  position: static;
  width: 100%;
  height: auto;
  max-width: none;
  max-height: none;
  transform: none;
}
.result-damage-sources li[data-source-id="other"] span { color: var(--cream-hi); }

/* TASK-092: real-phone readability, direct joystick response, and shop stat access. */
.touch-joystick.is-active .touch-joystick-cap {
  transition: filter 20ms steps(1,end);
}

.intermission-actions {
  display: grid;
  min-width: 0;
  align-self: stretch;
  grid-template-rows: 44px minmax(64px,1fr);
  gap: 6px;
}
.shop-stats-button {
  width: 100%;
  min-height: 44px;
  background: var(--teal);
  color: var(--cream-hi);
  font-size: 16px;
}

#backpackModal[data-backpack-context="shop"] .panel-backpack {
  width: min(88%,820px);
  height: 80%;
}
#backpackModal[data-backpack-context="shop"] {
  z-index: 60;
  background: rgb(22 13 9 / 36%);
  pointer-events: auto;
}
#backpackModal[data-backpack-context="shop"] .backpack-layout {
  grid-template-columns: minmax(0,1fr);
}
#backpackModal[data-backpack-context="shop"] .backpack-equipment-panel {
  display: none;
}
#backpackModal[data-backpack-context="shop"] .backpack-stats-panel {
  overflow: auto;
  overscroll-behavior: contain;
}

.game-shell[data-runtime-target="xhs"] .formal-ui,
.game-shell[data-preview-mode="iphone"] .formal-ui {
  font-size: 16px;
}
.game-shell[data-runtime-target="xhs"] :is(.modal-kicker,.pause-stamp,.hud-row,.hud-label,.hud-value,.boss-objective,.countdown-kicker,.intermission-feedback,.shop-kind,.quality-badge,.shop-price,.offer-lock-button,.offer-purchase-button,.quality-placeholder,.inventory-heading span,.inventory-identity b,.inventory-identity small,.inventory-sell-button,.inventory-empty,.info-copy p,.info-facts dt,.info-facts dd,.backpack-core-line span,.backpack-core-line small,.backpack-inventory-summary,.result-build-panel > p,.result-stats small),
.game-shell[data-preview-mode="iphone"] :is(.modal-kicker,.pause-stamp,.hud-row,.hud-label,.hud-value,.boss-objective,.countdown-kicker,.intermission-feedback,.shop-kind,.quality-badge,.shop-price,.offer-lock-button,.offer-purchase-button,.quality-placeholder,.inventory-heading span,.inventory-identity b,.inventory-identity small,.inventory-sell-button,.inventory-empty,.info-copy p,.info-facts dt,.info-facts dd,.backpack-core-line span,.backpack-core-line small,.backpack-inventory-summary,.result-build-panel > p,.result-stats small) {
  font-size: 16px;
}
.game-shell[data-runtime-target="xhs"] :is(.shop-name,.info-copy strong,.inventory-heading h3,.backpack-stat-group h3,.backpack-equipment-panel h3,.backpack-core-line strong,.backpack-stat-list dt,.backpack-stat-list dd,.settings-list,.result-stats b),
.game-shell[data-preview-mode="iphone"] :is(.shop-name,.info-copy strong,.inventory-heading h3,.backpack-stat-group h3,.backpack-equipment-panel h3,.backpack-core-line strong,.backpack-stat-list dt,.backpack-stat-list dd,.settings-list,.result-stats b) {
  font-size: 18px;
  line-height: 1.3;
}
.game-shell[data-runtime-target="xhs"] :is(.pixel-button,.shop-stats-button),
.game-shell[data-preview-mode="iphone"] :is(.pixel-button,.shop-stats-button) {
  font-size: 16px;
}
.game-shell[data-runtime-target="xhs"] .intermission-dock,
.game-shell[data-preview-mode="iphone"] .intermission-dock {
  min-height: 116px;
  grid-template-columns: minmax(0,70fr) minmax(190px,30fr);
}
.game-shell[data-runtime-target="xhs"] .info-card,
.game-shell[data-preview-mode="iphone"] .info-card {
  min-height: 94px;
}
.game-shell[data-runtime-target="xhs"] .panel-backpack,
.game-shell[data-preview-mode="iphone"] .panel-backpack {
  width: 96%;
  height: 90%;
}
.game-shell[data-runtime-target="xhs"] #backpackModal[data-backpack-context="shop"] .panel-backpack,
.game-shell[data-preview-mode="iphone"] #backpackModal[data-backpack-context="shop"] .panel-backpack {
  width: 88%;
  height: 82%;
}
.game-shell[data-runtime-target="xhs"] #backpackModal[data-backpack-context="shop"] .backpack-stat-group,
.game-shell[data-preview-mode="iphone"] #backpackModal[data-backpack-context="shop"] .backpack-stat-group {
  padding: 14px 16px;
}

/* TASK-099: preserve all Boss information while reducing mobile combat occlusion. */
.game-shell[data-runtime-target="xhs"] .boss-hud,
.game-shell[data-preview-mode="iphone"] .boss-hud {
  top: 58px;
  width: 340px;
  gap: 1px;
}
.game-shell[data-runtime-target="xhs"] .boss-hud.is-dual,
.game-shell[data-preview-mode="iphone"] .boss-hud.is-dual {
  width: 390px;
}
.game-shell[data-runtime-target="xhs"] .boss-hud > .boss-objective,
.game-shell[data-preview-mode="iphone"] .boss-hud > .boss-objective {
  justify-self: center;
  padding: 1px 5px;
  border-width: 2px;
  box-shadow: 1px 1px 0 var(--ink-deep);
  font-size: 12px;
  line-height: 1;
}
.game-shell[data-runtime-target="xhs"] .boss-hud-list,
.game-shell[data-preview-mode="iphone"] .boss-hud-list {
  gap: 1px;
}
.game-shell[data-runtime-target="xhs"] .boss-row,
.game-shell[data-preview-mode="iphone"] .boss-row {
  box-sizing: border-box;
  min-height: 0;
  height: 29px;
  padding: 1px 3px;
  border-width: 2px;
  grid-template-columns: minmax(0,1fr) auto auto;
  grid-template-rows: 12px 7px;
  gap: 0 3px;
  box-shadow: 1px 1px 0 var(--ink-deep);
}
.game-shell[data-runtime-target="xhs"] :is(.boss-name,.boss-phase,.boss-health-text),
.game-shell[data-preview-mode="iphone"] :is(.boss-name,.boss-phase,.boss-health-text) {
  font-size: 12px;
  line-height: 1;
}
.game-shell[data-runtime-target="xhs"] .boss-name,
.game-shell[data-preview-mode="iphone"] .boss-name {
  grid-row: 1;
  grid-column: 1;
}
.game-shell[data-runtime-target="xhs"] .boss-phase,
.game-shell[data-preview-mode="iphone"] .boss-phase {
  grid-row: 1;
  grid-column: 2;
}
.game-shell[data-runtime-target="xhs"] .boss-health-text,
.game-shell[data-preview-mode="iphone"] .boss-health-text {
  grid-row: 1;
  grid-column: 3;
  text-align: right;
}
.game-shell[data-runtime-target="xhs"] .boss-segment-meter,
.game-shell[data-preview-mode="iphone"] .boss-segment-meter {
  grid-row: 2;
  grid-column: 1 / -1;
  height: 7px;
  gap: 1px;
}

/* TASK-094: keep the two-row shop action stack inside a canonical 960x540 stage. */
@container game-stage (min-width: 761px) and (max-height: 600px) {
  .core-zone {
    grid-template-rows: 24px auto auto 0;
    overflow: hidden;
  }
  .core-zone-header {
    min-height: 24px;
    height: 24px;
  }
  .core-zone .board-grid {
    grid-template-columns: repeat(3,54px);
    grid-template-rows: repeat(3,54px);
    gap: 2px;
  }
  .core-zone .inventory-zone {
    height: 190px;
    min-height: 190px;
    grid-template-rows: 40px 150px;
  }
  .core-zone .inventory-heading {
    height: 40px;
  }
  .core-zone .inventory-list {
    height: 150px;
    min-height: 150px;
    grid-template-rows: repeat(4,36px);
  }
  .core-zone .inventory-item,
  .core-zone .inventory-identity {
    min-height: 36px;
  }
  .core-zone .inventory-heading .info-action-button {
    min-height: 40px;
  }
}

/* TASK-101: phone readability without changing the canonical 960x540 stage or package resolution. */
.game-shell[data-runtime-target="xhs"] .formal-ui,
.game-shell[data-preview-mode="iphone"] .formal-ui {
  font-size: 17px;
}
.game-shell[data-runtime-target="xhs"] :is(.modal-kicker,.pause-stamp,.hud-row,.hud-label,.hud-value,.countdown-kicker,.intermission-feedback,.shop-kind,.quality-badge,.shop-price,.offer-lock-button,.offer-purchase-button,.quality-placeholder,.inventory-heading span,.inventory-identity b,.inventory-identity small,.inventory-sell-button,.inventory-empty,.backpack-core-line span,.backpack-core-line small,.backpack-inventory-summary,.result-build-panel > p,.result-stats small),
.game-shell[data-preview-mode="iphone"] :is(.modal-kicker,.pause-stamp,.hud-row,.hud-label,.hud-value,.countdown-kicker,.intermission-feedback,.shop-kind,.quality-badge,.shop-price,.offer-lock-button,.offer-purchase-button,.quality-placeholder,.inventory-heading span,.inventory-identity b,.inventory-identity small,.inventory-sell-button,.inventory-empty,.backpack-core-line span,.backpack-core-line small,.backpack-inventory-summary,.result-build-panel > p,.result-stats small) {
  font-size: 17px;
}
.game-shell[data-runtime-target="xhs"] :is(.shop-name,.inventory-heading h3,.backpack-stat-group h3,.backpack-equipment-panel h3,.backpack-core-line strong,.backpack-stat-list dt,.backpack-stat-list dd,.settings-list,.result-stats b),
.game-shell[data-preview-mode="iphone"] :is(.shop-name,.inventory-heading h3,.backpack-stat-group h3,.backpack-equipment-panel h3,.backpack-core-line strong,.backpack-stat-list dt,.backpack-stat-list dd,.settings-list,.result-stats b) {
  font-size: 19px;
  line-height: 1.25;
}
.game-shell[data-runtime-target="xhs"] :is(.pixel-button,.shop-stats-button),
.game-shell[data-preview-mode="iphone"] :is(.pixel-button,.shop-stats-button) {
  font-size: 17px;
}
.game-shell[data-runtime-target="xhs"] .info-copy strong,
.game-shell[data-preview-mode="iphone"] .info-copy strong {
  font-size: 20px;
  line-height: 1.15;
}
.game-shell[data-runtime-target="xhs"] .info-copy p,
.game-shell[data-preview-mode="iphone"] .info-copy p {
  font-size: 18px;
  line-height: 1.15;
}
.game-shell[data-runtime-target="xhs"] #infoDetail,
.game-shell[data-preview-mode="iphone"] #infoDetail {
  font-size: 20px;
}

/* TASK-115: the existing panel and pixel grammar, with readable long-form copy. */
.start-action-row { grid-template-columns: 1.25fr 1.25fr 1fr 1fr; }
.start-modal:not(.has-active-run) .start-action-row { grid-template-columns: 1.5fr 1fr 1fr; }
.result-actions { width: 100%; grid-template-columns: repeat(4,minmax(0,1fr)); }
.panel-settings { max-height: 94%; display: flex; flex-direction: column; gap: 6px; padding-block: 16px; }
.panel-settings .settings-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.panel-settings > button { flex: 0 0 auto; min-height: 44px; margin: 0; }
.language-setting select { min-width: 100px; min-height: 44px; border: 3px solid var(--ink); border-radius: 0; padding: 4px; background: var(--wood-deep); color: var(--cream-hi); font: inherit; }
.language-setting > span { min-width: 0; }
.achievements-modal { padding: 14px 18px; }
.panel-achievements { width: min(94%,900px); height: 100%; min-height: 0; max-height: 100%; padding: 20px; display: grid; grid-template-rows: auto auto minmax(0,1fr) auto auto; gap: 8px; }
.panel-achievements > .panel-corners { position: absolute; inset: 0; pointer-events: none; }
.panel-achievements .modal-heading-row { margin: 0; }
.panel-achievements h2 { margin: 0; }
.achievement-note,.achievement-storage { margin: 0; font-size: 14px; line-height: 1.5; color: var(--cream); }
.achievement-storage:empty { display: none; }
.achievements-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: 8px; padding: 3px 8px 3px 3px; }
.achievement-entry { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 12px; border: 3px solid var(--ink); background: var(--wood-deep); box-shadow: inset 0 2px 0 #a36d44, 0 4px 0 var(--ink); overflow-wrap: anywhere; }
.achievement-entry.is-unlocked { border-color: var(--amber); }
.achievement-seal { color: var(--muted); font-size: 28px; text-align: center; }
.is-unlocked .achievement-seal { color: var(--amber); }
.achievement-entry h3 { margin: 0 0 5px; font-size: 18px; color: var(--cream-hi); }
.achievement-entry p { margin: 0 0 5px; font-size: 15px; line-height: 1.5; color: var(--cream); }
.achievement-status,.achievement-progress { font-size: 14px; line-height: 1.5; color: var(--muted); }
.is-unlocked .achievement-status { color: var(--amber); }
.achievement-toast { position: absolute; z-index: 80; left: 50%; bottom: 14px; transform: translateX(-50%); max-width: 85%; margin: 0; padding: 10px 14px; border: 3px solid var(--ink); background: var(--wood-deep); color: var(--amber); box-shadow: 0 4px 0 var(--ink); font-size: 16px; pointer-events: none; }
.achievement-toast[hidden] { display: none; }
html[data-language="en"] .shop-name { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
html[data-language="en"] .info-copy { display: block; min-height: 0; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; padding-right: 7px; }
html[data-language="en"] .info-copy p { display: block; white-space: normal; overflow: visible; text-overflow: clip; -webkit-line-clamp: unset; margin: 0 0 5px; line-height: 1.4; }
html[data-language="en"] .info-facts dd { white-space: normal; overflow-wrap: anywhere; }
html[data-language="en"] .difficulty-card-title { flex-wrap: wrap; }
html[data-language="en"] .difficulty-card-title strong { font-size: inherit; }
html[data-language="en"] .difficulty-card-status { white-space: normal; }
html[data-language="en"] .difficulty-unlock-copy { white-space: normal; line-height: 1.3; }
html[data-language="en"] .result-heading h2 { font-size: 22px; line-height: 1.25; }
html[data-language="en"] .boss-name { white-space: normal; line-height: 1.1; }
html[data-language="en"] .shop-name { min-height: 2.6em; max-height: 2.6em; white-space: normal; line-height: 1.3; overflow-wrap: normal; }
html[data-language="en"] .info-copy { scrollbar-color: var(--amber) var(--wood-deep); scrollbar-width: auto; border-right: 2px solid var(--amber); }
.info-scroll-hint { display: none; }
html[data-language="en"] .info-scroll-hint { display: block; position: sticky; bottom: 0; float: right; padding-inline: 4px; background: var(--wood-deep); color: var(--amber); font-size: 14px; }
@container game-stage (max-width: 760px) {
  html[data-language="en"] .shop-card { padding-inline: 0; }
  html[data-language="en"] .shop-card-select { padding-inline: 0; }
  html[data-language="en"] .offer-purchase-button { display: grid; grid-template-columns: minmax(0,1fr); justify-items: center; gap: 0; padding: 2px; }
  html[data-language="en"] .offer-purchase-button > span:first-child { overflow: visible; text-overflow: clip; }
  html[data-language="en"] .shop-card.is-bought .shop-price { display: none; }
}
@media (max-height: 420px) {
  .panel-achievements { padding: 12px; gap: 5px; }
  .panel-achievements .modal-kicker { display: none; }
  .panel-achievements h2 { font-size: 24px; }
  .achievement-entry { padding: 9px; gap: 7px; grid-template-columns: 30px minmax(0,1fr) auto; }
  .panel-settings { padding-block: 9px; }
  .panel-settings .modal-kicker { display: none; }
  .panel-settings h2 { font-size: 24px; margin: 0; }
  .result-actions { grid-template-columns: repeat(4,minmax(0,1fr)); }
}

/* TASK-125: the XHS Boss HUD occupies the upper center; keep map/luck below it and the left stack. */
.game-shell[data-runtime-target="xhs"] .map-status-strip,
.game-shell[data-preview-mode="iphone"] .map-status-strip {
  top: 164px;
  left: 10px;
  transform: none;
}

/* TASK-135: readable three-line details on both preview and the canonical phone stage. */
.game-shell #intermissionInfo { grid-template-columns: minmax(0, 1fr) minmax(260px, .5fr); gap: 12px; }
.game-shell #intermissionInfo .info-copy { display: block; overflow-y: auto; min-height: 0; padding-right: 8px; }
.game-shell #intermissionInfo .info-copy p { display: block; font-size: 20px; line-height: 1.25; margin: 0 0 6px; white-space: normal; overflow: visible; -webkit-line-clamp: unset; }
.game-shell #intermissionInfo #infoDetail { font-size: 22px; }
.game-shell:is([data-preview-mode="iphone"],[data-runtime-target="xhs"]) #intermissionInfo .info-copy p { font-size: 18px; }
.game-shell:is([data-preview-mode="iphone"],[data-runtime-target="xhs"]) #intermissionInfo #infoDetail { font-size: 19px; }
.game-shell #intermissionInfo .info-facts { padding-left: 0; gap: 8px; }
.game-shell #intermissionInfo .info-facts::before { display: none; }
.game-shell #intermissionInfo .info-facts > div { min-height: 70px; padding: 7px 8px; display: flex; flex-direction: column; justify-content: center; }
.game-shell #intermissionInfo .info-facts dt { font-size: 16px; line-height: 1.2; }
.game-shell #intermissionInfo .info-facts dd { font-size: 18px; line-height: 1.25; white-space: normal; overflow-wrap: anywhere; }
.panel-start .replay-comic-button { position: absolute; top: 10px; right: 12px; min-height: 44px; min-width: 130px; padding: 6px 10px; font-size: 16px; z-index: 2; }
.panel-start .sign-kicker { padding-inline: 145px; }
.pixel-language-picker { position: relative; min-width: 160px; z-index: 4; }
#languageMenuButton { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 12px; font-size: 20px; }
.language-chevron { width: 10px; height: 10px; border-right: 4px solid var(--cream); border-bottom: 4px solid var(--cream); transform: rotate(45deg) translateY(-3px); }
#languageOptions { position: absolute; top: calc(100% + 5px); left: 0; width: 100%; padding: 4px; border: 3px solid var(--ink); background: var(--wood-deep); box-shadow: 4px 4px 0 var(--ink); }
#languageOptions[hidden] { display: none; }
#languageOptions button { display: block; width: 100%; min-height: 44px; padding: 6px 10px; border: 2px solid transparent; font: inherit; font-size: 20px; text-align: left; color: var(--cream); background: var(--wood-deep); }
#languageOptions button[aria-selected="true"] { color: var(--amber); background: var(--teal-deep, #164d4c); }
#languageOptions button:focus-visible, #languageOptions button:hover { outline: none; border-color: var(--amber); }
.result-heading > div:first-child { min-width: 0; flex: 1; }
.game-shell .panel-result { grid-template-rows: 90px auto minmax(0,1fr) 48px; }
#shopModal:not([hidden]) ~ #achievementToast { top: 88px; bottom: auto; left: 35%; }
.game-shell #intermissionInfo .info-scroll-hint { display: block; position: sticky; bottom: 0; float: right; padding-inline: 4px; background: var(--wood-deep); color: var(--amber); font-size: 14px; }

/* Victory is a short presentation AFTER the core has saved the terminal result. */
#formalUi[data-victory-presentation="active"] { visibility: hidden; pointer-events: none; }
.victory-presentation { position: absolute; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(43,27,20,.88); color: var(--cream); }
.victory-presentation[hidden] { display: none; }
.victory-presentation h2 { font-size: 32px; text-shadow: 3px 3px var(--ink); }
.victory-presentation #victoryCelebration { width: 400px; height: 280px; max-width: 65%; image-rendering: pixelated; }
