:root {
    --bb-ink: #171c1d;
    --bb-panel: #202728;
    --bb-turquoise: #43e1d5;
    --bb-pink: #fa2e8a;
    --bb-paper: #fffaf4;
}

html { scroll-behavior: smooth; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, summary:focus-visible {
    outline: 3px solid var(--bb-turquoise);
    outline-offset: 4px;
}
.site-header {
    padding: 0 24px;
    background: var(--bb-ink);
    position: relative;
    z-index: 10;
}
.site-header-inner {
    width: min(100%, 1560px);
    min-height: 88px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: clamp(24px, 4vw, 64px);
}
.site-header .brand {
    display: inline-block;
    font-size: clamp(2rem, 3vw, 3rem);
    font-weight: 950;
    font-style: italic;
    line-height: 1;
    letter-spacing: -.085em;
    white-space: nowrap;
}
.site-header .brand:hover { text-decoration: none; }
.site-header .brand .pink { color: var(--bb-pink); }
.site-header .primary-nav {
    display: flex;
    align-items: center;
    gap: clamp(20px, 3vw, 46px);
    flex: 1;
    min-width: 0;
}
.site-header .primary-nav a {
    color: #fbf9f6;
    font-size: 1rem;
    font-weight: 650;
    white-space: nowrap;
    position: relative;
    padding: 35px 0 34px;
    line-height: 1.2;
}
.site-header .primary-nav a::after {
    content: "";
    position: absolute;
    bottom: 22px;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 3px;
    background: var(--bb-turquoise);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .18s ease;
}
.site-header .primary-nav a:hover { text-decoration: none; }
.site-header .primary-nav a:hover::after,
.site-header .primary-nav a.active::after { transform: scaleX(1); }
.header-actions { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.header-wallet {
    min-width: 148px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 7px 15px 7px 7px;
    border: 1px solid #ffffff62;
    border-radius: 21px;
    background: #171d1ed4;
    box-shadow: 0 12px 32px #0002;
}
.header-wallet:hover { text-decoration: none; border-color: var(--bb-turquoise); }
.header-wallet img { width: 39px; height: 39px; object-fit: contain; }
.header-wallet span { display: flex; flex-direction: column; }
.header-wallet strong { font-size: 1.2rem; line-height: 1.05; letter-spacing: -.03em; }
.header-wallet small { color: #d7dadd; line-height: 1.2; font-size: .72rem; }
.account-menu { position: relative; }
.account-menu summary {
    list-style: none;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    color: #fff;
    border: 1px solid #fffc;
    border-radius: 50%;
    cursor: pointer;
    background: #17202170;
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary svg { width: 25px; height: 25px; }
.account-menu[open] summary,
.account-menu summary:hover { border-color: var(--bb-turquoise); }
.account-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 12px);
    z-index: 20;
    min-width: 220px;
    padding: 17px;
    color: var(--bb-ink);
    background: var(--bb-paper);
    border: 1px solid #eee4d9;
    border-radius: 15px;
    box-shadow: 0 22px 60px #0004;
}
.account-popover span {
    display: block;
    font-size: .79rem;
    color: #596063;
    overflow-wrap: anywhere;
    margin-bottom: 12px;
}
.account-popover button {
    width: 100%;
    color: var(--bb-ink);
    background: var(--bb-turquoise);
}
.site-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 28px max(24px, calc((100vw - 1560px) / 2));
    border-top: 1px solid #ffffff20;
    background: var(--bb-ink);
    color: #eee9e1;
}
.site-footer > span { font-size: 1.15rem; font-style: italic; font-weight: 900; letter-spacing: -.05em; white-space: nowrap; }
.site-footer p { margin: 0; color: #b9b8b3; font-size: .8rem; }
.player-shell { color: #f7f4ef; background: #1d2324; }
.player-shell .card { color: var(--bb-ink); }
.player-shell .container { max-width: 1560px; }
.home-shell .site-header { position: absolute; top: 0; left: 0; right: 0; background: transparent; border: 0; }
.home-shell .container { width: 100%; max-width: none; padding: 0; }
.home-shell .container > .notice,
.home-shell .container > .error { position: relative; top: 100px; z-index: 2; max-width: 1450px; margin: 0 auto 15px; }
.guest-shell {
    min-height: 100vh;
    background: linear-gradient(115deg, #111819ed 0%, #172526ca 70%, #172526a8 100%),
        url('/images/boule-home-hero.jpg') center 54% / cover no-repeat;
}
.guest-shell .container { min-height: calc(100vh - 172px); display: grid; align-items: center; }
.auth-card { color: var(--bb-ink); }
.guest-shell .auth-card { width: min(100%, 510px); margin: 35px auto; border: 0; box-shadow: 0 30px 75px #0005; }
.guest-shell .auth-card h1 { letter-spacing: -.06em; }
.guest-shell .auth-card button { background: var(--bb-turquoise); }
.guest-shell .auth-card a { color: #087e77; font-weight: 750; }
.guest-shell .auth-card .eyebrow { color: #0d9289; }
.guest-shell .auth-card .password-rules { background: #effbf9; border-color: #bdebe6; }
.admin-shell .site-header-inner { width: min(100%, 1560px); gap: 24px; }
.admin-shell .site-header .primary-nav { gap: 16px; flex-wrap: wrap; padding: 8px 0; }
.admin-shell .site-header .primary-nav a { font-size: .8rem; padding: 8px 0; }
.admin-shell .site-header .primary-nav a::after { bottom: 3px; }
.admin-logout { flex: none; }

@media (max-width: 1000px) {
    .site-header-inner { gap: 20px; }
    .site-header .primary-nav { gap: 20px; }
    .site-header .brand { font-size: 2.2rem; }
    .header-wallet { min-width: 0; padding-right: 10px; }
}
@media (max-width: 720px) {
    .site-header { padding: 0 18px; }
    .site-header-inner { min-height: 72px; display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 12px 0; }
    .site-header .brand { font-size: 2rem; }
    .site-header .primary-nav { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; flex-wrap: nowrap; gap: 25px; width: 100%; scrollbar-width: none; }
    .site-header .primary-nav::-webkit-scrollbar { display: none; }
    .site-header .primary-nav a { padding: 17px 0 12px; font-size: .9rem; }
    .site-header .primary-nav a::after { bottom: 4px; }
    .header-actions { grid-column: 2; grid-row: 1; gap: 9px; }
    .header-wallet { gap: 6px; padding: 5px 8px 5px 4px; border-radius: 16px; }
    .header-wallet img { width: 31px; height: 31px; }
    .header-wallet strong { font-size: 1rem; }
    .header-wallet small { font-size: .62rem; }
    .account-menu summary { width: 38px; height: 38px; }
    .account-menu summary svg { width: 21px; height: 21px; }
    .site-footer { flex-direction: column; align-items: flex-start; padding: 23px 18px; }
    .admin-shell .site-header-inner { grid-template-columns: 1fr auto; }
    .admin-shell .primary-nav { grid-column: 1 / -1; grid-row: 2; }
    .admin-logout { grid-column: 2; grid-row: 1; }
}
@media (max-width: 380px) {
    .site-header .brand { font-size: 1.8rem; }
    .header-wallet img { width: 26px; height: 26px; }
    .account-menu summary { width: 34px; height: 34px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .site-header .primary-nav a::after { transition: none; }
}
