/* Reversi: the page's own look (loaded only on its page, after app.css and t21.css, whose panels, time bar and
   messages it shares). One surface of 8 × 8 squares drawn with lines and four small dots (never two colours of
   squares), in a frame with a thin inlay; flat discs with two faces, one dark and one light, that turn over in 3D.
   Five boards (.rvb-*) and four sets of discs (.rvd-*): the admin's, or each player's own choice; the checkers bought
   with chips give their colours too (/cos.css: .rvd-cos_*). Nothing here changes every frame but the time bar. */

/* ---------- the boards: the frame (--fr*), its inlay (--in), the surface (--s*), the lines (--ln, --lw), the dots ---------- */
.rvb-felt { --fr1: #4a2c17; --fr2: #2c180b; --fr3: #140a04; --in: #c9a46a; --s1: #34a56a; --s2: #1d7246; --s3: #0e4529; --ln: rgba(0,0,0,.62); --lw: 1.4px;
  --dot: rgba(0,0,0,.7); --tex: rgba(0,0,0,.07); --gl: .12; --hint: rgba(255,247,214,.85); }
.rvb-jade { --fr1: #2a1d16; --fr2: #17100b; --fr3: #080504; --in: #e6c46e; --s1: #52bfa2; --s2: #23806b; --s3: #0d4a3d; --ln: #d9b45a; --lw: 1.4px;
  --dot: #f0d488; --tex: rgba(255,255,255,.06); --gl: .32; --hint: rgba(255,236,170,.95); }
.rvb-slate { --fr1: #3a3e46; --fr2: #22252b; --fr3: #0e1013; --in: #d08a52; --s1: #5a606a; --s2: #363a42; --s3: #1b1e23; --ln: #c98250; --lw: 1.3px;
  --dot: #e3a06c; --tex: rgba(255,255,255,.035); --gl: .1; --hint: rgba(255,214,180,.9); }
.rvb-teak { --fr1: #5a3416; --fr2: #3a1f0b; --fr3: #1c0e04; --in: #f0cf78; --s1: #c4864a; --s2: #9a5e2d; --s3: #6a3b17; --ln: #e8c46a; --lw: 1.6px;
  --dot: #f6db92; --tex: rgba(60,25,5,.16); --gl: .26; --hint: rgba(255,240,190,.95); }
.rvb-nebula { --fr1: #1c1240; --fr2: #0e0826; --fr3: #050212; --in: #b46cff; --s1: #4a2590; --s2: #26125a; --s3: #0e0630; --ln: rgba(95,240,255,.8); --lw: 1.2px;
  --dot: #8ff6ff; --tex: rgba(255,255,255,.03); --gl: .3; --hint: rgba(143,246,255,.95); }

/* ---------- the discs: the dark face (--dk, light --dkh, edge --dke) and the light one (--lt*) ---------- */
.rvd-classic { --dk: #1e1e21; --dkh: #4c4c52; --dke: #060607; --lt: #eeede8; --lth: #ffffff; --lte: #aaa69b; --shine: .35; }
.rvd-pearl { --dk: #121216; --dkh: #70707e; --dke: #000; --lt: #efeaf3; --lth: #ffffff; --lte: #b7aec4; --shine: .8; }
.rvd-copper { --dk: #b5602c; --dkh: #f5b47c; --dke: #5a270c; --lt: #c7ccd4; --lth: #fbfcff; --lte: #69707b; --shine: .7; }
.rvd-glass { --dk: rgba(38,42,56,.92); --dkh: rgba(160,170,200,.95); --dke: #0a0b11; --lt: rgba(232,242,252,.88); --lth: #ffffff; --lte: rgba(140,165,192,.95); --shine: .9; }

/* ---------- the table: the board on the left (the most room), one column on the right, nothing scrolls ---------- */
html:has(body.game-reversi[data-page="table"]) { overflow: hidden; }
body.game-reversi[data-page="table"] .site-foot { display: none; }
body.game-reversi[data-page="table"] #table.page { max-width: none; height: calc(100dvh - var(--top)); box-sizing: border-box; overflow: hidden; padding: 10px 14px; }
body.game-reversi[data-page="table"] .chat-fab { display: none !important; }
.rv-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "board tools" "board side"; gap: 10px 18px; height: 100%; }
.rv-tools { grid-area: tools; }
.rv-boardbox { grid-area: board; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; }
.rv-side { grid-area: side; display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; overflow: hidden; }
.rv-players { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* the frame: a solid moulding with a bevel and a thin inlay round the surface */
.rv-board { --bw: 560px; --u: calc(var(--bw) * .89 / 8); position: relative; flex: none; width: var(--bw); aspect-ratio: 1; border-radius: calc(var(--bw) * .03);
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  background: linear-gradient(160deg, rgba(255,255,255,.16), rgba(255,255,255,0) 30%, rgba(0,0,0,0) 70%, rgba(0,0,0,.3)), linear-gradient(135deg, var(--fr1), var(--fr2) 55%, var(--fr3));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), inset 0 2px 0 rgba(255,255,255,.18), inset 0 -3px 8px rgba(0,0,0,.5),
              0 30px 60px -24px rgba(0,0,0,.95), 0 10px 22px -10px rgba(0,0,0,.75); }
.rv-board::before { content: ''; position: absolute; inset: 3.6%; border-radius: calc(var(--bw) * .012); pointer-events: none;
  box-shadow: inset 0 0 0 calc(var(--bw) * .0035) var(--in), inset 0 0 0 calc(var(--bw) * .012) rgba(0,0,0,.35), 0 1px 0 rgba(255,255,255,.12); }
/* the surface: one material with its texture, the lines between the squares, the four dots, a soft light */
.rv-grid { position: absolute; inset: 5.5%; display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr); border-radius: 2px; overflow: hidden;
  outline: var(--lw) solid var(--ln);
  background:
    radial-gradient(circle at 25% 25%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    radial-gradient(circle at 75% 25%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    radial-gradient(circle at 25% 75%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    radial-gradient(circle at 75% 75%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    linear-gradient(150deg, rgba(255,255,255,var(--gl)) 0%, rgba(255,255,255,0) 38%, rgba(255,255,255,0) 78%, rgba(255,255,255,calc(var(--gl) * .3)) 100%),
    repeating-linear-gradient(45deg, var(--tex) 0 1px, transparent 1px 3px), repeating-linear-gradient(-45deg, var(--tex) 0 1px, transparent 1px 4px),
    radial-gradient(120% 120% at 35% 30%, var(--s1), var(--s2) 55%, var(--s3));
  box-shadow: inset 0 0 calc(var(--bw) * .04) rgba(0,0,0,.45); }
/* (teak: the grain of the wood, long and wavy; jade: clouds in the stone; nebula: light in the glass) */
.rvb-teak .rv-grid { background:
    radial-gradient(circle at 25% 25%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    radial-gradient(circle at 75% 25%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    radial-gradient(circle at 25% 75%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    radial-gradient(circle at 75% 75%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    linear-gradient(150deg, rgba(255,240,210,var(--gl)) 0%, rgba(255,255,255,0) 40%, rgba(0,0,0,.12) 100%),
    repeating-radial-gradient(ellipse 260% 30% at 40% 130%, var(--tex) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(91deg, rgba(0,0,0,.08) 0 1px, transparent 1px 6px, rgba(255,230,190,.06) 6px 7px, transparent 7px 13px),
    linear-gradient(90deg, var(--s2), var(--s1) 30%, var(--s2) 55%, var(--s1) 80%, var(--s3)); }
.rvb-jade .rv-grid { background:
    radial-gradient(circle at 25% 25%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    radial-gradient(circle at 75% 25%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    radial-gradient(circle at 25% 75%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    radial-gradient(circle at 75% 75%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    linear-gradient(150deg, rgba(255,255,255,var(--gl)) 0%, rgba(255,255,255,0) 34%),
    radial-gradient(ellipse 50% 22% at 22% 30%, rgba(220,255,240,.22), transparent 70%), radial-gradient(ellipse 40% 18% at 78% 68%, rgba(220,255,240,.16), transparent 70%),
    radial-gradient(ellipse 60% 30% at 60% 20%, rgba(0,40,30,.25), transparent 70%), linear-gradient(118deg, transparent 46%, rgba(230,255,245,.12) 47%, transparent 49%),
    radial-gradient(120% 120% at 35% 30%, var(--s1), var(--s2) 55%, var(--s3)); }
.rvb-nebula .rv-grid { background:
    radial-gradient(circle at 25% 25%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    radial-gradient(circle at 75% 25%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    radial-gradient(circle at 25% 75%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    radial-gradient(circle at 75% 75%, var(--dot) 0 calc(var(--u) * .07), transparent calc(var(--u) * .08)),
    linear-gradient(150deg, rgba(255,255,255,var(--gl)) 0%, rgba(255,255,255,0) 32%),
    radial-gradient(ellipse 55% 40% at 20% 75%, rgba(255,80,200,.28), transparent 70%), radial-gradient(ellipse 50% 40% at 80% 20%, rgba(60,180,255,.28), transparent 70%),
    radial-gradient(120% 120% at 35% 30%, var(--s1), var(--s2) 55%, var(--s3)); }
.rvb-nebula .rv-sq { box-shadow: inset 0 0 0 calc(var(--lw) / 2) var(--ln), inset 0 0 calc(var(--u) * .12) rgba(95,240,255,.1); }
.rv-sq { position: relative; display: block; cursor: default; box-shadow: inset 0 0 0 calc(var(--lw) / 2) var(--ln); }

/* ---------- a disc: two faces back to back; it turns over round its middle, lifting a little ---------- */
.rvd { position: absolute; inset: 9%; display: block; margin: 0; font-style: normal; pointer-events: none; transform-style: preserve-3d;
  transition: transform calc(.42s * var(--spd, 1)) cubic-bezier(.45,.05,.35,1); }
.rvd.lt { transform: rotateY(180deg); }
.rvd .f { position: absolute; inset: 0; border-radius: 50%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.rvd .fd { background: radial-gradient(circle at 50% 50%, transparent 0 62%, rgba(255,255,255,calc(var(--shine) * .08)) 63% 66%, transparent 67%),
    radial-gradient(circle at 33% 27%, rgba(255,255,255,calc(var(--shine) * .55)) 0, rgba(255,255,255,0) 30%),
    radial-gradient(circle at 40% 35%, var(--dkh), var(--dk) 55%, var(--dke) 100%);
  box-shadow: inset 0 0 0 calc(var(--u) * .018) rgba(255,255,255,.1), inset 0 calc(var(--u) * -.06) calc(var(--u) * .08) rgba(0,0,0,.45),
              0 calc(var(--u) * .045) 0 var(--dke), 0 calc(var(--u) * .08) calc(var(--u) * .1) rgba(0,0,0,.55); }
.rvd .fl { transform: rotateY(180deg);
  background: radial-gradient(circle at 50% 50%, transparent 0 62%, rgba(0,0,0,.06) 63% 66%, transparent 67%),
    radial-gradient(circle at 33% 27%, rgba(255,255,255,calc(var(--shine) * .8)) 0, rgba(255,255,255,0) 32%),
    radial-gradient(circle at 40% 35%, var(--lth), var(--lt) 55%, var(--lte) 100%);
  box-shadow: inset 0 0 0 calc(var(--u) * .018) rgba(0,0,0,.12), inset 0 calc(var(--u) * -.06) calc(var(--u) * .08) rgba(0,0,0,.22),
              0 calc(var(--u) * .045) 0 var(--lte), 0 calc(var(--u) * .08) calc(var(--u) * .1) rgba(0,0,0,.5); }
/* (mother-of-pearl: its colours in the light; copper and steel: a brushed shine; glass: a bright rim) */
.rvd-pearl .rvd .fl { background: conic-gradient(from 30deg at 45% 40%, rgba(255,200,230,.35), rgba(190,230,255,.35), rgba(210,255,220,.3), rgba(255,236,190,.35), rgba(255,200,230,.35)),
    radial-gradient(circle at 33% 27%, #fff 0, rgba(255,255,255,0) 34%), radial-gradient(circle at 40% 35%, var(--lth), var(--lt) 55%, var(--lte) 100%); }
.rvd-copper .rvd .f { background-blend-mode: normal; }
.rvd-copper .rvd .fd { background: repeating-radial-gradient(circle at 50% 50%, rgba(255,255,255,.05) 0 1px, transparent 1px 3px),
    radial-gradient(circle at 33% 27%, rgba(255,230,200,.7) 0, rgba(255,255,255,0) 32%), radial-gradient(circle at 40% 35%, var(--dkh), var(--dk) 55%, var(--dke) 100%); }
.rvd-copper .rvd .fl { transform: rotateY(180deg); background: repeating-radial-gradient(circle at 50% 50%, rgba(0,0,0,.05) 0 1px, transparent 1px 3px),
    radial-gradient(circle at 33% 27%, #fff 0, rgba(255,255,255,0) 32%), radial-gradient(circle at 40% 35%, var(--lth), var(--lt) 55%, var(--lte) 100%); }
.rvd-glass .rvd .f { box-shadow: inset 0 0 0 calc(var(--u) * .03) rgba(255,255,255,.45), inset 0 calc(var(--u) * -.08) calc(var(--u) * .1) rgba(0,0,0,.25),
              0 calc(var(--u) * .04) 0 rgba(0,0,0,.25), 0 calc(var(--u) * .08) calc(var(--u) * .1) rgba(0,0,0,.45); }
/* placed: it comes down on the square; turning: it lifts a little (scale/translate: apart from the turn itself) */
.rvd.drop { animation: rvDrop calc(.34s * var(--spd, 1)) cubic-bezier(.3,1.35,.5,1); }
@keyframes rvDrop { from { scale: 1.5; translate: 0 -35%; opacity: 0; } 60% { opacity: 1; } }
.rvd.flip { animation: rvLift calc(.42s * var(--spd, 1)) ease-in-out; }
@keyframes rvLift { 50% { scale: 1.16; translate: 0 -9%; } }
.rvd.arrive { animation: rvDrop .5s cubic-bezier(.3,1.35,.5,1) backwards; animation-delay: var(--d, 0ms); }
/* your turn: the squares where a disc can go have a soft dot that breathes; a mouse over one shows what it turns */
.rv-sq.can { cursor: pointer; }
.rv-sq.can::after { content: ''; position: absolute; left: 50%; top: 50%; width: 26%; aspect-ratio: 1; border-radius: 50%; translate: -50% -50%; background: var(--hint);
  box-shadow: 0 0 0 calc(var(--u) * .03) rgba(0,0,0,.25); animation: rvCan 1.5s ease-in-out infinite; }
@keyframes rvCan { 50% { scale: .72; opacity: .6; } }
@media (hover: hover) { .rv-sq.can:hover::after { width: 70%; opacity: .45; animation: none; } }
.rv-sq.hint::after { content: ''; position: absolute; inset: 12%; border-radius: 50%; box-shadow: 0 0 0 calc(var(--u) * .045) var(--hint); pointer-events: none; }
/* the last disc placed: a small ring of the board's light */
.rv-sq.last::before { content: ''; position: absolute; left: 50%; top: 50%; width: 16%; aspect-ratio: 1; border-radius: 50%; translate: -50% -50%; z-index: 2;
  background: #ff5a5a; box-shadow: 0 0 0 calc(var(--u) * .02) rgba(255,255,255,.7); pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .rvd, .rvd.drop, .rvd.flip, .rvd.arrive, .rv-sq.can::after { animation: none !important; transition: none; } }

/* ---------- on the board: a quiet message on the top edge, whose turn, the end of a game ---------- */
.rv-board .rv-banner { top: calc(var(--bw) * .012); left: 50%; transform: translateX(-50%); z-index: 50; width: max-content; max-width: 86%; box-sizing: border-box;
  padding: clamp(3px, calc(var(--bw) * .007), 6px) clamp(10px, calc(var(--bw) * .026), 16px); border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: clamp(10px, calc(var(--bw) * .024), 14px); font-weight: 800; line-height: 1.25; color: #eefaf2; text-shadow: 0 1px 2px rgba(0,0,0,.7);
  background: rgba(6,14,10,.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border: 1px solid rgba(190,255,220,.3);
  box-shadow: 0 6px 16px -6px rgba(0,0,0,.8); animation: rvBanIn .35s ease-out; pointer-events: none; }
.rv-board .rv-banner.blank { animation: none; }
@keyframes rvBanIn { from { opacity: 0; transform: translate(-50%, -8px); } }
.rv-turn { position: absolute; left: 50%; top: 7.5%; z-index: 48; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 5px 15px; border-radius: 999px; pointer-events: none; text-align: center; white-space: nowrap; background: rgba(6,14,10,.58);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border: 1px solid rgba(190,255,220,.28); box-shadow: 0 10px 24px -8px rgba(0,0,0,.8); animation: rvBanIn .35s ease-out; }
.rv-turn.me { top: auto; bottom: 7.5%; border-color: rgba(255,214,130,.6); }
.rv-turn b { font-size: 13.5px; font-weight: 800; color: #eefaf2; } .rv-turn.me b { color: #ffe3a3; }
.rv-turn small { font-size: 11.5px; font-weight: 700; color: #ffb3a6; } .rv-turn small:empty { display: none; }
.rv-turn.low { background: rgba(80,10,14,.55); border-color: rgba(255,120,110,.75); }
.rv-turn.hidden { display: none; }
.rv-board .paused21 { border-radius: inherit; z-index: 60; }
.rv-end { position: absolute; inset: 0; z-index: 70; display: grid; place-items: center; border-radius: inherit; padding: 6%; background: rgba(4,10,8,.55);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.rv-end.hidden { display: none; }
.rv-end-in { width: min(400px, 100%); max-height: 100%; overflow: hidden auto; box-sizing: border-box; padding: clamp(18px, calc(var(--bw) * .05), 30px) 18px 16px; border-radius: 24px;
  text-align: center; position: relative; background: radial-gradient(120% 90% at 50% 0%, rgba(46,170,110,.25), transparent 70%), linear-gradient(170deg, rgba(20,40,34,.97), rgba(8,16,14,.97));
  border: 1px solid rgba(255,255,255,.14); box-shadow: 0 40px 80px -24px rgba(0,0,0,.95), 0 0 90px -20px rgba(46,170,110,.35); animation: rvEndIn .55s cubic-bezier(.3,1.4,.5,1); }
.rv-end-in.over { background: radial-gradient(130% 110% at 50% 0%, rgba(255,207,77,.35), transparent 72%), linear-gradient(170deg, rgba(20,40,34,.97), rgba(8,16,14,.97)); }
@keyframes rvEndIn { from { transform: scale(.86) translateY(14px); opacity: 0; } }
.rv-end-in h3 { margin: 12px 0 4px; font-size: clamp(15px, calc(var(--bw) * .036), 21px); font-weight: 900; background: linear-gradient(180deg, #fff, #ffe9a6); -webkit-background-clip: text;
  background-clip: text; color: transparent; }
.rv-end-draw { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; font-size: 30px; font-weight: 900; color: #ffe9a6;
  background: rgba(255,255,255,.08); box-shadow: 0 0 0 2px rgba(255,216,102,.45); }
.rv-endwhy { margin: 0 0 8px; font-size: 13px; font-weight: 800; color: #ffd866; }
.rv-end-discs { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0 8px; }
.rv-end-discs b { font-size: clamp(22px, calc(var(--bw) * .055), 34px); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.rv-end-discs em { font-style: normal; font-size: 22px; color: var(--muted); }
.rv-end-discs .rv-sw { --u: 26px; width: 26px; height: 26px; }
.rv-end-score { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 6px 0 2px; }
.rv-end-score b { font-size: 20px; font-weight: 900; line-height: 1; }
.rv-end-score em { font-style: normal; font-size: 18px; color: var(--muted); }
.rv-end-score span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 800; color: var(--muted); }
.rv-end-to { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: rgba(223,240,232,.6); font-weight: 800; }
.rv-end .he-hero { position: relative; display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; padding: 4px;
  background: conic-gradient(#ffcf4d, #fff3c4, #c98f1d, #ffcf4d); box-shadow: 0 0 32px rgba(255,207,77,.55); }
.rv-end .he-hav { position: relative; width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; overflow: hidden; font-size: 22px; font-weight: 900; color: #fff;
  background: radial-gradient(circle at 35% 28%, rgba(255,255,255,.55), transparent 42%), var(--bg); }
.rv-end .he-hav svg.i { width: 26px; height: 26px; } .rv-end .he-hav .ava-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rv-end .he-crown { position: absolute; left: 50%; top: -24px; width: 36px; transform: translateX(-50%) rotate(-8deg); filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
.rv-end .he-crown svg { display: block; width: 100%; }
.rv-end .he-next { margin: 12px 4px 0; font-size: 12px; color: rgba(223,240,232,.7); }
.rv-end .he-next i { display: block; height: 6px; margin-top: 7px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; }
.rv-end .he-next b { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #4fe0a0, #5fd1f0); transform-origin: left; animation: rvBar linear forwards; }
@keyframes rvBar { from { transform: scaleX(0); } }

/* ---------- around the board: the players, the score, your move, the discs ---------- */
.rv-pl { position: relative; display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 9px 42px 9px 10px; border-radius: 18px; min-width: 0;
  background: linear-gradient(160deg, rgba(22,40,46,.88), rgba(12,22,28,.85)); border: 1px solid var(--stroke); transition: border-color .3s, box-shadow .3s; }
.rv-pl.turn { border-color: rgba(255,216,102,.55); box-shadow: 0 0 0 3px rgba(255,216,102,.1), 0 16px 30px -18px rgba(255,216,102,.5); }
.rv-av { position: relative; width: 46px; height: 46px; flex: none; border-radius: 50%; padding: 3px; box-sizing: border-box; }
.rv-ring { position: absolute; inset: 0; border-radius: 50%; background: rgba(255,255,255,.14); }
.rv-pl.turn .rv-ring { background: conic-gradient(#ffd866 calc(var(--k, 1) * 360deg), rgba(255,255,255,.12) 0); }
.rv-avi { position: relative; display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; color: #fff; font-weight: 900; font-size: 17px;
  background: radial-gradient(circle at 35% 28%, rgba(255,255,255,.5), transparent 42%), var(--bg); box-shadow: 0 0 0 2px #0e1a1e; }
.rv-avi svg.i { width: 22px; height: 22px; } .rv-avi .ava-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rv-pn { display: flex; flex-direction: column; gap: 2px; min-width: 0; width: 100%; }
.rv-pn b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-pn small { font-size: 11.5px; color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* (a disc of the player's colour, at the side) */
.rv-sw { --u: 22px; position: relative; display: inline-block; flex: none; width: 22px; height: 22px; }
.rv-sw .rvd { inset: 0; transition: none; }
.rv-pl > .rv-sw { position: absolute; right: 12px; top: 50%; margin-top: -11px; }
.rv-score { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; padding: 8px 12px; border-radius: 18px;
  background: linear-gradient(160deg, rgba(22,40,46,.88), rgba(12,22,28,.85)); border: 1px solid var(--stroke); }
.rv-score small { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); line-height: 1.3; }
.rv-score small:last-child { text-align: right; }
.rv-sc { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; font-size: 30px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rv-sc i { font-style: normal; color: var(--muted); font-size: 22px; } .rv-sc b.me { color: #ffd866; }
.rv-sc b.bump { animation: rvBump .6s cubic-bezier(.3,1.6,.5,1); }
@keyframes rvBump { 40% { transform: scale(1.35); color: #fff; } }
/* the buttons: one bar of glass, the same size and look for each (pause has its word) */
.rv-tools { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; min-width: 0; }
.rv-tool { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; width: 40px; height: 40px; padding: 0; flex: none;
  border-radius: 13px; cursor: pointer; color: #effaf4; font: 800 13px 'Inter', system-ui, sans-serif;
  background: linear-gradient(180deg, rgba(255,255,255,.13), rgba(255,255,255,.04)), linear-gradient(160deg, rgba(22,44,40,.95), rgba(10,22,20,.95));
  border: 1px solid rgba(255,255,255,.16); box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 8px 18px -10px rgba(0,0,0,.9);
  transition: border-color .2s, background .2s, transform .15s; -webkit-tap-highlight-color: transparent; }
.rv-tool:hover { border-color: rgba(120,230,170,.55); }
.rv-tool:active { transform: translateY(1px) scale(.97); }
.rv-tool svg.i { width: 18px; height: 18px; flex: none; }
.rv-tool.wide { width: auto; padding: 0 15px; }
.rv-tool.hidden { display: none; }
.rv-tool > b { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; box-sizing: border-box; border-radius: 10px; display: grid; place-items: center;
  font-size: 11px; font-weight: 900; color: #fff; background: #ff4d6d; box-shadow: 0 0 0 2px #0e1a1e; }
.rv-tool > b.hidden { display: none; }
.rv-mute .tv-snd-off { display: none; }
body.tv-muted .rv-mute .tv-snd-off { display: inline; } body.tv-muted .rv-mute .tv-snd-on { display: none; }
.rv-dock { display: block; margin: 0; padding: 14px 14px 12px; min-width: 0; overflow: hidden; }
.rv-dock .turnlbl { flex-direction: column; gap: 3px; margin-bottom: 10px; }
.rv-dock .turnlbl b { white-space: normal; line-height: 1.3; overflow-wrap: anywhere; }
.rv-dock .turnlbl span:empty { display: none; }
.rv-dock.my-turn { border-color: rgba(255,216,102,.5); }
.rv-dock #tbarFill { will-change: transform; }
.rv-panel.rv-logp { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rv-logp .log21 { flex: 1; min-height: 0; max-height: none; }
.rv-count { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.rv-cn { display: grid; grid-template-columns: auto auto; justify-content: start; align-items: center; gap: 0 8px; min-width: 0; }
.rv-cn .rv-sw { grid-row: span 2; --u: 28px; width: 28px; height: 28px; }
.rv-cn b { font-size: 22px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.rv-cn > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.rv-bar { grid-column: 1 / -1; height: 6px; border-radius: 6px; overflow: hidden; background: rgba(255,255,255,.12); }
.rv-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffd866, #f2a93b); transform-origin: left; transition: transform .5s; }

/* ---------- home: a corner of the board, the look, the games to win ---------- */
.logo-rv { position: relative; width: 36px; height: 36px; flex: none; }
.logo-rv svg { width: 36px; height: 36px; display: block; filter: drop-shadow(0 3px 5px rgba(0,0,0,.45)); }
.hero-rv .rv-art { position: relative; height: 150px; display: flex; justify-content: center; align-items: flex-start; }
.rv-mini { --u: 33px; position: relative; margin-top: 4px; width: 150px; aspect-ratio: 1; padding: 8px; box-sizing: border-box; border-radius: 12px;
  background: linear-gradient(135deg, var(--fr1), var(--fr2) 55%, var(--fr3)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 14px 26px -10px rgba(0,0,0,.8);
  transform: perspective(600px) rotateX(18deg) rotateZ(-6deg); animation: rvMiniIn .7s cubic-bezier(.2,.9,.3,1) backwards; }
@keyframes rvMiniIn { from { transform: perspective(600px) rotateX(40deg) rotateZ(-20deg) translateY(-20px); opacity: 0; } }
.rv-mini-sq, .rv-prev { display: grid; border-radius: 3px; overflow: hidden; outline: var(--lw) solid var(--ln);
  background: radial-gradient(120% 120% at 35% 30%, var(--s1), var(--s2) 55%, var(--s3)); }
.rv-mini-sq { grid-template: repeat(4, 1fr) / repeat(4, 1fr); width: 100%; height: 100%; }
.rv-to { display: grid; grid-template-columns: repeat(3, 1fr); }
.rv-to button { font-size: 16px; font-weight: 900; }
/* your look: a small sample of the board and the discs you see, and what they are called */
.rv-mylook { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 16px; cursor: pointer; text-align: left; color: var(--text);
  background: rgba(255,255,255,.04); border: 1px solid var(--stroke); transition: background .2s, border-color .2s; }
.rv-mylook:hover { background: rgba(255,255,255,.07); border-color: rgba(120,230,170,.45); }
.rv-mylook > svg.i { width: 18px; height: 18px; color: var(--muted); flex: none; }
.rv-ml-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rv-ml-t b { font-size: 14px; } .rv-ml-t small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-prev { --u: 21px; position: relative; flex: none; grid-template: 1fr 1fr / 1fr 1fr; width: 46px; height: 46px; margin: 4px; border: 4px solid var(--fr2);
  box-shadow: 0 0 0 1px var(--in), 0 6px 12px -6px rgba(0,0,0,.8); }
.rv-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(2,8,6,.6); animation: fade .2s; }
.rv-modal.hidden { display: none; }
.rv-lk-box { width: min(760px, 100%); max-height: 90dvh; overflow-x: hidden; overflow-y: auto; box-sizing: border-box; padding: 22px; border-radius: 24px;
  background: linear-gradient(165deg, rgba(20,48,42,.98), rgba(8,18,16,.98)); border: 1px solid rgba(255,255,255,.14); box-shadow: 0 30px 80px -20px rgba(0,0,0,.9); }
.rv-lk-box h3 { margin: 0 0 4px; font-size: 19px; font-weight: 900; }
.rv-lk-note { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.rv-lk-h { margin: 12px 0 8px; font-size: 11px; font-weight: 900; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.rv-lk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px; min-width: 0; }
.rv-lk { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-width: 0; overflow: hidden; padding: 10px 8px; border-radius: 14px;
  cursor: pointer; color: var(--text); text-align: center; font: 700 12.5px 'Inter', system-ui, sans-serif; background: rgba(255,255,255,.04); border: 1px solid var(--stroke); }
.rv-lk > span:last-child { min-width: 0; line-height: 1.25; overflow-wrap: anywhere; hyphens: auto; }
.rv-lk .rv-prev { zoom: 1.75; }
.rv-lk.on { border-color: #ffd866; background: rgba(255,216,102,.1); box-shadow: 0 0 0 1px #ffd866 inset; }
.rv-lk-acts { display: flex; justify-content: flex-end; margin-top: 14px; }

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) { .rv-wrap { grid-template-columns: minmax(0, 1fr) 260px; gap: 10px 14px; } }
@media (max-height: 760px) and (min-width: 821px) { .rv-countp { display: none; } }
/* upright screens and small windows: the buttons on top, the board as wide as the screen, everything else under it */
@media (orientation: portrait), (max-width: 820px) and (min-height: 521px) {
  body.game-reversi[data-page="table"] #table.page { height: auto; overflow: visible; padding: 8px 10px 14px; }
  html:has(body.game-reversi[data-page="table"]) { overflow: auto; }
  .rv-wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; grid-template-areas: "tools" "board" "side"; gap: 8px; height: auto; }
  .rv-boardbox { aspect-ratio: 1; }
  .rv-side { overflow: visible; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .rv-players, .rv-dock { grid-column: 1 / -1; }
  .rv-players { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; }
  .rv-pl { padding: 7px 9px; } .rv-pl > .rv-sw { display: none; }
  .rv-score { display: flex; flex-direction: column; justify-content: center; gap: 0; height: 100%; box-sizing: border-box; padding: 6px 10px; text-align: center; }
  .rv-score small:last-child { text-align: center; }
  .rv-logp { max-height: 220px; }
  .rv-countp { display: block; }
}
@media (max-width: 520px) {
  /* (three narrow columns: each player's card upright — the picture on top, the whole name and its lines under it) */
  .rv-pl { flex-direction: column; justify-content: center; padding: 7px 6px; gap: 4px; text-align: center; }
  .rv-av { width: 34px; height: 34px; padding: 2px; }
  .rv-pn { align-items: center; gap: 1px; }
  .rv-pn b { font-size: 12px; line-height: 1.2; white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .rv-pn small { font-size: 10.5px; line-height: 1.25; white-space: normal; }
  .rv-sc { font-size: 24px; gap: 6px; } .rv-sc i { font-size: 16px; } .rv-score small { font-size: 9px; letter-spacing: .4px; }
  .rv-side { grid-template-columns: minmax(0, 1fr); }
  .rv-tool { width: 38px; height: 38px; }
  .rv-lk-box { padding: 16px 12px; } .rv-lk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .rv-lk .rv-prev { zoom: 1.5; }
}
/* a phone sideways: the whole height for the board on the left, the buttons and the rest in one column on the right */
@media (orientation: landscape) and (max-height: 520px) {
  body.game-reversi[data-page="table"] .top, body.game-reversi[data-page="table"] .site-foot { display: none; }
  body.game-reversi[data-page="table"] #table.page { height: 100dvh; margin: 0; padding: 4px max(6px, env(safe-area-inset-right)) 4px max(6px, env(safe-area-inset-left)); }
  .rv-wrap { grid-template-columns: minmax(0, 1fr) 200px; gap: 6px 8px; }
  .rv-tools { gap: 5px; }
  .rv-tool { width: 32px; height: 32px; border-radius: 10px; } .rv-tool svg.i { width: 15px; height: 15px; }
  .rv-tool.wide { width: 32px; padding: 0; }
  .rv-tool.wide > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .rv-side { gap: 6px; } .rv-players { gap: 5px; }
  .rv-pl { padding: 5px 30px 5px 7px; gap: 6px; border-radius: 13px; } .rv-av { width: 28px; height: 28px; padding: 2px; }
  .rv-pn b { font-size: 11.5px; } .rv-pn small { font-size: 9.5px; white-space: normal; line-height: 1.25; }
  .rv-pl > .rv-sw { --u: 16px; width: 16px; height: 16px; margin-top: -8px; right: 8px; }
  .rv-score { padding: 4px 8px; } .rv-sc { font-size: 20px; } .rv-sc i { font-size: 14px; } .rv-score small { font-size: 8.5px; letter-spacing: .3px; }
  .rv-dock { padding: 7px 9px; border-radius: 13px; } .rv-dock .turnlbl { font-size: 11px; margin-bottom: 5px; }
  .rv-panel { display: none; }
}
/* full screen: the table on one screen, nothing scrolls (the page's bar and footer go; the board grows to the height) */
body.game-fs .rv-wrap { height: 100%; }
@media (orientation: portrait), (max-width: 820px) and (min-height: 521px) {
  body.game-fs[data-page="table"]:has(.rv-wrap) { height: auto; min-height: 100dvh; overflow: visible; }
  body.game-fs[data-page="table"] .page#table:has(.rv-wrap) { height: auto; overflow: visible; }
}

/* the looks window always under the site's bar (it was centred: a tall one went under the bar); where the bar is hidden, the whole height */
.rv-modal { padding-top: calc(var(--top) + 12px); }
.rv-lk-box { max-height: calc(100dvh - var(--top) - 28px); }
body.game-fs .rv-modal { padding-top: 16px; } body.game-fs .rv-lk-box { max-height: calc(100dvh - 32px); }
@media (orientation: landscape) and (max-height: 520px) { body[data-page="table"] .rv-modal { padding-top: 16px; } body[data-page="table"] .rv-lk-box { max-height: calc(100dvh - 32px); } }
