/* Worms Ultimate Mayhem (games/worms3d) — our own cartoon UI: chunky rounded panels, bright accents, Lilita One. */
@font-face { font-family: "Lilita One"; src: url(fonts/lilitaone-latin.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Fira Sans Condensed"; font-weight: 500; src: url(fonts/firasanscondensed-500-latin.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Fira Sans Condensed"; font-weight: 700; src: url(fonts/firasanscondensed-700-latin.woff2) format("woff2"); font-display: swap; }

:root { --bg: #1d2b3a; --ink: #2b1a10; --text: #fff; --dim: #cfe0f0; --accent: #ffb13b; --accent2: #ff6f3c; --good: #6fdc5c; --bad: #ff5050;
  --panel: rgba(28, 44, 66, 0.92); --panel2: rgba(16, 26, 40, 0.94); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
  font-family: "Fira Sans Condensed", "Arial Narrow", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
#stage { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; --s: 1; --st: 0px; --sr: 0px; --sb: 0px; --sl: 0px; }
#stage.rotated { width: 100vh; width: 100dvh; height: 100vw; transform-origin: 0 0; transform: translateX(100vw) rotate(90deg); }
#game, #overlay { position: absolute; left: 0; top: 0; display: block; }
#overlay { pointer-events: none; }
#ui { position: absolute; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
.passive, .passive * { pointer-events: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.toon { font-family: "Lilita One", "Arial Black", sans-serif; font-weight: 400; letter-spacing: 0.02em; }
.outline { text-shadow: 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink), 0 5px 0 rgba(0,0,0,0.35); }

/* ---------------------------------------------------------------- boot */
#boot { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; z-index: 100;
  background: radial-gradient(ellipse at 50% 38%, #5fb8ff 0%, #3a7fd0 45%, #1d3a66 100%); }
#boot .bbar { width: 40%; max-width: 420px; height: 16px; padding: 3px; background: #10233c; border: 3px solid var(--ink); border-radius: 12px; }
#boot .bbar i { display: block; height: 100%; width: 10%; border-radius: 8px; background: linear-gradient(180deg, #ffe18a, #ffb13b 55%, #e8701c); transition: width 0.3s; }
#boot .msg { color: #eaf4ff; font-size: 15px; margin: 0; letter-spacing: 0.06em; }
.logo { display: flex; flex-direction: column; align-items: center; line-height: 0.95; transform: rotate(-3deg); }
.logo .l1 { font-family: "Lilita One", sans-serif; font-size: 84px; color: #ffd24a; letter-spacing: 0.04em;
  text-shadow: 0 4px 0 #c2541a, 0 8px 0 var(--ink), 4px 0 0 var(--ink), -4px 0 0 var(--ink), 0 -4px 0 var(--ink), 4px 4px 0 var(--ink), -4px 4px 0 var(--ink), 4px -4px 0 var(--ink), -4px -4px 0 var(--ink), 0 14px 18px rgba(0,0,0,0.35); }
.logo .l2 { font-family: "Lilita One", sans-serif; font-size: 30px; color: #fff; margin-top: 6px;
  text-shadow: 0 3px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink), 3px 3px 0 var(--ink), -3px 3px 0 var(--ink); }

/* ---------------------------------------------------------------- screens */
.screen { position: absolute; inset: 0; display: none; z-index: 20; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(95, 184, 255, 0.55), rgba(20, 40, 70, 0.85)); }
.screen.show { display: flex; }
.screen.clear { background: rgba(10, 20, 35, 0.35); }
.card { background: var(--panel); border: 4px solid var(--ink); border-radius: 22px; box-shadow: 0 8px 0 rgba(0,0,0,0.35), inset 0 2px 0 rgba(255,255,255,0.15);
  padding: calc(16px * var(--s) + 8px) calc(22px * var(--s) + 10px); max-width: min(94%, 980px); max-height: 92%; overflow: auto; }
.card h1, .card h2 { font-family: "Lilita One", sans-serif; font-weight: 400; margin: 0 0 0.4em; color: #ffd24a; letter-spacing: 0.02em;
  text-shadow: 0 3px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink); }
.card h1 { font-size: 2.1em; }
.card h2 { font-size: 1.4em; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4em; min-height: 2.6em; padding: 0.35em 1.1em; border-radius: 16px; border: 3px solid var(--ink);
  background: linear-gradient(180deg, #ffd56a, #ffb13b 55%, #ee8a22); color: var(--ink); font-family: "Lilita One", sans-serif; font-size: 1.15em; letter-spacing: 0.02em;
  box-shadow: 0 5px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,0.5); transition: transform 0.06s; }
.btn:active, .btn.down { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,0.5); }
.btn.blue { background: linear-gradient(180deg, #8fd0ff, #4ea2f0 55%, #2f7bd0); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.35); }
.btn.green { background: linear-gradient(180deg, #a8f08a, #6fdc5c 55%, #3fae3a); }
.btn.small { min-height: 2.1em; font-size: 0.95em; padding: 0.2em 0.8em; border-radius: 12px; }
.btn[disabled] { filter: grayscale(0.8) brightness(0.8); }
.row { display: flex; gap: 0.7em; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 0.6em; }
.menu-title { text-align: center; margin-bottom: 0.4em; }
.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.7em; margin: 0.6em 0 0.9em; }
.team { border-radius: 16px; border: 3px solid var(--ink); padding: 0.55em 0.7em; background: var(--panel2); position: relative; }
.team .swatch { display: inline-block; width: 1.1em; height: 1.1em; border-radius: 50%; border: 2px solid var(--ink); vertical-align: -0.15em; margin-right: 0.35em; }
.team input { width: 100%; font: inherit; font-weight: 700; font-size: 1.05em; padding: 0.25em 0.45em; border-radius: 10px; border: 2px solid var(--ink); background: #fff; color: var(--ink); }
.team .worms { font-size: 0.85em; color: var(--dim); margin-top: 0.3em; }
.team.off { opacity: 0.45; }
.stepper { display: inline-flex; align-items: center; gap: 0.35em; }
.stepper b { min-width: 1.6em; text-align: center; font-family: "Lilita One", sans-serif; font-size: 1.2em; }
.info { color: var(--dim); font-size: 0.9em; }
.build-id { margin: 0.5em 0 0; text-align: center; font-size: 0.7em; color: var(--dim); opacity: 0.75; letter-spacing: 0.02em; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.25em 0.9em; font-size: 0.92em; color: var(--dim); }
.kv b { color: #fff; }

/* ---------------------------------------------------------------- HUD */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 5; font-family: "Lilita One", sans-serif; }
#hud > * { position: absolute; }
.hud-clock { right: calc(14px * var(--s) + var(--sr)); top: calc(56px * var(--s) + var(--st)); width: calc(84px * var(--s)); height: calc(84px * var(--s));
  border-radius: 50%; border: 4px solid var(--ink); background: radial-gradient(circle at 40% 35%, #fff6d0, #ffcf5a 60%, #e89a28); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 5px 0 rgba(0,0,0,0.35); }
.hud-clock .sec { font-size: calc(40px * var(--s)); line-height: 1; }
.hud-clock .rt { font-size: calc(13px * var(--s)); line-height: 1; margin-top: 2px; font-family: "Fira Sans Condensed", sans-serif; font-weight: 700; }
.hud-clock.retreat { background: radial-gradient(circle at 40% 35%, #ffe4e4, #ff8a7a 60%, #e04848); }
.hud-clock.hot { background: radial-gradient(circle at 40% 35%, #e8f6ff, #8fd0ff 60%, #3a8ce0); }
.hud-clock.warn .sec { animation: pulse 0.5s infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.18); } }
.hud-wind { right: calc(14px * var(--s) + var(--sr)); top: calc(12px * var(--s) + var(--st)); width: calc(150px * var(--s)); height: calc(34px * var(--s));
  border-radius: 14px; border: 3px solid var(--ink); background: var(--panel); overflow: hidden; }
.hud-wind .half { position: absolute; top: 4px; bottom: 4px; width: 0; }
.hud-wind .half.r { left: 50%; background: linear-gradient(90deg, #ffe08a, #ff8a3c); border-radius: 0 8px 8px 0; }
.hud-wind .half.l { right: 50%; background: linear-gradient(270deg, #ffe08a, #ff8a3c); border-radius: 8px 0 0 8px; }
.hud-wind .mid { position: absolute; left: 50%; top: 2px; bottom: 2px; width: 2px; margin-left: -1px; background: rgba(255,255,255,0.6); }
.hud-wind .lab { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: calc(13px * var(--s)); color: #fff; letter-spacing: 0.05em; text-shadow: 0 2px 0 var(--ink); }
.hud-bars { left: calc(12px * var(--s) + var(--sl)); top: calc(10px * var(--s) + var(--st)); display: flex; flex-direction: column; gap: calc(5px * var(--s)); }
.hud-bar { display: flex; align-items: center; gap: 6px; font-size: calc(13px * var(--s)); color: #fff; text-shadow: 0 2px 0 var(--ink); }
.hud-bar .track { width: calc(130px * var(--s)); height: calc(16px * var(--s)); border-radius: 9px; border: 2.5px solid var(--ink); background: rgba(0,0,0,0.35); overflow: hidden; }
.hud-bar .fill { height: 100%; width: 100%; transition: width 0.6s; border-radius: 6px; }
.hud-bar.on .track { box-shadow: 0 0 0 2px #fff; }
.hud-bar .n { min-width: 2.4em; text-align: right; }
.hud-banner { left: 50%; top: 22%; transform: translate(-50%, -50%); text-align: center; font-size: calc(40px * var(--s)); color: #ffd24a; white-space: nowrap;
  text-shadow: 0 3px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink), 3px 3px 0 var(--ink), -3px 3px 0 var(--ink), 0 8px 10px rgba(0,0,0,0.3);
  opacity: 0; transition: opacity 0.25s, transform 0.25s; }
.hud-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
.hud-banner small { display: block; font-size: 0.5em; color: #fff; }
.hud-hot { left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.hud-hot .t { font-size: calc(22px * var(--s)); color: #fff; text-shadow: 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink); }
.hud-hot .w { font-size: calc(44px * var(--s)); text-shadow: 0 3px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink), 0 8px 10px rgba(0,0,0,0.3); }
.hud-hot .r { font-size: calc(18px * var(--s)); color: #eaf4ff; margin-top: 0.3em; text-shadow: 0 2px 0 var(--ink); font-family: "Fira Sans Condensed", sans-serif; font-weight: 700; }
.hud-power { left: 50%; bottom: calc(26px * var(--s) + var(--sb)); transform: translateX(-50%); width: calc(260px * var(--s)); height: calc(22px * var(--s));
  border-radius: 12px; border: 3px solid var(--ink); background: rgba(0,0,0,0.45); overflow: hidden; opacity: 0; transition: opacity 0.2s; }
.hud-power.show { opacity: 1; }
.hud-power i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6fdc5c, #ffe14a 55%, #ff5a3c); }
.hud-weapon { right: calc(14px * var(--s) + var(--sr)); top: calc(148px * var(--s) + var(--st)); color: #fff; font-size: calc(15px * var(--s)); text-shadow: 0 2px 0 var(--ink); text-align: right; }
.hud-weapon .fz { color: #ffd24a; }
.hud-msg { left: 50%; bottom: 30%; transform: translateX(-50%); color: #fff; font-size: calc(18px * var(--s)); text-shadow: 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink); white-space: nowrap; opacity: 0; transition: opacity 0.3s; }
.hud-msg.show { opacity: 1; }
.hud-fps { left: calc(12px * var(--s) + var(--sl)); bottom: 4px; font: 11px monospace; color: #fff; opacity: 0.7; }

/* ---------------------------------------------------------------- touch controls */
#controls { position: absolute; inset: 0; z-index: 6; pointer-events: none; font-family: "Lilita One", sans-serif; }
#controls > * { position: absolute; pointer-events: auto; touch-action: none; }
#controls.hidden > * { display: none; }
.ctl-aimzone { right: 0; top: 0; bottom: 0; left: 40%; }
.ctl-camzone { left: 0; top: 0; bottom: 0; width: 40%; }
.ctl-pad { border-radius: 50%; border: 4px solid rgba(43, 26, 16, 0.85); background: radial-gradient(circle, rgba(255,255,255,0.18), rgba(255,255,255,0.08) 65%, rgba(0,0,0,0.12)); }
.ctl-pad .knob { position: absolute; left: 50%; top: 50%; width: 42%; height: 42%; margin: -21% 0 0 -21%; border-radius: 50%; border: 4px solid var(--ink);
  background: radial-gradient(circle at 40% 35%, #fff, #ffcf5a 65%, #e89a28); box-shadow: 0 4px 0 rgba(0,0,0,0.3); }
.ctl-btn { border-radius: 50%; border: 4px solid var(--ink); display: flex; align-items: center; justify-content: center; color: var(--ink); font-size: calc(17px * var(--s));
  background: radial-gradient(circle at 40% 30%, #fff, #8fd0ff 60%, #3a8ce0); box-shadow: 0 5px 0 rgba(0,0,0,0.35); line-height: 1; text-align: center; }
.ctl-btn.down { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,0.35); }
.ctl-btn.fire { background: radial-gradient(circle at 40% 30%, #fff1d0, #ff9a4a 55%, #e04a2a); font-size: calc(22px * var(--s)); }
.ctl-btn.jump { background: radial-gradient(circle at 40% 30%, #f4ffe8, #a8f08a 55%, #45b23a); }
.ctl-btn.weap { border-radius: 18px; background: radial-gradient(circle at 40% 30%, #fff, #ffd56a 60%, #ee8a22); }
.ctl-btn.small { font-size: calc(13px * var(--s)); }
.ctl-btn canvas { width: 80%; height: 80%; pointer-events: none; }
.ctl-fuse { display: flex; gap: 4px; }
.ctl-fuse .ctl-btn { position: relative; }
#controls .off { opacity: 0.35; }

/* weapon panel */
.wpanel { position: absolute; z-index: 30; right: calc(18px * var(--s) + var(--sr)); bottom: calc(120px * var(--s) + var(--sb)); display: none; }
.wpanel.show { display: block; }
.wpanel .grid { display: grid; grid-template-columns: repeat(3, calc(76px * var(--s))); gap: calc(8px * var(--s)); }
.wpanel .cell { height: calc(76px * var(--s)); border-radius: 16px; border: 3px solid var(--ink); background: var(--panel2); display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; font-size: calc(11px * var(--s)); gap: 2px; box-shadow: 0 4px 0 rgba(0,0,0,0.35); }
.wpanel .cell canvas { width: 62%; height: 62%; }
.wpanel .cell.sel { background: linear-gradient(180deg, #ffd56a, #ee8a22); color: var(--ink); }
.wpanel .cell .ammo { font-family: "Fira Sans Condensed", sans-serif; font-weight: 700; color: #ffd24a; }

.keys-help { position: absolute; left: calc(12px * var(--s) + var(--sl)); bottom: calc(12px * var(--s) + var(--sb)); z-index: 6; font-size: 12px; color: #eaf4ff;
  background: rgba(10, 20, 35, 0.55); padding: 6px 10px; border-radius: 10px; line-height: 1.45; pointer-events: none; }
.pause-btn { position: absolute; z-index: 7; left: 50%; top: calc(8px * var(--s) + var(--st)); transform: translateX(-50%); }

/* compact menus on short stages (phones in landscape or a rotated portrait phone) */
#stage.short .card { padding: 10px 16px; }
#stage.short .menu-title .logo { transform: rotate(-2deg) scale(0.42) !important; margin: -30px 0 -26px !important; }
#stage.short .teams { grid-template-columns: repeat(4, 1fr); gap: 0.45em; margin: 0.3em 0 0.5em; }
#stage.short .team { padding: 0.35em 0.5em; }
#stage.short .team .worms { display: none; }
#stage.short .card h2 { font-size: 1.1em; margin-bottom: 0.2em; }
#stage.short .kv { margin: 0.4em 0 !important; }
#stage.short .info { display: none; }
#stage.short .btn.big { font-size: 1.25em !important; }
#hud.off { display: none; }

/* ---------------------------------------------------------------- online (ui/online.js) */
.online input { font: inherit; font-weight: 700; font-size: 1.05em; padding: 0.3em 0.5em; border-radius: 10px; border: 2px solid var(--ink); background: #fff; color: var(--ink);
  user-select: text; -webkit-user-select: text; touch-action: manipulation; min-width: 0; }
.online label.row input { flex: 1; }
.online .note { margin: 0; color: #ffd24a; }
.online .sub { color: var(--dim); font-size: 0.92em; }
.online .invite-code, .online .room-code { color: #fff; letter-spacing: 0.12em; }
.online-lobby .lb-members { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0.6em; }
.online-lobby .member { border-radius: 14px; border: 3px solid var(--ink); padding: 0.45em 0.65em; background: var(--panel2); }
.online-lobby .member.away { opacity: 0.6; }
.online .tag { display: inline-block; font-size: 0.78em; padding: 0 0.45em; border-radius: 8px; background: #44566e; color: #fff; vertical-align: 0.1em; }
.online .tag.ok { background: #3fae3a; } .online .tag.you { background: #2f7bd0; }
.online .lteam { display: inline-flex; align-items: center; gap: 0.3em; margin-top: 0.3em; font-weight: 700; }
.online .lteam .swatch { display: inline-block; width: 0.95em; height: 0.95em; border-radius: 50%; border: 2px solid var(--ink); }
.online .lteam .x { border: 0; background: none; color: var(--bad); font-size: 1.2em; padding: 0 0.2em; line-height: 1; }
.online .lb-myteam input { width: 12em; }
.online .lb-chat { border-top: 2px solid rgba(255,255,255,0.12); padding-top: 0.5em; }
.online .chat-log { max-height: 6.5em; overflow-y: auto; font-size: 0.9em; color: var(--dim); margin-bottom: 0.35em; user-select: text; }
.online .chat-log b { color: #fff; }
.online .chat-in { flex: 1; }
.online .spinner { width: 34px; height: 34px; border-radius: 50%; border: 5px solid rgba(255,255,255,0.25); border-top-color: #ffd24a; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.net-banner { position: absolute; left: 50%; top: calc(64px * var(--s) + var(--st)); transform: translateX(-50%); z-index: 15; padding: 0.25em 0.9em; border-radius: 14px;
  background: rgba(16, 26, 40, 0.85); border: 3px solid var(--ink); color: #ffd24a; font-size: calc(18px * var(--s) + 6px); white-space: nowrap; pointer-events: none !important; }
.net-toast { position: absolute; left: 50%; bottom: calc(150px * var(--s) + var(--sb)); transform: translateX(-50%); z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none !important; }
.net-toast div { background: rgba(16, 26, 40, 0.9); border: 2px solid var(--ink); border-radius: 12px; padding: 0.3em 0.8em; font-size: calc(13px * var(--s) + 5px); max-width: 80vw; text-align: center; }
#controls.watching .ctl-btn.fire, #controls.watching .ctl-btn.jump, #controls.watching .ctl-pad { opacity: 0.35; }
/* M3: 7 x 6 weapon panel, targeting and drop buttons */
.wpanel { right: auto; left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); background: rgba(43,26,16,0.82); border: 3px solid var(--ink); border-radius: 18px; padding: calc(8px * var(--s)); }
.wpanel .grid { grid-template-columns: repeat(6, calc(46px * var(--s))); gap: calc(4px * var(--s)); }
.wpanel .cell { height: calc(46px * var(--s)); border-radius: 12px; position: relative; padding: 0; box-shadow: 0 2px 0 rgba(0,0,0,0.35); }
.wpanel .cell.empty { visibility: hidden; }
.wpanel .cell img, .wpanel .cell canvas { width: 94%; height: 94%; object-fit: contain; pointer-events: none; }
.wpanel .cell.off { opacity: 0.32; filter: grayscale(0.8); }
.wpanel .cell .ammo { position: absolute; right: 4px; bottom: 1px; font-size: calc(13px * var(--s)); text-shadow: 0 1px 0 #000, 0 0 3px #000; }
.wpanel .wname { text-align: center; color: #fff4d6; font-family: "Lilita One", sans-serif; font-size: calc(16px * var(--s)); margin-top: calc(6px * var(--s)); min-height: 1.2em; }
.ctl-btn.tgt { background: radial-gradient(circle at 40% 30%, #fff, #ff9b9b 60%, #d23a3a); font-size: calc(26px * var(--s)); }
.ctl-btn.tgt.on { box-shadow: 0 0 0 4px #fff3, 0 0 18px #ff4a4a; }
.ctl-btn.drop { background: radial-gradient(circle at 40% 30%, #fff, #c9b2ff 60%, #7a52d6); }
/* M4: scheme editor, handicap, map / scheme selects */
.btn.tiny { min-height: 1.7em; font-size: 0.8em; padding: 0.1em 0.55em; border-radius: 10px; }
.hcap { gap: 4px; margin-top: 4px; }
.hcap .info { margin-right: 2px; }
select#mapsel, select#schsel { font: inherit; font-size: 0.95em; padding: 0.15em 0.3em; border-radius: 8px; border: 2px solid #2b1a10; background: #fff8e8; max-width: 13em; }
#scr-schemeedit { z-index: 30; }
.scheme-editor { min-width: min(560px, 94vw); max-height: 92vh; display: flex; flex-direction: column; }
.scheme-editor input { font: inherit; padding: 0.2em 0.5em; border-radius: 8px; border: 2px solid #2b1a10; max-width: 12em; }
.scheme-editor .srows { overflow-y: auto; margin: 0.5em 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
.scheme-editor .srow { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 2px 4px; border-bottom: 1px solid rgba(43, 26, 16, 0.12); }
.scheme-editor .srow.off { opacity: 0.45; }
.scheme-editor .srow .row { grid-column: 1 / -1; }
.scheme-editor .sval { display: flex; align-items: center; gap: 4px; }
.scheme-editor .sval b { min-width: 6.5em; text-align: center; }
@media (max-width: 700px) { .scheme-editor .srows { grid-template-columns: 1fr; } }
/* M7: game modes, Wormpot reels, Weapon Factory */
.modes { display: flex; gap: 0.45em; flex-wrap: wrap; justify-content: center; margin: 0.1em 0 0.3em; }
.mode-chip { border: 3px solid var(--ink); border-radius: 14px; padding: 0.25em 0.8em; font-family: "Lilita One", sans-serif; font-size: 1.02em;
  background: var(--panel2); color: #eaf4ff; box-shadow: 0 3px 0 rgba(0,0,0,0.35); }
.mode-chip.sel { background: linear-gradient(180deg, #ffd56a, #ee8a22); color: var(--ink); }
.mode-desc { text-align: center; color: var(--dim); font-size: 0.9em; margin: 0 0 0.4em; min-height: 1.2em; }
.wormpot { display: flex; align-items: center; gap: 0.5em; flex-wrap: wrap; }
.wormpot .reels { display: flex; gap: 0.35em; padding: 0.3em; border-radius: 14px; border: 3px solid var(--ink);
  background: linear-gradient(180deg, #7a3d12, #c46a1e 50%, #7a3d12); box-shadow: inset 0 3px 0 rgba(255,255,255,0.25), 0 4px 0 rgba(0,0,0,0.35); }
.reel { width: 7.2em; height: 3.1em; border-radius: 10px; border: 2px solid var(--ink); background: linear-gradient(180deg, #d8d0bf, #fffaf0 30%, #fffaf0 70%, #d8d0bf);
  color: #7d6a55; display: flex; align-items: center; justify-content: center; padding: 0 0.25em; font-family: "Lilita One", sans-serif; font-size: 0.86em;
  line-height: 1.05; text-align: center; overflow: hidden; }
.reel.on { color: var(--ink); }
.reel.on.cat-weapons { box-shadow: inset 0 -5px 0 #ff6f3c; } .reel.on.cat-worms { box-shadow: inset 0 -5px 0 #3a7be8; }
.reel.on.cat-world { box-shadow: inset 0 -5px 0 #3ab85a; } .reel.on.cat-crates { box-shadow: inset 0 -5px 0 #b05ad8; }
.wormpot.spinning .reel:not(.stop) .rv { filter: blur(0.6px); opacity: 0.8; }
.reel.stop { animation: reelstop 0.25s ease-out; }
@keyframes reelstop { 0% { transform: translateY(-6px); } 60% { transform: translateY(3px); } 100% { transform: none; } }
.wormpot.ro .reel { cursor: default; }
.wp-help { font-size: 0.82em; color: var(--dim); margin-top: 0.25em; max-width: 46em; }
.wp-help b { color: #ffd24a; }
.wp-picker { width: min(760px, 96%); display: flex; flex-direction: column; max-height: 92%; }
.wp-list { overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.4em; margin: 0.4em 0 0.7em; }
.wp-item { text-align: left; border: 2px solid var(--ink); border-radius: 12px; padding: 0.35em 0.55em; background: var(--panel2); color: #eaf4ff; display: flex; flex-direction: column; gap: 2px; }
.wp-item b { font-family: "Lilita One", sans-serif; font-weight: 400; color: #fff; }
.wp-item span { font-size: 0.8em; color: var(--dim); }
.wp-item.sel { background: linear-gradient(180deg, #ffd56a, #ee8a22); } .wp-item.sel b, .wp-item.sel span { color: var(--ink); }
.wp-item.cat-weapons { border-left: 6px solid #ff6f3c; } .wp-item.cat-worms { border-left: 6px solid #3a7be8; }
.wp-item.cat-world { border-left: 6px solid #3ab85a; } .wp-item.cat-crates { border-left: 6px solid #b05ad8; }
.team select, .team .wsel { font: inherit; font-size: 0.9em; border-radius: 8px; border: 2px solid var(--ink); background: #fff8e8; max-width: 100%; }
.team .wrow { margin-top: 4px; gap: 4px; flex-wrap: nowrap; }
.team .wrow select { flex: 1; min-width: 0; }
.setup-sec { border-top: 2px solid rgba(255,255,255,0.1); padding-top: 0.45em; margin-top: 0.45em; }
/* Weapon Factory editor */
#scr-factory { z-index: 30; }
.factory { width: min(980px, 96%); max-height: 94%; display: flex; flex-direction: column; }
.factory .fbody { display: grid; grid-template-columns: minmax(220px, 0.9fr) 1.3fr; gap: 0.8em; min-height: 0; flex: 1; overflow: hidden; }
.factory .fview { position: relative; border-radius: 16px; border: 3px solid var(--ink); background: radial-gradient(ellipse at 50% 40%, #3f6da0, #182c46); min-height: 200px; overflow: hidden; }
.factory .fview canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.factory .fview .fname { position: absolute; left: 0.5em; top: 0.4em; right: 0.5em; display: flex; gap: 0.4em; }
.factory .fview .fname input { flex: 1; min-width: 0; font: inherit; font-weight: 700; padding: 0.2em 0.5em; border-radius: 10px; border: 2px solid var(--ink); user-select: text; -webkit-user-select: text; }
.factory .fcost { position: absolute; left: 0.6em; right: 0.6em; bottom: 0.5em; }
.factory .fcost .track { height: 18px; border-radius: 10px; border: 3px solid var(--ink); background: rgba(0,0,0,0.4); overflow: hidden; position: relative; }
.factory .fcost .fill { height: 100%; background: linear-gradient(90deg, #6fdc5c, #ffe14a 70%, #ff8a3c); transition: width 0.2s; }
.factory .fcost.over .fill { background: linear-gradient(90deg, #ff8a3c, #ff3c3c); }
.factory .fcost .lab { font-family: "Lilita One", sans-serif; font-size: 0.95em; margin-bottom: 2px; text-shadow: 0 2px 0 var(--ink); }
.factory .fcost.over .lab { color: #ffb3a8; }
.factory .fside { display: flex; flex-direction: column; min-height: 0; }
.factory .ftypes { display: flex; gap: 0.35em; flex-wrap: wrap; margin-bottom: 0.35em; }
.factory .ftabs { display: flex; gap: 0.3em; margin-bottom: 0.3em; }
.factory .frows { overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding-right: 4px; }
.factory .frow { display: flex; align-items: center; justify-content: space-between; gap: 0.5em; padding: 3px 6px; border-radius: 10px; background: rgba(0,0,0,0.18); }
.factory .frow .lbl { font-weight: 700; }
.factory .frow .ctl { display: flex; align-items: center; gap: 4px; }
.factory .frow .ctl b { min-width: 6.2em; text-align: center; }
.factory .meter { display: inline-flex; gap: 2px; }
.factory .meter i { width: 7px; height: 14px; border-radius: 3px; background: rgba(255,255,255,0.15); border: 1px solid rgba(0,0,0,0.4); }
.factory .meter i.on { background: #ffd24a; }
.factory .flist { display: flex; gap: 0.35em; flex-wrap: wrap; margin: 0.4em 0; }
.factory .fl { border: 2px solid var(--ink); border-radius: 10px; padding: 0.2em 0.6em; background: var(--panel2); color: #eaf4ff; font-weight: 700; }
.factory .fl.sel { background: linear-gradient(180deg, #ffd56a, #ee8a22); color: var(--ink); }
.factory .fl.stock { border-style: dashed; }
.factory .fl small { color: inherit; opacity: 0.75; font-weight: 500; }
@media (max-width: 760px) { .factory .fbody { grid-template-columns: 1fr; overflow-y: auto; } .factory .fview { min-height: 170px; } .factory .frows { overflow: visible; } }
#stage.short .factory .fbody { grid-template-columns: minmax(200px, 0.8fr) 1.3fr; }
#stage.short .factory .fview { min-height: 140px; }
.hud-counters { left: 50%; top: calc(8px * var(--s) + var(--st)); transform: translateX(-50%); display: flex; gap: calc(8px * var(--s)); }
.hud-counters .c { display: flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; border: 2.5px solid var(--ink); background: var(--panel); color: #fff; font-size: calc(14px * var(--s)); text-shadow: 0 2px 0 var(--ink); }
.hud-counters .c i { width: calc(12px * var(--s)); height: calc(12px * var(--s)); border-radius: 50%; border: 2px solid var(--ink); }
.hud-counters .c.out { opacity: 0.4; text-decoration: line-through; }
.hud-wormpot { right: calc(14px * var(--s) + var(--sr)); top: calc(170px * var(--s) + var(--st)); display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.hud-wormpot span { font-size: calc(11px * var(--s)); padding: 1px 6px; border-radius: 8px; background: rgba(122, 61, 18, 0.85); border: 2px solid var(--ink); color: #fff4d6; }
.factory .fside { min-height: 0; overflow: hidden; }
.factory .frows { flex: 1 1 auto; min-height: 0; }
.factory .flist { max-height: 5.2em; overflow-y: auto; }
#stage.short .factory { padding: 8px 12px; }
#stage.short .factory .flist { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; max-height: none; margin: 0.2em 0; }
#stage.short .factory .fl { white-space: nowrap; font-size: 0.85em; }
#stage.short .factory .frow { padding: 1px 6px; }
#stage.short .factory .frow .btn.small { min-height: 1.7em; padding: 0.1em 0.6em; }
#stage.short .factory h2 { font-size: 1.1em; }
#stage.short .factory .info { display: block; font-size: 0.8em; }
.factory .frow .ctl b { min-width: 7.6em; }
/* M8: single player — hub, briefing and result cards, in-mission presentation */
.sp .card { width: min(94%, 900px); }
.sp-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6em; }
.sp-head h1 { margin: 0; }
.coin { display: inline-block; width: 0.95em; height: 0.95em; border-radius: 50%; vertical-align: -0.12em; border: 2px solid var(--ink);
  background: radial-gradient(circle at 35% 30%, #fff6c8, #ffd24a 45%, #d8961c); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.25); }
.sp-coins { font-family: "Lilita One", sans-serif; font-size: 1.35em; color: #ffd24a; display: inline-flex; align-items: center; gap: 0.3em; text-shadow: 0 2px 0 var(--ink); }
.sp-tabs { justify-content: flex-start; margin: 0.4em 0 0.2em; }
.sp .mode-desc { text-align: left; }
.sp-list { margin: 0.2em 0 0.6em; }
.sp-chapter h3 { font-family: "Lilita One", sans-serif; font-weight: 400; color: #fff4d6; margin: 0.5em 0 0.3em; font-size: 1.05em; text-shadow: 0 2px 0 var(--ink); }
.sp-chapter.locked h3 { color: var(--dim); opacity: 0.7; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5em, 1fr)); gap: 0.45em; }
.sp-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0.15em; min-height: 3.6em; padding: 0.4em 0.6em;
  border-radius: 14px; border: 3px solid var(--ink); background: linear-gradient(180deg, #3d5a80, #253a58); color: #fff; text-align: left; font: inherit; cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,0.35); }
.sp-tile:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.35); }
.sp-tile .t { font-family: "Lilita One", sans-serif; font-size: 1.02em; line-height: 1.05; padding-right: 1.4em; }
.sp-tile .m { font-size: 0.8em; color: var(--dim); line-height: 1.1; }
.sp-tile.done { background: linear-gradient(180deg, #4f8a4a, #2f5e34); }
.sp-tile.locked { filter: grayscale(0.85) brightness(0.7); cursor: not-allowed; box-shadow: none; }
.sp-tile.locked .m { color: #ffd9a0; }
.sp-tile .stamp { position: absolute; right: 0.35em; top: 0.25em; width: 1.35em; height: 1.35em; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #ffd24a; color: var(--ink); font-weight: 700; border: 2px solid var(--ink); transform: rotate(-8deg); }
.sp-tile .tag { position: absolute; right: 0.4em; bottom: 0.3em; font-size: 0.68em; padding: 0 0.4em; border-radius: 8px; background: #6b5a9a; color: #fff; }
.sp-tile.soon { background: linear-gradient(180deg, #4a4f66, #30344a); }
.sp-actions { justify-content: center; margin-top: 0.5em; }
.sp-kicker { color: #8fd0ff; font-size: 0.9em; letter-spacing: 0.04em; text-transform: uppercase; }
.sp-brief h1, .sp-result h1 { margin-bottom: 0.25em; }
.sp-text { margin: 0 0 0.7em; line-height: 1.35; max-width: 46em; }
.sp-text.soon { color: #ffd9a0; }
.sp-brief .kv, .sp-result .kv { font-size: 1em; margin: 0.4em 0; }
.sp-tips { margin: 0.5em 0 0; color: var(--dim); font-size: 0.92em; }
.sp-tips ul { margin: 0.2em 0 0; padding-left: 1.2em; }
.sp-result.won h1 { color: #a8f08a; }
.sp-result.lost h1 { color: #ff9a8a; }
.sp-bonus { color: #ffd24a !important; }
.sp-new { color: #a8f08a; margin-left: 0.4em; }
.sp-chapterup { font-family: "Lilita One", sans-serif; color: #ffd24a; font-size: 1.2em; text-align: center; margin: 0.4em 0; text-shadow: 0 2px 0 var(--ink); }
#stage.short .sp-tile { min-height: 3em; padding: 0.3em 0.5em; }
#stage.short .sp-text { margin-bottom: 0.4em; }
#stage.short .sp .mode-desc { display: none; }
/* in-mission layer: above the HUD and the controls, below the menus */
#ui > #sp-mission { position: absolute; inset: 0; z-index: 9; pointer-events: none; display: none; font-family: "Lilita One", sans-serif; }
#ui > #sp-mission.on { display: block; }
.sp-lbox { position: absolute; left: 0; right: 0; height: 12%; background: #05070b; transition: transform 0.45s ease; }
.sp-lbox.top { top: 0; transform: translateY(-101%); }
.sp-lbox.bottom { bottom: 0; transform: translateY(101%); }
#sp-mission.letterbox .sp-lbox { transform: none; }
.sp-sub { position: absolute; left: 50%; bottom: 13.5%; transform: translateX(-50%); width: min(86%, 900px); text-align: center; color: #fff; font-family: "Fira Sans Condensed", sans-serif;
  font-weight: 700; font-size: calc(17px * var(--s) + 3px); line-height: 1.3; text-shadow: 0 2px 0 #000, 0 0 6px #000; opacity: 0; transition: opacity 0.4s; }
.sp-sub.show { opacity: 1; }
#ui > #sp-mission .sp-skip { position: absolute; right: calc(18px * var(--s) + var(--sr)); bottom: calc(2% + var(--sb)); display: none; pointer-events: auto; }
.sp-skip.show { display: inline-flex !important; }
.sp-boxwrap { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(5, 10, 20, 0.45); pointer-events: auto; }
.sp-boxwrap.show { display: flex; }
.sp-box { max-width: min(86%, 640px); text-align: center; }
.sp-box p { font-family: "Fira Sans Condensed", sans-serif; font-weight: 700; font-size: 1.15em; line-height: 1.35; margin: 0 0 0.8em; }
.sp-say { position: absolute; left: 50%; top: calc(14% + var(--st)); transform: translateX(-50%); max-width: 80%; text-align: center; padding: 0.3em 0.9em; border-radius: 14px;
  background: rgba(16, 26, 40, 0.82); border: 3px solid var(--ink); color: #fff4d6; font-size: calc(17px * var(--s) + 4px); opacity: 0; transition: opacity 0.35s; }
.sp-say.show { opacity: 1; }
.sp-count { position: absolute; left: 50%; top: calc(54px * var(--s) + var(--st)); transform: translateX(-50%); display: none; align-items: center; gap: 0.4em; padding: 0.15em 0.8em;
  border-radius: 14px; background: rgba(16, 26, 40, 0.8); border: 3px solid var(--ink); color: #fff; font-size: calc(18px * var(--s) + 2px); }
.sp-count.show { display: flex; }
.sp-count b { color: #ffd24a; font-size: 1.2em; }
#sp-mission.letterbox .sp-count { display: none; }
.sp-egg { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%) scale(0.9); text-align: center; color: #ffd24a; font-size: calc(36px * var(--s) + 6px); opacity: 0;
  transition: opacity 0.3s, transform 0.3s; text-shadow: 0 3px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink); }
.sp-egg.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.sp-egg small { display: block; font-size: 0.5em; color: #fff; }
#hud.cine > *:not(.hud-msg):not(.hud-banner) { opacity: 0 !important; }
.sp-nopay { color: var(--dim); font-weight: 500; }
.sp-dim { color: var(--dim); font-size: 0.9em; }
