/* Raglike — UI based on the Ragnarok Online windows (references/ui), proposal B "HD" chosen by the owner on 27/10/2026
   (docs/ref/ui_propostas/): pale blue title bar with the round blue button on the left and a minimise button on the
   right, light body, navy bold labels, rounded-rectangle grey buttons (8 px), HP/EXP bars as in the RO Basic Info,
   striped footer, Tahoma. Original design; the previous UI is in _obsoleto/2026-10-27_ui_antiga/. */
:root {
  --ink: #101a33;
  --mute: #4c5873;
  --lbl: #1f3a8f;
  --red: #d42a2a;
  --green: #188a2e;
  --win-bg: linear-gradient(180deg, #ffffff 0%, #f6f8fc 100%);
  --win-side: #e9eef8;
  --win-line: #8fa7d8;
  --win-r: 10px;
  --win-sh: 0 8px 24px rgba(12, 28, 80, 0.35), 0 1px 0 rgba(255, 255, 255, 0.9) inset;
  --wt-bg: linear-gradient(180deg, #ffffff 0%, #e6eefc 45%, #bfd2f5 100%);
  --wt-line: #9bb2e0;
  --btn-bg: linear-gradient(180deg, #ffffff 0%, #f1f4f9 50%, #dfe5ef 100%);
  --btn-line: #a0acc2;
  --btn-pri: linear-gradient(180deg, #f5f9ff 0%, #cfdefb 50%, #a9c2f0 100%);
  --btn-pri-line: #5576c2;
  --btn-r: 8px;
  --bar-line: #4a6ab5;
  --exp-fill: linear-gradient(180deg, #7fa3ec, #3f6ccc);
  --inset-bg: #e7ecf6;
  --foot-bg: linear-gradient(180deg, #f3f5f9, #e6eaf1);
  --pc: #8fb0de;
  --font: Tahoma, 'Segoe UI', Verdana, sans-serif;          /* titles, names, buttons, numbers */
  --font-small: Arial, Helvetica, sans-serif;               /* hints, roles, small labels */
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a2142; color: var(--ink); font-family: var(--font); font-weight: 400; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button { font-family: inherit; }
canvas, img { image-rendering: pixelated; image-rendering: crisp-edges; }
/* UI pictures are resampled at screen resolution (assets.resample): draw them smoothly */
.pp-por img, .sk img, .pp-pot img, .slot img, .c-card img, .c-card-skills img, #c-pot-img, #c-shop-img, .c-sk, .c-atk, img[src*="hero_"] { image-rendering: auto; }
.btn small, .pp-cls, .t-save, .join-url, .net-status, .slot-info span, .lobby-hint, .lobby-kb, .pause-room, .m-stat, #kb-help, .howto, .c-card-role, #c-hp-text, .p-note, .c-p-note { font-family: var(--font-small); }
.host-tag { display: inline-block; font: bold 0.7em var(--font-small); font-style: normal; letter-spacing: 0.06em; color: #fff; background: #d29a1e; border: 1px solid #6a4510; border-radius: 3px; padding: 0 0.35em; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3); vertical-align: middle; }

/* ---------- windows (RO anatomy: title bar with the round button, body, striped footer) ---------- */
.win {
  position: relative;
  background: var(--win-bg);
  border: 2px solid var(--win-line);
  border-radius: var(--win-r);
  box-shadow: var(--win-sh);
}
.win-title {
  display: flex; align-items: center; gap: 0.45em;
  margin: 0 0 0.7em; padding: 0 0.5em; height: 1.8em; border-radius: calc(var(--win-r) - 2px) calc(var(--win-r) - 2px) 0 0;
  background: var(--wt-bg); border-bottom: 1px solid var(--wt-line);
  color: #10204e; font-size: 1em; font-weight: 600; text-shadow: 0 1px 0 #fff; white-space: nowrap;
}
/* a flat, small dot: an ornament, not a button; no minimise button (owner, 27/10/2026: they looked clickable) */
.win-title::before { content: ''; flex: none; width: 0.6em; height: 0.6em; border-radius: 50%; background: #4a72cf; }
.win-foot { margin: 0.6em -0.8em -0.8em; padding: 0.45em 0.8em; background: var(--foot-bg); border-top: 1px solid rgba(120, 135, 165, 0.45); border-radius: 0 0 calc(var(--win-r) - 2px) calc(var(--win-r) - 2px); }
.win.slim { border-radius: 8px; }
.win h2 { margin: 0 0 0.4em; color: var(--lbl); font-weight: 700; }

/* ---------- buttons: RO capsule made for the TV (rounded rectangle, 8 px) ---------- */
.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 2.2em; padding: 0.35em 1.1em; border: 1.5px solid var(--btn-line); border-radius: var(--btn-r);
  background: var(--btn-bg); color: var(--ink); font-size: 1em; font-weight: 600; cursor: pointer; white-space: nowrap;
  box-shadow: 0 2px 0 rgba(20, 40, 90, 0.12), inset 0 1px 0 #fff;
  transition: transform 0.06s, filter 0.15s, box-shadow 0.15s;
}
.btn:hover { filter: brightness(1.04); box-shadow: 0 2px 0 rgba(20, 40, 90, 0.12), 0 0 0 2px rgba(80, 130, 230, 0.35); }
.btn:active { transform: translateY(1px); background: linear-gradient(180deg, #c7d6f3, #e6edfb); box-shadow: inset 0 2px 3px rgba(20, 40, 90, 0.25); }
.btn:disabled { opacity: 0.45; cursor: default; filter: none; box-shadow: none; }
.btn small { display: block; font-size: 0.68em; font-weight: 400; color: var(--mute); }
.btn.big { font-size: 1.12em; padding: 0.45em 1.3em; }
/* primary (the RO "selected" blue); the old gold/blue classes both map to it */
.btn-gold, .btn-blue { background: var(--btn-pri); border-color: var(--btn-pri-line); color: var(--lbl); }

.coin { display: inline-block; width: 0.9em; height: 0.9em; border-radius: 50%; vertical-align: -0.1em; margin-right: 0.25em;
  background: radial-gradient(circle at 35% 35%, #fff4a8, #e1a72f 60%, #9a6a12); border: 1px solid #6b4a12; }
/* pixel art coin (owner, 30/10/2026): 12x16 texels at 16 CSS px, one texel = whole device pixels (assets.coinURL) */
.coin-px .coin { width: 12px; height: 16px; border: 0; border-radius: 0; vertical-align: -0.2em; background: var(--coin) center / 100% 100% no-repeat; }

/* inputs, selects, checkboxes, sliders in the RO style */
input[type=text], input:not([type]), select {
  font: inherit; color: var(--ink); background: #fff; border: 1.5px solid #9fb0d2; border-radius: 4px; padding: 0.2em 0.4em; box-shadow: inset 0 2px 3px rgba(30, 50, 100, 0.12);
}
input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; width: 1.1em; height: 1.1em; margin: 0; border: 1.5px solid #6b7c9f; border-radius: 3px; background: #fff; position: relative; cursor: pointer; }
input[type=checkbox]:checked::after { content: ''; position: absolute; left: 30%; top: 5%; width: 32%; height: 60%; border: solid #1d3c8f; border-width: 0 0.18em 0.18em 0; transform: rotate(40deg); }
input[type=range] { appearance: none; -webkit-appearance: none; height: 0.55em; border-radius: 0.3em; background: linear-gradient(180deg, #9db4e4, #dbe5f7); border: 1px solid #6b84bb; cursor: pointer; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 1.15em; height: 1.15em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 15%, #a9c0ef 40%, #3e68c8); border: 1px solid #23458f; }
input[type=range]::-moz-range-thumb { width: 1.15em; height: 1.15em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 15%, #a9c0ef 40%, #3e68c8); border: 1px solid #23458f; }

/* the logo is the Gemini art (owner, 26/10/2026; tools/logo_build.py): full one on the TV and the landing page,
   the word alone (no subtitle band) on the phone */
.logo-img { display: block; margin: 0 auto; width: 100%; max-width: 360px; height: auto; }
.logo-img.small { max-width: 200px; }
.logo-img.big { width: auto; max-width: 80vw; height: 34vh; max-height: none; }
.tagline { text-align: center; color: var(--mute); margin: 0.4em 0 1em; }
#t-logo { margin-bottom: 1em; }   /* the title screen's tagline was removed (owner, 26/10/2026) */
body.play-mode .test-only { display: none !important; }   /* ?play=1: no test tools (owner, 27/10/2026) */
.tagline.glow { color: #fff; text-shadow: 0 2px 0 #24325e, 0 0 12px rgba(30, 40, 90, 0.8); font-size: 1.3em; }

#loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 100; background: #1a2142; }
#loading .win { width: 220px; text-align: center; padding-bottom: 6px; }

/* (the landing page was removed on 31/10/2026, owner: the address opens the TV lobby; _obsoleto/2026-10-31_tela_inicial/) */
.c-join-card input { font: inherit; font-size: 1.3em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.2em; text-align: center;
  border: 1.5px solid #9fb0d2; border-radius: 4px; padding: 0.25em; width: 6em; background: #fff; color: var(--ink); box-shadow: inset 0 2px 3px rgba(30, 50, 100, 0.12); }

/* ---------- big screen ---------- */
/* the browser draws without the graphics card (js/tvmode.js SOFTWARE; owner, 31/10/2026) */
.sw-warn { position: absolute; left: 50%; bottom: 3%; transform: translateX(-50%); z-index: 40; width: min(560px, 90vw); padding: 0 1em 0.6em; font-size: clamp(12px, 1vw, 18px); }
.sw-warn .win-title { margin: 0 -1em 0.5em; background: linear-gradient(#ffe4c4, #f6c48e); color: #6b3500; }
.sw-warn p { margin: 0.3em 0; color: var(--ink); }
#display { position: fixed; inset: 0; background: #2f6b33; }
#gl { position: absolute; inset: 0; }
#gl canvas { width: 100%; height: 100%; display: block; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
#vignette { position: absolute; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(ellipse 75% 70% at 50% 48%, transparent 62%, rgba(10, 20, 30, 0.38)); }
#fade { position: absolute; inset: 0; background: #0c1020; opacity: 0; pointer-events: none; z-index: 30; transition: opacity 0.5s; }
#fade.on { opacity: 1; }
/* everything on the TV is sized in em from here: proposal B was drawn at 20 px for a 1600 px wide screen, then made
   30% smaller in game (owner, 27/10/2026: cards, top bar and map were too big) */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 3; font-size: clamp(10px, 0.84vw, 18px); }

#topbar { position: absolute; top: 0.6em; left: 50%; transform: translateX(-50%); display: flex; gap: 1.1em; align-items: center; padding: 0.3em 1em; white-space: nowrap; }
#stage-name { color: var(--lbl); font-weight: 700; }
#stage-prog { color: var(--mute); font-size: 0.85em; }
.tb-gold b { color: #8a5a10; }
#bossbar { position: absolute; top: 3.4em; left: 50%; transform: translateX(-50%); width: min(28vw, 32em); padding: 0.35em 0.7em 0.5em; }
.bb-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.25em; }
.bb-name { color: var(--lbl); font-weight: 700; }
.bb-lv { color: var(--mute); font-size: 0.85em; }
.bb-bar { position: relative; height: 1.05em; border: 1.5px solid var(--bar-line); border-radius: 0.55em; background: linear-gradient(180deg, #eef2f8, #fff); overflow: hidden; }
.bb-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 0.55em; background: linear-gradient(180deg, #ffd7f0, #c98ae8 45%, #8a3fc4 60%, #b07ad8); transition: width 0.2s; }
.bb-bar span { position: relative; display: block; text-align: center; font-size: 0.75em; line-height: 1.3em; color: #0c1640; text-shadow: 0 0 2px #fff, 0 0 2px #fff; }
#bossbar.p2 .bb-bar i { background: linear-gradient(180deg, #ffe0c8, #ff9a5a 45%, #e0461e 60%, #f07a4a); }

/* the map alone, flush with the top-right corner (owner, 27/10/2026: no frame and no title); with 4 players it is
   smaller and sits under the 4th card (hud.layout sets --mm-top) */
#minimap { position: absolute; top: var(--mm-top, 0); right: 0; }
/* frame A (owner, 30/10/2026, docs/ref/minimapa_moldura/propostas_ABC.png): the window border on the sides that don't
   touch the screen edge, like the hero cards, rounded on the inner corner */
#minimap { border-left: 2px solid var(--win-line); border-bottom: 2px solid var(--win-line); border-radius: 0 0 0 var(--win-r); overflow: hidden; box-shadow: var(--win-sh); }
#minimap.small { border-top: 2px solid var(--win-line); border-radius: var(--win-r) 0 0 var(--win-r); }   /* 4 players: under the 4th card */
/* the map shrinks a bit more than the rest (owner, 27/10/2026): about the width of a card */
#minimap canvas { display: block; width: 13em; height: calc(13em * 150 / 216); }
#minimap.small canvas { width: 10.5em; height: calc(10.5em * 150 / 216); }
#hud.no-mini #minimap { display: none; }

/* system messages, like the RO chat box (yellow on translucent black); off by default (UI.systemLog) */
#syslog { position: absolute; left: 50%; bottom: 0.5em; transform: translateX(-50%); width: min(34em, 30vw); padding: 0.35em 0.6em; border-radius: 0.5em;
  background: rgba(8, 14, 30, 0.6); color: #ffe98a; font-size: 0.8em; line-height: 1.35; text-shadow: 1px 1px 0 #000; }
#syslog:empty { display: none; }
#syslog div { transition: opacity 1s; }
#syslog div.old { opacity: 0; }
/* colours by kind, like the RO chat: info white, skills and crits yellow, damage taken and monster skills red,
   heals and level ups green, EXP / coins / items light blue, map changes violet, warnings orange */
#syslog .w { color: #fff; }
#syslog .y { color: #ffe98a; }
#syslog .r { color: #ff9a9a; }
#syslog .g { color: #8cf08c; }
#syslog .b { color: #9fd8ff; }
#syslog .m { color: #d6b8ff; }
#syslog .o { color: #ffb36b; }

#toast { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); color: #fff; font-weight: 700; font-size: 1.5em; white-space: nowrap;
  text-shadow: 2px 2px 0 #1a1030, 0 0 10px rgba(0, 0, 0, 0.7); opacity: 0; }
#toast.big { font-size: 2.6em; color: #ffe27a; }
#toast.show { animation: toast 2.4s ease-out forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 10px) scale(0.9); } 10% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 18% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
#banner { position: absolute; bottom: 20%; left: 50%; transform: translateX(-50%); padding: 0.3em 0.9em; color: #fff; background: rgba(20, 30, 70, 0.75); border: 1px solid #8cb4ea; border-radius: 6px; }
#kb-help { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: 0.7em; color: #fff; background: rgba(20, 25, 50, 0.6); padding: 2px 10px; border-radius: 3px; white-space: nowrap; }

/* ---- hero cards (proposal B): portrait, name and level, "HP 292/340" in text with the EXP bar and % beside it,
   skills and potion. They fill the corners in player order: top-left, bottom-left, bottom-right, then top-right
   (owner, 27/10/2026); flush with the screen edges, the edge sides without border or rounding */
.pp { position: absolute; width: 21em; display: flex; gap: 0.6em; align-items: center; padding: 0.5em 0.6em; transition: opacity 0.3s; border-radius: 0; }
.pp[data-corner="tl"] { top: 0; left: 0; border-top: 0; border-left: 0; border-radius: 0 0 var(--win-r) 0; box-shadow: inset 0.3em 0 0 var(--c), var(--win-sh); }
.pp[data-corner="bl"] { bottom: 0; left: 0; border-bottom: 0; border-left: 0; border-radius: 0 var(--win-r) 0 0; box-shadow: inset 0.3em 0 0 var(--c), var(--win-sh); }
.pp[data-corner="br"] { bottom: 0; right: 0; border-bottom: 0; border-right: 0; border-radius: var(--win-r) 0 0 0; box-shadow: inset -0.3em 0 0 var(--c), var(--win-sh); }
.pp[data-corner="tr"] { top: 0; right: 0; border-top: 0; border-right: 0; border-radius: 0 0 0 var(--win-r); box-shadow: inset -0.3em 0 0 var(--c), var(--win-sh); }
.pp[data-corner="tl"], .pp[data-corner="bl"] { padding-left: 0.85em; }
.pp[data-corner="tr"], .pp[data-corner="br"] { padding-right: 0.85em; }
.pp.empty { display: none; }
.pp.away { opacity: 0.55; }
.pp.down .pp-por img { filter: grayscale(1) brightness(0.7); }
.pp-por { width: 4em; height: 4em; flex: none; border: 1.5px solid #8fa0c4; border-radius: 8px; background: #fff; overflow: hidden; }
.pp-por img { width: 100%; height: 100%; display: block; }
.pp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.25em; }
.pp-name { display: flex; gap: 0.35em; align-items: center; white-space: nowrap; overflow: hidden; }
.pp-name > b { color: #fff; background: var(--c); padding: 0 0.3em; border-radius: 3px; font-size: 0.8em; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35); }
.pp-n { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.pp-cls { display: none; }   /* the class icon says it (owner, 26/10/2026) */
.pp-host { display: none; font: bold 0.62em var(--font-small); font-style: normal; color: #fff; background: #d29a1e; border: 1px solid #6a4510; border-radius: 3px; padding: 0 0.3em; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3); }
.pp.lead .pp-host { display: inline-block; }
.pp-state { font-size: 0.75em; font-weight: 700; color: var(--red); }
.pp-state.blue { color: #2e5fd0; }
.pp-lv { margin-left: auto; color: var(--mute); font-size: 0.85em; }
/* HP as text only (the bar under the hero on the map changes colour), EXP bar with the % beside it */
.pp-stat { display: flex; align-items: center; gap: 0.4em; white-space: nowrap; }
.pp-k { color: var(--lbl); font-weight: 700; font-size: 0.9em; }
.pp-hpv { color: var(--lbl); font-weight: 700; margin-right: 0.3em; }
.pp-xp { flex: 1; position: relative; height: 0.6em; min-width: 2em; background: #fff; border: 1.5px solid #9aa9c6; border-radius: 0.3em; overflow: hidden; }
.pp-xp i { position: absolute; inset: 0 auto 0 0; background: var(--exp-fill); transition: width 0.3s; }
.pp-xpp { color: var(--mute); font-size: 0.8em; }   /* no reserved width: the EXP bar runs up to the % (owner, 28/10/2026) */
.pp-row { display: flex; align-items: center; gap: 0.3em; }
.pp-sk { display: flex; gap: 0.3em; }
.sk { position: relative; width: 2.5em; height: 2.5em; overflow: hidden; border: 1.5px solid var(--rim, #8fa0c4); border-radius: 6px; }
/* the HD drawing, slightly rounded, with a thin border in the colour of the icon's rim (owner, 27/10/2026) */
.sk img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.sk s { position: absolute; inset: 0; background: conic-gradient(rgba(10, 20, 50, 0.6) calc(var(--cd, 0) * 360deg), transparent 0); text-decoration: none; }
.sk u { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.85em; text-decoration: none; text-shadow: 0 0 3px #000, 0 0 2px #000; font-weight: 700; }
.sk.on { box-shadow: 0 0 0 2px #ffe27a, 0 0 8px #ffe27a; }
.pp-pot { margin-left: auto; position: relative; width: 2.5em; height: 2.5em; border: 1.5px solid #8fa0c4; border-radius: 7px; background: linear-gradient(180deg, #fff, #dde4f1); }
.pp-pot img { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); object-fit: contain; }
.pp-pot b { position: absolute; right: 2px; bottom: 0; color: #fff; font-size: 0.8em; text-shadow: 0 0 3px #000, 1px 1px 0 #000; }

/* ---------- TV screens ---------- */
.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10; padding: 2vh 2vw; font-size: clamp(14px, 1.15vw, 24px); }
.screen.dim { background: rgba(8, 14, 34, 0.5); }
.title-wrap { display: flex; flex-direction: column; align-items: center; gap: 1vh; }
.title-card { width: min(22em, 80vw); padding: 0 0.9em 0.9em; }
.title-card .win-title { margin: 0 -0.9em 0.8em; }
.title-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.title-card .title-actions { flex-direction: column; }
.title-card .title-actions .btn { width: 100%; }
.t-save { text-align: center; color: var(--mute); font-size: 0.85em; margin: 0.7em 0 0; min-height: 1em; }
.t-hint { color: #fff; text-shadow: 0 1px 2px #000, 0 0 8px rgba(0, 0, 0, 0.6); font-size: 0.9em; }

/* the TV opens straight on the lobby (owner, 27/10/2026): logo on top, the QR and the party below */
.lobby-screen { flex-direction: column; gap: 1.2vh; }
.lobby-logo { width: auto; height: 22vh; max-width: 60vw; }
.lobby-save { margin: -0.3em 0 0.7em; color: var(--mute); font-size: 0.85em; }
.lobby-save:empty { display: none; }
.lobby { display: flex; gap: 2vw; align-items: stretch; max-width: 62em; width: 100%; }
.lobby.qr-only { justify-content: center; }   /* nobody joined yet: only the QR, centred (owner, 28/10/2026) */
.qr-hint { position: absolute; right: calc(100% + 1.2em); top: 50%; width: 15em; height: 15em; transform: translateY(-50%);
           pointer-events: none; filter: drop-shadow(0 0.3em 0.5em rgba(0, 0, 0, 0.35)); }
.qr-laser { position: absolute; pointer-events: none; z-index: 2; }
.lobby-join { width: 18em; padding: 0 0.9em 0.9em; text-align: center; }
.lobby-join .win-title, .lobby-party .win-title, .msg-card .win-title { margin: 0 -0.9em 0.8em; }
#qr { width: 13em; height: 13em; border: 1px solid #9aa8c4; background: #fff; padding: 0.4em; }
.room-code small { display: block; color: var(--mute); }
.room-code b { font-size: 2.4em; letter-spacing: 0.2em; color: var(--lbl); }
.join-url { font-size: 0.72em; word-break: break-all; color: var(--mute); }
.join-url a { color: var(--lbl); }
.net-status { font-size: 0.8em; color: var(--green); min-height: 1em; }
.net-status.bad { color: var(--red); }
.lobby-party { flex: 1; padding: 0 0.9em 0.9em; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6em; }
.slot { display: flex; gap: 0.6em; align-items: center; padding: 0.5em; border-radius: 10px; background: var(--inset-bg); min-height: 5em; opacity: 0.65; }
.slot.filled { opacity: 1; box-shadow: inset 0.3em 0 0 var(--c); padding-left: 0.8em; }
.slot.away { opacity: 0.6; }
.slot img { width: 4.2em; height: 4.2em; border: 1.5px solid #8fa0c4; border-radius: 8px; background: #fff; }
.slot-info b { display: block; }
.slot-info span { color: var(--mute); font-size: 0.85em; }
.lobby-hint, .lobby-kb { color: var(--mute); font-size: 0.85em; margin: 0.8em 0 0; }

/* pause: an "Option" window and a "Paused" menu, side by side (both mirrored on the host's phone) */
.pause-wrap { display: flex; gap: 1em; align-items: flex-start; }
.pause-card { width: min(26em, 60vw); padding: 0 0.9em 0.9em; display: flex; flex-direction: column; gap: 0.55em; }
.pause-card .win-title { margin: 0 -0.9em 0.3em; }
.pause-card label, .pause-card .p-row { display: flex; justify-content: space-between; align-items: center; gap: 0.8em; color: var(--lbl); font-weight: 600; }
.pause-card input[type=range] { flex: 1; max-width: 60%; }
.pause-card select { max-width: 60%; }
.pause-card .p-jump { display: flex; gap: 0.3em; }
.pause-card .p-jump .btn { min-width: 2.3em; padding-left: 0; padding-right: 0; }
.pause-room { font-size: 0.75em; color: var(--mute); word-break: break-all; margin-top: 0.3em; }
.pause-menu { width: 15em; padding: 0 0.9em 0.9em; display: flex; flex-direction: column; gap: 0.5em; }
.pause-menu .win-title { margin: 0 -0.9em 0.3em; }
.pause-menu .btn { width: 100%; }
.p-note { margin: 0.2em 0 0; color: var(--mute); font-size: 0.72em; line-height: 1.35; }
.msg-card { text-align: center; width: min(32em, 92vw); padding: 0 0.9em 0.9em; display: flex; flex-direction: column; gap: 0.6em; }
.msg-card h2 { font-size: 1.7em; margin: 0; color: var(--red); }
.msg-card h2.good { color: #2a56b8; }   /* Demo Complete! */
.msg-card p { margin: 0; color: var(--mute); white-space: pre-line; }
.m-stats { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.m-stat { box-shadow: inset 0.25em 0 0 var(--c); background: var(--inset-bg); padding: 6px 10px 6px 14px; text-align: left; font-size: 0.85em; border-radius: 6px; }
.shop-panel { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); padding: 0 0.8em 0.5em; z-index: 5; text-align: center; font-size: clamp(13px, 1.1vw, 22px); }
.shop-panel .win-title { margin: 0 -0.8em 0.5em; }
.shop-panel p { margin: 4px 0; }
.net-badge { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 20; color: #fff; font-size: 1.4em; text-shadow: 2px 2px 0 #000; pointer-events: none; }

/* ---------- phone controller ---------- */
body.mode-controller { background: radial-gradient(ellipse at 50% 0%, #3c5a96 0%, #1a2546 60%, #10162b 100%); touch-action: none; font-size: 15px; }
#controller { position: fixed; inset: 0; }
.c-top { position: absolute; top: 0; left: 0; right: 0; height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right));
  background: var(--wt-bg); border-bottom: 1px solid var(--wt-line); box-shadow: inset 0 -3px 0 var(--pc); z-index: 5; }
.c-slot { background: var(--pc); width: 0.9em; height: 0.9em; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8); }   /* the player's colour (no P1–P4) */
.c-cls { font-weight: 700; color: var(--lbl); white-space: nowrap; }
.c-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.c-hp { flex: 1; position: relative; height: 18px; background: linear-gradient(180deg, #eef2f8, #fff); border: 1.5px solid var(--bar-line); border-radius: 9px; overflow: hidden; }   /* fills up to the coins (owner, 30/10/2026; was max-width 340px) */
.c-hp-fill { position: absolute; inset: 0 auto 0 0; width: 100%; border-radius: 9px; background: linear-gradient(180deg, #eaf1ff 0%, #a9c1f2 35%, #5f87dc 62%, #7e9fe8 100%); transition: width 0.15s; }
#c-hp-text { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 15px; color: #0c1640; text-shadow: 0 0 2px #fff, 0 0 2px #fff; }
.c-gold { white-space: nowrap; }
.c-mini { width: 34px; height: 30px; min-height: 0; padding: 0; border-radius: 7px; font-size: 14px; }
.c-screen { position: absolute; inset: 42px 0 0 0; }
/* the card stays below the top bar (42px) and scrolls on a short landscape phone (owner, 30/10/2026: it touched the bar) */
#c-join { display: flex; padding: 52px 10px 10px; inset: 0; z-index: 6; overflow-y: auto; }
#c-join .c-join-card { margin: auto; }
.c-join-card { width: min(420px, 100%); padding: 0 1em 1em; display: flex; flex-direction: column; gap: 8px; }
.c-join-card .win-title { margin: 0 -1em 4px; }
.c-join-card label { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--lbl); font-weight: 700; }
.c-join-card input { width: 9em; font-size: 1.1em; letter-spacing: 0.08em; }
#c-name { text-transform: none; letter-spacing: 0.02em; }
body[data-phase="join"] .c-top > :not(.c-slot):not(.c-cls) { visibility: hidden; }
.c-status { margin: 0; color: var(--mute); font-size: 0.85em; min-height: 1.2em; text-align: center; }

#c-select { display: flex; flex-direction: column; padding: 8px; gap: 8px; }
.c-cards { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; min-height: 0; }
.c-card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 4px;
  border: 2px solid var(--win-line); border-radius: var(--win-r); background: var(--win-bg); color: var(--ink); min-height: 0; overflow: hidden; box-shadow: var(--win-sh); font: inherit; }
.c-card img.c-portrait { width: min(84px, 18vh); height: min(84px, 18vh); border: 1.5px solid #8fa0c4; border-radius: 8px; }
.c-card-name { font-weight: 700; color: var(--lbl); }
.c-card-role { font-size: 0.75em; color: var(--mute); }
.c-card-skills { display: flex; gap: 3px; }
.c-card-skills img { width: 24px; height: 24px; border: 1.5px solid #8fa0c4; border-radius: 5px; }
.c-card-walk { width: min(104px, 27vh); height: min(104px, 27vh); flex: none; }   /* the hero walking in place */
.c-card-owner { font-size: 0.8em; font-weight: 700; min-height: 1.1em; color: #fff; background: var(--oc); padding: 0 6px; border-radius: 3px; }
.c-card.mine { box-shadow: 0 0 0 3px var(--oc), 0 0 16px var(--oc); }
.c-card.taken { filter: grayscale(0.85) opacity(0.6); }
/* PvP lobby on the phone (owner, 31/10/2026) */
.c-pvp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: #fff; font-size: 13px; }
.c-pvp[hidden], .c-pvp-grp[hidden] { display: none; }
.c-pvp-grp { display: flex; align-items: center; gap: 4px; }
.c-pvp-grp b { margin-right: 4px; font-size: 12px; }
.c-pvp .btn { min-height: 28px; padding: 0 10px; font-size: 12px; }
.c-pvp .btn.on { background: var(--btn-pri); border-color: var(--btn-pri-line); }
.c-pvp .c-team0.on { background: #4a86ff; border-color: #2a5ed8; color: #fff; }
.c-pvp .c-team1.on { background: #ff5a5a; border-color: #d83a3a; color: #fff; }
.c-pvp-bots .btn.bot0 { box-shadow: inset 0 -3px 0 #4a86ff; }
.c-pvp-bots .btn.bot1 { box-shadow: inset 0 -3px 0 #ff5a5a; }
.c-pvp-bots .btn.botf { box-shadow: inset 0 -3px 0 #e9b23a; }
body.pvp-mode .tb-gold, body.pvp .c-gold { display: none !important; }   /* no coins in PvP */
.c-select-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #fff; }
.c-mode { display: flex; gap: 4px; margin-left: auto; }
.c-mode .btn { min-height: 34px; padding: 0 12px; }

#c-game { overflow: hidden; }
.c-joy { position: absolute; width: 132px; height: 132px; margin: -66px 0 0 -66px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.06); opacity: 0; transition: opacity 0.1s; pointer-events: none; }
.c-joy.on { opacity: 1; }
.c-joy-knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; border-radius: 50%; transform: translate(-50%, -50%); background: radial-gradient(circle at 35% 30%, #fff 0 12%, #b9cdf3 40%, #5a80d4); border: 2px solid #2b4c9c; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4); }
.c-joy-hint { position: absolute; left: 25%; top: 50%; transform: translate(-50%, -50%); color: rgba(255, 255, 255, 0.25); font-size: 1.1em; pointer-events: none; }
.c-buttons { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: 8px; width: min(48vw, 380px); height: min(76vh, 300px); }
.c-cell { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.c-lbl { color: #fff; font-size: 11px; font-weight: 600; text-shadow: 1px 1px 0 #000; white-space: nowrap; pointer-events: none; }
/* round buttons with the capsule bevel (proposal B) */
.c-btn { position: relative; border-radius: 50%; border: 3px solid #8fa0c4; background-color: #2a3050; background-size: cover; background-position: center; image-rendering: pixelated;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.8); padding: 0; touch-action: none; }
.c-btn.down { transform: scale(0.92); filter: brightness(1.25); }
.c-cell-atk { right: 0; bottom: 14px; }
.c-atk { width: min(30vh, 120px); height: min(30vh, 120px); background: radial-gradient(circle at 40% 35%, #ffffff, #dfe5ef 70%, #b9c4d8); }
.c-cell-s0 { right: calc(min(30vh, 120px) + 18px); bottom: 6px; }
.c-cell-s1 { right: calc(min(30vh, 120px) + 4px); bottom: calc(min(30vh, 120px) + 4px); }
.c-cell-s2 { right: 0; bottom: calc(min(30vh, 120px) + 46px); }
/* skills: the icon as drawn, square, no frame or bevel (owner, 27/10/2026) */
.c-sk { width: min(21vh, 82px); height: min(21vh, 82px); overflow: hidden; border: 2px solid var(--rim, #8fa0c4); border-radius: 14px; background-color: #10162b; background-size: cover; box-shadow: none; image-rendering: auto; }
.c-sk::after { content: ''; position: absolute; inset: 0; border-radius: 12px; background: conic-gradient(rgba(10, 20, 50, 0.7) calc(var(--cd, 0) * 360deg), transparent 0); }
.c-sk-cd { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.6em; font-weight: 700; text-shadow: 2px 2px 0 #000; z-index: 1; }
.c-sk.disabled { filter: grayscale(1) brightness(0.6); }
.c-sk.shake { animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.c-cell-pot { right: calc(min(30vh, 120px) + min(21vh, 82px) + 34px); bottom: 18px; }
.c-pot { width: min(16vh, 62px); height: min(16vh, 62px); background: radial-gradient(circle at 40% 35%, #ffffff, #dfe5ef 70%, #b9c4d8); }
.c-pot img { width: 64%; height: 64%; margin-top: 2px; }
.c-pot b { position: absolute; right: -6px; bottom: -6px; background: #fff; border: 1.5px solid #8fa0c4; border-radius: 10px; min-width: 22px; font-size: 13px; line-height: 18px; }
.c-pot.disabled { filter: grayscale(1) opacity(0.6); }
.c-act { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 3; font-size: 1.1em; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(120, 160, 240, 0.6), 0 2px 0 rgba(0, 0, 0, 0.3); } }
.c-aim { position: absolute; width: 0; height: 0; display: none; z-index: 4; pointer-events: none; }
.c-aim.on { display: block; }
.c-aim::before { content: ''; position: absolute; width: min(64vh, 260px); height: min(64vh, 260px); left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; border: 2px dashed rgba(255, 176, 74, 0.8); background: rgba(255, 140, 40, 0.1); }
.c-aim-dot { position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; background: radial-gradient(circle, #fff, #ff9a2f); border: 2px solid #5a2a00; transform: translate(-50%, -50%); }
.c-toast { position: absolute; right: 30%; top: 30%; color: #fff; font-weight: 700; font-size: 1.4em; text-shadow: 2px 2px 0 #000; opacity: 0; pointer-events: none; }
.c-toast.show { animation: toast2 1.1s ease-out forwards; }
.c-notice { position: fixed; left: 50%; top: 50px; z-index: 30; transform: translateX(-50%); padding: 7px 16px; border-radius: 999px; background: rgba(16, 22, 44, 0.92); border: 1.5px solid var(--pc, #8fb4ff); color: #fff; font: bold 14px var(--font); white-space: nowrap; opacity: 0; pointer-events: none; }
.c-notice.show { animation: notice 2.4s ease-out forwards; }
@keyframes notice { 0% { opacity: 0; transform: translate(-50%, -8px); } 10% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes toast2 { 0% { opacity: 0; transform: translateY(8px); } 15% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.c-overlay { position: absolute; inset: 42px 0 0 0; display: flex; align-items: center; justify-content: center; z-index: 8; padding: 10px; overflow: auto; }
.c-overlay.dim { background: rgba(10, 14, 32, 0.7); }
.c-msgwin { padding: 0 1em 0.9em; text-align: center; width: min(440px, 100%); }
.c-msgwin .win-title { margin: 0 -1em 0.6em; }
.c-msgwin h2 { font-size: 1.25em; }
.c-msgwin p { margin: 0.3em 0; color: var(--mute); }
.c-msg-acts { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.c-msg-acts:empty { display: none; }
.c-support .btn { text-decoration: none; min-width: 5.5em; }   /* end-of-demo support links (Stripe) */
#c-ov-msg { flex-direction: column; gap: 10px; }
.c-supportwin { width: min(620px, 100%); }
.c-supportwin .c-support { gap: 14px; margin-top: 14px; }
.c-supportwin .c-support .btn { font-size: 1.5em; padding: 0.75em 1.1em; min-width: 5.2em; flex: 1; }
.c-hostwin { width: min(320px, 100%); padding-bottom: 0.7em; }
/* the Discord button: the screen's bottom-left corner, outside the support card (owner, 31/10/2026) */
.c-discord { position: fixed; left: 14px; bottom: 14px; z-index: 9; font-size: 16px; width: 2.6em; height: 2.4em; border-radius: 50%; background: #5865f2; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(12, 28, 80, 0.35); }
.c-discord[hidden] { display: none; }
.c-discord svg { width: 58%; height: 58%; fill: #fff; }
.c-rev { height: 14px; border: 1.5px solid var(--bar-line); border-radius: 7px; background: #fff; margin-top: 8px; overflow: hidden; }
#c-rev-fill { height: 100%; width: 0; background: var(--exp-fill); transition: width 0.15s; }
.c-shop { padding: 0 1em 0.8em; width: min(460px, 100%); display: flex; flex-direction: column; gap: 8px; }
.c-shop .win-title { margin: 0 -1em 4px; }
.c-shop p { margin: 0; color: var(--mute); }
.c-shop-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--inset-bg); }
.c-shop-item img { height: 22px; vertical-align: middle; }
.c-shop-item small { display: block; color: var(--mute); font-size: 0.8em; }
/* host's main menu on the phone (owner, 27/10/2026: no keyboard at play time) */
.c-titlewin #c-title-lead { display: flex; flex-direction: column; gap: 8px; }
.c-t-save { font-size: 0.8em; }
/* pause on the phone: the host gets the TV's Option window; everyone gets the menu and the hero change */
.c-ov-pause { gap: 10px; align-items: flex-start; }
.c-optwin { width: min(420px, 56%); padding: 0 0.9em 0.7em; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.c-optwin .win-title { margin: 0 -0.9em 4px; }
.c-optwin label, .c-jumprow { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--lbl); font-weight: 700; min-height: 26px; }
.c-optwin input[type=range] { flex: 1; max-width: 58%; height: 10px; touch-action: none; }
/* a thumb big enough for a finger */
.c-optwin input[type=range]::-webkit-slider-thumb { width: 24px; height: 24px; }
.c-optwin input[type=range]::-moz-range-thumb { width: 24px; height: 24px; }
.c-optwin select { max-width: 58%; font-size: 13px; }
.c-jumprow span { display: flex; gap: 4px; }
.c-jumprow .btn { min-width: 34px; min-height: 26px; padding: 0; }
.c-optwin.no-test .c-test { display: none; }
.c-pmenu { width: min(300px, 42%); padding: 0 0.9em 0.8em; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.c-pmenu .win-title { margin: 0 -0.9em 4px; }
.c-pmenu > .btn { width: 100%; }
.c-p-note { margin: 0; color: var(--mute); font-size: 12px; text-align: center; }
.c-rotate { display: none; position: fixed; inset: 0; z-index: 50; background: #12162c; align-items: center; justify-content: center; padding: 20px; }
.rot-icon { font-size: 3em; color: var(--lbl); }
@media (orientation: portrait) {
  body.mode-controller[data-phase="game"] .c-rotate, body.mode-controller[data-phase="select"] .c-rotate { display: flex; }
}
body.ghost .c-buttons { opacity: 0.5; }
/* pause menu on the phone: give a potion */
.c-give { display: flex; flex-direction: column; gap: 4px; }
.c-give-t { font-weight: bold; color: var(--lbl); font-size: 13px; }
.c-give-t small { font: 11px var(--font-small); color: var(--mute); font-weight: normal; margin-left: 4px; }
.c-give-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.c-give-b { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 2px; border-bottom: 3px solid var(--oc, transparent); min-width: 0; }
.c-give-b b { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-give-b small { font: 10px var(--font-small); color: var(--mute); }
/* pause menu on the phone: change hero */
.c-heroes { margin-top: 4px; display: flex; flex-direction: column; gap: 6px; }
.c-hero-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.c-pmenu .c-hero-list { grid-template-columns: repeat(2, 1fr); }
.c-hero { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; border: 1.5px solid var(--btn-line); border-bottom: 3px solid var(--oc, transparent); border-radius: var(--btn-r); background: var(--btn-bg); color: var(--ink); font: inherit; cursor: pointer; }
.c-hero img { width: 36px; height: 36px; image-rendering: auto; border-radius: 5px; }
.c-hero b { font-size: 12px; }
.c-hero small { font: 10px var(--font-small); color: var(--mute); }
.c-hero.mine { background: var(--btn-pri); border-color: var(--btn-pri-line); }
.c-hero:disabled { opacity: 0.6; cursor: default; }
.c-swap-in, .c-swap-out { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; font: 13px var(--font-small); }
