/* CSS Document */
html, body { padding:0; margin:0; width: 100%; }
head { padding:0; margin:0; }
/*
 * Font: Inter, self-hosted under assets/fonts/inter (SIL Open Font
 * License, see LICENSE.txt there). Deliberately not from Google Fonts -
 * that would send the IP address to Google on every request.
 * Split by character set: the browser only loads what the page needs
 * (Polish latin-ext, Russian cyrillic).
 */
@font-face {
    font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
    src: url(../fonts/inter/inter-latin.woff2) format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
    src: url(../fonts/inter/inter-latin-ext.woff2) format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
    src: url(../fonts/inter/inter-cyrillic.woff2) format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
:root { --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
/* Accent for buttons and highlights, derived from the background colour the
   player picks (--body-bg, see prefs.js): its hue at a fixed perceived
   lightness (OKLCH), so white text has the same contrast on every colour.
   Chroma follows the background but is capped - black and grey stay grey,
   strong colours do not get garish. For the default #003333 this is close
   to the former teal #128a84, which remains the fallback where relative
   colours are not supported. */
:root {
    --accent: #128a84;
    --accent-hover: #17a69f;
    --accent-soft: rgba(18,138,132,0.12);
    --accent-softer: rgba(18,138,132,0.16);
}
@supports (color: oklch(from red l c h)) {
    :root {
        --accent: oklch(from var(--body-bg, #003333) 0.54 min(calc(c * 3), 0.11) h);
        --accent-hover: oklch(from var(--body-bg, #003333) 0.61 min(calc(c * 3), 0.11) h);
        --accent-soft: oklch(from var(--body-bg, #003333) 0.54 min(calc(c * 3), 0.11) h / 0.12);
        --accent-softer: oklch(from var(--body-bg, #003333) 0.54 min(calc(c * 3), 0.11) h / 0.16);
    }
}
/* Buttons and nav links fade between their colours on hover */
#say_s, .btn, .pager button, .ajax-field button, .cards-set,
.data-table th button, .top-nav a, .lang-switch a {
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

body,div { font-family: var(--font); font-size:13px; line-height:1.5; }
/* The playing field positions texts pixel-exact - keep the old line height there.
   Broad defaults for everything inside an ID use :where(), which gives them
   the weight of a plain element selector: a class rule for a single element
   (e.g. .mp_game *) then wins, as it would anywhere else. A plain #id div
   outranked every class rule below it. */
#game_container, :where(#game_container) div { line-height: normal; }
body { background-color: var(--body-bg, #003333); background-image:url(../img/bg.png); background-attachment:fixed; background-position: left top; color:#FFFFFF; min-width: 660px; }
img { border:none; }
a { text-decoration:underline; color:#FFFFFF; }
a:hover { text-decoration:none; }
h1 { font-size:20px; font-weight:700; margin-top:10px; margin-bottom:10px; text-align: center; }
h2 { font-size:16px; margin-top:10px; margin-bottom:10px; }
hr  { border:none; border-top:1px solid rgba(255,255,255,0.25); height:0; padding:0px; }

#top {
    position: relative;
    /* slightly transparent, the wallpaper shows through behind a blur */
    background-color: rgba(11,42,42,0.6);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    color: #FFFFFF;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
#top .container { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; width: auto; max-width: 760px; padding: 0 16px; box-sizing: border-box; }
#title {
    display: inline-flex; align-items: center; gap: 6px; height: 40px;
    font-family: var(--font); font-size: 25px; font-weight: 700; letter-spacing: .3px; line-height: 1;
    color: #FFFFFF; text-decoration: none; z-index: 1;
}
#title::before { content: ""; width: 38px; height: 40px; background: url(../img/logo.svg) no-repeat center / 38px 40px; }
#title:hover { color: #cfe7e5; }

/* Language switcher in the header bar - codes instead of flags */
.lang-switch { display: flex; gap: 2px; margin-left: auto; }
.lang-switch a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .5px;
    padding: 5px 7px;
    border-radius: 6px;
}
.lang-switch a:hover { color: #FFFFFF; background-color: rgba(255,255,255,0.08); }
.lang-switch a.active { color: #FFFFFF; background-color: rgba(255,255,255,0.14); }

/* A player's language in the multiplayer lists: code instead of flag.
   The column durak_user.lang arrives as a class, e.g. "lang ru". */
.lang {
    /* Centred with flex, not line-height: a 17px line around the 9px text
       would stick out of the box and give #mp_played a scrollbar */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    /* As high as the level box next to it */
    height: 17px;
    line-height: 1;
    padding: 0 3px;
    border-radius: 3px;
    background-color: rgba(14,61,61,0.12);
    color: #0e3d3d;
    font-size: 9px;
    font-weight: 700;
    text-align: center;
    letter-spacing: .3px;
    box-sizing: border-box;
}
.lang.de::after { content: "DE"; }
.lang.ru::after { content: "RU"; }
.lang.en::after { content: "EN"; }
.lang.pl::after { content: "PL"; }
/* Country code on purpose, "UK" would read like the United Kingdom */
.lang.uk::after { content: "UA"; }
.lang:not(.de):not(.ru):not(.en):not(.pl):not(.uk) { display: none; }

.link {
    cursor: pointer;
}
.link:hover {
    text-decoration: underline;
}
.link.join {
    color: #FF0000;
    font-weight: bold;
}

p { margin-top:10px; margin-bottom:10px; }

#container { position:relative; width: 610px; }
.container { position:relative; width: 610px; min-width: 610px; margin: 0 auto; }

#ad { position:relative; text-align:center; padding:5px; }
#ad a{ color:#FFFFFF; }
#ad a:hover { text-decoration:underline; }
/* iframes (ads, consent) without the browser's default border */
iframe { border: 0; }

#game_container { position:relative; left:-25px; width:660px; height:460px; color:#EEEEEE; z-index:5; }
/* Frame of the table, 10px inside the box like the former image bg_.png */
#game_container::before {
    content: ""; position: absolute; inset: 10px;
    border: 1px solid rgba(51,51,51,0.62); border-radius: 11px;
    background: linear-gradient(to right, rgba(255,255,255,0.26), rgba(255,255,255,0.5) 50%, rgba(255,255,255,0.26)) padding-box;
    box-shadow: 0 0 5px rgba(0,0,0,0.1), inset 0 0 0 1px rgba(251,251,251,0.8), inset 0 0 4px 2px rgba(0,0,0,0.1);
}
:where(#game_container) div { font-family: var(--font); font-size:11px; }
:where(#game_container) a { text-decoration:none; }
:where(#game_container) a:hover { text-decoration:underline; }

#durak { position:absolute; top:20px; left:10px; width:640px; height:400px; z-index:1; }
/* Playing surface, former image bg_1.png */
#durak::before {
    content: ""; position: absolute; inset: 10px; z-index: -1;
    border: 1px solid rgba(67,84,85,0.75); border-radius: 10px;
    background: linear-gradient(to right, rgba(202,249,255,0.51), rgba(236,254,255,0.75) 50%, rgba(202,249,255,0.51)) padding-box;
    box-shadow: 0 0 5px 1px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(240,250,251,0.7), inset 0 0 4px 2px rgba(0,40,45,0.1);
}
:where(#durak) div { font-family: var(--font); font-size:12px; }
#durak_m { position:absolute; left:10px; top:120px; height:160px; width:620px; }
/* Table area in the middle, former image d_m.png */
#durak_m::before {
    content: ""; position: absolute; inset: 10px;
    border: 1px solid rgba(60,60,60,0.65); border-radius: 7px;
    background-color: rgba(255,255,255,0.3); background-clip: padding-box;
    box-shadow: 0 0 5px 1px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(248,248,248,0.62), inset 0 0 4px 2px rgba(0,0,0,0.1);
}

#durak_copy { position:absolute; left:15px; bottom:15px; width:65px; height:39px; background-image:url(../img/durak_ir.png); }

#con_c_c { position:absolute; left:22px; top:22px; }
#con_c_w { position:absolute; left:28px; top:137px; height:126px; z-index:1; }
/* Above #durak_m, which comes later and reaches 2px over the hand: a raised
   card would otherwise slide under the table area and its shadow */
#con_c_h { position:absolute; left:22px; top:282px; z-index:2; }
#con_c_r { position:absolute; left:502px; top:137px; z-index:2; }

/* Views above the card table: the box itself is the playing surface (same
   look as #durak::before), so background and frame stay put while the
   content scrolls and is clipped at the rounded inner edge */
#loaded {
    position:absolute; display:none; top:30px; left:20px; width:620px; height:380px;
    box-sizing:border-box; padding:5px 9px; overflow-y:auto;
    border: 1px solid rgba(67,84,85,0.75); border-radius: 10px;
    background: linear-gradient(to right, rgba(202,249,255,0.51), rgba(236,254,255,0.75) 50%, rgba(202,249,255,0.51)) padding-box;
    box-shadow: 0 0 5px 1px rgba(0,0,0,0.35), inset 0 0 0 1px rgba(240,250,251,0.7), inset 0 0 4px 2px rgba(0,40,45,0.1);
    color:#1c2f2f; text-align:left; font-family: var(--font); font-size:12px; line-height:1.45;
}

/* Loading indicator, formerly loading.gif */
#loading {
    position:absolute; display:none; top:212px; left:316px; width:28px; height:28px; z-index:50;
    box-sizing: border-box; border: 3px solid rgba(14,61,61,0.2); border-top-color: var(--accent);
    border-radius: 50%; animation: durak-spin .8s linear infinite;
}
@keyframes durak-spin { to { transform: rotate(360deg); } }

#menu_l { position:absolute; left:30px; top:14px; z-index:5; }
:where(#menu_l) * { font-family: var(--font); font-size:11px; color:#FFFFFF; font-weight:bold; }

#menu_r { position:absolute; right:30px; top:14px; z-index:5; display:none; }
:where(#menu_r) * { font-family: var(--font); font-size:11px; color:#FFFFFF; }

/* Menu above the card table: buttons styled as links (see data-ajax in
   function.js - deliberately no href) */
#menu_l button, #menu_r button {
    background: none; border: 0; padding: 0; margin: 0;
    font: inherit; font-weight: bold; color: inherit; cursor: pointer;
}
#menu_l button:hover, #menu_r button:hover, #menu_l button.active { text-decoration: underline; }
/* Card sound on/off: round button after the menu, speaker with waves when
   on, crossed out when off (cardSound in function.js) */
/* Sound on/off: round, in the top right corner of the playing surface,
   where neither game puts cards. Inside #durak (cardSound.mount() in
   function.js), so a view that hides the table hides it as well; until
   then (lobby) it is not shown. Half transparent so it does not draw the
   eye, full on hover; above the cards and the room panel. */
.sound-toggle { display: none; }
#durak > .sound-toggle {
    position: absolute; top: 18px; right: 18px; z-index: 200;
    display: grid; place-items: center; width: 26px; height: 26px; padding: 0;
    border: 0; border-radius: 50%; background-color: var(--accent); opacity: .7;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3); cursor: pointer;
    transition: opacity .15s ease, background-color .15s ease;
}
#durak > .sound-toggle:hover, #durak > .sound-toggle:focus-visible { opacity: 1; background-color: var(--accent-hover); }
/* Its tooltip ends at the right edge of the button instead of running past
   the edge of the table */
.sound-toggle[data-tooltip]::after { left: auto; right: -4px; width: max-content; transform: translate(0, -4px); }
.sound-toggle[data-tooltip]:hover::after, .sound-toggle[data-tooltip]:focus-visible::after { transform: translate(0, 0); }
.sound-toggle svg { width: 15px; height: 15px; overflow: visible; }
.sound-toggle .sound-body { fill: #FFFFFF; }
.sound-toggle .sound-waves, .sound-toggle .sound-cross { fill: none; stroke: #FFFFFF; stroke-width: 2; stroke-linecap: round; }
.sound-toggle[aria-pressed="true"] .sound-cross, .sound-toggle[aria-pressed="false"] .sound-waves { display: none; }
/* Close link of the views: label like the menu on the left, plus a
   larger x that is not underlined */
#menu_r .view-close { display: inline-flex; align-items: center; gap: 4px; margin-top: -3px; }
/* The x is drawn with two bars so it turns around its exact centre. Whole
   pixel sizes only: with half pixels the x is rounded differently with and
   without a transform and jumps by a pixel after the spin. The page above
   can still put it on a half pixel, so it always gets its own layer: then
   it is rounded the same at rest, while spinning and afterwards. */
#menu_r .view-close .x { position: relative; width: 10px; height: 10px; will-change: transform; }
#menu_r .view-close .x::before, #menu_r .view-close .x::after {
    content: ""; position: absolute; left: 0; top: 4px; width: 10px; height: 2px;
    border-radius: 1px; background-color: #FFFFFF; transform: rotate(45deg);
}
#menu_r .view-close .x::after { transform: rotate(-45deg); }
#menu_r .view-close:hover { text-decoration: none; }
#menu_r .view-close:hover span:first-child { text-decoration: underline; }
/* On hover the x waits a moment, winds back, then spins three times while
   slowing down and springs back into place. It ends on exactly three turns
   and keeps no transform afterwards (no fill-mode forwards), so at rest it
   is drawn the same with and without hover. */
#menu_r .view-close:hover .x, #menu_r .view-close:focus-visible .x { animation: view-close-spin 2.2s .25s; }
@keyframes view-close-spin {
    0%   { transform: rotate(0deg); animation-timing-function: ease-out; }
    10%  { transform: rotate(-35deg); animation-timing-function: cubic-bezier(.15, .75, .25, 1); }
    88%  { transform: rotate(1095deg); animation-timing-function: ease-in-out; }
    100% { transform: rotate(1080deg); }
}
@media (prefers-reduced-motion: reduce) {
    #menu_r .view-close:hover .x, #menu_r .view-close:focus-visible .x { animation: none; }
}

#online { position:absolute; top:-2px; right:20px; color:#FFFFFF; }

/* Tab with the colour bar below the table, formerly c_bar_l/m/r.png:
   gradient, a light and a dark line at the bottom, shadow below */
#ch_color { position:relative; display: inline-block; margin-top:-11px; height:25px; z-index:10; background-image: linear-gradient(to bottom, rgba(245,245,245,0.58) 0.5px, rgba(132,132,132,0.45) 14.5px, rgba(150,150,150,0.49) 15px 16px, rgba(156,158,158,0.88) 16px 17px, rgba(50,64,64,0.84) 17px 18px, rgba(0,0,0,0.16) 18.5px, rgba(0,0,0,0.03) 21.5px, transparent 22px); }
/* Slanted ends: a face skewed by 45deg, so its left border runs along the
   slant and turns round into the bottom lines (rounded corner) like in the
   former images; its shadow follows the shape. It reaches under the bar
   and is clipped to the 25px end piece. The right end is the left one
   mirrored. */
#c_bar_l, #c_bar_r { position:absolute; width:25px; height:25px; top:0px; z-index:10; overflow:hidden; }
#c_bar_l  { left:-25px; }
#c_bar_r  { right:-25px; transform: scaleX(-1); }
#c_bar_l::before, #c_bar_r::before {
    content: ""; position: absolute; left: 5px; top: 0; width: 40px; height: 17px;
    transform: skewX(45deg); transform-origin: 0 0;
    border-left: 1px solid rgba(47,61,61,0.72); border-bottom: 1px solid rgba(50,64,64,0.84);
    border-bottom-left-radius: 4px;
    background: linear-gradient(to bottom, rgba(245,245,245,0.58) 0.5px, rgba(132,132,132,0.45) 14.5px, rgba(150,150,150,0.49) 15px) padding-box;
    box-shadow: inset 1px 0 0 rgba(110,120,120,0.84), inset 2px 0 0 rgba(245,245,245,0.9), inset 0 -1px 0 rgba(156,158,158,0.88),
                0 0 5px rgba(0,0,0,0.4);
}
/* Colour swatches: one element each, the shading lies over the colour and
   the white border (formerly color.png / colorh.png). Gradients cannot be
   faded, so both lights are layers: ::before lit from the top, ::after lit
   from the bottom plus a streak of light. On hover the swatch grows a
   little, the layers cross-fade and the streak runs across once. */
.ch_color {
    position:relative; width:10px; height:10px; float:left; margin:2px; border:1px solid #FFFFFF; cursor:pointer;
    transition: transform .25s cubic-bezier(.3, 1.8, .5, 1);
}
.ch_color:hover { transform: scale(1.25); z-index: 1; }
.ch_color::before, .ch_color::after {
    content: ""; position: absolute; inset: -1px; pointer-events: none;
    transition: opacity .2s ease;
}
.ch_color::before { background-image: radial-gradient(circle at 6.5px 0, transparent 3.5px, rgba(0,0,0,0.5) 12px); }
.ch_color::after {
    opacity: 0;
    background-image:
        linear-gradient(115deg, transparent 38%, rgba(255,255,255,0.8) 50%, transparent 62%),
        radial-gradient(circle at 6.5px 12px, transparent 3.5px, rgba(0,0,0,0.5) 12px);
    background-size: 300% 100%, 100% 100%; background-repeat: no-repeat; background-position: 100% 0, 0 0;
}
.ch_color:hover::before { opacity: 0; }
.ch_color:hover::after { opacity: 1; animation: swatch-shine .6s ease-out; }
@keyframes swatch-shine {
    from { background-position: 100% 0, 0 0; }
    to   { background-position: 0 0, 0 0; }
}
@media (prefers-reduced-motion: reduce) {
    .ch_color { transition: none; }
    .ch_color:hover { transform: none; }
    .ch_color:hover::after { animation: none; }
}
.clear { clear: both; }

.cardback { cursor:pointer; }
#cardback { width:71px; height:96px; display: block; }

#mp_durak { position:absolute; top:58px; left:12px; width:616px; height:322px; z-index:1; overflow:auto; }
/* The page buttons stay at the bottom, also on a last page with few rooms */
.mp-list { display:flex; flex-direction:column; min-height:100%; color:#000000; text-align:center; }
.mp-list .pager { margin-top:auto; padding-top:8px; }
/* No room open: say so, an empty list looks broken */
.mp-empty { margin: auto 0; padding: 0 40px; font-size: 14px; color: #3d5655; }

.mp_game * {
    font-size:12px;
    line-height: 25px;
}
#player_vs .mp_game {
    background-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.5);
    color: black;
}
.mp_game {
    margin:2px;
    white-space: nowrap;
    background-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.3);
}
.mp_game a { font-weight:bold; color:#FF0000; }

.mp_game .player {
    width: 40%;
    float: left;
}
.mp_game .stat {
    width: 20%;
    float: left;
    background-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.25);
}
.mp_game .player .user {
    line-height: 15px;
    padding: 0 4px;
    /* Flag and level always keep their place, a long name is shortened
       with an ellipsis instead of pushing them out (narrow screens) */
    display: flex;
    align-items: center;
}
.mp_game .player.right .user { justify-content: flex-end; }
.mp_game .player .user .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp_game .player .user .lang, .mp_game .player .user .level { flex: none; }
.mp_game .player .user .lang {
    vertical-align: middle;
}
.mp_game .player .user .name {
    font-weight: bold;
    display: inline-block;
    vertical-align: middle;
}
.mp_game .player .user .level {
    background-color: rgba(255, 255, 255, 0.50);
    background: rgba(255, 255, 255, 0.50);
    min-width: 25px;
    text-align: center;
    display: inline-block;
    vertical-align: middle;
    margin: 4px;
    padding: 0 2px;
    line-height: 17px;
}

/* Send button of the chat: same height as the chat field next to it, in
   the teal of the other buttons, with a paper plane drawn by clip-path */
#say_s {
    position:absolute; right:16px; bottom:-20px; width:34px; height:22px; padding:0;
    border:0; border-radius:6px; background-color:var(--accent); cursor:pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
#say_s:hover, #say_s:focus-visible { background-color:var(--accent-hover); }
#say_s::before {
    content: ""; position: absolute; left: 11px; top: 5px; width: 13px; height: 12px;
    background-color: #FFFFFF;
    clip-path: polygon(0 0, 100% 50%, 0 100%, 18% 50%);
}

#say_w { position:absolute; right:50px; bottom:-28px; width:516px; height:38px; }
/* Chat field, formerly say_w.png */
#say_w::before {
    content: ""; position: absolute; inset: 8px; border-radius: 9px;
    border: 1px solid rgba(255,255,255,0.87);
    background: rgba(255,255,255,0.5) padding-box;
    box-shadow: 0 2px 2px rgba(255,255,255,0.2), 0 0 3px 1px rgba(0,0,0,0.18);
}
.say_w { position:absolute; left:13px; top:10px; width:490px; background-color:transparent; border:none; font-family: var(--font); font-size:12px; color:#003333; font-weight:bold; }
/* Focus: the ring goes around the drawn field, not the bare input in it */
.say_w:focus { box-shadow: none; }
#say_w:focus-within::before { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-softer); }

#mp_time { position:absolute; top:-22px; left:15px; color:#FFFFFF; }

.durak_copy { position:fixed; left:0px; bottom:3px; width:65px; height:39px; background-image:url(../img/durak_ir.png); }
div#mp_c_left  { position:absolute; top:2px; right:3px; font-size:11px; font-weight:bold; }

/* Lobby: create a room, optionally private */
#d_mp_menu {
    position:absolute; left:12px; width:616px; top:20px; color:#000000; font-size:12px;
    display:flex; align-items:center; justify-content:center; gap:12px;
}
#d_mp_menu a{ color:#000000; font-size:12px; }


#mp_played { position:absolute; top:30px; left:12px; width:616px; height:340px; z-index:1; overflow:auto; }

.gender_0 {  }
.gender_1 { color:#0066FF; }
.gender_2 { color:#FF66FF }

#game_container a.active { text-decoration:underline; }

ul.stats {
    margin: 0;
    padding: 0;
    text-align: justify;
}
ul.stats li {
    display: inline-block;
    zoom: 1;
    *display: inline;
    width: 33%;
    text-align: center;
}

.premium {
    display: inline-block;
    zoom: 1;
    *display: inline;
    width: 13px;
    height: 13px;
    background-image:url(../img/icon/premium.png);
}

.left   { text-align: left; }
.center { text-align: center; }
.right  { text-align: right; }

/**
 * Game
 */
.ztrump {
    position: absolute;
    top: 25px;
    left: 30px;
    z-index: 53;
    height: 50px;
    width: 50px;
    display: none;
    background-image: url(../img/game/trump/ztrump.png);
}

.card {
    position: absolute;
    top: 0px;
    left: 0px;
    background-image: url(../img/game/cards/modern.png?v=1);
    display: block;
    width: 71px;
    height: 96px;
    border-radius: 5px 5px;
    -moz-border-radius: 5px 5px;
    -webkit-border-radius: 5px 5px;

    -webkit-box-shadow: -1px 0px 2px #2C2C2C;
       -moz-box-shadow: -1px 0px 2px #2C2C2C;
            box-shadow: -1px 0px 2px #2C2C2C;
    display: none;
}
/* Card set chosen in the "Cards" view, see setCardSet() in function.js */
:root[data-card-set="big"] .card { background-image: url(../img/game/cards/big.png?v=1); }
:root[data-card-set="classic"] .card { background-image: url(../img/game/cards/classic.png?v=1); }
.pointer {
    cursor: pointer;
}
/* Hand cards rise by 10px on hover (formerly a setInterval in sp.js/mp.js).
   The invisible strip below keeps the pointer on the raised card, otherwise
   it would drop again under the pointer at its lower edge and flicker. */
/* Raised card: it springs up softly past the 10px and settles (one
   overshoot, about 13px), with a deeper shadow. Going down again is calm.
   The invisible strip covers the highest point, so the pointer never
   leaves the card. */
#con_c_h .card { transition: transform .15s ease-out, box-shadow .15s ease-out; }
#con_c_h .card:hover {
    transform: translateY(-10px);
    box-shadow: -1px 8px 12px rgba(0,0,0,0.45);
    transition: transform .45s cubic-bezier(.3, 2.2, .5, 1), box-shadow .2s ease-out;
}
#con_c_h .card:hover::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 15px; }
@media (prefers-reduced-motion: reduce) {
    #con_c_h .card:hover { transition: box-shadow .2s ease-out; }
}
#con_c_h.idle .card:hover { transform: none; box-shadow: -1px 0px 2px #2C2C2C; }
.back {
    background-image: url(../img/game/deck/deck.png);
    background-position: center center;
    display: none;
}
/* Cards on the move (cardFly in function.js): stand-ins above everything
   on the table. The layer is a 100px box so the script can measure how
   much the table is zoomed on phones. */
.card-fly { position: absolute; left: 0; top: 0; width: 100px; height: 100px; pointer-events: none; z-index: 300; }
.card-fly-item { position: absolute; width: 71px; height: 96px; will-change: transform; }
.card-fly-item .card { display: block; }
/* Take / done button next to the deck, in the teal of the other buttons.
   sp.js/mp.js set width 110px and height 18px inline; with the padding
   that makes 24px. content-box because buttons default to border-box. */
.btn {
    display: none;
    box-sizing: content-box;
    width: 110px;
    height: 18px;
    padding: 3px 0;
    border: 0;
    border-radius: 6px;
    background-color: var(--accent);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    color: #FFFFFF;
    font-family: var(--font);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 18px;
    cursor: pointer;
    text-align: center;
}
.btn:hover, .btn:focus-visible { background-color: var(--accent-hover); }

input, select {
    background-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.5);
    border: 0 none;
    padding: 2px;
}
/* Focus: never the browser's black frame. Fields show a soft ring in the
   accent colour while focused (like the forms in page.css); buttons and
   links only when reached with the keyboard (:focus-visible) - a mouse
   click shows nothing. :where() keeps these at the weight of an element
   selector, so the own rules of a control (e.g. .btn, the chat field)
   still win. */
:where(button, a, input, select, textarea, [tabindex]):focus { outline: none; }
:where(input, select, textarea):focus { box-shadow: 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-softer); }
:where(button, a, [tabindex]):focus-visible { box-shadow: 0 0 0 2px rgba(255,255,255,0.9), 0 0 0 4px var(--accent); }
select {
    padding: 1px;
}
option {
    background: #FFFFFF;
}
table {
    margin-left: auto;
    margin-right: auto;
}

/**
 * MP
 */

/* Modal in place of alert() (modal() in function.js), e.g. at the end of a
   game. A <dialog> opened with showModal() sits in the top layer and makes
   the page behind it inert; the backdrop dims it. */
#modal {
    width: min(400px, calc(100vw - 32px));
    box-sizing: border-box;
    padding: 24px 20px 20px;
    background-color: rgba(255,255,255,0.94);
    border: 1px solid #FFFFFF;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    color: #111111;
    text-align: center;
}
#modal::backdrop { background-color: rgba(0,0,0,0.45); }
#modal_msg { margin: 0 0 20px; font-family: var(--font); font-size: 16px; font-weight: bold; }
/* Who wants another game: open circle, or a tick once agreed */
/* A block in the middle, its lines aligned on the left */
.modal-details { list-style: none; width: fit-content; margin: -8px auto 18px; padding: 0; font-size: 13px; color: #3d5655; text-align: left; }
.modal-details:empty { display: none; }
.modal-details li { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
.modal-details li::before {
    content: ""; width: 10px; height: 10px; flex: none; border-radius: 50%;
    border: 1.5px solid #9fb3b2; box-sizing: border-box;
}
.modal-details li.done { color: #0e3d3d; font-weight: 600; }
.modal-details li.done::before { border: 0; background-color: var(--accent); }
#modal .modal-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
/* Same button as in the game (.btn), sized by its label */
#modal .btn, .room-panel .btn, .sp-start .btn { display: inline-block; width: auto; height: auto; padding: 7px 16px; font-size: 12px; text-decoration: none; }
/* Secondary action next to a .btn: remove, leave, close */
.btn.btn-quiet { background-color: rgba(0,0,0,0.38); }
.btn.btn-quiet:hover, .btn.btn-quiet:focus-visible { background-color: rgba(0,0,0,0.55); }

/* Single player: "play now" over the stock before the first deal (sp.js) */
.sp-start { position: absolute; inset: 10px; z-index: 150; display: flex; align-items: center; justify-content: center; }
.sp-start .btn { padding: 10px 26px; font-size: 14px; }

/* Multiplayer room (src/mp/room.phtml): on the playing surface instead of
   the cards until the host starts; visitors keep seeing it during the game */
#room { display: none; }
#durak.in-room #room {
    position: absolute; inset: 10px; z-index: 150;
    display: flex; align-items: center; justify-content: center;
}
#durak.in-room #con_c_w, #durak.in-room #con_c_h, #durak.in-room #con_c_c,
#durak.in-room #con_c_r, #durak.in-room #durak_m, #durak.in-room #mp_time { visibility: hidden; }
/* Only the two seated players chat */
#durak.visitor #say_w, #durak.visitor #say_s { display: none; }
.room-panel { width: 520px; text-align: center; color: #111111; }
:where(.room-panel) div { font-size: 13px; }
.room-title { margin-bottom: 14px; font-size: 16px !important; font-weight: 700; }
.room-lock {
    display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 9px;
    background-color: rgba(0,0,0,0.12); font-size: 11px; font-weight: 700; vertical-align: 2px;
}
.room-seats { display: flex; align-items: stretch; justify-content: center; gap: 10px; }
.room-seat {
    flex: 1 1 0; min-height: 62px; padding: 8px 6px; box-sizing: border-box;
    border-radius: 8px; background-color: rgba(255,255,255,0.55);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.room-seat.free { background-color: rgba(255,255,255,0.25); border: 1px dashed rgba(0,0,0,0.25); box-shadow: none; }
.room-role { font-size: 11px !important; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(0,0,0,0.55); }
.room-seat .user { line-height: 25px; white-space: nowrap; }
.room-seat .user .name { font-weight: 700; }
.room-seat .user .lang, .room-seat .user .level { vertical-align: middle; }
.room-seat .user .level {
    display: inline-block; min-width: 25px; margin: 0 4px; padding: 0 2px;
    background-color: rgba(255,255,255,0.6); line-height: 17px;
}
.room-empty { line-height: 25px; color: rgba(0,0,0,0.5); font-style: italic; }
.room-offline { font-size: 11px !important; color: #9b1c1c; }
.room-vs { align-self: center; font-weight: 700; color: rgba(0,0,0,0.45); }
.room-msg { margin: 14px 0 10px; font-size: 13px; font-weight: 700; }
/* Seconds until a waiting room closes (MP_ROOM_WAIT) */
.room-timer { margin: 10px 0 0; font-size: 12px; color: rgba(0,0,0,0.55); }
.room-timer strong { display: inline-block; min-width: 1.4em; color: #0e3d3d; font-variant-numeric: tabular-nums; }
.room-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.room-invite { margin-top: 16px; padding-top: 12px; border-top: 1px solid rgba(0,0,0,0.12); }
.room-private { font-size: 12px; cursor: pointer; }
.room-hint { margin: 8px 0 4px; font-size: 12px; }
.room-link { display: flex; gap: 6px; justify-content: center; }
.room-link input {
    width: 340px; height: 28px; padding: 0 8px; box-sizing: border-box;
    border-radius: 6px; background: rgba(255,255,255,0.75); color: #003333; font-size: 12px;
}
.room-link .btn { padding: 5px 12px; }

/* Lobby: "new game" is a button that looks like the old link */
/* "New game" as one button in two parts: create on the left, the switch
   for a private room on the right, each with its own hover */
.create-room {
    display: inline-flex; align-items: stretch; overflow: hidden;
    border-radius: 6px; background-color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.create-room > button, .create-room > label {
    display: inline-flex; align-items: center; gap: 7px; padding: 0 14px; height: 30px;
    border: 0; background-color: transparent; color: #FFFFFF;
    font-family: var(--font); font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
    cursor: pointer; transition: background-color .15s ease;
}
.create-room > button { padding: 0 16px; }
.create-room > label { padding-left: 12px; border-left: 1px solid rgba(255,255,255,0.35); }
.create-room > button:hover, .create-room > button:focus-visible,
.create-room > label:hover, .create-room > label:has(input:focus-visible) { background-color: var(--accent-hover); }
/* White box, ticked in the accent colour, drawn in CSS so it suits any
   background. Centred in the button: as much space above as below. */
.create-room input {
    appearance: none; -webkit-appearance: none; margin: 0; width: 14px; height: 14px; flex: none;
    border: 0; border-radius: 3px; background-color: #FFFFFF; cursor: pointer;
    display: grid; place-content: center;
}
.create-room input::before {
    content: ""; width: 8px; height: 8px; transform: scale(0); transition: transform .12s ease;
    background-color: var(--accent);
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.create-room input:checked::before { transform: scale(1); }
.create-room input:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
.mp_game .stat.private { color: rgba(0,0,0,0.55); font-style: italic; }
@media (prefers-reduced-motion: no-preference) {
    #modal[open] { animation: modal-in .18s ease-out; }
    #modal[open]::backdrop { animation: modal-fade .18s ease-out; }
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes modal-fade { from { opacity: 0; } }


/* Whose turn it is, formerly arrow.png: light rim (::before) around a red
   triangle with a glossy upper part (::after) */
#p1_arrow, #p2_arrow { position:absolute; width:12px; height:30px; left:-19px; top:33px; display:none; }
#p1_arrow::before, #p2_arrow::before {
    content: ""; position: absolute; inset: 0;
    background-color: rgba(255,214,214,0.92);
    clip-path: path(evenodd, 'M0 1.3 L1 0 L3.4 0 L12.1 15 L3.4 30 L1 30 L0 28.7 Z M1 1.7 L2.5 1.7 L10.2 15 L2.5 28.3 L1 28.3 Z');
}
#p1_arrow::after, #p2_arrow::after {
    content: ""; position: absolute; inset: 0;
    /* first column lighter in the gloss and darker below it; the two
       layers do not overlap, otherwise their alpha would add up */
    background:
        linear-gradient(to bottom, rgba(255,71,71,0.72) 2.5px, rgba(255,100,100,0.76) 10.5px, rgba(255,41,41,0.69) 11.5px) 1px 0 / 1px 100% no-repeat,
        linear-gradient(to bottom, rgba(255,25,25,0.67) 2.5px, rgba(255,95,95,0.75) 10.5px, rgba(255,30,30,0.68) 11.5px, rgba(255,0,0,0.65) 12.5px) 2px 0 / 100% 100% no-repeat;
    clip-path: polygon(1px 1.7px, 2.5px 1.7px, 10.2px 15px, 2.5px 28.3px, 1px 28.3px);
}

/**
 * Page frame - navigation, notice, content box, footer.
 * Applies to game pages and subpages.
 */

.top-nav { display: flex; gap: 4px; }
.top-nav a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
}
.top-nav a:hover { color: #FFFFFF; background-color: rgba(255,255,255,0.08); }
.top-nav a.active { color: #FFFFFF; background-color: rgba(255,255,255,0.14); }

h1 { margin-top: 24px; margin-bottom: 16px; }

/* Notice at the top of the game pages (move to durak.io) */
.site-notice {
    background-color: rgba(0,0,0,0.28);
    border: 1px solid rgba(255,255,255,0.12);
    border-left: 3px solid #E0B64F;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 0 0 20px;
}

/* Content box - semi-transparent like the notice, the wallpaper shows through */
.page-card {
    background-color: rgba(0, 0, 0, 0.3);
    color: #E6F0EF;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    padding: 28px 32px;
}

.page-card h1 {
    font-size: 26px;
    line-height: 1.25;
    margin: 0 0 18px;
    text-align: left;
    color: #FFFFFF;
}
.page-card h2 {
    font-size: 19px;
    margin: 30px 0 8px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
}
.page-card h3 {
    font-size: 16px;
    margin: 20px 0 4px;
    color: #FFFFFF;
}
.page-card p, .page-card ul { margin: 0 0 14px; }
.page-card ul { padding-left: 22px; }

.page-card a { color: #9FE0D9; }
.page-card a:hover { color: #FFFFFF; }

.page-card .muted { color: rgba(255, 255, 255, 0.6); font-size: 13px; }

.page-card > h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.page-card h1 + h2 { margin-top: 0; padding-top: 0; border-top: none; }

.info-card { margin-top: 24px; font-size: 14px; line-height: 1.6; }
.info-card div { font-size: inherit; }

/* Footer */
.site-footer { text-align: center; margin: 28px 0 70px; font-size: 13px; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; }
.footer-nav a, .copyright a { color: rgba(255,255,255,0.75); text-decoration: none; }
.footer-nav a:hover, .copyright a:hover { color: #FFFFFF; text-decoration: underline; }
.copyright { margin-top: 8px; color: rgba(255,255,255,0.5); }

/**
 * Tooltip: <a data-tooltip="Text">. CSS only, no JavaScript - like in
 * Bootstrap a dark bubble with an arrow, below the element. Used instead
 * of title, which would also show the browser tooltip; for screen
 * readers the element then needs an aria-label.
 */
/* Anchor for the bubble. :where() so an element that is positioned itself
   (e.g. the sound button, absolute in the corner of the table) keeps it */
:where([data-tooltip]) { position: relative; }
[data-tooltip]::before,
[data-tooltip]::after {
    position: absolute;
    left: 50%;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -4px);
    /* Hidden it is also shrunk to nothing (scale, after the fade): an
       invisible bubble still counts as content, and below the last row of
       a list that scrolls it brought up a scrollbar */
    scale: 0;
    transform-origin: top center;
    transition: opacity .15s ease, transform .15s ease, visibility .15s, scale 0s .15s;
    z-index: 1000;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    top: calc(100% + 8px);
    padding: 5px 10px;
    border-radius: 6px;
    background-color: #111c1c;
    color: #FFFFFF;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: normal;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
[data-tooltip]::before {
    content: "";
    top: calc(100% + 2px);
    border: 6px solid transparent;
    border-top-width: 0;
    border-bottom-color: #111c1c;
}
[data-tooltip]:hover::before,
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::before,
[data-tooltip]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    scale: 1;
    transition: opacity .15s ease, transform .15s ease, visibility .15s, scale 0s;
}

/**
 * Chat of the multiplayer (src/partials/chat.php, mp.js): a window below
 * the table in the look of its playing surface. The input stays in the bar
 * under the table.
 */
.chat {
    position: relative; margin: 14px auto 20px; overflow: hidden;
    border: 1px solid rgba(67,84,85,0.75); border-radius: 10px;
    background: linear-gradient(to right, rgba(202,249,255,0.78), rgba(236,254,255,0.9) 50%, rgba(202,249,255,0.78));
    box-shadow: 0 0 5px 1px rgba(0,0,0,0.35);
    color: #0e3d3d; text-align: left;
}
.chat[hidden] { display: none; }
.chat-head {
    display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 14px;
    border-bottom: 1px solid rgba(14,61,61,0.14);
}
.chat-title { font-size: 14px; font-weight: 700; }
.chat-with { font-size: 12px; color: #4f6665; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-badge {
    min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9px;
    background-color: var(--accent); color: #FFFFFF; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.chat-badge[hidden] { display: none; }
/* Fold button: a chevron that points up while the log is open */
.chat-toggle {
    margin-left: auto; width: 28px; height: 28px; border: 0; border-radius: 6px;
    background-color: transparent; cursor: pointer; position: relative;
}
.chat-toggle:hover, .chat-toggle:focus-visible { background-color: rgba(14,61,61,0.1); }
.chat-toggle::before {
    content: ""; position: absolute; left: 10px; top: 12px; width: 7px; height: 7px;
    border-left: 2px solid #0e3d3d; border-top: 2px solid #0e3d3d; transform: rotate(45deg);
    transition: transform .15s ease, top .15s ease;
}
.chat.closed .chat-toggle::before { transform: rotate(225deg); top: 8px; }
.chat.closed .chat-body { display: none; }
.chat-body { position: relative; }
.chat-log {
    list-style: none; margin: 0; padding: 10px 12px; height: 160px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 6px; box-sizing: border-box;
}
.chat-empty { margin: auto; max-width: 360px; font-size: 12px; color: #4f6665; text-align: center; }
.chat-msg { max-width: 75%; }
.chat-msg.other { align-self: flex-start; }
.chat-msg.me { align-self: flex-end; text-align: right; }
.chat-meta { display: flex; gap: 6px; align-items: baseline; padding: 0 4px 1px; font-size: 11px; color: #4f6665; }
.chat-msg.me .chat-meta { justify-content: flex-end; }
.chat-name { font-weight: 700; color: #0e3d3d; }
.chat-text {
    display: inline-block; padding: 5px 10px; border-radius: 10px; font-size: 13px; line-height: 1.4;
    overflow-wrap: anywhere; white-space: pre-wrap; text-align: left;
}
.chat-msg.other .chat-text { background-color: rgba(255,255,255,0.85); border-bottom-left-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,0.12); }
.chat-msg.me .chat-text { background-color: var(--accent); color: #FFFFFF; border-bottom-right-radius: 3px; }
.chat-msg.system { align-self: center; max-width: 90%; }
.chat-msg.system .chat-text { padding: 2px 8px; font-size: 11px; color: #4f6665; font-style: italic; }
/* "To the new messages" while the reader has scrolled up */
.chat-new {
    position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
    padding: 4px 12px; border: 0; border-radius: 12px; cursor: pointer;
    background-color: var(--accent); color: #FFFFFF; font: inherit; font-size: 12px; font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.chat-new:hover { background-color: var(--accent-hover); }
.chat-new[hidden] { display: none; }
/* On the table: new messages while the chat window is out of view */
#chat_ping {
    position: absolute; left: 24px; bottom: 16px; z-index: 170;
    padding: 4px 12px; border: 0; border-radius: 12px; cursor: pointer;
    background-color: var(--accent); color: #FFFFFF; font-family: var(--font); font-size: 12px; font-weight: 700;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
#chat_ping:hover { background-color: var(--accent-hover); }
#chat_ping[hidden] { display: none; }

/**
 * Scrollbars
 */
/* Everything that scrolls on the light playing surface: the views, the
   lobby list, the history. Thin and dark teal, a little stronger on hover. */
.ajax-body, #loaded, #mp_durak, #mp_played, .chat-log {
    scrollbar-width: thin; scrollbar-color: rgba(14,61,61,0.3) transparent;
}
.ajax-body:hover, #loaded:hover, #mp_durak:hover, #mp_played:hover, .chat-log:hover { scrollbar-color: rgba(14,61,61,0.5) transparent; }
/* Safari ignores scrollbar-color, Chrome and Firefox use it instead */
:is(.ajax-body, #loaded, #mp_durak, #mp_played, .chat-log)::-webkit-scrollbar { width: 6px; height: 6px; }
:is(.ajax-body, #loaded, #mp_durak, #mp_played, .chat-log)::-webkit-scrollbar-track { background: transparent; }
:is(.ajax-body, #loaded, #mp_durak, #mp_played, .chat-log)::-webkit-scrollbar-thumb { background-color: rgba(14,61,61,0.3); border-radius: 3px; }
:is(.ajax-body, #loaded, #mp_durak, #mp_played, .chat-log)::-webkit-scrollbar-thumb:hover { background-color: rgba(14,61,61,0.5); }

/* The page on its dark background: light thumb on a slightly darker track */
html { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.28) rgba(0,0,0,0.25); }
html:hover { scrollbar-color: rgba(255,255,255,0.42) rgba(0,0,0,0.25); }
html::-webkit-scrollbar { width: 10px; height: 10px; }
html::-webkit-scrollbar-track { background-color: rgba(0,0,0,0.25); }
html::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.28); border-radius: 5px;
    border: 2px solid transparent; background-clip: padding-box;
}
html::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,0.42); }

/**
 * Views above the card table (public/ajax/*.php in #loaded)
 */
/* The heading stays put, only .ajax-body scrolls. The negative margin puts
   the scrollbar close to the frame instead of next to the content. */
.ajax-view { display: flex; flex-direction: column; height: 100%; }
.ajax-body {
    flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto;
    margin-right: -6px; padding-right: 6px;
}
.ajax-head {
    flex: none;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    margin: 2px 0 8px; padding: 0 2px 8px;
    border-bottom: 1px solid rgba(14,61,61,0.15);
}
.ajax-head h2 {
    margin: 0; font-size: 15px; font-weight: 700; line-height: 1.2;
    letter-spacing: .2px; color: #0e3d3d;
}
.ajax-meta {
    padding: 3px 10px; border-radius: 999px; font-size: 12px; color: #0e3d3d;
    background-color: var(--accent-soft); white-space: nowrap;
}

.data-table { width: 100%; border-collapse: collapse; margin: 0; font-size: 12px; }
.data-table th {
    padding: 5px 6px; font-size: 11px; font-weight: 600; color: #3d5655;
    border-bottom: 1px solid rgba(14,61,61,0.25); white-space: nowrap;
}
.data-table td { padding: 4px 6px; border-bottom: 1px solid rgba(14,61,61,0.08); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .text { text-align: left; }
/* Gold, silver and bronze for the first three of the statistics
   (public/ajax/top.php). The negative margin keeps the row height: the
   medal is taller than the 15px text line. */
.medal { display: inline-block; vertical-align: middle; margin: -7px 0 -7px; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25)); }
.data-table tbody tr:hover td { background-color: rgba(14,61,61,0.05); }
.data-table tr.me td { background-color: var(--accent-softer); font-weight: 600; }
.data-table th button {
    background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer;
}
.data-table th button:hover { color: #0b6b68; }

.pager { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; align-items: center; margin: 10px 0 0; font-size: 12px; color: #3d5655; }
.pager.pills { gap: 4px; margin: 0 0 6px; }
.pager.pills button { padding: 3px 6px; }
.pager button {
    background-color: rgba(14,61,61,0.08); border: 0; border-radius: 6px;
    padding: 3px 9px; font: inherit; color: #0e3d3d; cursor: pointer;
}
.pager button:hover { background-color: rgba(14,61,61,0.16); }
.pager button.active { background-color: var(--accent); color: #FFFFFF; }

.ajax-note { margin: 10px 0 0; font-size: 11px; color: #4f6665; text-align: center; }
.ajax-empty { margin: 40px 0; color: #4f6665; text-align: center; }
.ajax-date { margin: 10px 0 4px; font-size: 12px; color: #0e3d3d; }
.ajax-notice {
    margin: 0 0 10px; padding: 6px 10px; border-radius: 6px; font-size: 12px;
    background-color: var(--accent-soft); border-left: 3px solid var(--accent);
}
.ajax-notice.error { background-color: rgba(198,40,40,0.12); border-left-color: #c62828; }

/* The form is a block as wide as its content, centred above the boxes
   below; labels right-aligned next to the fields */
.ajax-form { display: grid; grid-template-columns: max-content max-content; gap: 8px 12px; align-items: center; width: max-content; max-width: 100%; margin: 6px auto 14px; }
.ajax-form > label, .ajax-label { font-weight: 600; color: #0e3d3d; text-align: right; }
/* Labels next to a field line up with the field, also when a hint below it
   makes the row taller: fields are 30px high, so is the label's line */
.ajax-form > label { align-self: start; line-height: 30px; }
.ajax-field { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ajax-field input[type="text"], .ajax-field input[type="email"], .ajax-field select {
    box-sizing: border-box; height: 30px; width: 240px; font: inherit; padding: 0 8px; color: #1c2f2f;
    background: #FFFFFF; border: 1px solid rgba(14,61,61,0.3); border-radius: 6px;
}
.ajax-field select { width: auto; }
.ajax-field button {
    box-sizing: border-box; height: 30px; font: inherit; font-weight: 600; padding: 0 12px; color: #FFFFFF;
    background-color: var(--accent); border: 0; border-radius: 6px; cursor: pointer;
}
.ajax-field button:hover { background-color: var(--accent-hover); }
.ajax-field.radios label { display: inline-flex; gap: 4px; align-items: center; margin-right: 12px; }
.ajax-field.radios input { background: none; }
.ajax-badge { font-size: 11px; font-weight: 600; color: #0b6b68; }
/* Hint on its own line below a field. contain: inline-size keeps the long
   text from widening the form - it wraps within field and button. */
.ajax-hint { flex: 1 0 100%; contain: inline-size; font-size: 11px; line-height: 1.4; color: #4f6665; }

.ajax-stats { display: flex; gap: 10px; margin: 0; }
.ajax-stats div { flex: 1; padding: 8px 10px; text-align: center; background-color: rgba(14,61,61,0.06); border-radius: 8px; }
.ajax-stats dt { font-size: 11px; color: #4f6665; }
.ajax-stats dd { margin: 2px 0 0; font-size: 18px; font-weight: 700; color: #0e3d3d; }

/* "Cards" view: card set and card back */
.cards-section h3 { margin: 4px 0 8px; font-size: 13px; color: #0e3d3d; }
.cards-section + .cards-section { margin-top: 14px; }
.cards-sets { display: flex; gap: 10px; justify-content: center; }
.cards-set {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 8px 14px 6px; border: 2px solid transparent; border-radius: 10px;
    background-color: rgba(14,61,61,0.06); color: #1c2f2f;
    font: 600 12px var(--font); cursor: pointer;
}
.cards-set:hover { background-color: rgba(14,61,61,0.12); }
.cards-set.active, .deck-grid .cardback.active { border-color: var(--accent); }
/* Two sample cards of the set, the sprite scaled to 75 % */
.cards-sample { display: flex; }
.cards-sample span {
    width: 53px; height: 72px; border-radius: 4px; box-shadow: -1px 0 2px rgba(0,0,0,0.45);
    background-image: url(../img/game/cards/modern.png?v=1); background-size: 479px 288px;
}
.cards-sample span + span { margin-left: -22px; }
.cards-sample .sample-9s { background-position: -160px 0; }       /* nine of spades */
.cards-sample .sample-kh { background-position: -373px -216px; }  /* king of hearts */
.cards-set[data-cards="big"] .cards-sample span { background-image: url(../img/game/cards/big.png?v=1); }
.cards-set[data-cards="classic"] .cards-sample span { background-image: url(../img/game/cards/classic.png?v=1); }
.deck-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.deck-grid .cardback { box-sizing: border-box; width: 52px; height: 71px; border: 2px solid transparent; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,0.25); cursor: pointer; transition: transform .12s ease; }
.deck-grid .cardback:hover { transform: translateY(-3px); }

/* History: the list now flows inside the box instead of being positioned absolutely */
/* Inside the view .ajax-body scrolls; its own overflow cut off the tooltips */
#loaded #mp_played { position: static; width: auto; height: auto; overflow: visible; }

/* Players above the multiplayer table, filled by checkTime() in mp.js -
   empty in the lobby */
#player_vs { text-align: center; }
#player_vs:empty { display: none; }

/**
 * Small screens
 */
/* Below the width of the card table: no minimum width, so the navigation
   wraps and the texts flow. The table itself is laid out in fixed pixels
   by sp.js/mp.js, so it is scaled as a whole - zoom (unlike transform) also
   shrinks the space it takes, and clicks still hit the right card. */
@media (max-width: 675px) {
    body { min-width: 0; }
    .container { width: auto; min-width: 0; padding: 0 8px; }
    #game_container { left: auto; margin: 0 auto; }
    #game_container, #ch_color { zoom: var(--game-zoom, 1); }
}
@media (max-width: 675px) { :root { --game-zoom: 0.95; } }
@media (max-width: 642px) { :root { --game-zoom: 0.90; } }
@media (max-width: 609px) { :root { --game-zoom: 0.85; } }
@media (max-width: 576px) { :root { --game-zoom: 0.80; } }
@media (max-width: 543px) { :root { --game-zoom: 0.75; } }
@media (max-width: 510px) { :root { --game-zoom: 0.70; } }
@media (max-width: 477px) { :root { --game-zoom: 0.65; } }
@media (max-width: 444px) { :root { --game-zoom: 0.60; } }
@media (max-width: 411px) { :root { --game-zoom: 0.55; } }
@media (max-width: 378px) { :root { --game-zoom: 0.50; } }
@media (max-width: 345px) { :root { --game-zoom: 0.45; } }
