/* js/space/arcade/arcade.css — Rehablix Space arcade: the shared look of every game (web and Android).
   (2026-11-10) No background of its own: a game sits directly on the app's background and fills the screen to its
   base. Text and glass use the app's theme colours (--text-primary, --card-bg …; space-arcade.html sets the same
   names for the Android app, light and dark). Game objects (tiles, jars, pieces, cards) are glossy and solid.
   No color-mix(): each colour comes with its light and dark shades as variables (arcade-kit.js K.paint). */
@font-face { font-family: 'Rehablix Brand'; src: url('../../../fonts/outfit.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }

.rxa {
  --game: #14b8a6; --game-l: #5eead4; --game-d: #0f766e;
  --ink: var(--text-primary, #1f2933);
  --ink-2: var(--text-secondary, #6b7280);
  --glass: var(--card-bg, rgba(255, 255, 255, 0.62));
  --solid: var(--surface, #ffffff);
  --rim: var(--border-light, rgba(15, 23, 42, 0.12));
  --good: #16a34a; --bad: #e11d48; --gold: #f59e0b;
  position: relative;
  display: flex; flex-direction: column;
  min-height: calc(100vh - var(--rxa-top, 0px));
  min-height: calc(100dvh - var(--rxa-top, 0px));
  color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: transparent;
  /* --rxa-pad-top: room for the app's navbar, which floats over the game (web: space-view.js; Android: the app) */
  padding: var(--rxa-pad-top, 8px) 12px calc(14px + env(safe-area-inset-bottom));
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.rxa * { box-sizing: border-box; }
.rxa-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.rxa-grow { flex: 1; min-height: 8px; }
.rxa-title { font-family: 'Rehablix Brand', system-ui, sans-serif; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.rxa-muted { color: var(--ink-2); font-size: 0.88rem; }
.rxa-glass {
  background: var(--glass);
  border: 1px solid var(--rim);
  border-radius: 18px;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* top bar: back, title, music, sound, score */
.rxa-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rxa-icon-btn {
  width: 40px; height: 40px; flex: none; border-radius: 14px; border: 1px solid var(--rim); cursor: pointer;
  background: var(--glass); color: var(--ink); font-size: 1.1rem; display: grid; place-items: center;
}
.rxa-icon-btn.rxa-music.off { opacity: 0.4; text-decoration: line-through; }
.rxa-bar .rxa-title { flex: 1; min-width: 0; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rxa-score {
  flex: none; padding: 7px 12px; border-radius: 999px; font-weight: 800; font-size: 0.95rem; color: #fff;
  background: linear-gradient(135deg, var(--game), var(--game-d));
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.rxa-score.pop { animation: rxa-pop 0.35s ease; }
@keyframes rxa-pop { 50% { transform: scale(1.18); } }

/* progress dots */
.rxa-dots { display: flex; gap: 5px; justify-content: center; margin: 2px 0 10px; }
.rxa-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-2); opacity: 0.3; }
.rxa-dots i.done { background: var(--good); opacity: 1; }
.rxa-dots i.miss { background: var(--bad); opacity: 1; }
.rxa-dots i.now { background: var(--gold); opacity: 1; box-shadow: 0 0 8px var(--gold); }

/* glossy buttons */
.rxa-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 12px 22px;
  border: 0; border-radius: 16px; cursor: pointer; font: inherit; font-weight: 800; font-size: 1rem; color: #fff;
  background: linear-gradient(180deg, var(--game-l), var(--game) 45%, var(--game-d));
  box-shadow: 0 5px 0 var(--game-d), 0 10px 18px rgba(15, 23, 42, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.rxa-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--game-d), 0 4px 10px rgba(15, 23, 42, 0.2); }
.rxa-btn.ghost { background: var(--glass); color: var(--ink); box-shadow: none; border: 1px solid var(--rim); }
.rxa-btn.ghost:active { transform: scale(0.97); }
.rxa-btn.small { min-height: 40px; padding: 8px 14px; font-size: 0.9rem; border-radius: 13px; }
.rxa-btn[disabled] { opacity: 0.45; pointer-events: none; }
.rxa-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* feedback card */
.rxa-explain { margin-top: 10px; padding: 12px 14px; border-radius: 16px; font-size: 0.93rem; line-height: 1.45; color: var(--ink); animation: rxa-rise 0.3s ease; }
.rxa-explain b { display: block; font-size: 1rem; margin-bottom: 3px; }
.rxa-explain.ok { background: rgba(22, 163, 74, 0.14); border: 1px solid rgba(22, 163, 74, 0.45); }
.rxa-explain.no { background: rgba(225, 29, 72, 0.12); border: 1px solid rgba(225, 29, 72, 0.4); }
.rxa-explain.info { background: var(--glass); border: 1px solid var(--rim); }
@keyframes rxa-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rxa-shake { animation: rxa-shake 0.4s ease; }
@keyframes rxa-shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

.rxa-float { position: absolute; z-index: 30; pointer-events: none; font-weight: 900; font-size: 1.4rem; color: var(--gold); text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); animation: rxa-floatup 1s ease forwards; }
@keyframes rxa-floatup { to { transform: translateY(-60px) scale(1.2); opacity: 0; } }
.rxa-cheer { position: absolute; left: 50%; top: 34%; z-index: 35; pointer-events: none; transform: translate(-50%, -50%); font-family: 'Rehablix Brand', system-ui, sans-serif; font-weight: 900; font-size: 2rem; color: #fff; padding: 6px 18px; border-radius: 999px; background: linear-gradient(135deg, var(--game-l), var(--game-d)); box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35); animation: rxa-cheer 1.1s cubic-bezier(.2, 1.5, .4, 1) forwards; white-space: nowrap; }
@keyframes rxa-cheer { 0% { transform: translate(-50%, -50%) scale(0.2) rotate(-8deg); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.1) rotate(2deg); opacity: 1; } 75% { transform: translate(-50%, -60%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -90%) scale(0.9); opacity: 0; } }
.rxa-confetti { position: fixed; inset: 0; z-index: 60; pointer-events: none; }

/* modal (knowledge check, quit warning, results) */
/* (a flex box of the screen's height, so the card's max-height is real and a long card scrolls inside itself;
   the top padding keeps it clear of the floating navbar) */
.rxa-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: max(14px, var(--rxa-pad-top, 14px)) 14px calc(14px + env(safe-area-inset-bottom)); background: rgba(8, 15, 30, 0.45); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); animation: rxa-fade 0.2s ease; }
@keyframes rxa-fade { from { opacity: 0; } }
.rxa-modal-card { position: relative; width: min(460px, 100%); max-height: 100%; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 18px; border-radius: 22px; background: var(--solid); color: var(--ink); border: 1px solid var(--rim); box-shadow: 0 24px 60px rgba(8, 15, 30, 0.4); animation: rxa-zoom 0.28s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes rxa-zoom { from { transform: scale(0.85) translateY(10px); opacity: 0; } }
.rxa-q { font-size: 1.08rem; font-weight: 700; line-height: 1.4; margin: 6px 0 14px; }
.rxa-options { display: grid; gap: 10px; }
.rxa-opt {
  text-align: left; padding: 13px 14px; border-radius: 14px; cursor: pointer; font: inherit; font-weight: 650; font-size: 0.95rem; color: var(--ink);
  background: var(--glass); border: 1px solid var(--rim); box-shadow: 0 3px 0 rgba(15, 23, 42, 0.14); transition: transform 0.08s ease;
}
.rxa-opt:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(15, 23, 42, 0.14); }
.rxa-opt.right { background: linear-gradient(180deg, #34d399, #059669); border-color: #6ee7b7; color: #fff; }
.rxa-opt.wrong { background: linear-gradient(180deg, #fb7185, #e11d48); border-color: #fda4af; color: #fff; }
.rxa-opt[disabled] { cursor: default; }

/* results: light rays, a bouncing trophy, stars that pop in one by one, a counting score */
.rxa-result { text-align: center; padding-bottom: 0; }
.rxa-result > * { position: relative; }
/* (the rays are a background layer: absolute, so they take no room in the card) */
.rxa-result > .rxa-rays { position: absolute; left: 50%; top: 70px; width: 420px; height: 420px; margin: -210px 0 0 -210px; border-radius: 50%; pointer-events: none; opacity: 0.5;
  background: repeating-conic-gradient(from 0deg, rgba(251, 191, 36, 0.55) 0deg 10deg, transparent 10deg 24deg);
  -webkit-mask-image: radial-gradient(circle, #000 0, transparent 68%); mask-image: radial-gradient(circle, #000 0, transparent 68%);
  animation: rxa-spin 14s linear infinite; }
@keyframes rxa-spin { to { transform: rotate(360deg); } }
/* the buttons: pinned to the bottom of the card, over a fade, so Next is always in reach */
.rxa-result > .rxa-actions { position: sticky; bottom: 0; z-index: 2; margin: 12px -18px 0; padding: 18px 18px 16px; background: linear-gradient(180deg, transparent, var(--solid) 34%); }
.rxa-result .rxa-explain.info { max-height: none; }
.rxa-trophy { font-size: 3.6rem; line-height: 1.1; filter: drop-shadow(0 8px 14px rgba(245, 158, 11, 0.45)); animation: rxa-trophy 0.9s cubic-bezier(.2, 1.6, .4, 1) both, rxa-bob 2.6s ease-in-out 0.9s infinite; }
@keyframes rxa-trophy { 0% { transform: translateY(40px) scale(0.2) rotate(-25deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes rxa-bob { 50% { transform: translateY(-7px) rotate(-3deg); } }
.rxa-stars { display: flex; justify-content: center; gap: 8px; margin: 6px 0 2px; }
.rxa-stars span { font-size: 2.3rem; line-height: 1; filter: grayscale(1); opacity: 0.25; transform: scale(0.7); }
.rxa-stars span.on { animation: rxa-star 0.55s cubic-bezier(.2, 1.8, .4, 1) forwards; }
@keyframes rxa-star { 0% { transform: scale(0.2) rotate(-40deg); opacity: 0.2; filter: grayscale(1); } 60% { transform: scale(1.35) rotate(8deg); } 100% { transform: scale(1) rotate(0); opacity: 1; filter: grayscale(0) drop-shadow(0 4px 8px rgba(245, 158, 11, 0.6)); } }
.rxa-result .big { font-family: 'Rehablix Brand', system-ui, sans-serif; font-weight: 900; font-size: 3rem; line-height: 1.05; color: var(--game-d); }
.rxa-result .xp { display: inline-block; margin: 10px 0 4px; padding: 6px 14px; border-radius: 999px; font-weight: 800; background: rgba(245, 158, 11, 0.16); border: 1px solid rgba(245, 158, 11, 0.5); color: #b45309; animation: rxa-pop 0.5s ease 1.2s both; }
.rxa-praise { font-weight: 700; margin-top: 4px; color: var(--ink); }

/* ---------- levels ---------- */
.rxa-level-hero { padding: 16px; text-align: center; margin-bottom: 12px; }
/* the game focus (the player's field): chips on the level map */
.rxa-focus { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.rxa-focus::-webkit-scrollbar { display: none; }
.rxa-focus > span { flex: none; font-weight: 800; font-size: .8rem; margin-right: 2px; }
.rxa-chip { flex: none; border: 1.5px solid var(--rim); background: var(--glass); color: var(--ink);
  border-radius: 999px; padding: 7px 13px; font: 700 .8rem/1 system-ui, sans-serif; cursor: pointer; transition: transform .12s, background .15s; }
.rxa-chip:active { transform: scale(.96); }
.rxa-chip.on { background: var(--game); border-color: var(--game-d); color: #fff; box-shadow: 0 3px 0 var(--game-d); }
.rxa-level-hero .n { font-family: 'Rehablix Brand', system-ui, sans-serif; font-weight: 900; font-size: 2.6rem; line-height: 1; color: var(--game-d); }
.rxa-level-bar { height: 10px; border-radius: 10px; background: rgba(15, 23, 42, 0.10); overflow: hidden; margin: 10px 0 12px; }
.rxa-level-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--game-l), var(--game)); border-radius: 10px; }
.rxa-level-pages { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.rxa-level-pages::-webkit-scrollbar { display: none; }
.rxa-level-pages button { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--rim); background: var(--glass); color: var(--ink); font: inherit; font-weight: 700; font-size: 0.8rem; cursor: pointer; }
.rxa-level-pages button.on { background: var(--game); color: #fff; border-color: transparent; }
.rxa-level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rxa-level {
  position: relative; aspect-ratio: 1; border-radius: 14px; border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 1rem; color: #fff;
  background: linear-gradient(160deg, var(--game-l), var(--game) 50%, var(--game-d)); box-shadow: 0 4px 0 var(--game-d), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  display: grid; place-items: center;
}
.rxa-level:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--game-d); }
.rxa-level small { position: absolute; left: 0; right: 0; bottom: 3px; font-size: 0.55rem; letter-spacing: 1px; }
.rxa-level.locked { background: var(--glass); color: var(--ink-2); box-shadow: none; border: 1px solid var(--rim); cursor: default; }
.rxa-level.next { box-shadow: 0 0 0 3px var(--gold), 0 4px 0 var(--game-d); animation: rxa-pulse 1.6s ease-in-out infinite; }
@keyframes rxa-pulse { 50% { transform: scale(1.06); } }

/* ---------- wooden letter tiles (Word Lab) ---------- */
.rxa-tile {
  --tile: 46px;
  position: relative; width: var(--tile); height: var(--tile); flex: none; border-radius: 9px; cursor: grab; touch-action: none;
  display: grid; place-items: center; font-family: 'Rehablix Brand', system-ui, sans-serif; font-weight: 900; font-size: calc(var(--tile) * 0.5); color: #3b2405;
  background:
    repeating-linear-gradient(92deg, rgba(120, 72, 20, 0.10) 0 2px, transparent 2px 7px),
    linear-gradient(160deg, #f8e3b4 0%, #e9c27f 45%, #d19a4c 100%);
  box-shadow: 0 5px 0 #8a5a22, 0 8px 12px rgba(15, 23, 42, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.7), inset 0 -3px 5px rgba(120, 72, 20, 0.3);
  transition: transform 0.15s ease, opacity 0.15s;
}
.rxa-tile sub { position: absolute; right: 4px; bottom: 2px; font-size: calc(var(--tile) * 0.22); font-weight: 800; color: #7c4a14; }
.rxa-tile.used { opacity: 0; pointer-events: none; }
.rxa-tile.ghost { position: fixed; z-index: 1000; pointer-events: none !important; transform: scale(1.15) rotate(-6deg); box-shadow: 0 16px 26px rgba(15, 23, 42, 0.4), 0 5px 0 #8a5a22; }
.rxa-tile.gold { animation: rxa-flip 0.6s ease both; background: linear-gradient(160deg, #fff4c2, #fcd34d 45%, #d97706); }
@keyframes rxa-flip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg) scale(1.1); } 100% { transform: rotateY(0); } }
.rxa-board { perspective: 900px; margin: 6px 0 14px; }
.rxa-board-plane {
  transform: rotateX(16deg); transform-origin: center bottom; padding: 16px 10px 18px; border-radius: 16px;
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0 3px, transparent 3px 11px), linear-gradient(180deg, #2f7d57, #1f6245);
  border: 5px solid #7a4a1e; box-shadow: 0 8px 0 #4f2f12, 0 22px 30px rgba(15, 23, 42, 0.35), inset 0 2px 8px rgba(0, 0, 0, 0.35);
}
.rxa-slots { display: flex; gap: 5px; justify-content: center; flex-wrap: nowrap; }
.rxa-slot { --tile: 46px; position: relative; width: var(--tile); height: var(--tile); flex: none; border-radius: 9px; display: grid; place-items: center; background: rgba(0, 0, 0, 0.18); box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4); transition: background 0.15s, transform 0.15s; }
.rxa-slot.over { background: rgba(251, 191, 36, 0.45); transform: scale(1.06); }
.rxa-slot .b { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); font-size: 0.6rem; font-weight: 900; padding: 1px 5px; border-radius: 6px; color: #fff; letter-spacing: 0.04em; z-index: 2; }
.rxa-slot .b.DL { background: #0ea5e9; } .rxa-slot .b.DW { background: #e11d48; }
.rxa-slot .rxa-tile { cursor: pointer; box-shadow: 0 3px 0 #8a5a22, inset 0 2px 0 rgba(255, 255, 255, 0.7); }
.rxa-rack {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 14px 10px 16px; border-radius: 14px; min-height: 76px;
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.07) 0 3px, transparent 3px 13px), linear-gradient(180deg, #8a5a22, #6b4216);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.5), 0 6px 0 #4f2f12, 0 12px 18px rgba(15, 23, 42, 0.3);
}
.rxa-clue { padding: 12px 14px; border-radius: 18px; margin-bottom: 8px; }
.rxa-clue .cat { display: inline-block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--game-d); margin-bottom: 4px; }
.rxa-clue p { font-size: 1.02rem; line-height: 1.45; font-weight: 600; margin: 0; }

/* ---------- Muscle Match ---------- */
.rxa-deck { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 90px; margin: 4px 0 14px; }
.rxa-card {
  position: relative; padding: 12px 14px; min-width: 120px; max-width: 46%; border-radius: 14px; cursor: grab; touch-action: none; text-align: center;
  font-weight: 800; font-size: 0.92rem; color: #1f2933;
  background: linear-gradient(170deg, #ffffff, #f1f5f9);
  border-left: 6px solid var(--game);
  box-shadow: 0 4px 0 #cbd5e1, 0 10px 16px rgba(15, 23, 42, 0.22);
  transition: transform 0.2s, opacity 0.25s; animation: rxa-deal 0.4s cubic-bezier(.2, 1.3, .4, 1) both;
}
@keyframes rxa-deal { from { transform: translateY(-30px) rotate(-6deg); opacity: 0; } }
.rxa-card.selected { transform: translateY(-6px) scale(1.05); box-shadow: 0 0 0 3px var(--gold), 0 12px 20px rgba(15, 23, 42, 0.3); }
.rxa-card.ghost { position: fixed; z-index: 1000; pointer-events: none !important; transform: scale(1.08) rotate(-4deg); animation: none; }
.rxa-card.gone { opacity: 0; transform: scale(0.3); pointer-events: none; }
.rxa-card.used { visibility: hidden; }
.rxa-bins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; flex: 1; align-content: end; }
.rxa-bin {
  position: relative; min-height: 130px; padding: 12px 8px 10px; border-radius: 16px 16px 20px 20px; text-align: center; cursor: pointer; color: #fff;
  background: linear-gradient(180deg, var(--c-l), var(--c) 45%, var(--c-d));
  box-shadow: 0 6px 0 var(--c-d), 0 12px 18px rgba(15, 23, 42, 0.25), inset 0 8px 14px rgba(0, 0, 0, 0.22);
  transition: transform 0.15s;
}
.rxa-bin b { display: block; font-size: 0.8rem; line-height: 1.25; }
.rxa-bin .n { margin-top: 8px; font-size: 1.5rem; font-weight: 900; }
.rxa-bin.over { transform: scale(1.06); }
.rxa-bin.yes { animation: rxa-pop 0.35s ease; }

/* ---------- Goniometer 3D ---------- */
.rxa-canvas-wrap { position: relative; border-radius: 20px; overflow: hidden; }
.rxa-canvas-wrap canvas { display: block; width: 100%; height: auto; touch-action: none; }
.rxa-canvas-wrap .tag { position: absolute; left: 10px; top: 10px; padding: 5px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; background: var(--solid); color: var(--ink); border: 1px solid var(--rim); }
.rxa-dial { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.rxa-dial input[type=range] { flex: 1; min-width: 0; accent-color: var(--game); height: 36px; }
.rxa-deg { font-family: 'Rehablix Brand', system-ui, sans-serif; font-size: 2.4rem; font-weight: 900; text-align: center; margin-top: 8px; color: var(--game-d); }

/* ---------- Clinical Chess: a solid wooden board with a thick frame ---------- */
/* the board's finish (five skins): light squares, dark squares, the frame and its edge */
.rxa-chess-wrap { --l1: #f6e4c4; --l2: #e6cb9b; --d1: #9c6a40; --d2: #7c4f2c; --grain: rgba(150, 100, 40, 0.07); --f1: #7a4a22; --f2: #5a3416; --f3: #472810; --edge: #4a2a10; --coord: #f1dcb6;
  perspective: 1200px; margin: 10px auto 12px; width: min(calc(100% - 20px), 440px); touch-action: none; }
.rxa-chess-wrap[data-skin="marble"] { --l1: #fbfbfa; --l2: #e7e5e4; --d1: #8b929b; --d2: #5d646e; --grain: rgba(120, 120, 130, 0.12); --f1: #d6d3d1; --f2: #a8a29e; --f3: #78716c; --edge: #57534e; --coord: #44403c; }
.rxa-chess-wrap[data-skin="tournament"] { --l1: #f1f5e8; --l2: #e6ecd6; --d1: #78a35a; --d2: #5f8a44; --grain: rgba(0, 0, 0, 0.02); --f1: #2f3a2b; --f2: #232c20; --f3: #182016; --edge: #10160e; --coord: #e6ecd6; }
.rxa-chess-wrap[data-skin="ocean"] { --l1: #eaf4fb; --l2: #d5e8f6; --d1: #4f86b8; --d2: #346a9b; --grain: rgba(255, 255, 255, 0.05); --f1: #1e3a5f; --f2: #16304f; --f3: #0f223a; --edge: #0b1a2c; --coord: #d5e8f6; }
.rxa-chess-wrap[data-skin="ebony"] { --l1: #f3dfb7; --l2: #e2c38c; --d1: #3b2a20; --d2: #241812; --grain: rgba(255, 255, 255, 0.04); --f1: #2a1d16; --f2: #1c130e; --f3: #120c08; --edge: #0a0604; --coord: #e2c38c; }
.rxa-chess-frame {
  position: relative; padding: 16px; border-radius: 14px; transform: rotateX(20deg); transform-origin: center 70%; transition: transform 0.5s cubic-bezier(.2, .8, .2, 1);
  background: repeating-linear-gradient(88deg, rgba(0, 0, 0, 0.07) 0 3px, transparent 3px 12px), linear-gradient(150deg, var(--f1), var(--f2) 55%, var(--f3));
  box-shadow: 0 2px 0 var(--f2), 0 6px 0 var(--edge), 0 12px 0 var(--f3), 0 16px 0 var(--edge), 0 34px 34px rgba(15, 23, 42, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.22), inset 0 -2px 0 rgba(0, 0, 0, 0.3);
}
.rxa-chess { position: relative; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); aspect-ratio: 1; border-radius: 3px; box-shadow: 0 0 0 2px var(--edge), inset 0 0 0 1px rgba(0, 0, 0, 0.3); }
.rxa-sq { position: relative; min-width: 0; min-height: 0; touch-action: none; }
.rxa-chess-wrap.td .rxa-chess-frame, .rxa-chess-wrap.td .rxa-chess, .rxa-chess-wrap.td .rxa-sq { transform-style: preserve-3d; }
.rxa-sq.l { background: repeating-linear-gradient(95deg, var(--grain) 0 2px, transparent 2px 9px), linear-gradient(135deg, var(--l1), var(--l2)); }
.rxa-sq.d { background: repeating-linear-gradient(95deg, rgba(0, 0, 0, 0.08) 0 2px, transparent 2px 9px), linear-gradient(135deg, var(--d1), var(--d2)); }
.rxa-chess-wrap[data-skin="marble"] .rxa-sq { background-size: auto, auto; }
.rxa-chess-wrap[data-skin="marble"] .rxa-sq.l { background: radial-gradient(120% 60% at 20% 10%, rgba(160, 160, 170, 0.18), transparent 40%), linear-gradient(120deg, transparent 45%, rgba(150, 150, 160, 0.22) 47%, transparent 50%), linear-gradient(135deg, var(--l1), var(--l2)); }
.rxa-chess-wrap[data-skin="marble"] .rxa-sq.d { background: linear-gradient(60deg, transparent 40%, rgba(255, 255, 255, 0.18) 42%, transparent 45%), linear-gradient(135deg, var(--d1), var(--d2)); }
/* 3D: the table tilts and turns (drag it, or a camera button); the pieces stand upright on it */
.rxa-chess-wrap.td { perspective: 900px; padding: 10px 0 24px; }
.rxa-chess-wrap.td .rxa-chess-frame { transform: rotateX(var(--tilt)) rotateZ(var(--spin)); transform-origin: center center; }
.rxa-chess-wrap.td.turning .rxa-chess-frame { transition: none; }
.rxa-chess-wrap.td .rxa-coord { display: none; }
.rxa-chess-wrap.td .rxa-piece { height: 150%; bottom: 40%; transform: rotateZ(calc(var(--spin) * -1)) rotateX(calc(var(--tilt) * -1)); filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.35)); }
.rxa-piece .sh { display: none; }
.rxa-chess-wrap.td .rxa-piece .sh { display: block; position: absolute; left: 12%; right: 12%; bottom: -4%; height: 14%; border-radius: 50%; background: radial-gradient(ellipse, rgba(0, 0, 0, 0.45), transparent 70%); transform: rotateX(var(--tilt)); transform-origin: center bottom; z-index: -1; }
/* real 3D (chess-3d.js): the WebGL table takes the board's place */
.rxa-chess3d { display: none; position: relative; width: 100%; }
.rxa-chess-wrap.gl { padding: 0; perspective: none; }
.rxa-chess-wrap.gl .rxa-chess-frame { display: none; }
.rxa-chess-wrap.gl .rxa-chess3d { display: block; height: min(112vw, 520px); height: min(112vw, 520px, calc(100dvh - 300px)); min-height: 300px; }
.rxa-chess3d-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.rxa-chess3d-canvas:active { cursor: grabbing; }
.rxa-cams { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.rxa-tools { display: flex; justify-content: center; gap: 10px; padding: 4px 0 2px; }
.rxa-tool { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 64px; padding: 8px 0 6px; border-radius: 16px; cursor: pointer; font: 800 0.66rem/1 system-ui, sans-serif; color: var(--ink);
  background: var(--glass); border: 1px solid var(--rim); box-shadow: 0 3px 0 rgba(15, 23, 42, 0.12); transition: transform 0.08s; }
.rxa-tool:active { transform: translateY(2px); box-shadow: none; }
.rxa-tool svg { width: 22px; height: 22px; color: var(--game-d); }
.rxa-clock { font: 900 0.95rem/1 ui-monospace, monospace; padding: 4px 8px; border-radius: 8px; background: var(--glass); border: 1px solid var(--rim); color: var(--ink); }
.rxa-clock:empty { display: none; }
.rxa-clock.run { background: var(--game); color: #fff; border-color: var(--game-d); }
.rxa-clock.low.run { background: #e11d48; }
.rxa-skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.rxa-skin { display: grid; gap: 6px; justify-items: center; padding: 10px; border-radius: 14px; border: 2px solid var(--rim); background: var(--glass); cursor: pointer; font: 800 0.8rem/1.2 system-ui, sans-serif; color: var(--ink); }
.rxa-skin.on { border-color: var(--game); }
.rxa-skin .sw { display: grid; grid-template-columns: 1fr 1fr; width: 56px; height: 56px; border-radius: 6px; overflow: hidden; border: 4px solid var(--f2); }
.rxa-skin .sw i:nth-child(1), .rxa-skin .sw i:nth-child(4) { background: linear-gradient(135deg, var(--l1), var(--l2)); }
.rxa-skin .sw i:nth-child(2), .rxa-skin .sw i:nth-child(3) { background: linear-gradient(135deg, var(--d1), var(--d2)); }
.rxa-skin .sw[data-skin="walnut"] { --l1: #f6e4c4; --l2: #e6cb9b; --d1: #9c6a40; --d2: #7c4f2c; --f2: #5a3416; }
.rxa-skin .sw[data-skin="marble"] { --l1: #fbfbfa; --l2: #e7e5e4; --d1: #8b929b; --d2: #5d646e; --f2: #a8a29e; }
.rxa-skin .sw[data-skin="tournament"] { --l1: #f1f5e8; --l2: #e6ecd6; --d1: #78a35a; --d2: #5f8a44; --f2: #232c20; }
.rxa-skin .sw[data-skin="ocean"] { --l1: #eaf4fb; --l2: #d5e8f6; --d1: #4f86b8; --d2: #346a9b; --f2: #16304f; }
.rxa-skin .sw[data-skin="ebony"] { --l1: #f3dfb7; --l2: #e2c38c; --d1: #3b2a20; --d2: #241812; --f2: #1c130e; }
.rxa-online-btn { width: 100%; margin-top: 12px; text-align: left; border-color: var(--game); }
.rxa-sq.last::after, .rxa-sq.sel::after, .rxa-sq.check::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.rxa-sq.last::after { background: rgba(250, 204, 21, 0.38); }
.rxa-sq.sel::after { background: rgba(56, 189, 248, 0.48); }
.rxa-sq.check::after { box-shadow: inset 0 0 14px 5px #ef4444; }
.rxa-sq.over { box-shadow: inset 0 0 0 3px #38bdf8; }
.rxa-sq .dot { position: absolute; left: 37%; top: 37%; width: 26%; height: 26%; border-radius: 50%; background: rgba(15, 23, 42, 0.32); pointer-events: none; z-index: 3; }
.rxa-sq .ring { position: absolute; inset: 6%; border-radius: 50%; border: 4px solid rgba(15, 23, 42, 0.36); pointer-events: none; z-index: 3; }
.rxa-piece { position: absolute; left: 4%; right: 4%; bottom: 6%; height: 118%; z-index: 2; transform: rotateX(-20deg); transform-origin: bottom center; cursor: grab; pointer-events: none; filter: drop-shadow(0 5px 3px rgba(0, 0, 0, 0.45)); }
.rxa-piece svg { width: 100%; height: 100%; display: block; overflow: visible; }
.rxa-piece.ghost { position: fixed; z-index: 1000; width: 62px; height: 74px; left: auto; right: auto; bottom: auto; transform: scale(1.15); pointer-events: none !important; }
.rxa-piece.used { opacity: 0.25; }
.rxa-coord { position: absolute; font-size: 9px; font-weight: 800; color: var(--coord, #f1dcb6); opacity: 0.85; pointer-events: none; }
.rxa-coord.f { bottom: 2px; } .rxa-coord.r { left: 5px; }
.rxa-tray { display: flex; flex-wrap: wrap; gap: 0; min-height: 28px; align-items: center; }
.rxa-tray svg { width: 20px; height: 26px; }
.rxa-chess-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.9rem; font-weight: 700; margin: 4px 2px; color: var(--ink); }
.rxa-level-list { display: grid; gap: 10px; margin-top: 14px; }

/* ---------- Sort Lab: cardboard cartons of index cards ---------- */
.rxa-boxes { flex: 1; display: flex; flex-wrap: wrap; gap: 18px 14px; justify-content: center; align-content: center; padding: 4px 0 6px; }
.rxa-box { position: relative; width: var(--w); flex: none; cursor: pointer; touch-action: none; transition: transform 0.18s ease; }
.rxa-box::after { /* its shadow on the floor */
  content: ""; position: absolute; left: -6%; right: -6%; bottom: -9px; height: 16px; border-radius: 50%; z-index: 0;
  background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.35), transparent 70%);
}
/* the opening seen from above: dark inside, a cardboard rim */
.bx-inside {
  position: absolute; left: 0; right: 0; top: var(--rim); height: calc(var(--t) + 4px); z-index: 1;
  clip-path: polygon(7% 0, 93% 0, 100% 100%, 0 100%);
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 5px),
    linear-gradient(180deg, #2a180a, #553517 65%, #7a5128);
}
.bx-cards { position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 2; overflow: hidden; }
/* An office file folder (2026-11-11): a coloured pressboard folder, papers peeking out of its top, and a clear plastic tab
   holding a typed paper label with the item's name. The tabs sit left, middle or right as in a real drawer, so the
   label of every folder shows above the one in front of it. */
.bx-card {
  position: absolute; left: 7%; right: 7%; height: var(--card-h); touch-action: none; cursor: grab;
  filter: drop-shadow(0 -2px 3px rgba(40, 25, 10, 0.28));
  transition: transform 0.2s cubic-bezier(.2, 1.3, .4, 1);
}
.bx-card::before { /* the folder itself: pressboard with a fine grain, a scored fold line and a darker lower edge */
  content: ""; position: absolute; left: 0; right: 0; top: calc(var(--s) - 7px); bottom: 0; border-radius: 3px 3px 2px 2px; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0, rgba(255, 255, 255, 0) 3px, rgba(0, 0, 0, 0.12) 6px, rgba(255, 255, 255, 0.16) 7px, rgba(255, 255, 255, 0) 10px),
    repeating-linear-gradient(97deg, rgba(255, 255, 255, 0.05) 0 1px, rgba(0, 0, 0, 0.035) 1px 3px),
    linear-gradient(180deg, var(--c-l) 0, var(--c) 30%, var(--c-d) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 1px 0 0 rgba(255, 255, 255, 0.18), inset -1px 0 0 rgba(0, 0, 0, 0.15);
}
.bx-papers { /* sheets of paper inside the folder, their top edges showing */
  position: absolute; z-index: 0; top: calc(var(--s) - 12px); height: 9px; left: 52%; right: 6%; pointer-events: none; border-radius: 1px;
  background: linear-gradient(180deg, #ffffff, #eef0f2); transform: rotate(-1.2deg);
  box-shadow: -5px 2px 0 -1px #f7f5ef, -9px 3px 0 -2px #e9e6dd, 0 -1px 0 rgba(0, 0, 0, 0.06);
}
.bx-card.tab1 .bx-papers { left: 6%; right: 52%; transform: rotate(1.4deg); }
.bx-card.tab2 .bx-papers { left: 30%; right: 30%; }
.bx-card b { /* the plastic tab with its typed label */
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; text-align: center;
  width: 86%; height: calc(var(--s) - 3px); margin-left: 0; padding: 0 4px; box-sizing: border-box;
  border-radius: 6px 6px 1px 1px; border: 2px solid var(--c-d); border-bottom: none;
  background: linear-gradient(180deg, #ffffff 0%, #f6f4ee 70%, #ebe7dc 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9), inset 0 4px 4px -3px rgba(255, 255, 255, 1), 0 1px 0 var(--c-d);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: var(--fs); font-weight: 800; line-height: 1.04; letter-spacing: -0.2px;
  color: #1f2430; overflow: hidden; overflow-wrap: normal; word-break: normal; hyphens: none;
}
.bx-card b::after { /* the clear plastic's shine */
  content: ""; position: absolute; left: 3px; right: 3px; top: 1px; height: 38%; border-radius: 4px 4px 8px 8px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0));
}
.bx-card.tab1 b { margin-left: 14%; }
.bx-card.tab2 b { margin-left: 7%; }
.bx-card.used { visibility: hidden; }
.rxa-box.sel .bx-card.top { transform: translateY(-22px) rotate(-2deg); filter: drop-shadow(0 0 2px var(--gold)) drop-shadow(0 0 1px var(--gold)) drop-shadow(0 10px 8px rgba(15, 23, 42, 0.35)); }
.bx-card.ghost, .bx-card.flying { position: fixed; z-index: 1000; pointer-events: none !important; transform: rotate(-5deg) scale(1.04); filter: drop-shadow(0 16px 14px rgba(15, 23, 42, 0.4)); }
.bx-card.flying { transform: none; }
/* the front of the carton: kraft corrugated cardboard, with the flutes showing along its cut top edge, a hand-hole,
   darker sides turning away, a fibre grain and printed handling marks */
.bx-front {
  position: absolute; left: 0; right: 0; top: calc(var(--rim) + var(--t)); height: var(--f); z-index: 3; border-radius: 1px 1px 5px 5px;
  background:
    radial-gradient(ellipse 17% 12% at 50% 30%, #2e1c0c 0 55%, #5a3818 70%, rgba(90, 56, 24, 0) 78%),
    linear-gradient(90deg, rgba(60, 35, 10, 0.24), rgba(60, 35, 10, 0) 7%, rgba(60, 35, 10, 0) 93%, rgba(60, 35, 10, 0.3)),
    repeating-linear-gradient(90deg, rgba(120, 72, 28, 0.07) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(12deg, rgba(255, 255, 255, 0.035) 0 2px, rgba(0, 0, 0, 0.03) 2px 4px),
    linear-gradient(180deg, #ddae72 0%, #cc9757 50%, #b07a3d 100%);
  box-shadow: inset 0 -3px 6px rgba(90, 50, 15, 0.3), 0 7px 14px rgba(15, 23, 42, 0.25);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; box-sizing: border-box;
}
.bx-front::after { /* the cut top edge: the wavy flutes inside the corrugated board */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; border-radius: 1px;
  background: radial-gradient(circle at 50% 120%, #8e5d2c 0 2.2px, #f1cf9c 2.6px) 0 0 / 5px 5px repeat-x;
  box-shadow: 0 1px 0 rgba(90, 50, 15, 0.35);
}
.bx-front::before { /* printed marks: recyclable and "this way up" */
  content: "\267B  \2191\2191"; position: absolute; right: 6px; bottom: 3px; font-size: 9px; font-weight: 900; letter-spacing: -0.5px; color: rgba(70, 40, 12, 0.4);
}
.rxa-box.over .bx-front { box-shadow: 0 0 0 3px #38bdf8, inset 0 2px 0 rgba(255, 236, 200, 0.75); }
.rxa-box.sel .bx-front { box-shadow: 0 0 0 3px var(--gold), inset 0 2px 0 rgba(255, 236, 200, 0.75); }
/* the two flaps: open, they stand out from the rim like wings; closed, they lie across the opening */
.bx-flap {
  position: absolute; top: var(--rim); width: 50%; height: calc(var(--t) + 2px); z-index: 4;
  background:
    repeating-linear-gradient(90deg, rgba(120, 72, 28, 0.08) 0 1px, transparent 1px 5px),
    linear-gradient(180deg, #ecc185, #d29d5c);
  box-shadow: inset 0 -2px 0 rgba(120, 72, 28, 0.3), inset 0 2px 0 rgba(255, 240, 210, 0.5);
}
.bx-flap.l { left: 0; transform-origin: 0 50%; transform: rotate(-112deg); clip-path: polygon(7% 0, 100% 0, 100% 100%, 0 100%); }
.bx-flap.r { right: 0; transform-origin: 100% 50%; transform: rotate(112deg); clip-path: polygon(0 0, 93% 0, 100% 100%, 0 100%); }
.rxa-box.done .bx-flap { transform: none; background: linear-gradient(180deg, #e9bd80, #cf9752); }
.rxa-box.done .bx-flap.l { box-shadow: inset -1px 0 0 rgba(120, 72, 28, 0.35); }
.rxa-box.done .bx-card { transform: translateY(var(--sink)); }
.bx-tape { position: absolute; left: calc(50% - 7px); width: 14px; top: calc(var(--rim) - 1px); height: calc(var(--t) + 16px); z-index: 5; border-radius: 1px;
  background: linear-gradient(90deg, rgba(255, 248, 225, 0.75), rgba(255, 240, 200, 0.92) 40%, rgba(255, 248, 225, 0.7)); box-shadow: 0 1px 2px rgba(90, 50, 15, 0.25); transform-origin: top center; }
.bx-label {
  position: relative; max-width: 88%; padding: 3px 6px 3px 5px; border-radius: 5px; transform: rotate(-3deg);
  display: flex; align-items: center; gap: 4px; font-size: calc(var(--fs) * 0.92); font-weight: 900; line-height: 1.05; color: #fff; text-align: left;
  background: linear-gradient(180deg, var(--c-l), var(--c)); box-shadow: 0 2px 5px rgba(15, 23, 42, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  overflow-wrap: anywhere;
}
.bx-label i { font-style: normal; flex: none; width: 14px; height: 14px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; background: #fff; color: var(--c-d); }
/* a carton that has just been completed: the cards sink in, the flaps fold, the tape and label go on, a little bounce */
.rxa-box.just .bx-card { animation: bx-sink 0.42s cubic-bezier(.5, 0, .7, .4) both; }
.rxa-box.just .bx-flap.l { animation: bx-close-l 0.3s cubic-bezier(.3, 0, .2, 1) 0.42s both; }
.rxa-box.just .bx-flap.r { animation: bx-close-r 0.3s cubic-bezier(.3, 0, .2, 1) 0.6s both; }
.rxa-box.just .bx-tape { animation: bx-tape 0.3s ease-out 0.86s both; }
.rxa-box.just .bx-label { animation: bx-label 0.45s cubic-bezier(.2, 1.6, .4, 1) 1s both; }
.rxa-box.just { animation: bx-bounce 0.5s ease 0.95s; }
@keyframes bx-sink { from { transform: translateY(0); } to { transform: translateY(var(--sink)); } }
@keyframes bx-close-l { from { transform: rotate(-112deg); } to { transform: none; } }
@keyframes bx-close-r { from { transform: rotate(112deg); } to { transform: none; } }
@keyframes bx-tape { from { transform: scaleY(0); opacity: 0.4; } to { transform: scaleY(1); opacity: 1; } }
@keyframes bx-label { from { transform: scale(0.2) rotate(-25deg); opacity: 0; } to { transform: rotate(-3deg); opacity: 1; } }
@keyframes bx-bounce { 30% { transform: translateY(4px) scaleY(0.96); } 60% { transform: translateY(-6px); } }
.rxa-legend { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 2px 0 6px; }
.rxa-legend span { font-size: 0.72rem; font-weight: 700; padding: 4px 9px; border-radius: 999px; color: #fff; background: var(--c); }

/* ---------- online play (arcade-net.js): the lobby and the waiting room ---------- */
.rxa-online { padding: 16px; border-radius: 20px; text-align: center; }
.rxa-online .rxa-level-list { text-align: left; }
.rxa-room-code { font-family: 'Rehablix Brand', system-ui, sans-serif; font-weight: 900; font-size: 2.4rem; letter-spacing: 6px; color: var(--game-d); margin: 2px 0; user-select: all; }
.rxa-code { display: block; width: 100%; box-sizing: border-box; margin-top: 12px; padding: 12px; text-align: center; font: 900 1.6rem/1 system-ui, sans-serif; letter-spacing: 6px; text-transform: uppercase;
  border-radius: 14px; border: 2px solid var(--rim); background: var(--solid); color: var(--ink); }
.rxa-invite { display: flex; gap: 6px; }
.rxa-invite input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--rim); background: var(--solid); color: var(--ink); font: inherit; font-size: 0.9rem; }
.rxa-players { display: grid; gap: 6px; margin-top: 10px; text-align: left; }
.rxa-player { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--glass); border: 1px solid var(--rim); }
.rxa-player .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #fff; background: var(--game); flex: none; }
.rxa-player.empty .av { background: var(--rim); color: var(--ink-2); }
.rxa-player b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rxa-player .tag { font-size: 0.66rem; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: var(--game); color: #fff; }
.rxa-player .tag.you { background: var(--ink-2); }
.rxa-spin { width: 38px; height: 38px; margin: 4px auto 10px; border-radius: 50%; border: 4px solid var(--rim); border-top-color: var(--game); animation: rxa-spin 0.9s linear infinite; }
@keyframes rxa-spin { to { transform: rotate(360deg); } }
.rxa-settings { text-align: left; display: grid; gap: 12px; margin-top: 10px; }
.rxa-settings label { display: grid; gap: 6px; font-weight: 700; font-size: 0.88rem; color: var(--ink); }
.rxa-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.rxa-race { display: grid; gap: 4px; }
.rxa-race div { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.rxa-race i { flex: 1; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.35); overflow: hidden; }
.rxa-race i b { display: block; height: 100%; background: linear-gradient(90deg, #fde047, #f97316); border-radius: 4px; transition: width 0.4s; }

/* ---------- Muscle Match: a steel specimen tray, and open cardboard cartons with a shipping label ---------- */
.mm-tray { position: relative; height: 150px; margin: 6px auto 2px; width: min(300px, 92%); display: grid; place-items: center; }
.mm-tray-dish { position: absolute; left: 0; right: 0; bottom: 6px; height: 64px; border-radius: 50% / 46%;
  background: radial-gradient(ellipse at 50% 38%, #f8fafc 0, #cbd5e1 45%, #94a3b8 70%, #64748b 100%);
  box-shadow: inset 0 6px 14px rgba(15, 23, 42, 0.35), inset 0 -2px 0 rgba(255, 255, 255, 0.7), 0 10px 18px rgba(15, 23, 42, 0.25); }
.mm-tray-dish::after { content: ""; position: absolute; left: 14%; right: 40%; top: 18%; height: 18%; border-radius: 50%; background: rgba(255, 255, 255, 0.55); filter: blur(2px); }
.mm-slot { position: relative; z-index: 1; display: grid; place-items: center; }
.mm-specimen { width: 190px; text-align: center; cursor: grab; touch-action: none; animation: mm-in 0.42s cubic-bezier(.2, 1.3, .4, 1) both; }
.mm-specimen.sel { filter: drop-shadow(0 0 3px var(--gold)) drop-shadow(0 0 2px var(--gold)); transform: translateY(-6px); }
.mm-specimen.ghost { position: fixed; z-index: 1000; pointer-events: none !important; transform: rotate(-4deg) scale(1.05); filter: drop-shadow(0 16px 14px rgba(15, 23, 42, 0.4)); }
.mm-svg { width: 100%; height: auto; display: block; overflow: visible; filter: drop-shadow(0 4px 3px rgba(60, 10, 10, 0.3)); }
.mm-name { display: inline-block; margin-top: -2px; padding: 3px 10px; border-radius: 6px; font-weight: 800; font-size: 0.86rem; color: #1f2430;
  background: linear-gradient(180deg, #ffffff, #f1efe8); box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2), inset 0 0 0 1px rgba(0, 0, 0, 0.06); }
@keyframes mm-in { from { transform: translateX(120%) rotate(8deg); opacity: 0; } to { transform: none; opacity: 1; } }
.mm-after { min-height: 8px; }
.mm-cartons { flex: 1; display: flex; flex-wrap: wrap; gap: 16px 12px; justify-content: center; align-content: flex-start; padding: 8px 0 12px; }
.mm-carton { position: relative; flex: none; height: 132px; cursor: pointer; touch-action: none; }
.mm-carton::after { content: ""; position: absolute; left: -5%; right: -5%; bottom: -8px; height: 14px; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.32), transparent 70%); }
.mm-in { /* the open top, seen from just above: dark cardboard inside */
  position: absolute; left: 0; right: 0; top: 0; height: 34px; clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%);
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 5px), linear-gradient(180deg, #2a180a, #553517 70%, #7a5128); overflow: hidden; }
.mm-filed { position: absolute; left: 6%; right: 6%; bottom: -16px; display: flex; flex-wrap: wrap-reverse; justify-content: center; gap: 0 2px; }
.mm-mini { width: 46px; margin: 0 -6px -4px; animation: mm-drop 0.35s cubic-bezier(.5, 0, .7, .4) both; }
.mm-mini.late { opacity: 0.7; }
@keyframes mm-drop { from { transform: translateY(-50px) scale(1.3); opacity: 0; } to { transform: none; opacity: 1; } }
.mm-front { position: absolute; left: 0; right: 0; top: 34px; bottom: 0; border-radius: 1px 1px 5px 5px; display: flex; align-items: center; justify-content: center; padding: 6px 6px 8px; box-sizing: border-box;
  background:
    linear-gradient(90deg, rgba(60, 35, 10, 0.24), rgba(60, 35, 10, 0) 7%, rgba(60, 35, 10, 0) 93%, rgba(60, 35, 10, 0.3)),
    repeating-linear-gradient(90deg, rgba(120, 72, 28, 0.07) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(12deg, rgba(255, 255, 255, 0.035) 0 2px, rgba(0, 0, 0, 0.03) 2px 4px),
    linear-gradient(180deg, #ddae72 0%, #cc9757 50%, #b07a3d 100%);
  box-shadow: inset 0 -3px 6px rgba(90, 50, 15, 0.3), 0 7px 14px rgba(15, 23, 42, 0.25); }
.mm-front::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: radial-gradient(circle at 50% 120%, #8e5d2c 0 2.2px, #f1cf9c 2.6px) 0 0 / 5px 5px repeat-x; box-shadow: 0 1px 0 rgba(90, 50, 15, 0.35); }
.mm-label { position: relative; width: 100%; padding: 5px 5px 6px; border-radius: 3px; text-align: center; transform: rotate(-1.5deg);
  background: linear-gradient(180deg, #ffffff, #f4f1e8); box-shadow: 0 2px 4px rgba(60, 35, 10, 0.3), inset 0 0 0 1px rgba(0, 0, 0, 0.05); }
.mm-label::before { content: ""; position: absolute; left: 6px; right: 6px; top: 3px; border-top: 2px dashed rgba(124, 58, 237, 0.35); }
.mm-neuron { width: 46px; height: 19px; display: block; margin: 3px auto 1px; }
.mm-label b { display: block; font-size: 0.74rem; font-weight: 900; line-height: 1.12; color: #1f2430; }
.mm-label span { display: block; margin-top: 2px; font-size: 0.62rem; font-weight: 800; color: #7c3aed; text-transform: uppercase; letter-spacing: 0.4px; }
.mm-n { position: absolute; right: -6px; top: -8px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; box-sizing: border-box; font-style: normal; font-weight: 900; font-size: 0.75rem; line-height: 22px; text-align: center; color: #fff; background: var(--game); box-shadow: 0 2px 0 var(--game-d); }
.mm-carton.over .mm-front { box-shadow: 0 0 0 3px #38bdf8, inset 0 -3px 6px rgba(90, 50, 15, 0.3); }
.mm-carton.glow .mm-front { box-shadow: 0 0 0 3px var(--gold), 0 0 18px var(--gold); }
.mm-carton.thunk { animation: bx-bounce 0.45s ease; }

/* ---------- Tower Tumble: a 3D park scene behind the whole game, the slingshot at the bottom middle ---------- */
.rxa-bar { position: relative; z-index: 3; }
.rxa-tower3d { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.rxa-tower3d canvas { position: absolute; left: 0; top: 0; display: block; touch-action: none; }
.rxa-over { position: relative; z-index: 2; }
.rxa-hud { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-weight: 800; }
.rxa-hud .pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 0.88rem; color: #0f172a;
  background: rgba(255, 255, 255, 0.72); border: 1px solid rgba(255, 255, 255, 0.85); box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(10px) saturate(150%); -webkit-backdrop-filter: blur(10px) saturate(150%); }
.rxa-hud .pill i.ball { width: 13px; height: 13px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #7dd3fc 35%, #075985); }
.rxa-hud .pill i.ball.power { background: radial-gradient(circle at 35% 30%, #fffbe6, #fbbf24 35%, #b45309); box-shadow: 0 0 8px #fbbf24; }
.rxa-tower-note { z-index: 2; }
.rxa-tower-note .rxa-explain { background: rgba(255, 255, 255, 0.86); color: #0f172a; border-color: rgba(22, 163, 74, 0.5); box-shadow: 0 10px 26px rgba(15, 23, 42, 0.2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.rxa-power {
  position: absolute; left: 14px; bottom: calc(26px + env(safe-area-inset-bottom)); width: 74px; height: 74px; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font: inherit; color: #fff;
  background: radial-gradient(circle at 35% 28%, #fde68a, #f59e0b 45%, #b45309); box-shadow: 0 6px 0 #92400e, 0 14px 24px rgba(15, 23, 42, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.5);
}
.rxa-power b { font-size: 1.5rem; line-height: 1; }
.rxa-power span { font-size: 0.62rem; font-weight: 800; line-height: 1.1; text-align: center; padding: 0 6px; }
.rxa-power:active { transform: translateY(4px); box-shadow: 0 2px 0 #92400e, 0 6px 12px rgba(15, 23, 42, 0.3); }
.rxa-power.on { animation: rxa-pulse 1.2s ease-in-out infinite; }
.rxa-power[disabled] { opacity: 0.5; pointer-events: none; }
.rxa-sling-hint {
  align-self: center; margin-top: 2px; white-space: nowrap; pointer-events: none;
  padding: 7px 14px; border-radius: 999px; font-size: 0.82rem; font-weight: 800; color: #fff; background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: opacity 0.4s;
}
.rxa-sling-hint.gone { opacity: 0; }

/* ---------- hub cards (used by the web hub) ---------- */
.rxa-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; perspective: 1000px; }
.rxa-hub-card {
  position: relative; min-height: 150px; padding: 14px; border-radius: 22px; cursor: pointer; text-align: left; border: 0; font: inherit; color: #fff; overflow: hidden;
  background: linear-gradient(155deg, var(--c-l) 0%, var(--c) 40%, var(--c-d) 100%);
  box-shadow: 0 8px 0 var(--c-dd), 0 18px 26px rgba(15, 23, 42, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.rxa-hub-card:active { transform: translateY(5px); box-shadow: 0 3px 0 var(--c-dd), 0 8px 14px rgba(15, 23, 42, 0.25); }
.rxa-hub-card .emo { font-size: 2.6rem; line-height: 1; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35)); display: inline-block; }
.rxa-hub-card b { display: block; margin-top: 10px; font-family: 'Rehablix Brand', system-ui, sans-serif; font-size: 1.08rem; font-weight: 800; }
.rxa-hub-card span { display: block; margin-top: 3px; font-size: 0.78rem; opacity: 0.92; line-height: 1.3; }
.rxa-hub-card .new { position: absolute; top: 10px; right: 10px; padding: 2px 8px; border-radius: 999px; font-size: 0.66rem; font-weight: 900; letter-spacing: 0.06em; background: #fff; color: var(--c-d); }
.rxa-hub-card::after { content: ""; position: absolute; width: 140px; height: 140px; right: -40px; bottom: -50px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }

@media (max-width: 380px) { .rxa-level-grid { gap: 6px; } }
/* short screens: a more compact results card */
@media (max-height: 760px) {
  .rxa-trophy { font-size: 2.8rem; }
  .rxa-stars span { font-size: 1.9rem; }
  .rxa-result .big { font-size: 2.4rem; }
  .rxa-result .xp { margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) { .rxa *, .rxa-modal * { animation: none !important; transition: none !important; } }

