/* Valence layout. Colours come from data\ui-tokens.json and data\palette.json as CSS variables set at start. */
@font-face { font-family: Fredoka; font-weight: 400; font-display: swap; src: url(./assets/fonts/fredoka-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Fredoka; font-weight: 500; font-display: swap; src: url(./assets/fonts/fredoka-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Fredoka; font-weight: 600; font-display: swap; src: url(./assets/fonts/fredoka-latin-600-normal.woff2) format('woff2'); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--dark, #2a2433); overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; }
body { font-family: Fredoka, system-ui, sans-serif; font-weight: 500; font-size: 18px; color: var(--c-dialogue-text, #2a2433); }
[hidden] { display: none !important; }
#world { position: fixed; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; display: block; }

.btn { font: inherit; font-weight: 600; min-height: var(--btn-min, 64px); min-width: var(--btn-min, 64px); padding: 8px 18px; border: 0; border-radius: 14px; background: var(--c-button-bg, #0f6e73); color: var(--c-button-text, #fff); cursor: pointer; }
.btn:disabled { opacity: 0.45; }
.btn:active { transform: translateY(1px); }

/* World: Act and Menu sit on the side away from the joystick. */
.worldBtn { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); display: none; opacity: 0.85; z-index: 5; }
body[data-mode="world"] .worldBtn { display: block; }
#btnAct { left: 16px; }
#btnMenu { left: calc(32px + var(--btn-min, 64px) + 24px); }
html[data-hand="left"] #btnAct { left: auto; right: 16px; }
html[data-hand="left"] #btnMenu { left: auto; right: calc(32px + var(--btn-min, 64px) + 24px); }
html[data-portrait="1"] #btnMenu { left: 16px; bottom: calc(32px + var(--btn-min, 64px) + env(safe-area-inset-bottom)); }
html[data-portrait="1"][data-hand="left"] #btnMenu { left: auto; right: 16px; }

#stick { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); right: 16px; border-radius: 50%; border: 3px solid var(--f-joystickRing, #fff); background: rgba(29, 36, 51, 0.25); display: none; z-index: 5; touch-action: none; }
#knob { position: absolute; left: 30%; top: 30%; width: 40%; height: 40%; border-radius: 50%; background: var(--f-joystickKnob, #fff); pointer-events: none; }

#banner { position: fixed; top: 12px; left: 50%; transform: translate(-50%, -160%); background: var(--c-label-plate, #1d2433); color: var(--c-label-text, #fff); padding: 8px 22px; border-radius: 12px; opacity: 0.8; transition: transform 0.25s; z-index: 6; white-space: nowrap; pointer-events: none; }
#banner.show { transform: translate(-50%, 0); }

/* Dialogue box: 2 lines, name tab at the top left. */
#talk { position: fixed; left: 10px; bottom: 8px; background: var(--c-dialogue-box-bg, #fff8e8); color: var(--c-dialogue-text, #2a2433); border-radius: 16px; border: 3px solid var(--c-dialogue-name-tab-bg, #14666b); padding: 14px 18px; z-index: 20; line-height: 1.35; cursor: pointer; }
#talkName { position: absolute; left: 12px; top: -1.3em; background: var(--c-dialogue-name-tab-bg, #14666b); color: var(--c-dialogue-name-tab-text, #fff); padding: 2px 14px; border-radius: 10px 10px 0 0; font-size: 0.85em; }
#talkText { white-space: pre-wrap; }
#talkHold { position: absolute; right: 12px; top: -1.75em; font-size: 0.62em; font-weight: 600; line-height: 1.2; padding: 2px 10px; border-radius: 999px; background: rgba(7, 28, 34, 0.62); color: #fff8e8; pointer-events: none; white-space: nowrap; }
#talkMore { position: absolute; right: 14px; bottom: 6px; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 10px solid var(--c-dialogue-name-tab-bg, #14666b); }
#talkChoice { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

/* Pages */
#screens { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.screen { position: absolute; inset: 0; pointer-events: auto; background: var(--c-book-page-bg, #fbf3dc); color: var(--c-book-text, #2a2433); display: flex; flex-direction: column; padding: calc(10px + env(safe-area-inset-top)) 16px calc(10px + env(safe-area-inset-bottom)); }
.screen h2 { margin: 0 0 8px 52px; font-size: 1.35em; min-height: 40px; display: flex; align-items: center; gap: 12px; }
.screen .body { flex: 1; overflow-y: auto; touch-action: pan-y; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.screen .foot { display: flex; gap: 10px; padding-top: 10px; }
.screen .foot .btn { flex: 1; }
.row { font: inherit; text-align: left; padding: 12px 14px; min-height: 52px; border-radius: 12px; border: 2px solid rgba(42, 36, 51, 0.25); background: rgba(255, 255, 255, 0.7); color: inherit; cursor: pointer; }
.row.plain { border-color: transparent; background: transparent; cursor: default; min-height: 0; padding: 4px 14px; }
.row.small { font-size: 0.9em; }
.row.picked { border-color: var(--c-button-bg, #0f6e73); border-width: 3px; }
.row.grey, .row:disabled { opacity: 0.5; }
.row.up { color: var(--c-dialogue-gold-text, #7a4f00); font-weight: 600; }
.note { color: var(--c-dialogue-danger-text, #a3201a); font-size: 0.9em; }
.formula { font-size: 1.6em; color: var(--c-dialogue-formula-text, #5a5266); text-align: center; }
.screen.card .body { justify-content: center; text-align: center; max-width: 34em; margin: 0 auto; }
.screen.card .note { color: var(--c-card-note-text, #5a5266); }
.screen.title { background: var(--f-awwfyBlue, #2f6fd0); color: #fff; text-align: center; }
.screen.title h2 { margin: 6vh 0 0; justify-content: center; font-size: 2.6em; }
.screen.title .body { align-items: center; justify-content: center; }
.screen.title .note { color: #fff; max-width: 30em; }
.pose { height: min(34vh, 260px); image-rendering: auto; }
.preview { height: min(34vh, 240px); align-self: center; image-rendering: pixelated; }
.lookRow { display: flex; align-items: flex-end; justify-content: center; gap: 4vw; }
.lookRow .preview { height: min(17vh, 120px); align-self: flex-end; }
.stepTitle { text-align: center; font-size: 1.1em; }
.stepValue { text-align: center; font-weight: 600; min-height: 1.4em; }
.nameInput { font: inherit; align-self: center; padding: 12px; border-radius: 12px; border: 2px solid var(--c-button-bg, #0f6e73); width: min(80vw, 16em); text-align: center; user-select: text; -webkit-user-select: text; }
h2.tap { cursor: pointer; text-decoration: underline; }
.btn.leave { margin-left: auto; min-height: 44px; }

/* Bonding chamber page: the Chapter 1 look. A dark glass room, a glowing chamber, cream orb cards below. */
.screen[data-screen="bench"] { background: radial-gradient(circle at 50% 40%, var(--c-chamber-bg-mid, #1f5a63) 0, var(--c-chamber-bg, #0e2e35) 70%, var(--c-chamber-bg-edge, #081d22) 100%); color: var(--c-chamber-text, #e6f5f1); }
.screen[data-screen="bench"] h2 { margin: 0 52px 8px; justify-content: center; font-weight: 600; color: var(--c-chamber-title-text, #8fe3d3); }
.benchChamber { flex: 1 1 0; min-height: 120px; container-type: size; align-self: stretch; display: flex; align-items: center; justify-content: center; padding: 10px 10px 24px; border-radius: 24px; border: 3px solid var(--c-chamber-edge, #3fa79b); background: radial-gradient(circle at 50% 50%, rgba(143, 227, 211, 0.25) 0, rgba(143, 227, 211, 0.08) 55%, rgba(0, 0, 0, 0) 72%); }
.benchStage { position: relative; width: min(100%, 46vh, 420px); aspect-ratio: 1; flex: none; }
/* B03: the drawn chamber (tools\chamberart.mjs) fills the chamber box, a soft light breathes behind its dome */
.benchChamber { position: relative; overflow: hidden; }
.chamberArt { position: absolute; left: 50%; top: 50%; width: min(92%, 118cqh); max-height: 92%; object-fit: contain; translate: -50% -50%; pointer-events: none; filter: drop-shadow(0 0 18px rgba(127, 245, 234, 0.45)); animation: chamberHum 3.2s ease-in-out infinite; }
.chamberGlow { position: absolute; left: 50%; top: 40%; width: min(70%, 90cqh); aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: radial-gradient(circle, rgba(127, 245, 234, 0.42) 0, rgba(127, 245, 234, 0.12) 45%, rgba(127, 245, 234, 0) 70%); pointer-events: none; animation: chamberGlow 3.2s ease-in-out infinite; }
@keyframes chamberHum { 50% { filter: drop-shadow(0 0 30px rgba(127, 245, 234, 0.7)); } }
@keyframes chamberGlow { 50% { scale: 1.12; opacity: 0.75; } }
.benchStage { z-index: 1; }
.benchChamber.building .chamberArt { opacity: 0.38; filter: blur(1px) drop-shadow(0 0 30px rgba(127, 245, 234, 0.7)); transition: opacity 0.3s; }
.benchChamber .benchHint { align-items: flex-end; padding: 0 8% 3%; }
.benchChamber .benchHint > span { padding: 6px 16px; border-radius: 999px; background: rgba(7, 28, 34, 0.78); color: var(--c-chamber-hint-text, #a9cfc7); border: 2px solid rgba(127, 245, 234, 0.35); }
.benchHint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 12%; font-weight: 600; color: var(--c-chamber-hint-text, #a9cfc7); }
.mark { position: absolute; width: 12%; height: 12%; margin: -6% 0 0 -6%; border-radius: 50%; border: 3px dashed rgba(143, 227, 211, 0.7); }
.atom { font: inherit; font-weight: 600; border: 3px solid #3a3a3a; background: #d0d0d0; color: #2a2433; border-radius: 50%; cursor: pointer; }
.atom.centre { position: absolute; left: 50%; top: 50%; width: 30%; height: 30%; margin: -15% 0 0 -15%; }
.atom.placed { position: absolute; width: 22%; height: 22%; margin: -11% 0 0 -11%; background: #bdbdbd; }
.benchMsg { text-align: center; min-height: 1.3em; font-weight: 600; color: var(--c-chamber-msg-text, #ffc7b8); }
.screen[data-screen="bench"] .body { overflow: hidden; }
.benchWrap { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
.benchMain { display: flex; flex-direction: column; gap: 6px; flex: 1 1 52%; min-width: 0; min-height: 0; }
/* what can be made: one card for each compound. A tap builds it. */
.benchList { flex: 1 1 48%; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 16px; border: 2px solid rgba(63, 167, 155, 0.6); background: rgba(143, 227, 211, 0.08); }
.benchListTitle { flex: none; font-weight: 600; text-align: center; }
.benchListNone { grid-column: 1 / -1; text-align: center; font-size: 0.9em; padding: 12px; }
.makeGrid { flex: 1; min-height: 0; overflow-y: auto; touch-action: pan-y; display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(8.6em, 15vw, 15em), 1fr)); gap: 8px; align-content: start; grid-auto-rows: max-content; scrollbar-width: none; }
.makeGrid::-webkit-scrollbar, .benchTray::-webkit-scrollbar { display: none; }
.make { font: inherit; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 64px; padding: 8px 8px 10px; border-radius: 16px; border: 3px solid var(--c-chamber-card-edge, #cdb88e); background: var(--c-chamber-card-bg, #fffbf2); color: var(--c-chamber-card-text, #2a2433); cursor: pointer; text-align: center; }
.make.short { opacity: 0.6; }
.make.picked { outline: 4px solid var(--c-chamber-title-text, #8fe3d3); }
.busy .make:not(.picked) { opacity: 0.3; pointer-events: none; }
.makePic { width: 100%; height: clamp(60px, 15vh, 170px); display: grid; place-items: center; }
.makePic img { max-width: 100%; max-height: clamp(60px, 15vh, 170px); object-fit: contain; }
.make.unseen .makePic img { filter: brightness(0) opacity(0.28); }   /* never seen: only its shape */
.makeName { font-weight: 600; line-height: 1.1; }
.makeFormula { font-size: 0.9em; }
.makeNeed { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 8px; margin-top: 2px; }
.makeAtom { display: inline-flex; align-items: center; gap: 2px; font-size: 0.85em; }
.makeAtom.low b { color: var(--c-dialogue-danger-text, #a3201a); }
.atom.mini { width: 1.7em; height: 1.7em; border: 0; background: none; display: inline-grid; place-items: center; cursor: inherit; }
.make > .famBadge { top: 5px; right: 5px; width: 2em; height: 2em; }
.makeTag { position: absolute; top: 6px; left: 6px; font-size: 0.7em; font-weight: 600; border-radius: 8px; padding: 1px 7px; background: #8a4f08; color: #fff; }
.make.made .makeTag { background: var(--c-chamber-button-bg, #1f7f74); }
@media (orientation: landscape) {
  /* the chamber on the left, the cards beside it */
  .benchWrap { flex-direction: row; align-items: stretch; gap: 16px; }
  .benchMain { flex: 1 1 50%; }
  .benchList { flex: 1 1 50%; }
}
.benchTray { scrollbar-width: none; }
/* the atoms the player carries stand in one row; with many kinds the row slides sideways */
.benchTray { display: flex; gap: 10px; overflow-x: auto; touch-action: pan-x; padding: 9px 9px 2px; flex: none; }
.benchTray::before, .benchTray::after { content: ''; margin: auto; }
.atom.tray { flex: none; position: relative; display: grid; justify-items: center; min-width: 76px; padding: 5px 8px 3px; border-radius: 16px; border: 3px solid var(--c-chamber-card-edge, #cdb88e); background: var(--c-chamber-card-bg, #fffbf2); color: var(--c-chamber-card-text, #2a2433); }
.atom.tray .orbimg { width: 46px; height: 46px; }
.atom.tray .count { position: absolute; right: -8px; top: -8px; background: var(--c-chamber-button-bg, #1f7f74); color: var(--c-chamber-button-text, #fff); border-radius: 10px; padding: 0 7px; font-size: 0.8em; }
.atom.tray .aname { font-size: 0.75em; font-weight: 600; white-space: nowrap; }
.atom.centre .aname, .atom.placed .aname { position: absolute; left: 50%; top: 96%; transform: translateX(-50%); font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--c-chamber-label-text, #bfe9e0); pointer-events: none; }
.screen[data-screen="bench"] .foot .btn { border-radius: 999px; background: transparent; color: var(--c-chamber-label-text, #bfe9e0); border: 2px solid var(--c-chamber-edge, #3fa79b); }
.screen[data-screen="bench"] .foot .btn[data-act="bond"] { background: var(--c-chamber-button-bg, #1f7f74); color: var(--c-chamber-button-text, #fff); border-color: transparent; }

/* Fight: the picture behind is shown whole, both sides stand on its rings (fight.js sets the sizes) */
#fight { position: fixed; inset: 0; z-index: 30; background: #10141f; color: var(--c-fight-name-text, #fff); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left)); }
#fight[data-side="1"] { flex-direction: row; }
.fview { position: relative; flex: none; background: #2a3142 no-repeat; border-radius: 14px; overflow: hidden; }
.fstage { position: absolute; inset: 0; }
.fside { flex: 1 1 0; min-width: 0; min-height: 0; align-self: stretch; display: flex; flex-direction: column; gap: 8px; }
#fight[data-side="0"][data-tall="0"] .fside { flex-direction: row; align-items: stretch; }
#fight[data-side="0"][data-tall="0"] .fmsg { flex: 1 1 34%; }
#fight[data-side="0"][data-tall="0"] .fbtns { flex: 2 1 66%; }
.fmsg { background: var(--c-dialogue-box-bg, #fff8e8); color: var(--c-dialogue-text, #2a2433); border: 3px solid var(--c-dialogue-name-tab-bg, #14666b); border-radius: 14px; padding: 8px 12px; min-height: 3.6em; display: flex; flex-direction: column; justify-content: center; }
.fline { font-weight: 500; }
.freason { color: var(--c-dialogue-gold-text, #7a4f00); font-size: 0.9em; }
.freason:empty { display: none; }
.fbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#fight[data-side="0"][data-tall="0"] .fbtns[data-count="4"] { grid-template-columns: repeat(4, 1fr); }
#fight[data-side="0"][data-tall="0"] .fbtns[data-count="3"] { grid-template-columns: repeat(3, 1fr); }
#fight[data-tall="1"] .fbtns[data-count="3"] .fbtn:last-child { grid-column: span 2; }
#fight[data-side="1"] .fbtns { grid-template-columns: 1fr; }
#fight[data-side="1"] .fbtn { min-height: clamp(56px, 10vh, 104px); font-size: 1.1em; }
/* the team, in the free room of a side column */
.fteam { flex: 1; min-height: 0; display: none; flex-direction: column; justify-content: safe center; gap: 6px; overflow: hidden; }
#fight[data-side="1"] .fteam { display: flex; }
@media (max-height: 660px) { #fight[data-side="1"] .fteam { display: none; } #fight[data-side="1"] .fside { justify-content: space-between; } }
.fmate { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); border: 2px solid transparent; font-size: 0.85em; }
.fmate.on { border-color: #f4e6c2; background: rgba(255, 255, 255, 0.13); }
.fmate.out { opacity: 0.45; }
.fmate.empty { min-height: 2.9em; border: 2px dashed rgba(255, 255, 255, 0.16); background: none; }
.fteam .fmate { flex: none; }
.fteam .fmate.empty { min-height: 0; flex: 0 1 2.9em; }   /* B10: when the column is short, the empty slots shrink first; the team never slides under the hint */
.fmate img { width: 2.5em; height: 2.5em; object-fit: contain; flex: none; }
.fmate > div { flex: 1; min-width: 0; }
.fmate span { display: flex; justify-content: space-between; gap: 6px; white-space: nowrap; }
.fmateBar { height: 6px; margin-top: 3px; background: var(--c-fight-hp-track, #0b0f18); border-radius: 3px; overflow: hidden; }
.fmateBar i { display: block; height: 100%; background: var(--c-fight-hp-high, #3fbf5a); }
/* name panels, in the look of the drawn panel: dark navy, cream rim, a round place for the family icon */
.fpanel { position: absolute; z-index: 6; display: flex; align-items: center; gap: 0.5em; width: clamp(11.5em, 37%, 19em); padding: 0.35em 0.9em 0.35em 0.4em; background: var(--c-fight-panel-bg, #1d2433); border: 0.16em solid #f4e6c2; border-radius: 2.3em 0.9em 0.9em 2.3em; box-shadow: 0 0.22em 0 rgba(0, 0, 0, 0.35); transition: translate 0.35s ease-out, opacity 0.35s; }
#fight[data-tall="1"] .fpanel { width: clamp(12em, 52%, 19em); }
.fpanel.foe { left: 2.5%; top: max(3%, 46px); }
.fpanel.mine { right: 2.5%; bottom: 3%; }
.fpanel.away { opacity: 0; }
.fpanel.foe.away { translate: -14% 0; }
.fpanel.mine.away { translate: 14% 0; }
.ficon { flex: none; width: 3.4em; height: 3.4em; border-radius: 50%; display: grid; place-items: center; background: var(--c-fight-hp-track, #0b0f18); border: 0.14em solid #f4e6c2; font-weight: 600; overflow: hidden; }
.ficon:has(img) { border: 0; background: none; }
.ficon img { width: 100%; height: 100%; display: block; }
.fwords { flex: 1; min-width: 0; }
.frow { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5em; }
.fname { font-weight: 600; line-height: 1.1; overflow-wrap: anywhere; }
.flv { flex: none; font-size: 0.85em; }
.fformula, .ffam { font-size: 0.8em; color: var(--c-fight-formula-text, #c9d2e3); white-space: nowrap; }
.fhp { font-size: 0.75em; text-align: right; color: var(--c-fight-hp-text, #fff); }
.fbar { position: relative; height: 0.7em; background: var(--c-fight-hp-track, #0b0f18); border-radius: 0.4em; margin: 0.2em 0 0.1em; overflow: hidden; }
.fbarFill { height: 100%; width: 100%; background: var(--c-fight-hp-high, #3fbf5a); transition: width 0.6s ease-out; }
.fbarFill[data-level="mid"] { background: var(--c-fight-hp-mid, #ffd23f); }
.fbarFill[data-level="low"] { background: var(--c-fight-hp-low, #ff6a5c); }
.fbarLine { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: #fff; }
/* the two sides: a point at the feet, a shadow, and one picture */
.fsprite { position: absolute; width: 0; height: 0; z-index: 1; }
.fsprite.mine { z-index: 2; }
.fshadow { position: absolute; left: 0; top: 0; translate: -50% -50%; border-radius: 50%; background: radial-gradient(closest-side, rgba(20, 16, 30, 0.4), rgba(20, 16, 30, 0)); }
.fbody { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
.fpic { position: absolute; bottom: 0; background-repeat: no-repeat; }
.fpic.plain { background: #c4c4c4; border: 4px solid #3a3a3a; border-radius: 22%; display: grid; place-items: center; color: #2a2433; font-weight: 600; box-sizing: border-box; }
.fsprite.foe .fpic { transform: scaleX(-1); }
.fsprite.compound .fbody { animation: fBreath 2.8s ease-in-out infinite; }
.fsprite.element .fbody { animation: fBob 1.5s ease-in-out infinite; }
@keyframes fBreath { 50% { scale: 1.012 1.03; } }
@keyframes fBob { 50% { scale: 1.05 0.94; } }
/* where a hit lands */
.fdark { position: absolute; inset: 0; background: #0a1020; opacity: 0; pointer-events: none; }
/* the big effect: the drawn pieces (art\fx), put together by src\fx.js. It lies over the bodies and under the name panels. */
.ffx { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 5; }
/* the page that shows only the effects (SEE-EFFECTS.bat) */
#fight .fbtns[data-count="show"] { grid-template-columns: repeat(3, 1fr); gap: 6px; }
#fight[data-side="1"] .fbtns[data-count="show"] { grid-template-columns: 1fr 1fr; }
#fight[data-side="0"][data-tall="0"] .fbtns[data-count="show"] { grid-template-columns: repeat(4, 1fr); }
#fight .fbtns[data-count="show"] .fbtn { min-height: 40px; font-size: 0.9em; padding: 2px 4px; }
#fight .fbtns[data-count="show"] .fbtn:last-child { grid-column: 1 / -1; }
.fbtn.special { animation: fspecial 0.7s steps(2, jump-none) infinite; color: #3a2a1e; border-color: #ffffff; }
@keyframes fspecial { from { background: #ffd92e; } to { background: #fffdf0; } }
@media (prefers-reduced-motion: reduce) { .fbtn.special { animation: none; background: #ffd92e; } }
.fburst { position: absolute; width: 0; height: 0; z-index: 5; pointer-events: none; }
.fburst i, .fburst b { position: absolute; left: calc(var(--r) * -1); top: calc(var(--r) * -1); width: calc(var(--r) * 2); height: calc(var(--r) * 2); box-sizing: border-box; }
.fburst i { border-radius: 50%; border: calc(var(--r) * 0.16) solid #fff; animation: fRing 0.5s ease-out forwards; }
.fburst b { background: rgba(255, 255, 255, 0.92); clip-path: polygon(50% 0%, 58% 31%, 85% 15%, 69% 42%, 100% 50%, 69% 58%, 85% 85%, 58% 69%, 50% 100%, 42% 69%, 15% 85%, 31% 58%, 0% 50%, 31% 42%, 15% 15%, 42% 31%); animation: fStar 0.45s ease-out forwards; }
.fburst.strong i { border-color: #ffd23f; }
.fburst.strong b { background: #fff3b0; }
.fburst.weak i { border-color: #cfd6e4; }
.fburst.weak b { background: #cfd6e4; }
@keyframes fRing { from { scale: 0.2; opacity: 1; } to { scale: 1.25; opacity: 0; } }
@keyframes fStar { 0% { scale: 0.2; opacity: 1; } 40% { scale: 0.8; opacity: 0.95; } 100% { scale: 0.55; rotate: 40deg; opacity: 0; } }
/* the dark ring that closes on the world and opens on the fight */
.iris { position: fixed; inset: 0; z-index: 60; overflow: hidden; pointer-events: none; }
.irisHole { position: absolute; left: 50%; top: 50%; width: 160vmax; height: 160vmax; translate: -50% -50%; border-radius: 50%; box-shadow: 0 0 0 200vmax #0b0f18; }
#fight .screen { z-index: 8; }
/* after a fight: one line for each compound, its experience bar grows */
.xpRow { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.7); border: 2px solid rgba(42, 36, 51, 0.15); transition: border-color 0.3s, box-shadow 0.3s; }
.xpRow.up { border-color: var(--c-dialogue-gold-text, #7a4f00); box-shadow: 0 0 14px rgba(255, 196, 61, 0.8); }
.xpPic { width: 48px; height: 48px; flex: none; }
.xpPic img { width: 100%; height: 100%; object-fit: contain; }
.xpWords { flex: 1; min-width: 0; }
.xpTop { display: flex; align-items: baseline; gap: 8px; }
.xpName { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xpLv { font-weight: 600; }
.xpGain { font-weight: 600; color: var(--c-button-bg, #0f6e73); }
.xpBar { height: 12px; border-radius: 6px; background: rgba(42, 36, 51, 0.18); overflow: hidden; margin: 3px 0 1px; }
.xpFill { height: 100%; width: 0; border-radius: 6px; background: var(--c-fight-xp, #3f8fe0); transition: width 0.6s ease; }
.xpNum { font-size: 0.75em; text-align: right; }
/* Full pages (Muhammed 2026-11-18): no bare lists and no big empty space. Pictures, bars and a place for every slot. */
.panel { background: rgba(255, 255, 255, 0.72); border: 2px solid rgba(42, 36, 51, 0.15); border-radius: 14px; padding: 8px 12px; min-width: 0; }
.panelTitle { font-weight: 600; font-size: 0.85em; margin-bottom: 4px; }
.secTitle { font-weight: 600; font-size: 0.9em; margin: 2px 2px 0; }
.small { font-size: 0.85em; }
.screen .body.split { display: grid; gap: 10px; overflow: hidden; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
html[data-portrait="0"] .screen .body.split { grid-template-columns: minmax(0, 0.85fr) minmax(0, 2fr); grid-template-rows: minmax(0, 1fr); }
.screen .body.pair { display: grid; gap: 10px; overflow: hidden; grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(0, 1fr); }
html[data-portrait="0"] .screen .body.pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.meter { height: 10px; border-radius: 6px; background: rgba(42, 36, 51, 0.18); overflow: hidden; }
.meterFill { height: 100%; border-radius: 6px; background: var(--c-fight-hp-high, #3fbf5a); transition: width 0.45s ease; }
.meter.hp .meterFill[data-level="mid"] { background: var(--c-fight-hp-mid, #e0a52f); }
.meter.hp .meterFill[data-level="low"] { background: var(--c-fight-hp-low, #d64541); }
.meter.xp { height: 6px; margin-top: 3px; }
.meter.xp .meterFill { background: var(--c-fight-xp, #3f8fe0); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 3px 12px; border-radius: 999px; background: rgba(15, 110, 115, 0.12); border: 2px solid rgba(15, 110, 115, 0.35); font-size: 0.9em; }
.chip.grey { opacity: 0.5; }
.coin { width: 1.6em; height: 1.6em; flex: none; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe89a, #f0b429 60%, #c98a12); border: 2px solid #a8730c; }
/* the player card */
.who { display: flex; align-items: center; gap: 12px; overflow: hidden; }
.who.tapBox { cursor: pointer; }
.whoPose { height: min(20vh, 170px); width: auto; flex: none; image-rendering: auto; }
.whoWords { min-width: 0; }
.whoName { font-weight: 600; font-size: 1.15em; }
.whoLine { font-size: 0.85em; }
.whoTeam { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.whoMate { width: 2.3em; height: 2.3em; font-size: 0.7em; display: flex; align-items: center; justify-content: center; }
.whoMate img, .tilePic img, .mPic img, .heroPic img, .cellPic img, .orb img, .cardPic img { width: 100%; height: 100%; object-fit: contain; }
html[data-portrait="0"] .split > .who { flex-direction: column; justify-content: center; text-align: center; }
html[data-portrait="0"] .split > .who .whoPose { height: min(38vh, 300px); }
html[data-portrait="0"] .split > .who .whoTeam { justify-content: center; }
html[data-kind="phoneLandscape"] .who .whoPose, html[data-kind="phoneLandscape"] .split > .who .whoPose { height: 26vh; }
/* menu tiles */
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); min-height: 0; }
html[data-portrait="0"] .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { font: inherit; color: inherit; text-align: left; cursor: pointer; background: rgba(255, 255, 255, 0.72); border: 2px solid rgba(42, 36, 51, 0.25); border-radius: 14px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; min-height: 52px; overflow: hidden; }
.tileWords { flex: 1; min-width: 0; }
.tileName { font-weight: 600; font-size: 1.15em; }
.tileSub { font-size: 0.8em; opacity: 0.85; }
.tilePic { width: 3.2em; height: 3.2em; flex: none; }
/* a card for a compound, and a grid with a place for every slot */
.slots { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); min-height: 0; flex: 1; }
html[data-portrait="0"] .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mcard { font: inherit; color: inherit; background: rgba(255, 255, 255, 0.75); border: 2px solid rgba(42, 36, 51, 0.2); border-radius: 14px; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px 8px; min-height: 0; min-width: 0; overflow: hidden; text-align: center; transition: transform 0.2s, box-shadow 0.3s; }
button.mcard { cursor: pointer; }
.mcard.empty { border-style: dashed; background: rgba(255, 255, 255, 0.3); align-items: center; justify-content: center; opacity: 0.6; font-size: 0.85em; }
.mcard.picked { border-color: var(--c-button-bg, #0f6e73); border-width: 3px; }
.mcard:disabled { opacity: 0.55; }
.mPic { flex: 1 1 0; min-height: 1.8em; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.mWords { flex: none; min-width: 0; }
.mName { font-weight: 600; font-size: 0.85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mSub, .mNum { font-size: 0.72em; }
.mcard.glow { transform: translateY(-6px); box-shadow: 0 0 0 3px var(--c-chamber-title-text, #8fe3d3), 0 0 22px 6px rgba(143, 227, 211, 0.9); }
.mcard.glow .mPic { animation: healPop 0.5s ease; }
.mcard.done { animation: healHop 0.45s ease; }
@keyframes healPop { 50% { scale: 1.18; } }
@keyframes healHop { 40% { translate: 0 -12px; } }
html[data-kind="phoneLandscape"] .mcard { flex-direction: row; align-items: center; text-align: left; gap: 6px; padding: 4px 8px; }
html[data-kind="phoneLandscape"] .mPic { flex: 0 0 30%; align-self: stretch; }
html[data-kind="phoneLandscape"] .mWords { flex: 1; }
.side { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
/* a compound or an element: picture on one side, facts on the other */
.hero { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 0; background: radial-gradient(circle at 50% 42%, #fff 0, rgba(255, 255, 255, 0.6) 60%, rgba(255, 255, 255, 0.35) 100%); }
html[data-portrait="1"] .hero { height: 32vh; }
.heroPic { flex: 1 1 0; min-height: 3em; width: 100%; display: flex; align-items: center; justify-content: center; font-size: 2em; font-weight: 600; }
.info { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; touch-action: pan-y; }
.statRow { display: grid; grid-template-columns: 5em 1fr 2em; align-items: center; gap: 8px; font-size: 0.85em; }
.statRow .meter { height: 8px; margin: 0; }
.recipe { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.orb { width: 2.4em; height: 2.4em; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.plus { font-weight: 600; }
/* books */
.bookTile { font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 8px; padding: 14px; text-align: left; min-height: 0; overflow: hidden; border-color: rgba(42, 36, 51, 0.25); }
.bookName { font-weight: 600; font-size: 1.15em; }
/* the periodic table of the Element Book and the boxes of the Compound Book (Muhammed 2026-11-19). src\screens.js sizes them. */
.ptWrap { flex: 1; min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ptable { display: grid; gap: 2px; grid-template-columns: repeat(18, minmax(0, 1fr)); grid-template-rows: repeat(7, minmax(0, 1fr)) minmax(0, 0.35fr) repeat(2, minmax(0, 1fr)); flex: none; }
.cboxes { display: grid; gap: 2px; flex: none; }
.cboxes.scroll { flex: 1; min-height: 0; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(4.6em, 1fr)); grid-auto-rows: 5.4em; align-content: start; overflow-y: auto; touch-action: pan-y; --ptf: 0.9em; padding: 2px; }
.pt { font: inherit; font-size: var(--ptf, 10px); font-weight: 600; line-height: 1.2; color: rgba(42, 36, 51, 0.62); background: #d3cdbb; border: 1px solid #b9ae93; border-radius: 0.3em; margin: 0; padding: 1px 0 0; min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; box-shadow: none; }
button.pt { cursor: pointer; }
.pt.got { color: var(--c-page-panel-text, #2a2433); background: #fffdf6; border-color: #f2b632; box-shadow: 0 0 0 1px #f2b632; z-index: 1; }
.pt.none { background: rgba(211, 205, 187, 0.3); border-style: dashed; }
.pt.picked { outline: 3px solid #0f6e73; outline-offset: -2px; z-index: 2; }
.pt span { flex: none; white-space: nowrap; }
.cbox span { font-size: 0.78em; max-width: 100%; overflow: hidden; }
.cboxes.scroll .cbox span { font-size: 1em; }
.pt img { flex: 1 1 0; min-height: 0; width: 100%; object-fit: contain; display: block; padding: 0 1px 1px; }
.cboxes.scroll .pt { border-width: 2px; border-radius: 10px; padding-top: 4px; }
.screen .body.bookBody { display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.ptInfo { flex: none; display: flex; align-items: center; gap: 10px; min-height: 3.4em; }
.ptPic { width: 2.6em; height: 2.6em; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.ptPic img { width: 100%; height: 100%; object-fit: contain; }
.ptPic.sym { border: 2px solid var(--c-page-panel-edge, #d8c39a); border-radius: 8px; font-size: 0.95em; width: 2.75em; height: 2.75em; }
.ptName { font-weight: 600; flex: 1; min-width: 0; }
.cells { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(6.2em, 1fr)); grid-auto-rows: minmax(6.6em, 17em); align-content: center; flex: 1; min-height: 0; overflow-y: auto; touch-action: pan-y; }
.cells.low { flex: none; grid-auto-rows: minmax(3.2em, auto); grid-template-columns: repeat(auto-fill, minmax(8em, 1fr)); }
.cell { font: inherit; color: inherit; background: rgba(255, 255, 255, 0.75); border: 2px solid rgba(42, 36, 51, 0.2); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px; min-height: 0; min-width: 0; overflow: hidden; text-align: center; }
button.cell { cursor: pointer; }
.cell.unknown { opacity: 0.55; border-style: dashed; }
.cell.picked { border-color: var(--c-button-bg, #0f6e73); border-width: 3px; }
.cellPic { flex: 1 1 0; min-height: 2.2em; width: 100%; display: flex; align-items: center; justify-content: center; font-size: 1.5em; font-weight: 600; }
.cellPic:empty { display: none; }
.cellName { font-size: 0.8em; font-weight: 600; }
.cellCount { font-size: 0.75em; }
/* map */
.mapBox { display: flex; align-items: center; justify-content: center; min-height: 0; padding: 8px; overflow: hidden; }
html[data-portrait="1"] .mapBox { height: 46vh; }
html[data-portrait="0"] .screen[data-screen="map"] .body.split { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.mini { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.mapNone { text-align: center; padding: 1em; max-width: 22em; }
/* bag and settings */
.screen[data-screen="bag"] .cells { align-content: start; grid-template-columns: repeat(auto-fill, minmax(6.2em, 1fr)); grid-auto-rows: minmax(6.6em, 9em); }
.screen[data-screen="bag"] .cells.low { grid-template-columns: repeat(auto-fill, minmax(8em, 1fr)); grid-auto-rows: minmax(3.2em, auto); }
.purse { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 1.2em; }
.setGrid { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(52px, 5.5em); align-content: center; flex: 1; min-height: 0; overflow-y: auto; }
html[data-portrait="0"] .setGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row.set { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
/* heal point */
.healTop { display: flex; align-items: center; gap: 12px; min-height: 0; overflow: hidden; }
html[data-portrait="0"] .healTop { flex-direction: column; justify-content: center; text-align: center; overflow-y: auto; }
.thing { image-rendering: pixelated; height: min(15vh, 120px); width: auto; flex: none; transition: filter 0.3s; }
html[data-portrait="0"] .thing { height: min(28vh, 220px); }
html[data-kind="phoneLandscape"] .thing { height: 20vh; }
.healTop.glow .thing { filter: drop-shadow(0 0 14px rgba(143, 227, 211, 1)); }
.healWords { min-width: 0; }
.healFree { font-weight: 600; }
.fact { font-size: 0.82em; margin-top: 6px; padding-top: 6px; border-top: 2px dashed rgba(42, 36, 51, 0.2); }
.cardPic { height: min(26vh, 200px); align-self: center; aspect-ratio: 1; }
/* after a fight and the swap page: use the room */
.fresult .rows { flex: none; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; justify-content: center; gap: 8px; width: 100%; max-width: 38em; margin: 0 auto; scrollbar-width: none; }
/* B04: the result page fills the screen: what was won stands big in a soft light, the team below (beside it on a wide screen) */
.resBody { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.resHero { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.resStand { position: relative; flex: 1 1 auto; min-height: 64px; max-height: 260px; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.resBurst { position: absolute; inset: -8%; border-radius: 50%; background: radial-gradient(circle, rgba(255, 232, 160, 0.55) 0, rgba(255, 232, 160, 0.18) 42%, rgba(255, 232, 160, 0) 70%); animation: resGlow 2.4s ease-in-out infinite; }
.resBurst::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: repeating-conic-gradient(rgba(255, 240, 200, 0.16) 0 8deg, rgba(255, 240, 200, 0) 8deg 24deg); -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%); mask: radial-gradient(circle, #000 20%, transparent 68%); animation: resTurn 18s linear infinite; }
.resStand img { position: relative; max-width: 70%; max-height: 70%; object-fit: contain; animation: fBob 1.5s ease-in-out infinite; transform-origin: 50% 100%; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.35)); }
.resStand img.orb { image-rendering: pixelated; width: 56%; height: 56%; }
@keyframes resGlow { 50% { scale: 1.08; opacity: 0.8; } }
@keyframes resTurn { to { rotate: 360deg; } }
.resGot { font-size: 1.5em; font-weight: 600; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
.resXp { font-size: 0.95em; font-weight: 600; padding: 3px 14px; border-radius: 999px; background: rgba(7, 28, 34, 0.55); border: 2px solid rgba(255, 232, 160, 0.45); }
.xpRow.empty { min-height: 2.4em; justify-content: center; font-size: 0.8em; background: rgba(255, 248, 232, 0.07); border: 3px dashed rgba(255, 248, 232, 0.3); color: var(--c-page-text, #fff8e8); box-shadow: none; opacity: 0.8; padding: 4px 12px; }
html[data-portrait="0"] .resBody { flex-direction: row; align-items: stretch; }
html[data-portrait="0"] .resHero { flex: 1 1 42%; }
html[data-portrait="0"] .fresult .rows { flex: 1 1 58%; max-width: none; }
html[data-kind="phoneLandscape"] .fresult .rows { gap: 4px; justify-content: flex-start; }
html[data-kind="phoneLandscape"] .fresult .xpRow { padding: 2px 10px; }
html[data-kind="phoneLandscape"] .fresult .xpRow.empty { min-height: 1.6em; padding: 0 10px; }
html[data-kind="phoneLandscape"] .fresult .xpPic { width: 34px; height: 34px; }
.fresult .xpPic { width: clamp(48px, 9vh, 96px); height: clamp(48px, 9vh, 96px); }

#toast { position: fixed; left: 50%; top: 64px; transform: translate(-50%, -30px); opacity: 0; background: var(--c-overlay-bg, #1d2433); color: var(--c-overlay-text, #fff); padding: 10px 18px; border-radius: 12px; transition: opacity 0.2s, transform 0.2s; z-index: 60; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 0.95; transform: translate(-50%, 0); }
#fade { position: fixed; inset: 0; background: var(--fade, #1d2433); opacity: 0; pointer-events: none; z-index: 70; }

/* Frame */
#pauseIcon { position: fixed; left: calc(8px + env(safe-area-inset-left)); top: calc(8px + env(safe-area-inset-top)); z-index: 90; border: 0; border-radius: 50%; background: var(--f-iconBack, #1d2433); display: flex; gap: 5px; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
#pauseIcon span { width: 4px; height: 38%; background: var(--f-icon, #fff); border-radius: 2px; }
#pause { position: fixed; inset: 0; z-index: 80; background: rgba(29, 36, 51, 0.85); display: flex; align-items: center; justify-content: center; }
.pauseBox { background: var(--c-overlay-bg, #1d2433); color: var(--c-overlay-text, #fff); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 8px; width: min(86vw, 320px); max-height: 96vh; overflow-y: auto; }
.pauseBox h2 { margin: 0 0 4px; text-align: center; }
html[data-kind="phoneLandscape"] .pauseBox { flex-direction: row; flex-wrap: wrap; width: min(94vw, 620px); }
html[data-kind="phoneLandscape"] .pauseBox h2 { width: 100%; }
html[data-kind="phoneLandscape"] .pauseBox .btn { flex: 1 1 28%; }

#loading { position: fixed; inset: 0; z-index: 100; background: #2f6fd0; color: #fff; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; font-size: 1.6em; text-align: center; padding: 20px; }
.loadTrack { width: min(60vw, 280px); height: 10px; background: rgba(255, 255, 255, 0.3); border-radius: 5px; overflow: hidden; }
#loadBar { height: 100%; width: 5%; background: #fff; transition: width 0.2s; }

html[data-kind="phonePortrait"] body, html[data-kind="phoneLandscape"] body { font-size: 18px; }
html[data-kind="tablet"] body { font-size: 20px; }
html[data-kind="laptop"] body { font-size: 20px; }
html[data-kind="board"] body { font-size: 28px; }
html[data-kind="phoneLandscape"] .screen h2 { font-size: 1.1em; min-height: 36px; margin-bottom: 4px; }
html[data-kind="phoneLandscape"] .pose, html[data-kind="phoneLandscape"] .preview { height: 30vh; }
html[data-kind="phoneLandscape"] .lookRow .preview { height: 15vh; }
/* a phone on its side is low: no names under the atoms the player carries, smaller pictures on the cards */
html[data-kind="phoneLandscape"] .benchTray .aname { display: none; }
html[data-kind="phoneLandscape"] .benchTray { padding-top: 6px; }
html[data-kind="phoneLandscape"] .benchChamber { min-height: 0; padding: 6px; }
html[data-kind="phoneLandscape"] .makePic, html[data-kind="phoneLandscape"] .makePic img { height: 54px; max-height: 54px; }
/* The stage fills the chamber (a little taller than wide on a phone, a little wider than tall on a laptop), so a
   big molecule has room. Atoms are sized from the chamber, and --k makes them smaller when there are many. */
@supports (width: 1cqmin) {
  .benchStage { width: min(100cqw, 130cqh); height: min(100cqh, 150cqw); aspect-ratio: auto; }
  .atom.centre { width: calc(30cqmin * var(--k, 1)); height: calc(30cqmin * var(--k, 1)); margin: calc(-15cqmin * var(--k, 1)) 0 0 calc(-15cqmin * var(--k, 1)); }
  .atom.placed { width: calc(22cqmin * var(--k, 1)); height: calc(22cqmin * var(--k, 1)); margin: calc(-11cqmin * var(--k, 1)) 0 0 calc(-11cqmin * var(--k, 1)); }
  .mark { width: calc(12cqmin * var(--k, 1)); height: calc(12cqmin * var(--k, 1)); margin: calc(-6cqmin * var(--k, 1)) 0 0 calc(-6cqmin * var(--k, 1)); }
}
/* Chamber orbs (Chapter 1 pictures) and the joining scene */
.atom.centre.art, .atom.placed.art { background: none; border: 0; padding: 0; }
.atom .orbimg { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; pointer-events: none; }
.atom.wob { animation: wob 0.42s ease; }
.atom.in { animation: atomIn 0.3s ease-out; }
@keyframes atomIn { from { scale: 0.2; opacity: 0; translate: 0 45%; } }
.mark.full { border-style: solid; opacity: 0.45; }
.benchStage.small .aname { display: none; }
.atom.tray { cursor: default; }
@keyframes wob { 0%, 100% { translate: 0 0; } 20% { translate: -6px 0; } 40% { translate: 6px 0; } 60% { translate: -4px 0; } 80% { translate: 3px 0; } }
.joinScr { position: fixed; inset: 0; z-index: 60; background: #071C22; touch-action: none; }
.joinCv { position: absolute; inset: 0; width: 100%; height: 100%; }
.joinInfo { position: absolute; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 16px; text-align: center; color: #1f2a30; opacity: 0; transition: opacity 0.4s; }
.joinInfo.on { opacity: 1; }
.joinName { font-size: clamp(26px, 5vh, 40px); font-weight: 700; }
.joinFormula { font-size: clamp(20px, 4vh, 30px); font-weight: 600; }
.joinEq { font-size: clamp(16px, 2.8vh, 22px); }
.joinLine { font-size: clamp(15px, 2.5vh, 19px); max-width: 30em; }
.joinOk { margin-top: 8px; font: inherit; font-weight: 600; font-size: 20px; min-width: 140px; min-height: 48px; border: 0; border-radius: 14px; background: var(--c-button-bg, #0f6e73); color: #fff; cursor: pointer; }
/* storage: two grids, one above the other on a phone held upright, so each uses 3 columns */
html[data-portrait="1"] .side .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.side .slots .mName { font-size: 0.78em; }

.fmate em { font-style: normal; }

/* ---- The game skin (2026-11-18). Every page is a dark teal room with cream panels and chunky buttons,
        in the look of the drawn UI (A-U01 to A-U10). Colours: ui-tokens.json group page. ---- */
.screen { background: radial-gradient(circle at 50% 0%, var(--c-page-bg-top, #1c6a70) 0, var(--c-page-bg, #0f484e) 55%, var(--c-page-bg-edge, #0a3338) 100%); color: var(--c-page-text, #fff8e8); }
.screen h2 { text-shadow: 0 2px 0 rgba(0, 0, 0, 0.28); }
.screen .note { color: var(--c-page-note-text, #ffd0c2); }
.panel, .tile, .mcard, .cell, .row, .xpRow { background: var(--c-page-panel-bg, #fff8e8); color: var(--c-page-panel-text, #2a2433); border: 3px solid var(--c-page-panel-edge, #d8c39a); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.22); }
.panel .note, .screen.card .note { color: var(--c-dialogue-danger-text, #a3201a); }
.row.plain { background: transparent; border-color: transparent; box-shadow: none; color: inherit; }
.mcard.empty, .cell.unknown { background: rgba(255, 248, 232, 0.1); border: 3px dashed rgba(255, 248, 232, 0.38); color: var(--c-page-text, #fff8e8); box-shadow: none; opacity: 1; }
.mcard.picked, .cell.picked, .row.picked { border-color: #f0b429; }
/* the compound that walks behind the child (follow.js): a small tag on its card in Menu, Team */
.mcard.walks, .mcard.first { position: relative; }
.mWalks { position: absolute; top: 4px; right: 4px; font-size: 0.68em; font-weight: 600; line-height: 1; padding: 3px 7px; border-radius: 999px; background: var(--c-button-bg, #0f6e73); color: var(--c-button-text, #fff8e8); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); pointer-events: none; }
.tile:active, .cell:active, button.mcard:active, button.row:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22); }
.hero { border-radius: 14px; }
.btn { border: 2px solid var(--c-page-button-edge, #073a3e); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.22), inset 0 2px 0 rgba(255, 255, 255, 0.2); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.22); }
.screen[data-screen="bench"] .foot .btn { box-shadow: none; text-shadow: none; }
/* B02: a card is a cream panel in the teal room (it was a bare white page). A land card shows the drawn map. */
.screen.card h2 { justify-content: center; text-align: center; margin-left: 52px; margin-right: 52px; font-size: 1.7em; line-height: 1.15; }
.screen.card .body { width: 100%; align-items: center; }
.cardPanel { border-radius: 22px; padding: 18px 24px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; box-sizing: border-box; }
.cardPanel p { margin: 0; line-height: 1.45; font-size: 1.08em; }
.cardPanel.land { max-width: 40em; }
.cardMap { height: min(44vh, 380px); aspect-ratio: 3 / 2; max-width: 100%; border-radius: 14px; overflow: hidden; border: 3px solid var(--c-page-panel-edge, #d8c39a); flex: none; }
.cardMap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cardWords { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cardWords .formula { margin-bottom: -2px; }
/* a low wide screen (a phone on its side): the picture on the left, the words on the right */
html[data-kind="phoneLandscape"] .cardPanel.art { flex-direction: row; text-align: left; max-width: 48em; gap: 20px; padding: 12px 20px; }
html[data-kind="phoneLandscape"] .cardPanel.art .cardWords { align-items: flex-start; flex: 1; min-width: 0; }
html[data-kind="phoneLandscape"] .cardMap { height: min(60vh, 240px); }
html[data-kind="phoneLandscape"] .cardPanel .cardPic { height: min(48vh, 170px); }
/* a big screen: bigger words, so a card without a picture still fills its place */
@media (min-width: 1000px) and (min-height: 700px) { .cardPanel { font-size: 1.2em; padding: 26px 34px 28px; max-width: 34em; } .cardPanel.land { max-width: 38em; } }
.pursePic { width: 2em; height: 2em; flex: none; }
.pursePic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cell.item .cellPic { min-height: 2.6em; }
/* the drawn map of the land */
.landMap { position: relative; max-width: 100%; max-height: 100%; aspect-ratio: 3 / 2; height: 100%; border-radius: 12px; overflow: hidden; }
.landMap img { width: 100%; height: 100%; display: block; object-fit: cover; }
.mapBox { padding: 6px; }
.landPin { position: absolute; width: 1.5em; height: 1.5em; margin: -1.9em 0 0 -0.75em; border-radius: 50% 50% 50% 0; rotate: -45deg; background: #e5483d; border: 3px solid #fff; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4); animation: pinHop 0.9s ease-in-out infinite; }
@keyframes pinHop { 50% { translate: 0 -0.45em; } }
.landTown { position: absolute; width: 0; height: 0; }
.landTown span { position: absolute; left: 0; top: 0.5em; translate: -50% 0; white-space: nowrap; font-size: 0.8em; font-weight: 600; padding: 1px 9px; border-radius: 999px; background: var(--c-fight-panel-bg, #1d2433); color: #fff; border: 2px solid #f4e6c2; }
.landTown.grey span { opacity: 0.7; }
/* Title: the oasis behind, the name as a big word mark, the child standing in front */
.screen.title { background: #1d2433 url(./assets/art/arena/a-wide.jpg) center / cover no-repeat; color: #fff; }
@media (orientation: portrait) { .screen.title { background-image: url(./assets/art/arena/a-tall.jpg); } }
.screen.title::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 30, 40, 0.5) 0, rgba(10, 30, 40, 0) 34%, rgba(10, 30, 40, 0) 62%, rgba(10, 30, 40, 0.62) 100%); pointer-events: none; }
.screen.title > * { position: relative; }
.screen.title h2.wordmark { margin: 5vh 0 0; justify-content: center; font-size: clamp(3em, 13vmin, 7em); font-weight: 600; letter-spacing: 0.04em; color: #fff8e8; text-shadow: 0 0.06em 0 #14666b, 0 0.12em 0 #0a3338, 0 0.2em 0.3em rgba(0, 0, 0, 0.45); animation: markFloat 3.2s ease-in-out infinite; }
@keyframes markFloat { 50% { translate: 0 -0.05em; } }
.screen.title .body { justify-content: flex-end; align-items: center; padding-bottom: 2vh; }
.screen.title .body p { margin: 0; padding: 4px 16px; border-radius: 999px; background: rgba(13, 30, 40, 0.72); text-shadow: none; }
.titleStand { position: relative; display: flex; justify-content: center; }
.titleStand::after { content: ''; position: absolute; left: 50%; bottom: -3%; width: 70%; height: 12%; translate: -50% 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(20, 16, 30, 0.45), rgba(20, 16, 30, 0)); }
.titleStand .pose { position: relative; z-index: 1; height: min(40vh, 320px); animation: fBreath 2.8s ease-in-out infinite; transform-origin: 50% 100%; }
/* the face of the one who speaks: a round picture on the top left corner of the box, the name beside it */
#talkFace { display: none; position: absolute; left: 10px; bottom: calc(100% - 0.9em); width: 3.4em; height: 3.4em; border-radius: 50%; background: var(--c-dialogue-box-bg, #fff8e8); border: 3px solid var(--c-dialogue-name-tab-bg, #14666b); image-rendering: pixelated; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2); }
#talk.face #talkFace { display: block; }
#talk.face #talkName { left: calc(3.4em + 18px); border-radius: 10px; top: -1.45em; }
#talk { box-shadow: 0 4px 0 rgba(0, 0, 0, 0.22); }
/* after a fight: what was won */
.loot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 24px; font-size: 1.15em; font-weight: 600; padding: 4px 0 8px; }
.lootItem { display: flex; align-items: center; gap: 10px; }
.lootItem img { height: 2.6em; image-rendering: pixelated; animation: fBob 1.5s ease-in-out infinite; transform-origin: 50% 100%; }
.fresult h2 { justify-content: center; margin: 0 52px 8px; font-size: 1.7em; }
/* Who are you: the child stands in a soft light */
.screen[data-screen="creator"] .body { justify-content: center; gap: 12px; }
.screen[data-screen="creator"] .lookRow { align-self: center; padding: 3vh 8vw 1vh; border-radius: 50% 50% 18px 18px / 40% 40% 18px 18px; background: radial-gradient(ellipse at 50% 100%, rgba(255, 248, 232, 0.28), rgba(255, 248, 232, 0) 70%); }
.screen[data-screen="creator"] .pose { height: min(42vh, 340px); }
.screen[data-screen="creator"] .stepTitle { font-size: 1.3em; font-weight: 600; }
.screen[data-screen="creator"] .note { align-self: center; text-align: center; font-size: 1.05em; font-weight: 600; min-height: 1.4em; margin-top: -4px; }   /* B09: right under the name box */

/* ---------- Map page: the balloon (PLAN.md M16) ---------- */
.landTown.go span { cursor: pointer; pointer-events: auto; box-shadow: 0 0 0 3px rgba(255, 210, 63, 0.55); }
.landTown.go { pointer-events: auto; }
.landTown.picked span { background: #ffd23f; color: #2a2433; border-color: #2a2433; }
.shopInfo { display: flex; align-items: center; gap: 12px; flex: none; min-height: 4.4em; }
.shopPic { width: 3.4em; height: 3.4em; flex: none; }
.shopPic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.shopName { font-weight: 600; font-size: 1.15em; }
.shopHave { opacity: 0.75; }
.screen[data-screen="shop"] .cells { grid-template-columns: repeat(auto-fit, minmax(7em, 1fr)); grid-auto-rows: minmax(7em, 13em); }
.cell.mine .cellCount { color: #0f6e73; font-weight: 600; }
/* a wide screen: the gold and the picked thing on the left, the things to buy on the right, so nothing is cut on a phone held on its side */
html[data-portrait="0"] .screen[data-screen="shop"] .body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr); grid-template-rows: auto minmax(0, 1fr); gap: 10px; overflow: hidden; }
html[data-portrait="0"] .screen[data-screen="shop"] .purse { grid-column: 1; grid-row: 1; }
html[data-portrait="0"] .screen[data-screen="shop"] .shopInfo { grid-column: 1; grid-row: 2; flex-direction: column; justify-content: center; text-align: center; overflow-y: auto; }
html[data-portrait="0"] .screen[data-screen="shop"] .cells { grid-column: 2; grid-row: 1 / span 2; grid-auto-rows: minmax(5.4em, 15em); }
html[data-kind="phoneLandscape"] .screen[data-screen="shop"] .shopPic { width: 2.4em; height: 2.4em; }
.flyBox { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.flyPic { flex: 0 0 auto; width: 56px; height: 56px; }
.flyPic img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }

/* ---------- Title: the drawn logo (A-U11) ---------- */
.screen.title h2.wordmark.drawn { text-shadow: none; letter-spacing: 0; font-size: 1em; }
.screen.title h2.wordmark .logo { display: block; width: min(74vw, 130vh, 700px); height: auto; filter: drop-shadow(0 6px 0 rgba(10, 51, 56, 0.55)) drop-shadow(0 12px 14px rgba(0, 0, 0, 0.35)); }

/* V31 the intro: one canvas over everything but the pause layer. It fades out over the title page. */
#intro { position: fixed; inset: 0; z-index: 75; background: #05070d; transition: opacity 0.6s; touch-action: none; cursor: pointer; }
#intro.gone { opacity: 0; pointer-events: none; }
#intro canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#intro .introHint { position: absolute; left: 0; right: 0; bottom: calc(22px + env(safe-area-inset-bottom)); text-align: center; color: #fff8e8; font-size: clamp(18px, 3.6vmin, 32px); font-weight: 600; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7); pointer-events: none; animation: introPulse 1.6s ease-in-out infinite; }
#intro .introHint.quiet { font-size: clamp(13px, 2vmin, 18px); font-weight: 500; opacity: 0.55; animation: none; }
@keyframes introPulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
/* a tall tablet: two by two, so the page is full */
html[data-kind="tablet"] .screen[data-screen="shop"] .cells { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(7em, 1fr); align-content: stretch; }

/* ---------- the shop tabs, the element dolls, the phone (2026-11-19) ---------- */
.shopGoods { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
html[data-portrait="0"] .screen[data-screen="shop"] .shopGoods { grid-column: 2; grid-row: 1 / span 2; }
.shopTabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; flex: none; }
.shopTabs .tab { font: inherit; font-weight: 600; color: var(--c-page-text, #fff8e8); background: rgba(255, 248, 232, 0.1); border: 2px solid rgba(255, 248, 232, 0.38); border-radius: 12px; padding: 7px 4px; min-height: 40px; cursor: pointer; }
.shopTabs .tab.on { background: #fff8e8; color: #2a2433; border-color: #f0b429; }
.dollPic { display: flex; align-items: center; justify-content: center; min-height: 0; min-width: 0; }
.dollPic canvas { width: 100%; height: 100%; object-fit: contain; image-rendering: auto; display: block; }
.cell .dollPic.cellPic { min-height: 3.2em; }
.shopPic.dollPic { height: 4.2em; }
.shopPic img, .cell.item .cellPic img { image-rendering: auto; }
.dollTop { flex: none; display: flex; align-items: center; gap: 12px; }
.dollTop .bookName { flex: none; font-weight: 600; }
.dollTop .meter { flex: 1; }
.cboxes.scroll.dollGrid { grid-template-columns: repeat(auto-fill, minmax(4.2em, 1fr)); grid-auto-rows: 5.6em; }
.pt.dbox { display: flex; flex-direction: column; align-items: center; }
.pt.dbox .dollPic { flex: 1 1 0; width: 100%; padding: 0 2px 2px; }
.pt.dbox:not(.got) span { margin: auto; font-size: 1.15em; }
.dollInfo { align-items: center; min-height: 5.6em; }
.dollInfo .ptPic { width: 4.2em; height: 5em; }
.dollInfo .ptPic.sym { width: 3.2em; height: 3.2em; font-size: 1.1em; }
.dollWords { flex: 1; min-width: 0; }
.dollWords .warn { color: #a3341c; font-weight: 600; }
.tiles.odd .tile:last-child { grid-column: 1 / -1; }
.callScene { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 0; background: radial-gradient(circle at 50% 42%, #fff 0, rgba(255, 255, 255, 0.6) 60%, rgba(255, 255, 255, 0.35) 100%); border-radius: 14px; }
.callRow { display: flex; align-items: flex-end; justify-content: center; gap: 6px; flex: 0 1 auto; height: min(100%, 46vh); min-height: 0; width: 100%; padding-top: 8px; }
.callWho { flex: 1 1 0; height: 100%; min-height: 0; min-width: 0; display: flex; align-items: flex-end; justify-content: center; }
.callWho img { width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; image-rendering: auto; }
.callPhone { flex: none; width: 3em; height: 3em; align-self: center; animation: callRing 1.6s ease-in-out infinite; }
.callPhone img { width: 100%; height: 100%; object-fit: contain; }
@keyframes callRing { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
.callHello { flex: none; font-weight: 600; text-align: center; color: #2a2433; }
html[data-portrait="1"] .callScene { height: 30vh; }
html[data-portrait="1"] .callRow { height: auto; flex: 1 1 0; }
.asks { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(0, 1fr); min-height: 0; }
html[data-portrait="0"] .asks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile.ask { justify-content: center; text-align: center; }
html[data-portrait="0"]:not([data-kind="phoneLandscape"]) .screen[data-screen="shop"] .shopPic { width: min(9em, 60%); height: 9em; }
html[data-portrait="0"] .screen[data-screen="phone"] .body.split { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.6fr); }
/* the phone: the topics first, then the questions of one topic (2026-11-19, the Mentor as teacher) */
.asks.topics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
html[data-portrait="1"] .asks.topics .tile:first-child { grid-column: 1 / -1; }
html[data-portrait="0"] .asks.topics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile.topic { position: relative; padding: 6px 10px; min-height: 0; }
.tile.topic .tileName { font-size: 1.02em; line-height: 1.12; }
.tile.topic .tileSub { line-height: 1.15; }
.tile.topic.shut { opacity: 0.5; }
.asks.scroll { grid-auto-rows: auto; align-content: start; overflow-y: auto; touch-action: pan-y; padding: 2px; }
.tile.ask { justify-content: space-between; text-align: left; }
.tile.ask .tileName { font-size: 1.02em; line-height: 1.15; }
.askMark { flex: none; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; }
.askMark.new { width: 0.72em; height: 0.72em; background: #f0b429; box-shadow: 0 0 0 2px rgba(42, 36, 51, 0.28); }
.askMark.done { width: 1.5em; height: 1.5em; background: #2f8f6b; color: #fff; font-size: 0.9em; }
.tile.topic .askMark.new { position: absolute; top: 7px; right: 7px; }
.askLater { grid-column: 1 / -1; text-align: center; opacity: 0.85; font-size: 0.9em; padding: 4px; color: var(--c-page-text, #fff8e8); }
.tile.topic .tilePic { width: 2.6em; height: 2.6em; margin-right: 1.1em; }
.tile.topic .tilePic img { image-rendering: auto; }
/* a phone on its side is low: three rows of topics must fit, so the words are smaller and the picture is left out */
html[data-kind="phoneLandscape"] .asks.topics { gap: 6px; }
html[data-kind="phoneLandscape"] .tile.topic { padding: 3px 8px; }
html[data-kind="phoneLandscape"] .tile.topic .tileName { font-size: 0.86em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-kind="phoneLandscape"] .tile.topic .tileSub { font-size: 0.66em; }
html[data-kind="phoneLandscape"] .tile.topic .tilePic { display: none; }
html[data-kind="phoneLandscape"] .tile.ask { min-height: 40px; padding: 4px 10px; }
html[data-kind="phoneLandscape"] .tile.ask .tileName { font-size: 0.9em; }
/* a phone held upright: the half-wide topic tiles have no room for a picture beside the words */
html[data-portrait="1"] .asks.topics .tile:not(:first-child) .tilePic { display: none; }
html[data-kind="phoneLandscape"] .tile.ask .tileName { line-height: 1.08; }
html[data-kind="phoneLandscape"] .tile.ask { min-height: 44px; }

/* Comic strip scenes (comic.js, Muhammed 2026-11-20): a panel in a cream frame on the dark teal page, the text box under it. */
.comic { position: fixed; inset: 0; z-index: 15; opacity: 0; transition: opacity 0.35s; pointer-events: auto; background: radial-gradient(circle at 50% 0%, var(--c-page-bg-top, #1c6a70) 0, var(--c-page-bg, #0f484e) 55%, var(--c-page-bg-edge, #0a3338) 100%); }
.comic.in { opacity: 1; }
.comicFrame { position: absolute; overflow: hidden; border-radius: 10px; border: 6px solid var(--c-page-panel-bg, #fff8e8); box-shadow: 0 0 0 2px var(--c-page-panel-edge, #c9b98f), 0 6px 0 rgba(0, 0, 0, 0.35); background: #1d2433; box-sizing: border-box; }
.comicImg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 50%; }
.comicFlash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 2; }
.comicBlink { position: absolute; border-radius: 50%; pointer-events: none; z-index: 1; mix-blend-mode: screen; opacity: 0; }
.comicGlow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.comicWhite { position: absolute; inset: 0; pointer-events: none; z-index: 3; opacity: 0; }

/* Marks on the trainer card, under the player: a gem for each town mark and a bigger one for the mark of the land. Grey until won. */
.markRow { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; margin-top: 8px; }
html[data-portrait="0"] .split > .who .markRow { justify-content: center; }
.cardBadge { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 2.6em; font-size: 0.7em; color: var(--c-page-note-text, #5d5468); }
.cardBadge i { --mk: #b9b2a3; width: 2.3em; height: 2.65em; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: #d9d1bf; }
.cardBadge.got i { background: linear-gradient(160deg, #fff 0%, var(--mk) 38%, var(--mk) 70%, rgba(0, 0, 0, 0.35) 140%); filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.3)); }
.cardBadge.got span { color: var(--c-page-panel-text, #2a2433); font-weight: 600; }
.cardBadge.land i { width: 3em; height: 3.45em; }
.cardBadge.land.got i { --mk: #f2b632; }
/* his badges (A-C4-03): a mark not won yet is its dark shape only */
.cardBadge .markPic { width: 3.6em; height: 3.6em; }
.cardBadge.land .markPic { width: 4.3em; height: 4.3em; }
.cardBadge .markPic img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cardBadge:not(.got) .markPic img { filter: brightness(0); opacity: 0.2; }
.cardBadge.got .markPic img { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.3)); }
/* the mark scene: the badge just won comes up big for a moment (screens.js showMark) */
.markPop { position: fixed; left: 50%; top: 38%; z-index: 59; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 10px; transform: translate(-50%, -50%) scale(0.3); opacity: 0; transition: transform 0.45s cubic-bezier(0.2, 1.6, 0.4, 1), opacity 0.25s; }
.markPop.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.markPop.hide { transform: translate(-50%, -80%) scale(0.6); opacity: 0; transition: transform 0.5s ease-in, opacity 0.5s; }
.markPop .markPopPic { width: min(34vmin, 200px); height: min(34vmin, 200px); filter: drop-shadow(0 0 18px rgba(255, 214, 120, 0.75)) drop-shadow(0 4px 0 rgba(0, 0, 0, 0.35)); }
.markPop.land .markPopPic { width: min(42vmin, 240px); height: min(42vmin, 240px); }
.markPop .markPopPic img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.markPop .markPopName { font-weight: 600; font-size: 1.25em; color: var(--c-overlay-text, #fff); background: var(--c-overlay-bg, #1d2433); padding: 6px 16px; border-radius: 12px; opacity: 0.95; }

/* B05: the Save page. The player on one side, a card for every kept save on the other (a place for every slot). */
.saveSide { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.saveSlots { flex: 1; min-height: 0; display: grid; grid-auto-rows: minmax(0, 1fr); gap: 10px; overflow-y: auto; scrollbar-width: none; }
.saveCard { position: relative; border-radius: 18px; padding: 12px 16px; display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: 5.6em; }
.saveCard.newest { border-color: #f0b429; }
.saveCard.empty { background: rgba(255, 248, 232, 0.08); border: 3px dashed rgba(255, 248, 232, 0.34); color: var(--c-page-text, #fff8e8); box-shadow: none; }
.saveCard.broken { border-color: var(--c-dialogue-danger-text, #a3201a); }
.saveTag { align-self: flex-start; font-size: 0.72em; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--c-button-bg, #0f6e73); color: var(--c-button-text, #fff8e8); }
.saveCard.newest .saveTag { background: #b5761a; }
.saveCard.empty .saveTag { background: rgba(255, 248, 232, 0.18); }
.saveWhere { font-size: 1.15em; font-weight: 600; }
.saveWhen { font-size: 0.85em; opacity: 0.85; white-space: pre-wrap; }
.saveEmpty { opacity: 0.75; font-size: 0.9em; }
.saveTeam { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 2.2em; }
.saveMate { width: 2.4em; height: 2.4em; }
.saveMate img { width: 100%; height: 100%; object-fit: contain; }
.saveMarks { margin-left: auto; font-size: 0.8em; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: rgba(42, 36, 51, 0.1); }
html[data-kind="phoneLandscape"] .saveCard { min-height: 0; padding: 6px 12px; gap: 2px; }
html[data-kind="phoneLandscape"] .saveMate { width: 2.8em; height: 2.8em; }
html[data-kind="phoneLandscape"] .saveTeam { min-height: 0; }
html[data-portrait="0"] .saveCard { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-auto-rows: auto; align-content: center; column-gap: 16px; }
html[data-portrait="0"] .saveCard > :not(.saveTeam) { grid-column: 1; }
html[data-portrait="0"] .saveCard .saveTeam { grid-column: 2; grid-row: 1 / span 3; justify-content: flex-end; max-width: 60%; }
html[data-portrait="0"]:not([data-kind="phoneLandscape"]) .saveMate { width: 3.6em; height: 3.6em; }
html[data-portrait="0"] .saveMarks { margin-left: 6px; }
.saveCard .saveTag { justify-self: start; }
html[data-kind="phoneLandscape"] .saveCard { font-size: 0.82em; padding: 4px 12px; }
html[data-kind="phoneLandscape"] .saveWhere { font-size: 1.05em; }

/* a never-do card: the picture crossed out with a red ring */
.cardPic.no { position: relative; }
.cardPic.no::after { content: ''; position: absolute; inset: 4%; border-radius: 50%; border: 0.55em solid #d8402f; background: linear-gradient(45deg, transparent calc(50% - 0.28em), #d8402f calc(50% - 0.28em), #d8402f calc(50% + 0.28em), transparent calc(50% + 0.28em)); opacity: 0.92; }
.cardOrbs { display: flex; gap: 18px; align-items: flex-end; justify-content: center; }
.cardOrb { width: min(18vh, 120px); height: min(18vh, 120px); }
.cardOrb img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; animation: fBob 1.5s ease-in-out infinite; transform-origin: 50% 100%; }
.cardOrb:nth-child(2) img { animation-delay: 0.4s; }

/* The small round map, top right while walking outdoors (src\minimap.js). A cream ring with a teal edge, like the pages. */
#mini { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); z-index: 5; border-radius: 50%; border: 3px solid var(--c-page-panel-bg, #fff8e8); box-shadow: 0 0 0 2px var(--c-page-bg-edge, #0a3338), 0 4px 0 rgba(0, 0, 0, 0.25); cursor: pointer; display: none; }
body[data-mode="world"] #mini:not([hidden]) { display: block; }

/* ---- v3 UI pass (2026-11-21) ---- */
/* the fight text box grows to its words on a tall phone (3 lines never touch its edge) */
#fight[data-tall="1"] .fmsg { flex: none; line-height: 1.25; padding: 10px 14px; }
/* a wild element shows its own orb in the dark ring of its panel */
.ficon:has(img.forb) { background: var(--c-fight-hp-track, #0b0f18); border: 0.14em solid #f4e6c2; }
.ficon img.forb { width: 74%; height: 74%; object-fit: contain; image-rendering: pixelated; }
/* a page title that opens something (the trainer card) is not a web link: no underline, a small open sign instead */
h2.tap { text-decoration: none; display: inline-flex; align-items: center; gap: 0.35em; }
h2.tap::after { content: ''; width: 0.42em; height: 0.42em; border-right: 0.12em solid currentColor; border-bottom: 0.12em solid currentColor; transform: rotate(-45deg); opacity: 0.7; margin-left: 0.1em; }
/* a free place in the team: a soft plus and why it is there, not a bare "Empty" box */
.mcard.empty { gap: 0.4em; text-align: center; padding: 10px; }
.mcard.empty .slotPlus { width: 2.4em; height: 2.4em; border-radius: 50%; border: 3px dashed rgba(255, 248, 232, 0.45); display: grid; place-items: center; font-size: 1.2em; font-weight: 600; color: rgba(255, 248, 232, 0.7); }
.mcard.empty .slotWord { font-weight: 600; opacity: 0.9; }
.mcard.empty .slotSub { font-size: 0.78em; opacity: 0.7; max-width: 14em; }

/* v4 2026-11-21: the trainer's gold beside the XP on the result page, and the small level up panel (FEEL.md, 1.5 s) */
.resPills { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.resXp.gold { display: flex; align-items: center; gap: 6px; }
.resXp.gold img { height: 1.3em; image-rendering: pixelated; }
.lvPanel { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 5; display: flex; align-items: center; gap: 14px; width: min(90%, 26em); box-sizing: border-box; padding: 14px 18px; border-radius: 20px; background: var(--c-dialogue-box-bg, #fff8e8); color: var(--c-dialogue-text, #2a2433); border: 3px solid rgba(255, 214, 110, 0.95); box-shadow: 0 0 0 6px rgba(255, 232, 160, 0.25), 0 10px 26px rgba(0, 0, 0, 0.45); animation: lvIn 0.22s ease-out; cursor: pointer; }
.lvPanel img { width: 4.2em; height: 4.2em; object-fit: contain; flex: none; animation: fBob 1.2s ease-in-out infinite; transform-origin: 50% 100%; }
.lvWords { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lvTitle { font-size: 1.2em; font-weight: 700; color: var(--c-button-bg, #0f6e73); }
.lvLine { font-size: 0.95em; }
.lvLine.grow { font-weight: 600; color: #8a5a00; }
.lvPanel.out { opacity: 0; transform: translate(-50%, -50%) scale(0.92); transition: opacity 0.18s, transform 0.18s; }
@keyframes lvIn { from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); } }

/* V28 theme board at a hall door: the trainer, the families inside (their drawn icons and words), the theme lines */
.boardWho { font-weight: 700; font-size: 1.1em; color: var(--c-button-bg, #0f6e73); }
.boardFams { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.boardFam { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; border-radius: 14px; background: rgba(15, 110, 115, 0.09); min-width: 5.5em; }
.boardFamPic { width: 3em; height: 3em; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.2em; }
.boardFamPic img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.boardFamName { font-weight: 600; font-size: 0.9em; }

/* V11 Grow by bonding: the compound and what it grows into side by side, then what it needs */
/* Grow by bonding, redone 2026-11-27 (mockup reviews\pages\MOCKUP-GROW.html) */
.btn.gold { background: linear-gradient(#f6c445, #e6a21c); color: #3a2600; box-shadow: inset 0 -5px 0 rgba(122, 82, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.45); position: relative; overflow: hidden; }
.btn.gold::after, .mGrow.ready::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.75), transparent); animation: goldShine 2.6s ease-in-out infinite; pointer-events: none; }
@keyframes goldShine { 0%, 55% { left: -60%; } 100% { left: 130%; } }
.growUp { display: inline-block; width: 0; height: 0; border-left: 0.36em solid transparent; border-right: 0.36em solid transparent; border-bottom: 0.55em solid currentColor; }
.mGrow { flex: none; margin: 3px -8px -6px; padding: 3px 4px 4px; background: #efe6d0; color: #5a5266; font-size: 0.74em; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mGrow.ready { position: relative; background: linear-gradient(#f6c445, #e6a21c); color: #3a2600; display: flex; align-items: center; justify-content: center; gap: 0.4em; }
.mcard.canGrow { border-color: #e6a21c; animation: growGlow 2.2s ease-in-out infinite; }
@keyframes growGlow { 0%, 100% { box-shadow: 0 0 0 2px rgba(246, 196, 69, 0.55), 0 4px 0 rgba(0, 0, 0, 0.22); } 50% { box-shadow: 0 0 0 4px rgba(246, 196, 69, 0.95), 0 0 18px 4px rgba(246, 196, 69, 0.7), 0 4px 0 rgba(0, 0, 0, 0.22); } }
html[data-kind="phoneLandscape"] .mGrow { position: absolute; right: 4px; bottom: 4px; margin: 0; padding: 1px 8px 2px; border-radius: 999px; }
.screen .body.growBody { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 12px; align-items: stretch; overflow: hidden; }
html[data-portrait="1"] .screen .body.growBody { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
html[data-kind="phoneLandscape"] .growNeed { padding: 2px 8px; } html[data-kind="phoneLandscape"] .growNeeds { gap: 4px; padding-top: 4px; padding-bottom: 4px; }
.growPair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; min-height: 0; padding: 12px 10px; background: radial-gradient(circle at 50% 45%, #fffdf4 0, var(--c-page-panel-bg, #fff8e8) 55%, #f3e7c9 100%); }
.growSide { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; height: 100%; }
.growPic { position: relative; width: 100%; flex: 1 1 0; min-height: 4em; max-height: 15em; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.growPic img { max-width: 100%; max-height: 100%; width: auto; height: 100%; object-fit: contain; image-rendering: pixelated; }
.growPic.shape img { filter: brightness(0) opacity(0.28); }
.growPic.shape::after { content: '?'; position: absolute; font-size: 2.6em; font-weight: 700; color: #fff8e8; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
.growName { font-weight: 700; text-align: center; font-size: 1.05em; min-height: 1.3em; }
html[data-portrait="1"] .growPic { flex: 0 1 auto; aspect-ratio: 1; }
html[data-portrait="1"] .growName { min-height: 2.6em; display: flex; align-items: flex-end; }
.growSide .formula { font-weight: 600; font-size: 1.2em; }
.growFlow { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.growKinds { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.growKinds .orb { width: 1.7em; height: 1.7em; animation: growDrift 1.8s ease-in-out infinite; }
.growKinds .orb:nth-child(2) { animation-delay: 0.3s; }
.growKinds .orb:nth-child(3) { animation-delay: 0.6s; }
.growKinds .orb img, .growNeed .orb img { width: 100%; height: 100%; image-rendering: pixelated; }
@keyframes growDrift { 0%, 100% { translate: -5px 0; } 50% { translate: 5px 0; } }
.growArrow { position: relative; width: 3.2em; height: 1em; }
.growArrow::before { content: ''; position: absolute; left: 0; right: 0.6em; top: 0.31em; height: 0.38em; border-radius: 0.2em; background: #e6a21c; }
.growArrow::after { content: ''; position: absolute; right: 0; top: -0.06em; border-top: 0.56em solid transparent; border-bottom: 0.56em solid transparent; border-left: 0.85em solid #e6a21c; }
.growNeeds { display: flex; flex-direction: column; gap: 7px; min-height: 0; }
.growNeed { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: rgba(90, 82, 102, 0.1); }
.growNeed .orb { flex: none; width: 2em; height: 2em; }
.growLv { flex: none; border-radius: 50%; background: var(--c-button-bg, #0f6e73); color: #fff; font-weight: 700; font-size: 0.85em; width: 2.35em; height: 2.35em; display: flex; align-items: center; justify-content: center; }
.growWords { flex: 1; min-width: 0; font-weight: 600; }
.growWords .small { font-weight: 500; }
.growTick { flex: none; position: relative; width: 1.5em; height: 1.5em; border-radius: 50%; background: #c9c1ad; }
.growNeed.ok .growTick { background: #2f9e44; }
.growNeed.ok .growTick::after { content: ''; position: absolute; left: 0.5em; top: 0.25em; width: 0.36em; height: 0.7em; border: solid #fff; border-width: 0 0.19em 0.19em 0; transform: rotate(45deg); }
.growKeeps { margin-top: auto; padding-top: 6px; border-top: 2px dashed rgba(90, 82, 102, 0.25); font-size: 0.9em; }
.growScene { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(circle at 50% 42%, #1f7f86 0, #0d4046 48%, #061f24 100%); color: #fff8e8; }
.gsRays { position: absolute; left: 50%; top: 42%; width: 240vmax; height: 240vmax; margin: -120vmax; border-radius: 50%; opacity: 0; background: repeating-conic-gradient(rgba(255, 240, 190, 0.09) 0 9deg, transparent 9deg 18deg); -webkit-mask: radial-gradient(circle, #000 0, transparent 62%); mask: radial-gradient(circle, #000 0, transparent 62%); animation: resTurn 14s linear infinite; }
.gsHero { position: absolute; left: 50%; top: 42%; height: min(56vh, 78vw); aspect-ratio: 1; translate: -50% -50%; display: flex; align-items: center; justify-content: center; }
.gsHero img { position: absolute; max-width: 100%; max-height: 100%; object-fit: contain; image-rendering: pixelated; }
.gsNew { opacity: 0; }
.gsRing { position: absolute; left: 50%; top: 42%; width: 60px; height: 60px; margin: -30px; border-radius: 50%; border: 6px solid #fff3c4; opacity: 0; }
.gsFlash { position: absolute; inset: 0; background: #fffbe6; opacity: 0; pointer-events: none; }
.gsAtom { position: absolute; left: 0; top: 0; width: min(9vw, 9vh, 56px); height: min(9vw, 9vh, 56px); opacity: 0; image-rendering: pixelated; }
.gsBadge { position: absolute; left: 50%; top: max(12px, 3vh); transform: translateX(-50%); padding: 4px 18px; border-radius: 999px; background: linear-gradient(#f6c445, #e6a21c); color: #3a2600; font-weight: 700; white-space: nowrap; opacity: 0; }
.gsCap { position: absolute; left: 0; right: 0; bottom: calc(var(--btn-min, 64px) + 26px); padding: 0 12px; text-align: center; font-weight: 700; font-size: 1.3em; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); opacity: 0; }
.gsSub { font-size: 0.72em; font-weight: 500; color: #bfe0dc; }
.gsNext { position: absolute; left: 12px; right: 12px; bottom: 12px; opacity: 0; }
.screen[data-screen="grow"] .panel { box-sizing: border-box; min-width: 0; }

/* V18 the world on the Map page: the 7 lands, the one you are in, open ones, and closed ones with the key */
.worldLands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.worldLand { display: flex; align-items: center; gap: 5px; padding: 3px 6px; border-radius: 12px; background: rgba(15, 110, 115, 0.08); border: 2px solid transparent; }
.worldLand.here { border-color: var(--c-button-bg, #0f6e73); background: rgba(15, 110, 115, 0.16); }
.worldLand.shut { opacity: 0.72; }
.worldKey { width: 1.6em; height: 1.6em; flex: none; }
.worldKey img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.worldWords { min-width: 0; }
.worldName { font-weight: 700; font-size: 0.95em; }
.worldNote { font-size: 0.75em; line-height: 1.2; }

/* V30 ending and credits: the logo and the lines roll slowly up the teal room */
.screen.ending .body { overflow: hidden; position: relative; }
.endRoll { position: absolute; inset: 0; overflow: hidden; -webkit-mask: linear-gradient(transparent, #000 12%, #000 88%, transparent); mask: linear-gradient(transparent, #000 12%, #000 88%, transparent); }
.endInner { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 40vh 16px; animation: endUp 40s linear forwards; }
.endLogo { width: min(60vw, 18em); }
.endLogo img { width: 100%; }
.endLine { font-size: 1.15em; margin: 6px 0; max-width: 26em; line-height: 1.45; }
.endRole { margin-top: 18px; font-size: 0.85em; font-weight: 600; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.08em; }
.endName { font-size: 1.15em; font-weight: 600; }
@keyframes endUp { from { transform: translateY(0); } to { transform: translateY(-100%); } }

/* the family as its drawn icon and its word, on the compound page and its moves */
.famChip { display: inline-flex; align-items: center; gap: 5px; }
.famIcon { width: 1.4em; height: 1.4em; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.famIcon img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.screen.ending h2 { justify-content: center; text-align: center; margin-left: 52px; margin-right: 52px; }

/* PLAN.md 15 (2026-11-22): fight states, move hints, flasks in a fight, moves by level, elements on the radar and the map */
.fstate { display: inline-flex; align-items: center; gap: 0.25em; font-size: 0.72em; font-weight: 600; line-height: 1.2; padding: 0.1em 0.55em 0.1em 0.2em; margin-top: 0.25em; border-radius: 999px; background: #f4e6c2; color: #2a2433; white-space: nowrap; }
.fstateIcon { width: 1.5em; height: 1.5em; margin: 0; image-rendering: pixelated; }   /* inside its chip: a bigger icon reached up over the health bar (2026-11-23) */
/* the word and the ring wear the colour of the icon (Muhammed 2026-11-24: icon and text in different colours looked odd);
   each is dark enough to read on the cream chip */
.fstate[data-state="chilled"] { color: #0f6a7a; box-shadow: inset 0 0 0 2px #0f6a7a; }
.fstate[data-state="corroded"] { color: #56660a; box-shadow: inset 0 0 0 2px #56660a; }
.fstate[data-state="smothered"] { color: #4d4d75; box-shadow: inset 0 0 0 2px #4d4d75; }
.fstate[data-state="diluted"] { color: #1b5e8c; box-shadow: inset 0 0 0 2px #1b5e8c; }
.fpanel .frow .fhp { margin-left: auto; }
.fbtn .fgive { display: block; font-size: 0.68em; font-weight: 600; opacity: 0.85; line-height: 1.1; margin-top: 0.1em; }
.fswap .foot .btn[data-act="flask"] { background: #f4e6c2; color: #2a2433; }
.fswapCards { display: contents; }
.moveChips { display: flex; flex-wrap: wrap; gap: 6px; }
.moveChip { font: inherit; color: inherit; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }
button.moveChip { cursor: pointer; }
.moveChip.on { background: rgba(15, 110, 115, 0.3); border-color: #0f6e73; }
.moveChip.picked { box-shadow: 0 0 0 3px #f0b429; }
.moveChip.special { border-style: dashed; }
.moveChip .moveAt { font-size: 0.75em; font-weight: 600; opacity: 0.8; }
.moveNote { font-size: 0.85em; margin-top: 6px; min-height: 1.2em; }
.moveWhat { font-weight: 600; }
button.famBtn { font: inherit; color: inherit; cursor: pointer; min-height: 40px; }
.famNote { font-size: 0.85em; font-weight: 600; text-align: center; margin-top: 6px; max-width: 32em; }
.famNote:empty { display: none; }
.sizeRow { display: grid; grid-template-columns: 5em 1fr; align-items: center; gap: 8px; font-size: 0.85em; }
.sizeNum { font-weight: 600; }
.sizeWhy { margin-top: 6px; opacity: 0.8; }
#miniOrbs { position: fixed; z-index: 5; display: none; justify-content: center; gap: 3px; pointer-events: none; }
body[data-mode="world"] #mini:not([hidden]) + #miniOrbs:not([hidden]) { display: flex; }
.miniOrb { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 0 1px #0a3338) drop-shadow(0 1px 0 #0a3338); }
.miniOrb.unseen, .wildOrb.unseen img { filter: brightness(0) opacity(0.55) drop-shadow(0 0 1px #f4e6c2); }
.wildOrbs { display: flex; gap: 2px; }
.wildOrb { width: 26px; height: 26px; display: grid; place-items: center; font-weight: 700; }
.wildOrb img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.landWild { position: absolute; translate: -50% -50%; padding: 1px 3px; border-radius: 999px; background: rgba(29, 36, 51, 0.82); border: 2px solid #f4e6c2; pointer-events: none; }
.landWild .wildOrb { width: 15px; height: 15px; }
.landWild .wildOrbs, .landWild { gap: 1px; }
.mapTabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.wildRows { display: flex; flex-direction: column; gap: 8px; }
.wildRow { padding: 6px 8px; border-radius: 10px; background: rgba(15, 110, 115, 0.1); border: 2px solid rgba(15, 110, 115, 0.25); }
.wildRow.here { border-color: #f0b429; }
.wildHead { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.wildLv { font-size: 0.85em; opacity: 0.8; white-space: nowrap; }
.wildItems { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
.wildItem { display: flex; align-items: center; gap: 4px; font-size: 0.9em; }

/* Boosters on the compound page (PLAN.md 15.6): pips up to the cap of the level, a Give button per stat */
.boostRows { display: flex; flex-direction: column; gap: 4px; }
.boostRow { display: grid; grid-template-columns: 5em auto 3.5em 1fr; align-items: center; gap: 10px; font-size: 0.85em; min-height: 34px; }
.boostPips { display: flex; flex-wrap: wrap; gap: 5px; }
.boostPips .pip { width: 16px; height: 16px; border-radius: 5px; background: rgba(42, 36, 51, 0.1); border: 2px solid rgba(15, 110, 115, 0.4); box-sizing: border-box; }
.boostPips .pip.on { background: #f2b632; border-color: #8a5a00; box-shadow: inset -3px -3px 0 rgba(138, 90, 0, 0.35), inset 2px 2px 0 rgba(255, 244, 200, 0.8); }
.boostNum { font-weight: 600; white-space: nowrap; }
.boostGive { font: inherit; font-weight: 600; font-size: 0.95em; min-height: 40px; padding: 4px 14px; border: 0; border-radius: 12px; background: var(--c-button-bg, #0f6e73); color: var(--c-button-text, #fff); cursor: pointer; justify-self: end; }
.boostNote { justify-self: end; font-size: 0.9em; opacity: 0.7; text-align: right; }
.boostNote.full { color: #8a5a00; opacity: 1; font-weight: 600; }
.boostHow { margin-top: 6px; opacity: 0.8; }

/* the family photo on the title page (A-TF01, Muhammed 2026-11-23): pixel art, as big as the page allows */
.titleTag { margin: -1vh auto 0; animation: markFloat 3.2s ease-in-out infinite; text-align: center; font-weight: 600; font-size: clamp(1.6em, 7vmin, 3em); letter-spacing: 0.06em; color: #fff8e8; text-shadow: 0 0.06em 0 #14666b, 0 0.12em 0 #0a3338, 0 0.2em 0.3em rgba(0, 0, 0, 0.45); }

/* 2026-11-26 (Muhammed): the family symbol in the top right corner of every compound card; strong and weak rows on the
   compound page; Storage: pick a card, read it, then move it. Mockup: reviews\pages\MOCKUP-CARDS-WEST-ASIA.html */
.mcard, .fmate, .cbox, .hero { position: relative; }
.famBadge { position: absolute; top: 3px; right: 3px; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--c-page-panel-bg, #fff8e8); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); display: flex; align-items: center; justify-content: center; font-size: 0.9em; font-weight: 700; z-index: 1; pointer-events: none; }
.famBadge img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.hero > .famBadge { top: 8px; right: 8px; width: 2.6em; height: 2.6em; }
.fmate > .famBadge { position: static; flex: none; width: 1.6em; height: 1.6em; box-shadow: none; }
.cbox > .famBadge { top: 1px; right: 1px; width: 1.25em; height: 1.25em; box-shadow: none; }
.mWalks { right: auto; left: 4px; }
.mWalks + .mFirst { top: 2.2em; }
.mFirst { position: absolute; top: 4px; left: 4px; font-size: 0.68em; font-weight: 600; line-height: 1; padding: 3px 7px; border-radius: 999px; background: #b86e12; color: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); pointer-events: none; }
.teamHint { font-size: 0.85em; text-align: center; opacity: 0.85; margin: 6px 4px 0; }
html[data-kind="phoneLandscape"] .mcard .mName { padding-right: 1.5em; }
html[data-kind="phoneLandscape"] .mcard .mSub { white-space: nowrap; }
html[data-kind="phoneLandscape"] .mcard .famBadge { top: 2px; right: 2px; width: 1.3em; height: 1.3em; }
.match { width: 100%; display: flex; flex-direction: column; gap: 4px; flex: none; }
.matchRow { display: flex; align-items: center; gap: 6px; border-radius: 10px; padding: 3px 6px; background: rgba(42, 36, 51, 0.06); text-align: left; }
.matchLab { flex: none; width: 8.4em; white-space: nowrap; text-align: center; font-size: 0.76em; font-weight: 600; color: #fff; border-radius: 7px; padding: 3px 4px; }
.matchRow[data-kind="strong"] .matchLab { background: #1d7a34; }
.matchRow[data-kind="weak"] .matchLab { background: var(--c-dialogue-danger-text, #a3201a); }
.matchRow[data-kind="little"] .matchLab { background: var(--c-dialogue-formula-text, #5a5266); }
.matchList { display: flex; flex-wrap: wrap; gap: 2px 9px; font-size: 0.82em; min-width: 0; }
.matchFam { font: inherit; color: inherit; background: none; border: 0; padding: 0; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
button.matchFam { cursor: pointer; min-height: 28px; }
.matchFam.none { color: var(--c-dialogue-formula-text, #5a5266); }
.hero .famNote { margin-top: 0; font-size: 0.8em; }
html[data-portrait="1"] .screen[data-screen="compound"] .hero { height: auto; }
html[data-portrait="1"] .screen[data-screen="compound"] .hero .heroPic { flex: none; height: 15vh; }
/* a phone on its side is low: a wider picture side, no family chip (the symbol in the corner says it), and it scrolls if it must */
html[data-kind="phoneLandscape"] .screen[data-screen="compound"] .body.split { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.6fr); }
html[data-kind="phoneLandscape"] .screen[data-screen="compound"] .hero { justify-content: flex-start; gap: 3px; padding: 4px 8px; overflow-y: auto; touch-action: pan-y; }
html[data-kind="phoneLandscape"] .screen[data-screen="compound"] .hero > .famChip { display: none; }
html[data-kind="phoneLandscape"] .screen[data-screen="compound"] .hero .heroPic { min-height: 1.5em; }
html[data-kind="phoneLandscape"] .screen[data-screen="compound"] .hero .formula { font-size: 1.1em; line-height: 1; }
html[data-kind="phoneLandscape"] .screen[data-screen="compound"] .hero > .famBadge { top: 5px; right: 5px; width: 2em; height: 2em; }
.screen .body.pair.picking { grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) auto; grid-auto-rows: auto; }
html[data-portrait="0"] .screen .body.pair.picking { grid-template-rows: minmax(0, 1fr) auto; }
.pickBox { display: flex; flex-direction: column; gap: 4px; padding: 6px 9px; min-height: 5.6em; justify-content: center; }
html[data-portrait="0"] .pickBox { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 3em; }
html[data-portrait="0"] .pickBox .match { flex: 1; flex-direction: row; min-width: 0; }
html[data-portrait="0"] .pickBox .matchRow { flex: 0 1 auto; min-width: 0; }
html[data-portrait="0"] .pickBox .matchLab { width: auto; padding: 3px 9px; }
html[data-portrait="0"] .pickBox .matchList { flex-wrap: nowrap; }
html[data-kind="phoneLandscape"] .pickBox { padding: 3px 8px; min-height: 2.4em; font-size: 0.9em; }
html[data-kind="phoneLandscape"] .pickHead span { display: none; }
.pickHead { display: flex; align-items: center; gap: 6px; }
.pickHead .famIcon { width: 1.6em; height: 1.6em; }
.pickHead span { margin-left: auto; font-size: 0.85em; color: var(--c-dialogue-formula-text, #5a5266); }
html[data-portrait="0"] .pickHead span { margin-left: 4px; }
.pickHint { text-align: center; color: var(--c-dialogue-formula-text, #5a5266); }
.mcard.picked { box-shadow: 0 0 0 3px var(--c-chamber-title-text, #8fe3d3), 0 4px 0 rgba(0, 0, 0, 0.22); }
.screen[data-screen="storage"] .foot .btn[data-act="back"] { flex: 0 0 30%; }

/* ---- 2026-11-27 (Muhammed): my card on my side, the strong panel, the Flask button, critical hit ---- */
/* the player's compound stands on the left: its card is on the left now, the foe's card on the right */
.fpanel.mine { left: 2.5%; right: auto; top: max(3%, 46px); bottom: auto; }
.fpanel.foe { right: 2.5%; left: auto; bottom: 3%; top: auto; }
.fpanel.mine.away { translate: -14% 0; }
.fpanel.foe.away { translate: 14% 0; }
/* the one whose family is strong against the other: a gold rim, a soft glow and the word Strong */
.fpanel.strong { border-color: #ffd34d; box-shadow: 0 0 0 0.14em #7a5200, 0 0 1.1em 0.25em rgba(255, 211, 77, 0.75); }
.fpanel.strong .fname { color: #ffe08a; }
.fpanel .ftag { position: absolute; top: -0.85em; right: 1.2em; padding: 0.05em 0.6em; border-radius: 1em; background: #ffd34d; color: #3a2800; border: 0.12em solid #7a5200; font-size: 0.72em; font-weight: 600; line-height: 1.35; white-space: nowrap; }
.fpanel .ftag::before { content: '\25B2'; font-size: 0.7em; margin-right: 0.3em; }
.fpanel .ftag[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) { .fpanel.strong { animation: fstrong 1.6s ease-in-out infinite; } }
@keyframes fstrong { 50% { box-shadow: 0 0 0 0.14em #7a5200, 0 0 1.6em 0.45em rgba(255, 211, 77, 0.9); } }
/* the words of a critical hit jump up over the one who is hit */
.fcrit { position: absolute; z-index: 7; translate: -50% -100%; padding: 0.1em 0.6em; border-radius: 0.5em; background: #b3261e; color: #fff; border: 0.14em solid #fff; font-weight: 700; font-size: 1.25em; white-space: nowrap; pointer-events: none; animation: fcrit 1.1s ease-out forwards; }
@keyframes fcrit { 0% { scale: 0.4; opacity: 0; } 15% { scale: 1.2; opacity: 1; } 30% { scale: 1; } 80% { opacity: 1; translate: -50% -160%; } 100% { opacity: 0; translate: -50% -190%; } }
/* five buttons in a wild fight (Attack, Swap, Collect, Dodge, Flask), four against a trainer */
#fight[data-side="0"][data-tall="0"] .fbtns[data-count="5"] { grid-template-columns: repeat(5, 1fr); }
#fight[data-tall="1"] .fbtns[data-count="5"] .fbtn[data-act="attack"] { grid-column: span 2; }
.fbtn[data-act="flask"] { background: #f4e6c2; color: #2a2433; }
.fbtn[data-act="flask"]:disabled { opacity: 0.55; }

/* ---- 2026-11-27 (Muhammed): the New compounds page, a card with a picture for each ---- */
[data-screen="news"] .body { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.newsSub { text-align: center; font-size: 1.05em; opacity: 0.92; }
.newsGrid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(7.2em, 1fr)); grid-auto-rows: minmax(8.6em, min(19em, 100%)); gap: 10px; align-content: safe center; overflow-y: auto; touch-action: pan-y; padding: 4px; }
.newsGrid[data-n="1"], .newsGrid[data-n="2"], .newsGrid[data-n="3"] { grid-template-columns: repeat(auto-fit, minmax(7.2em, 12em)); justify-content: center; }
.newsCard { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 1px; padding: 8px 6px 7px; text-align: center; min-height: 0; box-shadow: 0 0 0 2px #ffd34d, 0 0 14px rgba(255, 211, 77, 0.45); }
.newsCard > .famBadge { position: absolute; top: 5px; right: 5px; }
.newsPic { flex: 1 1 0; min-height: 0; width: 100%; object-fit: contain; image-rendering: pixelated; }
.newsName { font-weight: 600; line-height: 1.15; }
.newsFormula { font-size: 0.85em; opacity: 0.8; }
.newsFam { font-size: 0.78em; opacity: 0.8; }
@media (prefers-reduced-motion: no-preference) { .newsCard { animation: newsIn 0.4s ease-out backwards; } }
@keyframes newsIn { from { opacity: 0; translate: 0 14px; scale: 0.92; } }
html[data-kind="phoneLandscape"] .newsGrid { grid-template-columns: repeat(auto-fit, minmax(6.2em, 1fr)); grid-auto-rows: minmax(6.6em, 1fr); gap: 6px; }
html[data-kind="phoneLandscape"] .newsFam { display: none; }
/* a phone held sideways: five or four buttons in the side column go two by two, so the words and every button fit */
@media (max-height: 520px) {
  #fight[data-side="1"] .fbtns[data-count="5"], #fight[data-side="1"] .fbtns[data-count="4"] { grid-template-columns: 1fr 1fr; gap: 6px; }
  #fight[data-side="1"] .fbtns[data-count="5"] .fbtn[data-act="attack"] { grid-column: span 2; }
}
@media (max-height: 520px) { #fight[data-side="1"] .fbtns[data-count="5"] .fbtn, #fight[data-side="1"] .fbtns[data-count="4"] .fbtn { font-size: 0.86em; padding-left: 4px; padding-right: 4px; white-space: nowrap; } #fight[data-side="1"] .fbtn .fgive { white-space: nowrap; } }

/* ---- 2026-11-27 (Muhammed): the Ride button, the third button while walking; the reviving flask tag ---- */
#btnRide { left: calc(232px + 2 * (var(--btn-min, 64px) - 64px)); }
#btnRide[hidden] { display: none !important; }
html[data-hand="left"] #btnRide { left: auto; right: calc(232px + 2 * (var(--btn-min, 64px) - 64px)); }
html[data-portrait="1"] #btnRide { left: 16px; bottom: calc(48px + 2 * var(--btn-min, 64px) + env(safe-area-inset-bottom)); }
html[data-portrait="1"][data-hand="left"] #btnRide { left: auto; right: 16px; }
.reviveTag { position: absolute; left: 50%; top: 38%; translate: -50% -50%; padding: 0.15em 0.7em; border-radius: 1em; background: #ffd34d; color: #3a2800; border: 2px solid #7a5200; font-weight: 600; font-size: 0.85em; white-space: nowrap; }

/* The end of a land in five parts (Muhammed 2026-11-28, mockup reviews\pages\MOCKUP-CREDITS-WEST-ASIA.html) */
.screen.endParts .body { padding: 0; }
.endStage { position: absolute; inset: 0; }
.endPart { position: absolute; inset: 0; opacity: 0; transition: opacity 1.1s ease; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 16px; text-align: center; pointer-events: none; }
.endPart.show { opacity: 1; }
.endFit { display: flex; flex-direction: column; align-items: center; width: 100%; transform-origin: center center; flex: none; }
.endPanel { position: absolute; inset: 0; opacity: 0; transition: opacity 1.4s ease; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.8em; padding: 8px 16px; }
.endPanel.show { opacity: 1; }
.endFrame { width: min(94%, 46em, 80vh); aspect-ratio: 4 / 3; overflow: hidden; border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,0.45); border: 3px solid rgba(251,243,220,0.18); }
.endFrame img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.endPanel.show .endFrame img { animation: endCloser 9s ease-out forwards; }
@keyframes endCloser { from { transform: scale(1); } to { transform: scale(1.12); } }
.endPanel .endLine { font-size: 1.3em; font-weight: 500; max-width: 24em; line-height: 1.35; margin: 0; opacity: 0; transform: translateY(8px); transition: opacity 1s ease 0.6s, transform 1s ease 0.6s; }
.endPanel.show .endLine { opacity: 1; transform: none; }
.endNextLine { font-size: 1.7em; font-weight: 600; color: var(--gold, #f0c04a); opacity: 0; transition: opacity 1.2s ease; }
.endPanel.nextIn .endNextLine { opacity: 1; }
.endHead { font-size: 1.6em; font-weight: 600; }
.endSub { opacity: 0.75; margin: 0.1em 0 0.9em; }
.endTeam { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; width: min(100%, 60em); }
.endMon { display: flex; flex-direction: column; align-items: center; opacity: 0; transform: translateY(26px) scale(0.9); }
.endMon.in, .endPerson.in { animation: endHop 0.7s cubic-bezier(.3,1.6,.5,1) forwards; }
@keyframes endHop { to { opacity: 1; transform: none; } }
.endMonPic { height: clamp(56px, 13vh, 130px); width: 100%; display: flex; justify-content: center; }
.endMonPic img { height: 100%; max-width: 100%; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 6px 6px rgba(0,0,0,0.35)); }
.endMonName { font-weight: 600; font-size: 0.9em; margin-top: 4px; line-height: 1.15; }
.endMonFormula { opacity: 0.75; font-size: 0.8em; }
.endMonLevel { margin-top: 3px; font-size: 0.75em; font-weight: 600; color: #0a2a30; background: #f0c04a; border-radius: 999px; padding: 1px 9px; }
.endMarks { display: flex; gap: clamp(4px, 2vw, 22px); margin: 1.2em 0 0.4em; justify-content: center; width: min(100%, 34em); }
.endMark { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; opacity: 0; transform: scale(0.4) rotate(-20deg); }
.endMark.in { animation: endMarkIn 0.6s cubic-bezier(.3,1.7,.5,1) forwards; }
@keyframes endMarkIn { to { opacity: 1; transform: none; } }
.endMarkPic { width: clamp(40px, 6vw, 64px); }
.endMarkPic img { width: 100%; image-rendering: pixelated; filter: drop-shadow(0 0 10px rgba(240,192,74,0.45)); }
.endMark span { font-size: 0.7em; opacity: 0.75; margin-top: 4px; line-height: 1.1; }
.endStats { display: flex; gap: 8px; justify-content: center; margin-top: 0.8em; width: min(100%, 30em); }
.endStat { flex: 1; min-width: 0; padding: 8px 6px; border-radius: 14px; background: rgba(0,0,0,0.22); opacity: 0; transition: opacity 0.6s; display: flex; flex-direction: column; }
.endStat.in { opacity: 1; }
.endStat b { font-size: 1.6em; font-weight: 600; color: #f0c04a; }
.endStat span { font-size: 0.75em; opacity: 0.75; }
.endWho { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 8px; width: min(100%, 56em); }
.endPerson { display: flex; flex-direction: column; align-items: center; opacity: 0; transform: translateY(14px); }
.endSprite { width: 72px; height: 96px; background-size: 432px 288px; background-position: 0 0; image-rendering: pixelated; }
.endPersonName { font-weight: 600; font-size: 0.9em; }
.endPersonRole { font-size: 0.72em; opacity: 0.75; line-height: 1.15; }
.endMore { margin-top: 1em; opacity: 0; transition: opacity 0.8s; }
.endMore.in { opacity: 0.75; }
.endCreditRoll { position: absolute; inset: 0; overflow: hidden; -webkit-mask: linear-gradient(transparent, #000 14%, #000 86%, transparent); mask: linear-gradient(transparent, #000 14%, #000 86%, transparent); }
.endCreditIn { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 16px; transform: translateY(100vh); }
.endCreditIn.go { animation: endRollUp 44s linear forwards; }
@keyframes endRollUp { from { transform: translateY(70vh); } to { transform: translateY(-100%); } }
.endCreditIn .endLogo { width: min(64vw, 340px); margin-bottom: 1.4em; }
.endCreditIn .endRole { margin-top: 1.8em; color: #f0c04a; opacity: 1; letter-spacing: 0.12em; }
.endCreditIn .endName { font-weight: 500; margin-top: 0.3em; }
.endMade { margin-top: 2.6em; opacity: 0.75; }
.endThanks { margin: 2.6em 0 40vh; font-size: 1.3em; font-weight: 500; }
.endNext { opacity: 0; pointer-events: none; transition: opacity 0.8s; }
.endNext.in { opacity: 1; pointer-events: auto; }
/* phone portrait and other narrow screens: three on a row, every part fits on one screen */
@media (max-aspect-ratio: 4/5), (max-width: 640px) {
  .endTeam { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .endWho { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .endMonPic { height: clamp(52px, 8vh, 90px); }
}
/* low and wide screens (phone landscape): smaller pictures */
@media (max-height: 520px) {
  .endMonPic { height: 54px; }
  .endSprite { width: 48px; height: 64px; background-size: 288px 192px; }
  .endHead { font-size: 1.25em; }
  .endSub { margin-bottom: 0.4em; }
  .endWho { gap: 4px; }
  .endMarks { margin-top: 0.5em; }
  .endMarkPic { width: 34px; }
}
/* big screens: the people a little bigger */
@media (min-width: 900px) and (min-height: 700px) {
  .endSprite { width: 96px; height: 128px; background-size: 576px 384px; }
}
