/* Styles for 3d.html.
   Moved verbatim out of the page's inline <style> block: an inline block must be
   listed by sha256 in the Content-Security-Policy, so any edit to it silently
   renders the page unstyled unless nginx is re-pinned in the same change. An
   external file is covered by style-src 'self' and needs no hashes at all.
   This file must stay linked AFTER registration-verification.css, which is where
   the inline block used to sit. */
        canvas { width: 100%; height: 100%; touch-action: none; }
        body { margin: 0; overflow: hidden; background: #111; font-family: sans-serif; }

        #ui { position: absolute; top: 20px; left: 210px; color: white; }
        #ui h1 { margin: 0 0 4px; font-size: 18px; }
        #status { pointer-events: none; margin: 4px 0 0; }
        #score  { pointer-events: none; font-size: 12px; margin-top: 4px; opacity: 0.75; }

        /* ── PvP controls ─────────────────────────────────────── */
        #pvpControls {
            display: none;
            margin-top: 8px;
            gap: 8px;
        }
        .pvp-btn {
            background: rgba(255,255,255,0.12);
            color: white;
            border: 1px solid rgba(255,255,255,0.3);
            border-radius: 4px;
            padding: 4px 12px;
            font-size: 13px;
            cursor: pointer;
        }
        .pvp-btn:hover { background: rgba(255,255,255,0.22); }
        .pvp-btn.resign:hover { background: rgba(255,50,50,0.3); border-color: rgba(255,50,50,0.6); }

        /* ── Auth UI ──────────────────────────────────────────── */
        #authBtn {
            margin-top: 10px;
            background: rgba(100,160,255,0.18);
            color: #7eb8ff;
            border: 1px solid rgba(100,160,255,0.45);
            border-radius: 4px;
            padding: 4px 14px;
            font-size: 13px;
            cursor: pointer;
            display: block;
        }
        #authBtn:hover { background: rgba(100,160,255,0.32); }
        #userBadge {
            margin-top: 10px;
            font-size: 13px;
            color: #7eb8ff;
            display: none;
            align-items: center;
            gap: 6px;
        }
        #userBadge span { opacity: 0.9; }
        #logoutBtn {
            background: none;
            border: 1px solid rgba(100,160,255,0.4);
            color: #7eb8ff;
            border-radius: 4px;
            padding: 2px 8px;
            font-size: 12px;
            cursor: pointer;
        }
        #logoutBtn:hover { background: rgba(100,160,255,0.18); }

        /* Link to AI mode */
        #aiLink {
            display: block;
            margin-top: 12px;
            background: rgba(100,160,255,0.15);
            color: #7eb8ff;
            border: 1px solid rgba(100,160,255,0.4);
            border-radius: 4px;
            padding: 4px 12px;
            font-size: 13px;
            text-decoration: none;
            text-align: center;
        }
        #aiLink:hover { background: rgba(100,160,255,0.28); }

        /* ── Auth modal ───────────────────────────────────────── */
        #authOverlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.72);
            z-index: 2000;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(4px);
        }
        #authOverlay.active { display: flex; }
        #authModal {
            background: linear-gradient(160deg,#1a1f2e,#10141d);
            border: 1px solid rgba(100,160,255,0.25);
            border-radius: 14px;
            padding: 32px 36px;
            width: 340px;
            box-shadow: 0 8px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04);
            position: relative;
        }
        #authModal h2 { margin: 0 0 20px; font-size: 20px; font-weight: 700; color: #fff; letter-spacing: 1px; }
        .auth-tabs {
            display: flex;
            gap: 4px;
            margin-bottom: 22px;
            border-bottom: 1px solid rgba(255,255,255,0.1);
            padding-bottom: 0;
        }
        .auth-tab {
            background: none;
            border: none;
            color: rgba(255,255,255,0.45);
            font-size: 14px;
            padding: 6px 16px 10px;
            cursor: pointer;
            border-bottom: 2px solid transparent;
            margin-bottom: -1px;
            transition: color 0.2s, border-color 0.2s;
        }
        .auth-tab.active { color: #7eb8ff; border-bottom-color: #7eb8ff; }
        .auth-field { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
        .auth-field input {
            background: rgba(255,255,255,0.07);
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 6px;
            padding: 10px 14px;
            color: #fff;
            font-size: 14px;
            outline: none;
            transition: border-color 0.2s;
        }
        .auth-field input:focus { border-color: rgba(100,160,255,0.6); }
        .auth-field input::placeholder { color: rgba(255,255,255,0.3); }
        #authSubmit {
            width: 100%;
            padding: 11px;
            background: linear-gradient(135deg,#3a7bd5,#2563b0);
            color: #fff;
            border: none;
            border-radius: 7px;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            transition: opacity 0.2s;
        }
        #authSubmit:hover { opacity: 0.88; }
        #authMsg { margin-top: 12px; font-size: 13px; min-height: 18px; text-align: center; }
        #authMsg.error   { color: #ff7b7b; }
        #authMsg.success { color: #6ddb8f; }
        #authClose {
            position: absolute;
            top: 14px; right: 18px;
            background: none;
            border: none;
            color: rgba(255,255,255,0.4);
            font-size: 22px;
            cursor: pointer;
            line-height: 1;
        }
        #authClose:hover { color: #fff; }

        /* ── Admin panel ──────────────────────────────────────── */
        #adminBtn {
            margin-top: 6px;
            background: rgba(255,180,0,0.15);
            color: #ffc433;
            border: 1px solid rgba(255,180,0,0.4);
            border-radius: 4px;
            padding: 4px 14px;
            font-size: 13px;
            cursor: pointer;
            display: none;
        }
        #adminBtn:hover { background: rgba(255,180,0,0.28); }
        #usersPanel {
            position: fixed;
            left: 0; top: 0; bottom: 0;
            width: 190px;
            background: linear-gradient(180deg, rgba(10,14,24,0.97) 0%, rgba(16,20,30,0.97) 100%);
            border-right: 1px solid rgba(100,160,255,0.12);
            display: flex;
            flex-direction: column;
            z-index: 100;
            backdrop-filter: blur(8px);
        }
        #usersPanel h3 {
            margin: 0;
            padding: 16px 14px 10px;
            font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
            color: rgba(100,160,255,0.6);
            border-bottom: 1px solid rgba(100,160,255,0.1);
            flex-shrink: 0;
        }
        #usersList { flex: 1; overflow-y: auto; padding: 8px 0; }
        #usersList::-webkit-scrollbar { width: 3px; }
        #usersList::-webkit-scrollbar-track { background: transparent; }
        #usersList::-webkit-scrollbar-thumb { background: rgba(100,160,255,0.2); border-radius: 2px; }
        .users-item {
            display: flex; align-items: center; gap: 8px;
            padding: 7px 14px; font-size: 13px;
            color: rgba(255,255,255,0.7);
            transition: background 0.15s; cursor: default;
        }
        .users-item:hover { background: rgba(100,160,255,0.06); }
        .users-item.me { color: #7eb8ff; font-weight: 600; }
        .users-item .u-avatar {
            width: 26px; height: 26px; border-radius: 50%;
            background: rgba(100,160,255,0.1);
            border: 1px solid rgba(100,160,255,0.2);
            display: flex; align-items: center; justify-content: center;
            font-size: 12px; flex-shrink: 0; color: rgba(100,160,255,0.7);
        }
        .users-item.me .u-avatar {
            background: rgba(100,160,255,0.22);
            border-color: rgba(100,160,255,0.5);
            color: #7eb8ff;
        }
        .users-item .u-name {
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
        }
        #usersPanelCount {
            padding: 10px 14px; font-size: 11px;
            color: rgba(255,255,255,0.3);
            border-top: 1px solid rgba(100,160,255,0.08); flex-shrink: 0;
        }
        .u-online-dot {
            width: 8px; height: 8px; border-radius: 50%;
            background: #6ddb8f;
            box-shadow: 0 0 5px rgba(109,219,143,0.5);
            margin-left: auto; display: none;
        }
        .users-item.online .u-online-dot { display: block; }
        .u-challenge-btn {
            background: rgba(100,160,255,0.15); color: #7eb8ff;
            border: 1px solid rgba(100,160,255,0.3);
            border-radius: 4px; padding: 2px 6px; font-size: 11px; cursor: pointer;
            margin-left: 6px; display: none;
        }
        .u-challenge-btn:hover { background: rgba(100,160,255,0.3); }
        .users-item.online:hover:not(.me) .u-challenge-btn { display: block; }
        .users-item.online:hover:not(.me) .u-online-dot    { display: none; }
        .u-rating {
            font-size: 10px;
            color: rgba(255,215,0,0.65);
            flex-shrink: 0;
            margin-left: 4px;
        }

        /* ── Challenge modal ──────────────────────────────────── */
        #challengeModal {
            display: none;
            position: fixed; top: 50%; left: 50%;
            transform: translate(-50%, -50%) scale(0.95);
            background: linear-gradient(160deg,#2e1e4a,#1a102e);
            border: 1px solid rgba(180,100,255,0.3);
            border-radius: 12px; padding: 24px 32px;
            z-index: 2500;
            box-shadow: 0 10px 40px rgba(0,0,0,0.8);
            text-align: center; color: #fff; opacity: 0;
            transition: opacity 0.2s, transform 0.2s;
        }
        #challengeModal.active { display: block; opacity: 1; transform: translate(-50%, -50%) scale(1); }
        #challengeModal h3 { margin: 0 0 10px; color: #d4a5ff; }
        #challengeModal p  { margin: 0 0 20px; font-size: 14px; opacity: 0.8; }
        .ch-btn-row { display: flex; justify-content: center; gap: 12px; }
        .ch-btn { padding: 6px 16px; border-radius: 4px; font-size: 13px; cursor: pointer; border: 1px solid transparent; }
        .ch-btn.accept  { background: rgba(109,219,143,0.2); color: #6ddb8f; border-color: rgba(109,219,143,0.5); }
        .ch-btn.accept:hover  { background: rgba(109,219,143,0.3); }
        .ch-btn.decline { background: rgba(255,123,123,0.15); color: #ff7b7b; border-color: rgba(255,123,123,0.4); }
        .ch-btn.decline:hover { background: rgba(255,123,123,0.25); }

        /* ── Draw offer modal ────────────────────────────────── */
        #drawOfferModal {
            display: none;
            position: fixed; top: 50%; left: 50%;
            transform: translate(-50%, -50%) scale(0.95);
            background: linear-gradient(160deg,#1a2e1e,#102e10);
            border: 1px solid rgba(100,255,100,0.3);
            border-radius: 12px; padding: 24px 32px;
            z-index: 2500;
            box-shadow: 0 10px 40px rgba(0,0,0,0.8);
            text-align: center; color: #fff; opacity: 0;
            transition: opacity 0.2s, transform 0.2s;
        }
        #drawOfferModal.active { display: block; opacity: 1; transform: translate(-50%, -50%) scale(1); }
        #drawOfferModal h3 { margin: 0 0 10px; color: #6ddb8f; }
        #drawOfferModal p  { margin: 0 0 20px; font-size: 14px; opacity: 0.8; }

        /* ── Popups ───────────────────────────────────────────── */
        #checkPopup {
            display: none; position: fixed; top: 50%; left: 50%;
            transform: translate(-50%, -50%) scale(0.6);
            background: linear-gradient(135deg, #c0392b, #8e0000);
            color: #fff; font-size: 80px; font-weight: 900; letter-spacing: 8px;
            padding: 28px 64px; border-radius: 18px;
            box-shadow: 0 0 60px rgba(255,60,60,0.7), 0 0 120px rgba(255,0,0,0.3);
            pointer-events: none; z-index: 999; opacity: 0;
            transition: opacity 0.15s ease, transform 0.15s ease;
            text-shadow: 0 2px 12px rgba(0,0,0,0.5);
        }
        #checkPopup.show { display: block; opacity: 1; transform: translate(-50%, -50%) scale(1); }

        #drawPopup {
            display: none; position: fixed; top: 50%; left: 50%;
            transform: translate(-50%, -50%) scale(0.6);
            background: linear-gradient(135deg, #2471a3, #0a3d62);
            color: #fff; font-size: 80px; font-weight: 900; letter-spacing: 8px;
            padding: 28px 64px; border-radius: 18px;
            box-shadow: 0 0 60px rgba(36,113,163,0.7), 0 0 120px rgba(10,61,98,0.4);
            pointer-events: none; z-index: 999; opacity: 0;
            transition: opacity 0.15s ease, transform 0.15s ease;
            text-shadow: 0 2px 12px rgba(0,0,0,0.5);
        }
        #drawPopup.show { display: block; opacity: 1; transform: translate(-50%, -50%) scale(1); }

        #stalematePopup {
            display: none; position: fixed; top: 50%; left: 50%;
            transform: translate(-50%, -50%) scale(0.6);
            background: linear-gradient(135deg, #6c3483, #3b1a5a);
            color: #fff; font-size: 68px; font-weight: 900; letter-spacing: 6px;
            padding: 28px 64px; border-radius: 18px;
            box-shadow: 0 0 60px rgba(155,89,182,0.7), 0 0 120px rgba(108,52,131,0.4);
            pointer-events: none; z-index: 999; opacity: 0;
            transition: opacity 0.15s ease, transform 0.15s ease;
            text-align: center; text-shadow: 0 2px 12px rgba(0,0,0,0.5); line-height: 1.2;
        }
        #stalematePopup.show { display: block; opacity: 1; transform: translate(-50%, -50%) scale(1); }

        .gameOverPopup {
            display: none; position: fixed; top: 50%; left: 50%;
            transform: translate(-50%, -50%) scale(0.6);
            color: #fff; font-size: 60px; font-weight: 900; letter-spacing: 6px;
            padding: 28px 64px; border-radius: 18px;
            pointer-events: auto; cursor: pointer; z-index: 999; opacity: 0;
            transition: opacity 0.4s ease, transform 0.4s ease;
            text-align: center; text-shadow: 0 2px 12px rgba(0,0,0,0.5); line-height: 1.2;
        }
        .gameOverPopup.show { display: block; opacity: 1; transform: translate(-50%, -50%) scale(1); }
        #whiteWinsPopup {
            background: linear-gradient(135deg, #b7950b, #7d6608);
            box-shadow: 0 0 60px rgba(241,196,15,0.7), 0 0 120px rgba(183,149,11,0.3);
        }
        #blackWinsPopup {
            background: linear-gradient(135deg, #2e2e2e, #0a0a0a);
            box-shadow: 0 0 60px rgba(180,180,180,0.5), 0 0 120px rgba(100,100,100,0.3);
        }

/* ── Converted from style="" attributes ───────────────────────────────────────
   A style="" attribute is treated like an inline block by Content-Security-
   Policy: every distinct value needs its own sha256, and a newly introduced one
   is dropped without warning. As classes they need no hashes. Each selector
   below is chosen to carry the precedence the attribute had — an attribute
   always beat a class rule, so the popup ids (one id beats one class) and the
   compound .gameOverPopup .sub-note (two classes beat .gameOverPopup's one) win
   on specificity, exactly as the attributes did. */
.gameOverPopup .sub-note {
    font-size: 20px;
    font-weight: 400;
    letter-spacing: 2px;
    opacity: 0.75;
}
#resignWinPopup {
    background: linear-gradient(135deg, #1a5c1a, #0a3d0a);
    box-shadow: 0 0 60px rgba(50, 200, 50, 0.5);
}
#resignLosePopup {
    background: linear-gradient(135deg, #5c1a1a, #3d0a0a);
    box-shadow: 0 0 60px rgba(200, 50, 50, 0.5);
}
.users-item.users-item-loading {
    opacity: 0.4;
    font-size: 12px;
    padding: 14px;
}
