/* The platform's part of the play page: canvas, back button, and the creator's developer panel. */
@font-face { font-family: P2; src: url(/fonts/press-start-2p.woff2) format('woff2'); font-display: block; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* The phone's own edges (a notch, the home bar), as every rule here uses them. */
:root { --safe-top: env(safe-area-inset-top, 0px); --safe-right: env(safe-area-inset-right, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); --safe-left: env(safe-area-inset-left, 0px); }
html, body.mango-play { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; color: #f4ebe0; font: 16px/1.45 -apple-system, system-ui, 'Segoe UI', sans-serif; }
body.mango-play { display: flex; align-items: center; justify-content: center; }
body.mango-play canvas { display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
/* A sideways game on a phone held upright: the page is a wide stage laid along the screen, turned a quarter, and the
   player turns the phone (host.js sets the stage's size and corner, inside the phone's own edges). Everything fixed
   is placed on the stage, as on a wide screen; the phone's edges are already outside it. */
html.mango-turned { --safe-top: 0px; --safe-right: 0px; --safe-bottom: 0px; --safe-left: 0px; background: #000; }
html.mango-turned body.mango-play { position: fixed; top: var(--stage-top, 0px); left: var(--stage-right, 100%); width: var(--stage-w, 100vh); height: var(--stage-h, 100vw); transform-origin: 0 0; transform: rotate(90deg); }

/* Back to the home screen: top left. */
#mango-exit { position: fixed; top: max(12px, var(--safe-top)); left: max(12px, var(--safe-left)); z-index: 20; width: 40px; height: 40px; border: 0; border-radius: 20px; background: rgba(0, 0, 0, .45); color: #fff; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; }
#mango-exit .icon { width: 24px; height: 24px; margin-right: 2px; }
/* Pause, beside it (every player): the way to stop a run and come back. It shows a play triangle while paused. */
#mango-pause-button { position: fixed; top: max(12px, var(--safe-top)); left: calc(max(12px, var(--safe-left)) + 48px); z-index: 20; width: 40px; height: 40px; border: 0; border-radius: 20px; background: rgba(0, 0, 0, .45); color: #fff; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; }
#mango-pause-button .icon { width: 20px; height: 20px; }
#mango-pause-button[aria-pressed="false"] .icon-when-paused, #mango-pause-button[aria-pressed="true"] .icon-when-playing { display: none; }
#mango-exit:hover, #mango-pause-button:hover { background: rgba(0, 0, 0, .7); }
#mango-exit:focus-visible, #mango-pause-button:focus-visible { outline: 2px solid #ff4f00; outline-offset: 2px; }

/* The menu, top right: the home screen's (round button, a list under it), over the game like the back button. */
.home-menu { position: fixed; top: max(12px, var(--safe-top)); right: max(12px, var(--safe-right)); z-index: 20; }
.home-menu-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; margin: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; cursor: pointer; }
.home-menu-button .icon { width: 22px; height: 22px; }
.home-menu-button:hover, .home-menu-button[aria-expanded="true"] { background: rgba(0, 0, 0, .7); }
.home-menu-button:focus-visible { outline: 2px solid #ff4f00; outline-offset: 2px; }
.home-menu-button { position: relative; }
.home-menu-badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 999px; background: #ff4f00; color: #fff; font: 800 11px/18px system-ui, sans-serif; text-align: center; box-shadow: 0 0 0 2px #000; pointer-events: none; }
.home-menu-waiting { min-width: 20px; padding: 1px 7px; border-radius: 999px; background: #ff4f00; color: #fff !important; font-weight: 700; text-align: center; }
.home-menu-list { position: absolute; top: 48px; right: 0; display: flex; flex-direction: column; min-width: 300px; max-width: calc(100vw - 24px); padding: 6px; border: 1px solid #3b3229; border-radius: 14px; background: #17130f; box-shadow: 0 12px 32px #000000b3; }
.home-menu-list[hidden] { display: none; }
.home-menu-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; margin: 0; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: #f4ebe0; font: 500 16px/1.3 system-ui, sans-serif; text-align: left; text-decoration: none; cursor: pointer; }
.home-menu-item:hover, .home-menu-item:focus-visible { background: #2a231d; color: #fff; }
.home-menu-item .icon { width: 20px; height: 20px; flex-shrink: 0; color: #a39482; }
.home-menu-label { white-space: nowrap; }
.home-menu-note { margin-left: auto; padding-left: 16px; color: #a39482; font-size: 13px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The developer panel: Toolcmd's prompt in its orange Dev accent. Put away, only the round button shows (bottom
   right); open, the prompt runs along the bottom: the text grows as you type, the round send button sits inside. */
.dev-dock { --prompt-accent: #ff4f00; --prompt-accent-hover: #ff6a26; --prompt-on-accent: #1a1a1a; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: flex-end; align-items: flex-end; padding: 8px max(8px, var(--safe-right)) max(8px, var(--safe-bottom)) max(8px, var(--safe-left)); pointer-events: none; }
.dev-dock > * { pointer-events: auto; }
/* Someone who didn't make the game: the same prompt in blue, for a suggestion to its maker */
.dev-dock[data-mode="suggest"] { --prompt-accent: #3d8bff; --prompt-accent-hover: #5c9dff; --prompt-on-accent: #ffffff; }
.dev-dock[data-prompt="closed"] .command-bar, .dev-dock[data-prompt="open"] .command-fab { display: none; }
.dev-dock[data-prompt="open"] .command-bar { flex: 1; max-width: 640px; margin: 0 auto; }

.command-bar { position: relative; display: flex; flex-direction: column; min-width: 0; border-radius: 12px; background: #1a1a1a; color: #edece8; overflow: hidden; box-shadow: 0 0 0 1px #ffffff1f, 0 8px 24px #00000080; animation: dev-up .14s ease-out; }
.command-bar:focus-within { box-shadow: 0 0 0 2px var(--prompt-accent), 0 8px 24px #00000080; }
.command-bar-row { display: flex; align-items: flex-end; gap: 6px; padding: 6px 6px 6px 14px; }
#mango-dev-input { flex: 1; min-width: 0; height: 36px; margin: 0; padding: 8px 0; border: 0; border-radius: 0; background: transparent; color: #f2f1ed; font: 16px/20px -apple-system, system-ui, 'Segoe UI', sans-serif; resize: none; }
#mango-dev-input:focus { outline: none; }
#mango-dev-input::placeholder { color: #9c9b96; }
.build-send { flex-shrink: 0; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--prompt-accent); color: var(--prompt-on-accent); cursor: pointer; }
.build-send:hover { background: var(--prompt-accent-hover); }
.build-send .icon { width: 18px; height: 18px; stroke-width: 2.2; }
.dev-dock[data-busy] .command-bar { opacity: .6; }
/* a picture pasted, dropped or picked: shown small above the prompt, sent with the note */
.dev-picture { position: relative; align-self: flex-start; margin: 10px 0 0 14px; }
.dev-picture[hidden] { display: none; }
.dev-picture img { display: block; height: 80px; width: auto; min-width: 40px; max-width: 200px; object-fit: contain; image-rendering: pixelated; border-radius: 8px; background: repeating-conic-gradient(#2a2a2a 0 25%, #222 0 50%) 0 0 / 16px 16px; box-shadow: 0 0 0 1px #ffffff26; }
.dev-picture-x { position: absolute; top: -8px; right: -8px; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: #edece8; color: #1a1a1a; cursor: pointer; }
.dev-picture-x .icon { width: 14px; height: 14px; stroke-width: 2.6; }
.dev-attach { flex-shrink: 0; display: grid; place-items: center; width: 36px; height: 36px; margin-left: -8px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #a8a6a0; cursor: pointer; }
.dev-attach:hover { color: #edece8; background: #ffffff14; }
.dev-attach .icon { width: 20px; height: 20px; }
.command-bar[data-drop] { box-shadow: 0 0 0 2px var(--prompt-accent), 0 8px 24px #00000080; }

.command-fab { position: relative; display: grid; place-items: center; width: 56px; height: 56px; margin: 0 4px 4px 0; padding: 0; border: 0; border-radius: 50%; background: var(--prompt-accent); color: var(--prompt-on-accent); box-shadow: 0 6px 18px #00000059, 0 1px 3px #0000003d; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.command-fab .icon { width: 26px; height: 26px; stroke-width: 2; pointer-events: none; }
.command-fab:hover { background: var(--prompt-accent-hover); }
.command-fab:focus-visible { outline: 3px solid color-mix(in srgb, var(--prompt-accent) 45%, transparent); outline-offset: 3px; }
.dev-count { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #1a1a1a; color: #ffb38a; font: 700 12px/22px system-ui, sans-serif; text-align: center; pointer-events: none; }
.dev-count[hidden], #mango-pause[hidden], #mango-toast[hidden] { display: none; }

/* Paused: the whole screen dims and PAUSED runs across it. It lets touches through (a tap on the game continues), and
   sits under the back button and the developer panel so both stay usable. */
#mango-pause { position: fixed; inset: 0; z-index: 15; pointer-events: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: rgba(0, 0, 0, .6); color: #fff; text-align: center; animation: mango-fade .12s ease-out; }
.mango-pause-title { font: normal clamp(36px, 12vw, 64px)/1 P2, monospace; letter-spacing: .04em; text-shadow: 4px 4px 0 #000; }
.mango-pause-hint { font: normal 12px/1.4 P2, monospace; color: #d8cfc4; text-shadow: 2px 2px 0 #000; }
#mango-toast { position: fixed; left: 50%; top: max(16px, var(--safe-top)); transform: translateX(-50%); z-index: 40; max-width: calc(100% - 120px); background: #1d3323; color: #a3e4b7; border: 1px solid #2f5a3c; border-radius: 999px; padding: 8px 16px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mango-toast[data-tone="error"] { background: #3d1a17; color: #ff8a7a; border-color: #6b2a24; white-space: normal; border-radius: 16px; }
.mango-toast-link { margin-left: 6px; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* A phone held the other way than the game is made for: the game is covered and waits. The back, pause and menu
   buttons stay on top and usable. */
#mango-turn { position: fixed; inset: 0; z-index: 18; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; background: rgba(8, 7, 6, .96); text-align: center; }
#mango-turn[hidden] { display: none; }
#mango-turn .icon { width: 72px; height: 72px; color: #ff4f00; animation: mango-turn 2.4s ease-in-out infinite; }
#mango-turn.mango-turn-sideways .icon { animation-name: mango-turn-sideways; }
.mango-turn-title { font: normal clamp(18px, 6vw, 28px)/1.2 P2, monospace; }
.mango-turn-hint { font: normal 11px/1.5 P2, monospace; color: #a39482; }
@keyframes mango-turn { 0%, 30% { transform: rotate(90deg); } 60%, 100% { transform: rotate(0deg); } }
@keyframes mango-turn-sideways { 0%, 30% { transform: rotate(0deg); } 60%, 100% { transform: rotate(90deg); } }
@media (prefers-reduced-motion: reduce) { #mango-turn .icon { animation: none; } }

/* The ranking: every player's best run, in a list over the paused game (opened from the menu). */
#mango-ranking { position: fixed; inset: 0; z-index: 35; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .55); animation: mango-fade .12s; }
#mango-ranking[hidden], #mango-rank[hidden] { display: none; }
.rank-panel { display: flex; flex-direction: column; width: min(440px, 100%); max-height: min(640px, 100%); border: 1px solid #3b3229; border-radius: 16px; background: #17130f; box-shadow: 0 12px 40px rgba(0, 0, 0, .6); overflow: hidden; }
.rank-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 20px; }
.rank-title { font-size: 17px; font-weight: 600; }
.rank-window { margin-left: 6px; color: #a39482; font-size: 13px; font-weight: 500; }
#mango-ranking-close { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #a39482; cursor: pointer; }
#mango-ranking-close:hover, #mango-ranking-close:focus-visible { background: #2a231d; color: #fff; outline: none; }
#mango-ranking-close .icon { width: 20px; height: 20px; }
.rank-list { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; overscroll-behavior: contain; }
.rank-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 18px auto; align-items: center; gap: 10px; min-height: 48px; padding: 4px 12px 4px 6px; border-radius: 10px; }
.rank-row[data-you] { background: #2a231d; }
.rank-place { color: #a39482; text-align: right; font-variant-numeric: tabular-nums; }
.rank-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rank-note { display: block; color: #a39482; font-size: 12px; line-height: 1.3; }
.rank-device { display: grid; place-items: center; color: #a39482; }
.rank-device .icon { width: 16px; height: 16px; }
.rank-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-line { padding: 10px 12px 14px; color: #a39482; }
.rank-login { margin: 0 8px 8px; padding: 12px; border-radius: 10px; background: #2a231d; color: #f4ebe0; text-align: center; text-decoration: none; font-weight: 600; }
.rank-login:hover, .rank-login:focus-visible { background: #3b3229; color: #fff; outline: none; }
/* After a run: the player's place, for a moment. It never takes a touch (the next tap restarts the game). */
#mango-rank { position: fixed; left: 50%; top: max(16px, var(--safe-top)); transform: translateX(-50%); z-index: 40; max-width: calc(100% - 120px); padding: 8px 16px; border: 1px solid #3b3229; border-radius: 18px; background: #17130fee; color: #f4ebe0; font-size: 14px; font-weight: 600; line-height: 1.35; text-align: center; width: max-content; pointer-events: none; animation: mango-fade .15s; }
#mango-rank[data-tone="best"] { border-color: #ff4f00; color: #ffb38a; }

/* A build is running: a ring turns around the developer button; the open panel says what it's doing. */
.dev-ring { position: absolute; inset: -6px; border-radius: 50%; border: 3px solid transparent; border-top-color: #ffb38a; border-right-color: #ffb38a; display: none; pointer-events: none; animation: dev-spin 1.1s linear infinite; }
.dev-dock[data-build="running"] .dev-ring { display: block; }
/* Every build is over and a newer version is live: the button turns green and becomes Refresh. */
.command-fab .dev-refresh, .dev-dock[data-build="ready"] .command-fab .dev-icon { display: none; }
.dev-dock[data-build="ready"] .command-fab .dev-refresh { display: block; }
.dev-dock[data-build="ready"] .command-fab { background: #2fbf71; color: #0f1a13; }
.dev-dock[data-build="ready"] .command-fab:hover { background: #45d184; }
.dev-dock[data-build="ready"] .command-fab:focus-visible { outline-color: #2fbf7173; }
@keyframes dev-spin { to { transform: rotate(360deg); } }
.dev-build { position: absolute; left: 50%; bottom: calc(100% - 2px); transform: translateX(-50%); width: min(624px, calc(100% - 32px)); padding: 6px 12px; border-radius: 10px; background: #1a1a1acc; color: #ffb38a; font: 500 13px/1.35 system-ui, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-build[data-tone="error"] { color: #ff8a7a; white-space: normal; }
.dev-dock[data-prompt="closed"] .dev-build, .dev-build[hidden] { display: none; }
/* The helper line: beside the round button while the prompt is closed, above the prompt while it is open. */
/* What the last build said: a card above the developer button, until it is closed or a note is sent. */
.dev-said { position: absolute; right: max(8px, var(--safe-right)); bottom: calc(100% + 4px); width: min(440px, calc(100% - 16px)); max-height: 45vh; overflow-y: auto; padding: 10px 14px 12px; border: 1px solid #ffffff2e; border-radius: 14px; background: #1a1a1af2; color: #f2f1ed; font: 400 14px/1.45 system-ui, sans-serif; box-shadow: 0 6px 18px #00000059; box-sizing: border-box; }
.dev-said[hidden], .dev-dock[data-prompt="open"] .dev-said { display: none; }
.dev-said p { margin: 0; }
.dev-said-text { white-space: pre-line; }
.dev-said-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px !important; color: #f2f1ed99; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.dev-said-x { display: grid; place-items: center; width: 26px; height: 26px; margin: -4px -6px -4px 0; padding: 0; border: 0; border-radius: 999px; background: transparent; color: #f2f1edaa; cursor: pointer; }
.dev-said-x:hover { background: #ffffff1a; color: #fff; }
.dev-said-x .icon { width: 16px; height: 16px; }
.dev-said-more { display: inline-block; margin-top: 8px; padding: 0; border: 0; background: none; color: #f2f1ed99; font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
/* The history: a small quiet round button just above the developer button, while the prompt is closed */
.dev-history { flex-shrink: 0; display: grid; place-items: center; width: 36px; height: 36px; margin-left: -6px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #a8a6a0; cursor: pointer; }
.dev-history:hover { color: #edece8; background: #ffffff14; }
.dev-history .icon { width: 19px; height: 19px; }
/* The history sheet: every build, newest first, with its notes and what it said */
.mango-history { width: min(560px, calc(100vw - 32px)); max-height: min(80vh, 760px); padding: 0; border: 1px solid #ffffff2e; border-radius: 14px; background: #161616; color: #f2f1ed; font: 400 14px/1.45 system-ui, sans-serif; overflow: hidden; }
.mango-history[open] { display: flex; flex-direction: column; }
.mango-history::backdrop { background: #000a; }
.mango-history-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 18px; border-bottom: 1px solid #ffffff14; }
.mango-history-title { margin: 0; font-size: 16px; font-weight: 600; }
.mango-history-x { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #f2f1edaa; cursor: pointer; }
.mango-history-x:hover { background: #ffffff1a; color: #fff; }
.mango-history-x .icon { width: 18px; height: 18px; }
.mango-history-list { overflow-y: auto; padding: 4px 18px 16px; }
.mango-history-list p { margin: 0; }
.mh-build { padding: 12px 0; border-bottom: 1px solid #ffffff12; }
.mh-head { margin-bottom: 4px !important; color: #f2f1ed80; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.mh-answer { margin-bottom: 6px !important; padding: 8px 10px; border-left: 3px solid #ff4f00; border-radius: 4px; background: #ff4f0014; white-space: pre-line; }
.mh-summary { margin-bottom: 6px !important; white-space: pre-line; }
.mh-error { margin-bottom: 6px !important; color: #ff8a7a; }
.mh-question { margin-bottom: 6px !important; color: #ffb38a; font-style: italic; }
.mh-note { margin: 6px 0 0 0; padding-left: 10px; border-left: 2px solid #ffffff1f; }
.mh-note-body { color: #f2f1edcc; white-space: pre-line; }
.mh-note-reply { margin-top: 2px !important; color: #f2f1ed80; font-size: 13px; white-space: pre-line; }
.mh-note-reply.mh-declined { color: #ffb38a99; }
.mh-none { padding: 16px 0; color: #f2f1ed80; }
.mh-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mh-head-row .mh-head { margin-bottom: 0 !important; }
.mh-running .mh-head { color: #ff8a4c; }
.mh-stop { flex: none; padding: 5px 14px; border: 1px solid #ff6a5a80; border-radius: 999px; background: transparent; color: #ff8a7a; font: 600 13px/1.2 system-ui, sans-serif; cursor: pointer; }
.mh-stop:hover { background: #ff6a5a1f; color: #ffb0a6; }
.mh-stop:disabled { opacity: .6; cursor: default; }
.mh-more { display: inline-block; margin-top: 12px; color: #f2f1ed99; font-size: 12px; }
.dev-ask { max-width: min(360px, calc(100% - 76px)); margin: 0 6px 10px 0; padding: 10px 14px; border: 1px solid var(--prompt-accent); border-radius: 14px 14px 4px 14px; background: #1a1a1af2; color: #f2f1ed; font: 500 15px/1.35 system-ui, sans-serif; text-align: left; cursor: pointer; box-shadow: 0 6px 18px #00000059; }
.dev-ask[hidden] { display: none; }
.dev-dock[data-prompt="open"] .dev-ask { position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%); width: min(624px, calc(100% - 32px)); max-width: none; margin: 0; border-radius: 12px; }
.dev-dock[data-prompt="open"] .dev-build:not([hidden]) ~ .dev-ask { bottom: calc(100% + 36px); }
@media (prefers-reduced-motion: reduce) { .dev-ring { animation-duration: 3s; } }

.mango-fatal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: #ff8a7a; }

@keyframes dev-up { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes mango-fade { from { opacity: 0; } to { opacity: 1; } }

/* The invitation to a room (a game played together), where a game played alone has its ranking card: the room's QR
   code and its link (host.js places it and sets --u, one game unit in pixels). In a wide room the code stands
   beside the words, in a tall one above them. A press on the code shows it big (#mango-room-big). */
#mango-room-card { position: fixed; z-index: 12; display: flex; align-items: center; gap: calc(var(--u, 1px) * 26); padding: calc(var(--u, 1px) * 24) calc(var(--u, 1px) * 28); border: calc(var(--u, 1px) * 3) solid #ffc23f66; border-radius: calc(var(--u, 1px) * 22); background: rgba(10, 8, 6, .86); color: #f4ebe0; font: calc(var(--u, 1px) * 22) / 1.35 P2, monospace; overflow: hidden; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
#mango-room-card[hidden] { display: none; }
#mango-room-card[data-shape="tall"] { flex-direction: column; justify-content: center; gap: calc(var(--u, 1px) * 18); }
.rm-qr { flex: 0 0 auto; height: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: calc(var(--u, 1px) * 10); background: #fff; overflow: hidden; cursor: zoom-in; }
#mango-room-card[data-shape="tall"] .rm-qr { flex: 1 1 0; min-height: 0; height: auto; }
.rm-qr .qr, #mango-room-big .qr, #mango-share-big .qr { display: block; width: 100%; height: 100%; }
.rm-side { display: flex; flex-direction: column; align-items: flex-start; gap: calc(var(--u, 1px) * 16); min-width: 0; }
#mango-room-card[data-shape="tall"] .rm-side { flex-direction: row; align-items: center; justify-content: space-between; width: 100%; }
.rm-title { color: #ffc23f; }
.rm-hint { color: #a39482; font: calc(var(--u, 1px) * 20) / 1.35 system-ui, -apple-system, 'Segoe UI', sans-serif; }
#mango-room-card[data-shape="tall"] .rm-hint { display: none; }
#mango-room-card[data-shape="tall"] .rm-title { font-size: calc(var(--u, 1px) * 20); white-space: nowrap; }
.rm-share { position: relative; display: inline-flex; align-items: center; gap: calc(var(--u, 1px) * 10); min-height: calc(var(--u, 1px) * 56); padding: 0 calc(var(--u, 1px) * 18); border: calc(var(--u, 1px) * 2) solid #ffc23f66; border-radius: calc(var(--u, 1px) * 12); background: #2a231d; color: #f4ebe0; font: 600 calc(var(--u, 1px) * 22) / 1 system-ui, -apple-system, 'Segoe UI', sans-serif; white-space: nowrap; cursor: pointer; }
.rm-share::after { content: ""; position: absolute; inset: calc(var(--u, 1px) * -14); } /* a finger's worth of room around it */
.rm-share:hover, .rm-share:focus-visible { border-color: #ffc23f; outline: none; }
.rm-share .icon { width: calc(var(--u, 1px) * 24); height: calc(var(--u, 1px) * 24); }
#mango-room-big, #mango-share-big { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0, 0, 0, .9); cursor: zoom-out; }
#mango-room-big[hidden], #mango-share-big[hidden] { display: none; }
.share-words { margin: 0; color: #d8cbb8; font: 600 15px/1.3 system-ui, sans-serif; text-align: center; }
.rm-big { display: flex; flex-direction: column; align-items: center; gap: 18px; }
#mango-room-big .qr, #mango-share-big .qr { width: min(86vw, 100vh - 190px, 600px); height: auto; border-radius: 12px; }

/* The ranking card on the start and game-over screens: laid over the room the game leaves for it (host.js places it
   and sets --u, one game unit in pixels, so it scales with the game). The best three, then the player's own place. */
#mango-rank-card { position: fixed; z-index: 12; display: flex; flex-direction: column; gap: calc(var(--u, 1px) * 10); padding: calc(var(--u, 1px) * 26) calc(var(--u, 1px) * 30); border: calc(var(--u, 1px) * 3) solid #ffc23f66; border-radius: calc(var(--u, 1px) * 22); background: rgba(10, 8, 6, .86); color: #f4ebe0; font: calc(var(--u, 1px) * 24) / 1.2 P2, monospace; cursor: pointer; overflow: hidden; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
#mango-rank-card[hidden] { display: none; }
#mango-rank-card:hover, #mango-rank-card:focus-visible { border-color: #ffc23f; outline: none; }
.rc-window { color: #a39482; font-size: calc(var(--u, 1px) * 18); text-align: center; letter-spacing: .04em; }
/* A game with levels: the card is headed by the level it ranks, between the way to the one before and the next. */
.rc-levels { display: grid; grid-template-columns: calc(var(--u, 1px) * 76) minmax(0, 1fr) calc(var(--u, 1px) * 76); align-items: center; gap: calc(var(--u, 1px) * 10); min-height: calc(var(--u, 1px) * 50); }
.rc-level { grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; text-transform: uppercase; color: #ffc23f; }
.rc-step { position: relative; display: grid; place-items: center; width: calc(var(--u, 1px) * 76); height: calc(var(--u, 1px) * 50); padding: 0; border: calc(var(--u, 1px) * 2) solid #ffc23f66; border-radius: calc(var(--u, 1px) * 12); background: #2a231d; color: #ffc23f; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rc-step::after { content: ""; position: absolute; inset: calc(var(--u, 1px) * -16); } /* a finger's worth of room around it */
.rc-step[hidden] { display: grid; visibility: hidden; }
.rc-step:hover:not(:disabled), .rc-step:focus-visible { border-color: #ffc23f; outline: none; }
.rc-step:disabled { border-color: #3b3229; color: #6f6356; cursor: default; }
.rc-step .icon { width: calc(var(--u, 1px) * 26); height: calc(var(--u, 1px) * 26); }
#mango-level-prev { grid-column: 1; }
#mango-level-next { grid-column: 3; }
.rc-step-lock, .rc-step[data-locked] .rc-step-go { display: none; }
.rc-step[data-locked] .rc-step-lock { display: grid; }
#mango-rank-card:has(.rc-levels) { padding-block: calc(var(--u, 1px) * 16); }
#mango-rank-card:has(.rc-levels) .rc-row { min-height: calc(var(--u, 1px) * 34); }
.rc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: calc(var(--u, 1px) * 6); }
.rc-row { display: grid; grid-template-columns: calc(var(--u, 1px) * 56) minmax(0, 1fr) auto; align-items: center; gap: calc(var(--u, 1px) * 14); min-height: calc(var(--u, 1px) * 36); }
.rc-row[data-you] { color: #ffc23f; }
.rc-place { color: #a39482; text-align: right; }
.rc-row[data-you] .rc-place { color: #ffc23f; }
.rc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: uppercase; }
.rc-score { text-align: right; }
.rc-gap { color: #6f6356; text-align: center; line-height: .6; }
.rc-line { color: #a39482; font-size: calc(var(--u, 1px) * 18); text-align: center; padding-top: calc(var(--u, 1px) * 6); }
/* A game with levels: the strip of levels to choose from (pictures captured from play), then the best three. */
#mango-rank-card:has(.rc-strip) { gap: calc(var(--u, 1px) * 8); padding: calc(var(--u, 1px) * 14) calc(var(--u, 1px) * 18); }
.rc-strip { display: flex; gap: calc(var(--u, 1px) * 10); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; flex-shrink: 0; }
.rc-strip::-webkit-scrollbar { display: none; }
.rc-tile { position: relative; flex: 0 0 calc(var(--u, 1px) * 168); display: flex; flex-direction: column; gap: calc(var(--u, 1px) * 4); padding: calc(var(--u, 1px) * 5); border: calc(var(--u, 1px) * 3) solid #3b3229; border-radius: calc(var(--u, 1px) * 14); background: #17130f; color: inherit; font: inherit; text-align: left; cursor: pointer; scroll-snap-align: start; }
.rc-tile[data-on] { border-color: #ffc23f; background: #2a231d; }
.rc-tile:disabled { cursor: default; opacity: .55; }
.rc-tile:hover:not(:disabled):not([data-on]), .rc-tile:focus-visible { border-color: #ffc23f99; outline: none; }
.rc-pic { position: relative; height: calc(var(--u, 1px) * 92); border-radius: calc(var(--u, 1px) * 9); background: #2a231d; overflow: hidden; display: grid; place-items: center; }
.rc-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rc-pic-none { color: #6f6356; font-size: calc(var(--u, 1px) * 34); }
.rc-pic .icon { position: absolute; width: calc(var(--u, 1px) * 34); height: calc(var(--u, 1px) * 34); color: #f4ebe0; filter: drop-shadow(0 1px 3px #000); }
/* the level's name inside its picture, along the bottom, on a see-through band so it reads over any picture */
.rc-pic-name { position: absolute; left: 0; right: 0; bottom: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: break-word; padding: calc(var(--u, 1px) * 4) calc(var(--u, 1px) * 8); background: #000000a6; color: #f4ebe0; font-size: calc(var(--u, 1px) * 14); line-height: 1.25; text-align: left; text-transform: uppercase; letter-spacing: .03em; text-shadow: 0 1px 2px #000; pointer-events: none; }
.rc-tile[data-on] .rc-pic-name { color: #ffc23f; }
.rc-tile-best { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #a39482; font-size: calc(var(--u, 1px) * 15); }
.rc-head { display: flex; justify-content: space-between; align-items: baseline; gap: calc(var(--u, 1px) * 10); min-width: 0; }
.rc-head .rc-level { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: uppercase; color: #ffc23f; }
.rc-best3 { flex-shrink: 0; color: #a39482; font-size: calc(var(--u, 1px) * 16); letter-spacing: .04em; }
#mango-rank-card:has(.rc-strip) .rc-row { min-height: calc(var(--u, 1px) * 30); }
.rc-foot { display: flex; justify-content: space-between; align-items: center; gap: calc(var(--u, 1px) * 10); margin-top: auto; color: #a39482; font-size: calc(var(--u, 1px) * 16); }
.rc-you { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-full { display: inline-flex; align-items: center; gap: calc(var(--u, 1px) * 4); flex-shrink: 0; color: #f4ebe0; }
.rc-full .icon { width: calc(var(--u, 1px) * 18); height: calc(var(--u, 1px) * 18); }
/* The picker filling the card (the game leaves room for the best player beside its words): levels in two columns. */
#mango-rank-card[data-grid] { cursor: default; padding: 0; border: 0; background: transparent; box-shadow: none; } /* no big frame: each level has its own */
/* The picker filling the card: each level is its picture alone (no words, to spare the room): on a game on its
   side one per row across the card's width, scrolling down; upright one per column across its height, scrolling
   sideways. The chosen one has the bright frame; one not opened yet shows a lock. */
#mango-rank-card[data-grid] .rc-strip { flex: 1 1 auto; min-height: 0; gap: calc(var(--u, 1px) * 12); }
#mango-rank-card[data-grid] .rc-tile { padding: calc(var(--u, 1px) * 4); }
#mango-rank-card[data-grid] .rc-tile-best { display: none; }
#mango-rank-card[data-grid] .rc-pic { height: auto; aspect-ratio: 16 / 9; }
#mango-rank-card[data-grid][data-orient="side"] .rc-strip { display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto; scroll-snap-type: y proximity; }
#mango-rank-card[data-grid][data-orient="side"] .rc-tile { flex: 0 0 auto; width: auto; }
#mango-rank-card[data-grid][data-orient="up"] .rc-strip { display: flex; flex-direction: row; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; }
#mango-rank-card[data-grid][data-orient="up"] .rc-tile { flex: 0 0 auto; height: auto; }
#mango-rank-card[data-grid][data-orient="up"] .rc-pic { height: 100%; aspect-ratio: 9 / 16; }
#mango-rank-card[data-grid] .rc-head, #mango-rank-card[data-grid] .rc-list, #mango-rank-card[data-grid] .rc-foot { display: none; }
/* Beside the game's words: three places of the chosen level's ranking (no frame), View more, and the big Play. */
#mango-lead { position: fixed; z-index: 12; display: flex; align-items: center; gap: calc(var(--u, 1px) * 24); color: #f4ebe0; font-family: P2, monospace; font-size: calc(var(--u, 1px) * 19); text-shadow: 0 calc(var(--u, 1px) * 2) calc(var(--u, 1px) * 4) #000c; }
#mango-lead[hidden] { display: none; }
.ld-text { display: flex; flex-direction: column; gap: calc(var(--u, 1px) * 6); flex: 1; min-width: 0; padding: calc(var(--u, 1px) * 8) calc(var(--u, 1px) * 14); border-radius: calc(var(--u, 1px) * 16); background: radial-gradient(ellipse at 40% 50%, #000000b3 30%, #0000008c 60%, #00000000 100%); cursor: pointer; } /* a soft dark backdrop, no frame: the places read over any scenery */
.ld-text:focus-visible { outline: calc(var(--u, 1px) * 3) solid #ffc23f; outline-offset: calc(var(--u, 1px) * 6); }
.ld-text { position: relative; }
.ld-title { color: #ffc23f; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(var(--u, 1px) * 16); }
#mango-lead[data-titled="yes"] .ld-title { position: absolute; left: calc(var(--u, 1px) * 14); right: 0; bottom: 100%; margin-bottom: calc(var(--u, 1px) * 4); font-size: calc(var(--u, 1px) * 30); } /* the level's name just above its places */
.ld-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: calc(var(--u, 1px) * 4); }
.ld-row { display: grid; grid-template-columns: calc(var(--u, 1px) * 44) minmax(0, 1fr) auto; gap: calc(var(--u, 1px) * 12); align-items: center; }
.ld-row[data-you] { color: #ffc23f; }
.ld-place { color: #a39482; text-align: right; }
.ld-row[data-you] .ld-place { color: #ffc23f; }
.ld-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: uppercase; }
.ld-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #a39482; font-size: calc(var(--u, 1px) * 16); }
#mango-lead[data-titled="no"] .ld-title { display: none; }
.ld-play[hidden] { display: none !important; }
.ld-play { position: fixed; z-index: 12; display: flex; align-items: center; justify-content: center; gap: calc(var(--u, 1px) * 16); padding: 0 calc(var(--u, 1px) * 24); border: 0; border-radius: calc(var(--u, 1px) * 999); background: #ff4f00; color: #1a1a1a; font: 400 calc(var(--u, 1px) * 30) P2, monospace; text-shadow: none; cursor: pointer; box-shadow: 0 calc(var(--u, 1px) * 6) calc(var(--u, 1px) * 18) #00000080; }
.ld-play:hover { background: #ff6a26; }
.ld-play .icon { width: calc(var(--u, 1px) * 34); height: calc(var(--u, 1px) * 34); fill: currentColor; flex-shrink: 0; }
.ld-play-key { font-size: calc(var(--u, 1px) * 14); opacity: .65; }
.ld-play[data-wide] { justify-content: flex-start; padding: 0 calc(var(--u, 1px) * 32); font-size: calc(var(--u, 1px) * 26); } /* one line: ▶ PLAY …… SPACE */
.ld-play[data-wide] .ld-play-words { flex: 1; text-align: left; }
.ld-play[data-wide] .icon { width: calc(var(--u, 1px) * 28); height: calc(var(--u, 1px) * 28); }
.ld-play[data-wide] .ld-play-key { font-size: calc(var(--u, 1px) * 18); }
.ld-play[data-touch] .ld-play-key { display: none; }

/* Credits: the recordings from the platform's sound library a game plays. */
.mango-credits { max-width: min(520px, calc(100vw - 32px)); padding: 18px 20px; border: 1px solid #3b3229; border-radius: 14px; background: #17130f; color: #f4ebe0; font: 15px/1.45 system-ui, sans-serif; }
.mango-credits::backdrop { background: #000a; }
.mango-credits h2 { margin: 0 0 8px; font-size: 17px; }
.mango-credits ul { margin: 0 0 14px; padding-left: 18px; }
.mango-credits-names { margin: 0 0 14px; color: #f4ebe0cc; }
.mango-credits a { color: #ffc23f; }
.mango-credits button { padding: 8px 16px; border: 1px solid #ffc23f; border-radius: 999px; background: transparent; color: #f4ebe0; font: inherit; cursor: pointer; }

/* Moments: now and then, after a run, the player taps its best (or most boring) moment among six pictures of it. */
#mango-moments { position: fixed; left: 50%; top: calc(max(16px, var(--safe-top)) + 52px); transform: translateX(-50%); z-index: 41; width: min(560px, calc(100% - 32px)); box-sizing: border-box; padding: 10px 12px 12px; border: 1px solid #3b3229; border-radius: 16px; background: #17130ff2; color: #f4ebe0; font: 600 14px/1.35 system-ui, sans-serif; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: mango-fade .15s; }
#mango-moments .mm-ask { margin: 0 34px 8px 2px; }
#mango-moments .mm-skip { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #a39482; font-size: 22px; line-height: 1; cursor: pointer; }
#mango-moments .mm-skip:hover, #mango-moments .mm-skip:focus-visible { background: #2a231d; color: #fff; outline: none; }
#mango-moments .mm-frames { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
#mango-moments[data-wide] .mm-frames { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#mango-moments .mm-frame { display: block; padding: 0; border: 2px solid transparent; border-radius: 8px; background: #000; overflow: hidden; cursor: pointer; }
#mango-moments .mm-frame:hover, #mango-moments .mm-frame:focus-visible { border-color: #ffc23f; outline: none; }
#mango-moments .mm-frame img { display: block; width: 100%; height: auto; }

/* The maker's tools (GameTools): a column of small round buttons above the developer button, one per tool. During
   play they stand back (host.js: .dev-tools-quiet); on a tool's page the open one is lit and the play button on top
   goes back to the game. */
.dev-tools { position: absolute; right: calc(max(8px, var(--safe-right)) + 12px); bottom: calc(max(8px, var(--safe-bottom)) + 72px); display: flex; flex-direction: column; align-items: center; gap: 10px; transition: opacity .25s; }
.dev-dock[data-prompt="open"] .dev-tools { display: none; }
.dev-tools.dev-tools-quiet { opacity: .35; }
.dev-tool { position: relative; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: #1a1a1ae6; color: #edece8; box-shadow: 0 4px 12px #00000059, 0 0 0 1px #ffffff26; cursor: pointer; text-decoration: none; }
.dev-tool .icon { width: 19px; height: 19px; stroke-width: 2; pointer-events: none; }
.dev-tool:hover { background: #2a2a2a; }
.dev-tool:focus-visible { outline: 3px solid color-mix(in srgb, var(--prompt-accent) 45%, transparent); outline-offset: 3px; }
.dev-tool[aria-current="page"] { background: var(--prompt-accent); color: var(--prompt-on-accent); box-shadow: 0 4px 12px #00000059; }
.dev-tool-game { background: #2fbf71; color: #0f1a13; box-shadow: 0 4px 12px #00000059; }
.dev-tool-game:hover { background: #45d184; }
.dev-tools-list { position: absolute; right: calc(100% + 10px); bottom: 0; min-width: 160px; padding: 6px; border-radius: 12px; background: #1a1a1af2; box-shadow: 0 6px 18px #00000059, 0 0 0 1px #ffffff26; }
.dev-tools-list[hidden] { display: none; }
.dev-tools-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #edece8; font: 500 14px/1.2 system-ui, sans-serif; text-decoration: none; white-space: nowrap; }
.dev-tools-item:hover, .dev-tools-item[aria-current="page"] { background: #ffffff14; }
.dev-tools-item .icon { width: 18px; height: 18px; }
/* what the last build said stands beside the column, not on it */
.dev-dock[data-tools] .dev-said { right: calc(max(8px, var(--safe-right)) + 64px); width: min(440px, calc(100% - 80px)); }

/* A tool's page: the tool's own HTML over the whole page (the canvas under it, for a tool that draws). The platform's
   buttons stay over it: back top left, the menu top right, the tools and the developer button bottom right. */
#mango-tool { position: fixed; inset: 0; z-index: 5; overflow: auto; color: #edece8; font: 15px/1.4 -apple-system, system-ui, 'Segoe UI', sans-serif; }
#mango-tool { pointer-events: none; } /* (a tool that draws on the canvas gets the presses there) */
#mango-tool > * { pointer-events: auto; }
