:root {
    color-scheme: dark;
    --ink: #f4f8f8;
    --muted: #a9b8ba;
    --faint: #718486;
    --glass: rgba(8, 18, 21, 0.68);
    --glass-strong: rgba(7, 15, 18, 0.88);
    --glass-soft: rgba(16, 32, 36, 0.44);
    --line: rgba(194, 233, 235, 0.17);
    --line-strong: rgba(194, 233, 235, 0.34);
    --cyan: #63e1d6;
    --cyan-strong: #25c9bc;
    --amber: #f2bb5d;
    --red: #f27070;
    --green: #76d49a;
    --blue: #69aef7;
    --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
    --radius-lg: 22px;
    --radius-md: 15px;
    --radius-sm: 10px;
    --nav-height: 74px;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    background: #081014;
    font-family: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    line-height: 1.55;
}
body.is-embedded { background: #091216; }
.page-background,
.page-shade { position: fixed; inset: 0; z-index: -2; pointer-events: none; }
.page-background {
    background-position: center;
    background-size: cover;
    filter: saturate(0.82) brightness(0.62);
    transform: scale(1.025);
    animation: background-drift 20s ease-in-out infinite alternate;
}
.page-shade {
    z-index: -1;
    background:
        radial-gradient(circle at 16% 12%, rgba(55, 194, 184, 0.16), transparent 34%),
        radial-gradient(circle at 88% 28%, rgba(234, 170, 78, 0.11), transparent 33%),
        linear-gradient(180deg, rgba(4, 11, 14, 0.42), rgba(5, 12, 15, 0.9) 68%, #071014);
}
@keyframes background-drift {
    from { transform: scale(1.025) translate3d(0, 0, 0); }
    to { transform: scale(1.06) translate3d(0, -8px, 0); }
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { color: inherit; }
img, canvas { max-width: 100%; }

.site-nav {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: var(--nav-height);
    padding: 13px clamp(18px, 4vw, 58px);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    background: rgba(6, 14, 17, 0.66);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
    backdrop-filter: blur(22px) saturate(130%);
    -webkit-backdrop-filter: blur(22px) saturate(130%);
}
.brand { display: inline-flex; align-items: center; gap: 11px; width: max-content; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.brand span { display: flex; flex-direction: column; line-height: 1.12; }
.brand strong { font-size: 16px; letter-spacing: 0.01em; }
.brand small {
    margin-top: 4px;
    color: var(--faint);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.035);
}
.nav-links a {
    padding: 8px 15px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}
.nav-links a:hover,
.nav-links a.is-active { color: var(--ink); background: rgba(99, 225, 214, 0.13); }
.nav-links a:active { transform: scale(0.97); }
.account { display: flex; justify-content: flex-end; }
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 13px;
    color: #dce7e7;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(8, 18, 21, 0.58);
    font-size: 13px;
}
.user-chip i,
.status-dot,
.online-pulse {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--green);
    box-shadow: 0 0 0 5px rgba(118, 212, 154, 0.1);
}

main { width: min(1220px, calc(100% - 40px)); margin: 0 auto; padding: clamp(38px, 7vw, 80px) 0 88px; }
.site-footer {
    width: min(1220px, calc(100% - 40px));
    margin: 0 auto;
    padding: 22px 0 34px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--faint);
    border-top: 1px solid var(--line);
    font-size: 12px;
}
body.is-embedded .site-nav,
body.is-embedded .site-footer { display: none; }
body.is-embedded main { width: min(1220px, calc(100% - 24px)); padding-top: 24px; }

.glass-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, rgba(18, 35, 39, 0.72), var(--glass));
    box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, 0.045);
    backdrop-filter: blur(24px) saturate(125%);
    -webkit-backdrop-filter: blur(24px) saturate(125%);
}
.page-head { margin-bottom: 32px; }
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--cyan);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.page-head h1,
.hero-copy h1 {
    max-width: 900px;
    margin: 0;
    font-size: clamp(36px, 6vw, 72px);
    line-height: 1.03;
    letter-spacing: -0.045em;
    text-wrap: balance;
}
.page-head h1 { font-size: clamp(32px, 5vw, 58px); }
.page-head p,
.hero-copy p { max-width: 720px; margin: 16px 0 0; color: var(--muted); font-size: clamp(14px, 1.8vw, 17px); }

.lobby-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
    gap: 36px;
    overflow: hidden;
    padding: clamp(30px, 5vw, 58px);
}
.lobby-hero::after {
    content: "";
    position: absolute;
    width: 320px;
    height: 320px;
    right: -110px;
    bottom: -150px;
    border: 1px solid rgba(99, 225, 214, 0.16);
    border-radius: 50%;
    box-shadow: 0 0 0 30px rgba(99, 225, 214, 0.025), 0 0 0 68px rgba(99, 225, 214, 0.018);
    pointer-events: none;
}
.hero-copy { position: relative; z-index: 1; }
.hero-actions,
.button-row,
.room-actions,
.solo-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hero-actions { margin-top: 28px; }
.hero-side { position: relative; z-index: 1; align-self: center; display: grid; gap: 12px; }
.metric-card {
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.035);
}
.metric-card strong { display: block; font-size: 28px; line-height: 1; }
.metric-card span { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }

.button {
    min-height: 42px;
    padding: 10px 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.045);
    cursor: pointer;
    color: var(--ink);
    font-weight: 700;
    font-size: 13px;
    transition: transform 170ms ease, border-color 170ms ease, background 170ms ease, box-shadow 170ms ease;
}
.button:hover { transform: translateY(-2px); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.075); }
.button:active { transform: translateY(0) scale(0.98); }
.button:disabled { opacity: 0.45; transform: none; cursor: not-allowed; }
.button-primary {
    border-color: rgba(99, 225, 214, 0.58);
    background: linear-gradient(135deg, rgba(48, 198, 184, 0.95), rgba(30, 151, 143, 0.96));
    color: #041311;
    box-shadow: 0 10px 28px rgba(26, 175, 162, 0.2);
}
.button-primary:hover { background: linear-gradient(135deg, #76eee3, #37c4b6); box-shadow: 0 13px 34px rgba(26, 175, 162, 0.3); }
.button-amber { border-color: rgba(242, 187, 93, 0.54); background: rgba(242, 187, 93, 0.13); color: #ffd48b; }
.button-danger { border-color: rgba(242, 112, 112, 0.42); background: rgba(242, 112, 112, 0.1); color: #ffaaaa; }
.button-small { min-height: 34px; padding: 7px 12px; font-size: 12px; border-radius: 9px; }

.section-head { margin: 54px 0 20px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.section-head h2 { margin: 0; font-size: clamp(24px, 3.3vw, 34px); letter-spacing: -0.025em; }
.section-head p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.game-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.game-card {
    position: relative;
    min-height: 250px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: linear-gradient(155deg, rgba(24, 44, 48, 0.72), rgba(7, 16, 19, 0.68));
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}
.game-card:hover {
    transform: translateY(-5px);
    border-color: rgba(99, 225, 214, 0.38);
    box-shadow: 0 24px 55px rgba(0, 0, 0, 0.3), inset 0 1px rgba(255, 255, 255, 0.06);
}
.game-card[hidden] { display: none; }
.game-card-art {
    min-height: 104px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 58px;
    filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.25));
}
.game-card h3 { margin: 12px 0 7px; font-size: 19px; }
.game-card p { margin: 0; color: var(--muted); font-size: 13px; }
.game-card-footer { margin-top: auto; padding-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border: 1px solid rgba(99, 225, 214, 0.24);
    border-radius: 999px;
    background: rgba(99, 225, 214, 0.07);
    color: #b9f5ef;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
}
.badge.solo { border-color: rgba(242, 187, 93, 0.25); background: rgba(242, 187, 93, 0.07); color: #f4d59b; }
.play-link { color: var(--cyan); font-size: 12px; font-weight: 800; }

.lobby-tools { margin-bottom: 18px; padding: 14px; display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 10px; }
.field {
    min-height: 44px;
    width: 100%;
    padding: 10px 13px;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    outline: none;
    background: rgba(4, 11, 13, 0.52);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.field::placeholder { color: #718487; }
.field:focus { border-color: rgba(99, 225, 214, 0.58); box-shadow: 0 0 0 3px rgba(99, 225, 214, 0.08); }
.room-list { display: grid; gap: 10px; }
.room-item {
    padding: 17px 18px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(13, 26, 30, 0.58);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.room-item h3 { margin: 0; font-size: 15px; }
.room-item p { margin: 4px 0 0; color: var(--faint); font-size: 12px; }
.room-meta { display: flex; align-items: center; gap: 13px; }
.empty-state,
.login-gate,
.loading-panel { padding: clamp(28px, 5vw, 52px); text-align: center; }
.empty-state strong,
.login-gate h2 { display: block; margin: 0 0 8px; font-size: 19px; }
.empty-state p,
.login-gate p,
.loading-panel { margin: 0; color: var(--muted); font-size: 13px; }
.login-gate .button { margin-top: 20px; }

/* Room and card-game surfaces */
.room-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.room-main,
.room-side { padding: clamp(18px, 3vw, 30px); }
.room-side { position: sticky; top: calc(var(--nav-height) + 18px); }
.room-side h2,
.room-main h2 { margin: 0 0 14px; font-size: 18px; }
.room-code {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px;
    border: 1px dashed var(--line-strong);
    border-radius: 11px;
    background: rgba(3, 9, 11, 0.36);
}
.room-code code { color: var(--cyan); font-family: "Cascadia Code", Consolas, monospace; font-size: 13px; }
.player-list { display: grid; gap: 8px; margin: 16px 0; }
.player-item {
    padding: 10px 11px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 12px;
}
.player-item .player-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-item .host-tag,
.player-item .me-tag { margin-left: auto; color: var(--amber); font-size: 9px; font-weight: 800; }
.player-item .me-tag { color: var(--cyan); }
.room-actions { margin-top: 16px; }
.game-status {
    margin: 14px 0;
    padding: 12px 14px;
    border-left: 2px solid var(--cyan);
    border-radius: 0 9px 9px 0;
    background: rgba(99, 225, 214, 0.055);
    color: #c2d0d1;
    font-size: 12px;
}
.turn-banner {
    margin: 0 0 18px;
    padding: 13px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 13px;
}
.turn-banner strong { color: var(--cyan); }
.waiting-orbit { width: 76px; height: 76px; margin: 0 auto 22px; border: 1px solid rgba(99, 225, 214, 0.16); border-radius: 50%; position: relative; }
.waiting-orbit::before,
.waiting-orbit::after { content: ""; position: absolute; inset: 12px; border: 1px solid rgba(99, 225, 214, 0.32); border-radius: 50%; animation: orbit-pulse 1.8s ease-in-out infinite; }
.waiting-orbit::after { inset: 27px; background: var(--cyan); border: 0; box-shadow: 0 0 24px rgba(99, 225, 214, 0.5); animation: core-pulse 1.8s ease-in-out infinite; }
@keyframes orbit-pulse { 50% { transform: scale(1.2); opacity: 0.35; } }
@keyframes core-pulse { 50% { opacity: 0.55; transform: scale(0.78); } }

/* Interaction foundation and lobby surfaces */
[hidden] { display: none !important; }
button:focus-visible,
a:focus-visible,
input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
main > section + section { margin-top: 22px; }
[data-reveal] {
    opacity: 0;
    transform: translate3d(0, 24px, 0);
    transition: opacity 650ms cubic-bezier(0.2, 0.75, 0.25, 1), transform 650ms cubic-bezier(0.2, 0.75, 0.25, 1);
}
[data-reveal].is-revealed { opacity: 1; transform: translate3d(0, 0, 0); }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
    [data-reveal] { opacity: 1; transform: none; }
}

.section-head .field { width: min(340px, 100%); }
.live-label { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.online-pulse { background: var(--cyan); box-shadow: 0 0 0 5px rgba(99, 225, 214, 0.09); animation: live-pulse 1.9s ease-in-out infinite; }
@keyframes live-pulse { 50% { box-shadow: 0 0 0 8px rgba(99, 225, 214, 0), 0 0 18px rgba(99, 225, 214, 0.42); } }

.room-entry {
    padding: clamp(22px, 4vw, 38px);
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(250px, 0.8fr);
    align-items: center;
    gap: 24px 32px;
}
.entry-copy h2 { margin: 6px 0 0; font-size: clamp(22px, 3vw, 32px); }
.entry-copy p { max-width: 650px; margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.entry-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.room-code-entry {
    grid-column: 1 / -1;
    padding-top: 22px;
    display: grid;
    grid-template-columns: auto minmax(240px, 440px) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--line);
}
.room-code-entry label { color: var(--muted); font-size: 12px; font-weight: 700; }
.room-code-entry p { margin: 0; color: var(--faint); font-size: 11px; }
.room-code-control { display: flex; gap: 8px; }
.room-code-control .field { min-width: 0; }
.room-code-control .button { flex: 0 0 auto; }
.room-source { margin: 10px 0 0; color: var(--faint); font-size: 11px; }
.icon-button {
    min-height: 36px;
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.icon-button:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.09); }
.icon-button:active { transform: scale(0.96); }
.button-wide { width: 100%; margin-top: 10px; }

.lobby-columns { display: grid; grid-template-columns: minmax(0, 1fr) 286px; align-items: start; gap: 16px; }
.online-panel { padding: 20px; }
.online-panel h2 { margin: 0 0 14px; font-size: 18px; }
.online-list { display: flex; flex-wrap: wrap; gap: 8px; }
.online-person {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: #dce8e8;
    font-size: 11px;
}
.online-person span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-person i { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--green); }
.online-note { margin: 16px 0 0; color: var(--faint); font-size: 11px; }
.empty-inline { display: block; padding: 14px; color: var(--faint); font-size: 12px; text-align: center; }
.room-item { transition: transform 180ms ease, border-color 180ms ease, background 180ms ease; }
.room-item:hover { transform: translateY(-2px); border-color: var(--line-strong); background: rgba(18, 34, 38, 0.72); }
.room-item .button { white-space: nowrap; }

.rule-strip { margin-top: 22px; padding: 18px 22px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.rule-strip > div { min-width: 0; padding-left: 13px; border-left: 2px solid rgba(99, 225, 214, 0.35); }
.rule-strip strong { display: block; margin-bottom: 3px; color: #dff9f6; font-size: 13px; }
.rule-strip span { color: var(--faint); font-size: 11px; }

.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 80; width: min(360px, calc(100vw - 36px)); display: grid; gap: 9px; pointer-events: none; }
.toast {
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #eaf4f4;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: rgba(8, 20, 23, 0.94);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    font-size: 12px;
    line-height: 1.55;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 200ms ease, transform 200ms ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { border-color: rgba(242, 112, 112, 0.48); }
.toast.is-success { border-color: rgba(118, 212, 154, 0.48); }
.toast-mark { width: 7px; height: 7px; margin-top: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px rgba(99, 225, 214, 0.6); }
.toast.is-error .toast-mark { background: var(--red); box-shadow: 0 0 12px rgba(242, 112, 112, 0.55); }
.toast.is-success .toast-mark { background: var(--green); box-shadow: 0 0 12px rgba(118, 212, 154, 0.55); }

.table-waiting { min-height: 340px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.table-waiting h2 { margin: 0 0 8px; font-size: 21px; }
.table-waiting p { max-width: 460px; margin: 0; color: var(--muted); font-size: 12px; }
.game-message { min-height: 34px; margin: 14px 0; padding: 9px 12px; border-radius: 9px; background: rgba(255, 255, 255, 0.035); color: var(--muted); font-size: 11px; text-align: center; }
.result-banner { margin: 16px auto 0; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid rgba(242, 187, 93, 0.36); border-radius: 12px; background: rgba(242, 187, 93, 0.09); }
.result-banner span { color: var(--amber); font-size: 11px; }
.result-banner strong { font-size: 16px; }
.count-pill { display: inline-flex; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, 0.04); color: var(--muted); font-size: 10px; }
.count-pill.is-current { border-color: rgba(99, 225, 214, 0.42); background: rgba(99, 225, 214, 0.1); color: #dffcf8; }

/* UNO table */
.uno-table {
    position: relative;
    min-height: 560px;
    padding: 22px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background:
        radial-gradient(circle at 50% 41%, rgba(255, 255, 255, 0.1), transparent 34%),
        radial-gradient(circle at 50% 45%, rgba(11, 105, 92, 0.46), rgba(5, 31, 29, 0.92) 72%);
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.38);
}
.uno-table::before { content: ""; position: absolute; inset: 18px; pointer-events: none; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 50%; }
.uno-opponents,
.dz-opponents { position: relative; z-index: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.uno-center { position: relative; z-index: 1; min-height: 220px; margin: 18px 0 8px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; justify-items: center; gap: 26px; }
.uno-pile { display: grid; justify-items: center; gap: 9px; color: var(--muted); font-size: 10px; }
.uno-card {
    position: relative;
    width: 84px;
    height: 124px;
    flex: 0 0 auto;
    padding: 8px;
    border: 3px solid rgba(255, 255, 255, 0.92);
    border-radius: 12px;
    color: white;
    background: #273238;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
    cursor: default;
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}
.uno-card strong { position: absolute; inset: 0; display: grid; place-items: center; font-size: 38px; line-height: 1; text-shadow: 0 2px 5px rgba(0, 0, 0, 0.22); }
.uno-corner { position: absolute; top: 7px; left: 8px; z-index: 1; font-size: 12px; font-weight: 900; line-height: 1; }
.uno-corner.is-bottom { top: auto; right: 8px; bottom: 7px; left: auto; transform: rotate(180deg); }
.uno-red { background: linear-gradient(145deg, #ef5b5b, #c53232); }
.uno-yellow { color: #2d2615; background: linear-gradient(145deg, #f6ce62, #d7a52e); }
.uno-green { background: linear-gradient(145deg, #56be7b, #258a4b); }
.uno-blue { background: linear-gradient(145deg, #5ea7ef, #236db4); }
.uno-wild { background: conic-gradient(from 20deg, #e95353, #e4be43, #4dad73, #488bd2, #e95353); }
.uno-card.is-playable { cursor: pointer; }
.uno-card.is-playable:hover { transform: translateY(-10px) rotate(-1deg); filter: brightness(1.08); box-shadow: 0 18px 32px rgba(0, 0, 0, 0.4); }
.uno-card.is-playable:active { transform: translateY(-4px) scale(0.98); }
.uno-card.is-locked { filter: saturate(0.62) brightness(0.72); }
.uno-card-back {
    width: 84px;
    height: 124px;
    border: 3px solid rgba(255, 255, 255, 0.88);
    border-radius: 12px;
    color: #fff;
    background: repeating-linear-gradient(135deg, #1e3e44 0 8px, #2b5960 8px 16px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
    font-size: 16px;
    font-weight: 900;
    transform: rotate(5deg);
    cursor: pointer;
}
.uno-card-back:disabled { opacity: 0.45; cursor: not-allowed; }
.uno-current-color { display: grid; justify-items: center; gap: 8px; color: var(--faint); font-size: 10px; text-align: center; }
.uno-current-color strong { width: 70px; height: 70px; display: grid; place-items: center; border: 2px solid rgba(255, 255, 255, 0.42); border-radius: 50%; color: white; font-size: 11px; text-transform: uppercase; box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.25); }
.uno-current-color .color-red,
.wild-color.color-red { background: #d84747; }
.uno-current-color .color-yellow,
.wild-color.color-yellow { background: #d7aa34; }
.uno-current-color .color-green,
.wild-color.color-green { background: #2e9b59; }
.uno-current-color .color-blue,
.wild-color.color-blue { background: #397fc2; }
.uno-current-color .color-wild { background: conic-gradient(#d84747, #d7aa34, #2e9b59, #397fc2, #d84747); }
.uno-hand {
    position: relative;
    z-index: 2;
    min-height: 154px;
    padding: 28px 12px 6px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}
.uno-hand .uno-card { margin-left: -18px; }
.uno-hand .uno-card:first-child { margin-left: 0; }
.uno-hand p { align-self: center; color: var(--muted); }
.wild-picker {
    position: absolute;
    right: 50%;
    bottom: 18px;
    z-index: 8;
    padding: 13px 15px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: rgba(6, 16, 19, 0.95);
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.42);
    transform: translateX(50%);
}
.wild-picker > span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.wild-color { width: 28px; height: 28px; border: 2px solid rgba(255, 255, 255, 0.75); border-radius: 50%; cursor: pointer; transition: transform 150ms ease; }
.wild-color:hover { transform: scale(1.12); }

/* Doudizhu table */
.dz-table {
    min-height: 610px;
    padding: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background:
        radial-gradient(circle at 50% 38%, rgba(46, 123, 108, 0.42), transparent 38%),
        linear-gradient(145deg, rgba(6, 38, 34, 0.9), rgba(4, 24, 24, 0.94));
    box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.4);
}
.dz-center { min-height: 175px; margin: 14px 0; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(160px, 0.7fr); align-items: center; gap: 18px; }
.last-play,
.landlord-state { padding: 16px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 13px; background: rgba(255, 255, 255, 0.035); }
.last-play > span,
.landlord-state > span { display: block; margin-bottom: 8px; color: var(--faint); font-size: 10px; }
.last-play div { min-height: 42px; display: flex; align-items: center; gap: 5px; overflow-x: auto; }
.last-play small { margin-right: 6px; color: var(--cyan); font-size: 10px; white-space: nowrap; }
.last-play em { color: var(--muted); font-size: 11px; font-style: normal; }
.landlord-state strong { display: block; color: var(--amber); font-size: 15px; }
.landlord-state small { display: block; margin-top: 5px; color: var(--faint); font-size: 10px; }
.playing-card {
    position: relative;
    width: 58px;
    height: 82px;
    flex: 0 0 auto;
    padding: 6px;
    overflow: hidden;
    color: #1d272a;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    background: linear-gradient(145deg, #f7f4ea, #dad6c9);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.playing-card span { position: absolute; top: 5px; left: 6px; font-size: 14px; font-weight: 900; line-height: 1; }
.playing-card strong { position: absolute; right: 7px; bottom: 6px; font-size: 22px; line-height: 1; }
.playing-card.is-red { color: #b72d2d; }
.playing-card.is-selected { transform: translateY(-15px); border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(99, 225, 214, 0.35), 0 12px 22px rgba(0, 0, 0, 0.3); }
.playing-card:disabled { cursor: default; }
.playing-card:not(:disabled):hover { transform: translateY(-7px); }
.playing-card.is-selected:not(:disabled):hover { transform: translateY(-18px); }
.dz-hand { min-height: 105px; padding: 20px 5px 8px; display: flex; align-items: flex-end; justify-content: center; overflow-x: auto; scrollbar-width: thin; }
.dz-hand .playing-card { margin-left: -20px; }
.dz-hand .playing-card:first-child { margin-left: 0; }
.dz-controls { padding: 10px 12px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; background: rgba(0, 0, 0, 0.16); }
.dz-controls > span { margin-right: 4px; color: var(--muted); font-size: 11px; }
.mini-card { min-width: 32px; height: 44px; padding: 4px; display: inline-grid; place-items: center; color: #1f292c; border-radius: 5px; background: #ece9df; font-size: 11px; font-weight: 800; }
.mini-card.is-red { color: #b72d2d; }

/* Chinese chess */
.chess-shell { width: min(100%, 620px); margin: 0 auto; }
.chess-meta { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chess-side { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, 0.04); font-size: 11px; }
.chess-side.is-red { color: #ffb2a7; }
.chess-side.is-black { color: #d4dfe1; }
.chess-board {
    width: 100%;
    aspect-ratio: 9 / 10;
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    grid-template-rows: repeat(10, minmax(0, 1fr));
    overflow: hidden;
    border: 2px solid rgba(223, 194, 143, 0.52);
    border-radius: 12px;
    background: #c9a96f;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35), inset 0 0 40px rgba(85, 50, 17, 0.2);
}
.chess-cell {
    position: relative;
    min-width: 0;
    min-height: 0;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-right: 1px solid rgba(74, 48, 24, 0.46);
    border-bottom: 1px solid rgba(74, 48, 24, 0.46);
    border-radius: 0;
    background: rgba(255, 242, 205, 0.17);
    cursor: pointer;
}
.chess-cell.is-light { background: rgba(255, 247, 219, 0.28); }
.chess-cell:hover { background-color: rgba(255, 255, 255, 0.16); }
.chess-cell.is-selected { box-shadow: inset 0 0 0 3px rgba(53, 164, 151, 0.85); }
.chess-cell.is-last-from { box-shadow: inset 0 0 0 2px rgba(56, 111, 184, 0.75); }
.chess-cell.is-last-to { box-shadow: inset 0 0 0 3px rgba(242, 187, 93, 0.92); }
.chess-piece {
    width: 76%;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border: 2px solid currentColor;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 28%, #fff9e8, #dcc594);
    box-shadow: 0 4px 8px rgba(76, 48, 20, 0.32);
    font-family: "KaiTi", "STKaiti", serif;
    font-size: clamp(14px, 2.5vw, 25px);
    font-weight: 900;
}
.chess-piece.is-r { color: #b83131; }
.chess-piece.is-b { color: #232a2b; }

/* Solo arcade */
.solo-head { max-width: 880px; }
.solo-shell {
    position: relative;
    padding: clamp(18px, 3.6vw, 34px);
    overflow: hidden;
}
.solo-toolbar {
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}
.segmented {
    padding: 4px;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(3, 10, 12, 0.38);
}
.segmented button {
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
    transition: color 170ms ease, background 170ms ease, border-color 170ms ease, transform 170ms ease;
}
.segmented button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.055); }
.segmented button:active { transform: scale(0.97); }
.segmented button.is-active {
    color: #dffcf8;
    border-color: rgba(99, 225, 214, 0.3);
    background: rgba(99, 225, 214, 0.13);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
}
.solo-stats,
.score-cluster {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 9px;
}
.solo-stats { margin-bottom: 14px; }
.solo-stats > div,
.score-cluster > div {
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.032);
}
.solo-stats span,
.score-cluster span {
    display: block;
    margin-bottom: 3px;
    color: var(--faint);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.solo-stats strong,
.score-cluster strong {
    display: block;
    color: var(--ink);
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: clamp(17px, 2.3vw, 23px);
    line-height: 1.25;
}
.score-cluster { flex: 1 1 360px; }
.game-status[data-state="win"] { border-left-color: var(--green); background: rgba(118, 212, 154, 0.08); color: #c6f1d5; }
.game-status[data-state="lose"] { border-left-color: var(--red); background: rgba(242, 112, 112, 0.075); color: #ffd0d0; }

/* Minesweeper */
.mine-scroll {
    max-width: 100%;
    padding: 8px 2px 14px;
    overflow: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
}
.mine-board {
    --mine-cols: 9;
    --mine-size: 36px;
    width: max-content;
    margin: 0 auto;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(var(--mine-cols), var(--mine-size));
    gap: 3px;
    border: 1px solid rgba(194, 233, 235, 0.14);
    border-radius: 14px;
    background: rgba(3, 10, 12, 0.52);
    box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.32), 0 16px 38px rgba(0, 0, 0, 0.16);
}
.mine-cell {
    width: var(--mine-size);
    height: var(--mine-size);
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(194, 233, 235, 0.18);
    border-radius: 6px;
    background:
        linear-gradient(145deg, rgba(42, 69, 74, 0.92), rgba(16, 35, 39, 0.96));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.075), 0 2px 5px rgba(0, 0, 0, 0.16);
    color: var(--ink);
    cursor: pointer;
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
    user-select: none;
    transition: transform 110ms ease, background 140ms ease, border-color 140ms ease;
}
.mine-cell:not(:disabled):hover { border-color: rgba(99, 225, 214, 0.52); background: linear-gradient(145deg, rgba(54, 88, 93, 0.95), rgba(20, 44, 48, 0.98)); }
.mine-cell:not(:disabled):active { transform: scale(0.94); }
.mine-cell:disabled { cursor: default; }
.mine-cell.is-open {
    border-color: rgba(194, 233, 235, 0.09);
    background: rgba(8, 21, 24, 0.78);
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.28);
}
.mine-cell.is-flag { color: var(--amber); background: linear-gradient(145deg, rgba(84, 62, 28, 0.92), rgba(43, 32, 16, 0.96)); }
.mine-cell.is-mine { color: #fff1f1; background: rgba(160, 48, 48, 0.72); animation: mine-hit 240ms ease-out; }
.mine-cell.near-1 { color: #81b8ff; }
.mine-cell.near-2 { color: #79dda2; }
.mine-cell.near-3 { color: #ff8d8d; }
.mine-cell.near-4 { color: #b09cff; }
.mine-cell.near-5 { color: #f0b56d; }
.mine-cell.near-6 { color: #68d8d0; }
.mine-cell.near-7 { color: #e9e5d0; }
.mine-cell.near-8 { color: #aab7ba; }
@keyframes mine-hit { from { transform: scale(0.82); filter: brightness(1.7); } }

/* 2048 */
.number-shell { width: min(100%, 720px); margin-inline: auto; }
.number-stage {
    width: min(100%, 520px);
    aspect-ratio: 1;
    margin: 18px auto 0;
    padding: clamp(7px, 1.6vw, 12px);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: clamp(6px, 1.3vw, 10px);
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: rgba(4, 12, 15, 0.58);
    box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.28), 0 20px 48px rgba(0, 0, 0, 0.2);
    touch-action: none;
}
.number-cell {
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
}
.number-tile {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    border-radius: inherit;
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: clamp(22px, 6.2vw, 48px);
    font-weight: 900;
    line-height: 1;
}
.number-tile.is-three { font-size: clamp(19px, 5.2vw, 40px); }
.number-tile.is-four { font-size: clamp(15px, 4.2vw, 32px); }
.number-cell.has-tile { animation: tile-pop 170ms cubic-bezier(0.2, 0.8, 0.3, 1); box-shadow: 0 7px 18px rgba(0, 0, 0, 0.15); }
.tile-2 { background: rgba(224, 235, 233, 0.93); color: #213135; }
.tile-4 { background: rgba(201, 222, 216, 0.93); color: #213135; }
.tile-8 { background: rgba(242, 187, 93, 0.92); color: #32220d; }
.tile-16 { background: rgba(239, 155, 81, 0.95); color: #2d1908; }
.tile-32 { background: rgba(233, 112, 91, 0.96); color: #fff7f3; }
.tile-64 { background: rgba(210, 68, 68, 0.96); color: #fff; }
.tile-128 { background: rgba(94, 206, 170, 0.95); color: #08231c; }
.tile-256 { background: rgba(61, 185, 162, 0.96); color: #041b18; }
.tile-512 { background: rgba(48, 160, 181, 0.96); color: #f0fdff; }
.tile-1024 { background: rgba(68, 121, 211, 0.96); color: #f5f9ff; }
.tile-2048 { background: linear-gradient(145deg, #6eebdf, #27bbae); color: #03211e; box-shadow: 0 0 28px rgba(99, 225, 214, 0.36); }
.tile-4096 { background: linear-gradient(145deg, #ffd47d, #e7a63e); color: #2b1a02; box-shadow: 0 0 28px rgba(242, 187, 93, 0.32); }
@keyframes tile-pop { from { transform: scale(0.82); } }

.pad-controls {
    width: 148px;
    margin: 18px auto 0;
    display: grid;
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(2, 44px);
    gap: 5px;
    justify-content: center;
}
.pad-controls .icon-button { width: 44px; height: 44px; padding: 0; border-radius: 10px; font-size: 18px; }
.pad-up { grid-column: 2; grid-row: 1; }
.pad-left { grid-column: 1; grid-row: 2; }
.pad-down { grid-column: 2; grid-row: 2; }
.pad-right { grid-column: 3; grid-row: 2; }

/* Snake */
.snake-shell { width: min(100%, 760px); margin-inline: auto; }
.snake-stage {
    position: relative;
    width: min(100%, 580px);
    aspect-ratio: 1;
    margin: 18px auto 0;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: #0b1a1f;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.34), 0 20px 48px rgba(0, 0, 0, 0.24);
    touch-action: none;
}
#snakeCanvas { width: 100%; height: 100%; display: block; }
.snake-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 8px;
    padding: 24px;
    background: rgba(3, 12, 15, 0.58);
    text-align: center;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.snake-overlay strong { color: var(--cyan); font-size: clamp(28px, 6vw, 48px); letter-spacing: 0.08em; }
.snake-overlay span { color: var(--muted); font-size: 12px; }

/* Memory */
.memory-shell { width: min(100%, 820px); margin-inline: auto; }
.memory-toolbar { align-items: flex-start; }
.memory-board {
    width: min(100%, 680px);
    margin: 18px auto 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(7px, 1.5vw, 12px);
}
.memory-board[data-size="20"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.memory-card {
    position: relative;
    aspect-ratio: 0.8;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    perspective: 800px;
}
.memory-card-inner {
    position: absolute;
    inset: 0;
    display: block;
    transform-style: preserve-3d;
    transition: transform 360ms cubic-bezier(0.2, 0.75, 0.25, 1);
}
.memory-card-back,
.memory-card-face {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: inherit;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.memory-card-back {
    color: var(--cyan);
    background:
        radial-gradient(circle at 50% 45%, rgba(99, 225, 214, 0.16), transparent 44%),
        linear-gradient(145deg, rgba(25, 52, 57, 0.95), rgba(7, 20, 23, 0.98));
    box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.26), 0 8px 18px rgba(0, 0, 0, 0.2);
}
.memory-card-back i { font-family: "Cascadia Code", Consolas, monospace; font-size: clamp(20px, 4vw, 34px); font-style: normal; font-weight: 900; }
.memory-card-face {
    color: #15282b;
    background: linear-gradient(145deg, #f3f1e7, #d8d8cd);
    box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.35), 0 8px 18px rgba(0, 0, 0, 0.2);
    font-size: clamp(24px, 6vw, 48px);
    transform: rotateY(180deg);
}
.memory-card.is-revealed .memory-card-inner,
.memory-card.is-matched .memory-card-inner { transform: rotateY(180deg); }
.memory-card.is-matched { opacity: 0.7; }
.memory-card.is-matched .memory-card-face { border-color: rgba(118, 212, 154, 0.7); box-shadow: 0 0 0 2px rgba(118, 212, 154, 0.16), 0 8px 18px rgba(0, 0, 0, 0.16); }
.memory-card:focus-visible { outline-offset: 4px; }

/* Responsive layouts */
@media (max-width: 1060px) {
    .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lobby-hero { grid-template-columns: minmax(0, 1fr) minmax(220px, 0.55fr); gap: 22px; }
    .lobby-columns,
    .room-layout { grid-template-columns: minmax(0, 1fr); }
    .room-side { position: static; }
    .room-entry { grid-template-columns: minmax(0, 1fr); }
    .entry-actions { justify-content: flex-start; }
    .room-code-entry { grid-template-columns: auto minmax(0, 1fr); }
    .room-code-entry p { grid-column: 1 / -1; }
    .dz-center { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 780px) {
    :root { --nav-height: 112px; }
    .site-nav {
        padding: 10px 16px;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px 14px;
    }
    .nav-links {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        border-radius: 12px;
        scrollbar-width: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .nav-links a { flex: 0 0 auto; }
    .account { min-width: 0; }
    .user-chip { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    main { width: min(100% - 24px, 1220px); padding-top: 32px; padding-bottom: 56px; }
    .site-footer { width: min(100% - 24px, 1220px); }
    .lobby-hero { grid-template-columns: minmax(0, 1fr); padding: 26px 22px; }
    .hero-side { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .metric-card { padding: 14px; }
    .metric-card strong { font-size: 22px; }
    .section-head { margin-top: 42px; align-items: flex-start; flex-direction: column; gap: 12px; }
    .section-head .field { width: 100%; }
    .lobby-tools { grid-template-columns: minmax(0, 1fr); }
    .solo-toolbar { align-items: stretch; }
    .segmented { width: 100%; }
    .segmented button { flex: 1 1 auto; }
    .solo-toolbar > .button { flex: 1 1 auto; }
    .room-code-entry { grid-template-columns: minmax(0, 1fr); }
    .room-code-entry p { grid-column: auto; }
    .room-code-control { min-width: 0; }
    .turn-banner { align-items: flex-start; flex-direction: column; gap: 5px; }
    .memory-board[data-size="20"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .brand small { display: none; }
    .brand strong { font-size: 14px; }
    .account .button { padding-inline: 10px; }
    .nav-links a { padding-inline: 11px; }
    .hero-side { grid-template-columns: minmax(0, 1fr); }
    .game-grid { grid-template-columns: minmax(0, 1fr); }
    .game-card { min-height: 220px; }
    .solo-shell { padding: 16px 12px 18px; border-radius: 17px; }
    .solo-stats,
    .score-cluster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .solo-toolbar { gap: 9px; }
    .segmented button { padding-inline: 9px; font-size: 11px; }
    .mine-board { --mine-size: 31px; }
    .pad-controls { margin-top: 14px; }
    .memory-board { gap: 6px; }
    .memory-card { border-radius: 9px; }
    .room-main,
    .room-side { padding: 15px 12px; border-radius: 17px; }
    .room-code-entry .room-code-control { flex-direction: column; }
    .room-code-control .button { width: 100%; }
    .dz-table { min-height: 520px; padding: 10px; }
    .dz-center { margin-block: 8px; }
    .dz-hand,
    .uno-hand { justify-content: flex-start; }
    .chess-board { border-radius: 8px; }
    .chess-piece { width: 86%; border-width: 1px; }
    .site-footer { flex-direction: column; gap: 6px; }
}
