
:root {
    color-scheme: dark;
    --bg: #090c14;
    --surface: rgba(18, 24, 42, .88);
    --surface-soft: #151a2a;
    --line: rgba(255, 255, 255, .13);
    --text: #f1f4ff;
    --muted: #aab4c9;
    --cyan: #4f7dff;
    --cyan-deep: #285bd6;
    --accent-rgb: 79, 125, 255;
    --cyan-bright: #86a5ff;
    --accent-contrast: #bdceff;
    --primary-text: #ffffff;
    --violet: #8aa8ff;
    --danger: #ff8d9b;
    --radius: 22px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100svh; margin: 0; overflow-x: clip; background: radial-gradient(ellipse at 18% 35%, rgba(var(--accent-rgb), .20), transparent 34%), radial-gradient(ellipse at 86% 75%, rgba(var(--accent-rgb), .12), transparent 32%), var(--bg); color: var(--text); }
button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.ambient { position: fixed; z-index: -1; width: 26rem; aspect-ratio: 1; pointer-events: none; filter: blur(100px); opacity: .12; }
.ambient--one { top: 16%; left: -17rem; background: var(--cyan); }
.ambient--two { right: -18rem; bottom: 2%; background: #2853bb; }
.topbar { width: min(1180px, calc(100% - 64px)); min-height: 88px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand__mark { display: grid; overflow: hidden; width: 38px; height: 38px; place-items: center; color: var(--cyan); border: 1px solid rgba(var(--accent-rgb), .36); border-radius: 12px; background: rgba(var(--accent-rgb), .07); box-shadow: 0 0 22px rgba(var(--accent-rgb), .09); }
.brand__mark img { width: 32px; height: 32px; object-fit: contain; }
.brand__name { font-size: 13px; font-weight: 800; letter-spacing: .14em; }
.brand__name b { color: var(--cyan); font-weight: 700; }
.topbar__actions { display: flex; align-items: center; gap: 20px; }
.secure-note { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.secure-note__dot, .status-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px rgba(var(--accent-rgb), .85); }

.page-shell { width: min(1100px, calc(100% - 64px)); min-height: calc(100svh - 144px); margin: 0 auto; padding: 64px 0 58px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 450px); align-items: center; gap: clamp(44px, 8vw, 112px); }
.intro { max-width: 560px; padding: 10px 0; }
.eyebrow { display: flex; align-items: center; gap: 12px; color: #b9c2d6; font-size: 10px; font-weight: 750; letter-spacing: .22em; }
.eyebrow__line { width: 27px; height: 1px; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.brand-slogan { margin: -12px 0 0; color: var(--cyan-bright); font-size: 10px; font-weight: 800; letter-spacing: .28em; text-shadow: 0 0 18px rgba(var(--accent-rgb), .28); }
.intro h1 { margin: 16px 0 18px; font-size: clamp(44px, 6vw, 76px); font-weight: 690; letter-spacing: -.065em; line-height: .99; }
.intro h1 span { color: var(--cyan); text-shadow: 0 0 38px rgba(var(--accent-rgb), .16); }
.intro__copy { max-width: 430px; margin: 0; color: #b9c2d6; font-size: 16px; line-height: 1.75; }
.feature-list { display: grid; gap: 20px; margin: 38px 0 34px; }
.feature { display: flex; align-items: center; gap: 15px; }
.feature__icon { display: grid; flex: 0 0 39px; width: 39px; height: 39px; place-items: center; color: var(--cyan); border: 1px solid rgba(var(--accent-rgb), .16); border-radius: 12px; background: rgba(var(--accent-rgb), .06); font-size: 19px; }
.feature__icon--violet { color: var(--accent-contrast); border-color: rgba(var(--accent-rgb), .2); background: rgba(var(--accent-rgb), .08); }
.feature__icon--blue { color: var(--accent-contrast); border-color: rgba(var(--accent-rgb), .18); background: rgba(var(--accent-rgb), .07); }
.feature strong, .feature small { display: block; }
.feature strong { margin-bottom: 4px; font-size: 13px; font-weight: 650; }
.feature small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.intro__footnote { display: flex; align-items: center; gap: 9px; color: #7e8ba4; font-size: 11px; }
.shield-icon { color: var(--cyan); font-size: 12px; }

.auth-card { width: 100%; padding: 29px; border: 1px solid rgba(255, 255, 255, .15); border-radius: var(--radius); background: linear-gradient(145deg, rgba(21, 27, 45, .96), rgba(16, 22, 38, .94)); box-shadow: 0 28px 90px rgba(0, 0, 0, .30), 0 0 0 1px rgba(255, 255, 255, .015) inset; backdrop-filter: blur(18px); }
.auth-card__topline { display: flex; align-items: center; justify-content: space-between; }
.status-pill { display: inline-flex; min-height: 27px; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid rgba(var(--accent-rgb), .17); border-radius: 99px; background: rgba(var(--accent-rgb), .06); color: var(--accent-contrast); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.status-pill span { width: 5px; height: 5px; }
.auth-card__index { color: #65718b; font-size: 10px; letter-spacing: .1em; }
.auth-heading { margin: 27px 0 21px; }
.auth-heading h2 { margin: 0 0 8px; font-size: 26px; font-weight: 650; letter-spacing: -.04em; }
.auth-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid rgba(255, 255, 255, .09); border-radius: 12px; background: rgba(12, 10, 11, .5); }
.auth-tab { min-height: 42px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: #8490a8; font-size: 12px; font-weight: 620; cursor: pointer; transition: background .18s ease, color .18s ease; }
.auth-tab.is-active { background: #1a2338; color: #fff7f8; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.auth-form { display: grid; gap: 16px; margin-top: 23px; }
.field { display: grid; gap: 8px; color: #dde5f7; font-size: 11px; font-weight: 600; }
.field input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, .15); border-radius: 10px; outline: none; background: rgba(13, 10, 11, .65); color: var(--text); font-size: 13px; transition: border-color .18s ease, box-shadow .18s ease; }
.field input::placeholder { color: #647087; opacity: 1; }
.field input:focus { border-color: rgba(var(--accent-rgb), .7); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field small { margin-top: -2px; color: #77849b; font-size: 10px; font-weight: 450; line-height: 1.45; }
.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 12px; padding: 0 16px; border: 1px solid transparent; border-radius: 10px; font-size: 12px; font-weight: 720; cursor: pointer; transition: transform .18s ease, background .18s ease, box-shadow .18s ease; }
.button:active { transform: translateY(1px); }
.button:focus-visible, .auth-tab:focus-visible, .text-button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.button--primary { background: linear-gradient(100deg, var(--cyan), var(--cyan-deep)); color: var(--primary-text); box-shadow: 0 7px 24px rgba(var(--accent-rgb), .16); }
.button--primary:hover { background: linear-gradient(100deg, var(--cyan-bright), var(--cyan-deep)); box-shadow: 0 9px 30px rgba(var(--accent-rgb), .24); }
.button--quiet { border-color: rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .035); color: #eef2ff; }
.button--quiet:hover { background: rgba(255, 255, 255, .075); }
.button__arrow { font-size: 16px; font-weight: 500; }
.auth-submit { width: 100%; min-height: 49px; margin-top: 2px; }
.auth-submit:disabled { opacity: .65; cursor: wait; }
.form-hint { margin: 0; color: #7f8aa2; font-size: 11px; text-align: center; }
.text-button { padding: 4px; border: 0; background: transparent; color: var(--cyan); font-size: inherit; font-weight: 680; cursor: pointer; }
.form-message { margin-top: 15px; padding: 11px 12px; border: 1px solid rgba(255, 141, 155, .24); border-radius: 9px; background: rgba(255, 141, 155, .07); color: #ffb4bd; font-size: 11px; line-height: 1.5; }
.form-message.is-success { border-color: rgba(var(--accent-rgb), .22); background: rgba(var(--accent-rgb), .06); color: var(--accent-contrast); }
.auth-card__footer { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 23px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .09); color: #77839b; font-size: 10px; text-align: center; }
.auth-privacy-note { margin: 12px 0 0; color: #77849b; font-size: 9px; line-height: 1.55; text-align: center; }
.lock-icon { color: var(--accent-contrast); font-size: 12px; }
.member-panel { padding-top: 28px; text-align: center; }
.member-avatar { display: grid; width: 64px; height: 64px; margin: 0 auto 15px; place-items: center; border: 1px solid rgba(var(--accent-rgb), .28); border-radius: 20px; background: rgba(var(--accent-rgb), .08); color: var(--cyan); font-size: 24px; font-weight: 700; }
.member-avatar.animal-avatar { font-size: 34px; }
.member-panel__label { color: var(--accent-contrast); font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.member-panel h3 { margin: 7px 0; font-size: 22px; }
.member-panel__meta, .member-panel__note { color: var(--muted); font-size: 11px; line-height: 1.6; }
.member-panel__note { margin: 22px 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: rgba(12, 10, 11, .3); }
.site-footer { width: min(1100px, calc(100% - 64px)); min-height: 56px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #66728a; font-size: 10px; }

@media (max-width: 820px) {
    .topbar { width: min(100% - 40px, 620px); min-height: 72px; }
    .page-shell { width: min(100% - 40px, 620px); min-height: auto; padding: 48px 0 44px; grid-template-columns: 1fr; gap: 32px; }
    .intro { max-width: none; }
    .intro h1 { margin-top: 18px; font-size: clamp(42px, 9vw, 66px); }
    .intro__copy { max-width: 540px; font-size: 14px; }
    .feature-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 26px 0 18px; }
    .feature { align-items: flex-start; gap: 9px; }
    .feature__icon { flex-basis: 32px; width: 32px; height: 32px; border-radius: 10px; font-size: 15px; }
    .feature small { font-size: 10px; }
    .intro__footnote { display: none; }
    .auth-card { max-width: 500px; justify-self: center; }
    .site-footer { width: min(100% - 40px, 620px); }
}

@media (max-width: 520px) {
    .topbar { width: calc(100% - 36px); min-height: 65px; }
    .brand__mark { width: 34px; height: 34px; border-radius: 10px; }
    .brand__name { font-size: 11px; letter-spacing: .12em; }
    .secure-note { font-size: 0; }
    .secure-note__dot { width: 8px; height: 8px; }
    .topbar__actions { gap: 10px; }
    .install-button { min-height: 40px; padding: 0 10px; font-size: 10px; }
    .page-shell { width: calc(100% - 36px); padding: 35px 0 calc(30px + env(safe-area-inset-bottom)); gap: 25px; }
    .eyebrow { font-size: 9px; letter-spacing: .18em; }
    .intro h1 { margin: 17px 0 12px; font-size: clamp(40px, 12vw, 55px); }
    .intro__copy { max-width: 420px; font-size: 13px; line-height: 1.65; }
    .feature-list { margin-top: 20px; gap: 8px; }
    .feature { display: grid; gap: 7px; }
    .feature strong { font-size: 10px; }
    .feature small { font-size: 9px; line-height: 1.4; }
    .auth-card { padding: 21px 18px; border-radius: 18px; }
    .auth-heading { margin: 21px 0 17px; }
    .auth-heading h2 { font-size: 23px; }
    .auth-form { gap: 14px; margin-top: 19px; }
    .field input { min-height: 50px; font-size: 16px; }
    .button { min-height: 48px; }
    .auth-card__footer { font-size: 9px; }
    .site-footer { width: calc(100% - 36px); padding-bottom: env(safe-area-inset-bottom); font-size: 9px; }
    .site-footer span:last-child { text-align: right; }
}

@media (max-width: 360px) {
    .topbar, .page-shell, .site-footer { width: calc(100% - 28px); }
    .page-shell { padding-top: 27px; }
    .intro h1 { font-size: 39px; }
    .feature-list { gap: 6px; }
    .feature small { font-size: 8px; }
    .auth-card { padding: 18px 15px; }
    .site-footer { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Authenticated arena shell */
:root {
    --bg-main: #10141f; --bg-panel: #161c2b; --bg-card: #1d263a; --bg-hover: #293853;
    --primary: var(--cyan); --primary-hover: var(--cyan-deep); --accent: var(--cyan); --success: #36c98f;
    --danger: #ed637b; --warning: #f2bd60; --text-main: #f1f4ff; --text-secondary: #b6c1d8;
    --text-muted: #77819b; --border: #344665; --radius-sm: 8px; --radius-md: 12px;
    --radius-lg: 18px; --radius-xl: 24px; --shadow-panel: 0 12px 40px rgba(0,0,0,.24);
}
.arena-shell { min-height: 100dvh; padding: 0 24px 24px; color: var(--text-main); }
.arena-header { max-width: 1600px; min-height: 76px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--border); }
#arena-shell[data-active-page="messages"] > .arena-header { min-height: 48px; gap: 12px; border-bottom: 0; }
#arena-shell[data-active-page="messages"] > .arena-header > .brand { display: none; }
#arena-shell[data-active-page="messages"] > .arena-header > .main-nav { max-width: none; flex: 1 1 auto; justify-content: flex-start; }
.arena-header .brand__mark { font-weight: 800; }
.main-nav { display: flex; align-items: center; justify-content: center; gap: 3px; flex-wrap: wrap; }
.main-nav button { padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text-secondary); font-size: 11px; white-space: nowrap; cursor: pointer; }
.main-nav button:hover, .main-nav button.is-active { background: rgba(var(--accent-rgb), .14); color: var(--accent-contrast); }
.main-nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.main-nav .theme-picker--nav { flex: 0 0 auto; margin-left: auto; }
#notification-badge { display: inline-grid; min-width: 17px; height: 17px; place-items: center; margin-left: 3px; border-radius: 6px; background: var(--danger); color: #fff; font-size: 9px; }
.arena-account { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); font-size: 12px; }
.role-badge { padding: 5px 8px; border: 1px solid rgba(var(--accent-rgb), .4); border-radius: 999px; background: rgba(var(--accent-rgb), .15); color: var(--accent-contrast); font-size: 9px; font-weight: 850; letter-spacing: .1em; }
.role-crown { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; vertical-align: -3px; }
.role-crown svg { display: block; width: 16px; height: 16px; fill: currentColor; filter: drop-shadow(0 0 4px currentColor); }
.role-crown--owner { color: #ffd34f; }
.role-crown--admin { color: #d7e0ee; }
#arena-username .role-crown { width: 18px; height: 18px; margin-left: 3px; vertical-align: -4px; }
#arena-username .role-crown svg { width: 18px; height: 18px; }
.owner-login-notice { position: fixed; z-index: 1000; top: max(18px, env(safe-area-inset-top)); left: 50%; display: flex; width: min(440px, calc(100% - 28px)); min-height: 72px; align-items: center; gap: 13px; padding: 13px 15px; transform: translate(-50%, -12px); border: 1px solid rgba(var(--accent-rgb), .42); border-radius: 15px; background: rgba(15, 22, 39, .96); box-shadow: 0 18px 60px rgba(0, 0, 0, .42), 0 0 28px rgba(var(--accent-rgb), .16); color: var(--accent-contrast); animation: owner-notice-in .22s ease-out forwards; }
.owner-login-notice[hidden] { display: none; }
.owner-login-notice__mark { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border: 1px solid rgba(var(--accent-rgb), .4); border-radius: 12px; background: rgba(var(--accent-rgb), .18); color: var(--accent-contrast); font-size: 20px; }
.owner-login-notice strong, .owner-login-notice small { display: block; }
.owner-login-notice strong { font-size: 11px; letter-spacing: .08em; }
.owner-login-notice small { margin-top: 5px; color: #b6c1d8; font-size: 11px; }
.owner-login-notice button { width: 30px; height: 30px; margin-left: auto; border: 0; border-radius: 8px; background: transparent; color: #b6c1d8; font-size: 21px; cursor: pointer; }
.owner-login-notice button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.moderation-notice { position: fixed; z-index: 1400; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(3,6,13,.78); backdrop-filter: blur(9px); animation: moderation-notice-in .18s ease-out both; }
.moderation-notice__dialog { display: grid; justify-items: center; gap: 16px; width: min(480px, 100%); padding: clamp(24px, 6vw, 40px); border: 1px solid rgba(237,99,123,.62); border-radius: 22px; background: color-mix(in srgb, var(--bg-panel) 96%, #120d19); box-shadow: 0 30px 100px rgba(0,0,0,.65), 0 0 55px rgba(237,99,123,.2); color: var(--text-main); text-align: center; }
.moderation-notice--mute .moderation-notice__dialog { border-color: rgba(var(--accent-rgb), .68); box-shadow: 0 30px 100px rgba(0,0,0,.65), 0 0 55px rgba(var(--accent-rgb), .2); }
.moderation-notice__mark { display: grid; width: 64px; height: 64px; place-items: center; border: 1px solid rgba(237,99,123,.62); border-radius: 20px; background: rgba(237,99,123,.15); color: #ff9dad; font-size: 32px; font-weight: 900; }
.moderation-notice--mute .moderation-notice__mark { border-color: rgba(var(--accent-rgb), .62); background: rgba(var(--accent-rgb), .15); color: var(--accent-contrast); }
.moderation-notice__copy { min-width: 0; }
.moderation-notice__copy h2 { margin: 0; font-size: clamp(23px, 6vw, 32px); letter-spacing: -.04em; }
.moderation-notice__copy p { margin: 12px 0 0; color: #c4cada; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.moderation-notice__acknowledge { min-height: 44px; margin-top: 3px; }
@keyframes moderation-notice-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: scale(1); } }
@keyframes owner-notice-in { to { opacity: 1; transform: translate(-50%, 0); } }
.arena-account .button { min-height: 36px; font-size: 11px; }
.presence-dot, .room-live i, .online-footnote i { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: var(--success); box-shadow: 0 0 12px rgba(54,201,143,.45); }
.chat-layout { display: grid; grid-template-columns: 250px minmax(0,1fr) 240px; gap: 16px; max-width: 1600px; min-height: calc(100dvh - 120px); margin: 0 auto; padding-top: 18px; }
.chat-sidebar, .chat-main, .chat-members { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-panel); box-shadow: var(--shadow-panel); }
.chat-sidebar, .chat-members { display: flex; flex-direction: column; padding: 18px 14px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 5px 18px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 15px; letter-spacing: -.02em; }
.members-panel-toggle { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); color: var(--text-main); font-size: 22px; line-height: 1; cursor: pointer; touch-action: manipulation; }
.members-panel-toggle:hover, .members-panel-toggle:focus-visible { border-color: rgba(var(--accent-rgb), .65); background: var(--bg-hover); outline: none; }
.members-panel-toggle[aria-expanded="false"] { display: none; }
.eyebrow-small, .room-kicker { color: var(--text-muted); font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.live-badge { padding: 5px 7px; border: 1px solid rgba(var(--accent-rgb), .19); border-radius: 99px; color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.room-list, .online-list { display: grid; align-content: start; gap: 6px; }
.room-button { width: 100%; display: flex; gap: 11px; align-items: center; padding: 12px 10px; text-align: left; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--text-secondary); cursor: pointer; }
.room-button:hover, .room-button.is-active { border-color: rgba(var(--accent-rgb), .22); background: rgba(var(--accent-rgb), .12); color: var(--text-main); }
.room-symbol { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 9px; background: rgba(var(--accent-rgb), .09); color: var(--accent); font-size: 14px; }
.room-button strong, .room-button small { display: block; }
.room-button strong { font-size: 11px; font-weight: 650; }
.room-button small { margin-top: 3px; color: var(--text-muted); font-size: 9px; }
.sidebar-note { margin-top: auto; padding: 12px 10px 2px; color: var(--text-muted); font-size: 10px; line-height: 1.55; }
.chat-main { position: relative; display: flex; min-height: 600px; flex-direction: column; }
.chat-layout .chat-main { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.room-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 19px 22px; border-bottom: 1px solid var(--border); }
.room-members-toggle { display: none; }
.room-header h1 { margin: 4px 0; font-size: 17px; }
.room-header p { margin: 0; color: var(--text-muted); font-size: 11px; }
.room-live { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 10px; white-space: nowrap; }
.room-live i { width: 6px; height: 6px; }
.chat-messages { display: flex; flex: 1; min-height: 0; flex-direction: column; gap: 14px; overflow: auto; padding: 16px 14px; }
@media (min-width: 681px) {
    #arena-shell[data-active-page="chat"] { display: flex; height: 100dvh; min-height: 0; flex-direction: column; overflow: hidden; }
    #arena-shell[data-active-page="chat"] > .arena-header { flex: 0 0 auto; }
    #arena-shell[data-active-page="chat"] > #chat-layout { width: 100%; height: auto; min-height: 0; flex: 1 1 auto; }
    #arena-shell[data-active-page="chat"] .chat-sidebar,
    #arena-shell[data-active-page="chat"] .chat-main,
    #arena-shell[data-active-page="chat"] .chat-members { height: 100%; min-height: 0; }
    #arena-shell[data-active-page="chat"] .chat-main { overflow: hidden; }
    #arena-shell[data-active-page="chat"] .chat-messages { min-height: 0; flex: 1 1 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; }
    #arena-shell[data-active-page="chat"] #chat-form { flex: 0 0 auto; }
}
.chat-empty { margin: auto; max-width: 260px; color: var(--text-muted); font-size: 12px; line-height: 1.7; text-align: center; }
.chat-message { display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 8px; align-items: start; }
.chat-message > div { min-width: 0; }
.chat-avatar, .online-avatar { display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(var(--accent-rgb), .26); border-radius: 11px; background: rgba(var(--accent-rgb), .13); color: var(--accent-contrast); font-size: 12px; font-weight: 750; }
.animal-avatar { background: linear-gradient(145deg, rgba(var(--accent-rgb), .22), rgba(116, 100, 190, .22)); font-size: 17px; line-height: 1; transform-origin: center; animation-duration: 2.6s; animation-timing-function: ease-in-out; animation-iteration-count: infinite; }
.animal-motion--0 { animation-name: animal-float; }
.animal-motion--1 { animation-name: animal-hop; animation-duration: 1.9s; }
.animal-motion--2 { animation-name: animal-wiggle; animation-duration: 3.1s; }
.animal-motion--3 { animation-name: animal-sway; animation-duration: 2.8s; }
@keyframes animal-float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-3px) rotate(2deg); } }
@keyframes animal-hop { 0%, 78%, 100% { transform: translateY(0) scale(1); } 88% { transform: translateY(-4px) scale(1.04); } }
@keyframes animal-wiggle { 0%, 74%, 100% { transform: rotate(0); } 80% { transform: rotate(-7deg); } 87% { transform: rotate(6deg); } 93% { transform: rotate(-3deg); } }
@keyframes animal-sway { 0%, 100% { transform: translateY(0) rotate(2deg); } 50% { transform: translateY(-2px) rotate(-3deg); } }
.animal-avatar--0, .animal-avatar--5 { background: linear-gradient(145deg, #ffe9c7, #edcaa1); }
.animal-avatar--1, .animal-avatar--6 { background: linear-gradient(145deg, #d9eaff, #b6cce5); }
.animal-avatar--2, .animal-avatar--4 { background: linear-gradient(145deg, #ffe3ec, #f0c7dc); }
.animal-avatar--3 { background: linear-gradient(145deg, #d6f2df, #b9dfd1); }
.chat-avatar { width: 30px; height: 30px; }
.chat-avatar img, .online-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-profile-trigger { display: grid; width: 30px; height: 30px; flex: 0 0 30px; place-items: center; padding: 0; border: 0; border-radius: 11px; background: transparent; cursor: pointer; }
.chat-profile-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.message-meta { display: flex; align-items: baseline; gap: 9px; }
.message-meta strong { color: var(--text-main); font-size: 11px; }
.message-meta .chat-user-trigger { padding: 0; border: 0; background: transparent; color: var(--text-main); font: inherit; font-size: 10px; font-weight: 750; text-align: left; cursor: pointer; }
.message-meta .chat-user-trigger:hover, .message-meta .chat-user-trigger:focus-visible { color: var(--accent-contrast); text-decoration: underline; text-underline-offset: 3px; }
.message-meta time { color: var(--text-muted); font-size: 9px; }
.chat-user-menu { position: fixed; z-index: 1200; display: grid; width: min(260px, calc(100vw - 16px)); max-height: min(420px, calc(100dvh - 16px)); gap: 5px; overflow: auto; padding: 10px; border: 1px solid rgba(var(--accent-rgb), .42); border-radius: 13px; background: color-mix(in srgb, var(--bg-panel) 94%, var(--bg-main)); box-shadow: 0 18px 55px rgba(0,0,0,.45), 0 0 25px rgba(var(--accent-rgb), .12); }
.chat-user-menu[hidden] { display: none; }
.chat-user-menu__title { padding: 4px 8px 7px; color: var(--text-main); font-size: 12px; overflow-wrap: anywhere; }
.chat-user-menu__item { min-height: 36px; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; background: rgba(var(--accent-rgb), .1); color: var(--text-main); font: inherit; font-size: 11px; text-align: left; cursor: pointer; }
.chat-user-menu__item:hover, .chat-user-menu__item:focus-visible { border-color: rgba(var(--accent-rgb), .38); background: rgba(var(--accent-rgb), .18); outline: none; }
.chat-user-menu__item.is-primary { color: var(--accent-contrast); font-weight: 750; }
.chat-user-menu__item.is-danger { border-color: rgba(237,99,123,.22); background: rgba(237,99,123,.1); color: #ff9eae; }
.chat-user-menu__item.is-danger:hover, .chat-user-menu__item.is-danger:focus-visible { background: rgba(237,99,123,.2); }
.chat-user-menu__item.is-quiet { background: transparent; color: var(--text-muted); }
.chat-user-menu__item:disabled { opacity: .55; cursor: wait; }
.chat-user-menu__form { display: grid; gap: 8px; }
.chat-user-menu__form label { display: grid; gap: 5px; color: var(--text-secondary); font-size: 10px; }
.chat-user-menu__form textarea, .chat-user-menu__form select { width: 100%; min-height: 35px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-main); color: var(--text-main); font: inherit; font-size: 11px; }
.chat-user-menu__form textarea { resize: vertical; }
.chat-user-menu__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.chat-user-menu__feedback { margin: 2px 4px; color: var(--text-secondary); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.message-content { margin: 4px 0 0; color: var(--text-secondary); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }
.typing-indicator { min-height: 17px; padding: 0 22px; color: var(--text-muted); font-size: 10px; }
.chat-composer { display: flex; width: 100%; box-sizing: border-box; align-items: center; gap: 8px; margin: 2px 0 max(10px, env(safe-area-inset-bottom)); padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; background: #121722; }
.chat-composer:focus-within { border-color: rgba(var(--accent-rgb), .7); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1); }
.chat-composer textarea { width: 100%; min-width: 0; max-height: 130px; min-height: 42px; flex: 1 1 auto; resize: vertical; overflow-y: auto; padding: 2px 4px; border: 0; outline: none; background: transparent; color: var(--text-main); font-size: 12px; }
.chat-composer textarea::placeholder { color: var(--text-muted); }
.send-button { width: 48px; height: 48px; flex: 0 0 48px; border: 0; border-radius: 50%; background: var(--primary); color: white; font-size: 20px; cursor: pointer; touch-action: manipulation; }
#chat-emoji-toggle { order: 0; }
#chat-photo-trigger { order: 1; }
#chat-input { order: 2; }
#chat-form .send-button { order: 3; margin-left: auto; }
.send-button:hover { background: var(--primary-hover); }
.emoji-toggle { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--accent); font-size: 25px; line-height: 1; cursor: pointer; }
.emoji-toggle:hover, .emoji-toggle[aria-expanded="true"] { background: rgba(var(--accent-rgb), .13); }
.chat-composer .attach-button { border: 0; border-radius: 50%; }
.chat-composer .attach-button:hover, .chat-composer .attach-button:focus-visible, .emoji-toggle:focus-visible { outline: none; background: rgba(var(--accent-rgb), .13); }
.chat-composer button:disabled { opacity: .55; cursor: not-allowed; }
.chat-photo-pending { display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box; margin: 0 0 8px; padding: 8px 10px; border: 1px solid rgba(var(--accent-rgb),.3); border-radius: 12px; background: rgba(var(--accent-rgb),.08); }
.chat-photo-pending[hidden] { display: none; }
.chat-photo-pending img { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 8px; object-fit: cover; }
.chat-photo-pending span { display: grid; min-width: 0; gap: 3px; color: var(--text-main); font-size: 10px; }
.chat-photo-pending small { overflow: hidden; color: var(--text-muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.chat-photo-pending .button { min-height: 34px; margin-left: auto; padding: 0 9px; font-size: 9px; }
.emoji-picker { position: absolute; z-index: 30; right: 12px; bottom: 68px; display: grid; width: min(360px, calc(100% - 24px)); max-height: min(280px, 45dvh); grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; overflow: auto; padding: 9px; border: 1px solid var(--border); border-radius: 14px; background: #171d29; box-shadow: 0 14px 44px rgba(0,0,0,.38); overscroll-behavior: contain; }
.emoji-picker[hidden] { display: none; }
.emoji-picker__item { min-width: 0; min-height: 36px; padding: 1px; border: 0; border-radius: 8px; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; }
.emoji-picker__item:hover, .emoji-picker__item:focus-visible { outline: none; background: rgba(var(--accent-rgb),.18); }
.message-attachment-preview { display: block; max-width: min(360px, 82vw); margin-top: 7px; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 11px; background: transparent; cursor: zoom-in; }
.message-attachment { display: block; max-width: 100%; max-height: 300px; object-fit: contain; }
.online-list { min-height: 0; flex: 1 1 auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-gutter: stable; }
.online-user { display: flex; align-items: center; gap: 9px; padding: 8px 6px; border-radius: 9px; }
.online-user:hover { background: rgba(255,255,255,.035); }
.online-user--interactive { width: 100%; border: 0; background: transparent; color: var(--text-main); font: inherit; text-align: left; cursor: pointer; }
.online-user--interactive:focus-visible { outline: 2px solid rgba(var(--accent-rgb), .7); outline-offset: 1px; }
.online-user__label { min-width: 0; flex: 1; }
.online-user__name { display: block; max-width: 100%; padding: 0; border: 0; background: transparent; color: var(--text-main); font: inherit; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.online-user__name:hover, .online-user__name:focus-visible { color: var(--accent-contrast); text-decoration: underline; text-underline-offset: 2px; }
.online-user__menu-trigger { display: grid; width: 31px; height: 31px; flex: 0 0 31px; place-items: center; border: 1px solid rgba(var(--accent-rgb), .28); border-radius: 8px; background: rgba(var(--accent-rgb), .08); color: var(--accent-contrast); font-size: 19px; line-height: 1; cursor: pointer; touch-action: manipulation; }
.online-user__menu-trigger:hover, .online-user__menu-trigger:focus-visible { border-color: rgba(var(--accent-rgb), .7); background: rgba(var(--accent-rgb), .2); outline: none; }
.online-avatar { width: 31px; height: 31px; flex: 0 0 31px; border-radius: 10px; }
.online-user strong, .online-user small { display: block; }
.online-user strong { font-size: 10px; font-weight: 650; }
.online-user small { margin-top: 3px; color: var(--text-muted); font-size: 9px; }
.count-pill { display: inline-grid; min-width: 20px; height: 20px; place-items: center; margin-left: 4px; border-radius: 7px; background: rgba(var(--accent-rgb), .1); color: var(--accent); font-size: 9px; vertical-align: 1px; }
.online-footnote { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; margin-top: auto; padding: 16px 5px 2px; color: var(--text-muted); font-size: 9px; }
.online-footnote i { width: 6px; height: 6px; }
.mobile-chat-nav { display: none; }
.app-page { max-width: 1420px; min-height: calc(100dvh - 145px); margin: 0 auto; padding: 32px 4px 50px; }
.page-title { margin: 6px 0 24px; }
.page-title h1 { margin: 7px 0; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.05em; }
.page-title p, .muted-copy { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.7; }
.home-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 15px; }
.feature-card, .settings-card, .game-card, .profile-summary { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-panel); box-shadow: var(--shadow-panel); }
.feature-card { display: flex; min-height: 210px; flex-direction: column; align-items: flex-start; }
.feature-card h2, .settings-card h2 { margin: 15px 0 7px; font-size: 16px; }
.feature-card p { flex: 1; margin: 0 0 18px; color: var(--text-muted); font-size: 11px; line-height: 1.6; }
.feature-card .button { min-height: 39px; font-size: 11px; }
.feature-card__icon { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid rgba(var(--accent-rgb), .2); border-radius: 13px; background: rgba(var(--accent-rgb), .08); color: var(--accent); font-size: 21px; }
.feature-card__icon--violet { border-color: rgba(var(--accent-rgb), .2); background: rgba(var(--accent-rgb), .1); color: var(--accent-contrast); }
.dm-layout { display: grid; min-height: calc(100dvh - 130px); grid-template-columns: minmax(230px,270px) minmax(0,1fr); gap: 10px; }
.dm-list-panel, .dm-chat-panel { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-panel); }
.dm-list-panel { padding: 14px; }
.dm-list-panel h2 { margin: 12px 5px 8px; font-size: 13px; }
.inline-search, .search-bar { display: flex; gap: 8px; }
.inline-search input, .search-bar input, .ranking-controls select { min-width: 0; width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; outline: none; background: #121722; color: var(--text-main); font-size: 11px; }
.inline-search .button { min-height: 42px; font-size: 10px; }
.dm-chat-panel { display: flex; min-height: 0; flex-direction: column; }
.dm-header { display: flex; min-height: 46px; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 12px; border-bottom: 1px solid var(--border); }
.dm-profile-name { display: block; max-width: min(60vw, 360px); overflow: hidden; padding: 0; border: 0; background: transparent; color: var(--text-main); font: inherit; font-size: 14px; font-weight: 750; line-height: 1.2; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.dm-profile-name:hover, .dm-profile-name:focus-visible { color: var(--accent-contrast); text-decoration: underline; text-underline-offset: 3px; }
.dm-header .muted-copy { font-size: 9px; line-height: 1.2; }
.dm-header__person { display: grid; min-width: 0; gap: 2px; }
.dm-profile-avatar { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; padding: 0; overflow: hidden; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.dm-profile-avatar__image { width: 32px; height: 32px; }
.dm-profile-avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dm-actions { display: flex; gap: 7px; }
.dm-actions .button { min-height: 34px; padding: 0 9px; font-size: 9px; }
.dm-messages { display: flex; flex: 1; min-height: 0; flex-direction: column; gap: 8px; overflow: auto; padding: 10px 10px 6px; }
.dm-message-row { display: flex; width: fit-content; max-width: min(94%,760px); flex-direction: row; align-items: flex-start; gap: 8px; }
.dm-message-row.is-own { align-self: flex-end; }
.dm-message-avatar-trigger { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; padding: 0; overflow: hidden; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.dm-message-avatar-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dm-message-avatar { display: grid; width: 32px; height: 32px; place-items: center; overflow: hidden; border: 1px solid rgba(var(--accent-rgb),.3); border-radius: 50%; background: rgba(var(--accent-rgb),.14); color: var(--accent-contrast); font-size: 12px; }
.dm-message-avatar img { width: 100%; height: 100%; object-fit: cover; }
.dm-message-content { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; }
.dm-message { width: fit-content; max-width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: 11px 11px 11px 4px; background: var(--bg-card); color: var(--text-secondary); font-size: 12px; line-height: 1.42; white-space: pre-wrap; overflow-wrap: anywhere; }
.dm-message.is-own { border-color: rgba(var(--accent-rgb), .3); border-radius: 12px 12px 4px 12px; background: rgba(var(--accent-rgb), .14); color: var(--text-main); }
.dm-message-footer { display: flex; min-height: 13px; align-items: center; gap: 6px; margin-top: 1px; color: var(--text-muted); font-size: 9px; line-height: 1.2; }
.dm-message-row.is-own .dm-message-footer { justify-content: flex-end; }
.dm-message-footer time { font-size: 9px; text-align: right; }
.dm-message-delete { margin: 0; padding: 0 2px; }
.dm-message img { display: block; max-width: min(100%,360px); max-height: 280px; margin-top: 6px; border-radius: 9px; cursor: zoom-in; }
#page-messages.app-page { width: calc(100% + 48px); max-width: none; min-height: 0; margin: 0 -24px -24px; padding: 8px 0 0; }
#page-messages .dm-layout { width: 100%; }
#page-messages[data-dm-view="chat"] .dm-layout { grid-template-columns: minmax(210px,250px) minmax(0,1fr); }
#page-messages[data-dm-view="chat"] .dm-chat-panel { width: 100%; }
#page-messages[data-dm-view="chat"] .dm-header__identity h2 { font-size: 15px; }
#dm-typing:empty { display: none; }
#dm-composer { margin: 0; }
.dm-row, .person-row, .notification-row, .ranking-row, .search-person { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid transparent; border-radius: 10px; color: var(--text-secondary); }
.dm-row { width: 100%; text-align: left; background: transparent; cursor: pointer; }
.dm-row:hover, .dm-row.is-active { border-color: rgba(var(--accent-rgb), .2); background: rgba(var(--accent-rgb), .1); }
.dm-row strong, .dm-row small, .person-row strong, .person-row small, .search-person strong, .search-person small { display: block; }
.dm-row strong, .person-row strong, .search-person strong { font-size: 11px; }
.dm-row small, .person-row small, .search-person small { margin-top: 4px; color: var(--text-muted); font-size: 9px; }
.unread-badge { display: grid; min-width: 18px; height: 18px; margin-left: auto; place-items: center; border-radius: 6px; background: var(--primary); color: #fff; font-size: 9px; }
.stack-list { display: grid; align-content: start; gap: 6px; }
.stack-empty { padding: 18px 10px; color: var(--text-muted); font-size: 11px; line-height: 1.6; }
.attach-button { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border: 1px solid var(--border); border-radius: 10px; color: var(--accent); font-size: 22px; cursor: pointer; }
.dm-photo-pending { display: flex; align-items: center; gap: 10px; margin: 0 14px 8px; padding: 8px 10px; border: 1px solid rgba(var(--accent-rgb),.3); border-radius: 11px; background: rgba(var(--accent-rgb),.08); }
.dm-photo-pending[hidden] { display: none; }
.dm-photo-pending img { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 7px; object-fit: cover; }
.dm-photo-pending span { display: grid; min-width: 0; gap: 3px; color: var(--text-main); font-size: 10px; }
.dm-photo-pending small { overflow: hidden; color: var(--text-muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.dm-photo-pending .button { min-height: 32px; margin-left: auto; padding: 0 9px; font-size: 9px; }
.search-bar { max-width: 600px; margin: 0 0 18px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 10px; margin-bottom: 20px; }
.search-person { background: var(--bg-panel); border-color: var(--border); }
.person-row .button, .search-person .button { min-height: 31px; margin-left: auto; padding: 0 8px; font-size: 9px; }
.friends-columns { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.friends-columns h2 { margin: 16px 0 8px; font-size: 14px; }
.friends-columns section { min-width: 0; }
.game-cards { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.game-card { position: relative; display: grid; min-height: 310px; grid-template-columns: minmax(120px,.8fr) 1.2fr; align-items: center; gap: 15px; overflow: hidden; }
.game-card--football { background: radial-gradient(circle at 15% 45%,rgba(var(--accent-rgb), .17),transparent 50%),var(--bg-panel); }
.game-card--chess { background: radial-gradient(circle at 15% 45%,rgba(var(--accent-rgb), .16),transparent 50%),var(--bg-panel); }
.game-card__tag { position: absolute; top: 16px; right: 16px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 99px; color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.game-card--chess .game-card__tag { color: var(--accent-contrast); }
.game-card__art { display: grid; aspect-ratio: 1; place-items: center; border: 1px solid rgba(var(--accent-rgb), .2); border-radius: 24px; background: rgba(var(--accent-rgb), .08); color: var(--accent); font-size: clamp(46px,8vw,90px); }
.game-card--chess .game-card__art { border-color: rgba(var(--accent-rgb), .2); background: rgba(var(--accent-rgb), .08); color: var(--accent-contrast); }
.game-card h2 { margin: 7px 0; font-size: 22px; }
.game-card p { color: var(--text-muted); font-size: 11px; line-height: 1.7; }
.ranking-controls { display: flex; gap: 12px; margin-bottom: 16px; }
.ranking-controls label { display: grid; width: min(260px,50%); gap: 7px; color: var(--text-muted); font-size: 10px; }
.ranking-row { border: 1px solid var(--border); background: var(--bg-panel); }
.ranking-row strong { width: 30px; color: var(--accent); }
.ranking-row span:last-child { margin-left: auto; color: var(--text-main); font-size: 11px; }
.profile-layout { display: grid; grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr); align-items: start; gap: 18px; }
.profile-layout > * { min-width: 0; }
.profile-summary { min-height: 250px; }
.profile-summary .profile-hero { display: flex; align-items: center; gap: 15px; }
.profile-summary .chat-avatar { width: 62px; height: 62px; border-radius: 18px; font-size: 20px; }
.profile-summary h2 { margin: 0 0 4px; }
.profile-stats { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin-top: 24px; }
.profile-stats div { padding: 12px; border-radius: 10px; background: rgba(255,255,255,.035); }
.profile-stats > .profile-friend-stat { display: block; width: 100%; padding: 12px; border: 1px solid transparent; border-radius: 10px; background: rgba(255,255,255,.035); color: var(--text-main); text-align: left; cursor: pointer; }
.profile-stats > .profile-friend-stat:hover, .profile-stats > .profile-friend-stat:focus-visible { border-color: rgba(var(--accent-rgb),.4); background: rgba(var(--accent-rgb),.1); outline: none; }
.profile-stats strong, .profile-stats small { display: block; }
.profile-stats strong { font-size: 15px; }
.profile-stats small { margin-top: 4px; color: var(--text-muted); font-size: 9px; }
.profile-achievements { margin-top: 22px; }
.profile-achievements h3 { margin: 0 0 10px; font-size: 13px; }
.achievement-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.achievement-badge { display: grid; gap: 5px; padding: 10px; border: 1px solid rgba(var(--accent-rgb), .22); border-radius: 10px; background: rgba(36, 68, 140,.08); }
.achievement-badge strong { font-size: 10px; }
.achievement-badge small { color: var(--text-muted); font-size: 9px; line-height: 1.4; }
.public-profile-dialog { width: min(560px,calc(100% - 24px)); max-height: min(85dvh,760px); padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 18px; background: #111621; color: var(--text-main); box-shadow: 0 24px 90px rgba(0,0,0,.62); }
.public-profile-dialog::backdrop { background: rgba(3,5,12,.78); backdrop-filter: blur(6px); }
.public-profile-dialog section { padding: 22px; }
.public-profile-dialog #public-profile-close { float: right; min-height: 34px; padding: 0 11px; }
.public-profile-view { clear: both; padding-top: 8px; }
.public-profile-view .profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.public-profile-view .profile-actions .form-feedback { flex-basis: 100%; }
.public-profile-view .profile-request-status { flex-basis: 100%; margin: 0; padding: 9px 12px; border: 1px solid rgba(54,201,143,.38); border-radius: 9px; background: rgba(54,201,143,.12); color: #67e2ae; font-size: 11px; font-weight: 700; }
.public-profile-view .profile-request-status:empty { display: none; }
.public-profile-view .profile-hero { display: flex; align-items: center; gap: 14px; }
.public-profile-view .profile-stats { margin-top: 18px; }
.profile-friends-panel { margin-top: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.025); }
.profile-friends-panel h3 { margin: 0 0 10px; font-size: 13px; }
.profile-friends-list { max-height: min(38dvh,280px); overflow-y: auto; overscroll-behavior: contain; }
.profile-friend-row { display: flex; width: 100%; min-width: 0; align-items: center; gap: 10px; padding: 8px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text-main); text-align: left; cursor: pointer; }
.profile-friend-row:hover, .profile-friend-row:focus-visible { border-color: rgba(var(--accent-rgb),.28); background: rgba(var(--accent-rgb),.09); outline: none; }
.profile-friend-row > span { min-width: 0; }
.profile-friend-row strong, .profile-friend-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-friend-row strong { font-size: 11px; }
.profile-friend-row small { margin-top: 3px; color: var(--text-muted); font-size: 9px; }
.public-profile-view .profile-bio { margin: 18px 0; color: var(--text-muted); line-height: 1.65; white-space: pre-wrap; }
.settings-card { display: grid; gap: 14px; max-width: 620px; margin-bottom: 16px; }
.settings-card h2 { margin: 0; }
.settings-card .field textarea, .settings-card .field select, .settings-card .field input { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; outline: none; background: #121722; color: var(--text-main); font-size: 11px; }
.settings-card .field textarea { resize: vertical; }
.settings-card .button { min-height: 42px; }
.form-feedback { min-height: 14px; margin: 0; color: var(--accent); font-size: 10px; }
.notification-row { align-items: flex-start; border: 1px solid var(--border); background: var(--bg-panel); }
.notification-row p { flex: 1; margin: 0; font-size: 11px; line-height: 1.5; }
.notification-row small { display: block; margin-top: 5px; color: var(--text-muted); font-size: 9px; }
.notification-row .button { min-height: 30px; padding: 0 9px; font-size: 9px; }
.help-grid { display: grid; grid-template-columns: minmax(240px,.8fr) minmax(300px,1.2fr); align-items: start; gap: 16px; }
.football-lobby { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-panel); }
.football-lobby p { flex: 1 0 100%; color: var(--text-secondary); font-size: 12px; }
.football-character-picker { display: flex; flex: 1 1 100%; align-items: center; gap: 12px; color: var(--text-secondary); font-size: 11px; font-weight: 700; }
.football-character-picker select { min-width: 200px; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); color: var(--text-main); }
#football-canvas { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 15px; background: #121722; touch-action: none; }
.football-scoreboard { display: flex; align-items: center; justify-content: space-between; padding: 11px 6px; color: var(--text-secondary); font-size: 11px; }
.football-scoreboard strong { display: grid; gap: 3px; color: var(--text-main); font-size: 21px; text-align: center; }
.football-scoreboard small { color: var(--accent); font-size: 11px; }
.football-controls { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }
.football-controls button { min-width: 65px; min-height: 48px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-panel); color: var(--text-main); touch-action: none; }
.football-result { position: absolute; inset: 20% 10%; display: grid; align-content: center; justify-items: center; border: 1px solid var(--border); border-radius: var(--radius-xl); background: rgba(19, 15, 17,.95); text-align: center; }
.chess-lobby { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-panel); }
.chess-lobby > p:first-child { flex: 1 0 100%; margin: 0; color: var(--text-secondary); font-size: 12px; }
.chess-lobby #chess-status { flex: 1 0 100%; min-height: 18px; margin: 0; color: var(--text-muted); font-size: 11px; }
.chess-stage { max-width: 1120px; margin: 0 auto; padding: 18px; border: 1px solid rgba(var(--accent-rgb), .25); border-radius: 20px; background: radial-gradient(ellipse at 50% 0%,rgba(var(--accent-rgb),.1),transparent 55%),var(--bg-panel); box-shadow: var(--shadow-panel); }
.chess-match-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 2px 4px 18px; }
.chess-match-header > div { display: grid; gap: 4px; color: var(--text-main); font-size: 12px; }
.chess-match-header > div:last-child { text-align: right; }
.chess-match-header .eyebrow-small { color: var(--text-muted); font-size: 8px; }
.chess-turn-status { padding: 8px 13px; border: 1px solid var(--border); border-radius: 99px; background: rgba(var(--accent-rgb),.08); color: var(--accent-contrast); font-size: 10px; text-align: center; }
.chess-match-layout { display: grid; grid-template-columns: minmax(0,680px) minmax(200px,260px); justify-content: center; align-items: stretch; gap: 16px; }
.chess-board { display: grid; grid-template-columns: repeat(8,minmax(0,1fr)); width: 100%; aspect-ratio: 1; overflow: hidden; border: 5px solid #182335; border-radius: 12px; box-shadow: 0 24px 60px rgba(0,0,0,.42),0 0 0 1px rgba(255,255,255,.08); }
.chess-square { position: relative; display: grid; min-width: 0; min-height: 0; place-items: center; padding: 0; border: 0; border-radius: 0; cursor: pointer; touch-action: manipulation; }
.chess-square.is-light { background: #d9d4c7; color: #435064; }
.chess-square.is-dark { background: #5d766f; color: #e0e8d9; }
.chess-square:disabled { opacity: 1; cursor: default; }
.chess-square.is-last-move { background: #a9a56a; }
.chess-square.is-selected { z-index: 1; outline: 3px solid #f2c65e; outline-offset: -3px; box-shadow: inset 0 0 0 4px rgba(242,198,94,.25); }
.chess-square.is-legal-target::after { position: absolute; width: 26%; aspect-ratio: 1; border-radius: 50%; background: rgba(22,34,42,.28); content: ""; }
.chess-square.is-capture-target::after { position: absolute; inset: 4%; border: 4px solid rgba(144,54,71,.72); border-radius: 50%; content: ""; }
.chess-piece { z-index: 1; font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", serif; font-size: clamp(24px,5.5vw,58px); line-height: 1; user-select: none; filter: drop-shadow(0 3px 2px rgba(0,0,0,.35)); }
.chess-piece--white { color: #fff8e8; -webkit-text-stroke: .45px #31404d; text-shadow: 0 1px 0 #58636b; }
.chess-piece--black { color: #1d2632; -webkit-text-stroke: .4px #e1e6dc; text-shadow: 0 1px 0 rgba(255,255,255,.2); }
.chess-coordinate { position: absolute; z-index: 2; font-size: clamp(8px,1.1vw,11px); font-weight: 800; line-height: 1; pointer-events: none; }
.chess-coordinate--rank { top: 4px; left: 5px; }
.chess-coordinate--file { right: 5px; bottom: 4px; }
.is-light .chess-coordinate { color: #526173; }
.is-dark .chess-coordinate { color: #e2eadf; }
.chess-side-panel { display: flex; min-height: 400px; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: rgba(9,15,25,.52); }
.chess-side-panel__top { display: flex; align-items: center; justify-content: space-between; gap: 9px; color: var(--text-muted); }
.chess-side-panel__top label { display: flex; align-items: center; gap: 6px; font-size: 9px; }
.chess-side-panel__top select { min-height: 30px; padding: 4px 7px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg-panel); color: var(--text-main); font-size: 10px; }
.chess-move-list { display: grid; grid-template-columns: 1fr; align-content: start; gap: 3px; min-height: 120px; max-height: 480px; margin: 0; padding: 5px 0; overflow: auto; list-style: none; color: var(--text-main); font: 12px/1.5 ui-monospace,Consolas,monospace; }
.chess-move-list li { display: grid; grid-template-columns: 34px 1fr 1fr; gap: 8px; padding: 5px 7px; border-radius: 6px; }
.chess-move-list li:nth-child(even) { background: rgba(255,255,255,.035); }
.chess-move-list li span { color: var(--text-muted); }
.chess-side-panel #chess-resign, .chess-side-panel #chess-return { width: 100%; margin-top: auto; }
.check-field { display: flex; align-items: center; gap: 10px; color: var(--text-secondary); font-size: 11px; }
.check-field input { width: 17px; height: 17px; accent-color: var(--primary); }
.admin-toolbar { display: flex; align-items: end; gap: 14px; margin-bottom: 22px; }
.admin-toolbar label { display: grid; gap: 6px; color: var(--text-muted); font-size: 10px; }
.admin-toolbar select, .admin-toolbar input, .admin-report input, .admin-user input, .admin-user select { min-height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: #121722; color: var(--text-main); font-size: 10px; }
.admin-toolbar form { display: flex; gap: 7px; }
.admin-toolbar .button { min-height: 38px; }
#page-admin > h2 { margin: 24px 0 10px; font-size: 14px; }
.admin-report, .admin-user { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-panel); }
.admin-report > strong { flex: 1 0 100%; color: var(--text-main); font-size: 11px; }
.admin-report > p { flex: 1 0 100%; margin: 0; color: var(--text-secondary); font-size: 11px; line-height: 1.55; }
.admin-report blockquote { flex: 1 0 100%; margin: 0; padding: 9px 11px; border-left: 2px solid var(--danger); background: rgba(237,99,123,.06); color: var(--text-secondary); font-size: 10px; white-space: pre-wrap; }
.admin-report input { flex: 1 1 220px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-actions .button, .admin-user .button { min-height: 33px; padding: 0 9px; font-size: 9px; }
.admin-user > strong { margin-right: auto; font-size: 11px; }
.admin-user > input { min-width: 110px; }
.admin-login-history { margin-top: 26px; padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-panel); }
.admin-login-history h2 { margin: 0 0 7px; font-size: 15px; }
.login-history-filters { flex-wrap: wrap; margin: 14px 0 8px; }
.login-history-filters label { flex: 1 1 150px; }
.login-history-table-wrap { max-width: 100%; overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-main); }
.login-history-table { width: 100%; min-width: 820px; border-collapse: collapse; font-size: 11px; text-align: left; }
.login-history-table th, .login-history-table td { padding: 10px 11px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.login-history-table th { color: var(--text-muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.login-history-table td { color: var(--text-secondary); }
.login-history-table tbody tr:last-child td { border-bottom: 0; }
.login-history-ip { padding: 3px 0; border: 0; background: transparent; color: var(--accent-contrast); font: 11px ui-monospace, Consolas, monospace; cursor: copy; }
.login-history-ip:hover { text-decoration: underline; text-underline-offset: 3px; }
.login-history-delete { min-height: 31px !important; padding: 0 8px !important; }
.login-history-pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.login-history-pager .button { min-height: 34px; }
.login-history-pager button:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width:680px){.admin-toolbar{align-items:stretch;flex-direction:column}.admin-toolbar label,.admin-toolbar form{width:100%}.admin-toolbar form input{flex:1}.admin-user{align-items:stretch}.admin-user>*{max-width:100%}.admin-user>strong{flex:1 0 100%}}
@media (max-width: 1100px) { .home-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .main-nav { max-width: 52vw; } }
@media (max-width: 980px) {
    .chat-layout { position: relative; grid-template-columns: 210px minmax(0,1fr); }
    .chat-main { min-height: min(600px, calc(100dvh - 110px - env(safe-area-inset-bottom))); }
    .chat-members { display: none; }
    .room-members-toggle { position: absolute; z-index: 4; top: 8px; right: 8px; display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid var(--border); border-radius: 11px; background: var(--bg-card); color: var(--text-main); font-size: 23px; line-height: 1; touch-action: manipulation; }
    .chat-layout[data-members-open="true"] .chat-members { position: absolute; z-index: 30; top: 8px; right: 8px; display: flex; width: min(320px, calc(100% - 16px)); max-height: min(68vh, 480px); max-height: min(68dvh, 480px, calc(100dvh - 128px - env(safe-area-inset-bottom))); min-height: 0; padding: 12px; overflow: hidden; overscroll-behavior: contain; border-color: var(--border); background: var(--bg-panel); box-shadow: 0 18px 55px rgba(0,0,0,.62); backdrop-filter: none; }
}
@media (max-width: 680px) {
    .arena-shell { min-height: 100dvh; padding: 0 12px 18px; }
    .arena-header { min-height: 58px; gap: 8px; }
    .arena-header .brand { gap: 7px; }
    .arena-header .brand__mark { width: 30px; height: 30px; }
    .arena-header .brand__name { font-size: 12px; letter-spacing: .1em; }
    .main-nav { display: none; }
    .arena-account { gap: 7px; font-size: 10px; }
    .arena-account .button { min-height: 32px; padding: 0 9px; font-size: 10px; }
    #arena-shell[data-active-page="messages"] > .arena-header { min-height: 38px; justify-content: flex-end; }
    #arena-shell[data-active-page="messages"] > .mobile-chat-nav { margin-top: 0; }
    #arena-shell[data-active-page="messages"][data-dm-view="chat"] > .mobile-chat-nav { display: none; }
    .mobile-chat-nav { position: sticky; top: env(safe-area-inset-top); z-index: 20; display: flex; width: 100%; min-height: 42px; align-items: center; gap: 5px; overflow-x: auto; margin: 0 auto; padding: 4px 0; border-bottom: 1px solid var(--border); background: var(--bg-main); scrollbar-width: none; }
    .mobile-chat-nav::-webkit-scrollbar { display: none; }
    .mobile-chat-nav button { flex: 0 0 auto; min-height: 34px; padding: 0 11px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text-muted); font-size: 11px; white-space: nowrap; }
    .mobile-chat-nav button.is-active { background: rgba(var(--accent-rgb), .16); color: var(--accent-contrast); }
    .mobile-chat-nav .theme-picker--mobile { position: sticky; right: 0; z-index: 2; flex: 0 0 auto; margin-left: auto; padding-left: 7px; background: var(--bg-main); }
    .mobile-chat-nav .theme-picker--mobile select { min-height: 34px; max-width: 108px; padding-left: 7px; padding-right: 20px; font-size: 10px; }
    .chat-layout { position: relative; display: block; min-height: calc(100dvh - 144px - env(safe-area-inset-bottom)); padding-top: 8px; }
    .chat-sidebar, .chat-main, .chat-members { display: none; min-height: calc(100dvh - 148px - env(safe-area-inset-bottom)); border-radius: 15px; }
    .chat-layout[data-mobile-view="rooms"] .chat-sidebar, .chat-layout[data-mobile-view="chat"] .chat-main { display: flex; }
    .chat-members { display: none !important; }
    .chat-layout[data-members-open="true"] .chat-members { display: flex !important; }
    .chat-layout[data-members-open="true"] .chat-members { inset-inline: 8px 8px; width: auto; }
    .chat-layout[data-members-open="true"] .online-user__menu-trigger { width: 44px; height: 44px; flex-basis: 44px; }
    .chat-layout[data-members-open="true"] .members-panel-toggle { width: 44px; height: 44px; flex-basis: 44px; }
    .chat-main { height: calc(100dvh - 110px - env(safe-area-inset-bottom)); min-height: min(440px, calc(100dvh - 110px - env(safe-area-inset-bottom))); }
    .chat-messages { padding: 58px 8px 16px; }
    .chat-message { grid-template-columns: 36px minmax(0,1fr); gap: 9px; }
    .chat-avatar, .chat-profile-trigger { width: 36px; height: 36px; }
    .chat-profile-trigger { flex-basis: 36px; border-radius: 50%; }
    .chat-avatar { border-radius: 50%; }
    .message-meta .chat-user-trigger { font-size: 12px; }
    .message-meta time { font-size: 10px; }
    .message-content { font-size: 14px; line-height: 1.55; }
    .room-members-toggle[aria-expanded="true"] { border-color: rgba(var(--accent-rgb), .7); background: rgba(var(--accent-rgb), .17); color: var(--accent-contrast); }
    .chat-composer { width: 100%; max-width: none; gap: 5px; margin: 2px 0 max(10px, env(safe-area-inset-bottom)); padding: 2px 7px; border-radius: 999px; }
    .chat-composer textarea { min-height: 42px; max-height: 100px; padding: 2px; }
    .emoji-toggle { width: 36px; height: 40px; flex-basis: 36px; font-size: 23px; }
    .chat-composer .attach-button { width: 36px; height: 40px; flex-basis: 36px; font-size: 21px; }
    .send-button { width: 48px; height: 48px; flex-basis: 48px; }
    .chat-photo-pending { width: 100%; margin: 0 0 7px; padding: 7px; }
    .emoji-picker { right: 8px; bottom: 62px; width: calc(100% - 16px); max-height: min(260px, 42dvh); gap: 2px; padding: 7px; }
    .emoji-picker__item { min-height: 35px; font-size: 21px; }
    .app-page { min-height: calc(100dvh - 140px - env(safe-area-inset-bottom)); padding: 24px 0 18px; }
    .page-title { margin-bottom: 18px; }
    .home-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
    .feature-card { min-height: 185px; padding: 13px; }
    .feature-card h2 { font-size: 14px; }
    .feature-card .button { min-height: 36px; padding: 0 9px; font-size: 9px; }
    .dm-layout { display: block; width: 100%; min-height: 0; }
    .dm-list-panel { display: block; min-height: calc(100dvh - 180px - env(safe-area-inset-bottom)); padding: 12px; }
    .dm-chat-panel { display: none; height: calc(100dvh - 150px - env(safe-area-inset-bottom)); min-height: 360px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
    #page-messages[data-dm-view="chat"] .dm-list-panel { display: none; }
    #page-messages[data-dm-view="chat"] .dm-chat-panel { display: flex; }
    .dm-header { min-height: 40px; padding: 3px 7px; }
    .dm-header__identity { display: flex; min-width: 0; align-items: center; gap: 6px; }
    .dm-profile-name { max-width: 42vw; font-size: 13px; }
    .dm-profile-avatar, .dm-profile-avatar__image { width: 29px; height: 29px; }
    .dm-profile-avatar { flex-basis: 29px; }
    .dm-back { display: inline-flex !important; min-height: 32px !important; padding: 0 8px !important; }
    .dm-actions { gap: 4px; }
    .dm-actions .button { padding: 0 7px; font-size: 8px; }
    .dm-messages { min-height: 0; padding: 8px 4px 4px; }
    .dm-message-row { max-width: min(96%, 560px); gap: 7px; }
    .dm-message { width: fit-content; max-width: 100%; padding: 6px 10px; font-size: 14px; line-height: 1.5; }
    .dm-message-avatar-trigger, .dm-message-avatar { width: 34px; height: 34px; flex-basis: 34px; }
    .dm-message-footer { margin-top: 2px; }
    #page-messages.app-page { width: calc(100% + 24px); min-height: 0; margin: 0 -12px -18px; padding: 0; }
    #page-messages .dm-layout { width: 100%; }
    #page-messages[data-dm-view="chat"] .dm-chat-panel { width: 100%; }
    #page-messages[data-dm-view="chat"] .dm-chat-panel { height: calc(100dvh - 112px - env(safe-area-inset-bottom)); min-height: 0; }
    #dm-composer { margin: 0 0 env(safe-area-inset-bottom); }
    #dm-input, #chat-input { min-height: 44px; font-size: 16px; }
    #arena-shell[data-active-page="messages"][data-dm-view="chat"] { width: 100%; height: 100dvh; min-height: 0; overflow: hidden; padding: 0; }
    #arena-shell[data-active-page="messages"][data-dm-view="chat"] > .arena-header,
    #arena-shell[data-active-page="messages"][data-dm-view="chat"] > .mobile-chat-nav { display: none; }
    #arena-shell[data-active-page="messages"][data-dm-view="chat"] > #page-messages.app-page { position: fixed; z-index: 30; inset: 0; width: 100vw; height: 100dvh; min-height: 0; margin: 0; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
    #arena-shell[data-active-page="messages"][data-dm-view="chat"] .dm-layout { display: block; width: 100%; height: 100%; min-height: 0; }
    #arena-shell[data-active-page="messages"][data-dm-view="chat"] .dm-chat-panel { width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; }
    #arena-shell[data-active-page="messages"][data-dm-view="chat"] .dm-header { min-height: 40px; flex: 0 0 auto; border-radius: 0; }
    #arena-shell[data-active-page="messages"][data-dm-view="chat"] .dm-messages { flex: 1 1 auto; }
    #arena-shell[data-active-page="messages"][data-dm-view="chat"] #dm-composer { flex: 0 0 auto; margin-bottom: 0; padding-bottom: max(3px, env(safe-area-inset-bottom)); }
    .friends-columns { grid-template-columns: 1fr; gap: 10px; }
    .friends-columns section { padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-panel); }
    .game-cards, .profile-layout, .help-grid { grid-template-columns: minmax(0,1fr); }
    .game-card { min-height: 210px; grid-template-columns: 100px minmax(0,1fr); padding: 15px; }
    .game-card__art { border-radius: 18px; }
    .game-card h2 { font-size: 18px; }
    .game-card__tag { top: 10px; right: 10px; }
    .ranking-controls { flex-direction: column; }
    .ranking-controls label { width: 100%; }
    .profile-layout { gap: 10px; }
    .settings-card, .profile-summary { padding: 15px; }
    .notification-row { padding: 9px; }
    .football-controls button { min-width: 55px; min-height: 54px; }
}

@media (max-height: 500px) and (max-width: 980px) {
    .chat-layout[data-members-open="true"] .chat-members { max-height: min(78vh, 480px); max-height: min(78dvh, 480px, calc(100dvh - 128px - env(safe-area-inset-bottom))); padding-block: 8px; }
    .chat-layout[data-members-open="true"] .panel-heading { padding-bottom: 8px; }
    .chat-layout[data-members-open="true"] .online-footnote { padding-block: 7px 2px; }
}

.dm-back { display: none; }
.recovery-code-dialog { width: min(520px,calc(100% - 28px)); max-height: min(88dvh,740px); padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 18px; background: #111621; color: var(--text-main); box-shadow: 0 24px 90px rgba(0,0,0,.62); }
.recovery-code-dialog::backdrop { background: rgba(3,5,12,.82); backdrop-filter: blur(6px); }
.recovery-code-dialog .settings-card { display: grid; max-width: none; margin: 0; border: 0; box-shadow: none; }
.recovery-code-value { display: block; overflow-wrap: anywhere; padding: 15px; border: 1px solid var(--border); border-radius: 10px; background: #090c14; color: #a8ffdb; font: 700 16px/1.6 ui-monospace,SFMono-Regular,Consolas,monospace; text-align: center; user-select: all; }
.recovery-code-dialog form[method="dialog"] { display: flex; justify-content: flex-end; }
.recovery-rotate-form { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.message-delete { display: block; margin: 4px 0 0 auto; padding: 2px 4px; border: 0; background: transparent; color: var(--text-muted); font-size: 9px; cursor: pointer; }
.message-delete:hover { color: var(--danger); }
.image-preview { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(5,7,13,.92); }
.image-preview img { max-width: min(94vw,1200px); max-height: 88dvh; object-fit: contain; border-radius: 12px; }
.image-preview__close { position: absolute; top: max(15px,env(safe-area-inset-top)); right: 15px; }

/* Per-browser color palettes. The selected value is stored only in this browser. */
:root[data-theme="gold"] { --accent-rgb: 232, 185, 67; --cyan: #e8b943; --cyan-deep: #bd861c; --cyan-bright: #ffe09a; --accent-contrast: #ffe09a; --primary-text: #17120a; --primary: #e8b943; --primary-hover: #bd861c; --accent: #e8b943; }
:root[data-theme="silver"] { --accent-rgb: 190, 201, 216; --cyan: #bec9d8; --cyan-deep: #8794a8; --cyan-bright: #e4eaf2; --accent-contrast: #e4eaf2; --primary-text: #111722; --primary: #bec9d8; --primary-hover: #8794a8; --accent: #bec9d8; }
:root[data-theme="navy"] { --accent-rgb: 79, 125, 255; --cyan: #4f7dff; --cyan-deep: #285bd6; --cyan-bright: #86a5ff; --accent-contrast: #bdceff; --primary: #4f7dff; --primary-hover: #3c68e0; --accent: #4f7dff; }
:root[data-theme="emerald"] { --accent-rgb: 46, 201, 143; --cyan: #2ec98f; --cyan-deep: #159767; --cyan-bright: #83f0c4; --accent-contrast: #a2f2d1; --primary-text: #071710; --primary: #2ec98f; --primary-hover: #159767; --accent: #2ec98f; }
:root[data-theme="crimson"] { --accent-rgb: 231, 62, 79; --cyan: #e73e4f; --cyan-deep: #b82036; --cyan-bright: #ff8290; --accent-contrast: #ffb5bd; --primary-text: #23090d; --primary: #e73e4f; --primary-hover: #c52b40; --accent: #e73e4f; }
:root[data-theme="white"] { --accent-rgb: 242, 246, 255; --cyan: #f2f6ff; --cyan-deep: #c6d0e3; --cyan-bright: #ffffff; --accent-contrast: #ffffff; --primary-text: #111722; --primary: #f2f6ff; --primary-hover: #c6d0e3; --accent: #f2f6ff; }
:root[data-theme="black"] { --bg: #030405; --bg-main: #050608; --bg-panel: #0b0d10; --bg-card: #12151a; --bg-hover: #20242b; --accent-rgb: 145, 154, 169; --cyan: #919aa9; --cyan-deep: #687282; --cyan-bright: #c5ccd6; --accent-contrast: #d3d8e0; --primary: #919aa9; --primary-hover: #687282; --accent: #919aa9; }
.theme-picker { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.theme-picker select { min-height: 36px; padding: 0 27px 0 10px; border: 1px solid var(--line); border-radius: 9px; outline: none; background: var(--surface-soft); color: var(--text); font: inherit; cursor: pointer; }
.theme-picker select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
@media (max-width: 520px) { .topbar__actions { gap: 8px; } .theme-picker { gap: 4px; font-size: 9px; } .theme-picker select { min-height: 34px; padding-left: 7px; padding-right: 21px; font-size: 10px; } }

/* Carry the selected palette across cards, panels and the authenticated app. */
:root[data-theme="gold"] { --bg: #100d08; --surface: #1a150d; --surface-soft: #241c0e; --line: rgba(232,185,67,.24); --bg-main: #120f09; --bg-panel: #21190c; --bg-card: #30230f; --bg-hover: #433216; --border: #725522; }
:root[data-theme="silver"] { --bg: #0a0d12; --surface: #151a22; --surface-soft: #202631; --line: rgba(190,201,216,.24); --bg-main: #0e1219; --bg-panel: #1b202a; --bg-card: #292f3b; --bg-hover: #3a424f; --border: #566172; }
:root[data-theme="navy"] { --bg: #080b14; --surface: #10182a; --surface-soft: #17233a; --line: rgba(79,125,255,.26); --bg-main: #0c1220; --bg-panel: #121e35; --bg-card: #192a49; --bg-hover: #233b63; --border: #304f84; }
:root[data-theme="emerald"] { --bg: #07110e; --surface: #0e1d17; --surface-soft: #13271e; --line: rgba(46,201,143,.25); --bg-main: #0a1712; --bg-panel: #10271e; --bg-card: #15382a; --bg-hover: #1e4c38; --border: #287853; }
:root[data-theme="crimson"] { --bg: #12090c; --surface: #1d0d12; --surface-soft: #2b1119; --line: rgba(231,62,79,.26); --bg-main: #150a0e; --bg-panel: #241018; --bg-card: #35151f; --bg-hover: #4b1b28; --border: #793040; }
:root[data-theme="white"] { --bg: #0d1017; --surface: #171b25; --surface-soft: #222733; --line: rgba(242,246,255,.26); --bg-main: #11151e; --bg-panel: #1d222d; --bg-card: #2b313d; --bg-hover: #3b4351; --border: #596272; }
:root[data-theme="black"] { --line: rgba(145,154,169,.2); --border: #343a43; }
.topbar { background: linear-gradient(90deg, rgba(var(--accent-rgb), .16), rgba(var(--accent-rgb), .035) 72%, transparent); border-bottom-color: rgba(var(--accent-rgb), .32); }
.auth-card { border-color: rgba(var(--accent-rgb), .42); background: linear-gradient(145deg, color-mix(in srgb, #151b2d 76%, var(--cyan) 24%), color-mix(in srgb, #101626 82%, var(--cyan) 18%)); box-shadow: 0 28px 90px rgba(0,0,0,.3), 0 0 48px rgba(var(--accent-rgb), .12); }
.arena-shell { background: radial-gradient(ellipse at 8% 0%, rgba(var(--accent-rgb), .14), transparent 38%), var(--bg-main); }
.chat-sidebar, .chat-main, .chat-members { background: color-mix(in srgb, var(--bg-panel) 88%, var(--cyan) 12%); }
.feature-card, .settings-card, .game-card, .dm-list-panel, .dm-chat-panel, .profile-summary { background-color: color-mix(in srgb, var(--bg-panel) 86%, var(--cyan) 14%); border-color: var(--border); }
.chat-composer { background: var(--bg-card); }
.room-header, .dm-header, .panel-heading { border-color: rgba(var(--accent-rgb), .28); }
.room-button.is-active, .dm-row.is-active, .main-nav button.is-active { box-shadow: inset 3px 0 0 var(--cyan), 0 0 22px rgba(var(--accent-rgb), .12); }
.settings-card .field textarea, .settings-card .field select, .settings-card .field input, .admin-toolbar select, .admin-toolbar input, .admin-report input, .admin-user input, .admin-user select { background: color-mix(in srgb, var(--bg-main) 85%, var(--cyan) 15%); border-color: rgba(var(--accent-rgb), .32); }
@media (max-width: 760px) {
    .chess-stage { padding: 10px; border-radius: 15px; }
    .chess-match-layout { grid-template-columns: minmax(0,1fr); gap: 10px; }
    .chess-board { max-width: min(100%, 620px); margin: 0 auto; border-width: 3px; border-radius: 9px; }
    .chess-side-panel { min-height: 0; gap: 8px; padding: 10px; }
    .chess-move-list { grid-template-columns: 1fr 1fr; min-height: 54px; max-height: 120px; }
    .chess-match-header { grid-template-columns: 1fr auto 1fr; gap: 5px; padding-bottom: 12px; }
    .chess-turn-status { max-width: 145px; padding: 7px 9px; font-size: 9px; }
}
@media (max-width: 420px) {
    .chess-stage { margin-inline: -6px; padding: 7px; }
    .chess-match-header > div { font-size: 10px; }
    .chess-match-header .eyebrow-small { font-size: 7px; }
    .chess-turn-status { max-width: 110px; font-size: 8px; }
    .chess-piece { font-size: clamp(23px, 9vw, 38px); }
}
#football-orientation-hint { display: none; margin: 8px 0 0; color: var(--text-muted); font-size: 10px; text-align: center; }
@media (max-width: 760px) {
    .football-controls { position: sticky; bottom: 8px; z-index: 5; gap: 7px; margin: 10px 0 0; padding: 8px; border: 1px solid var(--border); border-radius: 15px; background: rgba(10,15,24,.92); backdrop-filter: blur(10px); }
    .football-controls button { min-width: 0; min-height: 58px; flex: 1 1 0; font-size: 13px; font-weight: 800; }
}
@media (max-width: 760px) and (orientation: portrait) { #football-orientation-hint { display: block; } }
@media (max-width: 360px) { .football-controls { gap: 4px; padding: 5px; } .football-controls button { min-height: 54px; font-size: 11px; } }
