/* Modern interface of BallMachina (menus and HUD over the 3D view). */
@font-face { font-family: 'Saira'; src: url('../assets/fonts/saira.woff2') format('woff2'); font-weight: 100 900; font-stretch: 100% 115%; font-style: normal; font-display: swap; }
@font-face { font-family: 'Saira'; src: url('../assets/fonts/saira-italic.woff2') format('woff2'); font-weight: 100 900; font-stretch: 100% 115%; font-style: italic; font-display: swap; }

:root {
  --p1: #ff7a2f; --p2: #2fc6ff; --gold: #ffd23d; --ok: #3dff8a; --bad: #ff5a4f;
  --text: #eef2f8; --muted: #93a0b5; --faint: #5d6880;
  --panel: rgba(10, 14, 21, 0.74); --panel-2: rgba(22, 28, 40, 0.82); --line: rgba(170, 195, 235, 0.16);
  --sel: rgba(255, 255, 255, 0.09);
  --radius: 14px;
  --font: 'Saira', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

#ui { position: fixed; inset: 0; pointer-events: none; display: none; font-family: var(--font); color: var(--text);
  -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; z-index: 3; }
#ui.show { display: block; }
#ui .region { position: absolute; inset: 0; pointer-events: none; }
:where(#ui) :is(button, input, [data-slider], .panel, .menu, .cards) { pointer-events: auto; }
:where(#ui) button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
:where(#ui) kbd { font: 600 11px/1 var(--font); letter-spacing: .04em; padding: 3px 6px; border-radius: 5px; border: 1px solid var(--line);
  background: rgba(255,255,255,.06); color: var(--text); margin-right: 6px; }

/* ---------- menu screens ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; justify-content: safe center; overflow-y: auto; overscroll-behavior: contain;
  padding: max(28px, env(safe-area-inset-top)) max(16px, 7vw) max(28px, env(safe-area-inset-bottom));
  background: linear-gradient(90deg, rgba(5,7,11,.92) 0%, rgba(5,7,11,.72) 34%, rgba(5,7,11,.12) 70%, rgba(5,7,11,0) 100%); }
.screen.center { align-items: center; text-align: center; background: radial-gradient(ellipse at center, rgba(5,7,11,.55), rgba(5,7,11,.9)); }
.screen.wide { background: linear-gradient(180deg, rgba(5,7,11,.85), rgba(5,7,11,.55) 40%, rgba(5,7,11,.85)); }

.wordmark { font-style: italic; font-weight: 900; font-stretch: 112%; text-transform: uppercase; line-height: .86; letter-spacing: -.01em;
  font-size: clamp(44px, 8.2vw, 112px); margin: 0 0 6px;
  background: linear-gradient(180deg, #ffffff 0%, #c9d4e6 55%, #8996ad 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 24px rgba(0,0,0,.55)); }
.wordmark span { display: block; }
.wordmark span:last-child { background: linear-gradient(90deg, var(--p1), #ffb36b 40%, var(--p2)); -webkit-background-clip: text; background-clip: text; }
.byline { color: var(--muted); font-weight: 500; letter-spacing: .32em; text-transform: uppercase; font-size: 12px; margin-bottom: clamp(18px, 4vh, 44px); }

h1.title { font-style: italic; font-weight: 800; font-stretch: 105%; text-transform: uppercase; font-size: clamp(30px, 4.4vw, 54px);
  margin: 0 0 4px; letter-spacing: .01em; }
.subtitle { color: var(--muted); margin: 0 0 clamp(16px, 3vh, 30px); font-size: 15px; max-width: 46ch; }

.menu { display: flex; flex-direction: column; gap: 4px; width: min(440px, 100%); }
.menu .item { position: relative; display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  padding: 11px 18px 11px 22px; border-radius: 12px; transition: background .15s, transform .15s; }
.menu .item .t { font-weight: 700; font-stretch: 108%; font-size: clamp(19px, 2.1vw, 24px); letter-spacing: .04em; text-transform: uppercase; }
.menu .item .d { color: var(--muted); font-size: 13px; margin-top: 1px; }
.menu .item::before { content: ''; position: absolute; left: 6px; top: 12px; bottom: 12px; width: 4px; border-radius: 4px;
  background: linear-gradient(180deg, var(--p1), var(--p2)); opacity: 0; transform: scaleY(.4); transition: opacity .15s, transform .15s; }
.menu .item.sel { background: var(--sel); transform: translateX(4px); }
.menu .item.sel::before { opacity: 1; transform: none; }
.menu .item.sel .d { color: #c6d0e0; }

.hints { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 12px; letter-spacing: .04em; }
/* key hints of a menu screen: a bar fixed at the bottom of the window (the screen scrolls under it) */
.screen > .hints { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; pointer-events: none;
  padding: 14px max(16px, 7vw) max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(5,7,11,.55), rgba(5,7,11,.92) 60%); }
.screen.center > .hints { justify-content: center; }
/* menus scroll wherever the finger or the wheel is (the 3D view behind takes no input there) */
body.in-menu .screen { pointer-events: auto; }
.corner { position: absolute; right: max(16px, 4vw); bottom: max(18px, env(safe-area-inset-bottom)); color: var(--faint); font-size: 12px; letter-spacing: .08em; text-align: right; }

/* cards (court / ball / difficulty) */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; width: min(980px, 100%); }
.card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 12px 14px;
  border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .15s, border-color .15s, background .15s; }
.card.sel { border-color: rgba(255,255,255,.7); background: var(--panel-2); transform: translateY(-4px); box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.card .t { font-weight: 700; font-stretch: 105%; text-transform: uppercase; letter-spacing: .05em; font-size: 15px; }
.card .d { color: var(--muted); font-size: 12px; text-align: center; }
.card .ballimg { width: 74px; height: 74px; border-radius: 50%; background-size: 210% 105%; background-position: center;
  box-shadow: inset -12px -14px 22px rgba(0,0,0,.55), inset 8px 8px 16px rgba(255,255,255,.18), 0 8px 18px rgba(0,0,0,.5); }
.card .court { border: 2px solid rgba(255,255,255,.75); border-radius: 6px; position: relative; background: rgba(60,70,86,.6); }
.card .court::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 2px solid rgba(255,255,255,.6); }
/* court cards take the look of their arena (arenas.js) */
.card .court.a0 { border-color: #e8b81c; background: linear-gradient(160deg, #6f675b, #4a433b); }
.card .court.a2 { background: repeating-linear-gradient(90deg, #4c8a43 0 7px, #5a9a4f 7px 14px); }
.card .court.a3 { border-color: #6fe4ff; background: #0a1424; box-shadow: 0 0 12px rgba(79,216,255,.55), inset 0 0 10px rgba(79,216,255,.35); }
.card .court.a3::after { border-left-color: rgba(111,228,255,.8); }
.card .arena { font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; margin-top: -6px; color: #aebfd6; }
.card .arena.a0 { color: #e8b81c; }
.card .arena.a2 { color: #ffb27a; }
.card .arena.a3 { color: #6fe4ff; }
.card .lvl { display: flex; gap: 4px; }
.card .lvl i { width: 18px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); }
.card .lvl i.on { background: var(--gold); }

/* forms: rows with segmented choices and sliders */
.form { display: flex; flex-direction: column; gap: 4px; width: min(720px, 100%); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 14px; border-radius: 10px; min-height: 44px; }
.row.sel { background: var(--sel); box-shadow: inset 3px 0 0 #fff; }
.row .label { font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 14px; color: #d6deea; }
.seg { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 3px; padding: 3px; border-radius: 10px; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.seg button { padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: 14px; color: var(--muted); min-width: 40px; }
.seg button.on { background: #fff; color: #0b0e14; }
.slider { position: relative; width: min(300px, 46vw); height: 26px; border-radius: 8px; background: rgba(255,255,255,.07); border: 1px solid var(--line); overflow: hidden; cursor: ew-resize; touch-action: pan-y; }
.slider .fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, rgba(255,255,255,.35), #fff); border-radius: 7px 0 0 7px; }
.slider .val { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 700; color: #0b0e14; mix-blend-mode: difference; filter: invert(1); }
.form .sep { height: 1px; background: var(--line); margin: 8px 0; }
.form .group { color: var(--muted); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; margin: 10px 14px 2px; }
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.form > .actions { margin-top: 10px; }
.btn { padding: 12px 22px; border-radius: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 15px;
  background: rgba(255,255,255,.08); border: 1px solid var(--line); }
.btn.primary { background: #fff; color: #0b0e14; border-color: #fff; }
.btn.sel { outline: 2px solid #fff; outline-offset: 2px; }

/* controls table */
.padmap { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 14px; }
.padmap span { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 12px; font-weight: 600; align-self: center; }
.padmap b { font-weight: 600; }
.keys { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.6fr); gap: 4px 10px; align-items: center; width: 100%; }
.keys .h { color: var(--muted); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; padding: 0 8px; }
.keys .a { font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: 14px; padding-right: 12px; }
.keys button.k { padding: 9px 12px; border-radius: 9px; background: rgba(255,255,255,.05); border: 1px solid var(--line); font-weight: 700; letter-spacing: .05em; text-align: left; }
.keys button.k.sel { background: #fff; color: #0b0e14; }
.keys button.k.wait { background: var(--gold); color: #0b0e14; animation: blink 1s infinite; }
.keys button.k.pad { font-size: 12px; line-height: 1.25; padding: 7px 10px; min-height: 38px; }
.keys button.k.pad .n { white-space: nowrap; }
@keyframes blink { 50% { opacity: .55; } }

.panel { --px: clamp(18px, 3vw, 30px); --py: var(--px); box-sizing: border-box; max-width: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: var(--py) var(--px); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.screen .panel { width: min(620px, 100%); }
/* the buttons of a long form stay in view at the bottom while it scrolls */
/* (bottom: minus the screen's bottom padding, so nothing scrolls by underneath) */
.form > .actions { position: sticky; bottom: calc(-1 * max(28px, env(safe-area-inset-bottom, 0px))); z-index: 1;
  margin: 10px calc(-1 * var(--px)) calc(-1 * var(--py)); padding: 14px var(--px) calc(var(--py) + env(safe-area-inset-bottom, 0px)); border-radius: 0 0 17px 17px;
  background: linear-gradient(180deg, rgba(13,17,25,0), rgb(13,17,25) 12px); }
/* an entry reached with the keyboard is scrolled clear of the edges and,
   in a form, of its button bar (ui.js follow()) */
.screen .sel { scroll-margin: 20px; }
.form .row { scroll-margin-bottom: 110px; }
/* with the bar shown, the screen scrolls above it */
@media (min-width: 701px) and (min-height: 621px) {
  .screen:has(> .hints) { bottom: 50px; }
}

/* online lobby */
.code { font-weight: 800; font-stretch: 112%; font-size: clamp(42px, 7vw, 72px); letter-spacing: .18em; line-height: 1; margin: 6px 0 14px; }
.codebox { display: flex; gap: clamp(4px, 1.2vw, 8px); margin: 12px 0 16px; }
.codebox span { width: clamp(34px, 10vw, 60px); height: clamp(48px, 12vw, 74px); display: grid; place-items: center; border-radius: 12px;
  background: rgba(255,255,255,.06); border: 1px solid var(--line); font-weight: 800; font-size: clamp(24px, 5vw, 38px); }
.codebox span.cur { border-color: #fff; }
.codeinput { position: absolute; opacity: 0; pointer-events: auto; width: 1px; height: 1px; }
.players { display: grid; gap: 8px; margin: 12px 0; }
.player { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: 10px; background: rgba(255,255,255,.04); }
.player .n { font-weight: 700; letter-spacing: .06em; display: flex; align-items: center; gap: 10px; }
.player .n i { width: 10px; height: 10px; border-radius: 50%; }
.player .st { font-weight: 600; font-size: 14px; }
.st.ok { color: var(--ok); } .st.wait { color: var(--gold); } .st.away { color: var(--bad); }
.linkbox { display: flex; gap: 8px; margin-top: 12px; }
.linkbox input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.35); color: var(--text); font: 500 14px var(--font); }
.fps.live b { color: #ff4f4f; animation: blink 1.2s infinite; }
.watchbox { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.watchbox .linkbox { margin-top: 6px; }
.watchbox .linkbox input { font-size: 13px; padding: 8px 10px; }
.meta { color: var(--muted); font-size: 14px; line-height: 1.6; }
.countdown { font-weight: 900; font-style: italic; font-size: 64px; line-height: 1; }
.msg { font-weight: 700; font-size: clamp(20px, 2.6vw, 28px); letter-spacing: .04em; text-transform: uppercase; }
.msg.err { color: var(--bad); }
.hint { color: var(--muted); margin-top: 8px; }

/* ---------- HUD ---------- */
.hud-top { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.score { display: flex; align-items: stretch; border-radius: 14px; overflow: hidden; background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 8px 26px rgba(0,0,0,.35); }
.score .team { display: flex; align-items: center; gap: 10px; padding: 6px 14px; font-weight: 700; letter-spacing: .08em; font-size: 13px; text-transform: uppercase; min-width: 92px; }
.score .team.p1 { justify-content: flex-end; box-shadow: inset 4px 0 0 var(--p1); }
.score .team.p2 { box-shadow: inset -4px 0 0 var(--p2); }
.score .num { font-weight: 800; font-stretch: 110%; font-size: 34px; line-height: 1; padding: 6px 14px; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.score .num.p1 { background: linear-gradient(180deg, rgba(255,122,47,.35), rgba(255,122,47,.12)); }
.score .num.p2 { background: linear-gradient(180deg, rgba(47,198,255,.35), rgba(47,198,255,.12)); }
.clock { font-weight: 700; font-size: 16px; letter-spacing: .1em; padding: 3px 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.clock.low { color: var(--bad); border-color: rgba(255,90,79,.6); animation: blink .8s infinite; }
.status { position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; min-width: 170px; }
.status.p1 { left: max(14px, 2vw); } .status.p2 { right: max(14px, 2vw); align-items: flex-end; }
.status .who { font-weight: 700; letter-spacing: .12em; font-size: 12px; text-transform: uppercase; color: var(--muted); }
.status.p1 .who b { color: var(--p1); } .status.p2 .who b { color: var(--p2); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.status.p2 .chips { justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.chip .picto { width: 17px; height: 17px; flex: none; margin-left: -3px; filter: drop-shadow(0 0 4px rgba(255,255,255,.18)); }
.kick { width: 150px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.kick b { display: block; height: 100%; border-radius: 3px; background: rgba(255,255,255,.55); }
.kick.ready b { background: #fff; box-shadow: 0 0 10px #fff; }
.status.p1 .kick.ready b { background: var(--p1); box-shadow: 0 0 10px var(--p1); }
.status.p2 .kick.ready b { background: var(--p2); box-shadow: 0 0 10px var(--p2); }
.fps { position: absolute; left: 10px; top: 8px; color: var(--faint); font-size: 12px; font-weight: 600; letter-spacing: .06em; }
.notice { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); padding: 10px 18px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line);
  font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 14px; white-space: nowrap; }
.notice.warn { color: var(--gold); } .notice.err { color: var(--bad); }
.tag { position: absolute; left: 0; top: 0; transform: translate(var(--x, 0px), var(--y, 0px)) translate(-50%, -100%); padding: 3px 9px; border-radius: 8px; font-weight: 800; font-size: 12px; letter-spacing: .1em; color: #0b0e14;
  white-space: nowrap; animation: tagin .4s ease-out; }
.tag::after { content: ''; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent; border-bottom: 0; border-top-color: inherit; }
.tag.p1 { background: var(--p1); border-top-color: var(--p1); } .tag.p2 { background: var(--p2); border-top-color: var(--p2); }
/* (tags and bubbles move by transform, from --x and --y: no layout when they follow the machines) */
@keyframes tagin { from { opacity: 0; transform: translate(var(--x, 0px), var(--y, 0px)) translate(-50%, -60%); } }

/* notifications (gamepad connected...) */
.toast { position: absolute; left: 50%; bottom: max(64px, calc(env(safe-area-inset-bottom) + 48px)); transform: translateX(-50%); padding: 10px 18px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line); font-weight: 700; letter-spacing: .06em; font-size: 14px; white-space: nowrap;
  animation: toast 2.6s ease both; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 12px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* goal banner */
.goal { position: absolute; left: 0; right: 0; top: 38%; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.goal .bar { position: absolute; left: 0; right: 0; top: -14px; bottom: -14px; transform-origin: left; animation: sweep 2.6s cubic-bezier(.2,.8,.2,1) both; }
.goal.p1 .bar { background: linear-gradient(90deg, transparent, rgba(255,122,47,.75) 20%, rgba(255,122,47,.75) 80%, transparent); }
.goal.p2 .bar { background: linear-gradient(90deg, transparent, rgba(47,198,255,.75) 20%, rgba(47,198,255,.75) 80%, transparent); }
.goal .big { position: relative; font-style: italic; font-weight: 900; font-stretch: 115%; font-size: clamp(56px, 11vw, 140px); line-height: .9; letter-spacing: .02em;
  text-shadow: 0 6px 30px rgba(0,0,0,.45); animation: pop 2.6s cubic-bezier(.2,.8,.2,1) both; }
.goal .small { position: relative; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; font-size: 15px; animation: pop 2.6s .08s cubic-bezier(.2,.8,.2,1) both; }
@keyframes sweep { 0% { transform: scaleX(0); opacity: 1; } 18% { transform: scaleX(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scaleX(1); } }
@keyframes pop { 0% { transform: scale(2.2); opacity: 0; } 14% { transform: scale(1); opacity: 1; } 82% { opacity: 1; transform: scale(1.04); } 100% { opacity: 0; transform: scale(1.1); } }

/* overlays (pause, game over) */
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; overflow-y: auto; background: rgba(4,6,10,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); pointer-events: auto; padding: 16px; }
.overlay > * { margin: auto; }
.overlay .panel { width: min(480px, 100%); text-align: center; flex-shrink: 0; }
.overlay h1.title { margin-bottom: 8px; }
.overlay .menu { margin: 14px auto 0; width: 100%; }
.overlay .menu .item { align-items: center; text-align: center; }
.overlay .menu .item.sel { transform: none; }
.final { display: flex; justify-content: center; align-items: center; gap: 18px; margin: 10px 0 6px; font-weight: 800; font-size: 54px; font-variant-numeric: tabular-nums; }
.final .p1 { color: var(--p1); } .final .p2 { color: var(--p2); } .final .dash { color: var(--faint); font-size: 34px; }
.quip { color: var(--muted); font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
/* statistics of the match (end of match) */
.mstats { margin: 12px auto 4px; max-width: 360px; display: grid; gap: 3px; font-variant-numeric: tabular-nums; }
.ms-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; min-height: 22px; }
.ms-row .k { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-align: center; white-space: nowrap; }
.ms-row .v { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.ms-row .v.p1 { color: var(--p1); justify-content: flex-start; } .ms-row .v.p2 { color: var(--p2); justify-content: flex-end; }
.ms-bar { height: 4px; border-radius: 2px; background: var(--p2); overflow: hidden; margin: 0 0 4px; }
.ms-bar b { display: block; height: 100%; background: var(--p1); }
.ms-sub { display: flex; justify-content: space-between; gap: 16px; margin-top: -1px; }
.ms-sub .pus { display: flex; flex-wrap: wrap; gap: 3px 9px; max-width: 48%; font-size: 12px; font-weight: 700; color: var(--muted); }
.ms-sub .pus.p2 { justify-content: flex-end; }
.ms-sub .pus i { display: inline-flex; align-items: center; gap: 2px; font-style: normal; }
.ms-sub .pus .picto { width: 13px; height: 13px; }
@media (max-height: 560px) { .mstats { margin: 6px auto 0; gap: 0; } .ms-row { min-height: 18px; } .ms-row .v { font-size: 14px; } .final { font-size: 40px; margin: 4px 0; } }
.songs { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.songs button { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.06); font-weight: 700; }
.songs button.on { background: #fff; color: #0b0e14; }

/* intro */
.intro { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; background: radial-gradient(ellipse at center, rgba(4,6,10,.15), rgba(4,6,10,.55)); }
.intro p { position: absolute; left: 0; right: 0; top: 50%; margin: 0; transform: translateY(-50%); font-weight: 600; font-style: italic; letter-spacing: .14em;
  text-transform: uppercase; font-size: clamp(18px, 3vw, 32px); opacity: 0; animation: line 1.9s ease both; text-shadow: 0 2px 18px rgba(0,0,0,.8); }
.intro .wordmark { opacity: 0; animation: logo 2.6s ease both; }
@keyframes line { 0% { opacity: 0; transform: translateY(-40%); letter-spacing: .3em; } 20%, 75% { opacity: 1; transform: translateY(-50%); letter-spacing: .14em; } 100% { opacity: 0; transform: translateY(-60%); } }
@keyframes logo { 0% { opacity: 0; transform: scale(1.6); filter: blur(10px); } 30% { opacity: 1; transform: scale(1); filter: none; } 100% { opacity: 1; } }
.press { margin-top: 24px; color: var(--muted); letter-spacing: .3em; text-transform: uppercase; font-size: 13px; animation: blink 1.6s infinite; }

/* credits */
.credits { columns: 2 260px; column-gap: 32px; color: #c8d1df; font-size: 14px; line-height: 1.7; max-width: 760px; }
.credits.one { columns: 1; }
.credits b { color: #fff; letter-spacing: .06em; text-transform: uppercase; font-size: 12px; display: block; margin-top: 10px; }
.credits a { color: var(--gold); }
.steps { margin: 0; padding-left: 1.3em; display: grid; gap: 12px; color: #c8d1df; font-size: 15px; line-height: 1.5; }
.steps b { color: #fff; }

@media (max-height: 620px) {
  .wordmark { font-size: clamp(36px, 11vh, 80px); }
  .byline { margin-bottom: 12px; }
  .menu .item { padding: 6px 16px 6px 22px; }
  .menu .item .d { display: none; }
  h1.title { font-size: clamp(24px, 6vh, 40px); }
  .subtitle { margin-bottom: 10px; font-size: 14px; }
  .row { min-height: 34px; padding: 4px 12px; }
  .seg button { padding: 4px 10px; }
  .slider { height: 22px; }
  .form .group { margin-top: 4px; }
  .panel { --px: 18px; --py: 14px; }
  .actions { margin-top: 10px; }
  .card { padding: 12px 10px 10px; gap: 6px; }
  .card .ballimg { width: 56px; height: 56px; }
  .hints { display: none; }
  .screen { padding-top: 16px; padding-bottom: 16px; }
  .form > .actions { bottom: -16px; }
}

@media (max-width: 700px) {
  .keys { gap: 4px 6px; } .keys .a { font-size: 11px; padding-right: 2px; } .keys .h { letter-spacing: .08em; padding: 0 2px; } .keys button.k { padding: 7px 6px; font-size: 12px; } .keys button.k.pad { font-size: 10px; padding: 6px; }
  .screen { background: linear-gradient(180deg, rgba(5,7,11,.82), rgba(5,7,11,.7) 60%, rgba(5,7,11,.9)); justify-content: flex-start; padding-top: max(24px, env(safe-area-inset-top)); }
  .hints { display: none; }
  .row { flex-direction: column; align-items: stretch; gap: 6px; }
  .seg { justify-content: flex-start; }
  .slider { width: 100%; }
  .status { min-width: 0; }
  .kick { width: 90px; }
  .score .team { min-width: 0; padding: 6px 8px; }
  .score .team span.name { display: none; }
  .screen.center { justify-content: center; justify-content: safe center; }
}

/* touch controls in the modern style (layout in touch.js); the players'
   status moves under the score, the bottom of the screen is the controls' */
body.touch.modern .status { top: calc(max(12px, env(safe-area-inset-top)) + 58px); bottom: auto; min-width: 120px; }
body.touch.modern .status.p1 { left: max(14px, env(safe-area-inset-left)); }
body.touch.modern .status.p2 { right: max(14px, env(safe-area-inset-right)); }
body.touch.modern .fps { left: 66px; top: 24px; }
body.modern #touch [data-id=ok] { display: none; }
body.modern #touch [data-id=esc] { left: max(12px, env(safe-area-inset-left)) !important; right: auto !important; top: max(12px, env(safe-area-inset-top)) !important;
  width: 44px; height: 44px; font-size: 0; border-radius: 12px; }
body.modern #touch [data-id=esc]::after { content: '❚❚'; font-size: 14px; letter-spacing: 2px; }
body.modern #touch button { border: 1px solid rgba(255,255,255,.22); background: rgba(12,16,24,.5); color: #fff; font-family: var(--font); font-weight: 700;
  letter-spacing: .06em; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
body.modern #touch button.on { background: rgba(255,255,255,.35); }
body.modern #touch .tbtn { box-shadow: 0 4px 18px rgba(0,0,0,.25); }
body.modern #touch .tbtn span { letter-spacing: .08em; }
/* qualité moyenne ou basse (modern3d.js, setQuality) : pas de flou derrière le HUD du match */
body.fxlite .score, body.modern.fxlite #touch button, body.modern.fxlite #touch .tstick { backdrop-filter: none; -webkit-backdrop-filter: none; }
body.fxlite .score { background: rgba(10, 14, 21, 0.86); }
body.modern.fxlite #touch button { background-color: rgba(12, 16, 24, 0.6); }
body.modern #touch .tstick { color: #fff; border: 2px solid rgba(255,255,255,.28); box-shadow: 0 4px 18px rgba(0,0,0,.25);
  background: radial-gradient(circle, rgba(255,255,255,.05) 0 55%, rgba(12,16,24,.5) 56%); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
body.modern #touch .tknob { background: radial-gradient(circle at 40% 35%, rgba(255,255,255,.95), rgba(190,200,215,.85)); box-shadow: 0 6px 16px rgba(0,0,0,.45); }
body.modern.in-menu #touch { display: none !important; }
body.modern #panel { display: none !important; }

/* ---------- rankings, profile, quick match (main.js: RankingScreen, ProfileScreen…) ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.tabs button { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.tabs button.on { background: #fff; color: #0b0e14; border-color: #fff; }
.rank-panel { flex: none; width: min(760px, 100%); padding: 0 !important; max-height: min(44vh, 420px); overflow: auto; overscroll-behavior: contain; }
.ranktab { width: 100%; border-collapse: collapse; font-size: 14px; }
.ranktab th { position: sticky; top: 0; background: #121824; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 10px 10px 6px; text-align: center; }
.ranktab td { padding: 8px 10px; text-align: center; border-top: 1px solid var(--line); white-space: nowrap; }
.ranktab .l { text-align: left; white-space: normal; word-break: break-word; font-weight: 600; width: 60%; }
.ranktab td.r { text-align: right; font-weight: 600; }
.ranktab .rk { color: var(--muted); font-weight: 700; width: 3em; }
.ranktab .pts { color: var(--gold); font-weight: 800; }
.ranktab .sc { font-weight: 800; font-size: 16px; }
.ranktab .when { color: var(--muted); font-size: 12px; }
.ranktab tr.me td { background: rgba(255,255,255,.1); }
.ptag { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; font-weight: 600; letter-spacing: .04em; white-space: nowrap; }
.rank-empty { padding: 22px; color: var(--muted); }
.up { color: var(--ok); } .down { color: var(--bad); }
i.guest { color: var(--muted); font-weight: 400; }
.mine { margin: 10px 0 4px; font-weight: 700; letter-spacing: .02em; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; width: min(760px, 100%); margin: 6px 0 14px; }
.statgrid div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.statgrid span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.statgrid b { display: block; font-size: 18px; margin-top: 2px; }
.textbox { display: block; width: min(420px, 100%); padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,.7) !important;
  background: rgba(255,255,255,.06) !important; font-size: 22px !important; font-weight: 700 !important; text-align: left; margin: 8px 0 2px; cursor: text !important; }
.textbox .ph { color: var(--faint); font-weight: 500; }
.textbox .caret { font-weight: 300; margin-left: 1px; } .textbox .caret.off { opacity: 0; }
.err-line { color: var(--bad); min-height: 1.5em; font-size: 14px; }
.bigcode { font-size: clamp(18px, 5.4vw, 32px); font-weight: 800; letter-spacing: .1em; user-select: all; -webkit-user-select: all; margin: 6px 0 10px; }
.points { font-size: 15px; margin: 8px 0 0; } .points b { font-size: 18px; } .points .sub { display: block; color: var(--muted); font-size: 13px; }
.player .rating { color: var(--gold); font-weight: 700; font-size: 13px; margin-left: 4px; }
.challenge-line { margin: 10px 0 2px; } .challenge-line.ok { color: var(--ok); } .challenge-line.err { color: var(--gold); }
.queue .dots::after { content: ''; animation: dots 1.5s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* online game over: the rules of the rematch (a change by the opponent stands out) */
.next-rules { margin-top: 10px; }
.next-rules b { color: var(--gold); font-weight: 700; }

/* 2 vs 2 rooms: the teams side by side, the computer on the free seats */
.title .sub { font-size: .45em; color: var(--muted); letter-spacing: .12em; vertical-align: middle; margin-left: 8px; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.teams .team > .meta { margin-bottom: 6px; font-weight: 700; letter-spacing: .08em; }
.teams .team.t0 > .meta { color: var(--p1); } .teams .team.t1 > .meta { color: var(--p2); }
.teams .player { margin-bottom: 8px; }
.player.me { box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); }
.player .host { color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: .08em; }
.st.cpu { color: var(--muted); }
.tag.mini { font-size: 10px; padding: 2px 6px; opacity: .85; }
@media (max-width: 560px) { .teams { grid-template-columns: 1fr; gap: 4px; } }

/* smileys over the machines; the tray after a goal; 2v2 tactical messages */
.bubble { position: absolute; left: 0; top: 0; transform: translate(var(--x, 0px), var(--y, 0px)) translate(-50%, -100%); font-size: 34px; line-height: 1; padding: 6px 10px 8px; border-radius: 16px;
  background: rgba(10,14,21,.82); border: 2px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.35); white-space: nowrap;
  animation: bubble 2.3s cubic-bezier(.2,.8,.2,1) both; pointer-events: none; }
.bubble.p1 { border-color: var(--p1); } .bubble.p2 { border-color: var(--p2); }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -8px; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: inherit; }
.bubble.txt { font-size: 16px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 8px 12px; }
.bubble.tactic { font-size: 22px; display: flex; align-items: center; gap: 8px; animation-duration: 2.8s; }
.bubble.tactic small { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
@keyframes bubble { 0% { opacity: 0; transform: translate(var(--x, 0px), var(--y, 0px)) translate(-50%, -60%) scale(.3); } 12% { opacity: 1; transform: translate(var(--x, 0px), var(--y, 0px)) translate(-50%, -100%) scale(1.12); }
  20% { transform: translate(var(--x, 0px), var(--y, 0px)) translate(-50%, -100%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x, 0px), var(--y, 0px)) translate(-50%, -125%); } }
.emote-tray { position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 8px; padding: 8px;
  border-radius: 16px; background: var(--panel); border: 1px solid var(--line); animation: tagin .25s ease-out; pointer-events: auto; }
.emote-tray button, .tactics button { position: relative; width: 52px; height: 52px; border-radius: 12px; background: rgba(255,255,255,.06); display: grid; place-items: center; }
.emote-tray button span { font-size: 28px; line-height: 1; }
.emote-tray button.txt span { font-size: 11px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; line-height: 1.1; padding: 0 3px; text-align: center; }
.emote-tray button:hover, .tactics button:hover { background: rgba(255,255,255,.16); }
.emote-tray kbd, .tactics kbd { position: absolute; right: -4px; top: -6px; margin: 0; padding: 2px 4px; font-size: 10px; background: #0b0e14; }
.tactics { position: absolute; right: max(10px, env(safe-area-inset-right)); top: 46%; display: flex; flex-direction: column; gap: 6px; opacity: .8; }
.tactics button { width: 44px; height: 44px; }
.tactics button span { font-size: 22px; }
body.touch .emote-tray button { width: 48px; height: 48px; }
@media (max-width: 560px) { .emote-tray { gap: 4px; padding: 6px; } .emote-tray button { width: 44px; height: 44px; } .emote-tray kbd { display: none; } }

/* the replay after a goal */
.replay-band { display: flex; align-items: center; gap: 8px; animation: bandin .3s ease-out; }
@keyframes bandin { from { opacity: 0; transform: translateY(-6px); } }
.replay-band b { display: flex; align-items: baseline; gap: 8px; font-style: italic; font-weight: 900; font-stretch: 115%; font-size: 18px; line-height: 1; letter-spacing: .16em;
  padding: 6px 14px; border-radius: 8px; background: linear-gradient(90deg, #ff3b3b, #ff7a2f); color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.3); }
.replay-band b small { font-style: normal; font-size: 12px; letter-spacing: .06em; font-weight: 800; opacity: .9; }
.replay-band .skip { pointer-events: auto; padding: 6px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; font-size: 12px;
  line-height: 1; letter-spacing: .08em; text-transform: uppercase; }

/* highlights viewer */
.hl-top { position: absolute; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translateX(-50%); text-align: center; padding: 10px 22px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); min-width: min(420px, 92vw); transition: transform .4s cubic-bezier(.2,.8,.2,1); }
.hl-top.card { transform: translateX(-50%) scale(1.08); }
.hl-top .kicker { font-weight: 800; font-size: 12px; letter-spacing: .24em; color: #ff5a4f; }
.hl-title { font-style: italic; font-weight: 900; font-stretch: 110%; font-size: clamp(20px, 3.4vw, 32px); text-transform: uppercase; letter-spacing: .02em; }
.hl-title.p1 { color: var(--p1); } .hl-title.p2 { color: var(--p2); }
.hl-bar { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(760px, calc(100% - 32px)); padding: 12px 14px;
  border-radius: 16px; background: var(--panel); border: 1px solid var(--line); pointer-events: auto; text-align: center; }
.hl-bar .actions { justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.hl-bar .btn { padding: 9px 14px; font-size: 13px; }
.hl-bar .btn.icon { min-width: 46px; }
.hl-bar .linkbox { margin: 0 0 8px; }
.dots { display: flex; justify-content: center; gap: 8px; }
.dots .dot { width: 12px; height: 12px; border-radius: 50%; background: rgba(255,255,255,.18); }
.dots .dot.t0.on { background: var(--p1); } .dots .dot.t1.on { background: var(--p2); }
.meta.warn { color: var(--gold); }

/* Options → My smileys */
.emotes-menu { width: min(620px, 100%); }
.emotes-menu .slots { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.emotes-menu .slot { position: relative; width: 58px; height: 58px; border-radius: 12px; border: 1px dashed var(--line); display: grid; place-items: center; font-size: 30px; }
.emotes-menu .slot.txt { font-size: 11px; font-weight: 800; text-transform: uppercase; text-align: center; line-height: 1.1; padding: 2px; }
.emotes-menu .slot kbd { position: absolute; left: -6px; top: -8px; margin: 0; padding: 2px 4px; font-size: 10px; background: #0b0e14; }
.emote-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 12px; }
.emote-grid .em { height: 58px; border-radius: 12px; background: rgba(255,255,255,.05); font-size: 28px; border: 2px solid transparent; }
.emote-grid .em.txt { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; line-height: 1.1; padding: 0 4px; }
.emote-grid .em.on { background: rgba(61,255,138,.14); border-color: var(--ok); }
.emote-grid .em.cur { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 560px) { .emote-grid { gap: 5px; } .emote-grid .em { height: 48px; font-size: 24px; } .emotes-menu .slot { width: 46px; height: 46px; font-size: 24px; } }
