@font-face{font-family:PunchioPixel;src:url('./menu-pixel.woff') format('woff');font-display:swap;font-weight:400}
:root{--menu-paper:#f4d7a5;--menu-light:#fff0ce;--menu-ink:#233e46;--menu-wood:#a16c51;--menu-teal:#286e67;--menu-gold:#efb65f}
dialog,.item-shop{color-scheme:light;background:var(--menu-paper);color:var(--menu-ink);border:3px solid var(--menu-ink);border-radius:0;box-shadow:inset 0 3px var(--menu-light),5px 6px 0 #12343c;width:min(92vw,800px);padding:22px;scrollbar-color:#698c7b #e2bd8c;scrollbar-width:thin}
dialog::backdrop{background:#102f3bd4}
dialog h2,dialog legend,dialog button,.world-card b,.shop-wallet,.shop-price,.shop-eyebrow{font-family:PunchioPixel,monospace;font-weight:400;font-synthesis:none}
.dialog-heading{border-bottom:3px solid var(--menu-teal);padding:2px 0 14px;margin-bottom:20px;gap:16px}
.pause-course:not([hidden]){display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin-bottom:16px}
#pauseCourseLabel{flex:1 1 10em;min-width:0;font:600 14px/1.5 system-ui,sans-serif;overflow-wrap:anywhere;-webkit-user-select:text;user-select:text}
#copyPauseCourse{font-size:11px}
#pauseCopyStatus:not(:empty){width:100%;font:13px/1.4 system-ui,sans-serif}
#optionsRooms{background:transparent;color:var(--menu-teal);box-shadow:none;border:0;font:600 14px/1.4 system-ui,sans-serif;min-height:44px}
#optionsRooms:hover{text-decoration:underline}
#roomDirectory{width:min(92vw,590px);max-height:calc(100dvh - 16px)}
.room-directory-summary{display:flex;align-items:center;justify-content:space-between;gap:12px}
.room-directory-summary p{margin:0}
.room-entries{margin:16px 0 0;padding:0;list-style:none}
.room-entries:empty{display:none}
.room-entries li{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 0;border-top:2px solid #bf946a}
.room-entry-details{display:grid;gap:2px;min-width:0;overflow-wrap:anywhere;font:14px/1.35 system-ui,sans-serif}
.room-entry-details :is(small,span){color:#594c41}
.room-entries button{flex:0 0 auto;min-height:48px}
.dialog-heading h2,dialog h2{color:var(--menu-ink);font-size:28px;letter-spacing:0;text-shadow:2px 2px var(--menu-light)}
dialog p,dialog dd,dialog label,.save-options span{color:#594c41;font-size:13px;line-height:1.65}dialog dt{color:var(--menu-teal)}
dialog button{background:var(--menu-teal);color:var(--menu-light);border:2px solid var(--menu-ink);border-radius:0;box-shadow:inset 0 2px #76b7a0,0 3px var(--menu-ink);font-size:18px;line-height:1.4;padding:10px 12px;min-height:42px}
dialog button:hover{background:#397f6c}dialog button:active{box-shadow:inset 0 2px #76b7a0,0 1px var(--menu-ink);transform:translateY(2px)}
dialog button:focus-visible,dialog input:focus-visible{outline:3px solid #426c8e;outline-offset:3px}
dialog fieldset{border:0;border-bottom:2px solid #bf946a;border-radius:0;background:#fae4bd;padding:16px;margin:0 0 18px}
dialog legend{color:var(--menu-teal);background:var(--menu-paper);font-size:18px;padding:3px 8px 3px 0}
dialog input{color:var(--menu-ink);background:var(--menu-light);border:2px solid #ab8767;border-radius:0;font-family:inherit;min-height:40px}
.avatar{background:transparent!important;border:0!important;width:64px;height:64px;object-fit:contain;image-rendering:pixelated}
#color{white-space:nowrap}#colorAuto{font-size:.65em;vertical-align:middle}
.worlds{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.world-card{display:flex;flex-direction:column;align-items:center;gap:8px;padding:10px 4px;background:var(--menu-light);color:var(--menu-ink);border:2px solid #b18c67;box-shadow:inset 0 2px #fff8df,0 3px #b18c67}
.world-card .world-icon{width:128px;height:96px;max-width:100%;display:block;image-rendering:pixelated;border:0}
.world-card b{font-size:18px;color:inherit}.world-card small{font-size:11px;line-height:1.4;color:inherit}.world-card:hover,.world-card.selected{color:var(--menu-ink);background:var(--menu-gold);border-color:var(--menu-ink)}.world-card.locked{color:#686655;background:#d1c5a3}.world-card.locked canvas{filter:saturate(.6);opacity:.8}
.connection,#completion,#location,#saveStatus{color:#594c41}.pause-button,.world-nav-button{border:2px solid var(--menu-ink);background:var(--menu-paper);color:var(--menu-ink);box-shadow:2px 2px var(--menu-ink);border-radius:0;font-family:PunchioPixel,monospace}.pause-button{font-size:10px;min-width:40px}.world-nav-button{font-size:10px}
.item-shop{width:min(820px,94vw)}.item-shop header{border-bottom:3px solid var(--menu-teal)}.item-shop h2{color:var(--menu-ink);font-size:28px}.item-shop .shop-eyebrow{font-size:10px;letter-spacing:0;color:var(--menu-teal)}.item-shop .shop-intro,.item-shop .shop-message,.item-shop footer{color:#594c41}.item-shop .shop-wallet{color:#885a40;font-size:18px}
.shop-stock{gap:12px}.shop-offer{background:var(--menu-light);color:var(--menu-ink);border:2px solid #ab8767;box-shadow:inset 0 2px #fff8df,0 3px #ab8767;gap:8px;padding:12px 6px}.shop-offer:hover,.shop-offer:focus-visible{background:var(--menu-gold);color:var(--menu-ink);border-color:var(--menu-ink)}.shop-offer strong{font-size:18px;font-weight:400}.shop-price{font-size:18px;color:#885a40}.shop-unaffordable{background:#ddd0af;color:#655f50}.shop-unaffordable .shop-price{color:#655f50}.shop-offer canvas{width:48px;height:48px}.shop-close{font-size:28px;color:var(--menu-light);background:var(--menu-teal)}
#pause #name{background:var(--menu-light);color:var(--menu-ink);border:2px solid #ab8767}dialog .dialog-heading button{color:var(--menu-ink);background:var(--menu-gold);border:2px solid var(--menu-ink);box-shadow:none;min-width:36px}#pauseButton{font-size:10px;min-width:48px}
@media(max-width:640px){dialog,.item-shop{padding:14px}.worlds{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.world-card .world-icon{width:64px;height:48px}.world-card b,dialog button,dialog legend,.shop-offer strong,.shop-price,.item-shop .shop-wallet{font-size:10px}.dialog-heading h2,.item-shop h2{font-size:20px}.world-card small{font-size:10px}.shop-stock{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.shop-offer{padding:12px 4px}.shop-offer canvas{width:48px;height:48px}dialog button{min-height:40px;line-height:1.8}.shop-close{font-size:20px}dialog fieldset{padding:12px}}
/* This tile remains aligned to the game's integer display scale. */
#stage .hud-buttons {
 display: flex;
 align-items: center;
 gap: 6px;
 position: absolute;
 z-index: 5;
 top: max(1.8%,var(--device-safe-top));
 right: max(1.3%,var(--device-safe-right));
 pointer-events: none;
}
#stage .hud-buttons > button { position: static; pointer-events: auto; }
#stage #pauseButton:not([hidden]) {
 display: grid;
 place-items: center;
 width: max(32px,var(--menu-button-size,32px));
 height: max(32px,var(--menu-button-size,32px));
 min-width: 0;
 min-height: 0;
 opacity: 1;
 border: 0;
 background: transparent;
 box-shadow: none;
 padding: 0;
 line-height: 0;
}
#stage #pauseButton canvas {
 width: var(--menu-button-size,32px);
 height: var(--menu-button-size,32px);
 pointer-events: none;
}
#stage #pauseButton:hover { filter: brightness(1.12); }
#stage #pauseButton:active { transform: translateY(calc(var(--menu-button-size,32px)/16)); }
.music-credits{display:inline-block;margin-top:12px;color:var(--menu-teal)}
/* Keep purchase feedback in view while the catalogue scrolls. The padding
   lets keyboard focus reveal the complete final offer above this strip. */
.item-shop{scroll-padding-bottom:72px}
.item-shop [hidden]{display:none}
.shop-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.shop-actions [aria-pressed="true"]{background:var(--menu-teal);color:var(--menu-light)}
.shop-confirm{padding:12px;border:2px solid var(--menu-teal)}
.shop-confirm p{margin:0;line-height:1.5}
.item-shop .shop-message{position:sticky;bottom:0;z-index:2;background:var(--menu-paper);border-top:2px solid var(--menu-teal);padding:8px;margin-bottom:0;box-shadow:0 -6px 0 var(--menu-paper)}
@media(max-width:640px){
 #help dl{grid-template-columns:minmax(0,1fr);gap:6px}
 #help dt{margin-top:12px}
 #help dd{margin:0 0 8px}
}
/* Approved active Party rail. At native1 scale, put the existing controls in the available
   rail above the stage. Actual label/button nodes and handlers are retained. */
@container (max-width: 400px){
 .pipe-party-panel[data-party-playing225]{
  top:-58px!important;right:4px!important;
  display:flex!important;align-items:center;gap:8px;
  padding:4px 6px!important;max-width:calc(100cqw - 8px)!important;
  white-space:nowrap;
 }
 .pipe-party-panel[data-party-playing225] > div:last-child{
  margin-top:0!important;flex-wrap:nowrap!important;
 }
}

/* Portrait keeps a separate control rail. */
#stage {
 --device-safe-left: env(safe-area-inset-left,0px);
 --device-safe-right: env(safe-area-inset-right,0px);
 --device-safe-top: env(safe-area-inset-top,0px);
 --device-safe-bottom: env(safe-area-inset-bottom,0px);
 --safe-left: calc((var(--display-w) - 100vw) / 2 + var(--device-safe-left));
 --safe-right: calc((var(--display-w) - 100vw) / 2 + var(--device-safe-right));
 --safe-top: calc((var(--display-h) - 100dvh) / 2 + var(--device-safe-top) - var(--stage-shift,0px));
 --safe-bottom: calc((var(--display-h) - 100dvh) / 2 + var(--device-safe-bottom) + var(--stage-shift,0px));
 --touch-target: 60px;
 --touch-opacity: 1;
 --hud-button-size: 48px;
 --hud-button-top: max(4px,calc(var(--safe-top) + 4px));
 top: var(--stage-shift,0px);
}
#stage[data-touch-opacity="low"] { --touch-opacity: .72; }
#stage[data-touch-opacity="high"] { --touch-opacity: 1; --touch-fill: .35; }

#stage #touch {
 position: absolute;
 left: calc(var(--safe-left) + 12px);
 right: calc(var(--safe-right) + 12px);
 bottom: calc(var(--safe-bottom) + 12px);
 display: flex;
 justify-content: space-between;
 align-items: end;
 pointer-events: none;
 z-index: 4;
 --touch-jump-target: calc(1.45 * var(--touch-target));
 opacity: calc(var(--touch-opacity) * .76);
 transition: opacity .25s ease 1.5s;
}
#stage #touch[data-active] {
 opacity: var(--touch-opacity);
 transition: opacity .09s ease;
}
#stage[data-touch-side="left"] #touch #touchMove { order: 1; }
#stage[data-touch-side="left"] #touch .actions { direction: rtl; }
#touchMove, #stage #touch button {
 pointer-events: auto;
 touch-action: none;
 -webkit-user-select: none;
 user-select: none;
 -webkit-touch-callout: none;
 -webkit-tap-highlight-color: transparent;
}
#touchMove {
 position: relative;
 width: 45%;
 height: calc(var(--touch-target) + var(--touch-jump-target));
}
.stick-ring {
 position: absolute;
 left: clamp(var(--stick-edge),var(--stick-x,50%),calc(100% - var(--stick-edge)));
 top: clamp(var(--stick-edge),var(--stick-y,50%),calc(100% - var(--stick-edge)));
 width: var(--touch-target);
 aspect-ratio: 1;
 display: grid;
 place-items: center;
 border: 1px solid #fff0ceb3;
 border-radius: 50%;
 background: rgb(22 48 52 / var(--touch-fill,.30));
 transform: translate(-50%,-50%);
 pointer-events: none;
}
.stick-thumb {
 width: 46%;
 aspect-ratio: 1;
 border-radius: 50%;
 background: #edf4cb62;
 border: 1px solid #fff0ceb3;
 transform: translate(var(--thumb-x,0px),var(--thumb-y,0px));
}
#touchMove[data-held] .stick-ring { border-color: #fff0ce; }
#touchMove[data-running] .stick-thumb { background: #efc07ca6; }
#touchMove { --stick-edge: calc(var(--touch-target) / 2 + 4px); }
@media (orientation: landscape) {
 #touch[data-context="map"] #touchMove { width: calc(2 * var(--touch-target)); }
}

#stage #touch .actions {
 display: grid;
 grid-template-columns: var(--touch-target) var(--touch-jump-target);
 grid-template-rows: var(--touch-target) var(--touch-jump-target);
}
#touch [data-key="ShiftLeft"] { grid-area: 2 / 1; }
#touch [data-key="KeyX"]:not(#stone) { grid-area: 1 / 2; }
#touch #stone { grid-area: 1 / 1; }
#touch [data-key="Space"] { grid-area: 2 / 2; }
#touch [data-key="KeyI"] { grid-area: 1 / 2; }
#touch [data-key="Enter"] { grid-area: 2 / 2; }
#stage #touch button {
 display: grid;
 place-items: center;
 width: 100%;
 height: 100%;
 border: 0;
 padding: 0;
 background: transparent;
 box-shadow: none;
 color: var(--menu-light);
 font: 12px PunchioPixel,monospace;
 direction: ltr;
 transform: none;
}
#stage #touch[data-context="map"] :is([data-key="Space"],[data-key="ShiftLeft"],[data-key="KeyX"]),
#stage #touch[data-context="play"] :is([data-key="Enter"],[data-key="KeyI"]) { display: none; }
#touch button span {
 display: grid;
 place-items: center;
 width: 77%;
 aspect-ratio: 1;
 border: 1px solid #fff0ceb3;
 border-radius: 50%;
 background: rgb(22 48 52 / var(--touch-fill,.30));
 text-shadow: 0 1px 2px #101820,0 0 3px #101820;
 pointer-events: none;
}
#touch .primary-control span {
 width: 84%;
 background: rgb(94 54 24 / var(--touch-fill,.30));
}
#touch button[data-touch-held] span {
 background: #b9e3c37a;
 border-color: #fff0ce;
 transform: scale(.95);
}
#touch .primary-control[data-touch-held] span {
 background: #ffce827a;
}
#stage[data-touch-overlay] #touch { inset: 0; display: block; }
#stage[data-touch-player-mask] #touch {
 mask-image: radial-gradient(ellipse var(--touch-player),transparent 78%,#000 100%);
}
#stage[data-touch-overlay] #touchMove {
 position: absolute;
 --touch-window-edge: max(0px,calc((var(--display-w) - 100vw) / 2));
 --stick-zone-top: 0px;
 inset: var(--stick-zone-top) auto 0 var(--touch-window-edge);
 width: 45vw;
 height: auto;
}
#stage[data-touch-overlay][data-touch-side="left"] #touchMove { left: auto; right: var(--touch-window-edge); }
#stage[data-touch-overlay] #touch[data-context="map"] #touchMove {
 --stick-zone-top: 50%;
 width: calc(2 * var(--touch-target));
}
#stage[data-touch-overlay] #touchMove:not([data-held]) .stick-ring { visibility: hidden; }
#stage[data-touch-overlay] .stick-ring {
 left: max(calc(var(--safe-left) + var(--stick-edge)),var(--stick-x,50%));
 top: clamp(calc(max(0px,var(--safe-top) - var(--stick-zone-top)) + var(--stick-edge)),var(--stick-y,50%),
            calc(100% - max(var(--touch-hud),var(--safe-bottom)) - var(--stick-edge)));
}
#stage[data-touch-overlay][data-touch-side="left"] .stick-ring {
 left: min(var(--stick-x,50%),calc(100% - var(--safe-right) - var(--stick-edge)));
}
#stage #touchMove[data-held] .stick-ring {
 left: var(--stick-x);
 top: var(--stick-y);
}
#stage[data-touch-overlay] #touch .actions {
 position: absolute;
 right: calc(var(--safe-right) + 10px);
 bottom: calc(max(var(--safe-bottom),var(--touch-action-floor)) + 8px);
}
#stage[data-touch-overlay][data-touch-side="left"] #touch .actions {
 right: auto;
 left: calc(var(--safe-left) + 10px);
}
#stage[data-touch-overlay] #touch[data-context="map"] .actions {
 grid-template-rows: var(--touch-jump-target);
}
#stage[data-touch-overlay] #touch[data-context="map"] [data-key="KeyI"] { grid-area: 1 / 1; }
#stage[data-touch-overlay] #touch[data-context="map"] [data-key="Enter"] { grid-area: 1 / 2; }
#inputPrompt {
 position: absolute;
 z-index: 6;
 left: calc(var(--safe-left) + 8px);
 bottom: max(8px,calc(var(--safe-bottom) + 6px));
 display: flex;
 flex-wrap: wrap;
 gap: 8px;
 max-width: calc(100vw - 32px);
 width: max-content;
 background: #172f36ed;
 color: #fff0ce;
 padding: 4px 7px;
 font: 12px/1.35 ui-monospace,monospace;
 pointer-events: none;
}
#inputPrompt kbd {
 border: 1px solid #d8b57e;
 border-radius: 2px;
 padding: 0 3px;
 margin-right: 4px;
 color: #ffcf85;
 font: inherit;
}
.input-settings { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.input-settings label { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.input-settings select {
 appearance: none;
 font: inherit;
 color: var(--menu-ink);
 background: linear-gradient(45deg,transparent 50%,var(--menu-teal) 50%) right 13px center / 5px 5px no-repeat,
  linear-gradient(135deg,var(--menu-teal) 50%,transparent 50%) right 8px center / 5px 5px no-repeat var(--menu-light);
 border: 2px solid #ab8767;
 border-radius: 0;
 height: 48px;
 padding: 0 24px 0 8px;
}
dialog .input-settings input { min-height: 0; width: 22px; height: 22px; accent-color: var(--menu-teal); }
[data-pad-focus] { outline: 3px solid #426c8e !important; outline-offset: 3px; }
#gameContainer {
 display: grid;
 grid-template: minmax(0,1fr) / minmax(0,1fr);
 place-items: center;
 width: 100%;
 height: 100%;
 background: #101018;
}
#stage .title-menu { inset: 0; }
.title-menu button { display: none; }
@media (any-pointer: coarse) {
 html,body { overscroll-behavior: none; touch-action: pan-y; }
 #stage { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
 #stage .hud-buttons {
  top: var(--hud-button-top);
  right: calc(var(--safe-right) + 8px);
 }
 #stage .hud-buttons :is(#pauseButton,#chatButton,#worldNavButton):not([hidden]) {
  display: grid;
  place-items: center;
  width: var(--hud-button-size);
  height: var(--hud-button-size);
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid #fff0ce99;
  border-radius: 4px;
  background: #18182859;
  color: #fff0ce;
  box-shadow: none;
  opacity: 1;
 }
 #stage #pauseButton canvas { display: none; }
 #stage #pauseButton span {
  width: 10px;
  height: 14px;
  border-inline: 3px solid currentColor;
 }
 #stage #chatButton { touch-action: none; -webkit-tap-highlight-color: transparent; }
 #stage #chatButton span {
  position: relative;
  width: 15px;
  height: 11px;
  border: 2px solid currentColor;
  border-radius: 2px;
 }
 #stage #chatButton span::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  left: 1px;
  bottom: -4px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: skewY(-35deg);
 }
 #stage .hud-buttons :is(#pauseButton,#chatButton,#worldNavButton):is(:active,[data-touch-held]) {
  background: #181828a6;
  transform: none;
 }
 /* With the stick on the right, start its zone below the HUD row. */
 #stage[data-touch-overlay][data-touch-side="left"] #touchMove {
  --stick-zone-top: calc(var(--hud-button-top) + var(--hud-button-size));
 }
 #stage .title-menu:not(.hidden) {
  display: grid !important;
  gap: 7px;
  justify-items: center;
  align-content: start;
  left: 0;
  right: 0;
  top: 34%;
 }
 #stage .title-menu button {
  position: static;
  width: min(180px,50vw);
  height: 48px;
  color: var(--menu-ink);
  background: var(--menu-paper);
  border: 2px solid var(--menu-ink);
  box-shadow: inset 0 2px var(--menu-light),2px 3px var(--menu-ink);
  font: 14px PunchioPixel,monospace;
 }
 #stage .title-menu button:not([hidden]) { display: block; }
 #stage .title-menu button[data-selected] { background: var(--menu-gold); }
 #stage .title-menu button:where(:lang(ja,zh)) { font-family:system-ui,sans-serif; font-weight:700; }
 dialog,.item-shop {
  max-width: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 16px);
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
  margin: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
 }
 dialog button,dialog .dialog-heading button,.item-shop button { min-width: 48px; min-height: 48px; }
 #pause #name { min-height: 48px; font-size: 16px; }
 #stage .ending-menu { left: 10%; right: 10%; }
 #stage .ending-menu button { min-height: 48px; }
 #stage .pipe-party-panel {
  top: max(8px,calc(var(--safe-top) + 8px)) !important;
  right: calc(var(--safe-right) + 66px) !important;
  max-width: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 82px) !important;
  white-space: normal;
 }
 #stage .pipe-party-panel button,#stage .pipe-party-launch { min-height: 48px; }
 #stage .pipe-party-launch {
  right: calc(var(--safe-right) + 12px) !important;
  bottom: calc(var(--safe-bottom) + 2 * var(--touch-target) + 20px) !important;
 }
}
@media (any-pointer: coarse) and (max-height: 460px) {
 #stage .title-menu:not(.hidden) {
  grid-template-columns: repeat(2,minmax(0,1fr));
  width: min(370px,90vw);
  margin-inline: auto;
 }
 #stage .title-menu button { width: 100%; }
}
@media (any-pointer: coarse) and (orientation: portrait) {
 #stage .pipe-party-launch {
  bottom: max(calc(var(--safe-bottom) + 2 * var(--touch-target) + 20px),-54px) !important;
 }
}
@media (any-pointer: coarse) and (orientation: landscape) {
 #stage[data-touch-overlay]:has(#touch[data-context="map"]) .pipe-party-launch {
  top: var(--hud-button-top) !important;
  right: auto !important;
  bottom: auto !important;
  left: calc(var(--safe-left) + 8px) !important;
 }
}

.panel-input-prompt { margin: 5px 0 9px; font: 12px/1.4 ui-monospace,monospace; white-space: pre-wrap; }

@media (orientation: portrait) {
 #stage #touch #touchMove {
  order: 0;
  width: min(45%,calc(100% - var(--touch-target) - var(--touch-jump-target) - 56px));
 }
 #stage #touch .actions { order: 2; }
 #stage[data-touch-side="left"] #touch #touchMove { order: 2; }
 #stage[data-touch-side="left"] #touch .actions { order: 0; }
}
.language-option{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin-top:12px}
#language{max-width:100%;min-height:40px;padding:6px 10px;background:var(--menu-light);color:var(--menu-ink);border:2px solid #ab8767;font:inherit}
#language:focus-visible{outline:3px solid #426c8e;outline-offset:3px}
dialog fieldset,dialog button,.ending-menu button{min-inline-size:0}
:is(dialog,.ending-menu,.item-shop) :is(button,h2,legend,p,dt,dd),.world-card b,.shop-offer strong,#toast{overflow-wrap:anywhere}
.world-card :is(b,small),.shop-offer strong{max-inline-size:100%}
.ending-menu:where(:not(:lang(en))){left:15%;right:15%}
#stage #touch .actions button:where(:lang(es,it,fr)){font-size:10px;overflow-wrap:anywhere}
.player-options #color{flex:none;white-space:nowrap}
#stage #touch .actions button:where(:lang(ja,zh)){font-size:10px;padding-inline:2px;white-space:nowrap}
:is(dialog,.ending-menu,.item-shop) :is(button,h2,legend):where(:lang(ja,zh)),
:is(.world-card b,.world-nav-button,.shop-offer strong,#touch button):where(:lang(ja,zh)){
 font-family:system-ui,sans-serif;
 font-weight:700;
}
#muteChat[aria-pressed="true"] {background:#f7bf67;color:#181828}

/* Touch action zone: one capture area for the whole action cluster. Each finger takes the nearest visible button and keeps it until it lifts. */
#actionZone {
 position: absolute;
 top: 0;
 bottom: 0;
 right: 0;
 width: calc(var(--touch-target) + var(--touch-jump-target) + 56px);
 pointer-events: auto;
 touch-action: none;
 -webkit-user-select: none;
 user-select: none;
 -webkit-touch-callout: none;
 -webkit-tap-highlight-color: transparent;
 background: transparent;
}
#stage[data-touch-side="left"] #actionZone { right: auto; left: 0; }
#stage[data-touch-overlay] #actionZone {
 top: 30%;
 width: auto;
 left: calc(max(0px,(var(--display-w) - 100vw) / 2) + 45vw);
 right: 0;
}
#stage[data-touch-overlay][data-touch-side="left"] #actionZone {
 left: 0;
 right: calc(max(0px,(var(--display-w) - 100vw) / 2) + 45vw);
}
#stage #touch .actions button { pointer-events: none; }
#stage[data-touch-overlay] #touch .actions {
 right: calc(var(--safe-right) + .35 * var(--touch-target));
 bottom: calc(max(var(--safe-bottom),var(--touch-action-floor)) + .35 * var(--touch-target));
}
#stage[data-touch-overlay][data-touch-side="left"] #touch .actions {
 right: auto;
 left: calc(var(--safe-left) + .35 * var(--touch-target));
}
/* Map: the actions are only ITEMS and ENTER, so the zone shrinks to them and the board keeps its taps. */
#stage[data-touch-overlay] #touch[data-context="map"] #actionZone {
 top: 40%;
 left: auto;
 right: 0;
 width: calc(var(--touch-jump-target) + 40px);
}
#stage[data-touch-overlay][data-touch-side="left"] #touch[data-context="map"] #actionZone { left: 0; right: auto; }
#stage[data-touch-overlay] #touch[data-context="map"] .actions {
 right: calc(var(--safe-right) + 10px);
 bottom: calc(max(var(--safe-bottom),var(--touch-action-floor)) + 8px);
}
/* Map with side gutters: menu and chat on the left, ITEMS and ENTER on the right. */
#stage[data-map-hud="gutter"] { --hud-button-size: 44px; }
#stage[data-map-hud="gutter"] #touch { --touch-jump-target: calc(1.1 * var(--touch-target)); }
#stage[data-map-hud="gutter"] .hud-buttons {
 flex-direction: column;
 align-items: flex-start;
 left: calc(var(--safe-left) + 4px);
 right: auto;
}
#stage[data-map-hud="gutter"] #touch[data-context="map"] .actions {
 grid-template-columns: var(--touch-jump-target);
 grid-template-rows: var(--touch-jump-target) var(--touch-jump-target);
 right: calc(var(--safe-right) + 6px);
}
#stage[data-map-hud="gutter"] #touch[data-context="map"] [data-key="KeyI"] { grid-area: 1 / 1; }
#stage[data-map-hud="gutter"] #touch[data-context="map"] [data-key="Enter"] { grid-area: 2 / 1; }
#stage[data-map-hud="gutter"][data-touch-overlay] #touch[data-context="map"] #actionZone { width: var(--map-gutter-right); }
#stage[data-map-hud="gutter"][data-touch-overlay] #touch[data-context="map"] #touchMove { width: var(--map-gutter-left); }
@media (any-pointer: coarse) and (orientation: landscape) {
 #stage[data-map-hud="gutter"][data-touch-overlay]:has(#touch[data-context="map"]) .pipe-party-launch {
  top: var(--hud-button-top) !important;
  left: auto !important;
  right: calc(var(--safe-right) + 8px) !important;
 }
}
