/* Chess Web3 player shell: shared navigation and acquisition entry points. */
.cw3-app-nav {
    --cw3-accent: #a78bfa;
    min-height: 52px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 6px 16px;
    background: #17171d;
    border-bottom: 1px solid rgba(167, 139, 250, .18);
    color: #e8e5f2;
    position: relative;
    z-index: 120;
    flex: 0 0 auto;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Homepage: primary destinations live in the existing top header on desktop. */
.top-bar .cw3-home-header-nav {
    min-height: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    border: 0;
    background: transparent;
    position: static;
    z-index: auto;
}

.cw3-home-header-nav .cw3-nav-links {
    grid-column: auto;
    gap: 4px;
}

.cw3-home-header-nav .cw3-nav-link,
.cw3-home-header-nav .cw3-more-toggle {
    min-height: 34px;
    gap: 6px;
    padding: 0 9px;
    font-size: .76rem;
}

.cw3-home-header-nav .cw3-nav-icon { font-size: .84rem; }

.top-bar .cw3-home-header-nav .cw3-locale-toggle {
    grid-column: auto;
    justify-self: auto;
    min-width: 42px;
    min-height: 32px;
    padding: 0 7px;
}

/* Full-height utility panel, visually continuous with the top header. */
.cw3-home-utility-rail {
    position: fixed;
    z-index: 130;
    top: var(--header-height, 52px);
    bottom: 0;
    left: 0;
    width: 62px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 8px;
    border: 0;
    border-right: 1px solid var(--border-color, #454545);
    border-radius: 0;
    background: var(--bg-panel, #262626);
    box-shadow: 3px 0 14px rgba(0, 0, 0, .12);
}

.cw3-home-utility-rail > a,
.cw3-home-utility-rail .history-link.icon-only,
.cw3-home-utility-rail .history-dropdown,
.cw3-home-utility-rail .settings-menu,
.cw3-home-utility-rail .user-menu {
    width: 38px;
    height: 38px;
    margin: 0;
    flex: 0 0 38px;
}

.cw3-home-utility-rail > a,
.cw3-home-utility-rail .history-link.icon-only,
.cw3-home-utility-rail .settings-btn {
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    background-color: rgba(255, 255, 255, .035);
}

.cw3-home-utility-rail > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cw3-home-utility-rail .history-dropdown { display: block; }
.cw3-home-utility-rail .user-avatar,
.cw3-home-utility-rail .settings-btn,
.cw3-home-utility-rail .history-link.icon-only { width: 38px; height: 38px; }
.cw3-home-utility-rail .history-dropdown .dropdown-content { top: 0; left: calc(100% + 8px); margin: 0; }
.cw3-home-utility-rail .settings-dropdown { top: 0; right: auto; left: 100%; }
.cw3-home-utility-rail .user-dropdown { top: 0; right: auto; left: 100%; }
.cw3-home-utility-rail #settings-menu:hover .settings-dropdown,
.cw3-home-utility-rail #settings-menu:focus-within .settings-dropdown,
.cw3-home-utility-rail #user-menu:hover .user-dropdown,
.cw3-home-utility-rail #user-menu:focus-within .user-dropdown {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.cw3-home-utility-rail .link-tooltip { top: 50%; left: calc(100% + 7px); transform: translateY(-50%); }
.cw3-home-utility-rail .link-tooltip::before { top: 50%; left: -9px; bottom: auto; transform: translateY(-50%) rotate(-90deg); }

/* On narrow screens use the existing hamburger drawer instead of another bar. */
.cw3-home-drawer-nav {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    border: 0;
    border-bottom: 1px solid #3b3844;
    border-radius: 0;
    background: transparent;
    position: static;
    z-index: auto;
}

.cw3-home-drawer-nav .cw3-nav-links { width: 100%; display: grid; gap: 3px; }
.cw3-home-drawer-nav .cw3-nav-link,
.cw3-home-drawer-nav .cw3-more-toggle { width: 100%; min-height: 42px; justify-content: flex-start; padding: 0 10px; color: #e4e0ec; font-size: .9rem; }
.cw3-home-drawer-nav .cw3-nav-more { width: 100%; }
.cw3-more-menu-floating {
    position: fixed;
    z-index: 10030;
    right: auto;
    width: min(210px, calc(100vw - 24px));
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    margin: 0;
}
.cw3-home-drawer-nav .cw3-locale-toggle {
    align-self: stretch;
    width: 100%;
    min-height: 42px;
    grid-column: auto;
    justify-self: stretch;
    justify-content: flex-start;
    padding: 0 10px;
    color: #e4e0ec;
    font-size: .9rem;
}

.mobile-drawer .cw3-drawer-community-link {
    width: 100%;
    height: 42px;
    min-height: 42px;
    flex: 0 0 42px;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 20px;
    border: 0;
    border-radius: 0;
    color: var(--text-main);
    background: transparent;
    box-shadow: none;
    text-decoration: none;
}
.mobile-drawer .cw3-drawer-community-link .link-tooltip { display: none !important; }

.mobile-drawer .settings-menu,
.mobile-drawer .user-menu {
    width: 100%;
    height: auto;
    min-height: 42px;
    flex: 0 0 auto;
    margin: 0;
}

.mobile-drawer .settings-btn,
.mobile-drawer .user-avatar {
    width: 100%;
    height: 42px;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 20px;
    border: 0;
    border-radius: 0;
    color: var(--text-main);
    background: transparent;
    transform: none;
    box-shadow: none;
}

.mobile-drawer .settings-btn svg { width: 18px; height: 18px; }
.mobile-drawer .user-avatar #user-initial {
    width: 28px;
    height: 28px;
    display: inline-flex;
    flex: 0 0 28px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
}

.user-avatar { overflow: hidden; }
.user-avatar .avatar-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.user-avatar .avatar-photo[hidden] { display: none; }
.user-dropdown .avatar-status {
    min-height: 0;
    margin: 0;
    padding: 0 12px;
    color: #c4c0d0;
    font-size: .75rem;
}
.user-dropdown .avatar-status:empty { display: none; }
.avatar-crop-content { width: min(92vw, 430px); padding: 28px 24px 22px; }
.avatar-crop-content .modal-title { margin: 0 30px 8px; font-size: 1.45rem; }
.avatar-crop-content .modal-text { margin: 0 auto 18px; font-size: .95rem; }
#avatar-crop-canvas {
    display: block;
    width: min(72vw, 300px);
    height: min(72vw, 300px);
    margin: 0 auto 14px;
    border: 2px solid #8b5cf6;
    border-radius: 50%;
    background: #17151c;
    cursor: grab;
    touch-action: none;
}
#avatar-crop-canvas:active { cursor: grabbing; }
.avatar-zoom-label { display: block; margin: 0 auto 6px; color: var(--text-main); font-size: .85rem; }
.avatar-crop-zoom { width: min(72vw, 300px); accent-color: #8b5cf6; }
.avatar-crop-actions { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }
.avatar-crop-actions button { min-height: 42px; padding: 0 16px; border-radius: 9px; font: 700 .9rem system-ui, sans-serif; cursor: pointer; }
.avatar-crop-secondary { color: var(--text-main); background: #29272f; border: 1px solid #514b5d; }
.avatar-crop-primary { color: #fff; background: linear-gradient(135deg, #7c3aed, #8b5cf6); border: 0; }
.avatar-crop-actions button:disabled { opacity: .6; cursor: wait; }
@media (max-width: 480px) {
    .avatar-crop-content { padding: 24px 16px 18px; }
    .avatar-crop-actions button { flex: 1; padding: 0 10px; }
}
.cw3-drawer-account-label { color: var(--text-main); font: 500 1rem/1.2 system-ui, sans-serif; }

.mobile-drawer .settings-dropdown,
.mobile-drawer .user-dropdown {
    position: static;
    inset: auto;
    width: auto;
    min-width: 0;
    margin: 0 10px 6px;
    box-shadow: none;
}

.mobile-drawer .drawer-nav #logout-btn {
    width: 100%;
    min-height: 44px;
    justify-content: flex-start;
    margin-top: 0;
    border-top: 1px solid var(--border-color);
    border-radius: 0;
}

.cw3-nav-links {
    grid-column: 2;
    width: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.cw3-nav-link,
.cw3-more-toggle,
.cw3-locale-toggle {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0 14px;
    color: #bcb8c9;
    background: transparent;
    text-decoration: none;
    font: 600 .84rem/1 system-ui, -apple-system, "Segoe UI", sans-serif;
    white-space: nowrap;
    cursor: pointer;
    transition: color .16s ease, background .16s ease, border-color .16s ease;
}

.cw3-nav-icon { font-size: .96rem; line-height: 1; }

.cw3-nav-link:hover,
.cw3-more-toggle:hover,
.cw3-locale-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, .06);
}

.cw3-nav-link:focus-visible,
.cw3-more-toggle:focus-visible,
.cw3-locale-toggle:focus-visible,
.cw3-more-menu a:focus-visible {
    outline: 2px solid #c4b5fd;
    outline-offset: 2px;
}

.cw3-nav-link[aria-current="page"] {
    color: #fff;
    border-color: rgba(167, 139, 250, .42);
    background: rgba(124, 77, 255, .17);
}

.cw3-more-toggle.is-active {
    color: #fff;
    border-color: rgba(167, 139, 250, .42);
    background: rgba(124, 77, 255, .17);
}
.cw3-more-toggle[aria-current="page"]::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: #c4b5fd; }

.cw3-shell-brand {
    color: #eeeaf7;
    font: 750 .92rem/1 system-ui, -apple-system, "Segoe UI", sans-serif;
    letter-spacing: .01em;
    text-decoration: none;
    white-space: nowrap;
}

.cw3-nav-link-coach {
    color: #f4efff;
    background: linear-gradient(110deg, rgba(124, 77, 255, .25), rgba(167, 139, 250, .12));
    border-color: rgba(167, 139, 250, .3);
}

.cw3-nav-link-coach[aria-current="page"] {
    background: linear-gradient(110deg, rgba(124, 77, 255, .44), rgba(167, 139, 250, .2));
}

.cw3-nav-more {
    position: relative;
}

.cw3-more-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 210px;
    display: grid;
    gap: 4px;
    padding: 8px;
    border: 1px solid #383542;
    border-radius: 12px;
    background: #211f29;
    box-shadow: 0 16px 36px rgba(0, 0, 0, .4);
}

.cw3-more-menu[hidden] { display: none; }

.cw3-more-menu a {
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 0 11px;
    border-radius: 8px;
    color: #d6d2e0;
    text-decoration: none;
    font-size: .84rem;
}

.cw3-more-menu a:hover,
.cw3-more-menu a[aria-current="page"] {
    color: #fff;
    background: rgba(167, 139, 250, .14);
}

.cw3-locale-toggle {
    grid-column: 3;
    justify-self: end;
    min-width: 48px;
    min-height: 34px;
    margin-left: 0;
    padding: 0 9px;
    border-color: #3c3947;
    color: #d6d2e0;
    font-size: .73rem;
    letter-spacing: .04em;
}

.cw3-coach-promo {
    display: grid;
    gap: 6px;
    margin: 2px 0 8px;
    padding: 12px;
    border: 1px solid rgba(167, 139, 250, .36);
    border-radius: 14px;
    background:
        radial-gradient(ellipse at 100% 0, rgba(124, 77, 255, .24), transparent 57%),
        linear-gradient(135deg, #24212f, #1c1c24 75%);
    color: #efedf6;
    text-align: left;
}

.cw3-coach-promo-kicker {
    color: #c4b5fd;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.cw3-coach-promo h2 {
    margin: 0;
    color: #fff;
    font-size: .92rem;
    line-height: 1.3;
}

.cw3-coach-promo p {
    margin: 0;
    color: #c4c0d0;
    font-size: .75rem;
    line-height: 1.4;
}

.cw3-coach-promo-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 3px;
}

.cw3-coach-promo-actions a {
    min-height: 40px;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 7px;
    border: 1px solid rgba(196, 181, 253, .28);
    border-radius: 9px;
    background: rgba(255, 255, 255, .04);
    color: #f5f3ff;
    text-decoration: none;
    font-size: .7rem;
    line-height: 1.2;
    text-align: center;
    font-weight: 700;
}

.cw3-coach-promo-actions a:first-child {
    border-color: transparent;
    background: linear-gradient(110deg, #7446ee, #9b76fa);
    color: #fff;
}

.cw3-coach-promo-actions a:hover { filter: brightness(1.1); }

.cw3-coach-intro {
    max-width: 1040px;
    margin: 0 auto 22px;
    padding: 20px 22px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    border: 1px solid rgba(167, 139, 250, .32);
    border-radius: 16px;
    background:
        radial-gradient(ellipse at 90% 0, rgba(124, 77, 255, .2), transparent 52%),
        #1c1b23;
    text-align: left;
}

.cw3-coach-intro-copy { min-width: 0; }
.cw3-coach-intro-kicker { margin: 0 0 5px !important; color: #c4b5fd !important; font-size: .7rem !important; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.cw3-coach-intro h1 { margin: 0 0 7px !important; font-size: clamp(1.45rem, 3vw, 2rem) !important; background: none !important; color: #fff !important; -webkit-text-fill-color: #fff !important; }
.cw3-coach-intro-desc { max-width: 660px; margin: 0 !important; color: #c4c0d0 !important; font-size: .88rem !important; line-height: 1.55 !important; }
.cw3-coach-benefits { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.cw3-coach-benefit { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid #3d3948; border-radius: 999px; color: #e4e0ec; background: rgba(0,0,0,.12); font-size: .72rem; font-weight: 650; }
.cw3-coach-benefit strong { color: #d2c2ff; }
.cw3-coach-intro-actions { display: flex; flex-direction: column; gap: 8px; min-width: 190px; }
.cw3-coach-intro-actions a,
.cw3-coach-intro-actions button { min-height: 42px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 0 14px; border: 1px solid #494454; border-radius: 10px; color: #efedf6; background: rgba(255,255,255,.035); text-decoration: none; font: 700 .82rem/1 system-ui, -apple-system, "Segoe UI", sans-serif; cursor: pointer; }
.cw3-coach-intro-actions .cw3-coach-primary { color: #fff; border-color: transparent; background: linear-gradient(110deg, #7040e8, #9a74f8); }
.cw3-coach-intro-actions a:hover,
.cw3-coach-intro-actions button:hover { filter: brightness(1.1); }

.cw3-coach-import-callout {
    max-width: 1040px;
    margin: 0 auto 18px;
    padding: 13px 16px;
    border-left: 3px solid #8b5cf6;
    border-radius: 0 10px 10px 0;
    background: rgba(124, 77, 255, .075);
    text-align: left;
}

.cw3-coach-import-callout h2 { margin: 0 0 4px; color: #ded4ff; font-size: .9rem; }
.cw3-coach-import-callout p { margin: 0; color: #aaa6b5; font-size: .79rem; line-height: 1.5; }
.cw3-coach-promo-limit { color: #ddd4ff !important; font-size: .74rem !important; font-weight: 750; }

/* Keep the complete coach card and both actions reachable in the fixed-height game sidebar. */
#sidebar-lobby .lobby-controls {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

#play-online.lobby-play-button {
    align-self: center;
    width: min(100%, 260px);
    padding: 10px 12px;
    font-size: .88rem;
    text-transform: none;
}

#sidebar-lobby .lobby-coach-promo-slot { min-width: 0; }
#sidebar-lobby .lobby-play-action #play-online { margin: 0; }
#sidebar-lobby .lobby-play-action .cancel-x { z-index: 1; }
#sidebar-lobby .lobby-actions button:focus-visible,
#sidebar-lobby .lobby-actions a:focus-visible,
#sidebar-lobby .time-selector-toggle:focus-visible,
#sidebar-lobby .time-btn:focus-visible { outline: 2px solid #c4b5fd; outline-offset: 2px; }

@media (max-width: 620px) {
    .cw3-app-nav { min-height: 48px; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; padding: 5px 6px; }
    .cw3-nav-links { grid-column: 1; justify-content: space-between; gap: 2px; }
    .cw3-nav-link, .cw3-more-toggle { min-height: 38px; gap: 4px; padding: 0 6px; font-size: .68rem; }
    .cw3-nav-icon { font-size: .84rem; }
    .cw3-locale-toggle { grid-column: 2; min-width: 40px; margin-left: 0; padding: 0 6px; }
    .cw3-coach-intro { grid-template-columns: 1fr; gap: 14px; margin: 0 0 18px; padding: 16px; }
    .cw3-coach-intro-actions { min-width: 0; flex-direction: row; flex-wrap: wrap; }
    .cw3-coach-intro-actions a, .cw3-coach-intro-actions button { flex: 1 1 145px; }
}

@media (prefers-reduced-motion: reduce) {
    .cw3-nav-link, .cw3-more-toggle, .cw3-locale-toggle, .cw3-coach-promo-actions a,
    .cw3-coach-intro-actions a, .cw3-coach-intro-actions button { transition: none; }
}
