/* ============================================================================
   La Suite Infernale — thème (fan game). Couleurs extraites du livret officiel.
   ============================================================================ */
@font-face { font-family: 'Bebas Neue'; src: url('../assets/fonts/bebas-neue.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 400; src: url('../assets/fonts/barlow-condensed-400.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; src: url('../assets/fonts/barlow-condensed-600.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; src: url('../assets/fonts/barlow-condensed-700.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Permanent Marker'; src: url('../assets/fonts/permanent-marker.woff2') format('woff2'); font-display: swap; }

:root {
  --navy: #001433; --navy-2: #06214a; --navy-3: #0a2d5c; --navy-4: #0f3a6e;
  --teal: #5ec4b8; --teal-glow: #7fe3d6; --teal-d: #2f8f86;
  --gold: #cfa640; --gold-2: #e7bd4f; --gold-d: #8a6a14;
  --pink: #ed3d75; --green: #2fbd74; --purple: #a63d96; --lime: #abd142; --orange: #f7a12a; --yellow: #f7e35a; --red: #f0484a;
  --text: #eaf3fa; --muted: #93abc2; --line: rgba(94, 196, 184, .28);
  --glass: linear-gradient(180deg, rgba(10, 45, 92, .72), rgba(3, 20, 48, .86));
  --font-ui: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --font-display: 'Bebas Neue', 'Barlow Condensed', Impact, sans-serif;
  --font-hand: 'Permanent Marker', cursive;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --cw: clamp(56px, min(13.2vw, 15.5vh), 124px);   /* width of a card in the hand */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 18px; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--navy); color: var(--text); font: 500 1rem/1.35 var(--font-ui); -webkit-font-smoothing: antialiased; touch-action: manipulation; overscroll-behavior: none; }
button { font: inherit; color: inherit; }
img { -webkit-user-drag: none; user-select: none; }
a { color: var(--teal); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--teal-glow); outline-offset: 2px; }

#app { position: fixed; inset: 0; overflow: hidden; background: radial-gradient(1400px 800px at 50% -15%, #0f4a72 0%, var(--navy-2) 42%, var(--navy) 100%); }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .6s; touch-action: none; }
#gl.on { opacity: 1; }
#screens { position: absolute; inset: 0; }
.screen { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.screen.game { overflow: hidden; pointer-events: none; }
.screen.game > * { pointer-events: auto; }

/* ------------------------------------------------------------------ boot */
#boot { position: absolute; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: radial-gradient(900px 600px at 50% 40%, #0d3a5e, var(--navy)); transition: opacity .5s, visibility .5s; }
#boot.done { opacity: 0; visibility: hidden; }
#boot img { width: min(70vw, 360px); height: auto; filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .5)); animation: float 3.2s ease-in-out infinite; }
#boot .bar { width: min(60vw, 260px); height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .12); overflow: hidden; }
#boot .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--gold)); border-radius: 99px; transition: width .2s; }
#boot p { margin: 0; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; font-size: .9rem; }
@keyframes float { 50% { transform: translateY(-8px); } }

/* ------------------------------------------------------------------ shared widgets */
/* decorative rays: a clipping layer fixed to the viewport holds a huge rotating square, faded long before its own
   edges, so no edge is ever visible on any screen ratio and the page itself never becomes scrollable because of it */
.rays { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.rays::before { content: ''; position: absolute; left: 50%; top: 50%; width: 150vmax; height: 150vmax; margin: -75vmax 0 0 -75vmax; background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(94, 196, 184, .085) 0 3deg, transparent 3deg 9deg); animation: spin 140s linear infinite; mask-image: radial-gradient(circle closest-side at 50% 50%, #000 0%, transparent 56%); -webkit-mask-image: radial-gradient(circle closest-side at 50% 50%, #000 0%, transparent 56%); will-change: transform; }
@keyframes spin { to { transform: rotate(360deg); } }
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 50px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .06); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; letter-spacing: .05em; margin: 0 0 .5em; }
h2 { font-size: 1.7rem; color: var(--teal); } h3 { font-size: 1.25rem; color: var(--gold-2); }
.muted { color: var(--muted); }

.btn { appearance: none; border: 0; cursor: pointer; font-family: var(--font-ui); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 1.05rem; padding: .62em 1.3em; border-radius: 12px; color: #1b1200; background: linear-gradient(180deg, var(--gold-2), #b98d28); box-shadow: 0 3px 0 var(--gold-d), 0 10px 22px rgba(0, 0, 0, .38); transition: transform .12s, filter .15s, box-shadow .12s; display: inline-flex; align-items: center; justify-content: center; gap: .55em; text-align: center; user-select: none; }
.btn:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--gold-d), 0 4px 10px rgba(0, 0, 0, .4); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }
.btn.teal { color: #00221f; background: linear-gradient(180deg, #8fe9de, var(--teal)); box-shadow: 0 3px 0 var(--teal-d), 0 10px 22px rgba(0, 0, 0, .38); }
.btn.ghost { color: var(--text); background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.danger { color: #fff; background: linear-gradient(180deg, #f5706e, #c12f31); box-shadow: 0 3px 0 #7d1517, 0 10px 22px rgba(0, 0, 0, .38); }
.btn.ghost.danger { color: #ffc4c3; background: rgba(240, 72, 74, .14); box-shadow: inset 0 0 0 1.5px var(--red); }       /* "Défausser" next to "Jouer": outlined, not the filled red of a confirmation */
.btn.big { font-size: 1.35rem; padding: .62em 1.4em; width: 100%; flex-direction: column; gap: 0; line-height: 1.12; }
.btn.big small { display: block; font-size: .72em; font-weight: 600; letter-spacing: .04em; opacity: .75; text-transform: none; }
.btn.sm { font-size: .9rem; padding: .35em .8em; border-radius: 9px; box-shadow: none; }
.iconbtn { appearance: none; border: 1px solid var(--line); background: rgba(0, 12, 34, .55); color: var(--text); width: 42px; height: 42px; border-radius: 12px; font-size: 1.15rem; cursor: pointer; display: grid; place-items: center; backdrop-filter: blur(6px); transition: background .15s, transform .1s; }
.iconbtn:hover { background: rgba(94, 196, 184, .2); }
.iconbtn:active { transform: scale(.94); }
.iconbtn.on { background: rgba(207, 166, 64, .25); border-color: var(--gold); }
input[type=text], input[type=number], select { width: 100%; padding: .55em .8em; border-radius: 11px; border: 1.5px solid var(--line); background: rgba(0, 10, 30, .62); color: var(--text); font: 600 1.1rem var(--font-ui); outline: none; }
input:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(94, 196, 184, .22); }
label.lbl { display: block; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-size: .78rem; margin-bottom: 5px; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; background: rgba(94, 196, 184, .18); color: var(--teal-glow); }
.pill.gold { background: rgba(207, 166, 64, .2); color: var(--gold-2); } .pill.red { background: rgba(240, 72, 74, .2); color: #ff9a9c; } .pill.pink { background: rgba(237, 61, 117, .2); color: #ff8fb4; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { appearance: none; width: 46px; height: 26px; border-radius: 99px; background: rgba(255, 255, 255, .16); position: relative; flex: none; cursor: pointer; transition: background .2s; border: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--teal); } .switch input:checked::after { transform: translateX(20px); }
input[type=range] { width: 100%; accent-color: var(--teal); }

/* ------------------------------------------------------------------ menu */
.menu { display: flex; flex-direction: column; align-items: center; min-height: 100%; padding: calc(18px + var(--safe-t)) 16px 0; }
.menu-inner { position: relative; width: min(100%, 460px); margin: auto 0; padding: 10px 0 24px; display: flex; flex-direction: column; gap: 16px; align-items: stretch; animation: rise .6s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } }
.menu .logo { width: min(86%, 380px); margin: 0 auto; filter: drop-shadow(0 10px 26px rgba(0, 0, 0, .55)); animation: float 5s ease-in-out infinite; }
.menu .tagline { text-align: center; margin: -6px 0 2px; font-family: var(--font-hand); font-size: 1.15rem; color: var(--teal-glow); transform: rotate(-1.5deg); text-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.banner { text-align: center; padding: 9px 14px; border-radius: 12px; font-weight: 600; background: rgba(207, 166, 64, .16); border: 1px solid rgba(207, 166, 64, .5); color: var(--gold-2); }
.banner.maint { background: rgba(240, 72, 74, .16); border-color: rgba(240, 72, 74, .55); color: #ff9a9c; }
.profile { padding: 14px 16px 12px; }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-top: 10px; }
.avatars button { aspect-ratio: 1; border-radius: 12px; border: 1.5px solid transparent; background: rgba(255, 255, 255, .06); font-size: 1.5rem; cursor: pointer; transition: transform .12s, background .15s; padding: 0; }
.avatars button:hover { transform: scale(1.1); background: rgba(94, 196, 184, .2); }
.avatars button.sel { border-color: var(--gold-2); background: rgba(207, 166, 64, .22); }
.actions { display: flex; flex-direction: column; gap: 11px; }
.join { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.join input { text-transform: uppercase; letter-spacing: .3em; text-align: center; font-family: var(--font-display); font-size: 1.55rem; padding: .3em; }
.link { appearance: none; background: none; border: 0; color: var(--teal); cursor: pointer; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .95rem; padding: 6px 4px; }
.link:hover { color: var(--teal-glow); text-decoration: underline; }
.resume { padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.resume b { font-family: var(--font-display); font-size: 1.4rem; letter-spacing: .12em; color: var(--gold-2); }
.resume .grow { flex: 1; }

/* legal / credit */
.legal { position: relative; width: 100%; text-align: center; color: var(--muted); font-size: .92rem; padding: 14px 18px calc(16px + var(--safe-b)); line-height: 1.35; }
.legal p { margin: 0 auto; max-width: 560px; }
.legal .heart { color: var(--red); } .legal strong { color: var(--gold-2); font-weight: 700; }
.legal a { color: var(--teal); }

/* ------------------------------------------------------------------ lobby */
.lobby { display: flex; flex-direction: column; min-height: 100%; padding: calc(14px + var(--safe-t)) 14px 0; }
.lobby-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; max-width: 1020px; width: 100%; margin: 0 auto 14px; }
.codebox { display: flex; align-items: center; gap: 12px; padding: 8px 16px; }
.codebox .lbl { margin: 0; }
.codebox b { font-family: var(--font-display); font-size: 2.4rem; letter-spacing: .22em; color: var(--gold-2); line-height: 1; text-shadow: 0 0 20px rgba(207, 166, 64, .35); }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; max-width: 1020px; width: 100%; margin: 0 auto; flex: 1; align-content: start; }
.panel { padding: 16px 18px; }
.seats { display: flex; flex-direction: column; gap: 9px; }
.seat { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1.5px solid transparent; transition: background .2s; }
.seat.me { border-color: rgba(207, 166, 64, .6); background: rgba(207, 166, 64, .08); }
.seat.teamA { box-shadow: inset 5px 0 0 var(--teal); } .seat.teamB { box-shadow: inset 5px 0 0 var(--gold); }
.seat .av { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; background: radial-gradient(circle at 35% 30%, #1f5d8c, var(--navy-3)); border: 2px solid var(--line); }
.seat.empty .av { background: transparent; border-style: dashed; color: var(--muted); font-size: 1.1rem; }
.seat .nm { font-weight: 700; font-size: 1.15rem; line-height: 1.1; }
.seat .sub { color: var(--muted); font-size: .9rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.seat .ctl { display: flex; gap: 5px; }
.seat .ctl .btn { padding: .28em .62em; font-size: .85rem; }
.opts { display: flex; flex-direction: column; gap: 14px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; padding: 4px; background: rgba(0, 10, 30, .55); border-radius: 12px; border: 1px solid var(--line); }
.seg button { appearance: none; border: 0; background: transparent; color: var(--muted); font-weight: 700; letter-spacing: .05em; padding: .5em .4em; border-radius: 9px; cursor: pointer; text-transform: uppercase; font-size: .92rem; }
.seg button.on { background: linear-gradient(180deg, var(--gold-2), #b98d28); color: #1b1200; }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.lobby-foot { position: sticky; bottom: 0; margin-top: 14px; padding: 12px 0 calc(8px + var(--safe-b)); display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; background: linear-gradient(0deg, var(--navy) 55%, transparent); }
.rules-mini { color: var(--muted); font-size: .95rem; }

/* ------------------------------------------------------------------ in-game HUD */
.topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 10px 8px; background: linear-gradient(180deg, rgba(0, 8, 24, .78), transparent); z-index: 20; }
.topbar .room { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.topbar .room b { font-family: var(--font-display); font-size: 1.3rem; color: var(--gold-2); letter-spacing: .16em; margin-left: 4px; }
.topbar .grow { flex: 1; }
.turn-banner { position: absolute; left: 50%; top: calc(8px + var(--safe-t)); transform: translateX(-50%); z-index: 21; padding: 5px 20px; border-radius: 99px; font-family: var(--font-display); font-size: 1.35rem; letter-spacing: .1em; background: rgba(0, 12, 34, .72); border: 1.5px solid var(--line); white-space: nowrap; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; transition: background .3s, border-color .3s, color .3s; pointer-events: none; }
.turn-banner.mine { background: linear-gradient(180deg, rgba(231, 189, 79, .95), rgba(185, 141, 40, .95)); color: #1b1200; border-color: #ffe9a8; animation: pulseBanner 1.6s ease-in-out infinite; }
.turn-banner.react { background: rgba(240, 72, 74, .85); border-color: #ff9a9c; color: #fff; }
@keyframes pulseBanner { 50% { box-shadow: 0 0 26px rgba(231, 189, 79, .8); } }

#plates { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.plate { position: absolute; transform: translate(0, calc(-100% - 5px)); display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 18px; background: rgba(0, 12, 34, .78); border: 1.5px solid var(--line); backdrop-filter: blur(6px); pointer-events: auto; transition: border-color .25s, box-shadow .25s, background .25s, opacity .25s; white-space: nowrap; will-change: left, top; }
.plate .av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 1.35rem; background: radial-gradient(circle at 35% 30%, #1f5d8c, var(--navy-3)); border: 2px solid var(--line); flex: none; }
.plate .info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.plate .top { display: flex; align-items: center; gap: 8px; }
.plate .nm { font-weight: 700; font-size: 1rem; line-height: 1; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.plate .stt { font-size: .74rem; color: var(--muted); }
.plate .pips { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; }
.pip { display: block; height: 14px; min-width: 11px; border-radius: 3px; background: rgba(255, 255, 255, .1); font: 700 .62rem/14px var(--font-ui); text-align: center; color: transparent; }
.pip.n { background: linear-gradient(180deg, #8fe9de, var(--teal)); color: #00322d; }
.pip.j { background: linear-gradient(180deg, #ff8fb4, var(--pink)); color: #4a0720; }
.pip.done { background: linear-gradient(180deg, var(--gold-2), #b98d28); color: #2a1c00; }
.plate .cnt { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; color: var(--teal-glow); font-size: .9rem; }
.plate .cnt i { display: inline-block; width: 11px; height: 15px; border-radius: 2px; background: linear-gradient(135deg, var(--navy-4), var(--navy-2)); border: 1.5px solid var(--teal); }
.plate.me .av { border-color: var(--gold-2); } .plate.teamA .av { border-color: var(--teal); } .plate.teamB .av { border-color: var(--gold); }
.plate.active { border-color: var(--gold-2); box-shadow: 0 0 0 2px rgba(231, 189, 79, .35), 0 0 24px rgba(231, 189, 79, .55); background: rgba(40, 28, 0, .85); }
.plate.away { opacity: .55; }
.plate.selectable { cursor: pointer; border-color: var(--teal-glow); animation: pulsePlate 1s ease-in-out infinite; }
.plate.selectable:hover { background: rgba(94, 196, 184, .3); transform: translate(0, calc(-100% - 5px)) scale(1.05); }
.plate.dim { opacity: .35; }
@keyframes pulsePlate { 50% { box-shadow: 0 0 22px rgba(127, 227, 214, .75); } }
.plate .emote { position: absolute; left: 50%; top: -34px; transform: translateX(-50%); font-size: 1.7rem; animation: emote 2.2s ease-out forwards; pointer-events: none; }
@keyframes emote { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.4); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1.2); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -22px) scale(1); } }

.pile-label { position: absolute; transform: translate(-50%, 0); text-align: center; pointer-events: none; z-index: 5; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; color: var(--muted); text-shadow: 0 1px 6px #000; }
.pile-label b { display: block; font-family: var(--font-display); font-size: 1.15rem; color: var(--text); letter-spacing: .04em; }

/* prompt (what to do now) */
#prompt { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--hand-h, 30vh) + 6px); z-index: 25; display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 16px; border-radius: 14px; background: rgba(0, 12, 34, .88); border: 1.5px solid var(--teal); box-shadow: 0 8px 28px rgba(0, 0, 0, .5); max-width: calc(100vw - 20px); animation: rise .3s both; }
#prompt .msg { font-weight: 700; font-size: 1.1rem; }
#prompt.must { border-color: var(--gold-2); } #prompt.danger { border-color: var(--red); }

/* hand */
#hand { position: absolute; left: 0; right: 0; bottom: 0; height: var(--hand-h, 30vh); z-index: 15; pointer-events: none; padding-bottom: var(--safe-b); }
#hand .fan { position: absolute; left: 50%; bottom: 0; width: 0; height: 0; }
.hcard { position: absolute; bottom: calc(-0.28 * var(--cw) * 1.515); left: calc(var(--cw) / -2); width: var(--cw); aspect-ratio: 0.66; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; transform-origin: 50% 130%; transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0deg)); transition: transform .22s cubic-bezier(.2, .9, .3, 1.2), filter .2s, opacity .25s; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .55)); z-index: var(--z, 1); }
.hcard img { width: 100%; height: 100%; display: block; pointer-events: none; }
.hcard.dim { filter: brightness(.55) saturate(.6) drop-shadow(0 6px 10px rgba(0, 0, 0, .55)); }
.hcard.playable::after { content: ''; position: absolute; inset: -3px; border-radius: 9%; box-shadow: 0 0 0 2px var(--teal-glow), 0 0 18px rgba(127, 227, 214, .75); pointer-events: none; animation: glowc 1.6s ease-in-out infinite; }
@keyframes glowc { 50% { opacity: .45; } }
.hcard.discardable::after { content: ''; position: absolute; inset: -3px; border-radius: 9%; box-shadow: 0 0 0 2px var(--red), 0 0 16px rgba(240, 72, 74, .7); pointer-events: none; }
.hcard.stopready::after { content: ''; position: absolute; inset: -3px; border-radius: 9%; box-shadow: 0 0 0 3px var(--red), 0 0 26px rgba(240, 72, 74, .95); pointer-events: none; animation: glowc .7s ease-in-out infinite; }
@media (hover: hover) {
  .hcard:hover { transform: translate(var(--x, 0), calc(var(--y, 0px) - calc(var(--cw) * .5))) rotate(0deg) scale(1.1); z-index: 99; }
}
.hcard.sel { transform: translate(var(--x, 0), calc(var(--y, 0px) - calc(var(--cw) * .42))) rotate(0deg) scale(1.1); z-index: 100; }
.hcard.sel::before { content: ''; position: absolute; inset: -4px; border-radius: 9%; box-shadow: 0 0 0 3px var(--gold-2), 0 0 24px rgba(231, 189, 79, .8); pointer-events: none; }

/* suite chooser (attack targets, several suites) */
.suitepanel { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--hand-h, 30vh) + 62px); z-index: 24; width: min(96vw, 800px); max-height: calc(100vh - var(--hand-h, 30vh) - 140px); overflow-y: auto; padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 8px; border-color: var(--accent, var(--teal)); animation: rise .25s both; --spw: min(clamp(40px, 7.4vh, 58px), calc((100vw - 74px) / 10.4)); }
.sp-suite { padding: 4px 6px 6px; border-radius: 12px; background: rgba(255, 255, 255, .04); }
.sp-suite.clickable { cursor: pointer; transition: background .15s; box-shadow: inset 0 0 0 1.5px transparent; }
.sp-suite.clickable:hover { background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1.5px var(--accent); }
.sp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 1rem; }
.sp-head .av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-3); font-size: 1rem; }
.sp-grid { display: grid; grid-template-columns: repeat(10, var(--spw)); gap: 4px; justify-content: center; }
.sp-card { padding: 0; border: 0; background: none; border-radius: 8%; cursor: pointer; transition: transform .12s, filter .15s; position: relative; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .5)); }
.sp-card img { width: 100%; display: block; pointer-events: none; }
/* a Joker +2 covers two slots but stays ONE card: normal size, centred on them (the ring follows the card, not the two slots) */
.sp-card.wide { width: var(--spw); justify-self: center; }
.sp-card:disabled { filter: grayscale(.8) brightness(.55); cursor: default; }
.sp-card:not(:disabled):hover { transform: translateY(-5px) scale(1.07); z-index: 2; }
.sp-card:not(:disabled)::after { content: ''; position: absolute; inset: -2px; border-radius: 9%; box-shadow: 0 0 0 2px var(--accent), 0 0 14px var(--accent); animation: glowc 1.4s ease-in-out infinite; pointer-events: none; }
.sp-empty { aspect-ratio: .66; border: 2px dashed rgba(94, 196, 184, .3); border-radius: 8%; display: grid; place-items: center; color: rgba(94, 196, 184, .4); font-family: var(--font-hand); font-size: 1.2rem; }
.hcard.entering { animation: enter .55s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes enter { from { opacity: 0; transform: translate(var(--fx, 0), var(--fy, -60vh)) scale(.45) rotate(-14deg); } }
.hcard.leaving { opacity: 0; pointer-events: none; transform: translate(var(--x, 0), -40vh) scale(.5); }
.cardtip { position: absolute; z-index: 120; width: min(300px, 90vw); padding: 12px 14px; border-radius: 14px; background: rgba(0, 10, 28, .96); border: 1.5px solid var(--accent, var(--teal)); box-shadow: 0 14px 40px rgba(0, 0, 0, .6); pointer-events: none; animation: rise .2s both; }
.cardtip h4 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; letter-spacing: .06em; color: var(--accent, var(--teal)); }
.cardtip p { margin: 0; font-size: .98rem; line-height: 1.3; color: var(--text); }
.cardtip small { display: block; margin-top: 6px; color: var(--muted); }
.cardtip .go { margin-top: 9px; display: flex; gap: 8px; }

/* STOP window / played card stage */
#stage { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding-bottom: calc(var(--hand-h, 30vh) * .5); background: radial-gradient(circle at 50% 44%, rgba(0, 4, 16, .78), rgba(0, 4, 16, .3) 75%); animation: fadein .2s both; }
@keyframes fadein { from { opacity: 0; } }
#stage .box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 14px; max-width: min(94vw, 480px); text-align: center; }
#stage .chain { display: flex; align-items: center; justify-content: center; padding: 6px 0 10px; }
#stage .scard { position: relative; width: clamp(92px, min(19vh, 34vw), 176px); margin: 0 -6px; filter: drop-shadow(0 16px 26px rgba(0, 0, 0, .7)); animation: stageIn .5s cubic-bezier(.2, .9, .3, 1.25) both; }
#stage .scard.stop { animation: stageStop .45s cubic-bezier(.2, .9, .3, 1.3) both; }
#stage .scard img { width: 100%; display: block; }
#stage .scard.cancelled { filter: grayscale(1) brightness(.5) drop-shadow(0 16px 26px rgba(0, 0, 0, .7)); }
#stage .scard.cancelled::after { content: '✖'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 4rem; color: var(--red); text-shadow: 0 0 20px #000; }
#stage .by { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .9rem; color: var(--muted); }
#stage .what { font-family: var(--font-display); font-size: clamp(1.3rem, 4.6vw, 1.9rem); letter-spacing: .06em; line-height: 1.12; text-shadow: 0 3px 14px #000; }
#stage .what em { font-style: normal; color: var(--accent, var(--gold-2)); }
#stage .count { width: min(80vw, 300px); height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .16); overflow: hidden; }
#stage .count i { display: block; height: 100%; width: 100%; transform-origin: left; background: linear-gradient(90deg, var(--red), var(--gold-2)); }
#stage .btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
#stage .stopbtn { font-family: var(--font-display); font-size: clamp(1.7rem, 6vw, 2.2rem); letter-spacing: .08em; padding: .15em 1.1em; background: linear-gradient(180deg, #ff6b69, #c4282b); color: #fff; box-shadow: 0 4px 0 #761215, 0 0 34px rgba(240, 72, 74, .75); animation: pulseStop .9s ease-in-out infinite; }
@keyframes pulseStop { 50% { transform: scale(1.06); } }
@keyframes stageIn { from { opacity: 0; transform: translateY(70px) scale(.5) rotate(-8deg); } }
@keyframes stageStop { from { opacity: 0; transform: translateY(-90px) scale(1.9) rotate(14deg); } }

/* log */
#log { position: absolute; left: 8px; top: calc(56px + var(--safe-t)); width: min(300px, 62vw); z-index: 12; font-size: .92rem; pointer-events: none; display: flex; flex-direction: column; gap: 3px; }
#log .l { background: rgba(0, 10, 28, .66); border-left: 3px solid var(--line); padding: 3px 9px; border-radius: 0 8px 8px 0; animation: logIn .35s both; color: #cfe2f1; transition: opacity 1.2s; }
#log .l b { color: var(--gold-2); font-weight: 700; }
#log .l.x { opacity: 0; }
#log .l.atk { border-color: var(--red); } #log .l.sp { border-color: var(--purple); } #log .l.ok { border-color: var(--teal); } #log .l.win { border-color: var(--gold-2); }
@keyframes logIn { from { opacity: 0; transform: translateX(-20px); } }
#log.expanded { pointer-events: auto; max-height: 55vh; overflow-y: auto; background: rgba(0, 8, 24, .8); border-radius: 12px; padding: 6px; }
#log.expanded .l.x { opacity: 1; }

/* emote wheel */
.emotes { position: absolute; right: 10px; top: calc(56px + var(--safe-t)); z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px; border-radius: 14px; animation: rise .2s both; }
.emotes button { font-size: 1.6rem; width: 46px; height: 46px; border-radius: 12px; border: 0; background: rgba(255, 255, 255, .08); cursor: pointer; }
.emotes button:hover { background: rgba(94, 196, 184, .3); transform: scale(1.12); }

/* ------------------------------------------------------------------ modals / toasts */
#modals { position: absolute; inset: 0; z-index: 60; pointer-events: none; }
.modal-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(0, 6, 20, .72); backdrop-filter: blur(5px); pointer-events: auto; animation: fadein .2s both; }
.modal { width: min(100%, 560px); max-height: calc(100vh - 28px); display: flex; flex-direction: column; overflow: hidden; animation: pop .3s cubic-bezier(.2, .9, .3, 1.2) both; }
.modal.wide { width: min(100%, 880px); }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(14px); } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 8px; }
.modal-head h2 { margin: 0; flex: 1; }
.modal-body { padding: 4px 18px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-foot { padding: 10px 18px 16px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); }
.modal-body h3 { margin: 18px 0 6px; } .modal-body p { margin: 0 0 8px; }
.modal-body ul { margin: 4px 0 10px; padding-left: 20px; } .modal-body li { margin-bottom: 4px; }
.setrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.setrow:last-child { border-bottom: 0; }
.setrow .d { color: var(--muted); font-size: .9rem; }
.rulecards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 10px 0; }
.rulecard { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: start; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); border-left: 4px solid var(--accent, var(--teal)); }
.rulecard img { width: 100%; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); cursor: zoom-in; }
.rulecard h4 { margin: 0; font-family: var(--font-display); font-weight: 400; letter-spacing: .05em; font-size: 1.25rem; color: var(--accent, var(--teal)); }
.rulecard h4 small { font-family: var(--font-ui); color: var(--muted); font-size: .8rem; margin-left: 6px; }
.rulecard p { margin: 3px 0 0; font-size: .95rem; line-height: 1.28; }
.callout { padding: 10px 14px; border-radius: 12px; background: rgba(207, 166, 64, .1); border: 1px solid rgba(207, 166, 64, .4); margin: 10px 0; font-size: .96rem; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 8px; }
.tabs button { appearance: none; border: 1.5px solid var(--line); background: transparent; color: var(--muted); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .35em .9em; border-radius: 99px; cursor: pointer; font-size: .9rem; }
.tabs button.on { background: rgba(207, 166, 64, .2); color: var(--gold-2); border-color: var(--gold); }
.over { text-align: center; padding: 8px 6px 4px; }
.over .big { font-family: var(--font-display); font-size: clamp(2.6rem, 9vw, 4.2rem); line-height: 1; letter-spacing: .06em; color: var(--gold-2); text-shadow: 0 0 34px rgba(207, 166, 64, .55); margin: 6px 0; }
.over .big.lose { color: var(--muted); text-shadow: none; }
.podium { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.podium .who { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.podium .who .av { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 2.2rem; background: radial-gradient(circle at 35% 30%, #1f5d8c, var(--navy-3)); border: 3px solid var(--gold-2); box-shadow: 0 0 26px rgba(207, 166, 64, .55); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 8px; }
.stats-grid div { background: rgba(255, 255, 255, .06); border-radius: 12px; padding: 8px; text-align: center; }
.stats-grid b { display: block; font-family: var(--font-display); font-size: 1.8rem; color: var(--gold-2); line-height: 1.1; }
.stats-grid span { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.zoom-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px; max-width: min(92vw, 380px); }
.zoom-card img { width: min(70vw, 300px); filter: drop-shadow(0 18px 34px rgba(0, 0, 0, .7)); }

#toasts { position: absolute; left: 0; right: 0; top: calc(60px + var(--safe-t)); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { padding: 9px 18px; border-radius: 12px; background: rgba(0, 10, 28, .94); border: 1.5px solid var(--teal); font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: toast 3.6s both; max-width: 92vw; text-align: center; }
.toast.err { border-color: var(--red); color: #ffb3b4; } .toast.warn { border-color: var(--gold-2); color: var(--gold-2); } .toast.ok { border-color: var(--green); }
@keyframes toast { 0% { opacity: 0; transform: translateY(-14px) scale(.95); } 8%, 86% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-8px); } }
.netstate { position: absolute; left: 50%; bottom: calc(var(--hand-h, 30vh) + 60px); transform: translateX(-50%); z-index: 70; padding: 6px 16px; border-radius: 99px; background: rgba(240, 72, 74, .9); font-weight: 700; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 760px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .codebox b { font-size: 2rem; }
  .turn-banner { top: calc(54px + var(--safe-t)); font-size: 1.05rem; padding: 3px 14px; max-width: 80vw; }
  .plate .nm { max-width: 84px; font-size: .92rem; }
  #prompt .msg { font-size: .98rem; }
  #log { top: calc(92px + var(--safe-t)); }
  .topbar .room { display: none; }
  .plate .nm { max-width: 74px; font-size: .9rem; } .plate .av { width: 32px; height: 32px; font-size: 1.1rem; }
  #stage .what { font-size: 1.5rem; }
}
@media (max-height: 520px) and (orientation: landscape) {
  :root { --cw: clamp(48px, 12vh, 84px); }
  .turn-banner { top: 4px; font-size: 1.05rem; }
  #log:not(.expanded) { display: none; }
  #log.expanded { top: 52px; width: min(380px, 52vw); max-height: calc(100vh - 62px); }
  /* three opponents side by side on a very flat screen: compact name plates (each as wide as its suite), labels above the piles */
  .game .plate { gap: 5px; padding: 3px 8px 3px 3px; border-radius: 14px; }
  .game .plate .av { width: 26px; height: 26px; font-size: .95rem; border-width: 1.5px; }
  .game .plate .nm { max-width: 64px; font-size: .8rem; }
  .game .plate .vis, .game .plate .tag, .game .plate .stt { display: none; }
  .game .plate .cnt { font-size: .78rem; } .game .plate .cnt i { width: 9px; height: 12px; }
  .game .plate .pips { gap: 1px; } .game .pip { height: 10px; min-width: 7px; font: 700 .5rem/10px var(--font-ui); }
  .game .pile-label { transform: translate(-50%, -100%); font-size: .58rem; letter-spacing: .06em; line-height: 1; white-space: nowrap; }
  .game .pile-label b { display: inline; margin-left: 4px; font-size: .85rem; }
  /* the team score sits in the free left margin instead of covering the opponents */
  .game .teambar { top: calc(56px + var(--safe-t)); left: calc(8px + var(--safe-l, 0px)); transform: none; flex-direction: column; gap: 5px; }
  .game .tchip { font-size: .78rem; padding: 2px 10px 2px 8px; } .game .tchip b { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .rays::before { animation: none; }
}

/* sound shortcuts */
.sndbtns { display: flex; gap: 6px; }
.iconbtn { position: relative; }
.iconbtn.off { opacity: .6; }
.iconbtn.off::after { content: ''; position: absolute; left: 22%; right: 22%; top: 50%; height: 2.5px; border-radius: 2px; background: #ff6b69; transform: rotate(-45deg); box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.menu-snd { position: absolute; top: calc(10px + var(--safe-t)); right: 10px; z-index: 5; }

/* ================================================================== accounts, cosmetics, leaderboard, recap */
.pname { font-weight: 700; }
.pn .vis { color: var(--muted); font-weight: 600; font-size: .78em; letter-spacing: .02em; }
.fx-gold { background: linear-gradient(100deg, #b98d28, #ffe27a 35%, #fff3b8 50%, #ffd24a 65%, #b98d28); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; animation: shine 3.2s linear infinite; filter: drop-shadow(0 0 5px rgba(231, 189, 79, .45)); }
.fx-rainbow { background: linear-gradient(90deg, #ff5f6d, #ffc371, #f7f06d, #5ee38c, #5ec4f8, #b48cff, #ff5f6d); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; animation: rainbow 4s linear infinite; }
.fx-color { text-shadow: 0 0 10px currentColor; }
@keyframes shine { to { background-position: -220% 0; } }
@keyframes rainbow { to { background-position: -300% 0; } }

/* avatar frames: textured ring (border-box layer) around the avatar */
.av { --avbg: radial-gradient(circle at 35% 30%, #1f5d8c, var(--navy-3)); }
.av[class*="frame-"] { border: 3px solid transparent !important; background-origin: border-box; background-clip: padding-box, border-box; }
.frame-wood { background: var(--avbg) padding-box, repeating-linear-gradient(100deg, #9a6a35 0 4px, #6f4521 4px 8px, #8a5a2b 8px 11px) border-box !important; }
.frame-bronze { background: var(--avbg) padding-box, linear-gradient(135deg, #f0b27a, #8a4f1f 45%, #e09a5c 70%, #7a431a) border-box !important; box-shadow: 0 0 10px rgba(205, 127, 50, .45); }
.frame-silver { background: var(--avbg) padding-box, linear-gradient(135deg, #ffffff, #8e9aa6 40%, #e4eaf0 65%, #7d8892) border-box !important; box-shadow: 0 0 12px rgba(220, 230, 240, .45); }
.frame-gold { background: var(--avbg) padding-box, linear-gradient(135deg, #fff1a8, #c8921f 40%, #ffd24a 65%, #9c6f12) border-box !important; box-shadow: 0 0 14px rgba(231, 189, 79, .65); }
.frame-diamond { background: var(--avbg) padding-box, conic-gradient(from 0deg, #bff6ff, #ffffff, #5ec4f8, #e6fbff, #7fe3d6, #bff6ff) border-box !important; box-shadow: 0 0 16px rgba(127, 227, 214, .75), 0 0 4px #fff; animation: gem 3s ease-in-out infinite; }
.frame-master { background: var(--avbg) padding-box, conic-gradient(from 0deg, #b48cff, #ed3d75, #5b2bd6, #e6c6ff, #b48cff) border-box !important; box-shadow: 0 0 16px rgba(180, 140, 255, .75); animation: gem 3.6s ease-in-out infinite; }
.frame-challenger { background: var(--avbg) padding-box, conic-gradient(from 0deg, #ffe27a, #f0484a, #ff9d2e, #fff3b8, #f0484a, #ffe27a) border-box !important; box-shadow: 0 0 20px rgba(240, 72, 74, .8), 0 0 8px rgba(255, 210, 74, .8); animation: gem 2.2s ease-in-out infinite; }
@keyframes gem { 50% { filter: brightness(1.3) saturate(1.15); } }
.av.big { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 2.2rem; background: var(--avbg); border: 3px solid var(--line); flex: none; }
.av.sm { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 1.05rem; background: var(--avbg); border: 2px solid var(--line); flex: none; }
.av.sm[class*="frame-"] { border-width: 2.5px !important; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.podium .who { flex-direction: column; }
.podium .who .av[class*="frame-"] { border-width: 4px !important; }

/* forms in modals */
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack > * { margin: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 0; }
input[type=password], input[type=search], textarea { width: 100%; padding: .55em .8em; border-radius: 11px; border: 1.5px solid var(--line); background: rgba(0, 10, 30, .62); color: var(--text); font: 600 1.1rem var(--font-ui); outline: none; }
input[type=password]:focus, input[type=search]:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(94, 196, 184, .22); }
textarea { resize: vertical; min-height: 4.2em; }
input[type=color] { width: 64px; height: 38px; padding: 2px; border-radius: 10px; border: 1.5px solid var(--line); background: rgba(0, 10, 30, .62); cursor: pointer; }
.formerr { color: #ff9a9c; font-weight: 700; min-height: 1.2em; }
.fine { font-size: .85rem; color: var(--muted); margin: 0; }
.auth .tabs, .tabs { display: flex; gap: 6px; }
.tabs button.on { background: rgba(207, 166, 64, .2); color: var(--gold-2); border-color: var(--gold-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { appearance: none; border: 1.5px solid var(--line); background: rgba(255, 255, 255, .05); color: var(--text); font-weight: 700; padding: .3em .8em; border-radius: 99px; cursor: pointer; font-size: .95rem; }
.chip.sel { border-color: var(--gold-2); background: rgba(207, 166, 64, .2); color: var(--gold-2); }
.chip.static { cursor: default; }
.acct-prev { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .05); font-size: 1.5rem; }
.colorrow { display: flex; align-items: center; gap: 12px; }
.fold summary { cursor: pointer; font-weight: 700; color: var(--teal); }
.fold[open] summary { margin-bottom: 10px; }
.achlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.ach { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, .04); opacity: .55; }
.ach.ok { opacity: 1; background: rgba(207, 166, 64, .12); box-shadow: inset 0 0 0 1px rgba(207, 166, 64, .5); }
.ach .ico { font-size: 1.3rem; }
.banned { color: #ff9a9c; font-weight: 700; font-size: 1.2rem; }
.clickable { cursor: pointer; } .clickable:hover { text-decoration: underline; }

/* menu */
.profile.acct { display: flex; align-items: center; gap: 12px; }
.visitor-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-weight: 600; font-size: .95rem; }
.levelbox { padding: 10px 16px 12px; }
.levelbox .lbl { margin-bottom: 6px; }
.lvlsel { width: auto !important; padding: .2em .5em !important; font-size: .9rem !important; }

/* leaderboard */
.lb-wrap { overflow-x: auto; transition: opacity .2s; } .lb-wrap.loading { opacity: .5; }
table.lb, table.recap { width: 100%; border-collapse: collapse; }
.lb th, .recap th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; text-align: left; padding: 6px 8px; font-weight: 700; }
.lb td, .recap td { padding: 7px 8px; border-top: 1px solid rgba(94, 196, 184, .14); vertical-align: middle; }
.lb .num, .recap .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb tbody tr { cursor: pointer; } .lb tbody tr:hover { background: rgba(94, 196, 184, .1); }
.lb tr.me { background: rgba(207, 166, 64, .12); } .lb tr.unq { opacity: .6; }
.lb .rk { width: 2.4em; font-family: var(--font-display); font-size: 1.15rem; color: var(--gold-2); text-align: center; }
.lb .empty { text-align: center; padding: 22px; }
.lb-sort { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; }

/* end-of-game recap */
.overmodal .modal-body { padding-bottom: 6px; }
.recap-title { margin: 14px 0 6px; color: var(--teal-glow); }
.recap-wrap { text-align: left; overflow-x: auto; }
.recap th .ico { display: none; }
.recap-wrap .fine { text-align: center; margin-top: 6px; }
.rc-row { cursor: pointer; opacity: 0; transform: translateX(-26px); animation: rcIn .5s cubic-bezier(.2, .9, .3, 1.1) forwards; }
.rc-row:hover { background: rgba(94, 196, 184, .1); }
.rc-row.win { background: linear-gradient(90deg, rgba(207, 166, 64, .2), transparent); }
.rc-row.me .pname { text-decoration: underline dotted; }
@keyframes rcIn { to { opacity: 1; transform: none; } }
.rc-name { display: flex; flex-direction: column; min-width: 0; }
.rc-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.rc-flags .flag { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 0 7px; border-radius: 99px; background: rgba(255, 255, 255, .1); color: var(--muted); animation: fadein .5s both; }
.rc-flags .flag.unlock { background: rgba(207, 166, 64, .25); color: var(--gold-2); }
.crown { font-size: 1.1rem; animation: crown 1.6s ease-in-out infinite; }
@keyframes crown { 50% { transform: translateY(-3px) rotate(-8deg); } }
.recap td.top { color: var(--gold-2); font-weight: 800; text-shadow: 0 0 12px rgba(231, 189, 79, .6); }
.recap td.top::before { content: '▲ '; font-size: .7em; vertical-align: 2px; }
.rc-act { width: 46px; text-align: center; }
.iconbtn.flag { width: 34px; height: 34px; font-size: .95rem; opacity: .75; } .iconbtn.flag:hover { opacity: 1; background: rgba(240, 72, 74, .3); }

@media (max-width: 640px) {
  .recap th .lab { display: none; } .recap th .ico { display: inline; }
  .recap th, .recap td { padding: 6px 4px; }
  .lb th:nth-child(7), .lb td:nth-child(7), .lb th:nth-child(6), .lb td:nth-child(6) { display: none; }
  .achlist { grid-template-columns: 1fr; }
}

/* legal footer on two lines */
.legal p { max-width: 640px; }@media (min-width: 761px) { .plate .nm { max-width: 190px; } }
@media (max-width: 760px) { .plate .vis { display: none; } }
.plate .nm { display: inline-block; vertical-align: bottom; white-space: nowrap; }

/* install / full screen proposal (phones) */
.pwa-card { position: absolute; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 95; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; max-width: 460px; margin: 0 auto; animation: rise .4s both; }
.pwa-card p { margin: 4px 0 0; color: var(--muted); font-size: .95rem; }
.pwa-b { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.rc-who { min-width: 170px; }
.rc-flags .flag { white-space: nowrap; }
.rc-name .pn { white-space: nowrap; }
.avatars.compact { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); margin-top: 6px; }
.avatars.compact button { font-size: 1.35rem; }
.av.big[class*="frame-"] { border-width: 4px !important; }
/* phones in portrait: bigger cards, easier to tap */
@media (max-width: 760px) and (orientation: portrait) { :root { --cw: clamp(66px, 19vw, 96px); } }
@media (max-width: 640px) {
  .recap th:nth-child(n+6):nth-child(-n+8), .recap td:nth-child(n+6):nth-child(-n+8) { display: none; }
  .rc-who { min-width: 0; }
  .rc-act { width: 40px; }
}


/* ================================================================== v3: scrollbars, gate, tiles, teams, rules */
/* scrollbars: slim, rounded, golden (Chrome / Edge / Safari), thin and gold in Firefox */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: rgba(0, 10, 30, .35); border-radius: 12px; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #ecc65a, #a67c1f); border-radius: 12px; border: 2.5px solid rgba(0, 12, 34, .85); min-height: 40px; }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #f6dc92, #c9a042); }
::-webkit-scrollbar-corner { background: transparent; }
@-moz-document url-prefix() { * { scrollbar-width: thin; scrollbar-color: #b8902f rgba(0, 10, 30, .4); } }

/* entry gate */
.menu-lang { position: absolute; top: calc(10px + var(--safe-t)); left: 10px; z-index: 5; }
.langsw { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: rgba(0, 12, 34, .6); border: 1px solid var(--line); backdrop-filter: blur(6px); }
.langsw button { appearance: none; border: 0; background: transparent; color: var(--muted); font: 800 .85rem var(--font-ui); letter-spacing: .08em; padding: .42em .75em; border-radius: 9px; cursor: pointer; }
.langsw button.on { background: linear-gradient(180deg, var(--gold-2), #b98d28); color: #1b1200; }
.langsw button:not(.on):hover { color: var(--text); }
.lobby-head .langsw { align-self: center; }
.gate-card { padding: 18px 20px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.gate-card h2 { margin: 0; font-size: 1.7rem; letter-spacing: .06em; }
.gate-card p { margin: 0 0 6px; color: var(--muted); }
.gate-ico { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 1.7rem; background: radial-gradient(circle at 35% 30%, #1f5d8c, var(--navy-3)); border: 2px solid var(--line); box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
.gate-card.account .gate-ico { border-color: var(--gold); }
.gate-card .row { justify-content: center; margin-top: 4px; }
.gate-card .btn.big { margin-top: 4px; }
.gate-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-size: .85rem; }
.gate-or::before, .gate-or::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); }
.perks { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 6px; text-align: left; width: 100%; }
.perks li { padding-left: 28px; position: relative; color: var(--text); font-weight: 600; }
.perks li::before { content: '✔'; position: absolute; left: 4px; color: var(--teal-glow, #8fe9de); font-weight: 900; }

/* menu shortcuts: four glass tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.tile { appearance: none; position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px 12px; border-radius: 16px; border: 1px solid var(--line); cursor: pointer; color: var(--text); font-family: var(--font-ui);
  background: linear-gradient(160deg, rgba(31, 93, 140, .55), rgba(3, 20, 48, .85)); box-shadow: 0 8px 22px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .08); transition: transform .18s cubic-bezier(.2, .9, .3, 1.3), box-shadow .2s, border-color .2s; }
.tile::before { content: ''; position: absolute; inset: 0; background: radial-gradient(120% 80% at 50% -10%, var(--tc, rgba(94, 196, 184, .35)), transparent 60%); opacity: .55; transition: opacity .2s; }
.tile:hover { transform: translateY(-3px); border-color: var(--tb, var(--teal)); box-shadow: 0 14px 30px rgba(0, 0, 0, .45), 0 0 22px var(--tc, rgba(94, 196, 184, .35)); }
.tile:hover::before { opacity: 1; }
.tile:active { transform: translateY(0) scale(.97); }
.tile:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.tile-ico { position: relative; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 1.55rem; background: rgba(0, 10, 30, .55); border: 1px solid rgba(255, 255, 255, .1); box-shadow: inset 0 0 12px var(--tc, rgba(94, 196, 184, .3)); transition: transform .2s; }
.tile:hover .tile-ico { transform: scale(1.1) rotate(-4deg); }
.tile-lab { position: relative; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .88rem; }
.tile.t-rules { --tc: rgba(94, 196, 184, .38); --tb: #5ec4b8; }
.tile.t-board { --tc: rgba(231, 189, 79, .42); --tb: #e7bd4f; }
.tile.t-stats { --tc: rgba(237, 61, 117, .32); --tb: #ed3d75; }
.tile.t-settings { --tc: rgba(171, 209, 66, .3); --tb: #abd142; }
.tile.t-install { --tc: rgba(247, 161, 42, .35); --tb: #f7a12a; }

/* forms */
input[type=email] { width: 100%; padding: .55em .8em; border-radius: 11px; border: 1.5px solid var(--line); background: rgba(0, 10, 30, .62); color: var(--text); font: 600 1.1rem var(--font-ui); outline: none; }
input[type=email]:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(94, 196, 184, .22); }
.link.small { font-size: .85rem; align-self: center; }
.okmsg { color: #7ce8ad !important; }
.avatars.compact button.reg { border-color: rgba(231, 189, 79, .7); background: rgba(231, 189, 79, .14); }

/* teams: allies in turquoise, adversaries in orange, everywhere */
.plate.ally { border-color: rgba(94, 196, 184, .85); box-shadow: inset 5px 0 0 #5ec4b8; }
.plate.enemy { border-color: rgba(247, 161, 42, .55); box-shadow: inset 5px 0 0 #f7a12a; }
.plate.ally .av { border-color: #5ec4b8; } .plate.enemy .av { border-color: #f7a12a; }
.plate.active.ally, .plate.active.enemy { box-shadow: inset 5px 0 0 currentColor, 0 0 0 2px rgba(231, 189, 79, .35), 0 0 24px rgba(231, 189, 79, .55); }
.plate.active.ally { color: #5ec4b8; } .plate.active.enemy { color: #f7a12a; } .plate.active .info, .plate.active .nm { color: var(--text); }
.plate .tag { font-size: .66rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 0 6px; border-radius: 99px; }
.plate .tag.ally { background: rgba(94, 196, 184, .25); color: #8fe9de; } .plate .tag.enemy { background: rgba(247, 161, 42, .22); color: #ffc069; }
.teambar { position: absolute; top: calc(50px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 21; pointer-events: none; }
.tchip { display: inline-flex; align-items: center; gap: 7px; padding: 3px 13px 3px 10px; border-radius: 99px; background: rgba(0, 12, 34, .8); border: 1.5px solid; font-weight: 700; font-size: .92rem; white-space: nowrap; backdrop-filter: blur(5px); }
.tchip i { width: 10px; height: 10px; border-radius: 50%; }
.tchip b { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: .06em; font-weight: 400; }
.tchip.ally { border-color: #5ec4b8; } .tchip.ally i { background: #5ec4b8; box-shadow: 0 0 8px #5ec4b8; }
.tchip.enemy { border-color: #f7a12a; } .tchip.enemy i { background: #f7a12a; box-shadow: 0 0 8px #f7a12a; }
.teamlegend { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 6px; }
.teamchip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 99px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; font-size: .88rem; background: rgba(255, 255, 255, .05); border: 1.5px solid; }
.teamchip i { width: 11px; height: 11px; border-radius: 50%; }
.teamchip small { text-transform: none; font-weight: 600; opacity: .75; }
.teamchip.ally { border-color: var(--teal); color: #8fe9de; } .teamchip.ally i { background: var(--teal); }
.teamchip.enemy { border-color: #f7a12a; color: #ffc069; } .teamchip.enemy i { background: #f7a12a; }
.pill.ally { background: rgba(94, 196, 184, .22); color: #8fe9de; } .pill.enemy { background: rgba(247, 161, 42, .22); color: #ffc069; }
.seat.ally { background: linear-gradient(90deg, rgba(94, 196, 184, .16), rgba(255, 255, 255, .04) 45%); box-shadow: inset 5px 0 0 var(--teal); }
.seat.enemy { background: linear-gradient(90deg, rgba(247, 161, 42, .15), rgba(255, 255, 255, .04) 45%); box-shadow: inset 5px 0 0 #f7a12a; }
.seat.ally .av { border-color: var(--teal); } .seat.enemy .av { border-color: #f7a12a; }
@media (max-width: 760px) { .game.teams #log { top: calc(124px + var(--safe-t)); } .teambar { top: calc(88px + var(--safe-t)); } .tchip { font-size: .82rem; padding: 2px 10px 2px 8px; } }

/* end-of-game recap: the rows slide in vertically, so no horizontal scrollbar can appear while animating */
.recap-wrap { overflow-x: clip; overflow-y: visible; }
.overmodal .modal-body { overflow-x: hidden; }
.rc-row { transform: translateY(14px); }
@keyframes rcIn { to { opacity: 1; transform: none; } }

/* rules */
.rulesmodal { width: min(100%, 940px); }
.rulesmodal .modal-body { padding: 0 20px 18px; scroll-behavior: smooth; }
.rprogress { height: 3px; background: rgba(255, 255, 255, .07); flex: none; }
.rprogress i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold-2)); transform-origin: 0 50%; transform: scaleX(0); transition: transform .12s linear; }
.rules { width: 100%; max-width: none; margin: 0 auto; text-align: center; }
.rpane, .rtab, .rtab > * { width: 100%; box-sizing: border-box; }
.rtabs { position: sticky; top: 0; z-index: 4; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px; margin: 0 -20px 14px; background: #051a3d; border-bottom: 1px solid var(--line); }
.rtabs button { appearance: none; display: inline-flex; align-items: center; gap: 7px; border: 1.5px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--muted); font: 800 .92rem var(--font-ui); letter-spacing: .07em; text-transform: uppercase; padding: .5em 1.05em; border-radius: 99px; cursor: pointer; transition: background .15s, color .15s, transform .12s; }
.rtabs button:hover { color: var(--text); transform: translateY(-1px); }
.rtabs button.on { background: linear-gradient(180deg, rgba(231, 189, 79, .3), rgba(185, 141, 40, .22)); color: var(--gold-2); border-color: var(--gold-2); box-shadow: 0 0 18px rgba(231, 189, 79, .22); }
.rtabs .ico { font-size: 1.05rem; }
.rpane.swap { animation: rswap .35s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes rswap { from { opacity: 0; transform: translateY(10px); } }
.rtab { display: flex; flex-direction: column; gap: 14px; }
.rstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
@media (max-width: 560px) { .rstats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rstats div { padding: 12px 8px; border-radius: 14px; background: linear-gradient(160deg, rgba(31, 93, 140, .5), rgba(3, 20, 48, .8)); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rstats b { font: 400 2.1rem/1 var(--font-display); letter-spacing: .05em; color: var(--gold-2); text-shadow: 0 0 18px rgba(231, 189, 79, .35); }
.rstats span { font-size: .82rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.rsec { background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px 16px; text-align: left; }
.rsec > header { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 8px; text-align: center; }
.rsec > header .ico { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; font-size: 1.3rem; background: radial-gradient(circle at 35% 30%, #1f5d8c, var(--navy-3)); border: 2px solid var(--line); }
.rsec h3 { margin: 0; color: var(--teal-glow, #8fe9de); font-size: 1.5rem; letter-spacing: .06em; }
.rbody p { margin: 0 0 8px; } .rbody ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.rbody li::marker { color: var(--gold-2); }
.rlead { margin: 0 0 12px !important; text-align: center; color: var(--muted); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; counter-reset: st; }
.steps li { counter-increment: st; position: relative; display: flex; flex-direction: column; gap: 3px; padding: 30px 12px 12px; border-radius: 14px; background: rgba(0, 10, 30, .45); border: 1px solid var(--line); text-align: center; }
.steps li::before { content: counter(st); position: absolute; top: -12px; left: 50%; transform: translateX(-50%); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 400 1.2rem var(--font-display); background: linear-gradient(180deg, var(--gold-2), #b98d28); color: #1b1200; box-shadow: 0 3px 10px rgba(0, 0, 0, .4); }
.steps li { margin-top: 12px; }
.steps b { font-family: var(--font-display); font-weight: 400; font-size: 1.25rem; letter-spacing: .06em; color: var(--text); }
.steps span { color: var(--muted); font-size: .95rem; }
.callout { display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px 16px; border-radius: 14px; background: linear-gradient(90deg, rgba(231, 189, 79, .16), rgba(231, 189, 79, .05)); border: 1px solid rgba(231, 189, 79, .4); }
.callout .ico { font-size: 1.6rem; flex: none; }
.callout.credits { margin-top: 18px; background: rgba(255, 255, 255, .04); border-color: var(--line); display: block; font-size: .92rem; color: var(--muted); text-align: center; }
.rnums { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (min-width: 640px) { .rnums { grid-template-columns: repeat(10, 1fr); } }
.rnums div { text-align: center; display: flex; flex-direction: column; gap: 3px; }
.rnums img { width: 100%; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); transition: transform .15s; } .rnums img:hover { transform: translateY(-4px) scale(1.06); }
.rnums small { color: var(--muted); font-weight: 700; }
.rulecards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; text-align: left; }
.rulecard { display: grid; grid-template-columns: 78px 1fr; gap: 12px; align-items: start; padding: 10px; border-radius: 14px; background: rgba(0, 10, 30, .4); border: 1px solid rgba(255, 255, 255, .07); border-left: 4px solid var(--accent, var(--teal)); }
.rulecard img { width: 78px; border-radius: 6px; cursor: zoom-in; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); transition: transform .15s; } .rulecard img:hover { transform: scale(1.06) rotate(-2deg); }
.rulecard h4 { margin: 0 0 4px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 1.2rem; }
.rulecard h4 small { font-family: var(--font-ui); font-size: .8rem; color: var(--muted); font-weight: 700; }
.rulecard p { margin: 0; font-size: .95rem; color: #cfe2f1; }
.teamdemo { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 10px; }
.teamdemo > div { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 14px 10px; border-radius: 14px; border: 1.5px solid; }
.teamdemo b { font: 400 1.5rem var(--font-display); letter-spacing: .06em; }
.teamdemo span { font-size: .9rem; color: var(--muted); }
.teamdemo .ally { border-color: #5ec4b8; background: rgba(94, 196, 184, .12); } .teamdemo .ally b { color: #8fe9de; }
.teamdemo .enemy { border-color: #f7a12a; background: rgba(247, 161, 42, .1); } .teamdemo .enemy b { color: #ffc069; }
.teamdemo .vs { align-self: center; font: 400 1.4rem var(--font-display); color: var(--muted); border: 0; padding: 0; }
.racc { border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .04); overflow: hidden; text-align: left; }
.racc summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; font: 400 1.25rem var(--font-display); letter-spacing: .06em; color: var(--teal-glow, #8fe9de); }
.racc summary::-webkit-details-marker { display: none; }
.racc summary::after { content: '＋'; font-family: var(--font-ui); font-weight: 700; color: var(--gold-2); transition: transform .2s; }
.racc[open] summary::after { content: '－'; }
.racc[open] summary { border-bottom: 1px solid var(--line); }
.racc .rbody { padding: 12px 16px 14px; }
.racc + .racc { margin-top: -4px; }.tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile-lab { font-size: .8rem; letter-spacing: .05em; text-align: center; overflow-wrap: anywhere; }
@media (max-width: 420px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tile { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 12px; } .tile-lab { text-align: left; font-size: .85rem; } }
@media (max-width: 560px) { .menu .logo { margin-top: 40px; } }
@media (max-width: 760px) { .plate .tag { display: none; } .game.teams .plate:not(.me) .pips { display: none; } }
/* the credit footer stays centred inside modals (the generic .modal-body p margin used to push it to the left) */
.modal-body .legal p { margin: 0 auto; max-width: 640px; text-align: center; }
.rules .legal { padding-left: 0; padding-right: 0; }

/* board chooser (profile) */
.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 6px; }
.board { appearance: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border-radius: 14px; border: 1.5px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--text); cursor: pointer; font-family: var(--font-ui); text-align: center; transition: transform .15s, border-color .15s, box-shadow .2s; }
.board:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--teal); }
.board.sel { border-color: var(--gold-2); box-shadow: 0 0 0 2px rgba(231, 189, 79, .3), 0 0 18px rgba(231, 189, 79, .25); }
.board .swatch { position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), inset 0 0 22px rgba(0, 0, 0, .45); }
.board.locked { opacity: .62; cursor: not-allowed; }
.board.locked .swatch { filter: grayscale(.7) brightness(.65); }
.board .lock { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: 1.6rem; }
.board b { font-size: .95rem; letter-spacing: .03em; }
.board small { color: var(--muted); font-weight: 700; }

/* ================================================================== v4 */
/* big modals (rules, profile): wider on PC / tablet, full screen on a phone */
.modal.bigmodal { width: min(100%, 1120px); max-height: calc(100vh - 28px); }
.rulesmodal { width: min(100%, 1120px); }
.modal.bigmodal .modal-body { padding-left: 24px; padding-right: 24px; }
@media (min-width: 761px) { .modal.bigmodal { max-height: calc(100vh - 40px); } }
@media (max-width: 760px) {
  .modal-bg.fs-bg { padding: 0; align-items: stretch; }
  .modal.bigmodal, .modal.bigmodal.wide { width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; border-left: 0; border-right: 0; }
  .modal.bigmodal .modal-head { padding-top: calc(12px + var(--safe-t)); }
  .modal.bigmodal .modal-foot { padding-bottom: calc(14px + var(--safe-b)); }
  .modal.bigmodal .modal-body { padding-left: 14px; padding-right: 14px; }
  .rulesmodal .modal-body { padding: 0 14px 18px; }
  .rtabs { padding-left: 14px; padding-right: 14px; margin-left: -14px; margin-right: -14px; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; }
  .rtabs button { flex: none; }
  .rtabs { scrollbar-width: none; } .rtabs::-webkit-scrollbar { display: none; }
}

/* achievements with a progress bar */
.achlist { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.ach { align-items: flex-start; }
.achbody { flex: 1; min-width: 0; }
.pbar { height: 7px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-top: 7px; }
.pbar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--teal), #8fe9de); transition: width .7s cubic-bezier(.2, .9, .3, 1); min-width: 0; }
.ach.ok .pbar i { background: linear-gradient(90deg, #b98d28, var(--gold-2)); box-shadow: 0 0 10px rgba(231, 189, 79, .5); }
.ach .cap { display: block; margin-top: 3px; color: var(--muted); font-weight: 700; font-size: .78rem; letter-spacing: .03em; }
.ach.ok .cap { color: var(--gold-2); }

/* menus and lobby sit over a slowly rotating background: blurring what is behind them forced a repaint on every frame */
.screen:not(.game) .glass { -webkit-backdrop-filter: none; backdrop-filter: none; background: linear-gradient(180deg, rgba(10, 45, 92, .86), rgba(3, 20, 48, .94)); }

/* ------------------------------------------------------------------ v5: phone game view */
/* the log shows only the latest lines (faded ones leave the layout); the ≡ button opens the whole history */
#log:not(.expanded) .l.g { display: none; }
#log:not(.expanded) .l:nth-last-child(n+6) { display: none; }
@media (max-width: 760px) {
  #log { font-size: .84rem; width: min(300px, 74vw); }
  #log:not(.expanded) .l:nth-last-child(n+3) { display: none; }
}
@media (max-width: 560px) {
  /* a phone has no room for a floating log (it would cover the first opponent): the ≡ button opens it */
  #log:not(.expanded) { display: none; }
  #log.expanded { top: calc(92px + var(--safe-t)); max-height: 50vh; }
  .pile-label { font-size: .66rem; letter-spacing: .08em; white-space: nowrap; }
  .pile-label b { display: inline; margin-left: 5px; font-size: 1.05rem; }
  .suitepanel { bottom: calc(var(--hand-h, 30vh) + 112px); max-height: calc(100dvh - var(--hand-h, 30vh) - 190px); }
}
/* phone lobby: nothing may widen the page (grid tracks default to min-content), seat controls wrap under the name */
@media (max-width: 760px) {
  .lobby-grid { grid-template-columns: minmax(0, 1fr); }
  .codebox { flex-wrap: wrap; justify-content: center; max-width: 100%; }
  .lobby-head { justify-content: center; }
}
@media (max-width: 560px) {
  .seat { display: flex; flex-wrap: wrap; gap: 8px 12px; }
  .seat > :nth-child(2) { flex: 1 1 120px; min-width: 0; }
  .seat .ctl { flex: 0 0 auto; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
  .seat .ctl .btn, .seat .ctl select { min-height: 40px; }
  .seat .nm { overflow-wrap: anywhere; }
}
@media (max-width: 560px) {
  .modal.bigmodal .modal-foot { flex-wrap: wrap; justify-content: stretch; }
  .modal.bigmodal .modal-foot .btn { flex: 1 1 40%; min-height: 46px; }
}
/* the game-over table fits the screen: names are cut, figures keep a fixed narrow column */
@media (max-width: 640px) {
  table.recap { table-layout: fixed; }
  .recap th.num, .recap td.num { width: 38px; padding-left: 2px; padding-right: 2px; }
  .recap th:last-child, .recap td.rc-act { width: 32px; padding: 0; }
  .recap td.top::before { content: none; }
  .rc-who { overflow: hidden; }
  .rc-who .who { min-width: 0; gap: 6px; }
  .rc-name { min-width: 0; overflow: hidden; }
  .rc-name .pn { display: block; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .rc-who .crown { display: none; }
}
@media (max-width: 560px) {
  /* the prompt spans the width: message on top, buttons below (no more word-per-line column) */
  #prompt { left: 8px; right: 8px; transform: none; max-width: none; flex-wrap: wrap; justify-content: center; padding: 8px 10px; gap: 8px; }
  #prompt .msg { flex: 1 1 100%; text-align: center; font-size: 1rem; line-height: 1.2; }
  #prompt .btn { flex: 1 1 0; min-height: 44px; }
}
/* ================================================================== v6: visible height */
/* 100dvh = the visible height (the browser's address bar is not counted), unlike 100vh which lets the bottom of a modal fall off the screen */
:root { --vh100: 100vh; --vw100: 100vw; --ui-zoom: 1; --hs: 1; }
@supports (height: 100dvh) { :root { --vh100: 100dvh; } }
/* proportional scale (js/screen.js): the design is 1440 x 720, a bigger or smaller screen shows it scaled, ratios kept.
   --vh100 / --vw100 are then the visible size in the zoomed (virtual) pixels. */
#modals, .screen:not(.game) { zoom: var(--ui-zoom, 1); }
/* the table's texts follow the scale too (their positions are computed in screen pixels by game.js, which divides by the scale) */
.game .plate, .game .pile-label, .game .turn-banner, .game .teambar, .game #stage .box { zoom: var(--hs, 1); }
.game #prompt { zoom: var(--hs, 1); bottom: calc((var(--hand-h, 30vh) + 6px) / var(--hs, 1)); }
.game .tchip { font-size: inherit; }
.modal { max-height: calc(var(--vh100) - 28px); }
.modal.bigmodal { max-height: calc(var(--vh100) - 28px); }
@media (min-width: 761px) { .modal.bigmodal { max-height: calc(var(--vh100) - 40px); } }

/* card pictures keep their shape before they are loaded */
.rnums img, .rulecard img { aspect-ratio: .66; height: auto; }
/* notice shown once when the screen is smaller than the 1440 x 720 the game is designed for */
.sizewarn { position: absolute; left: 0; right: 0; top: calc(10px + var(--safe-t)); margin-inline: auto; width: min(92%, 900px); z-index: 95; display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 14px; background: rgba(0, 10, 28, .96); border: 1.5px solid var(--gold-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-weight: 600; font-size: 1rem; line-height: 1.25; }
.sizewarn .ico { font-size: 1.7rem; flex: none; }
.sizewarn p { margin: 0; flex: 1; }
/* ================================================================== v7: wide and short screens (1440 x 720 and the like) */
/* Everything is meant to be seen on ONE screen of 1440 x 720 or more; a phone shows the same page scaled down (viewport meta).
   On a wide but short window, columns replace the single tall column. */
.mcol, .acc-col { display: contents; }
.rpager, .rtab .callout.credits { display: none; }
/* (applies while html.lw is set by js/screen.js: the virtual screen is landscape enough) */
  /* ---- menu: left = logo + account, right = play + shortcuts */
  html.lw .menu { padding-top: calc(8px + var(--safe-t)); }
  html.lw .menu-inner { width: min(96%, 1120px); margin: auto; padding: 0 0 4px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 56px; row-gap: 10px; align-items: center; }
  html.lw .menu-inner > .banner { grid-column: 1 / -1; }
  html.lw .menu .mcol { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  html.lw .menu .logo { width: min(100%, 440px); }
  html.lw .menu .tagline { margin: -2px 0 4px; font-size: 1.25rem; }
  html.lw .menu .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  html.lw .menu .tile { padding: 10px 4px 8px; gap: 5px; } html.lw .menu .tile-lab { font-size: .72rem; letter-spacing: .04em; }
  html.lw .menu .legal { padding-top: 4px; padding-bottom: calc(8px + var(--safe-b)); }
  /* ---- entry gate: logo on top, the two cards side by side */
  html.lw .menu.gate .menu-inner { grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr); column-gap: 14px; }
  html.lw .menu.gate .mhead { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
  html.lw .menu.gate .mhead .logo { width: min(100%, 360px); }
  html.lw .gate .gate-or { flex-direction: column; align-self: stretch; }
  html.lw .gate .gate-or::before, html.lw .gate .gate-or::after { width: 1px; height: auto; flex: 1; background: linear-gradient(180deg, transparent, var(--line), transparent); }
  html.lw .gate .gate-card { align-self: stretch; justify-content: center; }
  /* ---- account: three columns (account | look | achievements) */
  html.lw .modal.bigmodal .acc-body { display: grid; grid-template-columns: .85fr 1.05fr 1.25fr; gap: 18px; align-items: start; }
  html.lw .acc-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
  html.lw .acc-col .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
  html.lw .acc-col .achlist { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  html.lw .acc-col.c h3 { margin: 0 0 2px; }
  html.lw .acc-col .ach .achbody > .muted { display: none; }       /* the reward stays in the tooltip */
  html.lw .acc-col .ach { padding: 6px 8px; } html.lw .acc-col .ach .achbody > b { font-size: .92rem; line-height: 1.1; display: block; }
  html.lw .acc-col .ach .pbar { margin-top: 4px; height: 5px; } html.lw .acc-col .ach .cap { font-size: .7rem; }
  html.lw .acc-col .boards { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  html.lw .acc-col .board { padding: 5px 3px; gap: 2px; } html.lw .acc-col .board b { font-size: .74rem; line-height: 1.05; } html.lw .acc-col .board small { font-size: .62rem; line-height: 1.05; }
  html.lw .acc-col .avatars.compact { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; }
  /* ---- rules: the text flows in columns, read page by page with the arrows (nothing scrolls vertically) */
  html.lw .modal.rulesmodal { height: calc(var(--vh100) - 40px); }       /* a definite height: the pane takes what is left under the tabs and above the arrows */
  html.lw .rulesmodal .modal-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding-bottom: 6px; }
  html.lw .rprogress { display: none; }
  html.lw .rules { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  html.lw .rules .rtabs { position: static; flex: none; margin: 0 0 8px; padding: 8px 20px; }
  html.lw .rules .rpane { flex: 1 1 0; min-height: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  html.lw .rules .rpane::-webkit-scrollbar { display: none; }
  html.lw .rules .rtab { display: block; height: 100%; column-width: 500px; column-gap: 28px; column-fill: auto; }
  html.lw .rules .rtab > *, html.lw .rules .rtab .rulecard { break-inside: avoid; margin-bottom: 12px; width: auto; }
  html.lw .rules .rtab > .rsec.big { break-inside: auto; }
  html.lw .rules .rulecards { display: block; }
  html.lw .rules .rtab .callout.credits { display: block; }
  html.lw .rules > .callout.credits { display: none; }
  html.lw .rules > .legal { flex: none; padding: 2px 8px 0; font-size: .8rem; line-height: 1.25; }
  html.lw .rules > .rpager { display: flex; flex: none; align-items: center; justify-content: center; gap: 22px; padding: 6px 0 2px; }
  html.lw .rpager .iconbtn { width: 52px; height: 38px; font-size: 1.6rem; } html.lw .rpager .iconbtn:disabled { opacity: .35; }
  html.lw .rpg { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-weight: 700; font-size: .82rem; letter-spacing: .08em; }
  html.lw .rdots { display: flex; gap: 6px; } html.lw .rdots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .22); } html.lw .rdots i.on { background: var(--gold-2); transform: scale(1.25); }
  html.lw .rsec { padding: 12px 16px 14px; } html.lw .rsec > header { margin-bottom: 4px; }
  html.lw .rbody { font-size: .97rem; line-height: 1.3; }

.acc-tabs { display: none; }
/* ================================================================== v9: observers, resume, red discard (all screens) */
.join { grid-template-columns: 1fr auto auto; }
.join .watch .lab { display: none; }
.join .watch { padding-left: .9em; padding-right: .9em; font-size: 1.2rem; }
.watch-banner { margin: 0 auto 10px; width: min(100%, 1020px); }
.watchers { color: var(--gold-2); }
.resume-load { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 18px; font-size: 1.15rem; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .2); border-top-color: var(--teal); animation: spin1 .9s linear infinite; }
@keyframes spin1 { to { transform: rotate(360deg); } }
.watchlist { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.iconbtn.eye { position: relative; }
.iconbtn.eye[data-n]:not([data-n=""])::after { content: attr(data-n); position: absolute; right: -5px; top: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--gold-2); color: #1b1200; font: 800 .72rem/18px var(--font-ui); text-align: center; }
.iconbtn.eye.on { background: rgba(207, 166, 64, .25); border-color: var(--gold); }
.game.spectating #prompt { display: none; }
/* omniscient observer: the hands of every player under the table */
#omni { position: absolute; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); z-index: 22; max-height: 40vh; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 6px 14px; padding: 8px 10px; border-radius: 14px; background: rgba(0, 10, 28, .92); border: 1.5px solid var(--line); }
.omni-row { min-width: 0; padding: 4px 6px; border-radius: 10px; }
.omni-row.active { box-shadow: inset 0 0 0 1.5px var(--gold-2); background: rgba(207, 166, 64, .08); }
.omni-who { display: flex; align-items: center; gap: 6px; font-size: .98rem; margin-bottom: 3px; }
.omni-who small { color: var(--muted); margin-left: auto; font-weight: 700; }
.omni-cards { display: flex; flex-wrap: wrap; gap: 3px; }
.omni-cards img { width: 36px; height: auto; aspect-ratio: .66; border-radius: 4px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5)); }
/* free-discard variant: a playable card can also be thrown away: thin red ring around the teal glow */
.hcard.both::before { content: ''; position: absolute; inset: -6px; border-radius: 11%; box-shadow: 0 0 0 2px rgba(240, 72, 74, .95), 0 0 16px rgba(240, 72, 74, .6); pointer-events: none; }
.hcard.sel.both::before { inset: -4px; box-shadow: 0 0 0 3px var(--gold-2), 0 0 24px rgba(231, 189, 79, .8); }

/* ================================================================== v9: phones and small tablets (html.ph, set by js/screen.js) */
/* real pixels, no scale: text at least 16 px, tap targets at least 44 px, one idea per screen, scrolling where the content needs it */
html.ph .btn, html.ph .iconbtn, html.ph .seg button, html.ph .chip, html.ph .tabs button { min-height: 44px; }
html.ph .iconbtn { min-width: 44px; }
html.ph .btn.sm { min-height: 40px; }
html.ph input[type=text], html.ph input[type=password], html.ph input[type=search], html.ph input[type=email], html.ph select { font-size: 16px; min-height: 46px; }

/* ---- sheets: rules, profile, ranking, settings, statistics, end of game take the whole screen */
html.ph .modal-bg.fs-bg { padding: 0; align-items: stretch; }
html.ph .modal-bg:not(.fs-bg) { padding: 12px; }
html.ph .modal.bigmodal, html.ph .modal.sheet { width: 100%; max-width: none; height: var(--vh100); max-height: none; border-radius: 0; border-left: 0; border-right: 0; }
html.ph .modal:not(.sheet):not(.bigmodal) { width: min(100%, 480px); max-height: calc(var(--vh100) - 24px); }
html.ph .modal.bigmodal .modal-head, html.ph .modal.sheet .modal-head { padding: calc(10px + var(--safe-t)) 14px 6px 16px; }
html.ph .modal-head h2 { font-size: 1.55rem; }
html.ph .modal-body { padding: 4px 16px 16px; overscroll-behavior: contain; }
html.ph .modal.bigmodal .modal-body, html.ph .modal.sheet .modal-body { flex: 1 1 auto; min-height: 0; padding-left: 16px; padding-right: 16px; }
html.ph .modal-foot { padding: 10px 16px calc(12px + var(--safe-b)); gap: 10px; flex-wrap: nowrap; justify-content: stretch; }
html.ph .modal-foot .btn { flex: 1 1 0; min-width: 0; min-height: 48px; padding: .4em .5em; font-size: 1rem; }
html.ph .rprogress { display: none; }

/* ---- entry gate and menu */
html.ph .menu { padding: calc(10px + var(--safe-t)) 14px 0; }
html.ph .menu-lang, html.ph .menu-snd { top: calc(10px + var(--safe-t)); }
html.ph .menu-lang { left: 10px; } html.ph .menu-snd { right: 10px; }
html.ph .menu-inner { width: min(100%, 520px); margin: 0 auto; padding: 58px 0 10px; gap: 12px; }
html.ph .menu .logo { width: auto; max-width: 86%; height: clamp(64px, 12vh, 140px); object-fit: contain; margin: 0 auto; }
html.ph .menu .tagline { font-size: 1.05rem; margin: -4px 0 0; }
html.ph .menu .banner { font-size: 1rem; }
html.ph .profile { padding: 12px 14px; }
html.ph .profile.acct .av.big { width: 54px; height: 54px; font-size: 1.9rem; }
html.ph .profile.acct .muted { font-size: .98rem; line-height: 1.25; }
html.ph .profile > .lbl { display: none; }
html.ph .profile .avatars { display: flex; overflow-x: auto; gap: 8px; margin-top: 8px; scrollbar-width: none; }
html.ph .profile .avatars::-webkit-scrollbar { display: none; }
html.ph .profile .avatars button { flex: 0 0 46px; width: 46px; height: 46px; aspect-ratio: auto; font-size: 1.55rem; }
html.ph .visitor-note { flex-wrap: nowrap; font-size: .98rem; margin-top: 8px; }
html.ph .visitor-note > span:first-child { display: none; }
html.ph .visitor-note .row { width: 100%; flex-wrap: nowrap; }
html.ph .visitor-note .btn { flex: 1; }
html.ph .levelbox { padding: 10px 14px 12px; }
html.ph .levelbox .seg { padding: 3px; gap: 4px; }
html.ph .levelbox .seg button { font-size: .95rem; padding: .45em .1em; letter-spacing: .02em; }
html.ph .menu .btn.big { font-size: 1.25rem; padding: .45em 1em; min-height: 60px; }
html.ph .join input { font-size: 1.5rem; min-height: 52px; }
html.ph .join .btn { min-height: 52px; }
html.ph .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
html.ph .tile { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 14px; min-height: 58px; }
html.ph .tile-ico { width: 40px; height: 40px; font-size: 1.35rem; }
html.ph .tile-lab { text-align: left; font-size: .98rem; letter-spacing: .05em; }
html.ph .menu .legal { padding: 8px 8px calc(14px + var(--safe-b)); font-size: .88rem; }
html.ph-p .menu .legal { padding-bottom: calc(54px + var(--safe-b)); }       /* the bug button sits in the bottom-left corner: the footer text stays above it at the end of the page */
html.ph .gate-card { padding: 14px 16px 16px; gap: 8px; }
html.ph .gate-card h2 { font-size: 1.55rem; }
html.ph .gate-card p { font-size: 1rem; line-height: 1.3; }
html.ph .gate-ico { display: none; }
html.ph .perks li { font-size: 1rem; }
html.ph .gate-card .row { flex-wrap: nowrap; width: 100%; }
html.ph .gate-card .row .btn { flex: 1 1 0; min-width: 0; padding: .45em .4em; font-size: 1rem; }
html.ph .gate .gate-card.visitor .btn.big { min-height: 64px; }
/* held sideways: two columns, nothing to scroll */
html.ph-l .menu { padding-top: calc(6px + var(--safe-t)); }
html.ph-l .menu-inner { width: min(96%, 940px); padding: 6px 0 4px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 26px; row-gap: 8px; align-items: center; }
html.ph-l .menu-inner > .banner { grid-column: 1 / -1; }
html.ph-l .menu .mcol { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
html.ph-l .menu .logo { height: clamp(48px, 26vh, 120px); }
html.ph-l .menu .tagline { display: none; }
html.ph-l .menu .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
html.ph-l .menu .tile { flex-direction: column; justify-content: center; gap: 2px; padding: 6px 2px; min-height: 0; }
html.ph-l .menu .tile-ico { width: 30px; height: 30px; font-size: 1.1rem; }
html.ph-l .menu .tile-lab { text-align: center; font-size: .8rem; letter-spacing: .02em; }
html.ph-l .menu .btn.big { min-height: 46px; padding: .25em 1em; font-size: 1.15rem; }
html.ph-l .menu .join input, html.ph-l .menu .join .btn { min-height: 44px; }
html.ph-l .menu .levelbox .lbl { display: none; }
html.ph-l .menu.gate .menu-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
html.ph-l .menu.gate .mhead { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; }
html.ph-l .menu.gate .mhead .tagline { display: none; }
html.ph-l .menu.gate .mhead .logo { height: clamp(40px, 20vh, 90px); }
html.ph-l .menu.gate .gate-or { display: none; }
html.ph-l .gate-card.visitor p, html.ph-l .perks { display: none; }
html.ph-l .modal.bigmodal .modal-head, html.ph-l .modal.sheet .modal-head { padding-top: calc(4px + var(--safe-t)); padding-bottom: 0; }
html.ph-l .modal-head h2 { font-size: 1.3rem; }
html.ph-l .modal-foot { padding-top: 6px; padding-bottom: calc(8px + var(--safe-b)); }
html.ph-l .modal-foot .btn { min-height: 44px; }

/* ---- profile: header + four tabs, one section at a time */
html.ph .acc-body { gap: 10px; }
html.ph .acct-prev { padding: 10px 12px; gap: 12px; font-size: 1.35rem; }
html.ph .acct-prev .av.big { width: 56px; height: 56px; font-size: 2rem; }
html.ph .acc-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; position: sticky; top: -4px; z-index: 3; padding: 4px 0 6px; background: #051a3d; }
html.ph .acc-tabs button { appearance: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .4em .1em; min-height: 58px; border-radius: 12px; border: 1.5px solid var(--line); background: rgba(255, 255, 255, .05); color: var(--muted); font: 800 .8rem/1.1 var(--font-ui); letter-spacing: .05em; text-transform: uppercase; cursor: pointer; }
html.ph .acc-tabs button .ico { font-size: 1.35rem; }
html.ph .acc-tabs button.on { background: rgba(207, 166, 64, .2); color: var(--gold-2); border-color: var(--gold-2); }
html.ph .acc-body [data-tab] { display: none; }
html.ph .acc-body[data-active="stats"] .stats-grid[data-tab="stats"] { display: grid; }
html.ph .acc-body[data-active="style"] .acc-col.b { display: flex; flex-direction: column; gap: 14px; }
html.ph .acc-body[data-active="ach"] .acc-col.c { display: flex; flex-direction: column; gap: 8px; }
html.ph .acc-body[data-active="sec"] [data-tab="sec"] { display: block; }
html.ph .acc-body[data-active="sec"] details[data-tab="sec"] > summary { display: none; }
html.ph .acc-col.c h3 { display: none; }
html.ph .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 0; }
html.ph .stats-grid div { padding: 12px 6px; }
html.ph .stats-grid b { font-size: 1.9rem; }
html.ph .stats-grid span { font-size: .8rem; }
html.ph .chips { gap: 8px; }
html.ph .chip { font-size: 1.05rem; padding: .35em 1em; }
html.ph .avatars.compact { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
html.ph .avatars.compact button { min-height: 50px; font-size: 1.5rem; }
html.ph .boards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
html.ph .board { padding: 8px; } html.ph .board b { font-size: 1.05rem; } html.ph .board small { font-size: .85rem; }
html.ph .achlist { grid-template-columns: minmax(0, 1fr); gap: 8px; }
html.ph .ach { padding: 12px 14px; gap: 12px; opacity: .8; }
html.ph .ach.ok { opacity: 1; }
html.ph .ach .ico { font-size: 1.4rem; }
html.ph .ach .achbody > b { font-size: 1.1rem; }
html.ph .ach .pbar { height: 8px; }
html.ph .ach .cap { font-size: .88rem; }
html.ph .acc-body input[type=password], html.ph .acc-body input[type=email] { min-height: 50px; }
html.ph-l .acc-tabs button { flex-direction: row; justify-content: center; gap: 6px; min-height: 44px; }
html.ph-l .acct-prev .av.big { width: 44px; height: 44px; font-size: 1.5rem; }

/* ---- rules: tabs always in sight, text at reading size, one column */
html.ph .rulesmodal .modal-body { padding: 0 16px 24px; }
html.ph .rtabs { position: sticky; top: 0; z-index: 4; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; margin: 0 -16px 12px; padding: 8px 16px; gap: 8px; scrollbar-width: none; background: #051a3d; }
html.ph .rtabs::-webkit-scrollbar { display: none; }
html.ph .rtabs button { flex: none; min-height: 46px; padding: .4em 1em; font-size: .98rem; }
html.ph .rtabs button:not(.on) .lab { display: none; }
html.ph .rtabs button:not(.on) { padding: .4em .8em; }
html.ph .rtabs button .ico { font-size: 1.25rem; }
html.ph .rtab { gap: 14px; }
html.ph .rsec { padding: 14px 14px 16px; }
html.ph .rsec h3 { font-size: 1.5rem; }
html.ph .rbody { font-size: 1.04rem; line-height: 1.4; }
html.ph .rbody ul { gap: 8px; }
html.ph .rlead { font-size: 1rem; line-height: 1.35; }
html.ph .rstats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
html.ph .rstats b { font-size: 2.2rem; } html.ph .rstats span { font-size: .85rem; }
html.ph .steps { grid-template-columns: minmax(0, 1fr); gap: 16px; }
html.ph .steps b { font-size: 1.3rem; } html.ph .steps span { font-size: 1rem; }
html.ph .rulecards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
html.ph .rulecard { grid-template-columns: 78px minmax(0, 1fr); gap: 12px; padding: 12px; }
html.ph .rulecard img { width: 78px; }
html.ph .rulecard h4 { font-size: 1.3rem; } html.ph .rulecard p { font-size: 1rem; line-height: 1.35; }
html.ph .rnums { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
html.ph .teamdemo { grid-template-columns: minmax(0, 1fr); gap: 8px; } html.ph .teamdemo .vs { display: none; }
html.ph .racc summary { padding: 14px 16px; font-size: 1.35rem; min-height: 54px; }
html.ph .callout { font-size: 1rem; padding: 12px 14px; }

/* ---- ranking: four columns that fit, names cut with an ellipsis */
html.ph .lbmodal .modal-body { display: flex; flex-direction: column; overflow: hidden; }
html.ph .lbmodal .modal-body > .stack { flex: 1 1 auto; min-height: 0; gap: 10px; }
html.ph .lb-sort { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; }
html.ph .lb-sort button { font-size: .95rem; padding: .5em .3em; letter-spacing: .03em; }
html.ph .lb-wrap { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; }
html.ph table.lb { table-layout: fixed; }
html.ph .lb th:nth-child(6), html.ph .lb td:nth-child(6), html.ph .lb th:nth-child(7), html.ph .lb td:nth-child(7) { display: none; }
html.ph .lb th, html.ph .lb td { padding: 10px 4px; }
html.ph .lb th { font-size: .75rem; letter-spacing: .03em; }
html.ph .lb th:nth-child(1), html.ph .lb td:nth-child(1) { width: 38px; padding-left: 0; padding-right: 0; }
html.ph .lb th:nth-child(3), html.ph .lb td:nth-child(3) { width: 62px; }
html.ph .lb th:nth-child(4), html.ph .lb td:nth-child(4) { width: 70px; }
html.ph .lb th:nth-child(5), html.ph .lb td:nth-child(5) { width: 70px; }
html.ph .lb td:nth-child(2) .who { gap: 8px; }
html.ph .lb td:nth-child(2) .who > :last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.ph .lb .av.sm { width: 34px; height: 34px; font-size: 1.1rem; }
html.ph .lb td { font-size: 1.02rem; }
html.ph .lbmodal .pager { flex: none; gap: 14px; }
html.ph .lbmodal .fine { flex: none; font-size: .8rem; line-height: 1.25; }

/* ---- settings and statistics */
html.ph .setrow { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px 0; }
html.ph .setrow:has(> .switch) { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
html.ph .setrow .seg { width: 100% !important; }
html.ph .setrow input[type=range] { width: 100% !important; }
html.ph .setrow .d { font-size: .9rem; }
html.ph .switch input { width: 58px; height: 34px; }
html.ph .switch input::after { top: 4px; left: 4px; width: 26px; height: 26px; }
html.ph .switch input:checked::after { transform: translateX(24px); }
html.ph .statmodal .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---- end of game */
html.ph .overmodal .modal-body { padding: calc(8px + var(--safe-t)) 12px 6px; }
html.ph .over .big { font-size: 3.2rem; }
html.ph .over > p { font-size: 1.02rem; }
html.ph .podium .who .av { width: 52px; height: 52px; font-size: 1.8rem; }
html.ph .recap th, html.ph .recap td { padding: 9px 3px; }
html.ph .recap td { font-size: 1.05rem; }
html.ph .recap .av.sm { width: 32px; height: 32px; }
html.ph .overmodal .legal { display: none; }
html.ph-l .over .big { font-size: 2.2rem; margin: 0; }
html.ph-l .podium { margin: 4px 0; }
html.ph-l .podium .who .av { width: 36px; height: 36px; font-size: 1.3rem; }
html.ph-l .recap th, html.ph-l .recap td { padding: 5px 3px; }

/* ---- lobby */
html.ph .lobby { padding: calc(10px + var(--safe-t)) 14px 0; }
html.ph .lobby-head { gap: 8px; justify-content: center; }
html.ph .lobby-head .btn { min-height: 44px; }
html.ph .codebox { padding: 8px 14px; }
html.ph .codebox b { font-size: 2.3rem; }
html.ph .seat { padding: 10px 12px; }
html.ph .seat .av { width: 48px; height: 48px; }
html.ph .seat .nm { font-size: 1.25rem; }
html.ph .seat .sub { font-size: .95rem; }
html.ph .seat .ctl .btn, html.ph .seat .ctl select { min-height: 44px; font-size: .95rem; }
html.ph .opts .seg, html.ph .panel .seg { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
html.ph .opts .switch { min-height: 46px; }
html.ph .lobby-foot .btn.big { min-height: 64px; }

/* ---- the game */
html.ph .topbar .iconbtn { width: 44px; height: 44px; }
html.ph-p { --cw: clamp(72px, 21vw, 100px); }
html.ph-l { --cw: clamp(54px, 14vh, 84px); }
html.ph .game .plate .nm { max-width: 130px; font-size: 1.02rem; }
html.ph .game .plate .av { width: 38px; height: 38px; font-size: 1.35rem; }
html.ph .game .plate .cnt { font-size: .95rem; }
html.ph .game .turn-banner { font-size: 1.15rem; }
html.ph .game .pile-label { font-size: .78rem; letter-spacing: .08em; }
html.ph .game .pile-label b { font-size: 1.25rem; }
html.ph #prompt .msg { font-size: 1.08rem; }
html.ph #prompt .btn { min-height: 48px; font-size: 1.02rem; }
html.ph #stage .box { max-width: min(96vw, 520px); }
html.ph #stage .stopbtn { min-height: 64px; }
html.ph .game .tchip { font-size: .95rem; }
html.ph #omni { max-height: 36vh; }
html.ph .cardtip { width: min(320px, 92vw); } html.ph .cardtip p { font-size: 1.05rem; }
html.ph .toast { font-size: 1.05rem; }
html.ph-l .game .plate .nm { max-width: 92px; font-size: .9rem; }
html.ph-l .game .plate .av { width: 28px; height: 28px; font-size: 1rem; }
html.ph-l .game .turn-banner { font-size: 1rem; }
html.ph-l .game .pile-label { font-size: .68rem; }
html.ph-l .game .pile-label b { font-size: 1rem; }
html.ph-l .pwa-card { flex-direction: row; align-items: center; max-width: 760px; padding: 8px 12px; }
html.ph-l .pwa-card p { display: none; }
html.ph-l .pwa-card .pwa-b { flex-wrap: nowrap; margin-left: auto; }
html.ph .pwa-b .btn { min-height: 44px; }
html.ph #prompt { flex-wrap: wrap; justify-content: center; gap: 8px; padding: 8px 10px; width: calc(100vw - 20px); max-width: 560px; }
html.ph #prompt .msg { flex: 1 0 100%; text-align: center; line-height: 1.2; }
html.ph #prompt .btn { flex: 1 1 0; min-width: 0; }
html.ph-l #prompt { flex-wrap: nowrap; width: auto; max-width: calc(100vw - 20px); }
html.ph-l #prompt .msg { flex: 0 1 auto; text-align: left; }
html.ph-l #prompt .btn { flex: 0 0 auto; }
html.ph-l .menu-snd { right: auto; left: 100px; }
@media (max-width: 380px) {
  html.ph-p .tile { gap: 8px; padding: 10px 10px; }
  html.ph-p .tile-ico { width: 34px; height: 34px; font-size: 1.2rem; }
  html.ph-p .tile-lab { font-size: .88rem; letter-spacing: .02em; min-width: 0; }
  html.ph-p .menu-inner { padding-top: 54px; }
}
html.ph-p .game.dense .plate { gap: 6px; padding: 3px 10px 3px 3px; border-radius: 15px; }
html.ph-p .game.dense .plate .av { width: 30px; height: 30px; font-size: 1.05rem; border-width: 1.5px; }
html.ph-p .game.dense .plate .nm { font-size: .95rem; max-width: 120px; }
html.ph-p .game.dense .plate .cnt { font-size: .88rem; }
html.ph-p .game.dense .plate .pips { gap: 1px; }
.hcard { touch-action: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; user-select: none; }
.hcard.touching { transform: translate(var(--x, 0), calc(var(--y, 0px) - var(--cw) * .5)) rotate(0deg) scale(1.12); z-index: 99; filter: drop-shadow(0 0 12px rgba(127, 227, 214, .95)) drop-shadow(0 10px 14px rgba(0, 0, 0, .6)); }
.turn-cue { position: absolute; left: 50%; top: 46%; z-index: 80; transform: translate(-50%, -50%); pointer-events: none; padding: .28em 1.3em .22em; border-radius: 99px; background: linear-gradient(180deg, #f1cc62, #c99a2e); color: #1b1200; font: 400 clamp(1.8rem, 7.5vw, 3rem)/1.1 var(--font-display); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; box-shadow: 0 0 0 3px rgba(255, 236, 170, .55), 0 14px 40px rgba(0, 0, 0, .55), 0 0 60px rgba(231, 189, 79, .55); animation: turncue 1.5s ease both; }
@keyframes turncue { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 14% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 24% { transform: translate(-50%, -50%) scale(1); } 78% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -58%) scale(1); } }
html.ph-l .turn-cue { font-size: clamp(1.6rem, 7vh, 2.6rem); }
html.ph .turn-banner.mine { display: none; }
html.ph #prompt.btnonly { width: auto; padding: 0; gap: 0; background: none; border: 0; box-shadow: none; }
html.ph #prompt.btnonly .btn { flex: 0 0 auto; min-width: 180px; background: rgba(0, 12, 34, .92); border: 1.5px solid var(--red); color: #ffd7d7; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); }
/* ---- phone held sideways: the rules flow in compact columns read page by page (no vertical scrolling), like on a wide screen but at real size */
html.ph-l .modal.rulesmodal { height: var(--vh100); }
html.ph-l .rulesmodal .modal-head { padding-bottom: 0; }
html.ph-l .rulesmodal .modal-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 0 12px 2px; }
html.ph-l .rules { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; text-align: left; }
html.ph-l .rules .rtabs { position: static; flex: none; margin: 0 0 4px; padding: 2px 0 4px; gap: 6px; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; border-bottom: 0; background: none; }
html.ph-l .rtabs button { min-height: 36px; padding: .25em .75em; font-size: .8rem; }
html.ph-l .rtabs button:not(.on) .lab { display: inline; }
html.ph-l .rtabs button .ico { font-size: 1rem; }
html.ph-l .rules .rpane { flex: 1 1 0; min-height: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
html.ph-l .rules .rpane::-webkit-scrollbar { display: none; }
html.ph-l .rules .rtab { display: block; height: 100%; column-width: 250px; column-gap: 14px; column-fill: auto; }
html.ph-l .rules .rtab > *, html.ph-l .rules .rtab .rulecard { break-inside: avoid; margin-bottom: 8px; width: auto; }
html.ph-l .rules .rtab > .rsec.big { break-inside: auto; }
html.ph-l .rules .rulecards { display: block; }
html.ph-l .rules .rtab .callout.credits { display: block; }
html.ph-l .rules > .callout.credits { display: none; }
html.ph-l .rules > .legal { flex: none; padding: 0 8px; font-size: .62rem; line-height: 1.15; }
html.ph-l .rules > .rpager { display: flex; flex: none; align-items: center; justify-content: center; gap: 16px; padding: 2px 0; }
html.ph-l .rpager .iconbtn { width: 56px; height: 36px; min-height: 36px; font-size: 1.5rem; } html.ph-l .rpager .iconbtn:disabled { opacity: .35; }
html.ph-l .rpg { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 700; font-size: .75rem; letter-spacing: .06em; }
html.ph-l .rdots { display: flex; gap: 6px; } html.ph-l .rdots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .22); } html.ph-l .rdots i.on { background: var(--gold-2); transform: scale(1.25); }
html.ph-l .rsec { padding: 7px 10px 9px; border-radius: 12px; }
html.ph-l .rsec > header { flex-direction: row; justify-content: flex-start; text-align: left; gap: 8px; margin-bottom: 3px; }
html.ph-l .rsec > header .ico { width: 24px; height: 24px; font-size: .85rem; border-width: 1.5px; flex: none; }
html.ph-l .rsec h3 { font-size: 1.05rem; }
html.ph-l .rbody { font-size: .84rem; line-height: 1.3; }
html.ph-l .rbody ul { gap: 4px; padding-left: 1.1em; }
html.ph-l .rlead { font-size: .82rem; line-height: 1.3; margin: 0 0 6px; text-align: left; }
html.ph-l .rstats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
html.ph-l .rstats > div { padding: 5px 4px; }
html.ph-l .rstats b { font-size: 1.35rem; } html.ph-l .rstats span { font-size: .62rem; }
html.ph-l .steps { grid-template-columns: minmax(0, 1fr); gap: 6px; }
html.ph-l .steps b { font-size: .95rem; } html.ph-l .steps span { font-size: .8rem; line-height: 1.25; }
html.ph-l .rnums { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
html.ph-l .rulecard { grid-template-columns: 48px minmax(0, 1fr); gap: 8px; padding: 6px; }
html.ph-l .rulecard img { width: 48px; }
html.ph-l .rulecard h4 { font-size: .95rem; } html.ph-l .rulecard p { font-size: .78rem; line-height: 1.25; }
html.ph-l .teamdemo { grid-template-columns: minmax(0, 1fr); gap: 4px; } html.ph-l .teamdemo .vs { display: none; }
html.ph-l .racc summary { padding: 8px 10px; font-size: .95rem; min-height: 38px; }
html.ph-l .callout { font-size: .8rem; padding: 7px 9px; line-height: 1.3; }
html.ph-l .steps li { margin-top: 8px; padding: 6px 8px 7px 38px; text-align: left; border-radius: 10px; }
html.ph-l .steps li::before { top: 50%; left: 8px; transform: translateY(-50%); width: 24px; height: 24px; font-size: 1rem; }
html.ph-l .callout .ico { font-size: 1rem; }
html.ph-l .rnums img { width: 100%; }
html.ph-l .rnums small { font-size: .6rem; }
/* ---- turn clock (room with a turn timer): a ring with the seconds hanging on the plate of the player whose turn it is */
.pclock { --p: 100; --c: #7fe3d6; position: relative; display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 1px 8px 4px 6px; border-radius: 99px; background: #031026; border: 1.5px solid var(--c); box-shadow: 0 3px 10px rgba(0, 0, 0, .45); overflow: hidden; color: #fff; font: 400 1rem/1.1 var(--font-display); letter-spacing: .02em; pointer-events: none; }
.pclock .ico { font-style: normal; font-size: .95em; line-height: 1; }
.pclock b { font-weight: 400; min-width: 1.15em; text-align: right; }
.pclock::after { content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--p) * 1%); background: var(--c); }
.pclock.mine { --c: var(--gold-2); }
.pclock.low { --c: #ff4a4d; background: #2a0509; }
.pclock.low b { color: #ff8f91; }
.pclock.beat { animation: clockbeat .9s ease-out; }
.game .plate .pclock { font-size: .86rem; padding: 0 6px 3px 5px; }
html.ph .game .plate .pclock { font-size: 1rem; }
html.ph-l .game .plate .pclock, html.ph-p .game.dense .plate .pclock { font-size: .82rem; padding: 0 5px 3px 4px; }
@keyframes clockbeat { 0% { transform: scale(1.35); box-shadow: 0 0 0 0 rgba(255, 74, 77, .9), 0 3px 10px rgba(0, 0, 0, .5); } 55% { transform: scale(1); box-shadow: 0 0 0 10px rgba(255, 74, 77, 0), 0 3px 10px rgba(0, 0, 0, .5); } 100% { transform: scale(1); } }
.game.panic::after { content: ''; position: absolute; inset: 0; z-index: 14; pointer-events: none; background: radial-gradient(ellipse at 50% 55%, transparent 52%, rgba(255, 30, 40, .42) 100%); animation: panicpulse 1s ease-in-out infinite; }
@keyframes panicpulse { 0%, 100% { opacity: .25; } 18% { opacity: 1; } 60% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .pclock.beat, .game.panic::after { animation: none; } .game.panic::after { opacity: .6; } }
/* ---- small question toast: full screen on a phone */
.fs-toast { position: absolute; left: 50%; top: calc(62px + var(--safe-t)); transform: translateX(-50%); z-index: 55; width: min(92vw, 430px); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; text-align: center; animation: rise .35s both; }
.fs-toast p { margin: 0; font-size: 1.02rem; line-height: 1.3; }
.fs-toast .row { display: flex; gap: 10px; justify-content: center; }
.fs-toast .btn { min-width: 110px; min-height: 44px; }
html.ph-l .fs-toast { top: calc(52px + var(--safe-t)); flex-direction: row; align-items: center; width: min(92vw, 640px); }
html.ph-l .fs-toast p { flex: 1; text-align: left; font-size: .95rem; }
/* ---- choosing the player whose suite receives the card (Joker...): one compact line per player on a phone, no scrolling */
.sp-mini { display: none; }
html.ph .suitepanel { overflow: visible; max-height: none; gap: 6px; padding: 8px; }
html.ph-p .suitepanel { bottom: calc(var(--hand-h, 161px) + 118px); }
html.ph .sp-suite.clickable { display: grid; grid-template-columns: minmax(92px, 34%) minmax(0, 1fr); align-items: center; gap: 8px; min-height: 48px; padding: 5px 8px; border-radius: 12px; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .08); }
html.ph .sp-suite.clickable:active { background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 2px var(--accent); }
html.ph .sp-suite.clickable .sp-head { margin: 0; gap: 6px; min-width: 0; font-size: 1rem; }
html.ph .sp-suite.clickable .sp-head .av { width: 30px; height: 30px; flex: none; font-size: 1.1rem; }
html.ph .sp-suite.clickable .sp-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.ph .sp-suite.clickable .sp-head .muted { display: none; }
html.ph .sp-suite.clickable .sp-grid { display: none; }
html.ph .sp-suite.clickable .sp-mini { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; }
.sp-mini i { display: grid; place-items: center; min-height: 28px; border-radius: 6px; font: 700 .8rem/1 var(--font-ui); font-style: normal; background: rgba(0, 0, 0, .32); color: rgba(255, 255, 255, .28); }
.sp-mini i.n { background: linear-gradient(180deg, #3fb7a9, #1f7f80); color: #031a22; }
.sp-mini i.j { background: linear-gradient(180deg, #f0508e, #b02c64); color: #fff; }
.sp-mini i.next { color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); animation: glowc 1.4s ease-in-out infinite; }
html.ph-l .suitepanel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: end; width: min(96vw, 820px); }
html.ph-l .sp-suite.clickable { grid-template-columns: minmax(80px, 30%) minmax(0, 1fr); min-height: 44px; }
html.ph-l .sp-mini i { min-height: 24px; font-size: .72rem; }
/* ---- choosing ONE card among the adversaries' suites (Retirer 1, Voler 1): cards stay readable and the panel always fits between the toolbar and the prompt (it scrolls rather than leaving the screen) */
html.ph .suitepanel.pick { overflow-y: auto; overscroll-behavior: contain; }
html.ph-p .suitepanel.pick { max-height: calc(100dvh - 64px - var(--hand-h, 161px) - 126px); }
/* phone sideways: a sheet from under the toolbar down to the prompt, which moves to the bottom edge over the hand (not needed meanwhile); ONE suite per line
   (who on the left, the ten slots on the right), the cards as big as the height allows (--rows = number of suites, set by game.js) */
html.ph-l .game.picksheet #prompt { bottom: calc(6px + var(--safe-b, 0px)); }
html.ph-l .suitepanel.pick { --avail: calc(100dvh - 58px - 80px - var(--safe-b, 0px)); top: 58px; bottom: auto; width: max-content; max-width: min(96vw, 820px); max-height: var(--avail);
  display: flex; flex-direction: column; gap: 4px; padding: 4px 8px;
  --spw: max(24px, min(calc((min(96vw, 820px) - 16px - 104px - 12px - 30px) / 10), calc(((var(--avail) - 8px - (var(--rows, 3) - 1) * 4px) / var(--rows, 3) - 10px) * .66))); }
html.ph-l .suitepanel.pick .sp-suite { display: grid; grid-template-columns: 100px auto; align-items: center; gap: 6px; padding: 3px 6px; }
html.ph-l .suitepanel.pick .sp-head { flex-direction: column; justify-content: center; align-items: center; gap: 1px; margin: 0; min-width: 0; font-size: .82rem; line-height: 1.1; text-align: center; }
html.ph-l .suitepanel.pick .sp-head .av { width: 26px; height: 26px; font-size: 1rem; }
html.ph-l .suitepanel.pick .sp-head b { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.ph-l .suitepanel.pick .sp-head .muted { font-size: .72rem; }
html.ph-l .suitepanel.pick .sp-grid { gap: 3px; justify-content: start; }

/* ================================================================== rules: accordion (Précisions) with an opening effect, one item open at a time */
.racc-list { display: flex; flex-direction: column; gap: 8px; }
.racc-col { display: contents; }
.racc-list .racc + .racc { margin-top: 0; }
.racc-h { appearance: none; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border: 0; background: none; cursor: pointer; text-align: left; font: 400 1.25rem var(--font-display); letter-spacing: .06em; color: var(--teal-glow, #8fe9de); transition: background .2s; }
.racc-h:hover { background: rgba(255, 255, 255, .05); }
.racc-h .chev { width: 9px; height: 9px; flex: none; margin-right: 4px; border-right: 2.5px solid var(--gold-2); border-bottom: 2.5px solid var(--gold-2); transform: rotate(45deg) translate(-2px, -2px); transition: transform .32s cubic-bezier(.3, .8, .3, 1); }
.racc.open .racc-h .chev { transform: rotate(225deg) translate(-2px, -2px); }
.racc { transition: border-color .25s, box-shadow .3s, background .25s; }
.racc.open { border-color: rgba(231, 189, 79, .55); background: rgba(255, 255, 255, .07); box-shadow: 0 0 0 1px rgba(231, 189, 79, .16), 0 8px 24px rgba(0, 0, 0, .25); }
.racc-b { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .34s cubic-bezier(.3, .8, .3, 1); }
.racc.open .racc-b { grid-template-rows: 1fr; }
.racc-in { min-height: 0; overflow: hidden; opacity: 0; transform: translateY(-6px); transition: opacity .28s ease .06s, transform .34s ease; }
.racc.open .racc-in { opacity: 1; transform: none; }
.racc-in .rbody { padding: 10px 16px 14px; border-top: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { .racc-b, .racc-in, .racc-h .chev, .racc { transition: none; } }
html.ph .racc-h { padding: 14px 16px; font-size: 1.3rem; min-height: 54px; }
html.lw .rules .rtab.acc, html.ph-l .rules .rtab.acc { display: block; column-width: auto; column-count: 1; height: auto; }
html.lw .rpane[data-tab=precisions], html.ph-l .rpane[data-tab=precisions] { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
html.lw .racc-list.cols, html.ph-l .racc-list.cols { flex-direction: row; align-items: flex-start; gap: 14px; }
html.lw .racc-list.cols .racc-col, html.ph-l .racc-list.cols .racc-col { display: flex; flex-direction: column; gap: 8px; flex: 1 1 0; min-width: 0; }
html.ph-l .racc-h { padding: 7px 10px; font-size: .92rem; min-height: 38px; }
html.ph-l .racc-in .rbody { padding: 6px 10px 9px; font-size: .8rem; }
html.ph-l .rtab.acc > .rlead { margin: 0 0 8px; }
html.lw .racc-h { padding: 9px 14px; font-size: 1.1rem; }
html.lw .racc-in .rbody { padding: 8px 14px 11px; font-size: .92rem; }
/* team tab on one screen (wide / sideways layouts): the two teams on the left, the text and the goal on the right, nothing split across columns */
html.lw .rules .rtab.team, html.ph-l .rules .rtab.team { display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, 2fr); grid-template-rows: auto 1fr; gap: 10px 14px; column-width: auto; height: auto; align-content: start; }
html.lw .rules .rtab.team > .teamdemo, html.ph-l .rules .rtab.team > .teamdemo { grid-row: 1 / span 2; grid-template-columns: minmax(0, 1fr); align-content: start; margin: 0; }
html.lw .rules .rtab.team > *, html.ph-l .rules .rtab.team > * { margin-bottom: 0; }
html.lw .rpane[data-tab=precisions], html.ph-l .rpane[data-tab=precisions] { padding-right: 10px; }
/* one-screen tabs: tighter text so that the shrink stays small */
html.ph-l .rtab.fit .rbody { line-height: 1.22; }
html.ph-l .rtab.fit .rbody ul { gap: 1px; margin: 3px 0; }
html.ph-l .rtab.fit .rbody p { margin: 3px 0; }
html.ph-l .rtab.fit .rsec { padding: 6px 10px 7px; }
html.ph-l .rtab.fit .rsec > header { margin-bottom: 1px; }
html.ph-l .rtab.fit .callout { padding: 5px 9px; }
html.ph-l .rules .rtab.team { grid-template-rows: auto auto; }
html.lw .rules .rtab.team { grid-template-rows: auto auto; }

/* ---- "report a bug" button: bottom left corner of every screen. Under the windows, above the table; discreet until pointed at.
   In a game held upright (portrait) the hand fills the whole bottom edge, so there it rises above the hand; `zoom` follows the scaled desktop layout (--ui-zoom). */
.bugbtn { position: absolute; left: calc(10px + env(safe-area-inset-left, 0px)); bottom: calc(10px + var(--safe-b)); z-index: 22; zoom: var(--ui-zoom, 1); width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: rgba(0, 12, 34, .55); color: var(--text); font-size: 1rem; line-height: 1; cursor: pointer; opacity: .6; backdrop-filter: blur(6px); transition: opacity .15s, background .15s, transform .1s; }
.bugbtn:hover, .bugbtn:focus-visible { opacity: 1; background: rgba(240, 72, 74, .28); }
.bugbtn:active { transform: scale(.92); }
@media (orientation: portrait) { #app.in-game .bugbtn { bottom: calc((var(--hand-h, 30vh) + var(--safe-b) + 8px) / var(--ui-zoom, 1)); } }
/* Edition choice and Master-specific game controls. */
.edition-chooser { padding: 10px 14px; border-color: rgba(255,211,38,.5); }
.edition-chooser .lbl { margin-bottom: 5px; }
.edition-chooser p { font-size: .95rem; line-height: 1.2; margin: 7px 0 0; color: #c8d4de; }
.edition-room { font: 400 1.15rem var(--font-display); color: var(--gold-2); letter-spacing: .07em; }
.menu.gate .edition-chooser { grid-column: 1 / -1; }
.master-choices { display: flex; flex-direction: column; gap: 12px; }
.master-choices .choice-row { border: 1px solid #526371; border-radius: 10px; padding: 10px; }
.master-choices .choice-cards { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.master-choices .choice-card { background: #111b23; border: 2px solid transparent; border-radius: 8px; padding: 3px; cursor: pointer; color: white; min-width: 44px; min-height: 44px; }
.master-choices .choice-card.on { border-color: var(--gold-2); background: #544916; }
.master-choices .choice-card img { width: 62px; height: 94px; object-fit: contain; display: block; }
.master-choices .choice-run { display: flex; gap: 3px; }
.master-status { position: absolute; top: 54px; left: 50%; transform: translateX(-50%); z-index: 16; display: flex; gap: 6px; max-width: 80%; flex-wrap: wrap; justify-content: center; pointer-events: none; }
.master-status .pill, .master-status button { pointer-events: auto; }
.master-status .pill { background: rgba(25,22,7,.9); border: 1px solid #c9a328; color: #ffe457; }
html.ph-p .master-status { top: 88px; max-width: 95%; font-size: .82rem; }
/* In landscape the centered logo shares the header with language/sound controls.
   The full-width edition chooser gets the following row, clear of those controls. */
html.ph-l .menu.gate .mhead { grid-row: 1; }
html.ph-l .menu.gate .edition-chooser { grid-row: 2; }
html.ph-l .edition-chooser { padding: 6px 10px; }
html.ph-l .edition-chooser p { display: none; }
html.ph .master-choice .modal-body { padding-bottom: 20px; }

/* The public edition chooser needs room beside the profile on desktop. */
html.lw:not(.ph) .menu .logo, html.lw:not(.ph) .menu.gate .mhead .logo { width: min(100%, 320px); max-height: 166px; object-fit: contain; }
html.master-edition.ph-l .menu-snd { left: auto; right: 10px; }
html.master-edition.ph-l .menu .mright { padding-top: 22px; }


/* ================================================================== Master: black cloth, charcoal panels, yellow ink.
   All rules are scoped to the selected edition; base keeps its original palette. */
html.master-edition {
  color-scheme: dark;
  --navy: #10110e; --navy-2: #191a15; --navy-3: #25261e; --navy-4: #34352a;
  --teal: #ffd326; --teal-glow: #ffe981; --teal-d: #a48109;
  --gold: #ffd326; --gold-2: #ffe457; --gold-d: #997600;
  --text: #f5f3e8; --muted: #b8b6a7; --line: rgba(255, 211, 38, .26);
  --glass: linear-gradient(180deg, rgba(38, 39, 31, .94), rgba(17, 18, 15, .96));
  --avbg: radial-gradient(circle at 35% 30%, #4b4830, var(--navy-3));
  --master-yellow: 255, 211, 38;
}
html.master-edition #app { background: radial-gradient(ellipse at 50% -15%, #484126 0%, #22231b 39%, #10110e 90%); }
html.master-edition #boot { background: radial-gradient(ellipse at 50% 40%, #34321f, #10110e 72%); }
html.master-edition .rays::before { background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(var(--master-yellow), .075) 0 3deg, transparent 3deg 9deg); }
html.master-edition .screen:not(.game) .glass { background: linear-gradient(180deg, rgba(37, 38, 30, .96), rgba(18, 19, 15, .98)); }
html.master-edition .glass { box-shadow: 0 18px 50px rgba(0, 0, 0, .46), inset 0 1px 0 rgba(255, 245, 188, .06); }

/* Warm accents share one palette, with dark text for readable yellow controls. */
html.master-edition .btn:not(.ghost):not(.danger),
html.master-edition :is(.seg button.on, .langsw button.on, .turn-cue) {
  color: #1c1908; background: linear-gradient(180deg, #ffe773, #e9bc18);
}
html.master-edition .btn.teal { box-shadow: 0 3px 0 var(--gold-d), 0 10px 22px rgba(0, 0, 0, .38); }
html.master-edition :is(.iconbtn, .bugbtn, .langsw, .seg, .tile-ico, .tchip) { background: rgba(15, 16, 12, .78); }
html.master-edition :is(.iconbtn:hover, .avatars button:hover) { background: rgba(var(--master-yellow), .16); }
html.master-edition :is(.iconbtn.on, .iconbtn.eye.on, .avatars button.sel, .chip.sel, .tabs button.on) { background: rgba(var(--master-yellow), .16); border-color: var(--gold); }
html.master-edition :is(input[type=text], input[type=number], input[type=password], input[type=search], input[type=email], input[type=color], textarea, select) { background: rgba(9, 10, 7, .72); }
html.master-edition :is(input, textarea, select):focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(var(--master-yellow), .18); }
html.master-edition :is(.av, .gate-ico) { --avbg: radial-gradient(circle at 35% 30%, #4b4830, var(--navy-3)); }
html.master-edition :is(.seat .av, .plate .av, .podium .who .av, .gate-ico, .rsec > header .ico) { background: var(--avbg); }
html.master-edition .seat.empty .av { background: transparent; }
html.master-edition .tile { background: linear-gradient(155deg, #34352a, #191a15); }
html.master-edition .tile.t-rules { --tc: rgba(var(--master-yellow), .28); --tb: var(--gold); }
html.master-edition .tile.t-settings { --tc: rgba(255, 235, 152, .22); --tb: #cabb7c; }
html.master-edition .pill:not(.red):not(.pink):not(.enemy),
html.master-edition .banner:not(.maint) { color: var(--gold-2); background: rgba(var(--master-yellow), .12); }
html.master-edition .pbar i { background: linear-gradient(90deg, #c49e19, #ffe981); }
html.master-edition .edition-chooser { border-color: rgba(var(--master-yellow), .56); box-shadow: inset 3px 0 0 var(--gold), 0 10px 26px rgba(0, 0, 0, .25); }
html.master-edition .edition-chooser p { color: #cecbb9; }
html.master-edition .lobby-foot { background: linear-gradient(0deg, var(--navy) 55%, transparent); }

/* In-game layers use neutral black, so the official multicolour card faces stay legible. */
html.master-edition .topbar { background: linear-gradient(180deg, rgba(7, 8, 5, .86), transparent); }
html.master-edition :is(.plate, .turn-banner:not(.mine):not(.react), #prompt, .cardtip, .toast, .sizewarn, #omni) { background: rgba(15, 16, 12, .94); }
html.master-edition .turn-banner.mine { color: #1c1908; background: linear-gradient(180deg, #ffe773, #e9bc18); border-color: #fff0a3; }
html.master-edition .plate.active { background: rgba(56, 48, 13, .94); border-color: var(--gold-2); box-shadow: 0 0 0 2px rgba(var(--master-yellow), .24), 0 0 24px rgba(var(--master-yellow), .36); }
html.master-edition .plate.selectable { animation-name: masterPlate; }
html.master-edition .plate.selectable:hover { background: rgba(91, 77, 17, .9); }
@keyframes masterPlate { 50% { box-shadow: 0 0 22px rgba(255, 227, 92, .65); } }
html.master-edition .hcard.playable::after { box-shadow: 0 0 0 2px #ffe981, 0 0 18px rgba(var(--master-yellow), .6); }
html.master-edition :is(.pip.n, .sp-mini i.n) { background: linear-gradient(180deg, #ffe981, #d6ae1b); color: #28220a; }
html.master-edition .sp-empty { border-color: rgba(var(--master-yellow), .36); color: rgba(255, 227, 92, .62); }
html.master-edition #stage { background: radial-gradient(circle at 50% 44%, rgba(5, 6, 3, .84), rgba(5, 6, 3, .38) 75%); }
html.master-edition #log .l { background: rgba(12, 13, 9, .78); color: #dfddcf; }
html.master-edition #log.expanded { background: rgba(12, 13, 9, .9); }
html.master-edition .modal-bg { background: rgba(3, 4, 2, .76); }
html.master-edition .pclock:not(.low) { --c: #ffe457; background: #191b12; }
html.master-edition.ph #prompt.btnonly { background: none; }
html.master-edition.ph #prompt.btnonly .btn { background: rgba(15, 16, 12, .96); }

/* Teams retain two clear identifiers: yellow for allies, amber-orange for opponents. */
html.master-edition .plate.ally { border-color: rgba(var(--master-yellow), .8); box-shadow: inset 5px 0 0 var(--gold); }
html.master-edition .plate.active.ally { color: var(--gold); box-shadow: inset 5px 0 0 var(--gold), 0 0 22px rgba(var(--master-yellow), .35); }
html.master-edition :is(.plate.ally .av, .tchip.ally, .teamchip.ally, .teamdemo .ally) { border-color: var(--gold); }
html.master-edition :is(.plate .tag.ally, .pill.ally, .teamchip.ally, .teamdemo .ally b) { color: #ffe981; }
html.master-edition :is(.plate .tag.ally, .teamdemo .ally) { background: rgba(var(--master-yellow), .14); }
html.master-edition .tchip.ally i { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
html.master-edition .seat.ally { background: linear-gradient(90deg, rgba(var(--master-yellow), .13), rgba(255, 255, 255, .035) 45%); }

/* Rules and action choices share the charcoal surfaces of the game. */
html.master-edition :is(.rtabs, .acc-tabs) { background: #1a1b15; }
html.master-edition .rstats div { background: linear-gradient(155deg, #34352a, #191a15); }
html.master-edition :is(.steps li, .rulecard) { background: rgba(9, 10, 7, .45); }
html.master-edition .rulecard p { color: #d7d5c7; }
html.master-edition .rtabs button.on { background: linear-gradient(180deg, rgba(var(--master-yellow), .2), rgba(var(--master-yellow), .08)); border-color: var(--gold); box-shadow: 0 0 18px rgba(var(--master-yellow), .12); }
html.master-edition .master-choices .choice-row { border-color: var(--line); background: rgba(255, 255, 255, .025); }
html.master-edition .master-choices .choice-card { background: #161711; }
html.master-edition .master-choices .choice-card.on { border-color: var(--gold); background: #4a421a; }
html.master-edition .master-status .pill { background: rgba(19, 20, 13, .96); border-color: #a78a27; color: #ffe981; }
html.master-edition ::-webkit-scrollbar-track { background: rgba(9, 10, 7, .45); }
html.master-edition ::-webkit-scrollbar-thumb { border-color: #191a15; }


/* Edition filters and public player statistics, shared by both visual themes. */
.stats-editions { grid-template-columns: repeat(3, minmax(0, 1fr)); flex: none; }
.stats-editions button { min-width: 0; padding: .55em .45em; font-size: .86rem; line-height: 1.15; white-space: normal; }
.lb-caption { caption-side: top; text-align: left; color: var(--gold-2); font-weight: 800; padding: 2px 8px 8px; }
.lb tbody tr:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -2px; background: rgba(255, 255, 255, .08); }
.player-statistics, .player-stat-content { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stat-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.stat-heading h3, .player-history h3 { font-size: 1rem; margin: 0; color: var(--gold-2); }
.stat-heading .muted { font-size: .8rem; }
.player-statistics .stats-grid { margin-top: 0; }
.player-statistics .player-totals { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.player-statistics .player-records { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.player-statistics .stats-grid b { font-size: 1.5rem; overflow-wrap: anywhere; }
.player-statistics .stats-grid span { font-size: .68rem; letter-spacing: .035em; line-height: 1.2; display: block; margin-top: 4px; }
.stats-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stats-mode { display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .025); }
.stats-mode b { font-size: .85rem; color: var(--gold-2); }
.stats-mode span, .stats-mode small { font-size: .78rem; line-height: 1.2; }
.stats-legacy { padding: 8px 10px; border-left: 2px solid var(--gold-2); background: rgba(255, 255, 255, .035); border-radius: 0 8px 8px 0; }
.player-history { display: flex; flex-direction: column; gap: 8px; }
.player-history p, .player-stat-content > p { margin: 0; }
.recent-games { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.recent-games li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.recent-games li > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.recent-games b { font-size: .85rem; }
.recent-games small, .recent-games time { font-size: .72rem; }
.recent-outcome { text-align: right; font-size: .8rem; }
.recent-outcome time { color: var(--muted); }
.recent-outcome .won { color: var(--teal-glow); font-weight: 800; }
.recent-outcome .lost { color: var(--muted); }
.player-modal .modal-body { overflow-x: hidden; }
html.lw .acc-col .player-statistics .player-totals, html.lw .acc-col .player-statistics .player-records { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.lw .acc-col .player-statistics .stats-modes { grid-template-columns: minmax(0, 1fr); }
html.ph .acc-body[data-active="stats"] .player-statistics[data-tab="stats"] { display: flex; }
html.ph .player-statistics .stats-grid { gap: 6px; }
html.ph .player-statistics .stats-grid div { padding: 10px 5px; }
html.ph .player-statistics .stats-grid b { font-size: 1.5rem; }
html.ph .player-statistics .stats-grid span { font-size: .68rem; }
html.ph .stats-editions { padding: 4px; gap: 4px; }
html.ph .stats-editions button { font-size: .8rem; padding: .5em .2em; min-height: 42px; }
html.ph .lbmodal .stats-editions button { min-height: 38px; }
html.ph .lb-caption { font-size: .8rem; padding-bottom: 5px; }
html.ph-l .lbmodal .modal-body > .stack { gap: 6px; }
html.ph-l .lbmodal .lb-sort { grid-template-columns: repeat(4, minmax(0, 1fr)); }
html.ph-l .lbmodal .lb-sort button { font-size: .75rem; padding: .4em .2em; }

.lb-controls { display: contents; }
html.ph .player-statistics .player-totals { grid-template-columns: repeat(4, minmax(0, 1fr)); }
html.ph-l .lb-controls { display: grid; grid-template-columns: 1fr 1.2fr .8fr; align-items: stretch; gap: 6px; flex: none; }
html.ph-l .lb-controls .seg { gap: 2px; padding: 3px; }
html.ph-l .lb-controls .stats-editions button, html.ph-l .lb-controls .lb-sort button { min-height: 42px; font-size: .68rem; letter-spacing: .015em; line-height: 1.1; padding: .3em .15em; }
html.ph-l .lb-controls input { min-width: 0; min-height: 50px; font-size: .9rem; padding: .5em .6em; }

/* Master booklet: warm paper, printed colour families, and readable vertical
   sections at every size. Base-edition pagination remains unchanged. */
html.master-edition .modal.master-rulesmodal { width: min(100%, 1080px); }
html.master-edition .master-rulesmodal .modal-body { display: block; overflow-y: auto; overflow-x: hidden; flex: 1 1 auto; min-height: 0; padding-bottom: 20px; }
html.master-edition .master-rulesmodal .rprogress { display: block; }
html.master-edition .master-rulebook { display: block; min-height: 0; text-align: left; }
html.master-edition .master-rulebook .rtabs { position: sticky; top: 0; z-index: 4; margin-bottom: 16px; padding: 10px 0; background: #191a15; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: thin; }
html.master-edition .master-rulebook .rtabs button { flex: none; min-height: 42px; font-size: .85rem; letter-spacing: .025em; }
html.master-edition .master-rulebook .rtabs button .lab { display: inline; }
html.master-edition .master-rulebook .rpane { display: block; flex: none; min-height: 0; height: auto; overflow: visible; }
html.master-edition .master-rulebook .rtab { display: flex; flex-direction: column; height: auto; column-count: auto; column-width: auto; gap: 16px; }
html.master-edition .master-rulebook .rtab > * { width: 100%; margin-bottom: 0; }
html.master-edition .master-rulebook > .rpager { display: none; }
html.master-edition .master-rulebook > .credits { display: block; }
html.master-edition .master-rulebook .rsec { padding: 18px; background: #f5efdc; border: 1px solid #d8cfb1; color: #292b21; box-shadow: 0 5px 18px rgba(0, 0, 0, .14); }
html.master-edition .master-rulebook .rsec > header { flex-direction: row; justify-content: flex-start; text-align: left; gap: 10px; margin-bottom: 12px; }
html.master-edition .master-rulebook .rsec > header .ico { flex: none; width: 32px; height: 32px; border: 1px solid #bfa958; background: #ffda45; font-size: 1.05rem; }
html.master-edition .master-rulebook .rsec h3 { font-size: 1.4rem; color: #22251b; letter-spacing: .035em; line-height: 1.15; }
html.master-edition .master-rulebook .rbody { font-size: .97rem; line-height: 1.5; }
html.master-edition .master-rulebook .rbody p { margin: 0 0 10px; }
html.master-edition .master-rulebook .rbody p:last-child { margin-bottom: 0; }
html.master-edition .master-rulebook .rbody ul { gap: 7px; padding-left: 1.2em; }
html.master-edition .master-rulebook .rbody li::marker { color: #7f6410; }
html.master-edition .master-rulebook .rlead { color: #535443; line-height: 1.4; }
html.master-edition .master-rulebook .rtab > .rlead { color: #d7d5c7; text-align: left; }
html.master-edition .master-rulebook .rstats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
html.master-edition .master-rulebook .rstats > div { padding: 12px 5px; }
html.master-edition .master-rulebook .rstats b { font-size: 1.95rem; }
html.master-edition .master-rulebook .rstats span { font-size: .72rem; letter-spacing: .035em; text-align: center; }
html.master-edition .master-book-intro { padding: 20px; background: linear-gradient(125deg, #ffdb34, #f1c51d); color: #171a10; border-radius: 14px; border: 1px solid #ffe574; }
html.master-edition .master-book-kicker { display: inline-block; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
html.master-edition .master-book-intro h3 { margin: 7px 0; font-size: 1.6rem; line-height: 1.15; color: #171a10; }
html.master-edition .master-book-intro p { margin: 0; font-size: .95rem; line-height: 1.4; }
html.master-edition .master-rulebook .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 14px; }
html.master-edition .master-rulebook .steps li { background: #e9e1c8; border-color: #d3c8a5; padding: 30px 12px 12px; margin-top: 12px; text-align: center; }
html.master-edition .master-rulebook .steps li::before { top: -12px; left: 50%; transform: translateX(-50%); width: 30px; height: 30px; font-size: 1.2rem; }
html.master-edition .master-rulebook .steps b { color: #22251b; font-size: 1.2rem; }
html.master-edition .master-rulebook .steps span { color: #4a4c3b; font-size: .94rem; line-height: 1.4; }
html.master-edition .master-family-note { padding: 9px 12px; margin: 0 0 14px; background: #e7dfc7; border-radius: 8px; font-size: .91rem; color: #474938; line-height: 1.4; }
html.master-edition .master-rulebook .rulecards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
html.master-edition .master-rulebook .rulecard { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 12px; padding: 12px; margin: 0; min-width: 0; border: 1px solid #dbd0b0; border-left: 5px solid var(--accent); background: #fffaf0; box-shadow: 0 2px 6px rgba(35, 31, 15, .04); }
html.master-edition .master-rulebook .rulecard h4 { display: block; color: #26291e; font-size: 1.18rem; line-height: 1.15; overflow-wrap: break-word; letter-spacing: .025em; }
html.master-edition .master-rulebook .rulecard p { color: #414333; font-size: .9rem; line-height: 1.45; margin: 6px 0 0; }
html.master-edition .master-card-count { display: block; color: #6b6b53; font-size: .75rem; font-weight: 700; }
html.master-edition .master-card-zoom { appearance: none; display: block; border: 0; padding: 0; margin: 0; min-width: 0; width: 100%; height: auto; background: transparent; cursor: zoom-in; border-radius: 6px; align-self: start; }
html.master-edition .master-card-zoom:focus-visible { outline: 3px solid #886a00; outline-offset: 4px; }
html.master-edition .master-card-zoom img { display: block; width: 100%; height: auto; }
html.master-edition .master-rulebook .rulecard img { width: 74px; }
html.master-edition .master-rulebook .rnums { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 7px; }
html.master-edition .master-rulebook .rnums small { color: #68694f; font-size: .78rem; }
html.master-edition .master-rulebook .master-digital { background: #e8e4d5; border-style: dashed; border-color: #a8a38d; }
html.master-edition .master-book-source { margin: 0; color: #c1bfad; font-size: .8rem; line-height: 1.45; }
html.master-edition .master-rulebook .callout { font-size: .95rem; line-height: 1.45; }
html.master-edition .master-rulebook .callout .ico { font-size: 1.4rem; }
@media (max-width: 620px) {
  html.master-edition .master-rulebook .rulecards { grid-template-columns: minmax(0, 1fr); }
  html.master-edition .master-rulebook .rnums { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  html.master-edition .master-rulebook .rstats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html.master-edition .master-rulebook .rsec { padding: 14px; }
  html.master-edition .master-book-intro { padding: 16px; }
  html.master-edition .master-book-intro h3 { font-size: 1.4rem; }
  html.master-edition .master-rulebook .rtabs button { padding: .4em .75em; font-size: .8rem; }
  html.master-edition .master-rulebook .rtabs button:not(.on) .lab { display: none; }
}
html.master-edition.ph-l .master-rulesmodal .modal-head { padding-bottom: 6px; }
html.master-edition.ph-l .master-rulebook .rtabs { padding-top: 4px; padding-bottom: 6px; margin-bottom: 10px; }
html.master-edition.ph-l .master-rulebook .rtabs button { min-height: 36px; }
html.master-edition.ph-l .master-rulebook .rsec h3 { font-size: 1.25rem; }
html.master-edition.ph-l .master-rulebook .rbody { font-size: .92rem; }

/* The Master card inspector keeps the illustration, rule and close control
   visible together, including on a phone held sideways. */
html.master-edition .modal.master-zoom { width: min(94vw, 760px); max-height: calc(var(--vh100) - 24px); }
html.master-edition .master-zoom .modal-body { padding: 16px; }
html.master-edition .master-zoom-card { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1fr); grid-template-rows: auto 1fr auto; gap: 12px 20px; align-items: start; width: 100%; max-width: none; padding: 0; }
html.master-edition .master-zoom-card img { grid-column: 1; grid-row: 1 / 4; display: block; width: 100%; height: auto; max-height: calc(var(--vh100) - 62px); object-fit: contain; }
html.master-edition .master-zoom-card h3 { grid-column: 2; margin: 0; font-size: 1.5rem; line-height: 1.2; color: var(--gold-2); }
html.master-edition .master-zoom-card p { grid-column: 2; text-align: left !important; font-size: 1rem; line-height: 1.5; }
html.master-edition .master-zoom-card .btn { grid-column: 2; justify-self: start; align-self: end; min-width: 120px; }
@media (max-width: 620px) {
  html.master-edition .modal.master-zoom { width: min(94vw, 420px); }
  html.master-edition .master-zoom-card { display: flex; gap: 12px; }
  html.master-edition .master-zoom-card img { width: auto; max-width: 100%; max-height: min(40vh, 330px); align-self: center; }
  html.master-edition .master-zoom-card h3 { text-align: center; width: 100%; }
  html.master-edition .master-zoom-card .btn { align-self: stretch; width: 100%; }
}

/* A menu installation suggestion must not cover a rule or a card inspector. */
html.master-edition:has(.master-rulesmodal, .master-zoom) .pwa-card { display: none; }
