/* Flick Goal Royale — design tokens from thiet_ke/design_tokens.json (single source for every screen) */
:root {
  --bg: #10351d; --surface: #242424; --primary: #dca33e; --secondary: #1d4f22; --accent: #f4c96b;
  --text: #f8f0e2; --muted: #c6b998; --border: #a16a2f; --danger: #b92f22; --success: #78d633;
  --charcoal: #262c2a; --charcoal-w: #2e2d2b; --felt: #2c6431; --felt-mid: #285d28; --felt-sh: #2a4f27; --wood: #c68b59;
  --f-display: 'Alfa Slab One', 'Noto Sans Arabic', 'Noto Sans Devanagari', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', 'PingFang SC', 'Microsoft YaHei', 'Malgun Gothic', 'Yu Gothic', serif;
  --f-round: 'Rowdies', var(--f-display);
  --f-head: 'Barlow Condensed', 'Noto Sans Arabic', 'Noto Sans Devanagari', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans KR', 'PingFang SC', 'Microsoft YaHei', 'Malgun Gothic', 'Yu Gothic', sans-serif;
  --f-wide: 'Barlow', var(--f-head);
  --f-num: 'Saira Condensed', 'Barlow Condensed', sans-serif;
  --shadow: 0 2px 0 #0009, 0 5px 10px #0008;
  --p: calc(min(100vw, 66.67dvh) / 1024);   /* 1 design px of the 1024-wide portrait mockups */
  --cut: calc(16 * var(--p));
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--f-head); font-weight: 800; }
body { touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 1em; height: 1em; fill: currentColor; flex: none; }
.num { font-family: var(--f-num); font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.gold { color: var(--primary); }

/* materials */
.felt { background: var(--bg) url(../assets/ui/felt.webp) repeat; background-size: calc(256 * var(--p)); }
.charcoal { background: var(--charcoal) url(../assets/ui/charcoal.webp) repeat; background-size: calc(256 * var(--p)); }
.screen { position: fixed; inset: 0; display: none; }
.screen.on { display: block; }
.col { position: relative; width: min(100vw, 66.67dvh); height: 100%; margin: 0 auto; display: flex; flex-direction: column; padding: 0 calc(24 * var(--p)) env(safe-area-inset-bottom); }

/* chamfered brass-rimmed charcoal plaque (spec: 1px light inner line, 2-4px gold band, 1px dark bronze, shadow) */
.plaque {
  --c: var(--cut);
  position: relative; background: linear-gradient(180deg, #2b2b2a, var(--surface) 40%, #1d1d1c);
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c));
  filter: drop-shadow(0 2px 0 #0009);
}
.plaque::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, #f4d58a, var(--primary) 45%, #8a5a22);
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c),
    0 var(--c), 3px calc(var(--c) + 1px), 3px calc(100% - var(--c) - 1px), calc(var(--c) + 1px) calc(100% - 3px), calc(100% - var(--c) - 1px) calc(100% - 3px), calc(100% - 3px) calc(100% - var(--c) - 1px), calc(100% - 3px) calc(var(--c) + 1px), calc(100% - var(--c) - 1px) 3px, calc(var(--c) + 1px) 3px, 3px calc(var(--c) + 1px), 0 var(--c));
}
.plaque > * { position: relative; }

/* ---------- LOBBY ---------- */
.topbar { display: flex; align-items: center; gap: calc(14 * var(--p)); height: calc(100 * var(--p)); margin: calc(8 * var(--p)) calc(-14 * var(--p)) 0; padding: 0 calc(24 * var(--p)) 0 calc(12 * var(--p)); flex: none; }
.topbar .badge { width: calc(88 * var(--p)); height: calc(88 * var(--p)); object-fit: contain; }
.sep { width: 2px; height: calc(40 * var(--p)); background: var(--primary); opacity: .8; }
.pname { font-size: calc(38 * var(--p)); font-weight: 900; letter-spacing: .02em; text-transform: uppercase; max-width: calc(250 * var(--p)); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lvpill { font-size: calc(30 * var(--p)); color: var(--primary); border: 2px solid var(--primary); padding: calc(2 * var(--p)) calc(16 * var(--p)); clip-path: polygon(10% 0, 90% 0, 100% 50%, 90% 100%, 10% 100%, 0 50%); background: #1b1b1a; white-space: nowrap; }
.topbar .coin { width: calc(46 * var(--p)); height: calc(46 * var(--p)); }
.coins { font-size: calc(40 * var(--p)); margin-right: auto; }
.ico { display: grid; place-items: center; width: calc(64 * var(--p)); height: calc(64 * var(--p)); font-size: calc(44 * var(--p)); color: var(--text); }
.ico:active { transform: scale(.92); }
[hidden] { display: none !important; }
.tabs { flex: 1; min-height: 0; position: relative; }
.tab { position: absolute; inset: 0; display: none; flex-direction: column; align-items: stretch; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; scrollbar-width: none; }
.tab.on { display: flex; }
#tabHome { overflow: hidden; }
.logo { position: relative; text-align: center; padding-top: calc(10 * var(--p)); flex: none; }
.crownline { display: flex; align-items: center; justify-content: center; gap: calc(14 * var(--p)); color: var(--primary); font-size: calc(46 * var(--p)); height: calc(36 * var(--p)); }
.crownline::before, .crownline::after { content: ''; width: calc(230 * var(--p)); height: 2px; background: var(--primary); }
.crown { width: calc(44 * var(--p)); height: calc(30 * var(--p)); }
.logo .l1, .logo .l2 { font-family: var(--f-display); font-size: calc(104 * var(--p)); line-height: .92; letter-spacing: .015em; text-transform: uppercase; color: var(--text);
  text-shadow: 0 calc(4 * var(--p)) 0 #6d4a1f, 0 calc(7 * var(--p)) 0 #2a1c0b, 0 calc(10 * var(--p)) calc(14 * var(--p)) #0008; white-space: nowrap; }
.logo .l2 { color: var(--primary); font-size: calc(96 * var(--p)); background: linear-gradient(180deg, #ffe39a 10%, var(--primary) 55%, #b8791f); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 calc(5 * var(--p)) 0 #4e3312); text-shadow: none; }
.laurel { position: absolute; color: var(--primary); width: calc(80 * var(--p)); height: calc(150 * var(--p)); }
.logo .laurel { top: calc(56 * var(--p)); }
.laurel.l { left: calc(110 * var(--p)); }
.laurel.r { right: calc(110 * var(--p)); transform: scaleX(-1); }
.tagline { display: inline-block; margin-top: calc(18 * var(--p)); padding: calc(10 * var(--p)) calc(50 * var(--p)); font-size: calc(30 * var(--p)); letter-spacing: .10em; background: #1d1d1c; border: 2px solid var(--primary);
  clip-path: polygon(calc(26 * var(--p)) 0, calc(100% - calc(26 * var(--p))) 0, 100% 50%, calc(100% - calc(26 * var(--p))) 100%, calc(26 * var(--p)) 100%, 0 50%); }
.boardwrap { flex: 1; min-height: calc(300 * var(--p)); position: relative; margin: calc(6 * var(--p)) calc(40 * var(--p)); }
.boardwrap canvas, .field canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.modebar { display: flex; align-items: center; justify-content: space-around; height: calc(66 * var(--p)); font-size: calc(32 * var(--p)); letter-spacing: .10em; flex: none; --c: calc(28 * var(--p)); }
.modebar .m { display: flex; align-items: center; gap: calc(16 * var(--p)); white-space: nowrap; }
.modebar svg { font-size: calc(44 * var(--p)); color: var(--primary); }
.vsep { width: 2px; height: 50%; background: var(--primary); }
.online { display: flex; justify-content: center; align-items: center; gap: calc(10 * var(--p)); font-size: calc(24 * var(--p)); color: var(--muted); letter-spacing: .06em; height: calc(34 * var(--p)); flex: none; }
.online i { width: calc(12 * var(--p)); height: calc(12 * var(--p)); background: var(--success); border-radius: 50%; }
.btn-gold { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; flex: none;
  background: url(../assets/ui/btn_gold.webp) center / 100% 100% no-repeat; color: #10351d; font-family: var(--f-display); letter-spacing: .025em; text-transform: uppercase; filter: drop-shadow(0 4px 6px #000a); }
.btn-gold:active { transform: translateY(2px) scale(.99); filter: brightness(.95) drop-shadow(0 2px 3px #000a); }
.btn-gold.play { height: calc(151 * var(--p)); font-size: calc(124 * var(--p)); line-height: 1; }
.btn-gold .arr { position: absolute; right: calc(70 * var(--p)); width: calc(70 * var(--p)); height: calc(46 * var(--p)); color: #10351d; }
.row2 { display: flex; gap: calc(30 * var(--p)); margin-top: calc(16 * var(--p)); flex: none; }
.btn-felt { flex: 1; display: flex; align-items: center; justify-content: center; gap: calc(18 * var(--p)); height: calc(99 * var(--p)); font-size: calc(40 * var(--p)); font-weight: 900; letter-spacing: .035em; text-transform: uppercase;
  background: var(--bg) url(../assets/ui/felt.webp); background-size: calc(256 * var(--p)); box-shadow: inset 0 0 0 calc(3 * var(--p)) var(--primary), inset 0 0 0 calc(7 * var(--p)) #0d2b17, inset 0 0 0 calc(9 * var(--p)) var(--border), var(--shadow);
  clip-path: polygon(calc(18 * var(--p)) 0, calc(100% - calc(18 * var(--p))) 0, 100% calc(18 * var(--p)), 100% calc(100% - calc(18 * var(--p))), calc(100% - calc(18 * var(--p))) 100%, calc(18 * var(--p)) 100%, 0 calc(100% - calc(18 * var(--p))), 0 calc(18 * var(--p))); }
.btn-felt svg { font-size: calc(50 * var(--p)); color: var(--text); }
.btn-felt i { width: 2px; height: 45%; background: var(--primary); }
.btn-felt:active { filter: brightness(1.15); }
.btn-felt.goldtxt { color: var(--accent); }
.linkbtn { display: block; margin: calc(12 * var(--p)) auto 0; font-size: calc(30 * var(--p)); letter-spacing: .1em; color: var(--text); text-decoration: underline; text-decoration-color: var(--primary); text-underline-offset: calc(8 * var(--p)); flex: none; padding: calc(6 * var(--p)); }
.navbar { display: flex; height: calc(110 * var(--p)); margin: calc(14 * var(--p)) calc(-14 * var(--p)) calc(10 * var(--p)); flex: none; }
.nav { flex: 1; display: flex; align-items: center; justify-content: center; gap: calc(16 * var(--p)); font-size: calc(34 * var(--p)); font-weight: 900; letter-spacing: .035em; color: var(--text); position: relative; }
.nav + .nav::before { content: ''; position: absolute; left: 0; top: 30%; height: 40%; width: 2px; background: var(--primary); }
.nav svg { font-size: calc(46 * var(--p)); }
.nav.on { color: var(--primary); }
.nav.on::after { content: ''; position: absolute; left: 18%; right: 18%; bottom: calc(14 * var(--p)); height: calc(5 * var(--p)); background: var(--primary); }

.h-plate { margin: calc(26 * var(--p)) 0 calc(12 * var(--p)); font-family: var(--f-display); font-weight: 400; font-size: calc(36 * var(--p)); color: #1d1d1c; letter-spacing: .015em; text-transform: uppercase;
  background: linear-gradient(180deg, #f2cf7d, var(--primary)); padding: calc(10 * var(--p)) calc(40 * var(--p)); align-self: flex-start;
  clip-path: polygon(0 0, calc(100% - calc(30 * var(--p))) 0, 100% 50%, calc(100% - calc(30 * var(--p))) 100%, 0 100%); }
.lb { padding: calc(16 * var(--p)) calc(24 * var(--p)); font-size: calc(28 * var(--p)); }
.lbrow { display: grid; grid-template-columns: calc(60 * var(--p)) calc(56 * var(--p)) 1fr auto auto; align-items: center; gap: calc(14 * var(--p)); padding: calc(8 * var(--p)) 0; border-bottom: 1px solid #f8f0e222; }
.lbrow .r { color: var(--muted); }
.lbrow.me { color: var(--accent); }
.lbrow img, .frow img { width: calc(52 * var(--p)); height: calc(52 * var(--p)); border-radius: 50%; border: 2px solid var(--primary); object-fit: cover; }
.lbrow .n, .frow .n { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lbrow b { font-family: var(--f-num); font-size: calc(34 * var(--p)); color: var(--primary); min-width: calc(60 * var(--p)); text-align: end; }
.lbrow small { color: var(--muted); font-size: calc(22 * var(--p)); }
.cc { display: inline-block; font-size: .7em; color: var(--muted); border: 1px solid #c6b99866; padding: 0 .3em; margin-inline-start: .4em; vertical-align: middle; }
.friends { display: grid; grid-template-columns: 1fr 1fr; gap: calc(12 * var(--p)); padding-bottom: calc(20 * var(--p)); }
.frow { display: flex; align-items: center; gap: calc(12 * var(--p)); font-size: calc(26 * var(--p)); background: #0d2b17aa; padding: calc(10 * var(--p)); border: 1px solid #a16a2f88; }
.frow .st { margin-inline-start: auto; width: calc(12 * var(--p)); height: calc(12 * var(--p)); border-radius: 50%; background: var(--success); flex: none; }
.frow .st.busy { background: var(--primary); }
.prof { display: grid; grid-template-columns: calc(150 * var(--p)) 1fr; grid-template-rows: auto auto auto; gap: calc(8 * var(--p)) calc(24 * var(--p)); padding: calc(24 * var(--p)); align-items: center; }
.pface { grid-row: 1 / 3; width: calc(150 * var(--p)); height: calc(150 * var(--p)); border: calc(4 * var(--p)) solid var(--primary); clip-path: polygon(12% 0, 88% 0, 100% 12%, 100% 88%, 88% 100%, 12% 100%, 0 88%, 0 12%); object-fit: cover; background: #0d2b17; }
.lbl { font-size: calc(24 * var(--p)); color: var(--muted); letter-spacing: .1em; align-self: end; }
#pfName, #joinCode { width: 100%; font: 900 calc(40 * var(--p)) var(--f-head); color: var(--text); background: #111; border: 2px solid var(--border); padding: calc(10 * var(--p)) calc(16 * var(--p)); text-transform: uppercase; outline: none; user-select: text; -webkit-user-select: text; }
#pfName:focus, #joinCode:focus { border-color: var(--accent); }
.pstats { grid-column: 1 / 3; display: grid; grid-template-columns: repeat(4, 1fr); gap: calc(8 * var(--p)); text-align: center; margin-top: calc(10 * var(--p)); }
.pstats div { background: #111a; border: 1px solid #a16a2f88; padding: calc(10 * var(--p)) 0; }
.pstats small { display: block; font-size: calc(20 * var(--p)); color: var(--muted); letter-spacing: .06em; }
.pstats b { font-family: var(--f-num); font-size: calc(46 * var(--p)); color: var(--primary); }
.faces { display: grid; grid-template-columns: repeat(7, 1fr); gap: calc(10 * var(--p)); }
.faces button { position: relative; aspect-ratio: 1; border: calc(3 * var(--p)) solid #a16a2f88; background: #0d2b17; overflow: hidden; }
.faces button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.faces button.sel { border-color: var(--accent); box-shadow: 0 0 0 calc(3 * var(--p)) var(--accent); }
.faces button.lock img { filter: grayscale(1) brightness(.45); }
.faces button .price { position: absolute; inset: auto 0 0 0; font-size: calc(20 * var(--p)); background: #000b; color: var(--accent); text-align: center; font-family: var(--f-num); }

/* gear bench rows (shared by profile + result) */
.bench { padding: calc(12 * var(--p)) calc(30 * var(--p)); }
.bitem { display: grid; grid-template-columns: 1fr 2px calc(150 * var(--p)) 2px calc(260 * var(--p)); align-items: center; gap: calc(22 * var(--p)); min-height: calc(126 * var(--p)); }
.bitem + .bitem { border-top: 2px solid #f8f0e255; }
.bitem .vl { background: #f8f0e277; height: 50%; }
.bitem h5 { font-size: calc(38 * var(--p)); font-weight: 900; letter-spacing: .015em; text-transform: uppercase; line-height: 1; }
.bitem p { font-size: calc(28 * var(--p)); font-weight: 700; color: var(--text); margin-top: calc(6 * var(--p)); }
.bitem img { width: calc(130 * var(--p)); height: calc(130 * var(--p)); object-fit: contain; justify-self: center; }
.bbtn { height: calc(84 * var(--p)); font-size: calc(34 * var(--p)); font-weight: 900; letter-spacing: .035em; line-height: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-transform: uppercase;
  clip-path: polygon(calc(14 * var(--p)) 0, calc(100% - calc(14 * var(--p))) 0, 100% calc(14 * var(--p)), 100% calc(100% - calc(14 * var(--p))), calc(100% - calc(14 * var(--p))) 100%, calc(14 * var(--p)) 100%, 0 calc(100% - calc(14 * var(--p))), 0 calc(14 * var(--p))); }
.bbtn.up { background: url(../assets/ui/btn_gold.webp) center / 100% 100%; color: #1d1d1c; }
.bbtn.buy { background: var(--bg); color: var(--text); box-shadow: inset 0 0 0 calc(3 * var(--p)) var(--primary); }
.bbtn.dis { opacity: .55; }
.bbtn .pr { display: flex; align-items: center; gap: calc(8 * var(--p)); font-family: var(--f-num); font-size: calc(32 * var(--p)); }
.bbtn .pr img { width: calc(30 * var(--p)); height: calc(30 * var(--p)); }

/* ---------- ROOM ---------- */
.titlebar { display: flex; align-items: center; justify-content: center; gap: calc(16 * var(--p)); height: calc(84 * var(--p)); margin: calc(8 * var(--p)) calc(-14 * var(--p)) 0; flex: none; }
.titlebar .t { font-size: calc(48 * var(--p)); font-weight: 900; letter-spacing: .015em; text-transform: uppercase; white-space: nowrap; }
.titlebar .x { position: absolute; right: calc(14 * var(--p)); top: 50%; transform: translateY(-50%); border: 2px solid var(--primary); font-size: calc(36 * var(--p)); }
.titlebar .laurel { position: static; width: calc(36 * var(--p)); height: calc(60 * var(--p)); }
.rmcode { text-align: center; margin: calc(30 * var(--p)) 0 calc(10 * var(--p)); flex: none; }
.rmcode span { display: block; font-size: calc(28 * var(--p)); letter-spacing: .12em; color: var(--muted); }
.rmcode b { display: block; font-family: var(--f-num); font-size: calc(120 * var(--p)); letter-spacing: .2em; color: var(--accent); line-height: 1.05; }
.rmcode small { font-size: calc(26 * var(--p)); color: var(--muted); font-weight: 700; }
.seats { display: grid; grid-template-columns: 1fr 1fr; gap: calc(14 * var(--p)); margin-top: calc(24 * var(--p)); flex: none; }
.seat { display: flex; align-items: center; gap: calc(16 * var(--p)); height: calc(104 * var(--p)); padding: 0 calc(18 * var(--p)); font-size: calc(32 * var(--p)); background: #111c; border: 2px solid #a16a2f99; transition: border-color .2s; }
.seat img { width: calc(76 * var(--p)); height: calc(76 * var(--p)); border-radius: 50%; border: calc(3 * var(--p)) solid var(--primary); object-fit: cover; }
.seat .n { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1; min-width: 0; }
.seat small { display: block; font-size: calc(22 * var(--p)); color: var(--muted); }
.seat.empty { color: #f8f0e255; justify-content: center; border-style: dashed; }
.seat.you { border-color: var(--accent); background: #3a2c10cc; }
.seat.pop { animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.85); opacity: .2; } to { transform: none; opacity: 1; } }
.rmstatus { text-align: center; font-size: calc(40 * var(--p)); letter-spacing: .06em; margin: calc(30 * var(--p)) 0; min-height: calc(50 * var(--p)); color: var(--accent); flex: none; }
.adbox { display: flex; align-items: center; gap: calc(20 * var(--p)); padding: calc(18 * var(--p)) calc(28 * var(--p)); flex: none; }
.adbox div { flex: 1; }
.adbox b { font-size: calc(36 * var(--p)); color: var(--accent); letter-spacing: .04em; display: block; }
.adbox small { font-size: calc(24 * var(--p)); color: var(--muted); font-weight: 700; }
.btn-small { display: inline-flex; align-items: center; gap: calc(10 * var(--p)); height: calc(68 * var(--p)); padding: 0 calc(26 * var(--p)); font-size: calc(30 * var(--p)); font-weight: 900; letter-spacing: .05em; background: #111; border: 2px solid var(--primary); color: var(--text); }
.btn-small.gold { background: url(../assets/ui/btn_gold.webp) center / 100% 100%; color: #1d1d1c; border: 0; }
.btn-small svg { font-size: calc(36 * var(--p)); }

/* ---------- MATCH: portrait (#07) ---------- */
#match .mgrid { position: absolute; inset: 0; margin: 0 auto; width: min(100vw, 66.67dvh); display: grid;
  grid-template-rows: calc(108 * var(--p)) calc(196 * var(--p)) 1fr calc(76 * var(--p)) calc(44 * var(--p)) calc(220 * var(--p));
  grid-template-areas: "hud" "plist" "field" "power" "hint" "act"; padding-bottom: env(safe-area-inset-bottom); }
.hudL, .leftL, .rightL, .hintL { display: none; }
.hudP { grid-area: hud; display: flex; align-items: center; justify-content: center; gap: calc(26 * var(--p)); position: relative; background: linear-gradient(#2a2a29, #1c1c1b); border-bottom: 2px solid var(--border); }
.hudP .pauseb { position: absolute; left: calc(36 * var(--p)); border: calc(3 * var(--p)) solid var(--primary); width: calc(84 * var(--p)); height: calc(72 * var(--p)); font-size: calc(40 * var(--p)); background: #1d1d1c; }
.hudP .laurel.sm { position: absolute; width: calc(30 * var(--p)); height: calc(56 * var(--p)); top: calc(30 * var(--p)); }
.hudP .laurel.l { left: calc(168 * var(--p)); } .hudP .laurel.r { right: calc(168 * var(--p)); left: auto; }
.hplate { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: calc(146 * var(--p)); height: calc(92 * var(--p)); background: #1b1b1a; border: calc(3 * var(--p)) solid var(--primary); box-shadow: inset 0 0 0 calc(2 * var(--p)) #0008; line-height: .95;
  clip-path: polygon(calc(10 * var(--p)) 0, calc(100% - calc(10 * var(--p))) 0, 100% calc(10 * var(--p)), 100% calc(100% - calc(10 * var(--p))), calc(100% - calc(10 * var(--p))) 100%, calc(10 * var(--p)) 100%, 0 calc(100% - calc(10 * var(--p))), 0 calc(10 * var(--p))); }
.hplate small { font-size: calc(25 * var(--p)); letter-spacing: .06em; }
.hplate b { font-size: calc(58 * var(--p)); }
.hplate.big { min-width: calc(250 * var(--p)); height: calc(100 * var(--p)); }
.hplate.big b { font-size: calc(64 * var(--p)); }
.plistP { grid-area: plist; display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: column; grid-template-rows: repeat(4, 1fr); gap: calc(5 * var(--p)) calc(20 * var(--p)); padding: calc(8 * var(--p)) calc(24 * var(--p)); }
.prow { display: flex; align-items: center; gap: calc(12 * var(--p)); padding: 0 calc(14 * var(--p)); background: linear-gradient(#2a2a29, #1f1f1e); border: 1px solid #a16a2f88; font-size: calc(30 * var(--p)); letter-spacing: .015em; overflow: hidden; }
.prow .dot { width: calc(8 * var(--p)); height: calc(8 * var(--p)); border-radius: 50%; background: var(--primary); flex: none; }
.prow img { width: calc(38 * var(--p)); height: calc(38 * var(--p)); border-radius: 50%; object-fit: cover; flex: none; }
.prow .n { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-transform: uppercase; }
.prow .h { display: flex; gap: calc(4 * var(--p)); color: var(--text); font-size: calc(24 * var(--p)); flex: none; }
.prow .h svg.off { color: #f8f0e22e; }
.prow.you { background: linear-gradient(90deg, #b5832c, #8a6020); color: #fff7e6; border-color: var(--accent); }
.prow.out { opacity: .38; text-decoration: line-through; text-decoration-color: var(--danger); }
.field { grid-area: field; position: relative; min-height: 0; touch-action: none; }
.powerP { grid-area: power; display: flex; align-items: center; gap: calc(26 * var(--p)); margin: calc(4 * var(--p)) calc(120 * var(--p)); padding: 0 calc(30 * var(--p)); font-size: calc(36 * var(--p)); font-weight: 900; letter-spacing: .04em; --c: calc(14 * var(--p)); }
.segs { flex: 1; display: flex; gap: calc(6 * var(--p)); height: calc(38 * var(--p)); }
.segs i, .vsegs i { flex: 1; background: #3a3a37; border: 1px solid #0007; clip-path: polygon(12% 0, 100% 0, 88% 100%, 0 100%); }
.segs i.on, .vsegs i.on { background: linear-gradient(#ffd879, var(--primary) 60%, #b07a22); }
.segs i.hot, .vsegs i.hot { background: linear-gradient(#ffb070, #e2722c); }
.hintP { grid-area: hint; display: flex; align-items: center; justify-content: center; gap: calc(20 * var(--p)); font-size: calc(30 * var(--p)); letter-spacing: .06em; color: var(--accent); }
.hintP i { width: calc(70 * var(--p)); height: 2px; background: var(--primary); }
.actP { grid-area: act; display: flex; align-items: center; justify-content: space-around; position: relative; background: linear-gradient(#2a2a29, #1a1a19); border-top: calc(3 * var(--p)) solid var(--border); padding: 0 calc(70 * var(--p)); }
.actP .laurel.sm { position: absolute; width: calc(40 * var(--p)); height: calc(80 * var(--p)); top: calc(90 * var(--p)); }
.actP .laurel.l { left: calc(30 * var(--p)); } .actP .laurel.r { right: calc(30 * var(--p)); left: auto; }
.rbtn { position: relative; width: calc(200 * var(--p)); height: calc(200 * var(--p)); border-radius: 50%; background: radial-gradient(circle at 50% 35%, #33332f, #161615 70%);
  box-shadow: 0 0 0 calc(8 * var(--p)) var(--primary), 0 0 0 calc(12 * var(--p)) #5a3b14, 0 calc(6 * var(--p)) calc(12 * var(--p)) calc(10 * var(--p)) #000a; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(6 * var(--p)); color: var(--text); font-size: calc(40 * var(--p)); font-weight: 900; letter-spacing: .035em; overflow: hidden; }
.rbtn svg { font-size: calc(90 * var(--p)); }
.rbtn:active, .ballbtn:active { transform: scale(.94); }
.flickP { display: flex; flex-direction: column; align-items: center; gap: calc(6 * var(--p)); }
.ballbtn { position: relative; width: calc(130 * var(--p)); height: calc(130 * var(--p)); border-radius: 50%; background: #161615; box-shadow: 0 0 0 calc(6 * var(--p)) var(--primary), 0 0 0 calc(9 * var(--p)) #5a3b14; display: grid; place-items: center; overflow: hidden; }
.ballbtn img { width: 82%; height: 82%; }
.fplate { font-size: calc(40 * var(--p)); font-weight: 900; letter-spacing: .035em; padding: calc(6 * var(--p)) calc(40 * var(--p)); background: #1b1b1a; border: calc(3 * var(--p)) solid var(--primary); }
.cdm { position: absolute; inset: 0; background: conic-gradient(#000a calc(var(--cd, 0) * 360deg), transparent 0); border-radius: inherit; pointer-events: none; }
.flickL .cdm, .guardL .cdm { border-radius: 0; }
.ready .cdm { background: none; }
[data-act].ready { animation: readyp .4s ease-out; }
@keyframes readyp { 50% { filter: brightness(1.5); } }
.banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none; white-space: nowrap; text-align: center;
  font-family: var(--f-display); font-size: calc(92 * var(--p)); color: var(--accent); text-transform: uppercase; text-shadow: 0 calc(4 * var(--p)) 0 #4e3312, 0 calc(8 * var(--p)) calc(16 * var(--p)) #000c; transition: transform .25s cubic-bezier(.2, 1.6, .4, 1), opacity .2s; }
.banner small { display: block; font-family: var(--f-head); font-weight: 900; font-size: .36em; color: var(--text); letter-spacing: .08em; }
.banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.banner.bad { color: #ff8a6a; }
.count { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-display); font-size: calc(220 * var(--p)); color: var(--text); text-shadow: 0 calc(8 * var(--p)) 0 #4e3312; pointer-events: none; }
.emotebar { position: absolute; left: 50%; bottom: calc(10 * var(--p)); transform: translateX(-50%); display: none; gap: calc(14 * var(--p)); padding: calc(10 * var(--p)) calc(16 * var(--p)); background: #1b1b1aee; border: 2px solid var(--primary); }
.emotebar.on { display: flex; }
.emotebar button { width: calc(84 * var(--p)); height: calc(84 * var(--p)); font-size: calc(54 * var(--p)); color: var(--accent); display: grid; place-items: center; border: 1px solid #a16a2f88; }
.emotebar button:active { transform: scale(.9); background: #333; }

/* ---------- MATCH: landscape (#09) ---------- */
@media (orientation: landscape) and (min-aspect-ratio: 5/4) {
  :root { --q: calc(min(100vw, 177.7dvh) / 1672); }   /* 1 design px of the 1672-wide landscape mockup */
  #match .mgrid { width: min(100vw, 177.7dvh); height: min(100dvh, 56.27vw); top: 50%; transform: translateY(-50%); bottom: auto; padding: 0 calc(6 * var(--q));
    grid-template-columns: 25% 1fr 25%; grid-template-rows: calc(76 * var(--q)) 1fr calc(66 * var(--q)); column-gap: calc(8 * var(--q));
    grid-template-areas: "hud hud hud" "left field right" "left hint right"; }
  .hudP, .plistP, .powerP, .hintP, .actP { display: none; }
  .hudL, .hintL { display: flex; }
  .leftL, .rightL { display: flex; flex-direction: column; gap: calc(10 * var(--q)); padding-bottom: calc(10 * var(--q)); min-height: 0; }
  .hudL { grid-area: hud; align-items: center; gap: calc(16 * var(--q)); padding: 0 calc(16 * var(--q)) 0 calc(40 * var(--q)); margin: calc(4 * var(--q)) 0 calc(6 * var(--q)); --c: calc(12 * var(--q)); }
  .lball { width: calc(48 * var(--q)); height: calc(48 * var(--q)); }
  .llogo { font-size: calc(42 * var(--q)); font-weight: 900; font-style: italic; letter-spacing: .02em; text-transform: uppercase; color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gem { width: calc(18 * var(--q)); height: calc(18 * var(--q)); transform: rotate(45deg); flex: none; border: 1px solid var(--accent); }
  .gem.b { background: linear-gradient(135deg, #8fd6ff, #1d6ea8); } .gem.r { background: linear-gradient(135deg, #ff8f7d, var(--danger)); }
  .ltime { font-size: calc(64 * var(--q)); padding: 0 calc(40 * var(--q)); border-inline: calc(3 * var(--q)) solid var(--primary); line-height: 1.1; }
  .lleft { flex: 1; text-align: center; font-size: calc(40 * var(--q)); font-weight: 900; letter-spacing: .02em; white-space: nowrap; }
  .hudL .pauseb { width: calc(64 * var(--q)); height: calc(54 * var(--q)); font-size: calc(32 * var(--q)); border: calc(3 * var(--q)) solid var(--primary); }
  .leftL { grid-area: left; } .rightL { grid-area: right; }
  .panel { position: relative; background: #0f2e19 url(../assets/ui/felt.webp); background-size: calc(256 * var(--q)); box-shadow: inset 0 0 0 calc(3 * var(--q)) var(--primary), inset 0 0 0 calc(6 * var(--q)) #0d2414, inset 0 0 0 calc(7 * var(--q)) var(--border), var(--shadow);
    clip-path: polygon(calc(16 * var(--q)) 0, calc(100% - calc(16 * var(--q))) 0, 100% calc(16 * var(--q)), 100% calc(100% - calc(16 * var(--q))), calc(100% - calc(16 * var(--q))) 100%, calc(16 * var(--q)) 100%, 0 calc(100% - calc(16 * var(--q))), 0 calc(16 * var(--q))); padding: calc(14 * var(--q)) calc(18 * var(--q)); }
  .rank { flex: 0 0 52%; min-height: 0; overflow: hidden; }
  .rank h3 { display: flex; justify-content: center; align-items: center; gap: calc(14 * var(--q)); font-size: calc(48 * var(--q)); font-weight: 900; letter-spacing: .015em; line-height: 1.1; }
  .rank h3 .laurel { position: static; width: calc(26 * var(--q)); height: calc(46 * var(--q)); }
  .rank table { width: 100%; border-collapse: collapse; font-size: calc(29 * var(--q)); margin-top: calc(6 * var(--q)); }
  .rank th { font-size: calc(21 * var(--q)); color: var(--text); font-weight: 800; padding-bottom: calc(4 * var(--q)); border-bottom: 1px solid #f8f0e244; }
  .rank td { text-align: center; padding: calc(3 * var(--q)) 0; border-bottom: 1px solid #f8f0e222; }
  .rank td.nm { text-align: start; display: flex; align-items: center; gap: calc(10 * var(--q)); max-width: calc(200 * var(--q)); overflow: hidden; white-space: nowrap; }
  .rank td img { width: calc(36 * var(--q)); height: calc(36 * var(--q)); border-radius: 50%; object-fit: cover; flex: none; }
  .rank tr.you td { color: var(--accent); background: #ffd06a1a; }
  .rank tr.you td:first-child { box-shadow: inset calc(3 * var(--q)) 0 0 var(--accent); }
  .rank tr.out td { opacity: .4; }
  .aimpad { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-between; min-height: 0; }
  .dial { position: relative; flex: 1; aspect-ratio: 1; max-width: 100%; min-height: 0; border-radius: 50%; background: radial-gradient(circle, #1f5a2c, #123d1e 70%); box-shadow: 0 0 0 calc(8 * var(--q)) var(--primary), 0 0 0 calc(12 * var(--q)) #5a3b14, inset 0 0 calc(20 * var(--q)) #000a; margin: calc(14 * var(--q)); touch-action: none; }
  .dial canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; }
  .dial .hand { position: absolute; left: 30%; top: 52%; width: 30%; height: 30%; color: var(--text); opacity: .85; pointer-events: none; transition: opacity .2s; }
  .dial.act .hand { opacity: 0; }
  .padlbl { display: flex; align-items: center; gap: calc(14 * var(--q)); font-size: calc(36 * var(--q)); font-weight: 900; letter-spacing: .02em; padding: calc(6 * var(--q)) calc(30 * var(--q)); background: #1b1b1a; border: calc(3 * var(--q)) solid var(--primary); white-space: nowrap; }
  .field { grid-area: field; }
  .hintL { grid-area: hint; align-items: center; justify-content: center; }
  .hintL span { font-size: calc(32 * var(--q)); font-style: italic; font-weight: 700; padding: calc(6 * var(--q)) calc(60 * var(--q)); background: #1b1b1a; border: calc(3 * var(--q)) solid var(--primary); white-space: nowrap; }
  .me { flex: 0 0 45%; display: grid; grid-template-columns: calc(130 * var(--q)) 1fr; grid-template-rows: auto auto 1fr; column-gap: calc(16 * var(--q)); align-content: start; overflow: hidden; }
  .mface { grid-row: 1 / 3; width: calc(130 * var(--q)); height: calc(130 * var(--q)); border-radius: 50%; border: calc(5 * var(--q)) solid var(--primary); object-fit: cover; background: #0d2b17; }
  .mtitle { font-size: calc(42 * var(--q)); font-weight: 900; align-self: end; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 2px solid #f8f0e244; }
  .mlives { display: flex; align-items: center; gap: calc(12 * var(--q)); font-size: calc(40 * var(--q)); }
  .mlives span { display: flex; gap: calc(6 * var(--q)); color: var(--primary); font-size: calc(40 * var(--q)); }
  .mlives svg.off { color: #f8f0e22e; }
  .mstats { grid-column: 1 / 3; list-style: none; margin-top: calc(10 * var(--q)); }
  .mstats li { display: flex; align-items: center; gap: calc(14 * var(--q)); font-size: calc(28 * var(--q)); padding: calc(6 * var(--q)) 0; border-top: 1px solid #f8f0e222; text-transform: uppercase; }
  .mstats li svg { font-size: calc(32 * var(--q)); color: var(--primary); }
  .mstats li b { margin-inline-start: auto; font-size: calc(38 * var(--q)); }
  .ctrl { flex: 1; display: grid; grid-template-columns: 30% 1fr; grid-template-rows: auto 1fr; gap: calc(10 * var(--q)); align-items: center; justify-items: center; min-height: 0; }
  .vpower { grid-row: 1 / 3; display: flex; flex-direction: column; align-items: center; gap: calc(6 * var(--q)); height: 100%; padding: calc(8 * var(--q)); border: calc(3 * var(--q)) solid var(--primary); background: #1b1b1a; }
  .vpower small { font-size: calc(30 * var(--q)); font-weight: 900; }
  .vsegs { flex: 1; width: calc(52 * var(--q)); display: flex; flex-direction: column-reverse; gap: calc(5 * var(--q)); }
  .vsegs i { clip-path: none; }
  .guardL { position: relative; width: calc(150 * var(--q)); height: calc(108 * var(--q)); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: calc(30 * var(--q)); font-weight: 900; background: #1b1b1a; border: calc(3 * var(--q)) solid var(--primary); overflow: hidden;
    clip-path: polygon(14% 0, 86% 0, 100% 20%, 100% 80%, 86% 100%, 14% 100%, 0 80%, 0 20%); }
  .guardL svg { font-size: calc(44 * var(--q)); color: var(--primary); }
  .flickL { position: relative; width: min(calc(250 * var(--q)), 100%); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #2b6b38, #123d1e 70%); box-shadow: 0 0 0 calc(8 * var(--q)) var(--primary), 0 0 0 calc(12 * var(--q)) #5a3b14, 0 calc(6 * var(--q)) calc(16 * var(--q)) #000a; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
  .flickL img { width: 40%; }
  .flickL span { font-size: calc(54 * var(--q)); font-weight: 900; font-style: italic; }
  .flickL .cdm { border-radius: 50%; }
  .banner { font-size: calc(70 * var(--q)); }
  .count { font-size: calc(180 * var(--q)); }
  .emotebar button { width: calc(64 * var(--q)); height: calc(64 * var(--q)); font-size: calc(40 * var(--q)); }
}

/* lobby/result in landscape: keep the portrait column but centred on felt with the wood frame */
@media (orientation: landscape) and (min-aspect-ratio: 5/4) {
  #lobby .col, #room .col, #result .col { box-shadow: 0 0 0 calc(10 * var(--p)) #6d4a1f, 0 0 0 calc(14 * var(--p)) var(--primary), 0 0 60px #000a; }
}
@media (orientation: landscape) and (min-aspect-ratio: 16/10) {
  /* wide screens: lobby becomes two columns (board left, menu right) */
  :root { --p: calc(min(50vw, 66.67dvh) / 1024); }
  #lobby .col { width: min(100vw, 133dvh); }
  #tabHome { display: none; }
  #tabHome.on { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto auto auto 1fr; column-gap: calc(40 * var(--p)); align-content: center; }
  #tabHome .logo { grid-column: 2; grid-row: 1; }
  #tabHome .boardwrap { grid-column: 1; grid-row: 1 / 7; min-height: 0; height: 100%; margin: 0; }
  #tabHome .modebar { grid-column: 2; margin-top: calc(24 * var(--p)); }
  #tabHome .online, #tabHome .play, #tabHome .row2, #tabHome .linkbtn { grid-column: 2; }
  #lobby .tab:not(#tabHome) { padding: 0 calc(200 * var(--p)); }
}

/* ---------- RESULT (#08) ---------- */
.woodframe .col { box-shadow: inset calc(22 * var(--p)) 0 0 #8a5a2e, inset calc(-22 * var(--p)) 0 0 #8a5a2e, inset calc(26 * var(--p)) 0 0 var(--primary), inset calc(-26 * var(--p)) 0 0 var(--primary); padding: 0 calc(54 * var(--p)); overflow-y: auto; touch-action: pan-y; scrollbar-width: none; }
.rhead { position: relative; text-align: center; margin-top: calc(16 * var(--p)); flex: none; }
.kick { display: flex; align-items: center; justify-content: center; gap: calc(28 * var(--p)); font-size: calc(32 * var(--p)); letter-spacing: .10em; }
.kick i { width: calc(120 * var(--p)); height: 2px; background: var(--text); opacity: .7; }
.vict { font-family: var(--f-display); font-size: calc(124 * var(--p)); line-height: .96; letter-spacing: .025em; text-transform: uppercase; white-space: nowrap;
  background: linear-gradient(180deg, #ffe08c, var(--primary) 60%, #b5781f); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 calc(5 * var(--p)) 0 #3a260c); }
.vict.lose { background: linear-gradient(180deg, #f8f0e2, #c6b998); -webkit-background-clip: text; background-clip: text; }
.place { font-size: calc(110 * var(--p)); line-height: 1; color: var(--text); text-shadow: 0 calc(4 * var(--p)) 0 #0008; }
.rhead .laurel.big { top: calc(40 * var(--p)); width: calc(90 * var(--p)); height: calc(170 * var(--p)); }
.rhead .laurel.l { left: calc(40 * var(--p)); } .rhead .laurel.r { right: calc(40 * var(--p)); }
.beam { position: relative; height: calc(150 * var(--p)); margin: calc(4 * var(--p)) calc(-54 * var(--p)); display: grid; place-items: center; flex: none; }
.beam::before { content: ''; position: absolute; left: 0; right: 0; top: 34%; height: 32%; background: url(../assets/ui/wood.webp) center / auto 100% repeat-x, #8a5a2e; box-shadow: 0 2px 0 var(--primary), 0 -2px 0 var(--primary), var(--shadow); }
.beam img { position: relative; height: 100%; width: auto; filter: drop-shadow(0 4px 6px #000a); }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); height: calc(112 * var(--p)); margin-top: calc(8 * var(--p)); flex: none; }
.stats3 > div { display: flex; align-items: center; justify-content: center; gap: calc(18 * var(--p)); }
.stats3 > div + div { border-inline-start: 2px solid #f8f0e244; }
.stats3 svg { font-size: calc(64 * var(--p)); color: var(--text); }
.stats3 p { text-align: center; line-height: 1; }
.stats3 small { display: block; font-size: calc(26 * var(--p)); letter-spacing: .06em; }
.stats3 b { font-size: calc(56 * var(--p)); }
.rewards { position: relative; margin-top: calc(34 * var(--p)); padding: calc(36 * var(--p)) calc(20 * var(--p)) calc(16 * var(--p)); border: 2px solid var(--primary); flex: none; }
.tagplate { position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%); font-family: var(--f-display); font-size: calc(32 * var(--p)); color: #1d1d1c; padding: calc(6 * var(--p)) calc(50 * var(--p)); white-space: nowrap;
  background: linear-gradient(#f2cf7d, var(--primary)); clip-path: polygon(calc(20 * var(--p)) 0, calc(100% - calc(20 * var(--p))) 0, 100% 50%, calc(100% - calc(20 * var(--p))) 100%, calc(20 * var(--p)) 100%, 0 50%); }
.rw2 { display: grid; grid-template-columns: 1fr 1fr; gap: calc(14 * var(--p)); }
.rw2 > div { display: flex; align-items: center; justify-content: center; gap: calc(20 * var(--p)); height: calc(116 * var(--p)); border: 1px solid #f8f0e299; }
.rw2 img { width: calc(96 * var(--p)); height: calc(96 * var(--p)); }
.rw2 b { font-size: calc(46 * var(--p)); font-weight: 900; }
.lvrow { display: flex; align-items: center; gap: calc(20 * var(--p)); margin-top: calc(16 * var(--p)); }
.lvtag { font-size: calc(28 * var(--p)); padding: calc(4 * var(--p)) calc(24 * var(--p)); border: 2px solid var(--primary); background: #1b1b1a; white-space: nowrap; }
.xpbar { flex: 1; height: calc(24 * var(--p)); background: #1b1b1a; border: 2px solid #5a3b14; }
.xpbar i { display: block; height: 100%; width: 0; background: linear-gradient(#ffd879, var(--primary)); transition: width 1.2s cubic-bezier(.2, .8, .2, 1); }
.xptxt { font-size: calc(26 * var(--p)); white-space: nowrap; }
#rsBench { margin-top: calc(26 * var(--p)); flex: none; }
.kick.next { margin-top: calc(26 * var(--p)); font-size: calc(28 * var(--p)); flex: none; }
.btn-gold.again { height: calc(118 * var(--p)); font-size: calc(72 * var(--p)); margin-top: calc(14 * var(--p)); background-image: url(../assets/ui/btn_gold2.webp); }
#rsBack { margin-bottom: calc(24 * var(--p)); font-size: calc(34 * var(--p)); }

/* ---------- MODALS ---------- */
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: #000a; z-index: 50; padding: 16px; }
.modal.on { display: flex; }
.mbox { width: min(92vw, calc(820 * var(--p)), 520px); padding: calc(40 * var(--p)) calc(44 * var(--p)); text-align: center; --c: calc(24 * var(--p)); max-height: 92dvh; overflow-y: auto; touch-action: pan-y; }
.mbox.wide { width: min(96vw, 1100px); }
.mbox h3 { font-family: var(--f-display); font-weight: 400; font-size: max(24px, calc(56 * var(--p))); color: var(--accent); margin-bottom: 16px; text-transform: uppercase; }
.mbox .row2 { margin-top: 18px; }
.mbox .btn-felt { height: max(48px, calc(90 * var(--p))); font-size: max(18px, calc(36 * var(--p))); }
.btn-gold.slim { height: max(56px, calc(110 * var(--p))); font-size: max(26px, calc(56 * var(--p))); margin-top: 16px; }
.mbox .linkbtn { font-size: max(16px, calc(30 * var(--p))); }
.note { font-size: max(15px, calc(28 * var(--p))); font-weight: 700; color: var(--muted); margin: 10px 0; line-height: 1.25; }
#joinCode { text-align: center; letter-spacing: .3em; font-size: max(28px, calc(64 * var(--p))); }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f8f0e222; font-size: max(18px, calc(34 * var(--p))); }
.toggle { width: 64px; height: 32px; background: #111; border: 2px solid var(--border); position: relative; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; background: var(--muted); transition: transform .15s; }
.toggle.on { border-color: var(--primary); background: #3a2c10; }
.toggle.on::after { transform: translateX(32px); background: var(--accent); }
.mbox .btn-small { font-size: max(16px, calc(30 * var(--p))); height: max(40px, calc(68 * var(--p))); }
.how4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; text-align: start; }
@media (max-width: 760px) { .how4 { grid-template-columns: 1fr 1fr; } }
.hstep { background: var(--secondary) url(../assets/ui/felt.webp); background-size: 200px; border: 3px solid var(--primary); border-radius: 22px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.hstep h4 { font-family: var(--f-wide); font-weight: 900; font-size: max(15px, calc(30 * var(--p))); color: var(--text); background: var(--bg); border: 2px solid var(--primary); border-radius: 12px; padding: 4px 8px; text-align: center; text-transform: uppercase; }
.hstep svg { width: 100%; height: auto; aspect-ratio: 3 / 2; }
.hstep p { background: var(--text); color: #1d1d1c; border-radius: 14px; padding: 8px 10px; font-size: max(13px, calc(24 * var(--p))); line-height: 1.12; font-weight: 800; flex: 1; }
.toast { position: fixed; left: 50%; bottom: 12%; transform: translateX(-50%); background: #1b1b1af2; border: 2px solid var(--primary); color: var(--text); font-size: max(16px, calc(32 * var(--p))); padding: 10px 20px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; text-align: center; max-width: 90vw; }
.toast.on { opacity: 1; }

/* language popup from shared i18n.js, restyled to the brass/charcoal kit */
#vds-lang-pop > div { background: var(--surface) !important; border-radius: 0 !important; border: 3px solid var(--primary); font-family: var(--f-head) !important; }
#vds-lang-pop > div > div:first-child { font-family: var(--f-display); font-weight: 400 !important; color: var(--accent); text-transform: uppercase; }
#vds-lang-pop button { border-radius: 0 !important; background: #111 !important; border: 2px solid #a16a2f99 !important; font-family: var(--f-head) !important; font-weight: 800; font-size: 17px !important; }
#vds-lang-pop button[style*="#6366f1"] { background: #3a2c10 !important; border-color: var(--accent) !important; color: var(--accent) !important; }
[dir="rtl"] .btn-gold .arr { right: auto; left: calc(70 * var(--p)); transform: scaleX(-1); }
[lang="ar"] .logo .l1, [lang="ar"] .logo .l2, [lang="hi"] .logo .l1, [lang="hi"] .logo .l2, [lang^="zh"] .logo .l1, [lang^="zh"] .logo .l2, [lang="ja"] .logo .l1, [lang="ja"] .logo .l2, [lang="ko"] .logo .l1, [lang="ko"] .logo .l2 { font-family: var(--f-head); font-weight: 900; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- fixes after self-review (Playwright shots) ---- */
.banner { white-space: normal; width: 94%; font-size: calc(68 * var(--p)); line-height: 1; }
.beam img { height: calc(150 * var(--p)); width: auto; }
.flickL img { height: auto; }
@media (orientation: landscape) and (min-aspect-ratio: 5/4) {
  .rank { flex: 0 0 56%; }
  .rank h3 { font-size: calc(40 * var(--q)); }
  .rank table { font-size: calc(26 * var(--q)); }
  .rank td { padding: 0; height: calc(38 * var(--q)); }
  .rank td img { width: calc(30 * var(--q)); height: calc(30 * var(--q)); }
  .banner { font-size: calc(58 * var(--q)); }
}
@media (orientation: landscape) and (min-aspect-ratio: 16/10) {
  #tabHome.on { grid-template-rows: 1fr auto auto auto auto auto auto 1fr; align-content: stretch; }
  #tabHome .logo { grid-row: 2; }
  #tabHome .modebar { grid-row: 3; } #tabHome .online { grid-row: 4; } #tabHome .play { grid-row: 5; } #tabHome .row2 { grid-row: 6; } #tabHome .linkbtn { grid-row: 7; }
  #tabHome .boardwrap { grid-row: 1 / -1; }
}
.ballbtn { width: calc(116 * var(--p)); height: calc(116 * var(--p)); }
.flickP { gap: calc(2 * var(--p)); }
.fplate { padding: calc(2 * var(--p)) calc(36 * var(--p)); }
@media (orientation: landscape) and (min-aspect-ratio: 5/4) {
  .me { flex: 0 0 50%; }
  .mstats { margin-top: calc(4 * var(--q)); }
  .mstats li { padding: calc(3 * var(--q)) 0; font-size: calc(26 * var(--q)); }
}
/* paint isolation for the parts that change during play */
.rbtn, .ballbtn, .guardL, .flickL, .segs, .vsegs, .hplate b, .banner, .count { will-change: transform; }
.field, .plistP, .rank, .mstats { contain: layout paint; }
#match .plaque, #match .hplate { filter: none; }
/* tall phones: the table takes the full width, the spare height is split evenly around it instead of pooling at the edges */
@media (orientation: portrait), (max-aspect-ratio: 5/4) {
  #match .mgrid { grid-template-rows: calc(108 * var(--p)) calc(196 * var(--p)) minmax(0, 1fr) min(calc(100vw * 1.05), calc(100dvh - 644 * var(--p))) minmax(0, 1fr) calc(76 * var(--p)) calc(44 * var(--p)) calc(220 * var(--p));
    grid-template-areas: "hud" "plist" "." "field" "." "power" "hint" "act"; }

}
/* scores and ranks stay left-to-right inside RTL layouts */
.place, .num, .rw2 b, .xptxt, .lvtag, .bbtn .pr { direction: ltr; unicode-bidi: isolate; }

/* shared 🌐 language button (#vds-lang-btn from i18n.js) docked in the lobby top bar, brass-on-charcoal like the LV pill */
.topbar #vds-lang-btn { position: static !important; flex: none; z-index: auto !important; max-width: calc(210 * var(--p)); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  padding: calc(6 * var(--p)) calc(14 * var(--p)) !important; border-radius: 0 !important; border: 2px solid var(--primary) !important; background: #1b1b1a !important; color: var(--text) !important;
  font-family: var(--f-head) !important; font-size: calc(28 * var(--p)) !important; font-weight: 800; line-height: 1.2; cursor: pointer; }
.topbar #vds-lang-btn:active { transform: scale(.95); }
