html,
body {
    width: 100%;
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

canvas {
    display: block;
    background-color: #000;
}

#gameCanvas {
    position: fixed;
    top: 0;
    left: 50%;
    z-index: 1;
    width: 100vw;
    height: 100vh;
    transform: translateX(-50%);
}

/* drawMenu() clears the canvas while the DOM lobby is active. Let that
   cleared canvas reveal the single full-page body gradient behind it. */
body:has(#lobbyRoot.is-visible) #gameCanvas {
    background-color: transparent;
}

/* Reconnect is the only menu UI still drawn on the gameplay canvas. Keep the
   current DOM lobby visible below it and remove the obsolete black/canvas-menu
   background while the reconnect modal is open. */
#gameCanvas.reconnect-offer-layer {
    z-index: 500;
    background: transparent;
}

#authOverlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 180ms ease-out;
}

html.login-scene-loading #authOverlay {
    opacity: 0;
}

html.login-scene-loading body::after {
    content: 'Forging the spires...';
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: grid;
    place-items: center;
    color: #f5d98a;
    background: #10091d;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(18px, 2vw, 28px);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-shadow: 0 0 18px rgba(245, 217, 138, 0.42);
    pointer-events: none;
}

.auth-particles,
#gameParticles,
#lobbyParticles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.auth-particles {
    z-index: 0;
}

/* Fixed-width live login composition. On narrower screens the complete scene
   is cropped as one unit, so the landscape, wizard, tower, and shadow never
   drift apart. The auth particles stay underneath the opaque landscape. */
#loginSceneStage {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 1;
    width: 1800px;
    height: 1013.04px;
    overflow: hidden;
    background: #1e1930;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

#loginLandscape,
#loginTowerCanvas,
#loginWizard,
#loginWizardAnimation {
    position: absolute;
    pointer-events: none;
    user-select: none;
}

#loginLandscape {
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: fill;
    object-position: center;
}

#loginTowerCanvas {
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    background: transparent;
}

#loginWizard,
#loginWizardAnimation {
    top: 31.4%;
    left: -1.1%;
    z-index: 3;
    width: 31%;
    height: auto;
    transform: scale(1.18);
    transform-origin: top left;
    filter: drop-shadow(0 14px 20px rgba(5, 2, 13, 0.48));
}

#loginWizard[hidden],
#loginWizardAnimation[hidden] {
    display: none;
}

#loginWizardAnimation {
    background-color: transparent;
}

.login-scene-frame,
#gameCanvasFrame {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 0;
    width: 100vw;
    height: 100vh;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.login-scene-frame {
    z-index: 2;
}

.login-scene-frame::before,
.login-scene-frame::after,
#gameCanvasFrame::before,
#gameCanvasFrame::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(
        180deg,
        rgba(217, 180, 91, 0.2) 0%,
        rgba(245, 220, 145, 0.9) 18%,
        rgba(217, 180, 91, 0.48) 50%,
        rgba(245, 220, 145, 0.9) 82%,
        rgba(217, 180, 91, 0.2) 100%
    );
}

.login-scene-frame::before,
#gameCanvasFrame::before {
    left: 0;
    box-shadow: -5px 0 0 rgba(255, 235, 171, 0.3), 0 0 14px rgba(245, 196, 89, 0.46);
}

.login-scene-frame::after,
#gameCanvasFrame::after {
    right: 0;
    box-shadow: 5px 0 0 rgba(255, 235, 171, 0.3), 0 0 14px rgba(245, 196, 89, 0.46);
}

#authCard {
    position: relative;
    z-index: 3;
    isolation: isolate;
    width: min(420px, 92vw);
    padding: 24px;
    border: 1px solid #2f4c63;
    background: rgba(8, 15, 20, 0.95);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

#authCard h1 {
    margin: 0 0 8px;
    color: #d2ecff;
    font-size: 28px;
}

#authCard p {
    margin: 0 0 18px;
    color: #86a5bb;
    font-size: 14px;
}

#authTabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

#authTabs button {
    flex: 1;
    height: 38px;
    border: 1px solid #2f4c63;
    background: #10202d;
    color: #d2ecff;
    cursor: pointer;
}

#authTabs button.active {
    background: #1b3a50;
    border-color: #3f7397;
}

.authForm {
    display: none;
    gap: 10px;
    flex-direction: column;
}

.authForm.active {
    display: flex;
}

.authForm input {
    height: 40px;
    border: 1px solid #304b5f;
    background: #0b1822;
    color: #e7f4ff;
    padding: 0 10px;
    font-size: 14px;
}

.authForm button {
    margin-top: 4px;
    height: 42px;
    border: 1px solid #3f7397;
    background: #1f4f71;
    color: #ffffff;
    cursor: pointer;
    font-size: 15px;
}

#authMessage {
    min-height: 22px;
    margin-top: 12px;
    color: #ffd4d4;
    font-size: 13px;
}

#authMessage.success {
    color: #abffcc;
}

.auth-data-notice {
    margin: 2px 0 0 !important;
    color: #7895aa !important;
    font-size: 11px !important;
    line-height: 1.45;
    text-align: center;
}

.auth-data-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 4px;
    color: #64839a;
    font-size: 11px;
}

.auth-data-notice a,
.auth-data-links a {
    color: #9dc9e5;
    text-decoration: none;
}

.auth-data-notice a:hover,
.auth-data-notice a:focus-visible,
.auth-data-links a:hover,
.auth-data-links a:focus-visible {
    color: #f5d98a;
    text-decoration: underline;
}

.auth-version {
    margin: 0;
    color: #64839a;
    font-size: inherit;
    letter-spacing: 0.02em;
}

.auth-data-separator { color: #64839a; }

.auth-maintenance-notice {
    display: grid;
    gap: 6px;
    margin: 0 0 16px;
    padding: 13px 14px;
    border: 1px solid rgba(245, 190, 92, 0.7);
    border-radius: 8px;
    background: rgba(108, 67, 12, 0.28);
    color: #ffe4a8;
    text-align: left;
}

.auth-maintenance-notice[hidden] {
    display: none;
}

.auth-maintenance-notice span {
    white-space: pre-wrap;
}

.auth-maintenance-notice strong {
    text-align: center;
}

#authCard h1,
#authCard > p,
#authMessage {
    text-align: center;
}

#sessionBar {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 900;
    display: none;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid #315168;
    background: rgba(8, 15, 20, 0.88);
    color: #d2ecff;
    font-size: 13px;
}

#sessionRanked {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    background: rgba(68, 214, 160, 0.15);
    color: #44d6a0;
    font-weight: bold;
    font-size: 12px;
}

#sessionBar button {
    height: 30px;
    padding: 0 10px;
    border: 1px solid #5f89a8;
    background: #224a67;
    color: #ffffff;
    cursor: pointer;
}

.sessionLevelGroup {
    display: flex;
    align-items: center;
    gap: 5px;
}

.sessionLevelBadge {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 3px;
    background: rgba(100, 180, 255, 0.18);
    color: #90ccff;
    font-weight: bold;
    font-size: 12px;
    white-space: nowrap;
}

.sessionXpWrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid #2a4a60;
    overflow: hidden;
    cursor: default;
}

.sessionXpBar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.45s ease;
}

.sessionXpWrap,
.monthly-pass__marker::before {
    background: rgba(255, 255, 255, 0.07);
}

.sessionXpBar,
.monthly-pass__marker::after {
    background: linear-gradient(90deg, #3a8fff, #55ffcc);
}

.sessionXpLabel {
    position: relative;
    z-index: 1;
    width: 100%;
    text-align: center;
    font-size: 10px;
    color: #d2ecff;
    pointer-events: none;
    white-space: nowrap;
}

/* XP gain flash animation */
@keyframes xpFlash {
    0%   { filter: brightness(1.8); }
    100% { filter: brightness(1); }
}

.sessionXpWrap.xp-gain {
    animation: xpFlash 0.6s ease forwards;
}

#activePresetLabel {
    color: #9fc7d7;
    font-size: 12px;
}

#activePresetSelect {
    height: 30px;
    border: 1px solid #5f89a8;
    background: #0f2332;
    color: #d2ecff;
    min-width: 120px;
}

#onlineQueueOverlay {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(5, 12, 18, 0.82);
}

#onlineQueueCard {
    width: min(420px, 92vw);
    padding: 22px;
    border: 1px solid #2b5f77;
    background: #08121a;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4);
    color: #d8f5ff;
    text-align: center;
}

#matchReadyOverlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(5, 2, 13, 0.84);
    box-sizing: border-box;
}

#matchReadyCard {
    width: min(480px, 94vw);
    padding: 28px;
    border: 1px solid rgba(226, 200, 140, 0.58);
    border-radius: 18px;
    background: linear-gradient(165deg, rgba(48, 35, 70, 0.98), rgba(20, 13, 35, 0.98));
    box-shadow: 0 22px 58px rgba(4, 1, 12, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: #fff6df;
    text-align: center;
}

.match-ready__eyebrow {
    color: var(--gold);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

#matchReadyTitle {
    margin: 8px 0 14px;
    font-family: var(--font-heading);
    font-size: 28px;
}

#matchReadyNames {
    margin: 0;
    color: var(--gold-bright);
    font-family: var(--font-heading);
    font-size: clamp(19px, 4vw, 26px);
    overflow-wrap: anywhere;
}

#matchReadyTimer {
    width: 82px;
    height: 82px;
    margin: 20px auto 12px;
    border: 2px solid var(--gold);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff6df;
    background: rgba(16, 9, 29, 0.72);
    box-shadow: 0 0 24px var(--gold-glow);
    font-size: 34px;
    font-weight: 800;
}

#matchReadyStatus,
#matchReadyRankedWarning {
    margin: 8px 0 0;
    color: var(--glass-muted);
    font-size: 13px;
}

#matchReadyRankedWarning {
    color: #f2c47c;
}

.match-ready__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 22px;
}

#matchReadyAcceptButton,
#matchReadyDeclineButton {
    min-height: 44px;
    border-radius: 12px;
    cursor: pointer;
    color: #fff;
    font-weight: 800;
}

#matchReadyAcceptButton {
    border: 1px solid #d9b85c;
    background: linear-gradient(180deg, #806229, #543b18);
}

#matchReadyDeclineButton {
    border: 1px solid rgba(235, 145, 145, 0.72);
    background: linear-gradient(180deg, #713c4e, #492434);
}

#matchReadyAcceptButton:disabled,
#matchReadyDeclineButton:disabled {
    opacity: 0.55;
    cursor: default;
}

/* Connected opponent-found ready check. Matchmaking behavior stays in online.js. */
#matchReadyCard {
    width: min(590px, 94vw);
    padding: 0;
    overflow: hidden;
}

.match-ready__header {
    padding: 19px 24px 16px;
    border-bottom: 1px solid rgba(226, 200, 140, 0.28);
    background: #2a203e;
}

.match-ready__eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 9px;
    letter-spacing: 0.18em;
}

#matchReadyTitle {
    margin: 0;
    color: var(--gold-bright);
    font-size: 29px;
    letter-spacing: 0.035em;
}

#matchReadyNames { margin: 0; }

.match-ready__versus {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr);
    align-items: stretch;
    color: var(--text-body);
    background: rgba(38, 28, 56, 0.72);
    font-family: var(--font-body);
    font-size: initial;
}

.match-ready__player {
    display: grid;
    place-items: center;
    align-content: center;
    min-width: 0;
    padding: 20px 12px 18px;
}

.match-ready__player:first-child { border-right: 1px solid rgba(226, 200, 140, 0.12); }
.match-ready__player:last-child { border-left: 1px solid rgba(226, 200, 140, 0.12); }

.match-ready__profile-icon {
    display: block;
    width: 72px;
    height: 72px;
    margin: 0 auto 9px;
    border: 2px solid var(--gold);
    border-radius: 12px;
    background-color: rgba(30, 20, 48, 0.8);
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    box-shadow: 0 0 16px var(--gold-glow);
}

.match-ready__identity {
    display: block;
    max-width: 100%;
    overflow: hidden;
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.match-ready__staff-prefix,
.match-ready__title-prefix { color: var(--gold-bright); }
.match-ready__username { color: var(--profile-name-color, var(--gold-bright)); }

.match-ready__rank {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
    color: var(--text-body);
    font-size: 11px;
    font-weight: 750;
}

.match-ready__rank img {
    width: 23px;
    height: 23px;
    object-fit: contain;
}

.match-ready__rating::before {
    content: '·';
    margin-right: 6px;
    color: var(--text-muted);
}

.match-ready__rating:empty { display: none; }

.match-ready__vs {
    display: grid;
    place-items: center;
    color: var(--gold);
    background: rgba(15, 9, 27, 0.26);
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 800;
}

.match-ready__decision {
    padding: 16px 22px 18px;
    border-top: 1px solid rgba(226, 200, 140, 0.28);
    background: rgba(13, 8, 24, 0.58);
}

.match-ready__accept-control {
    position: relative;
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid #d9b85c;
    border-radius: 11px;
    background: #21172f;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.match-ready__time-cell {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    min-height: 58px;
    border-right: 1px solid rgba(231, 202, 117, 0.34);
    background: #261b36;
}

.match-ready__time-cell > span {
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#matchReadyTimer {
    display: block;
    width: auto;
    height: auto;
    margin: 0;
    border: 0;
    border-radius: 0;
    color: var(--gold-bright);
    background: transparent;
    box-shadow: none;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

#matchReadyAcceptButton {
    min-height: 58px;
    border: 0;
    border-radius: 0;
    color: #fff;
    background: linear-gradient(180deg, #896826, #5b4019);
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
}

#matchReadyAcceptButton:hover:not(:disabled) {
    background: linear-gradient(180deg, #9b792f, #6a4a1b);
}

.match-ready__countdown-track {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    overflow: hidden;
    background: rgba(169, 159, 192, 0.16);
}

.match-ready__countdown-track > span {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--gold-bright);
    transition: width 0.25s linear, background-color 0.2s ease;
}

.match-ready__accept-control.is-urgent { border-color: #c96778; }
.match-ready__accept-control.is-urgent #matchReadyTimer { color: #e7929f; }
.match-ready__accept-control.is-urgent .match-ready__countdown-track > span { background: #c96778; }

.match-ready__decision-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 35px;
    padding: 8px 2px 0;
}

#matchReadyStatus {
    margin: 0;
    color: var(--text-muted);
    font-size: 11px;
    text-align: left;
}

#matchReadyStatus.is-accepted { color: #9eebc3; }

#matchReadyDeclineButton {
    flex: 0 0 auto;
    min-height: 0;
    padding: 5px 2px;
    border: 0;
    border-bottom: 1px solid transparent;
    border-radius: 0;
    color: #c8b9d4;
    background: transparent;
    font-size: 11px;
    font-weight: 400;
}

#matchReadyDeclineButton:hover:not(:disabled) {
    border-bottom-color: #e7929f;
    color: #f0ccd2;
}

#matchReadyRankedWarning {
    margin: 0;
    padding-top: 4px;
    color: #9c8dae;
    font-size: 10px;
    text-align: left;
}

@media (max-width: 560px) {
    .match-ready__versus { grid-template-columns: 1fr; }
    .match-ready__vs { padding: 8px; }
    .match-ready__player {
        grid-template-columns: 58px minmax(0, 1fr);
        justify-items: start;
        text-align: left;
    }
    .match-ready__player:first-child,
    .match-ready__player:last-child { border: 0; }
    .match-ready__profile-icon {
        grid-row: span 2;
        width: 50px;
        height: 50px;
        margin: 0;
    }
    .match-ready__accept-control { grid-template-columns: 88px minmax(0, 1fr); }
}

/* Local-only decorative sprite layers for the login card and whitelisted
   lobby panels. They never participate in layout, input or game state. */
.border-decoration-layer {
    position: absolute;
    inset: 0;
    z-index: 4;
    overflow: visible;
    pointer-events: none;
    user-select: none;
}

.border-decoration {
    position: absolute;
    display: block;
    background-repeat: no-repeat;
    pointer-events: none;
    transform-origin: center;
    /* filter: drop-shadow(0 4px 8px rgba(8, 3, 18, 0.46)); */
}

@media (prefers-reduced-motion: reduce) {
    .border-decoration { transition: none !important; }
}

#profileThemeGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

#customizationWorkspace {
    display: grid;
    grid-template-columns: minmax(330px, 0.9fr) minmax(420px, 1.1fr);
    gap: 22px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: min(680px, calc(100vh - 180px));
    padding: 4px;
    box-sizing: border-box;
}

#profileHubThemesPanel {
    min-width: 0;
}

#profileHubThemesPanel.profile-identity-active #customizationWorkspace {
    grid-template-columns: minmax(430px, 1.25fr) minmax(300px, .75fr);
}

#profileHubThemesPanel.profile-identity-active .customization-preview {
    align-self: start;
    min-height: 0;
}

.customization-controls,
.customization-preview {
    min-width: 0;
    border: 1px solid rgba(226, 200, 140, 0.28);
    border-radius: 16px;
    background: linear-gradient(165deg, rgba(42, 32, 63, 0.96), rgba(23, 17, 39, 0.96));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 14px 34px rgba(6,3,15,.25);
}
.customization-controls {
    padding: 20px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--gold-soft) transparent;
}
.customization-controls::-webkit-scrollbar { width: 8px; }
.customization-controls::-webkit-scrollbar-thumb {
    border-radius: 8px;
    background: var(--gold-soft);
}
.customization-heading h3,
.customization-preview__header h3 {
    margin: 3px 0 6px;
    color: #fff6df;
    font-family: var(--font-heading);
    font-size: clamp(20px, 2vw, 28px);
}
.customization-eyebrow {
    color: var(--gold);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.customization-heading {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 16px;
}

.customization-category-tabs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    flex: 0 0 auto;
    margin: 16px 4px 12px;
}
.customization-category-tabs button {
    min-width: 0;
    min-height: 38px;
    padding: 8px 6px;
    border: 1px solid rgba(226,200,140,.2);
    border-radius: 9px;
    color: var(--text-muted);
    background: rgba(255,255,255,.035);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.customization-category-tabs button:last-child { grid-column: auto; }
.customization-category-tabs button:hover,
.customization-category-tabs button.active {
    color: #fff6df;
    border-color: var(--gold);
    background: linear-gradient(180deg, rgba(245,217,138,.2), rgba(217,180,91,.09));
}

.customization-items { display: grid; gap: 9px; }
.customization-powerup-section {
    display: grid;
    gap: 8px;
}
.customization-powerup-toggle {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid rgba(226,200,140,.2);
    border-radius: 9px;
    color: var(--text-muted);
    background: rgba(255,255,255,.035);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.customization-powerup-toggle:hover,
.customization-powerup-toggle.active {
    color: #fff6df;
    border-color: var(--gold);
    background: linear-gradient(180deg, rgba(245,217,138,.2), rgba(217,180,91,.09));
}
.customization-powerup-chevron {
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform .16s var(--ease);
}
.customization-powerup-toggle[aria-expanded="true"] .customization-powerup-chevron {
    transform: rotate(225deg);
}
.customization-powerup-content {
    display: grid;
    gap: 9px;
    padding: 0 5px 7px;
}
.customization-powerup-coming {
    padding: 18px 14px;
    border: 1px dashed rgba(226,200,140,.22);
    border-radius: 9px;
    color: var(--text-muted);
    background: rgba(10,7,20,.28);
    font-size: 12px;
    text-align: center;
}
.customization-item {
    width: 100%;
    min-height: 86px;
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 8px 8px;
    border: 1px solid rgba(226,200,140,.18);
    border-radius: 12px;
    color: var(--text-body);
    background: rgba(10,7,20,.42);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .16s var(--ease), background .16s var(--ease);
}
.customization-item:hover:not(:disabled) {
    border-color: rgba(245,217,138,.6);
    background: rgba(217,180,91,.09);
}
.customization-item.selected {
    border-color: var(--gold);
    background: linear-gradient(100deg, rgba(217,180,91,.19), rgba(65,45,86,.3));
    box-shadow: 0 0 18px rgba(217,180,91,.1);
}
.customization-item.unavailable { cursor: not-allowed; opacity: .62; }
.customization-item__visual {
    width: 76px;
    height: 68px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 9px;
    background: rgba(0,0,0,.26);
}
.customization-item__visual canvas { width: 68px; height: 68px; }
.customization-item__visual img { width: 100%; height: 100%; object-fit: cover; }
.customization-item__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.customization-item__copy strong {
    overflow: hidden;
    color: var(--text-strong);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.customization-item__copy small { color: var(--text-muted); font-size: 11px; }
.customization-item.selected .customization-item__copy small,
.customization-item__mark { color: var(--gold-bright); }
.customization-item__mark { font-size: 16px; text-align: center; }
.customization-none-icon,
.customization-coming-icon,
.customization-title-icon {
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 13px;
}
.customization-coming-icon { font-size: 30px; }
.customization-title-icon {
    width: 62px;
    padding: 7px 4px;
    border: 1px solid rgba(245,217,138,.42);
    border-radius: 7px;
    color: var(--gold-bright);
    background: rgba(217,180,91,.1);
    font-size: 10px;
    text-align: center;
}
.customization-preview {
    display: flex;
    flex-direction: column;
    padding: 18px;
}
.customization-preview__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}
.customization-save-state {
    margin-top: 4px;
    padding: 5px 9px;
    border: 1px solid rgba(139,230,176,.34);
    border-radius: 999px;
    color: #8be6b0;
    background: rgba(139,230,176,.08);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.customization-save-state.is-saving {
    color: var(--gold-bright);
    border-color: rgba(245,217,138,.4);
    background: rgba(245,217,138,.08);
}
.customization-preview__stage {
    flex: 1 1 auto;
    min-height: 360px;
    overflow: hidden;
    border: 1px solid rgba(226,200,140,.34);
    border-radius: 13px;
    background: #120b24;
    box-shadow: inset 0 0 40px rgba(4,2,12,.45);
}
#customizationPreviewCanvas {
    width: 100%;
    height: 100%;
    min-height: 360px;
    display: block;
}
.customization-loadout-summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
    margin-top: 12px;
}
.customization-loadout-summary > div {
    min-width: 0;
    padding: 8px;
    border: 1px solid rgba(226,200,140,.16);
    border-radius: 9px;
    background: rgba(0,0,0,.2);
}
.customization-loadout-summary span,
.customization-loadout-summary strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.customization-loadout-summary span {
    color: var(--text-muted);
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.customization-loadout-summary strong {
    margin-top: 3px;
    color: var(--text-strong);
    font-size: 11px;
}
@media (max-width: 1050px) {
    #customizationWorkspace { grid-template-columns: 1fr; }
    #profileHubThemesPanel.profile-identity-active #customizationWorkspace { grid-template-columns: 1fr; }
    .customization-preview { min-height: 600px; }
}
@media (max-width: 680px) {
    .customization-category-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 440px) {
    .customization-loadout-summary { grid-template-columns: 1fr 1fr; }
    .customization-category-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .customization-category-tabs button:last-child { grid-column: auto; }
    .customization-loadout-summary > div:last-child { grid-column: 1 / -1; }
}

/* Themes can live inside a narrow center column even on a wide viewport.
   Respond to the actual inline-view host instead of only the browser width. */
@container lobby-view (max-width: 1050px) {
    #customizationWorkspace { grid-template-columns: minmax(0, 1fr); }
    #profileHubThemesPanel.profile-identity-active #customizationWorkspace { grid-template-columns: minmax(0, 1fr); }
    .customization-preview { min-height: 600px; }
}

#onlineQueueCard h2 {
    margin: 0 0 8px;
    font-size: 24px;
}

#onlineQueueStatus {
    margin: 0 0 14px;
    min-height: 22px;
    color: #9fc7d7;
    font-size: 14px;
}

#onlineQueueCard button {
    height: 40px;
    padding: 0 14px;
    border: 1px solid #6f92a5;
    background: #1c3f53;
    color: #fff;
    cursor: pointer;
}

#rankedSummaryOverlay {
    position: fixed;
    inset: 0;
    z-index: 960;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(5, 12, 18, 0.9);
}

#rankedSummaryCard {
    width: min(480px, 92vw);
    padding: 28px;
    border: 2px solid #aa44ff;
    background: rgba(20, 10, 40, 0.95);
    box-shadow: 0 0 30px rgba(170, 68, 255, 0.3), 0 16px 40px rgba(0, 0, 0, 0.5);
    color: #d8f5ff;
}

#rankedSummaryCard h2 {
    margin: 0 0 4px;
    font-size: 28px;
    color: #aa44ff;
}

.rankedRatingRow {
    margin: 16px 0;
    padding: 12px;
    border: 1px solid #5a2e8a;
    display: flex;
    gap: 8px;
}

#skillTreeResetButton {
    background: rgba(170, 68, 255, 0.08);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rankedRatingLabel {

#skillTreeResetButton {
    border-color: #9b7c40;
    background: #5e4721;
}

#skillTreeResetButton:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
    font-size: 14px;
    color: #9fc7d7;
}

.rankedRatingValue {
    font-size: 16px;
    font-weight: bold;
    color: #44d6a0;
}

.rankedRatingDelta {
    font-size: 16px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 3px;
    background: rgba(68, 214, 160, 0.2);
    color: #44d6a0;
}

.rankedRatingDelta.negative {
    background: rgba(255, 102, 102, 0.2);
    color: #ff6666;
}

#rankedSummaryCard button {
    margin-top: 20px;
    width: 100%;
    height: 40px;
    border: 1px solid #aa44ff;
    background: #3d1a5c;
    color: #aa44ff;
    cursor: pointer;
    font-weight: bold;
}

#rankedSummaryCard button:hover {
    background: #5a2e8a;
}

#powerUpPresetOverlay {
    position: fixed;
    inset: 0;
    z-index: 970;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(4, 10, 16, 0.9);
}

#powerUpPresetCard {
    width: min(900px, 96vw);
    max-height: 90vh;
    overflow: auto;
    padding: 24px;
    border: 1px solid #3f7397;
    background: #081521;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
    color: #d8f5ff;
}

#powerUpPresetCard h2 {
    margin: 0 0 8px;
    font-size: 30px;
}

#powerUpPresetHelp {
    margin: 0 0 16px;
    color: #9fc7d7;
}

#presetTabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

#presetRenameRow {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

#presetNameInput {
    flex: 1;
    height: 38px;
    border: 1px solid #304b5f;
    background: #0b1822;
    color: #e7f4ff;
    padding: 0 10px;
}

#presetRenameButton {
    height: 38px;
    padding: 0 14px;
    border: 1px solid #3f7397;
    background: #1f4f71;
    color: #fff;
    cursor: pointer;
}

#presetSlotsRoot {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#presetActionsRow {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

#presetSaveButton,
#presetCloseButton {
    height: 38px;
    padding: 0 16px;
    border: 1px solid #3f7397;
    background: #1f4f71;
    color: #fff;
    cursor: pointer;
}

.presetEditorRow {
    padding: 14px;
    border: 1px solid #35556d;
    background: #0c1a27;
    border-radius: 14px;
}

#onlineQueueOverlay.is-message #queueRangeInfo,
#onlineQueueOverlay.is-message #queueTimer,
#onlineQueueOverlay.is-message #queueTip,
#onlineQueueOverlay.is-message .online-queue__lock-note,
#onlineQueueOverlay.is-message #minimizeOnlineQueueButton,
#onlineQueueOverlay.is-message .online-queue__compact {
    display: none !important;
}

#onlineQueueOverlay.is-message #onlineQueueStatus {
    display: block;
    margin: 18px 0;
    color: #fff6df;
}

.presetEditorHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.presetExpandButton {
    min-width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #3f7397;
    background: #1f4f71;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    border-radius: 10px;
}

.presetExpandButton:hover {
    background: #2a5f81;
    border-color: #4a8aaf;
}

.presetEditorTitle {
    margin: 0;
    font-size: 19px;
    color: #d2ecff;
}

.presetInlineRename {
    display: flex;
    align-items: center;
    gap: 8px;
}

.presetInlineRename input {
    width: 180px;
    height: 34px;
    border: 1px solid #304b5f;
    background: #0b1822;
    color: #e7f4ff;
    padding: 0 8px;
}

.presetInlineRename button {
    height: 34px;
    padding: 0 12px;
    border: 1px solid #3f7397;
    background: #1f4f71;
    color: #fff;
    cursor: pointer;
}

.presetCategoryColumns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.presetCategoryColumns.withoutBan {
    grid-template-columns: 2fr 1fr 1fr;
}

.presetCategoryColumn {
    border: 1px solid #294154;
    background: #0a1620;
    padding: 10px;
    border-radius: 12px;
}

.presetCategoryColumn h4 {
    margin: 0 0 8px;
    color: #9fd6f4;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.presetSlotGrid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.presetSlotGrid.twoCols {
    grid-template-columns: 1fr 1fr;
}

.presetSlotButton {
    min-height: 44px;
    border: 1px dashed #4d708a;
    background: #0f2535;
    color: #d2ecff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px;
    text-align: center;
    width: 100%;
    border-radius: 10px;
}

.presetSlotButton.filled {
    border-style: solid;
    border-color: #66b7ea;
    background: #173549;
}

.presetSlotMarker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #0a1218;
    border: 1px solid #5f89a8;
    font-weight: bold;
    font-size: 13px;
}

.presetSlotLabel {
    font-size: 12px;
    color: #c2e7ff;
}

.presetPickerBackdrop {
    position: fixed;
    inset: 0;
    background: rgba(3, 8, 14, 0.82);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 980;
}

.presetPickerCard {
    width: min(760px, 94vw);
    max-height: 84vh;
    overflow: auto;
    border: 1px solid #3f7397;
    background: #081521;
    padding: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    border-radius: 14px;
}

.presetPickerTitle {
    margin: 0 0 12px;
    color: #d8f5ff;
    font-size: 20px;
}

.presetPickerList {
    display: grid;
    gap: 8px;
}

.presetTypeOption {
    width: 100%;
    border: 1px solid #2f4f67;
    background: #0d1d2b;
    color: #d8f5ff;
    cursor: pointer;
    text-align: left;
    padding: 10px;
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 10px;
    align-items: start;
    border-radius: 12px;
}

.presetTypeOption.selected {
    border-color: #6fcbff;
    background: #12344a;
}

.presetTypeOption.disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.presetTypeMarker {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #5f89a8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    background: #08121a;
}

.presetTypeName {
    font-size: 14px;
    color: #d8f5ff;
    margin-bottom: 4px;
}

.presetTypeText {
    font-size: 12px;
    color: #9fc7d7;
    line-height: 1.35;
}

.presetPickerActions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

.presetPickerClearButton,
.presetPickerCloseButton {
    height: 34px;
    padding: 0 12px;
    border: 1px solid #3f7397;
    background: #1f4f71;
    color: #fff;
    cursor: pointer;
    border-radius: 10px;
}

@media (max-width: 1000px) {
    .presetCategoryColumns {
        grid-template-columns: 1fr 1fr;
    }

    .presetCategoryColumns.withoutBan {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    .presetEditorHeader {
        flex-direction: column;
        align-items: stretch;
    }

    .presetInlineRename {
        width: 100%;
    }

    .presetInlineRename input {
        flex: 1;
        width: auto;
    }

    .presetCategoryColumns {
        grid-template-columns: 1fr;
    }

    .presetCategoryColumns.withoutBan {
        grid-template-columns: 1fr;
    }
}

#profileHubOverlay {
    position: fixed;
    inset: 0;
    z-index: 985;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(4, 12, 18, 0.92);
}

#skillTreeOverlay {
    position: fixed;
    inset: 0;
    z-index: 986;
    display: none;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at top left, rgba(46, 98, 127, 0.22), transparent 34%),
        radial-gradient(circle at bottom right, rgba(175, 112, 54, 0.16), transparent 32%),
        rgba(4, 12, 18, 0.94);
}

#skillTreeCard {
    width: min(1180px, 96vw);
    max-height: 92vh;
    overflow: auto;
    border: 1px solid #3f7397;
    border-radius: 16px;
    background: linear-gradient(180deg, #081521 0%, #0c1a27 100%);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55);
    color: #d8f5ff;
    padding: 22px;
}

#skillTreeHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

#skillTreeHeaderActions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

#skillTreeResetButton,
#skillTreeCloseButton {
    height: 36px;
    padding: 0 14px;
    border: 1px solid #3f7397;
    border-radius: 10px;
    background: #1f4f71;
    color: #fff;
    cursor: pointer;
}

#skillTreeResetButton {
    border-color: #9b7c40;
    background: #5e4721;
}

#skillTreeResetButton:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#skillTreeStatusBar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0;
}

.skillTreeStatusCard {
    min-width: 140px;
    min-height: 56px;
    padding: 9px 14px;
    border: 1px solid #35556d;
    border-radius: 12px;
    background: #0c1a27;
    box-sizing: border-box;
}

.skillTreeStatusCard.highlight {
    border-color: #b18b45;
    background: #2a2311;
}

#skillTreePointsValue {
    font-size: 28px;
    line-height: 1;
    color: #ffe7a6;
}

#skillTreePointsFraction {
    font-size: 24px;
    line-height: 1;
    color: #d7f0ff;
}

#skillTreeSpendableCount {
    font-size: 24px;
    line-height: 1;
    color: #9be3ad;
}

.skillTreeStatusLabel {
    display: block;
    color: #9fc7d7;
    font-size: 12px;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

#skillTreeMessage {
    min-height: 20px;
    margin-bottom: 12px;
    color: #9fc7d7;
    font-size: 13px;
}

#skillTreeMessage.error {
    color: #ff9a9a;
}

#skillTreeMessage.success {
    color: #9be3ad;
}

#skillTreeTabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.skillTreeTab {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #294154;
    border-radius: 10px;
    background: #0a1620;
    color: #7a9fb8;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.skillTreeTab:hover {
    background: #0f1f2d;
    color: #8fd0f8;
}

.skillTreeTab.active {
    background: #102232;
    color: #e6f5ff;
    border-color: #3f7397;
    border-bottom-color: #3f7397;
}

#skillTreeColumns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.skillTreeColumn {
    border: 1px solid #294154;
    border-radius: 14px;
    background: rgba(10, 22, 32, 0.92);
    padding: 14px;
}

.skillTreeColumnHeader {
    margin: 0 0 10px;
    color: #8fd0f8;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* TREE BRANCH STRUCTURE */
.skillTreeBranch {
    display: grid;
    gap: 28px;
    position: relative;
    padding: 12px;
}

.skillTreeConnections {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.skillTreeConnectionPath {
    fill: none;
    stroke: #3f7397;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.95;
}

.skillTreeRows {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 28px;
}

.skillTreeRow {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.skillTreeRowContent {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    align-items: flex-start;
}

/* NODE WITH BRANCHING LINES */
.skillTreeNode {
    position: relative;
    border: 1px solid #35556d;
    border-radius: 12px;
    background: linear-gradient(180deg, #102232 0%, #0c1a27 100%);
    padding: 12px;
    flex: 0 1 auto;
    min-width: 180px;
    max-width: 220px;
    z-index: 6;
}

.skillTreeNode.locked {
    opacity: 0.72;
}

.skillTreeNode.maxed {
    border-color: #6ab88f;
    background: linear-gradient(180deg, #173129 0%, #10261f 100%);
}

.skillTreeNode.can-spend {
    border-color: #c8a75a;
    background: linear-gradient(180deg, #2a2313 0%, #1c1a10 100%);
    box-shadow: 0 0 0 1px rgba(255, 219, 144, 0.45), 0 0 24px rgba(214, 170, 80, 0.22);
}

.skillTreeNodeHeader {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 6px;
}

.skillTreeNodeTitle {
    margin: 0;
    font-size: 17px;
    color: #e6f5ff;
}

.skillTreeNodeRank {
    white-space: nowrap;
    font-size: 12px;
    color: #8fd0f8;
}

.skillTreeNodeBody {
    font-size: 13px;
    color: #c7e6f7;
    line-height: 1.45;
}

.skillTreeNodeMeta {
    margin-top: 8px;
    display: grid;
    gap: 5px;
    font-size: 12px;
    color: #9fc7d7;
}

.skillTreeNodeActions {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.skillTreeNodeBadge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 8px;
    border: 1px solid #516c7f;
    border-radius: 8px;
    background: #0b1822;
    color: #d8f5ff;
    font-size: 12px;
}

.skillTreeSpendButton {
    height: 32px;
    padding: 0 12px;
    border: 1px solid #3f7397;
    border-radius: 10px;
    background: #1f4f71;
    color: #fff;
    cursor: pointer;
}

.skillTreeNode.can-spend .skillTreeSpendButton {
    border-color: #d2a957;
    background: linear-gradient(180deg, #876021 0%, #6e4b16 100%);
    color: #fff5d8;
    font-weight: 700;
}

.skillTreeSpendButton:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 980px) {
    #skillTreeColumns {
        grid-template-columns: 1fr;
    }
}

#profileHubCard {
    width: min(1000px, 96vw);
    max-height: 92vh;
    overflow: auto;
    border: 1px solid #3f7397;
    background: #081521;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55);
    color: #d8f5ff;
    padding: 20px;
}

@media (max-width: 620px) {
    #skillTreeHeader {
        align-items: stretch;
    }

    #skillTreeStatusBar {
        width: 100%;
    }

    .skillTreeStatusCard {
        flex: 1 1 130px;
        min-width: 0;
    }

    #skillTreeHeaderActions {
        width: 100%;
        justify-content: flex-end;
    }
}

#profileHubOverlay.is-player-profile #profileHubCard {
    width: min(720px, calc(100vw - 40px));
    max-height: 82vh;
    border-radius: 14px;
}

#profileHubHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

#profileHubHeader h2 {
    margin: 0;
    font-size: 30px;
}

#profileHubCloseButton {
    height: 34px;
    padding: 0 12px;
    border: 1px solid #3f7397;
    background: #1f4f71;
    color: #fff;
    cursor: pointer;
}

#profileHubTabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.profileHubTab,
.profileHistoryTab {
    height: 36px;
    padding: 0 14px;
    border: 1px solid #3b5f78;
    background: #10263a;
    color: #d2ecff;
    cursor: pointer;
}

.profileHubTab.active,
.profileHistoryTab.active {
    border-color: #66b7ea;
    background: #1f4f71;
}

#profileHubMessage {
    min-height: 20px;
    color: #9fc7d7;
    font-size: 13px;
    margin-bottom: 8px;
}

.profileHubPanel {
    display: none;
}

.profileHubPanel.active {
    display: block;
}

.achievement-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.achievement-summary {
    color: var(--gold-bright, #f5d98a);
    font-family: 'Cinzel', 'Trajan Pro', Georgia, serif;
    font-weight: 700;
    white-space: nowrap;
}

.achievement-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.achievement-filters button {
    min-height: 32px;
    padding: 5px 11px;
    border: 1px solid rgba(159, 199, 215, 0.34);
    border-radius: 9px;
    background: rgba(16, 38, 58, 0.82);
    color: #d2ecff;
    cursor: pointer;
}

.achievement-filters button:hover,
.achievement-filters button.active {
    border-color: var(--gold, #d9b45b);
    color: #fff6df;
    background: rgba(217, 180, 91, 0.18);
}

.achievement-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
}

.achievement-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    min-width: 0;
    padding: 13px;
    border: 1px solid rgba(105, 142, 166, 0.42);
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(16, 35, 52, 0.92), rgba(10, 22, 35, 0.9));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.achievement-card.is-completed {
    border-color: rgba(217, 180, 91, 0.72);
    background: linear-gradient(145deg, rgba(70, 54, 24, 0.5), rgba(19, 29, 39, 0.94));
    box-shadow: inset 0 1px 0 rgba(255, 236, 180, 0.11), 0 0 20px rgba(214, 170, 80, 0.08);
}

.achievement-card.is-concealed {
    filter: saturate(0.35);
}

.achievement-card__icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    overflow: hidden;
    border: 1px solid rgba(159, 199, 215, 0.4);
    border-radius: 10px;
    color: #d8f5ff;
    background: radial-gradient(circle at 35% 30%, rgba(122, 184, 218, 0.3), rgba(18, 39, 58, 0.94));
    font-size: 27px;
}

.achievement-card__icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.achievement-card.is-completed .achievement-card__icon {
    border-color: rgba(245, 217, 138, 0.72);
    color: #ffe6a4;
    background: radial-gradient(circle at 35% 30%, rgba(245, 217, 138, 0.35), rgba(68, 48, 16, 0.9));
}

.achievement-card__heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.achievement-card h3 {
    margin: 0;
    color: #f6efe0;
    font-family: 'Cinzel', 'Trajan Pro', Georgia, serif;
    font-size: 15px;
}

.achievement-card__heading > span {
    color: #9fc7d7;
    font-size: 10px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
}

.achievement-card.is-completed .achievement-card__heading > span {
    color: #f5d98a;
}

.achievement-card p {
    min-height: 34px;
    margin: 5px 0 9px;
    color: #bcd3df;
    font-size: 12px;
    line-height: 1.4;
}

.achievement-progress {
    height: 5px;
    overflow: hidden;
    border-radius: 99px;
    background: rgba(0, 0, 0, 0.38);
}

.achievement-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #568eb0, #9fd8f4);
}

.achievement-card.is-completed .achievement-progress > span {
    background: linear-gradient(90deg, #b88a32, #f5d98a);
}

.achievement-card small {
    display: block;
    margin-top: 6px;
    color: #8eafbf;
    font-size: 10px;
}

.achievement-empty {
    grid-column: 1 / -1;
    margin: 18px 0;
    color: #9fc7d7;
    text-align: center;
}

.profileHubStatsGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.profileHubStatCard {
    border: 1px solid #35556d;
    background: #0c1a27;
    padding: 12px;
}

.profileHubStatCard h3 {
    margin: 0 0 8px;
    color: #8fd0f8;
    font-size: 16px;
}

.profileStatLine {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid rgba(159, 199, 215, 0.15);
    padding: 6px 0;
    font-size: 13px;
}

.profileStatLine:last-child {
    border-bottom: none;
}

#profileHistoryTabs {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

#profileHistoryLimit,
#profileLadderMeta {
    margin-bottom: 8px;
    color: #9fc7d7;
    font-size: 13px;
}

.profileTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.profileTable th,
.profileTable td {
    padding: 8px;
    border: 1px solid #294154;
    text-align: left;
}

.profileTable thead th {
    background: #12344a;
    color: #d8f5ff;
}

.profileRowWin {
    color: #44d6a0;
    font-weight: bold;
}

.profileRowLoss {
    color: #ff8888;
    font-weight: bold;
}

.profileSelfRow {
    background: rgba(68, 214, 160, 0.08);
}

.matchHistoryList {
    display: grid;
    gap: 10px;
}

.matchHistoryCard {
    overflow: hidden;
    border: 1px solid rgba(226, 200, 140, 0.28);
    border-radius: 12px;
    background: linear-gradient(150deg, rgba(78, 64, 112, 0.42), rgba(28, 23, 45, 0.88));
}

.matchHistoryCard summary {
    display: grid;
    grid-template-columns: 78px minmax(130px, 1fr) minmax(145px, auto) 58px 20px;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    padding: 8px 13px;
    color: var(--text-body, #d7cfe4);
    cursor: pointer;
    list-style: none;
}

.matchHistoryCard summary::-webkit-details-marker { display: none; }
.matchHistoryCard[open] summary { border-bottom: 1px solid rgba(226, 200, 140, 0.2); }
.matchHistoryOpponent { color: #f6efe0; font-weight: 700; }
.matchHistoryResult { letter-spacing: 0.08em; }
.matchHistoryChevron { color: var(--gold-bright, #f5d98a); font-size: 20px; transition: transform 160ms ease; }
.matchHistoryCard[open] .matchHistoryChevron { transform: rotate(180deg); }

.matchHistoryBody { padding: 13px; }
.matchHistoryMeta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; color: var(--text-muted, #a99fc0); font-size: 13px; }
.matchHistorySides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.matchHistorySide { min-width: 0; padding: 12px; border: 1px solid rgba(226, 200, 140, 0.22); border-radius: 10px; background: rgba(20, 15, 34, 0.42); }
.matchHistorySide header { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; color: var(--gold-bright, #f5d98a); }
.matchHistorySide header > span { color: var(--text-muted, #a99fc0); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.matchHistorySide h4 { margin: 13px 0 7px; color: var(--gold-bright, #f5d98a); font-size: 13px; }
.matchHistoryMetricGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.matchHistoryMetricGrid > div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 7px; background: rgba(255, 250, 240, 0.045); font-size: 12px; }
.matchHistoryMetricGrid span, .matchHistoryMuted { color: var(--text-muted, #a99fc0); }
.matchHistoryLoadout { display: grid; gap: 4px; }
.matchHistoryLoadoutRow { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 8px; font-size: 12px; }
.matchHistoryLoadoutRow span { color: var(--text-muted, #a99fc0); }
.matchHistoryPowerUps { display: grid; gap: 6px; }
.matchHistoryPowerUp { display: grid; grid-template-columns: minmax(100px, 1fr) repeat(4, auto); gap: 8px; padding: 7px 8px; border-radius: 7px; background: rgba(217, 180, 91, 0.08); font-size: 11px; }
.matchHistoryPowerUp strong { color: #fff6df; }
.matchHistoryPowerUp span { color: var(--text-muted, #a99fc0); }
.matchHistoryUnavailable { margin: 0; padding: 14px; text-align: center; color: var(--text-muted, #a99fc0); }

@media (max-width: 760px) {
    .matchHistoryCard summary { grid-template-columns: 70px minmax(100px, 1fr) 20px; }
    .matchHistoryCard summary > span:nth-child(3),
    .matchHistoryCard summary > span:nth-child(4) { display: none; }
    .matchHistorySides { grid-template-columns: 1fr; }
    .matchHistoryPowerUp { grid-template-columns: 1fr 1fr; }
}

/* Match history is also embedded inside the narrow lobby centre column. The
   viewport can still be desktop-wide there, so respond to the actual panel
   width instead of relying only on a viewport media query. */
@container lobby-view (max-width: 700px) {
    .matchHistoryCard summary {
        grid-template-columns: 64px minmax(0, 1fr) 18px;
        gap: 8px;
        padding-inline: 10px;
    }

    .matchHistoryCard summary > span:nth-child(3),
    .matchHistoryCard summary > span:nth-child(4) {
        display: none;
    }

    .matchHistoryBody {
        padding: 10px;
    }

    .matchHistorySides,
    .matchHistoryMetricGrid {
        grid-template-columns: 1fr;
    }

    .matchHistoryLoadoutRow {
        grid-template-columns: minmax(70px, 0.42fr) minmax(0, 1fr);
    }

    .matchHistoryLoadoutRow strong,
    .matchHistoryPowerUp > * {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .matchHistoryPowerUp {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 5px 8px;
    }
}

@media (max-width: 900px) {
    .profileHubStatsGrid {
        grid-template-columns: 1fr;
    }

    .achievement-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .achievement-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .achievement-filters {
        justify-content: flex-start;
    }
}

/* ===== Fantasy Overlay Theme (shared by all pop-up windows/HUD) =====
   Repainted to match the lobby: twilight violet glass panels, gold
   accents, parchment text. Kept the --glass-* names so every existing
   overlay rule below inherits the new look without further edits. */
:root {
    /* Gold accent system (shared with the lobby) */
    --gold: #d9b45b;
    --gold-bright: #f5d98a;
    --gold-glow: rgba(245, 217, 138, 0.55);

    --glass-text: #f6efe0;
    --glass-muted: #a99fc0;
    --glass-line: rgba(226, 200, 140, 0.28);
    --glass-line-strong: rgba(226, 200, 140, 0.48);
    --glass-bg: linear-gradient(160deg, rgba(90, 76, 128, 0.45) 0%, rgba(46, 38, 70, 0.72) 56%, rgba(30, 25, 48, 0.86) 100%);
    --glass-spot: radial-gradient(circle at top left, rgba(245, 217, 138, 0.16), transparent 44%);
    --glass-shadow: 0 16px 44px rgba(10, 6, 20, 0.5), inset 0 1px 0 rgba(255, 250, 240, 0.12);
    --glass-btn: linear-gradient(180deg, rgba(120, 100, 155, 0.55) 0%, rgba(60, 48, 90, 0.8) 100%);
    --glass-btn-hover: linear-gradient(180deg, rgba(150, 125, 180, 0.62) 0%, rgba(80, 62, 115, 0.85) 100%);
    --glass-input: rgba(20, 14, 30, 0.5);

    /* Shared fantasy UI tokens. The lobby, overlays, and tutorial all consume
       these values so theme changes propagate through the complete site. */
    --panel-bg: rgba(38, 32, 58, 0.62);
    --panel-bg-solid: rgba(30, 25, 48, 0.9);
    --panel-inner: rgba(255, 250, 240, 0.05);
    --panel-border: rgba(226, 200, 140, 0.38);
    --panel-radius: 16px;
    --gold-soft: rgba(217, 180, 91, 0.16);
    --text-strong: #f6efe0;
    --text-body: #d7cfe4;
    --text-muted: #a99fc0;
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --font-heading: 'Cinzel', 'Trajan Pro', Georgia, serif;
    --font-body: 'Segoe UI', system-ui, 'Helvetica Neue', Arial, sans-serif;
    --lobby-sky-top: #2b2547;
    --lobby-sky-mid: #574a78;
    --lobby-sky-glow: #b98fb0;
    --lobby-sky-low: #e7c9a9;
    --status-online: #8be6b0;
    --status-away: #f0cf7c;
    --status-offline: #7e7794;
    --system-msg: #f0cf7c;
}

body {
    color: var(--glass-text);
}

#authCard,
#onlineQueueCard,
#rankedSummaryCard,
#powerUpPresetCard,
.presetPickerCard,
#profileHubCard,
#skillTreeCard {
    border: 1px solid var(--glass-line-strong);
    background-image: var(--glass-spot), var(--glass-bg);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(14px) saturate(135%);
    -webkit-backdrop-filter: blur(14px) saturate(135%);
    color: var(--glass-text);
    border-radius: 14px;
}

#authCard h1,
#onlineQueueCard h2,
#rankedSummaryCard h2,
#powerUpPresetCard h2,
#profileHubHeader h2 {
    color: #f3fbff;
    text-shadow: 0 2px 14px rgba(157, 221, 255, 0.28);
}

#authCard h1 {
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 5;
    margin: 0;
    font-size: clamp(36px, 6vw, 48px);
    line-height: 1;
    white-space: nowrap;
    color: var(--gold-bright);
    text-shadow: 0 2px 2px rgba(24, 15, 38, 0.9), 0 0 18px var(--gold-glow);
    transform: translate(-50%, -58%);
}

#authCard h1::before {
    content: '';
    position: absolute;
    top: calc(50% + 8px);
    left: 50%;
    z-index: -1;
    width: min(460px, 112vw);
    aspect-ratio: 2.85 / 1;
    background: url('../img/ui/rival-spires-title-backplate.png') center / 100% 100% no-repeat;
    filter: drop-shadow(0 8px 10px rgba(16, 7, 29, 0.62));
    transform: translate(-50%, -62%);
    pointer-events: none;
}

#authCard {
    padding-top: 58px;
}

#authCard p,
#onlineQueueStatus,
#powerUpPresetHelp,
#profileHubMessage,
#skillTreeMessage,
#profileHistoryLimit,
#profileLadderMeta,
.rankedRatingLabel,
.profileStatLine,
.skillTreeStatusLabel,
.skillTreeNodeMeta,
.presetTypeText {
    color: var(--glass-muted);
}

#sessionBar {
    border: 1px solid var(--glass-line);
    background-image: var(--glass-spot), var(--glass-bg);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px) saturate(125%);
    -webkit-backdrop-filter: blur(12px) saturate(125%);
    border-radius: 12px;
}

#authTabs button,
.profileHubTab,
.profileHistoryTab,
#rankedSummaryCard button,
#onlineQueueCard button,
#profileHubCloseButton,
#skillTreeResetButton,
#skillTreeCloseButton,
#presetRenameButton,
#presetSaveButton,
#presetCloseButton,
.presetPickerClearButton,
.presetPickerCloseButton,
.skillTreeSpendButton,
.glass-action-button,
#sessionBar button {
    border: 1px solid var(--glass-line-strong);
    background: var(--glass-btn);
    color: #f5fcff;
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 5px 14px rgba(0, 0, 0, 0.24);
}

#authTabs button:hover,
.profileHubTab:hover,
.profileHistoryTab:hover,
#rankedSummaryCard button:hover,
#onlineQueueCard button:hover,
#profileHubCloseButton:hover,
#skillTreeResetButton:hover:not(:disabled),
#skillTreeCloseButton:hover,
#presetRenameButton:hover,
#presetSaveButton:hover,
#presetCloseButton:hover,
.presetPickerClearButton:hover,
.presetPickerCloseButton:hover,
.skillTreeSpendButton:hover,
.glass-action-button:hover:not(:disabled),
#sessionBar button:hover {
    background: var(--glass-btn-hover);
}

#authTabs button.active,
.profileHubTab.active,
.profileHistoryTab.active {
    border-color: rgba(214, 243, 255, 0.95);
    background: linear-gradient(180deg, rgba(110, 176, 211, 0.68) 0%, rgba(56, 118, 151, 0.82) 100%);
}

.authForm input,
#presetNameInput,
#activePresetSelect,
.presetInlineRename input {
    border: 1px solid var(--glass-line);
    background: var(--glass-input);
    color: var(--glass-text);
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.rankedRatingRow,
.profileHubStatCard,
.skillTreeStatusCard,
.skillTreeColumn,
.skillTreeNode,
.presetEditorRow,
.presetCategoryColumn,
.presetTypeOption,
.profileTable th,
.profileTable td {
    border-color: var(--glass-line);
    background: rgba(11, 26, 37, 0.58);
}

.skillTreeNode.maxed,
.profileSelfRow,
.rankedRatingDelta,
.presetSlotButton.filled,
.presetTypeOption.selected {
    border-color: rgba(173, 236, 255, 0.55);
    background: rgba(58, 118, 148, 0.28);
}

.presetSlotButton,
.presetSlotMarker,
.skillTreeNodeBadge,
.presetTypeMarker {
    border-color: var(--glass-line);
    background: rgba(10, 22, 34, 0.58);
}

.profileTable thead th {
    background: rgba(60, 124, 158, 0.36);
    color: #f0fbff;
}

#onlineQueueOverlay,
#rankedSummaryOverlay,
#powerUpPresetOverlay,
#profileHubOverlay,
#skillTreeOverlay,
.presetPickerBackdrop {
    background:
        radial-gradient(circle at 24% 18%, rgba(130, 206, 252, 0.18), transparent 38%),
        radial-gradient(circle at 82% 74%, rgba(115, 166, 216, 0.12), transparent 36%),
        rgba(3, 9, 14, 0.74);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#authCard {
    background: #0c1824;
    border-color: #5f8ca9;
}

/* ===== Fantasy accents — cohesion with the lobby ===== */

/* Elegant heading font across every overlay (Cinzel is loaded by lobby.css) */
#authCard h1,
#onlineQueueCard h2,
#rankedSummaryCard h2,
#powerUpPresetCard h2,
#profileHubHeader h2,
.profileHubStatCard h3,
.skillTreeColumnHeader,
.skillTreeNodeTitle,
.presetEditorTitle,
.presetPickerTitle {
    font-family: 'Cinzel', 'Trajan Pro', Georgia, serif;
    letter-spacing: 0.04em;
}

/* Gold glow on button hover across overlays */
#authTabs button:hover,
.profileHubTab:hover,
.profileHistoryTab:hover,
#rankedSummaryCard button:hover,
#onlineQueueCard button:hover,
#profileHubCloseButton:hover,
#skillTreeCloseButton:hover,
#presetRenameButton:hover,
#presetSaveButton:hover,
#presetCloseButton:hover,
.presetPickerClearButton:hover,
.presetPickerCloseButton:hover,
.skillTreeSpendButton:hover,
.glass-action-button:hover:not(:disabled),
#sessionBar button:hover,
.authForm button:hover {
    box-shadow: 0 0 14px var(--gold-glow), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    border-color: var(--gold);
}

/* Primary submit / confirm buttons get a solid gold fill */
.authForm button,
#presetSaveButton {
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    border-color: var(--gold);
    color: #241a12;
    font-weight: 700;
}

.authForm button:hover,
#presetSaveButton:hover {
    background: linear-gradient(180deg, #ffe6a4, var(--gold-bright));
}

/* Active tabs -> gold */
#authTabs button.active,
.profileHubTab.active,
.profileHistoryTab.active {
    border-color: var(--gold);
    background: linear-gradient(180deg, rgba(245, 217, 138, 0.32) 0%, rgba(217, 180, 91, 0.22) 100%);
    color: #fff6df;
}

/* Ranked summary: swap the old purple frame for gold */
#rankedSummaryCard {
    border-color: var(--gold);
    box-shadow: 0 0 30px var(--gold-glow), 0 16px 40px rgba(10, 6, 20, 0.5);
}

#rankedSummaryCard h2 {
    color: var(--gold-bright);
}

.rankedRatingValue {
    color: var(--gold-bright);
}

/* Gold focus ring for text inputs / selects */
.authForm input:focus,
#presetNameInput:focus,
#activePresetSelect:focus,
.presetInlineRename input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
}

/* The body is the single outer-background paint for login, lobby, and game. */
body {
    background-color: #1c0f2f;
    background-image:
        linear-gradient(90deg,
            #05020d 0%,
            #140924 58%,
            #1c0f2f 100%),
        linear-gradient(90deg,
            #1c0f2f 0%,
            #140924 42%,
            #05020d 100%);
    background-position: left top, right top;
    background-size:
        max(0px, calc((100vw - 1800px) / 2)) 100%,
        max(0px, calc((100vw - 1800px) / 2)) 100%;
    background-repeat: no-repeat;
}

/* Auth screen: private, fantasy-toned gate matching the lobby */
#authOverlay {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Authentication reveals the shared body paint, never the already-built
   lobby or game layers underneath the transparent overlay. */
body.auth-active #lobbyRoot,
body.auth-active #lobbyParticles,
body.auth-active #gameCanvas,
body.auth-active #gameCanvasFrame,
body.auth-active #gameParticles {
    visibility: hidden;
}

#authCard {
    background: linear-gradient(160deg, rgba(62, 52, 94, 0.98) 0%, rgba(34, 27, 52, 0.99) 100%);
    border-color: var(--gold);
}

/* ===== Fantasy retint for view inner content =====
   Skill tree, presets, and profile tables still carried hardcoded blue/teal
   colors. Retint them to the violet + gold lobby palette so the inline views
   (and any pop-up use) match the theme. */
.skillTreeColumn,
.skillTreeStatusCard,
.presetCategoryColumn,
.presetEditorRow,
.presetTypeOption,
.presetSlotButton,
.skillTreeNodeBadge,
.presetSlotMarker,
.presetTypeMarker {
    border-color: rgba(226, 200, 140, 0.28);
    background: rgba(70, 58, 104, 0.30);
}

.skillTreeNode {
    border-color: rgba(226, 200, 140, 0.30);
    background: linear-gradient(180deg, rgba(90, 76, 128, 0.42) 0%, rgba(46, 38, 70, 0.74) 100%);
}

.skillTreeNode.maxed {
    border-color: #8be6b0;
    background: linear-gradient(180deg, rgba(60, 110, 90, 0.42) 0%, rgba(28, 60, 46, 0.72) 100%);
}

.skillTreeNode.can-spend {
    border-color: var(--gold);
    background: linear-gradient(180deg, rgba(122, 96, 50, 0.42) 0%, rgba(70, 55, 25, 0.72) 100%);
    box-shadow: 0 0 0 1px rgba(245, 217, 138, 0.4), 0 0 22px rgba(214, 170, 80, 0.22);
}

.skillTreeColumnHeader,
.presetCategoryColumn h4,
.profileHubStatCard h3,
.skillTreeNodeRank,
.presetTypeName {
    color: var(--gold-bright);
}

.skillTreeNodeTitle { color: #f6efe0; }
.skillTreeNodeBody { color: var(--glass-text); }

.skillTreeNodeMeta,
.presetTypeText,
.presetSlotLabel {
    color: var(--glass-muted);
}

.skillTreeTab {
    background: rgba(46, 38, 70, 0.5);
    color: var(--glass-muted);
    border-color: rgba(226, 200, 140, 0.28);
}

.skillTreeTab:hover {
    color: var(--gold-bright);
    background: rgba(70, 58, 104, 0.5);
}

.skillTreeTab.active {
    color: #fff6df;
    border-color: var(--gold);
    border-bottom-color: var(--gold);
    background: linear-gradient(180deg, rgba(245, 217, 138, 0.28) 0%, rgba(217, 180, 91, 0.2) 100%);
}

#skillTreeTabs { border-bottom-color: rgba(226, 200, 140, 0.28); }

.skillTreeConnectionPath { stroke: rgba(226, 200, 140, 0.55); }

.presetSlotButton.filled,
.presetTypeOption.selected {
    border-color: var(--gold);
    background: rgba(122, 96, 50, 0.32);
}

.profileTable th,
.profileTable td { border-color: rgba(226, 200, 140, 0.24); }

.profileTable thead th {
    background: rgba(122, 96, 50, 0.34);
    color: var(--gold-bright);
}

.profileSelfRow { background: rgba(217, 180, 91, 0.16); }
.profileStatLine { border-bottom-color: rgba(226, 200, 140, 0.18); }
/* =============================================================
   Rival Spires — Fantasy Lobby
   Modular stylesheet for the DOM lobby that replaces the
   canvas-drawn main menu. Loaded in addition to main.css.
   All lobby rules are namespaced under #lobbyRoot to avoid
   colliding with existing game / overlay styles.
   ============================================================= */

/* Elegant heading font (graceful serif fallback when offline). */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=EB+Garamond:ital@0;1&display=swap');

/* -------------------------------------------------------------
   2. Root layout
   ------------------------------------------------------------- */
#lobbyRoot {
    position: fixed;
    top: 0;
    bottom: 0;

    left: 50%;
    transform: translateX(-50%);

    width: min(100%, 1800px);

    z-index: 400;
    display: none;

    grid-template-columns: minmax(220px, 300px) minmax(0, 1fr) minmax(240px, 340px);
    grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
        "topbar topbar topbar"
        "friends center leaderboard"
        "news center chat";

    gap: 18px;
    padding: 18px;
    box-sizing: border-box;
    overflow: hidden;

    font-family: var(--font-body);
    color: var(--text-body);
}

#lobbyRoot.is-visible {
    display: grid;
    opacity: 1;                   /* resting state is always visible */
    animation: lobbyFadeIn 0.5s var(--ease);
}

@keyframes lobbyFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* The gameplay canvas is capped at the same 1800px width as the lobby. Its
   surrounding background and motes remain ordinary composited DOM/CSS. */
#gameParticles {
    z-index: 0;
    display: none;
}

body.game-canvas-active #gameParticles {
    display: block;
}

#gameCanvasFrame {
    z-index: 2;
    display: none;
}

@media (min-width: 1801px) {
    body.game-canvas-active #gameCanvasFrame {
        display: block;
    }
}

/* Floating magical particles (elements injected by the existing screens) */
#lobbyParticles {
    z-index: 399;
    display: none;
}

body:has(#lobbyRoot.is-visible) #lobbyParticles {
    display: block;
}

.lobby-particle {
    position: absolute;
    bottom: -12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--gold-bright), rgba(245, 217, 138, 0));
    opacity: 0;
    animation: particleRise linear infinite;
}

@keyframes particleRise {
    0%   { transform: translateY(0) scale(0.6); opacity: 0; }
    12%  { opacity: 0.9; }
    88%  { opacity: 0.7; }
    100% { transform: translateY(-102vh) scale(1); opacity: 0; }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    #lobbyRoot.is-visible { animation: none; }
    .lobby-particle,
    .lobby-panel { animation: none !important; }
}

/* -------------------------------------------------------------
   4. Reusable panel component
   ------------------------------------------------------------- */
.lobby-panel {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    min-height: 0;                /* allow inner scroll areas to shrink */
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--panel-radius);
    /* Outer shadow disabled because #lobbyRoot clips it at the 1800px edge. */
    /* box-shadow: 0 12px 30px rgba(10, 6, 20, 0.45); */
    box-shadow: inset 0 1px 0 var(--panel-inner);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 1;                   /* resting state is always visible */
    animation: panelIn 0.5s var(--ease);
}

@keyframes panelIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.lobby-panel__header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--panel-border);
    text-align: center;
}

.lobby-panel__header > .lobby-tag {
    position: absolute;
    right: 16px;
}

.lobby-panel__title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--gold-bright);
    text-transform: uppercase;
}

.lobby-panel__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px 14px;
    overflow-y: auto;
}

/* Thin themed scrollbars */
.lobby-panel__body::-webkit-scrollbar { width: 8px; }
.lobby-panel__body::-webkit-scrollbar-thumb {
    background: var(--gold-soft);
    border-radius: 8px;
}

/* Small "coming soon" tag for placeholder panels */
.lobby-tag {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
    background: var(--gold-soft);
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    padding: 2px 8px;
}

/* -------------------------------------------------------------
   5. Top bar
   ------------------------------------------------------------- */
#lobbyTopBar {
    grid-area: topbar;
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 18px;
    background: linear-gradient(180deg, rgba(40, 33, 60, 0.85), rgba(30, 25, 48, 0.72));
    border: 1px solid var(--panel-border);
    border-radius: var(--panel-radius);
    /* Outer shadow disabled because #lobbyRoot clips it at the 1800px edge. */
    /* box-shadow: 0 10px 26px rgba(10, 6, 20, 0.45); */
    box-shadow: inset 0 1px 0 var(--panel-inner);
    flex-wrap: nowrap;
    min-width: 0;
}

#queueRangeInfo,
#queueTimer,
#queueTip {
    margin: 10px 0;
    text-align: center;
}

#queueRangeInfo {
    color: var(--gold-bright);
    font-size: 14px;
}

#queueTimer {
    color: var(--glass-text);
    font-size: 16px;
    font-weight: 700;
}

#queueTip {
    min-height: 38px;
    color: var(--glass-muted);
    font-size: 13px;
    font-style: italic;
}

#cancelOnlineQueueButton {
    display: block;
    min-width: 120px;
    margin: 14px auto 0;
}

.lobby-crest {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    font-size: 24px;
    border-radius: 12px;
    color: #241a12;
    /*background: radial-gradient(circle at 35% 30%, var(--gold-bright), var(--gold) 70%); */
    /*box-shadow: 0 0 16px var(--gold-glow), inset 0 1px 2px rgba(255, 255, 255, 0.5); */
}

.lobby-crest img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Keeps the whole logo visible */
}

.lobby-brand {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}

.lobby-brand__title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--gold-bright);
    text-shadow: 0 0 14px var(--gold-glow);
}

.lobby-brand__tagline {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-style: italic;
}

/* Player identity cluster inside the top bar */
#lobbyIdentity {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
    min-width: 0;
    flex: 0 1 auto;
}

.lobby-online-count {
    position: absolute;
    left: 140px;
    bottom: 8px;
    transform: translateX(-50%);
    color: var(--gold-bright);
    font: 700 11px/1 var(--font-body);
    white-space: nowrap;
    text-shadow: 0 0 10px var(--gold-glow);
    pointer-events: none;
    user-select: none;
}

.lobby-league {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 150px;
    min-height: 50px;
    padding: 5px 14px 6px;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: var(--gold-soft);
    color: inherit;
    font: inherit;
    appearance: none;
    transition: border-color 160ms var(--ease), background 160ms var(--ease), box-shadow 160ms var(--ease);
}

.lobby-league:not(.is-home) {
    cursor: pointer;
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 0;
    width: 286px;
    min-width: 286px;
    height: 65px;
    min-height: 65px;
    padding: 0;
    overflow: hidden;
    border-color: rgba(245, 217, 138, 0.68);
    background: linear-gradient(180deg, rgba(245, 217, 138, 0.23), rgba(217, 180, 91, 0.13));
    box-shadow: 0 0 16px rgba(245, 217, 138, 0.13), inset 0 1px 0 rgba(255, 250, 230, 0.14);
}

.lobby-league:not(.is-home):hover,
.lobby-league:not(.is-home):focus-visible {
    border-color: var(--gold-bright);
    background: linear-gradient(180deg, rgba(245, 217, 138, 0.34), rgba(217, 180, 91, 0.2));
    box-shadow: 0 0 22px rgba(245, 217, 138, 0.3), inset 0 1px 0 rgba(255, 250, 230, 0.2);
    outline: none;
}

.lobby-league.is-home:disabled {
    opacity: 1;
}

.lobby-league__play {
    display: grid;
    place-content: center;
    gap: 4px;
    color: var(--gold-bright);
    text-align: center;
}

.lobby-league__play strong {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.18em;
    text-indent: 0.18em;
    text-shadow: 0 0 9px rgba(245, 217, 138, 0.48);
}

.lobby-league__play small {
    color: var(--text-muted);
    font: 8px/1 Arial, sans-serif;
    letter-spacing: 0.08em;
}

.lobby-league__play[hidden] { display: none; }

.lobby-league__icon {
    display: block;
    width: 34px;
    height: 34px;
    object-fit: contain;
    filter: drop-shadow(0 0 6px var(--gold-glow));
}
.lobby-league__icon[hidden] { display: none; }

/* League icon shine used on promotion */
.lobby-league.is-promoted .lobby-league__icon {
    animation: leagueShine 1.2s var(--ease);
}

@keyframes leagueShine {
    0%   { filter: drop-shadow(0 0 4px var(--gold-glow)) brightness(1); transform: scale(1); }
    40%  { filter: drop-shadow(0 0 18px var(--gold-bright)) brightness(1.8); transform: scale(1.25) rotate(-6deg); }
    100% { filter: drop-shadow(0 0 6px var(--gold-glow)) brightness(1); transform: scale(1); }
}

/* Icon-style top bar button (Settings shortcut) */
.lobby-icon-btn {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    font-size: 18px;
    color: var(--text-strong);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    cursor: pointer;
    transition: box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.lobby-icon-btn:hover {
    background: var(--gold-soft);
    box-shadow: 0 0 14px var(--gold-glow);
}

/* -------------------------------------------------------------
   6. Center — primary game mode buttons
   ------------------------------------------------------------- */
#lobbyCenter {
    grid-area: center;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}

#lobbyArenaHome {
    width: min(100%, 520px);
    min-width: 0;
}

.lobby-hero-title {
    margin: 0 0 12px;
    transform: translateY(-8px);
    font-family: var(--font-heading);
    font-size: clamp(28px, 3vw, 44px);
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-strong);
    text-shadow: 0 0 22px rgba(245, 217, 138, 0.3);
}

.lobby-modes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 18px;
    width: 100%;
}

.lobby-mode {
    position: relative;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 22px 18px;
    cursor: pointer;
    color: var(--text-strong);
    background: linear-gradient(160deg, rgba(90, 76, 128, 0.5), rgba(38, 32, 58, 0.72));
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    box-shadow: inset 0 1px 0 var(--panel-inner);
    font: inherit;
    transition: box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}

.lobby-mode__icon { font-size: 30px; filter: drop-shadow(0 0 8px rgba(245, 217, 138, 0.4)); }
.lobby-mode__label {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.lobby-mode__desc { font-size: 12px; color: var(--text-muted); }

/* Keep the cards even while the three-column lobby is being squeezed. */
@media (min-width: 981px) and (max-width: 1180px) {
    .lobby-mode {
        padding-inline: clamp(8px, 1.4vw, 16px);
    }

    .lobby-mode__label {
        font-size: clamp(13px, 1.45vw, 17px);
        letter-spacing: clamp(0.01em, 0.04vw, 0.04em);
        white-space: nowrap;
    }

    .lobby-mode__desc {
        font-size: clamp(10px, 1vw, 12px);
        white-space: nowrap;
    }
}

/* Button hover glow */
.lobby-mode:hover,
.lobby-mode:focus-visible {
    border-color: var(--gold);
    box-shadow: 0 14px 30px rgba(10, 6, 20, 0.5), 0 0 22px var(--gold-glow);
    outline: none;
}

/* Offline bot difficulty selector */
.bot-difficulty-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: grid;
    place-items: center;
    padding: 24px;
    box-sizing: border-box;
    background: rgba(12, 8, 22, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.bot-difficulty-overlay[hidden] { display: none; }

.bot-difficulty-card {
    position: relative;
    width: min(820px, 100%);
    padding: 32px;
    box-sizing: border-box;
    color: var(--text-body);
    text-align: center;
    background:
        radial-gradient(circle at 50% 0%, rgba(245, 217, 138, 0.13), transparent 42%),
        linear-gradient(160deg, rgba(90, 76, 128, 0.97), rgba(38, 32, 58, 0.98));
    border: 1px solid var(--panel-border);
    border-radius: var(--panel-radius);
    box-shadow: 0 24px 70px rgba(10, 6, 20, 0.65), inset 0 1px 0 var(--panel-inner);
    animation: panelIn 0.28s var(--ease);
}

.bot-difficulty-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px 0 0;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    border-radius: 11px;
    cursor: pointer;
    font: 26px/1 Arial, sans-serif;
    transition: color 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.bot-difficulty-close:hover,
.bot-difficulty-close:focus-visible {
    color: var(--gold-bright);
    background: var(--gold-soft);
    border-color: var(--gold);
    outline: none;
}

.bot-difficulty-eyebrow {
    margin: 0 0 5px;
    color: var(--gold);
    font: 700 12px/1 var(--font-body);
    letter-spacing: 0.22em;
}

.bot-difficulty-card h2 {
    margin: 0;
    color: var(--gold-bright);
    font-family: var(--font-heading);
    font-size: clamp(28px, 4vw, 42px);
    letter-spacing: 0.06em;
    text-shadow: 0 0 20px rgba(245, 217, 138, 0.25);
}

.bot-difficulty-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.bot-difficulty-option {
    min-width: 0;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 22px 16px;
    color: var(--text-strong);
    background: linear-gradient(160deg, rgba(110, 91, 145, 0.48), rgba(30, 25, 48, 0.8));
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    box-shadow: inset 0 1px 0 var(--panel-inner);
    cursor: pointer;
    font: inherit;
    transition: box-shadow 0.22s var(--ease), border-color 0.22s var(--ease), background 0.22s var(--ease);
}

.bot-difficulty-option:hover,
.bot-difficulty-option:focus-visible {
    border-color: var(--gold);
    background: linear-gradient(160deg, rgba(145, 116, 172, 0.62), rgba(54, 42, 78, 0.9));
    box-shadow: 0 14px 30px rgba(10, 6, 20, 0.48), 0 0 20px rgba(245, 217, 138, 0.32);
    outline: none;
}

.bot-difficulty-option__name {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

@media (max-width: 720px) {
    .bot-difficulty-card { padding: 28px 20px 22px; }
    .bot-difficulty-options { grid-template-columns: 1fr; }
    .bot-difficulty-option { min-height: 128px; }
}

/* Featured (ranked) mode gets a stronger golden frame */
.lobby-mode.is-featured {
    background: linear-gradient(160deg, rgba(120, 90, 150, 0.55), rgba(48, 36, 70, 0.8));
}

#lobbyRoot > * { min-width: 0; }

/* Secondary quick actions (preset / skill tree) */
.lobby-quick {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

/* -------------------------------------------------------------
   6b. Inline arena views (Player Hub / Presets / Skill Tree)
   These host each module's existing card in the center panel
   instead of a fullscreen pop-up. The module JS is untouched;
   lobby.js reparents the card into #lobbyViewHost.
   ------------------------------------------------------------- */

/* When a view is open the center panel becomes a scrollable column. */
#lobbyCenter.is-viewing {
    align-items: stretch;
    justify-content: flex-start;
    text-align: left;
    padding: 0;
    overflow: visible;
}

/* Wide views (Power-Up Presets / Skill Tree) need the full lobby width to
   fit their multi-column layouts. Expand the center across the whole area
   and hide the side panels while such a view is open (desktop-first). */
#lobbyRoot.view-wide {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "topbar"
        "center";
}

#lobbyRoot.view-wide #lobbyFriends,
#lobbyRoot.view-wide #lobbyLeaderboard,
#lobbyRoot.view-wide #lobbyNews,
#lobbyRoot.view-wide #lobbyChat {
    display: none;
}

#lobbyArenaView {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

/* Respect the hidden attribute (id selector would otherwise override it). */
#lobbyArenaView[hidden] {
    display: none;
}

.lobby-view-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--panel-border);
}

.lobby-view-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--gold-bright);
    text-transform: uppercase;
}

.lobby-view-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 14px;
    font: inherit;
    font-size: 13px;
    color: var(--text-strong);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.lobby-view-back:hover {
    background: var(--gold-soft);
    box-shadow: 0 0 12px var(--gold-glow);
}

/* Scroll region that holds the reparented module card. */
#lobbyViewHost {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 16px 18px;
    box-sizing: border-box;
    animation: panelIn 0.4s var(--ease);
}

#lobbyViewHost::-webkit-scrollbar { width: 8px; }
#lobbyViewHost::-webkit-scrollbar-thumb { background: var(--gold-soft); border-radius: 8px; }

/* Tournament details own their scrolling through the draggable bracket.
   Keep the general inline-view host fixed so it cannot add a second bar. */
#lobbyViewHost.is-tournament-detail {
    display: flex;
    overflow: hidden;
}

.tournament-header-create { display: none; }
#lobbyRoot.view-tournament .tournament-header-create:not([hidden]) {
    display: inline-flex;
    min-height: 34px;
    margin-left: 2px;
    padding: 6px 14px;
}

#lobbyViewHost.is-tournament-detail > .tournament-lobby {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden !important;
}

#lobbyViewHost.is-tournament-detail #tournamentLobbyContent,
#lobbyViewHost.is-tournament-detail .tournament-detail {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

#lobbyViewHost.is-tournament-detail .tournament-bracket {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

#lobbyViewHost.is-tournament-detail .tournament-bracket__viewport {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: auto;
}

/* Strip the reparented card's own chrome so it blends into the panel. */
#lobbyViewHost > * {
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
}

/* The header Back button replaces each module's own Close button. */
#lobbyViewHost #profileHubCloseButton,
#lobbyViewHost #skillTreeCloseButton,
#lobbyViewHost #presetCloseButton,
#lobbyViewHost #adminDashboardClose {
    display: none !important;
}

.lobby-view-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.lobby-view-version {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.lobby-view-action {
    padding: 7px 14px;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    color: var(--text-strong);
    background: rgba(255, 255, 255, 0.06);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.lobby-view-action[aria-pressed="true"] {
    border-color: var(--gold);
    color: var(--gold-bright);
    background: var(--gold-soft);
}

/* Tournament lobby ------------------------------------------------------ */
.tournament-lobby {
    width: 100%;
    min-height: min(650px, calc(100vh - 210px));
    color: var(--text-primary);
}

.tournament-lobby__toolbar,
.tournament-detail__top,
.tournament-section__heading,
.tournament-form-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.tournament-lobby__toolbar {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(221, 184, 92, 0.42);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(72, 48, 101, 0.88), rgba(30, 22, 50, 0.92));
    box-shadow: inset 0 1px 0 rgba(255, 236, 177, 0.08), 0 12px 28px rgba(8, 5, 18, 0.22);
}

.tournament-lobby.is-detail .tournament-lobby__toolbar { display: none; }

.tournament-lobby__eyebrow,
.tournament-series__label {
    color: #e7c875;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

#tournamentLobbySummary {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.tournament-primary-button,
.tournament-secondary-button,
.tournament-danger-button,
.tournament-text-button {
    min-height: 38px;
    border-radius: 9px;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.tournament-primary-button,
.tournament-secondary-button,
.tournament-danger-button {
    padding: 9px 15px;
    border: 1px solid var(--gold);
}

.tournament-primary-button {
    color: #241a12;
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
}

.tournament-secondary-button,
.tournament-danger-button {
    color: var(--gold-bright);
    background: var(--gold-soft);
}

.tournament-text-button {
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid var(--gold);
    color: var(--gold-bright);
    background: var(--gold-soft);
}

.tournament-primary-button:hover,
.tournament-primary-button:focus-visible,
.tournament-secondary-button:hover,
.tournament-secondary-button:focus-visible,
.tournament-danger-button:hover,
.tournament-danger-button:focus-visible,
.tournament-text-button:hover,
.tournament-text-button:focus-visible {
    filter: brightness(1.08);
    outline: none;
    border-color: var(--gold-bright);
    box-shadow: 0 0 14px var(--gold-glow);
}

.tournament-primary-button:focus-visible,
.tournament-secondary-button:focus-visible,
.tournament-danger-button:focus-visible {
    box-shadow: 0 0 0 2px rgba(239, 211, 132, 0.25), 0 0 18px var(--gold-glow);
}

.tournament-message {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid rgba(102, 204, 156, 0.42);
    border-radius: 8px;
    color: #bdf2d1;
    background: rgba(31, 85, 65, 0.34);
}

.tournament-message.is-error {
    border-color: rgba(222, 98, 116, 0.48);
    color: #ffcbd2;
    background: rgba(104, 34, 51, 0.38);
}

.tournament-section {
    margin: 0 0 22px;
}

.tournament-section__heading {
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(206, 173, 232, 0.16);
    padding: 0 2px 8px;
}

.tournament-section__heading h3,
.tournament-detail h3,
.tournament-create-form h3 {
    margin: 0;
    color: #f4e8ff;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 19px;
    letter-spacing: 0.02em;
}

.tournament-section__heading > span {
    min-width: 26px;
    padding: 3px 8px;
    border: 1px solid rgba(221, 184, 92, 0.32);
    border-radius: 999px;
    color: #e7c875;
    text-align: center;
    font-size: 11px;
}

.tournament-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
    gap: 10px;
}

.tournament-tile {
    display: flex;
    min-height: 145px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 13px;
    border: 1px solid rgba(179, 137, 213, 0.28);
    border-radius: 11px;
    color: #f5ebff;
    text-align: left;
    background: linear-gradient(145deg, rgba(62, 44, 84, 0.86), rgba(26, 20, 42, 0.94));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
    cursor: pointer;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.tournament-tile.is-official {
    border-color: rgba(221, 184, 92, 0.44);
    background: linear-gradient(145deg, rgba(83, 54, 82, 0.9), rgba(31, 22, 45, 0.96));
}

.tournament-tile:hover,
.tournament-tile:focus-visible {
    border-color: rgba(233, 203, 127, 0.76);
    box-shadow: 0 8px 24px rgba(8, 5, 18, 0.3), 0 0 18px rgba(161, 101, 213, 0.15);
    outline: none;
}

.tournament-tile__top,
.tournament-tile__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tournament-tile__chips {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}

.tournament-chip {
    display: inline-flex;
    width: fit-content;
    padding: 3px 7px;
    border: 1px solid rgba(218, 183, 99, 0.34);
    border-radius: 999px;
    color: #e9cf8b;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tournament-chip.is-joined {
    border-color: rgba(102, 204, 156, 0.38);
    color: #b9e9cd;
}

.tournament-chip.is-private {
    border-color: rgba(177, 137, 207, 0.46);
    color: #d8b9ee;
}

.tournament-tile strong {
    overflow: hidden;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tournament-tile__meta,
.tournament-tile__time,
.tournament-tile__format,
.tournament-empty {
    color: var(--text-muted);
    font-size: 11px;
}

.tournament-tile__format { margin-top: auto; }

.tournament-empty {
    margin: 0;
    padding: 18px;
    border: 1px dashed rgba(184, 145, 211, 0.2);
    border-radius: 10px;
    text-align: center;
    background: rgba(24, 17, 39, 0.35);
}

.tournament-create-form,
.tournament-detail {
    padding: 18px;
    border: 1px solid rgba(184, 145, 211, 0.26);
    border-radius: 12px;
    background: rgba(26, 19, 43, 0.8);
}

.tournament-detail { padding: 12px; }
.tournament-detail__top { min-height: 30px; justify-content: flex-end; }

.tournament-form-heading { margin-bottom: 18px; }

.tournament-form-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 13px;
}

.tournament-form-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #d7c5e5;
    font-size: 11px;
    font-weight: 700;
    min-width: 0;
}

.tournament-form-grid label[hidden] { display: none; }

.tournament-field--name { grid-column: span 9; }
.tournament-field--size { grid-column: span 3; }
.tournament-field--start { grid-column: span 4; }
.tournament-field--time { grid-column: span 8; }
.tournament-field--empty { grid-column: span 4; }
.tournament-field--format { grid-column: span 8; }
.tournament-field--password { grid-column: span 6; }
.tournament-field--gold { grid-column: span 6; }

.tournament-form-grid input,
.tournament-form-grid select {
    box-sizing: border-box;
    width: 100%;
    min-height: 40px;
    border: 1px solid rgba(177, 137, 207, 0.34);
    border-radius: 8px;
    padding: 8px 10px;
    color: #f7efff;
    background: rgba(20, 15, 34, 0.92);
    color-scheme: dark;
}

.tournament-field--size select {
    width: 112px;
    max-width: 100%;
}

.tournament-form-grid input:focus,
.tournament-form-grid select:focus {
    border-color: rgba(231, 200, 117, 0.72);
    outline: none;
    box-shadow: 0 0 0 2px rgba(231, 200, 117, 0.12);
}

.tournament-form-grid input:disabled { opacity: 0.48; }
.tournament-form-grid small { color: #8f7fa0; font-weight: 400; }

.tournament-cost-note {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 16px 0;
    padding: 11px 12px;
    border: 1px solid rgba(221, 184, 92, 0.3);
    border-radius: 8px;
    color: #e9cf8b;
    background: rgba(102, 72, 31, 0.18);
    font-size: 11px;
}

.tournament-cost-note span { color: var(--text-muted); }

.tournament-detail__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.tournament-detail__hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 8px 0 10px;
    padding: 10px 12px;
    border: 1px solid rgba(221, 184, 92, 0.3);
    border-radius: 9px;
    background: radial-gradient(circle at 85% 20%, rgba(144, 84, 184, 0.2), transparent 40%), rgba(38, 27, 56, 0.72);
}

.tournament-detail__identity { display: flex; min-width: 0; align-items: center; gap: 10px; }
.tournament-detail__identity > div { min-width: 0; }
.tournament-detail__hero h3 { overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.tournament-detail__hero p { margin: 3px 0 0; color: var(--text-muted); font-size: 10px; }

.tournament-detail__facts {
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}

.tournament-detail__facts > span {
    padding: 5px 7px;
    border: 1px solid rgba(179, 137, 213, 0.2);
    border-radius: 999px;
    color: #cbbbd7;
    background: rgba(17, 12, 29, 0.46);
    font-size: 9px;
    white-space: nowrap;
}

.tournament-detail__facts > span.is-status { color: #f0d486; border-color: rgba(221, 184, 92, 0.32); }

.tournament-inline-form,
.tournament-host-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    padding: 10px;
    border: 1px solid rgba(177, 137, 207, 0.25);
    border-radius: 9px;
    background: rgba(17, 12, 29, 0.54);
}

.tournament-inline-form input,
.tournament-host-controls input {
    box-sizing: border-box;
    min-width: 0;
    min-height: 38px;
    flex: 1 1 190px;
    border: 1px solid rgba(177, 137, 207, 0.34);
    border-radius: 8px;
    padding: 8px 10px;
    color: #f7efff;
    background: rgba(20, 15, 34, 0.92);
}

.tournament-host-controls > div {
    display: flex;
    min-width: 110px;
    flex-direction: column;
    gap: 3px;
    color: #e7c875;
    font-size: 11px;
}

.tournament-host-controls > div span { color: var(--text-muted); font-size: 9px; text-transform: uppercase; }

.tournament-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.tournament-stat-grid > div {
    display: flex;
    min-height: 60px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 10px;
    border: 1px solid rgba(179, 137, 213, 0.2);
    border-radius: 8px;
    background: rgba(17, 12, 29, 0.5);
}

.tournament-stat-grid span { color: var(--text-muted); font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; }
.tournament-stat-grid strong { color: #f4e8ff; font-size: 12px; }

.tournament-entrants { margin-top: 8px; }
.tournament-entrants > summary {
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 7px;
    color: #e7c875;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
}
.tournament-entrants > summary::-webkit-details-marker { display: none; }
.tournament-entrants > summary::before { content: '▸'; color: #9e84b2; transition: transform 140ms ease; }
.tournament-entrants[open] > summary::before { transform: rotate(90deg); }
.tournament-entrants > summary b {
    min-width: 20px;
    padding: 2px 6px;
    border-radius: 999px;
    color: #b9a5c8;
    background: rgba(99, 72, 122, 0.36);
    text-align: center;
    font-size: 9px;
}
.tournament-entrants > div { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }

.tournament-entrant {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 9px;
    border: 1px solid rgba(180, 140, 212, 0.25);
    border-radius: 7px;
    color: #e8ddf1;
    background: rgba(63, 43, 82, 0.58);
    font-size: 10px;
}

.tournament-entrant.is-bot { color: #9fcce7; border-color: rgba(90, 165, 207, 0.3); }
.tournament-entrant.is-you {
    color: #f5fbff;
    border-color: rgba(101, 211, 255, 0.72);
    background: linear-gradient(135deg, rgba(43, 99, 125, 0.72), rgba(50, 39, 76, 0.78));
    box-shadow: 0 0 16px rgba(78, 198, 246, 0.12);
}

.tournament-entrant button {
    border: 0;
    border-left: 1px solid rgba(214, 118, 132, 0.3);
    padding: 1px 0 1px 7px;
    color: #e8a5af;
    background: transparent;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.tournament-entrant button:hover,
.tournament-entrant button:focus-visible { color: #ffd2d8; outline: none; }

.tournament-bracket {
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid rgba(180, 140, 212, 0.2);
    border-radius: 10px;
    background:
        radial-gradient(circle at 92% 0%, rgba(116, 71, 151, 0.13), transparent 28%),
        rgba(13, 9, 24, 0.58);
}

.tournament-bracket__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(191, 150, 219, 0.17);
    background: rgba(21, 14, 34, 0.72);
}

.tournament-bracket__header > div { display: flex; flex-direction: column; gap: 2px; }
.tournament-bracket__header > div > span {
    color: #e7c875;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.tournament-bracket__header > div > strong { color: #f3eafb; font-size: 13px; }

.tournament-bracket__controls {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 7px !important;
}

.tournament-bracket__you-key {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 8px;
    border: 1px solid rgba(101, 211, 255, 0.38);
    border-radius: 999px;
    color: #ccefff;
    background: rgba(37, 87, 111, 0.35);
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.tournament-bracket__you-key:hover,
.tournament-bracket__you-key:focus-visible {
    border-color: rgba(142, 226, 255, 0.78);
    background: rgba(45, 111, 139, 0.48);
    outline: none;
}

.tournament-bracket__drag-hint {
    color: #9988a8 !important;
    font-size: 9px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

.tournament-bracket__viewport {
    position: relative;
    height: clamp(430px, 64vh, 690px);
    overflow: auto;
    cursor: grab;
    touch-action: none;
    overscroll-behavior: contain;
    scrollbar-color: rgba(157, 119, 184, 0.48) rgba(17, 11, 28, 0.72);
    scrollbar-width: thin;
}

.tournament-bracket__viewport.is-dragging { cursor: grabbing; user-select: none; }
.tournament-bracket__viewport:focus-visible { outline: 1px solid rgba(116, 211, 246, 0.65); outline-offset: -1px; }

.tournament-bracket__canvas {
    position: relative;
    min-width: 100%;
    background-image:
        linear-gradient(rgba(164, 125, 190, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(164, 125, 190, 0.035) 1px, transparent 1px);
    background-size: 24px 24px;
}

.tournament-bracket__round-label {
    position: absolute;
    top: 10px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    color: #e7c875;
    pointer-events: none;
}
.tournament-bracket__round-label span {
    color: #8f7fa0;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.tournament-bracket__round-label strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.tournament-bracket__connectors {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: visible;
    pointer-events: none;
}

.tournament-bracket__connector {
    fill: none;
    stroke: rgba(187, 151, 210, 0.52);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.tournament-bracket__connector.is-third-place-path {
    stroke: rgba(213, 175, 93, 0.42);
    stroke-dasharray: 5 5;
}

.tournament-bracket__connector.is-current-user-path {
    stroke: #67d5ff;
    stroke-width: 3;
    filter: drop-shadow(0 0 4px rgba(63, 193, 242, 0.55));
    stroke-dasharray: none;
}

.tournament-series {
    position: absolute;
    z-index: 2;
    box-sizing: border-box;
    width: 210px;
    height: 86px;
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(177, 137, 207, 0.25);
    border-radius: 9px;
    background: linear-gradient(145deg, rgba(67, 46, 88, 0.76), rgba(26, 19, 43, 0.9));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.tournament-series.is-third-place { border-color: rgba(196, 137, 73, 0.38); }
.tournament-series.is-current-user-match {
    border-color: rgba(101, 211, 255, 0.72);
    box-shadow: 0 0 0 1px rgba(101, 211, 255, 0.08), 0 8px 22px rgba(29, 129, 169, 0.12);
}

.tournament-series__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-sizing: border-box;
    height: 26px;
    padding: 4px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    color: #a998b7;
    background: rgba(14, 10, 24, 0.28);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tournament-series.is-current-user-match .tournament-series__meta { color: #8edfff; }
.tournament-series.is-third-place .tournament-series__meta { color: #e7c875; }
.tournament-series__meta small { color: #8f7fa0; font-size: 8px; font-weight: 600; letter-spacing: 0; text-transform: none; }

.tournament-series__player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-sizing: border-box;
    height: 29px;
    min-height: 29px;
    padding: 4px 8px;
    color: #d9cde2;
    font-size: 10px;
}

.tournament-series__player + .tournament-series__player { border-top: 1px solid rgba(255, 255, 255, 0.055); }
.tournament-series__player.is-winner { color: #f0d486; background: rgba(212, 169, 78, 0.045); }
.tournament-series__player.is-you { color: #eafaff; background: rgba(59, 164, 207, 0.1); }
.tournament-series__player b { flex: 0 0 auto; font-size: 11px; }

.tournament-player-label {
    display: inline-flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    gap: 6px;
}
.tournament-player-label > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

button.tournament-player-label.is-clickable {
    max-width: 100%;
    border: 0;
    padding: 0;
    color: inherit;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

button.tournament-player-label.is-clickable:hover,
button.tournament-player-label.is-clickable:focus-visible {
    color: #bcecff;
    outline: none;
    text-decoration: underline;
    text-decoration-color: rgba(142, 223, 255, 0.68);
    text-underline-offset: 2px;
}

.tournament-you-marker {
    display: inline-flex;
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(159, 232, 255, 0.72);
    border-radius: 50%;
    color: #eafaff;
    background: linear-gradient(145deg, #3da6cc, #6650a1);
    box-shadow: 0 0 10px rgba(79, 202, 248, 0.28);
}
.tournament-you-marker svg { width: 11px; height: 11px; overflow: visible; fill: currentColor; }
.tournament-you-marker svg path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.tournament-bracket-locked {
    display: flex;
    min-height: 120px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 20px;
    border: 1px dashed rgba(221, 184, 92, 0.3);
    border-radius: 10px;
    color: #e7c875;
    background: rgba(25, 18, 39, 0.5);
}

.tournament-bracket-locked span { color: var(--text-muted); font-size: 11px; }

#onlineQueueOverlay.is-tournament #onlineQueueCard {
    border-color: rgba(221, 184, 92, 0.68);
    box-shadow: 0 18px 55px rgba(8, 5, 18, 0.44), 0 0 24px rgba(181, 123, 219, 0.18);
}

#onlineQueueOverlay.is-tournament .online-queue__eyebrow { color: #e7c875; }

.profileTournamentLink {
    border: 0;
    padding: 2px 0;
    color: #e7c875;
    background: transparent;
    font: inherit;
    font-size: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(231, 200, 117, 0.4);
    text-underline-offset: 3px;
    cursor: pointer;
}

.profileTournamentLink:hover,
.profileTournamentLink:focus-visible {
    color: #fff0b4;
    outline: none;
    text-decoration-color: currentColor;
}

@media (max-width: 760px) {
    .tournament-lobby__toolbar,
    .tournament-detail__top,
    .tournament-cost-note { align-items: stretch; flex-direction: column; }
    .tournament-form-grid { grid-template-columns: 1fr; }
    .tournament-field--name,
    .tournament-field--size,
    .tournament-field--start,
    .tournament-field--time,
    .tournament-field--empty,
    .tournament-field--format,
    .tournament-field--password,
    .tournament-field--gold { grid-column: 1; }
    .tournament-detail__actions { justify-content: flex-start; }
    .tournament-inline-form,
    .tournament-host-controls { align-items: stretch; flex-direction: column; }
    .tournament-host-controls > div { min-width: 0; }
    .tournament-detail { padding: 9px; }
    .tournament-detail__hero { align-items: flex-start; flex-direction: column; }
    .tournament-detail__facts { justify-content: flex-start; }
    .tournament-bracket__header { align-items: flex-start; flex-direction: column; }
    .tournament-bracket__controls { width: 100%; justify-content: space-between; }
    .tournament-bracket__viewport { height: clamp(390px, 62vh, 560px); }
}

#lobbyViewHost .admin-dashboard__header {
    display: none;
}

#lobbyViewHost .admin-dashboard__tabs {
    margin: 0 0 16px;
    padding: 16px 18px;
}

#lobbyRoot.view-admin #lobbyViewHost {
    padding: 0;
}

#lobbyRoot.view-admin #lobbyViewHost .admin-dashboard__tab-panel,
#lobbyRoot.view-admin #lobbyViewHost #adminDashboardMessage {
    margin-right: 18px;
    margin-left: 18px;
}

#lobbyRoot.view-admin #adminDashboardPanel {
    width: min(1480px, 100%);
}

/* -------------------------------------------------------------
   7. Friends panel (placeholder data)
   ------------------------------------------------------------- */
#lobbyFriends { grid-area: friends; }

.lobby-friend-group {
    margin: 0 0 14px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

button.lobby-friend-group {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 2px;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 11px;
    font-weight: normal;
    line-height: normal;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

button.lobby-friend-group:hover,
button.lobby-friend-group:focus-visible {
    color: var(--gold-bright);
    outline: none;
}

.lobby-friend-group__chevron {
    display: inline-block;
    transition: transform 0.16s var(--ease);
}

.lobby-friend-group[aria-expanded="true"] .lobby-friend-group__chevron {
    transform: rotate(90deg);
}

.lobby-friend-group__list {
    margin-bottom: 14px;
}

.lobby-friend {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 10px;
    transition: background 0.18s var(--ease);
}

.lobby-friend:hover { background: rgba(255, 255, 255, 0.05); }

.lobby-friend__status {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--status-offline);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
}
.lobby-friend__status.is-online { background: var(--status-online); box-shadow: 0 0 8px var(--status-online); }
.lobby-friend__status.is-away   { background: var(--status-away); box-shadow: 0 0 8px var(--status-away); }

.lobby-friend__name { flex: 1 1 auto; color: var(--text-body); font-size: 13px; }
button.lobby-friend__name {
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
}
button.lobby-friend__name:hover,
button.lobby-friend__name:focus-visible {
    color: var(--gold-bright);
    text-decoration: underline;
    outline: none;
}
.lobby-friend.is-offline .lobby-friend__name { color: var(--text-muted); }
.lobby-friend__state { font-size: 11px; color: var(--text-muted); }

.lobby-friend__actions {
    display: none;
    flex: 1 0 100%;
    justify-content: flex-end;
    gap: 6px;
}

.lobby-friend:hover .lobby-friend__actions,
.lobby-friend:focus-within .lobby-friend__actions {
    display: flex;
}

.lobby-friend__actions .lobby-friend__invite {
    opacity: 1;
}

.lobby-friend__invite {
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--gold-bright);
    background: transparent;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 3px 8px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.18s var(--ease), background 0.18s var(--ease);
}
.lobby-friend:hover .lobby-friend__invite { opacity: 1; }
.lobby-friend__invite:hover { background: var(--gold-soft); }

/* Friend requests block */
.lobby-request {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px dashed var(--panel-border);
    border-radius: 10px;
    font-size: 13px;
}
.lobby-request__actions { margin-left: auto; display: flex; gap: 6px; }
.lobby-request__actions button {
    border: none;
    border-radius: 7px;
    width: 26px; height: 26px;
    cursor: pointer;
    font-size: 13px;
}
.lobby-req-accept { background: rgba(139, 230, 176, 0.25); color: var(--status-online); }
.lobby-req-decline { background: rgba(255, 140, 140, 0.2); color: #ff9a9a; }

/* -------------------------------------------------------------
   8. Leaderboard panel (real /api/ranked/leaderboard data)
   ------------------------------------------------------------- */
#lobbyLeaderboard { grid-area: leaderboard; }

.lobby-lb-row {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    transition: background 0.18s var(--ease);
}
.lobby-lb-row + .lobby-lb-row { margin-top: 4px; }
.lobby-lb-row:hover { background: rgba(255, 255, 255, 0.05); }
.lobby-lb-row.is-self {
    background: var(--gold-soft);
    border: 1px solid var(--panel-border);
}

.lobby-lb-rank {
    font-family: var(--font-heading);
    font-size: 15px;
    color: var(--gold-bright);
    text-align: center;
}
.lobby-lb-rank.top1 { color: #ffe08a; }
.lobby-lb-rank.top2 { color: #d9dbe6; }
.lobby-lb-rank.top3 { color: #e6b483; }

.lobby-lb-player { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lobby-lb-league {
    display: block;
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex: 0 0 28px;
}
.lobby-lb-name {
    color: var(--text-strong);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lobby-lb-sub { font-size: 11px; color: var(--text-muted); }
.lobby-lb-rating { font-family: var(--font-heading); color: var(--text-body); font-size: 14px; }


.lobby-lb-empty, .lobby-lb-error { color: var(--text-muted); font-size: 13px; padding: 8px 4px; }

/* Full-width footer button (view full leaderboard) */
.lobby-panel__footer {
    padding: 10px 14px;
    border-top: 1px solid var(--panel-border);
}
.lobby-wide-btn {
    width: 100%;
    padding: 10px;
    font: inherit;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: var(--gold-bright);
    background: var(--gold-soft);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.lobby-wide-btn:hover { background: rgba(217, 180, 91, 0.28); box-shadow: 0 0 14px var(--gold-glow); }

/* -------------------------------------------------------------
   9. News / Announcements (static content)
   ------------------------------------------------------------- */
#lobbyNews { grid-area: news; }

.lobby-news-item {
    display: block;
    width: 100%;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 0;
    border-left: 3px solid var(--gold);
}
.lobby-news-item:hover,
.lobby-news-item:focus-visible {
    background: rgba(245, 217, 138, 0.10);
    outline: 1px solid var(--panel-border);
}
.lobby-news-item:last-child { margin-bottom: 0; }
.lobby-news-item__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.lobby-news-item__tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 999px;
    color: #241a12;
    background: var(--gold);
}
.lobby-news-item__tag.patch { background: #8be6b0; }
.lobby-news-item__tag.event { background: #b6a3f0; }
.lobby-news-item__tag.status { background: #f0cf7c; }
.lobby-news-item__title { font-family: var(--font-heading); font-size: 13px; color: var(--text-strong); }
.lobby-news-item__body {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}
.lobby-news-item__date { font-size: 10px; color: var(--text-muted); opacity: 0.75; margin-top: 4px; }

.lobby-news-reader {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(12, 8, 22, 0.84);
    backdrop-filter: blur(6px);
}
.lobby-news-reader[hidden] { display: none; }
.lobby-news-reader__card {
    position: relative;
    width: min(760px, 94vw);
    max-height: 88vh;
    overflow-y: auto;
    padding: clamp(24px, 4vw, 42px);
    border: 1px solid var(--gold);
    border-radius: 16px;
    color: var(--text-strong);
    background: linear-gradient(160deg, rgba(62, 52, 94, 0.99), rgba(30, 24, 48, 0.99));
    box-shadow: 0 24px 70px rgba(5, 3, 12, 0.72);
}
.lobby-news-reader__close {
    position: absolute;
    top: 12px;
    right: 14px;
    border: 0;
    color: var(--text-strong);
    background: transparent;
    font-size: 28px;
    cursor: pointer;
}
.lobby-news-reader__type { color: var(--gold-bright); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.lobby-news-reader__card h2 { margin: 8px 40px 4px 0; font-family: var(--font-heading); }
.lobby-news-reader__date { color: var(--text-muted); font-size: 12px; }
.lobby-news-reader__content { margin-top: 24px; color: var(--text-body); line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }

/* -------------------------------------------------------------
   10. World chat (client-only placeholder)
   ------------------------------------------------------------- */
#lobbyChat { grid-area: chat; }

.lobby-chat-log {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lobby-chat-log::-webkit-scrollbar { width: 8px; }
.lobby-chat-log::-webkit-scrollbar-thumb { background: var(--gold-soft); border-radius: 8px; }

.lobby-chat-line { font-size: 13px; line-height: 1.4; word-break: break-word; }
.lobby-chat-line__time { color: var(--text-muted); font-size: 11px; margin-right: 6px; }
.lobby-chat-line__name { font-weight: 600; margin-right: 4px; }
button.lobby-chat-line__name {
    padding: 0;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    cursor: pointer;
}
button.lobby-chat-line__name:hover,
button.lobby-chat-line__name:focus-visible {
    text-decoration: underline;
    outline: none;
}
.lobby-chat-line__text { color: var(--text-body); }

/* Distinct colors for system vs player messages */
.lobby-chat-line.is-system .lobby-chat-line__text { color: var(--system-msg); font-style: italic; }
.lobby-chat-line.is-system .lobby-chat-line__name { color: var(--system-msg); }
.lobby-chat-line__name.c1 { color: #8be6b0; }
.lobby-chat-line__name.c2 { color: #b6a3f0; }
.lobby-chat-line__name.c3 { color: #f0a6c0; }
.lobby-chat-line__name.c4 { color: #8fc7f0; }
.lobby-chat-line__name.c5 { color: #f0cf7c; }

.lobby-chat-input {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--panel-border);
}
.lobby-chat-input input {
    flex: 1 1 auto;
    min-width: 0;
    height: 36px;
    padding: 0 12px;
    color: var(--text-strong);
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    font: inherit;
    font-size: 13px;
}
.lobby-chat-input input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
}
.lobby-chat-input button {
    flex: 0 0 auto;
    position: relative;
    display: inline-flex;
    width: 68px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    color: #241a12;
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    transition: box-shadow 0.2s var(--ease);
}
.lobby-chat-input button:hover { box-shadow: 0 0 14px var(--gold-glow); }
.lobby-chat-input button.is-cooling-down {
    cursor: wait;
    color: #241a12;
    background:
        linear-gradient(90deg, rgba(255, 246, 214, 0.72) var(--chat-cooldown-progress, 0%), rgba(36, 26, 18, 0.18) 0),
        linear-gradient(180deg, var(--gold-bright), var(--gold));
    box-shadow: none;
}
.lobby-chat-input button.is-cooling-down .chat-send-label { visibility: hidden; }
.chat-send-label { position: relative; z-index: 1; }
.chat-send-cooldown-marker {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    color: #241a12;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.chat-send-cooldown-marker[hidden] { display: none; }

/* -------------------------------------------------------------
   11. Responsive (desktop-first; graceful narrowing)
   ------------------------------------------------------------- */
@media (max-width: 1180px) {
    #lobbyRoot {
        grid-template-columns: minmax(210px, 260px) minmax(0, 1fr) minmax(230px, 300px);
    }
}

@media (max-width: 980px) {
    #lobbyRoot {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto 1fr auto;
        grid-template-areas:
            "topbar      topbar"
            "center      center"
            "friends     leaderboard"
            "news        chat";
    }
    #lobbyTopBar { gap: 10px; padding-inline: 18px; flex-wrap: nowrap; }
    .lobby-crest,
    .lobby-brand { display: none; }
    #lobbyIdentity {
        width: 100%;
        gap: 8px;
        margin-left: 0;
        justify-content: space-between;
    }
    .lobby-league {
        position: static;
        transform: none;
    }
    .lobby-league:not(.is-home):hover,
    .lobby-league:not(.is-home):focus-visible { transform: none; }
    .lobby-league { padding-inline: 9px; }
    .lobby-online-count {
        left: 50%;
        top: 4px;
        bottom: auto;
        transform: translateX(-50%);
    }
}

/* -------------------------------------------------------------
   12. Relocated session bar (folded into the top bar)
   The old floating #sessionBar is moved into #lobbyIdentity by
   lobby.js. Strip its floating-card chrome so it reads as one
   unified top bar. All ids/behaviour are preserved.
   ------------------------------------------------------------- */
#lobbyTopBar #sessionBar {
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
    gap: 12px;
    padding: 0;
    border: none;
    background: none;
    background-image: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0;
    color: var(--text-body);
}

#lobbyTopBar .sessionAccount {
    position: relative;
    display: grid;
    grid-template-columns: 62px minmax(180px, 1fr) 38px;
    grid-template-rows: 24px 34px;
    gap: 7px 9px;
    width: 310px;
    height: 65px;
    min-width: 0;
}

#lobbyTopBar .sessionProfileButton {
    position: relative;
    grid-column: 1;
    grid-row: 1 / 3;
    width: 62px;
    height: 62px;
    padding: 0;
    border-color: var(--gold);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(217, 180, 91, 0.22), rgba(80, 55, 105, 0.48));
    color: var(--gold-bright);
    box-shadow: inset 0 0 0 3px rgba(17, 12, 29, 0.72), 0 0 12px var(--gold-glow);
}

#lobbyTopBar .sessionProfileIcon {
    display: block;
    width: 52px;
    height: 52px;
    background-repeat: no-repeat;
}

.profile-icon-sprite {
    display: block;
    width: 64px;
    height: 64px;
    background: url('../img/profile-icons/profile-icons.png') no-repeat;
    background-size: 500% 500%;
    background-position: var(--profile-icon-x) var(--profile-icon-y);
}

.customization-identity-section { display: grid; min-width: 0; gap: 9px; }
.customization-identity-section + .customization-identity-section { margin-top: 14px; }
.customization-identity-section h3 { margin: 0; color: var(--gold-bright); font-size: 13px; }
.profile-title-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    max-height: 122px;
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--gold-soft) transparent;
}
.profile-title-grid::-webkit-scrollbar { width: 8px; }
.profile-title-grid::-webkit-scrollbar-thumb {
    border-radius: 8px;
    background: var(--gold-soft);
}
.profile-icon-grid { display: grid; grid-template-columns: repeat(5, minmax(64px, 1fr)); gap: 8px; }
.customization-item.profile-title-choice,
.customization-item.profile-icon-choice {
    position: relative;
    min-height: 0;
    display: flex;
    box-sizing: border-box;
}
.customization-item.profile-title-choice {
    align-items: center;
    gap: 7px;
    padding: 10px;
}
.profile-title-choice strong { min-width: 0; overflow: hidden; color: var(--gold-bright); text-overflow: ellipsis; white-space: nowrap; }
.profile-title-choice small { margin-left: auto; color: var(--text-muted); }
.profile-title-choice b,
.profile-icon-choice b { position: absolute; top: 4px; right: 6px; color: var(--gold-bright); }
.profile-color-wheel {
    min-height: 58px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border: 1px solid rgba(226,200,140,.18);
    border-radius: 12px;
    background: rgba(10,7,20,.42);
}
.profile-color-wheel input[type="color"] {
    width: 44px;
    height: 44px;
    padding: 2px;
    border: 1px solid var(--gold);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}
.profile-color-wheel input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.profile-color-wheel input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.profile-color-wheel label { display: grid; gap: 3px; cursor: pointer; }
.profile-color-wheel label strong { color: var(--text-strong); font-size: 12px; }
.profile-color-wheel label small { color: var(--text-muted); font-size: 10px; }
.profile-color-wheel output { color: var(--text-muted); font: 700 10px/1 monospace; }
.customization-item.profile-icon-choice {
    min-width: 0;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 5px;
    text-align: center;
}
.customization-item.profile-icon-choice.admin-exclusive {
    border-color: rgba(72, 238, 151, .78);
    box-shadow: inset 0 0 18px rgba(45, 217, 128, .12), 0 0 10px rgba(45, 217, 128, .16);
}
.profile-icon-choice .profile-icon-sprite,
.profile-icon-choice > img { width: 58px; height: 58px; object-fit: contain; }
.profile-icon-choice > span:last-of-type {
    max-width: 100%;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.customization-identity-preview {
    flex: 0 0 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
    border: 1px solid rgba(226,200,140,.34);
    border-radius: 13px;
    background: radial-gradient(circle at 50% 20%, rgba(137,76,204,.28), transparent 45%), #120b24;
    box-shadow: inset 0 0 40px rgba(4,2,12,.45);
}
.customization-identity-preview[hidden] { display: none; }
.customization-preview__stage[hidden],
.customization-loadout-summary[hidden] { display: none; }
.identity-preview-card { min-height: 218px; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 18px; box-sizing: border-box; text-align: center; }
.identity-preview-titles {
    padding-top: 12px;
    border-top: 1px solid rgba(226,200,140,.24);
}
.identity-preview-icon {
    width: 108px;
    height: 108px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 2px solid var(--gold);
    border-radius: 18px;
    background: rgba(30,20,48,.8);
    box-shadow: 0 0 28px var(--gold-glow);
}
.identity-preview-icon .profile-icon-sprite,
.identity-preview-icon img { width: 96px; height: 96px; object-fit: contain; }
.identity-preview-kicker { color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.identity-preview-name { color: var(--gold-bright); font-family: var(--font-heading); font-size: clamp(20px, 2.4vw, 28px); }
.identity-preview-username { color: var(--profile-name-color); }
.identity-preview-title-prefix { color: var(--gold-bright); }
.identity-preview-title { color: var(--text-body); font-weight: 700; }
.identity-preview-card small { color: var(--text-muted); }
@media (max-width: 560px) {
    .profile-icon-grid { grid-template-columns: repeat(4, minmax(58px, 1fr)); }
}

#lobbyTopBar .sessionProfileCog {
    position: absolute;
    top: -5px;
    left: -5px;
    display: grid;
    place-items: center;
    width: 17px;
    height: 17px;
    border: 1px solid var(--glass-line-strong);
    border-radius: 6px;
    background: rgba(34, 27, 54, 0.8);
    font: 10px/1 Arial, sans-serif;
}

#lobbyTopBar #sessionLevelBadge {
    position: absolute;
    left: 50%;
    bottom: -5px;
    translate: -50% 0;
    min-width: 25px;
    padding: 2px 5px;
    border: 1px solid var(--gold);
    border-radius: 8px;
    background: #21182f;
    color: var(--gold-bright);
    font-size: 9px;
    text-align: center;
}

#lobbyTopBar .sessionAccount__identity {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

#lobbyTopBar #sessionUser {
    display: block;
    max-width: 100%;
    overflow: hidden;
    color: var(--gold-bright);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#lobbyTopBar .sessionLevelGroup {
    grid-column: 2;
    grid-row: 2;
    display: grid;
    align-content: start;
    gap: 3px;
    min-width: 0;
    transform: translateY(1px);
}

#lobbyTopBar .sessionXpWrap {
    width: 100%;
    height: 8px;
    border: 0;
    border-radius: 3px;
}

#lobbyTopBar .sessionXpBar {
    border-radius: 3px;
}

#lobbyTopBar .sessionAccount__meta {
    justify-self: end;
    display: grid;
    justify-items: start;
    gap: 4px;
    width: max-content;
    max-width: 72px;
    overflow: hidden;
}

#lobbyTopBar .sessionXpLabel,
#lobbyTopBar .sessionGold {
    position: static;
    width: auto;
    max-width: 72px;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: none;
    box-shadow: none;
    font: 700 9px/1 Arial, Helvetica, sans-serif;
    text-align: left;
    white-space: nowrap;
}

#lobbyTopBar .sessionGold {
    color: var(--gold-bright);
}

#lobbyTopBar .sessionAccount__actions {
    position: absolute;
    left: 71px;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 19px;
}

#lobbyTopBar #storeButton,
#lobbyTopBar #adminDashboardButton {
    width: 78px;
    height: 19px;
    min-height: 19px;
    padding: 0;
    border-radius: 6px;
    font-size: 9px;
}

#lobbyTopBar .sessionAccount:has(#adminDashboardButton:not([hidden])) #storeButton,
#lobbyTopBar .sessionAccount:has(#adminDashboardButton:not([hidden])) #adminDashboardButton {
    width: 50px;
}

#lobbyTopBar #adminDashboardButton {
    border-color: #44d6a0;
    background: rgba(68, 214, 160, 0.14);
    color: #b9ffe3;
}

#lobbyTopBar #adminDashboardButton:hover,
#lobbyTopBar #adminDashboardButton:focus-visible {
    border-color: #44d6a0;
    background: rgba(68, 214, 160, 0.24);
    box-shadow: 0 0 14px var(--gold-glow);
}

#lobbyTopBar #adminDashboardButton[hidden] {
    display: none;
}

#lobbyTopBar .session-icon-link {
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    padding: 3px;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    color: var(--gold-bright);
    background: rgba(75, 57, 99, 0.62);
    text-decoration: none;
}

#lobbyTopBar .session-icon-link svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

#lobbyTopBar #discordButton {
    color: #ffffff;
    opacity: 1;
}
#lobbyTopBar #bugReportButton {
    color: #ff3b47;
    border-color: rgba(255, 59, 71, 0.62);
    background: rgba(116, 43, 62, 0.42);
    opacity: 1;
}

#lobbyTopBar .session-icon-link[href]:hover,
#lobbyTopBar .session-icon-link[href]:focus-visible,
#lobbyTopBar button.session-icon-link:hover,
#lobbyTopBar button.session-icon-link:focus-visible {
    border-color: var(--gold);
    background: rgba(126, 93, 61, 0.62);
    box-shadow: 0 0 8px var(--gold-glow);
}

#lobbyTopBar #bugReportButton:hover,
#lobbyTopBar #bugReportButton:focus-visible {
    color: #ff5964;
    border-color: #ff5964;
    background: rgba(116, 43, 62, 0.62);
    box-shadow: 0 0 14px var(--gold-glow);
}

/* In-game player feedback */
.feedback-modal {
    position: fixed;
    inset: 0;
    z-index: 1800;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(10, 6, 20, 0.84);
    backdrop-filter: blur(7px);
}

.feedback-modal[hidden] { display: none; }

.feedback-modal__dialog {
    box-sizing: border-box;
    width: min(620px, 96vw);
    max-height: 92vh;
    overflow: auto;
    padding: 22px;
    border: 1px solid var(--gold);
    border-radius: 16px;
    color: var(--text-strong);
    background:
        radial-gradient(circle at 85% 0%, rgba(119, 75, 174, 0.25), transparent 35%),
        linear-gradient(155deg, #403257, #1d172f 76%);
    box-shadow: 0 24px 70px rgba(4, 2, 10, 0.78), 0 0 24px rgba(245, 217, 138, 0.13);
}

.feedback-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--panel-border);
}

.feedback-modal__header p {
    margin: 0 0 4px;
    color: var(--gold);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.feedback-modal__header h2 { margin: 0; color: var(--gold-bright); }

#feedbackSubmit:disabled {
    opacity: 0.55;
    cursor: wait;
}

.feedback-form { display: grid; gap: 9px; }
.feedback-form > label,
.feedback-form__types legend { color: var(--text-muted); font-size: 12px; font-weight: 700; }

.feedback-form input[type="text"],
.feedback-form textarea {
    box-sizing: border-box;
    width: 100%;
    border: 1px solid var(--panel-border);
    border-radius: 9px;
    color: var(--text-strong);
    background: rgba(13, 9, 24, 0.72);
}

.feedback-form textarea { min-height: 170px; resize: vertical; }

.feedback-form__types {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 0 8px;
    padding: 0;
    border: 0;
}

.feedback-form__types legend { margin-bottom: 8px; }
.feedback-form__types label { position: relative; display: block; }
.feedback-form__types input { position: absolute; opacity: 0; pointer-events: none; }
.feedback-form__types span {
    display: grid;
    gap: 4px;
    height: 100%;
    box-sizing: border-box;
    padding: 13px;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
}
.feedback-form__types small { color: var(--text-muted); line-height: 1.35; }
.feedback-form__types input:checked + span {
    border-color: var(--gold);
    background: rgba(245, 217, 138, 0.12);
    box-shadow: inset 0 0 16px rgba(245, 217, 138, 0.05);
}

.feedback-form__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 7px;
}
.feedback-form__footer p { margin: 0; color: var(--text-muted); }
.feedback-form__footer p.is-success { color: #72e0ab; }
.feedback-form__footer p.is-error { color: #ff8e98; }
#feedbackSubmit { min-width: 118px; }

#lobbyTopBar .session-icon-link[aria-disabled="true"] {
    opacity: 0.48;
    cursor: not-allowed;
}

.auth-ban-modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(12, 6, 22, 0.76);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.auth-ban-modal[hidden] { display: none; }

.auth-ban-dialog {
    position: relative;
    width: min(430px, calc(100vw - 40px));
    padding: 30px;
    border: 1px solid var(--gold);
    border-radius: 16px;
    background:
        radial-gradient(circle at 50% 0, rgba(255, 69, 80, 0.16), transparent 38%),
        linear-gradient(160deg, rgba(70, 52, 96, 0.99), rgba(29, 22, 47, 0.99));
    box-shadow: 0 22px 70px rgba(5, 2, 12, 0.72), 0 0 28px rgba(217, 180, 91, 0.22), inset 0 1px rgba(255,255,255,0.12);
    color: var(--text-body);
    text-align: center;
}

.auth-ban-dialog__icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin: 0 auto 12px;
    border: 2px solid #ff6570;
    border-radius: 50%;
    color: #fff;
    background: rgba(156, 35, 49, 0.74);
    box-shadow: 0 0 20px rgba(255, 59, 71, 0.3);
    font: 800 28px/1 var(--font-heading);
}

.auth-ban-dialog__kicker {
    margin: 0 0 5px !important;
    color: #ff9299 !important;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.15em;
}

.auth-ban-dialog h2 {
    margin: 0 0 18px;
    color: var(--gold-bright);
    font: 700 28px/1.15 var(--font-heading);
}

.auth-ban-dialog__details {
    display: grid;
    gap: 8px;
    margin-bottom: 20px;
    text-align: left;
}

.auth-ban-dialog__details > div {
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid var(--panel-border);
    border-radius: 9px;
    background: rgba(18, 13, 31, 0.55);
}

.auth-ban-dialog__details span {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-ban-dialog__details strong {
    color: var(--text-strong);
    font-size: 13px;
    overflow-wrap: anywhere;
}

#authBanOkay {
    min-width: 130px;
    padding: 10px 22px;
    border: 1px solid var(--gold);
    border-radius: 9px;
    color: #241a12;
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    box-shadow: 0 6px 18px rgba(10, 6, 20, 0.4);
    font: 700 14px var(--font-body);
    cursor: pointer;
}

#authBanOkay:hover,
#authBanOkay:focus-visible {
    outline: none;
    background: linear-gradient(180deg, #ffe6a4, var(--gold-bright));
    box-shadow: 0 0 15px var(--gold-glow);
}

#lobbyTopBar #logoutButton,
#lobbyTopBar #lobbySettingsButton {
    grid-column: 3;
    width: 38px;
    padding: 0;
}

#lobbyTopBar #logoutButton {
    grid-row: 1;
    height: 24px;
    border-radius: 7px;
    color: var(--text-muted);
    font-size: 9px;
}

#lobbyTopBar #lobbySettingsButton {
    grid-row: 2;
    height: 34px;
    border-radius: 9px;
    font-size: 17px;
}

@media (max-width: 760px) {
    #lobbyTopBar { padding-inline: 6px; }
    #lobbyIdentity { gap: 6px; }
    #lobbyLeague:not(.is-home) {
        grid-template-columns: minmax(66px, 80px) minmax(84px, 1fr);
        width: clamp(150px, calc(100vw - 328px), 210px);
        min-width: 150px;
    }
    #lobbyLeague:not(.is-home) .lobby-league__rating { display: none; }
}

/* Profile button is redundant (Match History lives in the center) — hide it. */
#lobbyTopBar #profileHubButton { display: none; }

/* -------------------------------------------------------------
   13. Store — a small, extensible purple-and-gold catalog
   ------------------------------------------------------------- */
#lobbyStoreCard {
    width: min(900px, 100%);
    margin: 0 auto;
}

.lobby-store {
    overflow: hidden;
    border: 1px solid var(--gold);
    border-radius: 18px;
    background:
        radial-gradient(circle at 92% 0%, rgba(217, 180, 91, 0.16), transparent 34%),
        linear-gradient(155deg, rgba(74, 57, 107, 0.96), rgba(34, 27, 56, 0.98));
    box-shadow: 0 18px 42px rgba(10, 6, 20, 0.42), 0 0 24px rgba(245, 217, 138, 0.18);
}

.lobby-store-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid rgba(217, 180, 91, 0.45);
}

.lobby-store-head p {
    margin: 0 0 4px;
    color: var(--gold);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.lobby-store-head h2 {
    margin: 0;
    color: var(--text-strong);
    font-family: var(--font-heading);
    font-size: clamp(22px, 3vw, 31px);
}

.lobby-store-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 118px;
    min-height: 44px;
    padding: 0 12px;
    box-sizing: border-box;
    border: 1px solid var(--gold);
    border-radius: 10px;
    background: rgba(24, 18, 42, 0.56);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

.lobby-store-balance span {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.lobby-store-balance strong {
    color: var(--gold-bright);
    font-size: 22px;
}

.lobby-store-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 20px 0;
}

.lobby-store-tabs button {
    min-width: 112px;
    padding: 9px 18px;
    border: 1px solid var(--panel-border);
    border-radius: 10px 10px 0 0;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    cursor: pointer;
}

.lobby-store-tabs button:hover,
.lobby-store-tabs button.is-active {
    border-color: var(--gold);
    color: var(--gold-bright);
    background: var(--gold-soft);
}

.lobby-store-message {
    min-height: 22px;
    padding: 7px 22px 0;
    color: var(--gold-bright);
    font-size: 12px;
}

.lobby-store-items {
    min-height: 210px;
    padding: 12px 20px 22px;
}

.lobby-store-item {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) auto;
    align-items: center;
    gap: 17px;
    padding: 17px;
    border: 1px solid rgba(217, 180, 91, 0.55);
    border-radius: 14px;
    background: linear-gradient(110deg, rgba(122, 86, 150, 0.26), rgba(28, 22, 48, 0.52));
}

.lobby-store-item__preview {
    display: grid;
    place-items: center;
    width: 92px;
    height: 92px;
    overflow: hidden;
    border: 2px solid var(--gold);
    border-radius: 14px;
    color: var(--gold-bright);
    background: radial-gradient(circle at 35% 28%, rgba(245, 217, 138, 0.28), rgba(62, 43, 93, 0.9));
    box-shadow: 0 0 15px rgba(245, 217, 138, 0.25);
}

.lobby-store-item__preview canvas,
.lobby-store-item__preview img {
    display: block;
    width: 100%;
    height: 100%;
}

.lobby-store-item__preview img { object-fit: cover; }

.lobby-store-title-preview {
    padding: 8px;
    color: var(--gold-bright);
    font: 700 14px/1.15 var(--font-heading);
    text-align: center;
}

.lobby-store-item__icon {
    display: none;
    place-items: center;
    width: 62px;
    height: 62px;
    border: 2px solid var(--gold);
    border-radius: 50%;
    color: var(--gold-bright);
    background: radial-gradient(circle at 35% 28%, rgba(245, 217, 138, 0.28), rgba(62, 43, 93, 0.9));
    box-shadow: 0 0 15px rgba(245, 217, 138, 0.25);
    font: 800 28px var(--font-heading);
}

.lobby-store-item__body h3,
.lobby-store-empty h3 {
    margin: 0 0 5px;
    color: var(--gold-bright);
    font-family: var(--font-heading);
}

.lobby-store-item__body p,
.lobby-store-empty p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.lobby-store-item__action {
    display: flex;
    justify-content: flex-end;
}

.lobby-store-front {
    display: grid;
    gap: 14px;
}

.lobby-store-front__hero {
    padding: 26px;
    border: 1px solid rgba(217, 180, 91, 0.58);
    border-radius: 14px;
    background:
        radial-gradient(circle at 88% 20%, rgba(245, 217, 138, 0.18), transparent 32%),
        linear-gradient(120deg, rgba(112, 75, 143, 0.42), rgba(35, 27, 58, 0.72));
}

.lobby-store-front__hero p,
.lobby-store-front__grid small {
    display: block;
    margin: 0 0 7px;
    color: var(--gold);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.lobby-store-front__hero h3 {
    margin: 0 0 8px;
    color: var(--gold-bright);
    font: 700 clamp(20px, 3vw, 28px) var(--font-heading);
}

.lobby-store-front__hero span,
.lobby-store-front__grid p {
    color: var(--text-muted);
    line-height: 1.5;
}

.lobby-store-front__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.lobby-store-front__grid article {
    min-height: 128px;
    padding: 18px;
    border: 1px solid var(--panel-border);
    border-radius: 13px;
    background: rgba(26, 20, 45, 0.48);
}

.lobby-store-front__grid h4 {
    margin: 0 0 6px;
    color: var(--text-strong);
    font-family: var(--font-heading);
    font-size: 17px;
}

.lobby-store-front__grid p { margin: 0 0 12px; }

.lobby-store-front__grid button {
    padding: 8px 13px;
    border: 1px solid var(--gold);
    border-radius: 9px;
    background: var(--gold-soft);
    color: var(--gold-bright);
    font-weight: 700;
    cursor: pointer;
}

.lobby-store-buy {
    min-width: 148px;
    padding: 10px 14px;
    border: 1px solid var(--gold);
    border-radius: 10px;
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    color: #2c203c;
    font-weight: 800;
    cursor: pointer;
}

.lobby-store-buy:disabled { cursor: default; opacity: 0.55; }
.lobby-store-buy.is-owned { background: rgba(217, 180, 91, 0.14); color: var(--gold-bright); }

.lobby-store-empty,
.lobby-store-loading,
.lobby-store-error {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
}

.achievement-card .achievement-card__reward {
    color: #f5d98a;
    font-size: 0.82rem;
    line-height: 1.3;
    min-height: 0;
    margin: -0.2rem 0 0.55rem;
}

#monthlyPassTrack:empty::before,
.lobby-news-empty,
.lobby-chat-empty {
    display: grid;
    place-items: center;
    min-height: 72px;
    margin: 0;
    color: var(--text-muted);
    text-align: center;
}

.lobby-store-empty > span { color: var(--gold); font-size: 28px; }
.lobby-store-error { color: #ffd4d4; }

@media (max-width: 650px) {
    .lobby-store-head { align-items: stretch; flex-direction: column; }
    .lobby-store-balance { align-self: flex-end; }
    .lobby-store-item { grid-template-columns: 70px 1fr; }
    .lobby-store-item__preview { width: 66px; height: 66px; }
    .lobby-store-item__action { grid-column: 1 / -1; justify-items: stretch; }
    .lobby-store-buy { width: 100%; }
    .lobby-store-front__grid { grid-template-columns: 1fr; }
}

/* Rating/tier is merged into the league emblem blob, so drop its own pill. */
#lobbyLeague #sessionRanked {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    color: var(--gold-bright);
    font-weight: 700;
    font-size: 13px;
    line-height: 1.15;
}

#lobbyLeague .lobby-league__tier {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#lobbyLeague .lobby-league__rating {
    white-space: nowrap;
}

#lobbyLeague:not(.is-home) #sessionRanked {
    display: grid !important;
    place-content: center;
    gap: 4px;
    height: 100%;
    border-right: 1px solid var(--panel-border);
    font-size: 10px;
    text-align: center;
}

#lobbyLeague:not(.is-home) .lobby-league__tier {
    gap: 4px;
}

#lobbyLeague:not(.is-home) .lobby-league__icon {
    order: -1;
}

#lobbyLeague:not(.is-home) .lobby-league__rating {
    color: var(--text-muted);
    font-size: 9px;
}

#lobbyLeague:not(.is-home) .lobby-league__rating:not(.is-placement)::after {
    content: ' rating';
}

#lobbyTopBar #sessionLevelBadge {
    background: #21182f;
    color: var(--gold-bright);
}

#lobbyTopBar #activePresetLabel { color: var(--text-muted); }

/* -------------------------------------------------------------
   13. Inline Settings view
   ------------------------------------------------------------- */
.lobby-settings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--panel-border);
}

.lobby-settings-tab {
    min-width: 120px;
    padding: 10px 18px;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font: inherit;
    font-family: var(--font-heading);
    cursor: pointer;
}

.lobby-settings-tab:hover,
.lobby-settings-tab.active {
    border-color: var(--gold);
    background: var(--gold-soft);
    color: var(--gold-bright);
    box-shadow: 0 0 12px var(--gold-glow);
}

.lobby-settings-panel {
    width: min(900px, 100%);
    margin: 0 auto;
}

.lobby-settings-empty {
    min-height: 360px;
}

.lobby-settings-intro {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 13px;
}

.lobby-settings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lobby-keybind-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.lobby-keybind-row__label { color: var(--text-body); font-size: 13px; }

.lobby-keybind-row__key {
    min-width: 110px;
    padding: 7px 12px;
    text-align: center;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-strong);
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    cursor: pointer;
    transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

.lobby-keybind-row__key:hover {
    border-color: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
}

.lobby-keybind-row.is-capturing .lobby-keybind-row__key {
    color: var(--gold-bright);
    border-color: var(--gold);
    box-shadow: 0 0 12px var(--gold-glow);
}

.lobby-settings-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}

.lobby-settings-reset {
    padding: 9px 16px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    color: var(--gold-bright);
    background: var(--gold-soft);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.lobby-settings-reset:hover {
    background: rgba(217, 180, 91, 0.28);
    box-shadow: 0 0 12px var(--gold-glow);
}

.lobby-settings-status { margin: 12px 0 0; color: var(--text-muted); font-size: 13px; }
.lobby-settings-status.is-error { color: #ff9b9b; }
.lobby-settings-status.is-success { color: #9ee6ae; }

.lobby-account-settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.lobby-account-section {
    padding: 20px;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: rgba(20, 13, 35, 0.62);
}

.lobby-account-section h3 { margin: 0 0 14px; color: var(--gold-bright); }

.lobby-account-form {
    display: grid;
    gap: 12px;
}

.lobby-account-form[hidden] { display: none; }

.lobby-account-form label {
    display: grid;
    gap: 6px;
    color: var(--text-body);
    font-size: 13px;
}

.lobby-account-form input {
    box-sizing: border-box;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--panel-border);
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-strong);
    font: inherit;
}

.lobby-account-form input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
}

.lobby-account-danger { border-color: rgba(205, 79, 79, 0.5); }

.lobby-data-storage-section { grid-column: 1 / -1; }

.lobby-settings-link-button {
    display: inline-flex;
    width: fit-content;
    padding: 9px 16px;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    background: var(--gold-soft);
    color: var(--gold-bright);
    font-size: 13px;
    text-decoration: none;
}

.lobby-settings-link-button:hover,
.lobby-settings-link-button:focus-visible {
    border-color: var(--gold);
    background: rgba(217, 180, 91, 0.28);
    box-shadow: 0 0 12px var(--gold-glow);
}

.lobby-account-delete {
    width: fit-content;
    padding: 9px 16px;
    border: 1px solid rgba(230, 105, 105, 0.72);
    border-radius: 10px;
    background: rgba(132, 34, 42, 0.42);
    color: #ffd7d7;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.lobby-account-delete:hover:not(:disabled) { background: rgba(166, 43, 52, 0.62); }
.lobby-account-delete:disabled,
.lobby-account-form button:disabled { cursor: wait; opacity: 0.58; }

@media (max-width: 720px) {
    .lobby-account-settings { grid-template-columns: 1fr; }
    .lobby-settings-tabs { flex-wrap: wrap; }
    .lobby-settings-tab { flex: 1 1 120px; }
}
.game-tutorial-overlay {
    --tutorial-cell: min(2.75vw, 30px);
    position: fixed;
    z-index: 10000;
    inset: 0;
    display: block;
    min-height: 100%;
    overflow: auto;
    padding: 0;
    background: rgba(8, 4, 16, .88);
    color: var(--text-strong);
    font-family: var(--font-body);
}

.game-tutorial-overlay[hidden] { display: none; }
.game-tutorial-overlay,
.game-tutorial-overlay * { box-sizing: border-box; }
.game-tutorial-overlay button,
.game-tutorial-overlay input { font: inherit; }

.game-tutorial-overlay .tutorial-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.game-tutorial-overlay .tutorial-frame { position: relative; width: min(1180px, 96vw); min-height: min(760px, 92vh); overflow: hidden; display: grid; grid-template-rows: auto 1fr auto; border: 1px solid var(--glass-line-strong); border-radius: var(--panel-radius); background-image: var(--glass-spot), var(--glass-bg); box-shadow: var(--glass-shadow); backdrop-filter: blur(14px) saturate(135%); -webkit-backdrop-filter: blur(14px) saturate(135%); }
.game-tutorial-overlay .tutorial-frame::before { content: ""; position: absolute; inset: 7px; pointer-events: none; border: 1px solid var(--glass-line); border-radius: calc(var(--panel-radius) - 4px); }
.game-tutorial-overlay .tutorial-header,
.game-tutorial-overlay .tutorial-footer { position: relative; z-index: 2; display: flex; align-items: center; gap: 18px; padding: 22px 28px; background: var(--glass-input); }
.game-tutorial-overlay .tutorial-header { border-bottom: 1px solid var(--panel-border); }
.game-tutorial-overlay .tutorial-footer { justify-content: space-between; border-top: 1px solid var(--panel-border); }
.game-tutorial-overlay .tutorial-brand { display: flex; align-items: center; gap: 14px; min-width: max-content; }
.game-tutorial-overlay .tutorial-brand img { width: 48px; height: 48px; object-fit: contain; filter: drop-shadow(0 0 8px var(--gold-glow)); }
.game-tutorial-overlay .tutorial-brand strong { display: block; color: var(--gold-bright); font-family: var(--font-heading); letter-spacing: .08em; text-transform: uppercase; }
.game-tutorial-overlay .tutorial-brand span,
.game-tutorial-overlay .tutorial-counter { color: var(--text-muted); font-size: 13px; }
.game-tutorial-overlay .tutorial-progress { flex: 1; display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; }
.game-tutorial-overlay .tutorial-progress button { height: 7px; padding: 0; border: 0; border-radius: 20px; background: rgba(169, 159, 192, .32); cursor: pointer; }
.game-tutorial-overlay .tutorial-progress button.is-complete { background: var(--gold); opacity: .65; }
.game-tutorial-overlay .tutorial-progress button.is-current { background: var(--gold-bright); box-shadow: 0 0 11px var(--gold-glow); }
.game-tutorial-overlay .tutorial-stage { position: relative; z-index: 1; min-height: 0; }
.game-tutorial-overlay .tutorial-page { min-height: 560px; display: none; grid-template-columns: minmax(310px, .85fr) minmax(420px, 1.35fr); align-items: center; gap: 46px; padding: 42px 54px; animation: tutorialEnter .28s var(--ease) both; }
.game-tutorial-overlay .tutorial-page.is-active { display: grid; }
@keyframes tutorialEnter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.game-tutorial-overlay .tutorial-copy { max-width: 470px; }
.game-tutorial-overlay .tutorial-kicker { color: var(--gold); text-transform: uppercase; letter-spacing: .16em; font-size: 12px; font-weight: 800; }
.game-tutorial-overlay .tutorial-copy h1 { margin: 10px 0 14px; color: var(--gold-bright); font-family: var(--font-heading); font-size: clamp(32px, 4vw, 55px); line-height: .98; }
.game-tutorial-overlay .tutorial-copy p { margin: 0 0 18px; color: var(--text-body); font-size: 17px; line-height: 1.65; }
.game-tutorial-overlay .tutorial-tip { padding: 14px 16px; border-left: 3px solid var(--gold); background: var(--gold-soft); color: var(--text-strong); line-height: 1.45; }
.game-tutorial-overlay .tutorial-demo { position: relative; min-height: 410px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--panel-border); border-radius: calc(var(--panel-radius) - 2px); background: radial-gradient(circle at 50% 35%, rgba(100, 68, 136, .32), rgba(8, 5, 18, .88) 70%); box-shadow: inset 0 0 50px rgba(0, 0, 0, .45); }
.game-tutorial-overlay .tutorial-hero-tower { width: min(76%, 420px); max-height: 360px; object-fit: contain; filter: drop-shadow(0 22px 22px rgba(0, 0, 0, .65)); }
.game-tutorial-overlay .tower-preview { display: grid; grid-template-columns: repeat(11, var(--tutorial-cell)); grid-template-rows: repeat(11, var(--tutorial-cell)); gap: 3px; transform: perspective(700px) rotateX(2deg); }
.game-tutorial-overlay .tower-cell { border: 1px solid rgba(169, 159, 192, .36); border-radius: 5px; background: rgba(52, 39, 72, .82); box-shadow: inset 0 2px rgba(255, 255, 255, .05); }
.game-tutorial-overlay .tower-cell.filled { background: linear-gradient(145deg, #8b63ad, #4a2f6d); border-color: #b68bd0; box-shadow: inset 0 3px rgba(255, 255, 255, .16), 0 0 7px rgba(153, 93, 202, .3); }
.game-tutorial-overlay .tower-cell.gold { background: linear-gradient(145deg, var(--gold-bright), #9c7024); border-color: #ffe8a4; box-shadow: 0 0 12px var(--gold-glow); }
.game-tutorial-overlay .tower-cell.damage { background: repeating-linear-gradient(135deg, #7c342f 0 5px, #401b22 5px 10px); border-color: #d76a55; }
.game-tutorial-overlay .tower-cell.falling { animation: tutorialFall 1.25s ease-in-out infinite alternate; }
@keyframes tutorialFall { to { transform: translateY(8px); filter: brightness(1.18); } }
.game-tutorial-overlay .tower-cell.target { outline: 2px dashed var(--gold-bright); outline-offset: -4px; animation: tutorialPulse 1s ease infinite alternate; }
@keyframes tutorialPulse { to { filter: brightness(1.5); } }
.game-tutorial-overlay .demo-caption { position: absolute; left: 18px; right: 18px; bottom: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }
.game-tutorial-overlay .power-cards,
.game-tutorial-overlay .mode-cards { width: min(92%, 620px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.game-tutorial-overlay .power-card,
.game-tutorial-overlay .mode-card { min-height: 180px; padding: 18px; display: grid; align-content: center; text-align: center; border: 1px solid var(--panel-border); border-radius: calc(var(--panel-radius) - 4px); background-image: var(--glass-spot), var(--glass-bg); }
.game-tutorial-overlay .power-card span { font-size: 38px; }
.game-tutorial-overlay .power-card strong,
.game-tutorial-overlay .mode-card strong { margin: 10px 0 5px; color: var(--gold-bright); font-family: var(--font-heading); }
.game-tutorial-overlay .power-card small,
.game-tutorial-overlay .mode-card small { color: var(--text-muted); line-height: 1.4; }
.game-tutorial-overlay .power-card.is-lit { border-color: var(--gold); transform: translateY(-5px); box-shadow: 0 0 24px var(--gold-glow); }
.game-tutorial-overlay .tutorial-single-card { grid-template-columns: 1fr; }
.game-tutorial-overlay .tutorial-preset-cards { grid-template-columns: repeat(4, 1fr); }
.game-tutorial-overlay .tutorial-ban-card { border-color: #d86b61; }
.game-tutorial-overlay .tutorial-online-card { border-color: var(--gold); box-shadow: 0 0 24px var(--gold-soft); }
.game-tutorial-overlay .key-grid { display: grid; grid-template-columns: repeat(3, 68px); gap: 12px; text-align: center; }
.game-tutorial-overlay .key { min-height: 58px; display: grid; place-items: center; border: 1px solid var(--glass-line-strong); border-bottom-width: 5px; border-radius: 9px; background: var(--glass-btn); color: var(--text-strong); font-weight: 800; }
.game-tutorial-overlay .key small { display: block; color: var(--text-muted); font-size: 9px; font-weight: 600; }
.game-tutorial-overlay .key.blank { visibility: hidden; }
.game-tutorial-overlay .key-pyramids { display: flex; align-items: flex-start; justify-content: center; gap: 34px; }
.game-tutorial-overlay .key-pyramid { display: grid; grid-template-columns: repeat(3, 68px); gap: 10px; }
.game-tutorial-overlay .key-pyramid strong { grid-column: 1 / -1; margin-bottom: 4px; color: var(--gold-bright); text-align: center; }
.game-tutorial-overlay .live-build-zone { position: relative; padding: 3px; border: 2px solid var(--gold); background: #171321; box-shadow: 0 0 16px var(--gold-glow); }
.game-tutorial-overlay .live-build-zone::after { content: ""; position: absolute; z-index: 3; left: 3px; right: 3px; top: calc(3px + (var(--tutorial-cell) + 3px) * 5); height: var(--tutorial-cell); pointer-events: none; background: rgba(255, 240, 170, .2); }
.game-tutorial-overlay .tower-health-scene { width: min(94%, 650px); display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.game-tutorial-overlay .tower-health-card { position: relative; min-height: 370px; overflow: hidden; border: 1px solid var(--panel-border); border-radius: calc(var(--panel-radius) - 4px); background: var(--glass-input); }
.game-tutorial-overlay .tower-health-card canvas { position: absolute; inset: 32px 0 0; width: 100%; height: 330px; background: transparent; }
.game-tutorial-overlay .tower-health-card strong { position: absolute; top: 12px; left: 0; right: 0; z-index: 2; color: var(--gold-bright); text-align: center; }
.game-tutorial-overlay .tutorial-actions { display: flex; gap: 10px; }
.game-tutorial-overlay .tutorial-button { min-width: 116px; padding: 12px 18px; border: 1px solid var(--glass-line-strong); border-radius: 8px; background: var(--glass-btn); color: var(--glass-text); cursor: pointer; }
.game-tutorial-overlay .tutorial-button:hover:not(:disabled) { border-color: var(--gold); background: var(--glass-btn-hover); }
.game-tutorial-overlay .tutorial-button.primary { border-color: var(--gold); background: linear-gradient(180deg, var(--gold-bright), var(--gold)); color: #21152d; font-weight: 800; }
.game-tutorial-overlay .tutorial-button:disabled { opacity: .35; cursor: default; }
.game-tutorial-overlay .tutorial-skip { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.game-tutorial-overlay .tutorial-skip:hover { color: var(--text-strong); }
.game-tutorial-overlay .tutorial-toast { position: fixed; left: 50%; bottom: 22px; z-index: 20; padding: 11px 18px; border: 1px solid var(--gold); border-radius: 8px; background: var(--panel-bg-solid); color: var(--gold-bright); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s var(--ease); }
.game-tutorial-overlay .tutorial-toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 820px) {
    .game-tutorial-overlay .tutorial-shell { padding: 0; }
    .game-tutorial-overlay .tutorial-frame { width: 100%; min-height: 100vh; border-radius: 0; }
    .game-tutorial-overlay .tutorial-header { flex-wrap: wrap; }
    .game-tutorial-overlay .tutorial-progress { order: 3; flex-basis: 100%; }
    .game-tutorial-overlay .tutorial-page { grid-template-columns: 1fr; gap: 24px; padding: 30px 24px; }
    .game-tutorial-overlay .tutorial-copy { max-width: none; }
    .game-tutorial-overlay .tutorial-demo { min-height: 370px; }
    .game-tutorial-overlay .power-cards,
    .game-tutorial-overlay .mode-cards { grid-template-columns: 1fr; padding: 20px 0; }
    .game-tutorial-overlay .tutorial-footer { align-items: flex-end; }
    .game-tutorial-overlay .tutorial-counter { display: none; }
}

/* -------------------------------------------------------------
   14. Friend system UI (search, results, toast, invite prompt)
   ------------------------------------------------------------- */
/* Allow the friend row action buttons to wrap instead of overflowing. */
.lobby-friend { flex-wrap: wrap; }

.lobby-friend-search { position: relative; margin-bottom: 12px; }
.lobby-friend-search input {
    width: 100%;
    box-sizing: border-box;
    height: 34px;
    padding: 0 12px;
    color: var(--text-strong);
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    font: inherit;
    font-size: 13px;
}
.lobby-friend-search input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
}

.lobby-friend-results { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.lobby-friend-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-body);
    font-size: 13px;
}
.lobby-friend-result button {
    font: inherit;
    font-size: 11px;
    color: var(--gold-bright);
    background: var(--gold-soft);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 3px 10px;
    cursor: pointer;
}
.lobby-friend-result button:hover { background: rgba(217, 180, 91, 0.28); }
.muted { color: var(--text-muted); font-size: 11px; }

/* Transient toast (attached to <body>) */
.social-toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%) translateY(20px);
    z-index: 1200;
    max-width: 90vw;
    padding: 10px 18px;
    background: linear-gradient(160deg, rgba(60, 50, 92, 0.96), rgba(34, 27, 52, 0.98));
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    color: var(--text-strong);
    font-family: var(--font-body);
    font-size: 14px;
    box-shadow: 0 12px 30px rgba(10, 6, 20, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.social-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Incoming game-invite prompt (attached to <body>) */
.invite-prompt {
    position: fixed;
    right: 26px;
    bottom: 26px;
    z-index: 1200;
    width: min(320px, 92vw);
    padding: 16px 18px;
    background: linear-gradient(160deg, rgba(70, 58, 104, 0.97), rgba(34, 27, 52, 0.98));
    border: 1px solid var(--gold);
    border-radius: 14px;
    box-shadow: 0 0 24px var(--gold-glow), 0 14px 34px rgba(10, 6, 20, 0.5);
    animation: panelIn 0.3s var(--ease);
}
.invite-prompt__text { color: var(--text-strong); font-size: 14px; margin-bottom: 12px; }
.invite-prompt__text strong { color: var(--gold-bright); font-family: var(--font-heading); }
.invite-prompt__actions { display: flex; gap: 10px; }
.invite-prompt__actions button {
    flex: 1;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 0;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid var(--panel-border);
}
.invite-accept {
    color: #241a12;
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    border-color: var(--gold);
}
.invite-accept:hover { box-shadow: 0 0 14px var(--gold-glow); }
.invite-decline { color: var(--text-body); background: rgba(255, 255, 255, 0.06); }
.invite-decline:hover { background: rgba(255, 140, 140, 0.18); }

/* -------------------------------------------------------------
   15. Chat system (World / Private tabs + Match chat panel)
   ------------------------------------------------------------- */
.lobby-chat-header { padding: 8px 10px; }
.lobby-chat-tabs { display: flex; gap: 6px; }
.lobby-chat-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    font: inherit;
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: rgba(46, 38, 70, 0.5);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.15s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.lobby-chat-tab:hover { color: var(--gold-bright); }
.lobby-chat-tab.active {
    color: #fff6df;
    border-color: var(--gold);
    background: linear-gradient(180deg, rgba(245, 217, 138, 0.28) 0%, rgba(217, 180, 91, 0.2) 100%);
}
.lobby-chat-badge, .pm-unread {
    background: #e0554f;
    color: #fff;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    min-width: 16px;
    text-align: center;
}

/* Tab views fill the panel; only the active one is shown. */
.lobby-chat-view { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; }
.lobby-chat-view.active { display: flex; }

.chat-badge {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 4px;
    object-fit: contain;
    vertical-align: -5px;
}
.lobby-chat-line__name.is-system-name { color: var(--system-msg); }
.lobby-chat-line.is-mine .lobby-chat-line__name { color: var(--gold-bright); }

/* Private-message conversation list + thread */
.pm-convo-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pm-convo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s var(--ease);
}
.pm-convo:hover { background: rgba(255, 255, 255, 0.05); }
.pm-convo__name { flex: 1 1 auto; color: var(--text-body); font-size: 13px; }

.pm-thread { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.pm-thread[hidden] { display: none; }

#lobbyRoot.view-ladder #profileHubHeader,
#lobbyRoot.view-ladder #profileHubTabs,
#lobbyRoot.view-ladder #profileHubStatsPanel,
#lobbyRoot.view-ladder #profileHubHistoryPanel {
    display: none !important;
}

/* Stats and Match History are dedicated Profile subpages. The lobby's own
   title/back row replaces the inner Player Hub navigation on these pages. */
#lobbyRoot.view-profile-detail #profileHubHeader,
#lobbyRoot.view-profile-detail #profileHubTabs {
    display: none !important;
}
.pm-thread__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--panel-border);
}
.pm-thread__name { font-family: var(--font-heading); color: var(--gold-bright); font-size: 14px; }
.pm-back {
    width: 28px; height: 28px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-strong);
    cursor: pointer;
}
.pm-back:hover { border-color: var(--gold); box-shadow: 0 0 8px var(--gold-glow); }

/* Match chat panel — floats over the paused game canvas */
.match-chat {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 950;
    width: min(340px, 92vw);
    height: 320px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(160deg, rgba(60, 50, 92, 0.94), rgba(30, 25, 48, 0.96));
    border: 1px solid var(--gold);
    border-radius: 14px;
    box-shadow: 0 0 22px var(--gold-glow), 0 14px 34px rgba(10, 6, 20, 0.5);
    animation: panelIn 0.3s var(--ease);
}
.match-chat[hidden] { display: none; }
.match-chat__head {
    padding: 10px 14px;
    font-family: var(--font-heading);
    color: var(--gold-bright);
    font-size: 14px;
    border-bottom: 1px solid var(--panel-border);
}

/* Lobby identity and profile navigation refinements. */
#lobbyTopBar #profileHubButton {
    display: none;
}

#lobbyTopBar #lobbyProfileButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lobby-quick #activePresetLabel {
    color: var(--gold-bright);
    font-size: 13px;
}

.lobby-quick #activePresetSelect {
    display: none;
}

.active-preset-picker {
    position: relative;
    width: 150px;
}

.active-preset-picker__trigger {
    position: relative;
    width: 150px;
    height: 32px;
    padding: 0 30px 0 10px;
    border: 1px solid var(--gold);
    border-radius: 10px;
    background: var(--glass-input);
    color: var(--glass-text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    font: inherit;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}

.active-preset-picker__trigger::after {
    content: '▼';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold-bright);
    font-size: 10px;
    line-height: 1;
}

.active-preset-picker__trigger:focus {
    outline: none;
    box-shadow: 0 0 10px var(--gold-glow);
}

.active-preset-picker__menu {
    position: absolute;
    top: calc(100% + 3px);
    left: 50%;
    z-index: 20;
    width: 120px;
    padding: 4px;
    transform: translateX(-50%);
    border: 1px solid var(--panel-border);
    border-radius: 7px;
    background: #241d38;
    box-shadow: 0 10px 22px rgba(10, 6, 20, 0.55);
}

.active-preset-picker__menu[hidden] { display: none; }

.active-preset-picker__option {
    display: block;
    width: 100%;
    padding: 7px 8px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--gold-bright);
    font: inherit;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}

.active-preset-picker__option:hover,
.active-preset-picker__option[aria-selected="true"] {
    background: rgba(75, 132, 220, 0.75);
    color: #fff;
}

#lobbyRoot.view-wide #lobbyViewHost {
    display: flex;
    justify-content: center;
    min-width: 0;
    max-width: 100%;
    padding: clamp(10px, 2vw, 24px);
    container-name: lobby-view;
    container-type: inline-size;
}

/* Match history stays inside the three-column lobby. Measure that centre
   column as a container too, rather than the full desktop viewport. */
#lobbyRoot.view-profile-detail #lobbyViewHost {
    container-name: lobby-view;
    container-type: inline-size;
}

#lobbyRoot.view-wide #profileHubCard,
#lobbyRoot.view-wide #profileHubThemesPanel,
#lobbyRoot.view-wide #customizationWorkspace {
    min-width: 0;
    max-width: 100%;
}

#lobbyRoot.view-settings #lobbyViewHost {
    padding-top: 12px;
}

#lobbyRoot.view-wide #powerUpPresetCard,
#lobbyRoot.view-wide #skillTreeCard,
#lobbyRoot.view-wide #lobbySettingsCard {
    width: min(1180px, 100%) !important;
    min-width: 0;
    height: fit-content;
    font-size: clamp(11px, 0.9vw, 14px);
}

/* Admin owns its own inner spacing. This must come after the generic
   view-wide host padding so the tab divider reaches both panel edges and the
   tab bar has equal spacing above and below its buttons. */
#lobbyRoot.view-wide.view-admin #lobbyViewHost {
    padding: 0;
}

#lobbyRoot.view-wide #skillTreeHeader,
#lobbyRoot.view-wide #skillTreeStatusBar,
#lobbyRoot.view-wide #skillTreeTabs,
#lobbyRoot.view-wide #skillTreeColumns,
#lobbyRoot.view-wide #presetTabs,
#lobbyRoot.view-wide #presetRenameRow,
#lobbyRoot.view-wide #presetSlotsRoot,
#lobbyRoot.view-wide #presetActionsRow {
    min-width: 0;
}

/* On very wide browser windows these views fit comfortably in the center
   column, so keep the surrounding lobby panels visible. Below this breakpoint
   the existing full-width layout remains active. */
@media (min-width: 1350px) {
    #lobbyRoot.view-wide {
        grid-template-columns: minmax(220px, 300px) minmax(0, 1fr) minmax(240px, 340px);
        grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "topbar topbar topbar"
            "friends center leaderboard"
            "news center chat";
    }

    #lobbyRoot.view-wide #lobbyFriends,
    #lobbyRoot.view-wide #lobbyLeaderboard,
    #lobbyRoot.view-wide #lobbyNews,
    #lobbyRoot.view-wide #lobbyChat {
        display: flex;
    }
}

/* Keep Themes full-width until the center column is wide enough to hold the
   side-by-side workshop without colliding with the lobby side panels. */
#lobbyRoot.view-wide.view-themes {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "topbar"
        "center";
}

#lobbyRoot.view-wide.view-themes #lobbyFriends,
#lobbyRoot.view-wide.view-themes #lobbyLeaderboard,
#lobbyRoot.view-wide.view-themes #lobbyNews,
#lobbyRoot.view-wide.view-themes #lobbyChat {
    display: none;
}

/* Achievements is a true full-lobby view at every desktop width. It should
   never collapse back into the center column beside friends/news/chat. */
#lobbyRoot.view-wide.view-achievements {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "topbar"
        "center";
}

#lobbyRoot.view-wide.view-achievements #lobbyFriends,
#lobbyRoot.view-wide.view-achievements #lobbyLeaderboard,
#lobbyRoot.view-wide.view-achievements #lobbyNews,
#lobbyRoot.view-wide.view-achievements #lobbyChat {
    display: none;
}

/* Settings needs room for the Account forms and stays full-width on every
   desktop size instead of returning to the narrow middle column. */
#lobbyRoot.view-wide.view-settings {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "topbar"
        "center";
}

#lobbyRoot.view-wide.view-settings #lobbyFriends,
#lobbyRoot.view-wide.view-settings #lobbyLeaderboard,
#lobbyRoot.view-wide.view-settings #lobbyNews,
#lobbyRoot.view-wide.view-settings #lobbyChat {
    display: none;
}

#lobbyRoot.view-achievements #profileHubCard {
    display: flex;
    flex-direction: column;
    width: min(1500px, 100%) !important;
    height: 100%;
    min-height: 0;
}

#lobbyRoot.view-achievements #profileHubAchievementsPanel.active {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
}

#lobbyRoot.view-achievements .achievement-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (min-width: 1600px) {
    #lobbyRoot.view-wide.view-themes {
        grid-template-columns: minmax(220px, 300px) minmax(0, 1fr) minmax(240px, 340px);
        grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "topbar topbar topbar"
            "friends center leaderboard"
            "news center chat";
    }

    #lobbyRoot.view-wide.view-themes #lobbyFriends,
    #lobbyRoot.view-wide.view-themes #lobbyLeaderboard,
    #lobbyRoot.view-wide.view-themes #lobbyNews,
    #lobbyRoot.view-wide.view-themes #lobbyChat {
        display: flex;
    }
}

@media (max-width: 1050px) {
    #lobbyRoot.view-achievements .achievement-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    #lobbyRoot.view-achievements .achievement-list {
        grid-template-columns: minmax(0, 1fr);
    }
}

#lobbyRoot.view-themes #lobbyViewHost {
    overflow: hidden;
    padding-top: 0;
}

#lobbyRoot.view-themes #profileHubCard {
    display: flex;
    flex-direction: column;
    width: min(1500px, 100%) !important;
    height: 100%;
    min-height: 0;
    overflow: hidden !important;
}

#lobbyRoot.view-themes #profileHubMessage:empty {
    display: none;
}

#lobbyRoot.view-themes #profileHubThemesPanel.active {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
}

#lobbyRoot.view-themes #customizationWorkspace {
    flex: 1 1 auto;
    grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.18fr);
    height: auto;
    min-height: 0;
}

#lobbyRoot.view-themes .customization-controls,
#lobbyRoot.view-themes .customization-preview,
#lobbyRoot.view-themes .customization-preview__stage,
#lobbyRoot.view-themes #customizationPreviewCanvas {
    min-height: 0;
}

.lobby-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 16px;
    width: min(620px, 100%);
    margin: 24px auto;
}

.lobby-profile-grid button {
    min-height: 92px;
    padding: 16px;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    color: var(--text-strong);
    background: linear-gradient(160deg, rgba(90, 76, 128, 0.5), rgba(38, 32, 58, 0.72));
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

/* Matchmaking stays available while the lobby remains fully interactive. */
#onlineQueueOverlay {
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    background: transparent;
    pointer-events: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

#onlineQueueCard {
    width: min(390px, calc(100vw - 40px));
    padding: 0;
    overflow: hidden;
    pointer-events: auto;
    color: var(--text-body);
    border: 1px solid var(--gold);
    border-radius: 16px;
    background: linear-gradient(160deg, #4b3d70 0%, #302548 52%, #211a35 100%);
    background-image: linear-gradient(160deg, #4b3d70 0%, #302548 52%, #211a35 100%);
    box-shadow: 0 18px 46px rgba(10, 6, 20, 0.58), 0 0 20px rgba(217, 180, 91, 0.2);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    text-align: left;
}

.online-queue__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 16px 12px;
    border-bottom: 1px solid rgba(226, 200, 140, 0.34);
    background: #2a203e;
}

.online-queue__eyebrow {
    display: block;
    margin-bottom: 2px;
    color: var(--gold);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

#onlineQueueCard h2 {
    margin: 0;
    color: var(--gold-bright);
    font-family: var(--font-heading);
    font-size: 22px;
    text-shadow: none;
}

#onlineQueueCard .online-queue__icon-button {
    display: none;
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    border-color: rgba(226, 200, 140, 0.54);
    background: #493861;
    color: var(--gold-bright);
    font-size: 24px;
    line-height: 1;
}

#onlineQueueOverlay.is-minimizable .online-queue__icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.online-queue__details {
    padding: 14px 16px 16px;
    text-align: center;
}

#onlineQueueStatus,
#queueRangeInfo,
#queueTimer,
#queueTip {
    color: var(--text-body);
}

.online-queue__lock-note {
    display: none;
    margin: 14px 0;
    padding: 9px 11px;
    border: 1px solid rgba(217, 180, 91, 0.36);
    border-radius: 9px;
    background: #2b213e;
    color: var(--gold-bright);
    font-size: 12px;
}

.matchmaking-locked .online-queue__lock-note {
    display: block;
}

#onlineQueueCard button {
    border: 1px solid rgba(226, 200, 140, 0.58);
    border-radius: 9px;
    background: #493861;
    color: var(--text-strong);
    box-shadow: none;
}

#onlineQueueCard button:hover {
    border-color: var(--gold);
    background: #5a4676;
    box-shadow: 0 0 12px rgba(245, 217, 138, 0.28);
}

#cancelOnlineQueueButton {
    width: 100%;
}

.online-queue__compact {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}

#queueCompactTimer {
    color: var(--gold-bright);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.online-queue__searching {
    flex: 1 1 auto;
    color: var(--text-muted);
    font-size: 12px;
}

#onlineQueueOverlay.is-minimized #onlineQueueCard {
    width: min(330px, calc(100vw - 40px));
}

#onlineQueueOverlay.is-minimized {
    align-items: flex-end;
}

#onlineQueueOverlay.is-minimized .online-queue__header,
#onlineQueueOverlay.is-minimized .online-queue__details {
    display: none;
}

#onlineQueueOverlay.is-minimized .online-queue__compact {
    display: flex;
}

/* Queue state freezes gameplay configuration but leaves social/read-only
   lobby areas clickable. Mutation handlers also enforce this in JavaScript. */
.matchmaking-locked .active-preset-picker__trigger,
.matchmaking-locked [data-profile-action="powerUpPreset"],
.matchmaking-locked [data-profile-action="skillTree"],
.matchmaking-locked [data-profile-action="themes"] {
    opacity: 0.48;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.35);
}

.matchmaking-locked .lobby-quick::after {
    content: "Locked while matchmaking";
    flex-basis: 100%;
    color: var(--gold-bright);
    font-size: 11px;
    text-align: center;
}

/* The body owns the complete lobby/reconnect background. Keeping this root
   transparent avoids a second 1800px gradient and its visible edge seams. */
#lobbyRoot {
    background: transparent;
}

/* Post-match and reconnect-adjacent DOM dialogs use opaque lobby purple/gold,
   never the retired glass treatment. */
#rankedSummaryCard {
    border-color: var(--gold);
    background: linear-gradient(160deg, #4b3d70 0%, #302548 54%, #211a35 100%);
    background-image: linear-gradient(160deg, #4b3d70 0%, #302548 54%, #211a35 100%);
    color: var(--text-body);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

@media (max-width: 640px) {
    #onlineQueueOverlay {
        padding: 12px;
    }

    #onlineQueueCard,
    #onlineQueueOverlay.is-minimized #onlineQueueCard {
        width: calc(100vw - 24px);
    }
}

.lobby-profile-grid button:hover {
    border-color: var(--gold);
    box-shadow: 0 0 18px var(--gold-glow);
}

@media (max-width: 620px) {
    .lobby-profile-grid { grid-template-columns: 1fr; }
}

.admin-dashboard {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(12, 8, 22, 0.82);
    backdrop-filter: blur(6px);
}

.admin-dashboard[hidden] { display: none; }

.admin-dashboard__panel {
    box-sizing: border-box;
    width: min(980px, 96vw);
    max-width: 100%;
    max-height: 92vh;
    overflow: auto;
    padding: 24px;
    border: 1px solid var(--gold);
    border-radius: 16px;
    color: var(--text-strong);
    background: linear-gradient(160deg, rgba(62, 52, 94, 0.99), rgba(30, 24, 48, 0.99));
    box-shadow: 0 24px 70px rgba(5, 3, 12, 0.7);
}

.admin-dashboard__header,
.admin-news-form__actions,
.admin-news-entry {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-dashboard__header { justify-content: space-between; }
.admin-dashboard__header h2 { margin: 0; }

.admin-dashboard__tabs {
    display: flex;
    gap: 8px;
    margin: 20px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--panel-border);
}

.admin-dashboard__panel .admin-dashboard__tab {
    border-color: var(--gold);
    color: var(--gold-bright);
    background: var(--gold-soft);
}

.admin-dashboard__panel .admin-dashboard__tab.is-active {
    border-color: var(--gold);
    color: var(--gold-bright);
    background: rgba(245, 217, 138, 0.12);
    box-shadow: 0 0 14px var(--gold-glow);
}

.admin-dashboard__tab-panel[hidden] { display: none; }
.admin-dashboard__tab-panel h3 { margin-top: 0; }

.admin-feedback-unread {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    margin-left: 5px;
    padding: 0 4px;
    border-radius: 999px;
    color: #24152a;
    background: #ff7b86;
    font: 800 11px/1 Arial, sans-serif;
}
.admin-feedback-unread[hidden] { display: none; }

.admin-feedback-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}
.admin-feedback-toolbar h3 { margin-bottom: 4px; }
.admin-feedback-toolbar p { margin: 0; color: var(--text-muted); font-size: 13px; }
.admin-feedback-toolbar label { display: grid; gap: 4px; color: var(--text-muted); font-size: 11px; }

.admin-feedback-inbox {
    display: grid;
    grid-template-columns: minmax(260px, 0.85fr) minmax(340px, 1.4fr);
    min-height: 430px;
    overflow: hidden;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: rgba(13, 9, 24, 0.48);
}

.admin-feedback-list {
    max-height: 58vh;
    overflow-y: auto;
    padding: 8px;
    border-right: 1px solid var(--panel-border);
}

.admin-dashboard__panel .admin-feedback-row {
    display: grid;
    width: 100%;
    gap: 5px;
    margin: 0 0 6px;
    padding: 11px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: var(--text-muted);
    text-align: left;
    background: rgba(255, 255, 255, 0.035);
}
.admin-dashboard__panel .admin-feedback-row:hover,
.admin-dashboard__panel .admin-feedback-row.is-selected {
    border-color: var(--gold);
    background: rgba(245, 217, 138, 0.09);
}
.admin-dashboard__panel .admin-feedback-row.is-unread {
    color: var(--text-strong);
    background: rgba(104, 72, 145, 0.28);
}
.admin-feedback-row__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-feedback-row__subject { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.admin-feedback-row small { color: var(--text-muted); }
.admin-feedback-row__kind,
.admin-feedback-detail__category {
    padding: 3px 7px;
    border: 1px solid rgba(255, 123, 134, 0.48);
    border-radius: 999px;
    color: #ffadb4;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}
.admin-feedback-row__kind.is-suggestion,
.admin-feedback-detail__category.is-suggestion {
    border-color: rgba(100, 211, 170, 0.48);
    color: #8be8c5;
}

.admin-feedback-detail {
    min-width: 0;
    padding: 20px;
}
.admin-feedback-detail h4 { margin: 12px 0 6px; color: var(--gold-bright); font-size: 22px; }
.admin-feedback-detail__meta,
.admin-feedback-detail__context { margin: 4px 0; color: var(--text-muted); font-size: 12px; }
.admin-feedback-detail__body {
    min-height: 170px;
    margin: 18px 0;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: rgba(0, 0, 0, 0.16);
}
.admin-feedback-detail__actions { display: flex; gap: 9px; }
.admin-feedback-empty { margin: 16px; color: var(--text-muted); }

@media (max-width: 760px) {
    .admin-feedback-inbox { grid-template-columns: 1fr; }
    .admin-feedback-list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--panel-border); }
    .admin-feedback-toolbar { align-items: flex-start; flex-direction: column; }
    .feedback-form__types { grid-template-columns: 1fr; }
}

.admin-dashboard__metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 18px 0;
}

.admin-dashboard__metrics > div,
.admin-dashboard__panel .admin-dashboard__metric {
    display: grid;
    gap: 4px;
    padding: 14px;
    text-align: left;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
}

.admin-dashboard__panel .admin-dashboard__metric {
    transition: border-color 0.18s ease, background 0.18s ease;
}

.admin-dashboard__panel .admin-dashboard__metric:hover {
    border-color: var(--gold);
    background: rgba(245, 217, 138, 0.1);
}

.admin-dashboard__metrics strong { font-size: 26px; color: var(--gold-bright); }
.admin-dashboard__metrics span { color: var(--text-muted); font-size: 12px; }
.admin-metric-details {
    margin: 0 0 18px;
    padding: 14px;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: rgba(15, 11, 27, 0.45);
}

.admin-metric-details__header,
.admin-metric-detail-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-metric-details__header {
    justify-content: space-between;
    margin-bottom: 10px;
}

.admin-metric-details__header h3 { margin: 0; }
.admin-metric-details__list { display: grid; gap: 7px; }

.admin-metric-detail-row {
    justify-content: space-between;
    padding: 9px 11px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
}

.admin-metric-detail-row span {
    color: var(--text-muted);
    font-size: 12px;
    text-align: right;
}

.admin-metric-details__empty {
    margin: 0;
    color: var(--text-muted);
}

.admin-news-form {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 12px;
}

.admin-news-form textarea {
    grid-column: 1 / -1;
    min-height: 130px;
    resize: vertical;
}

.admin-news-form > label {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-news-form__actions { grid-column: 1 / -1; }
.admin-news-list { display: grid; gap: 8px; margin-top: 18px; }
.admin-news-entry { padding: 10px; border: 1px solid var(--panel-border); border-radius: 10px; }
.admin-news-entry strong { flex: 1; }
.admin-news-entry span { color: var(--text-muted); font-size: 12px; }

.admin-access-form {
    display: grid;
    gap: 12px;
    max-width: 680px;
}

.admin-access-form__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-access-form textarea {
    min-height: 110px;
    resize: vertical;
}

.admin-access-form button {
    justify-self: start;
}

.admin-dashboard__panel .admin-login-status { min-width: 190px; font-weight: 700; }

.admin-dashboard__panel button,
.admin-dashboard__panel input,
.admin-dashboard__panel select,
.admin-dashboard__panel textarea {
    border: 1px solid var(--panel-border);
    border-radius: 9px;
    padding: 9px 12px;
    color: var(--text-strong);
    background: rgba(20, 16, 34, 0.82);
    font: inherit;
}

.admin-dashboard__panel button {
    border-color: var(--gold);
    color: var(--gold-bright);
    background: var(--gold-soft);
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.admin-dashboard__panel button:hover:not(:disabled),
.admin-dashboard__panel button:focus-visible {
    border-color: var(--gold-bright);
    box-shadow: 0 0 14px var(--gold-glow);
    filter: brightness(1.08);
    outline: none;
}

.admin-dashboard__panel .admin-news-form button[type="submit"],
.admin-dashboard__panel #adminLoginAccessSave,
.admin-dashboard__panel .admin-ban-form button[type="submit"] {
    border-color: var(--gold);
    color: #241a12;
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    font-weight: 800;
}

.admin-dashboard__panel .admin-login-status,
.admin-dashboard__panel .admin-login-status.is-enabled {
    border-color: #44d6a0;
    color: #b9ffe3;
    background: rgba(68, 214, 160, 0.18);
}

.admin-dashboard__panel .admin-login-status:hover:not(:disabled),
.admin-dashboard__panel .admin-login-status:focus-visible {
    border-color: #67ebba;
    background: rgba(68, 214, 160, 0.28);
    box-shadow: 0 0 14px var(--gold-glow);
}

.admin-dashboard__panel button:disabled { cursor: not-allowed; opacity: 0.42; }

.admin-players-layout {
    display: grid;
    grid-template-columns: minmax(430px, 0.95fr) minmax(420px, 1.05fr);
    gap: 16px;
    min-height: 0;
}

.admin-players-list-card,
.admin-player-detail {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: rgba(15, 11, 27, 0.45);
}

.admin-players-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.admin-players-heading h3 { margin: 0; }
.admin-players-heading input { width: min(260px, 55%); }

.admin-players-list {
    display: grid;
    gap: 8px;
    max-height: min(62vh, 680px);
    overflow-y: auto;
    padding-right: 4px;
}

.admin-player-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px;
    border: 1px solid rgba(226, 200, 140, 0.18);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
}

.admin-player-row.is-selected {
    border-color: var(--gold);
    background: rgba(245, 217, 138, 0.08);
}

.admin-dashboard__panel .admin-player-row__identity {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 4px 6px;
    border: 0;
    text-align: left;
    background: transparent;
}

.admin-player-row__identity strong,
.admin-player-row__identity span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-player-row__identity strong { color: var(--gold-bright); }
.admin-player-row__identity span { color: var(--text-muted); font-size: 11px; }

.admin-player-row__actions {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 5px;
}

.admin-dashboard__panel .admin-player-row__actions button {
    padding: 6px 8px;
    font-size: 11px;
}

.admin-dashboard__panel button.is-danger {
    border-color: var(--gold);
    color: var(--gold-bright);
    background: var(--gold-soft);
}

.admin-player-detail__empty { margin: 0; color: var(--text-muted); }
.admin-metric-details > .admin-player-detail { margin-top: 14px; }
.admin-metric-details__list > .admin-player-detail {
    margin: -1px 8px 7px;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    box-shadow: inset 3px 0 rgba(245, 217, 138, 0.35);
}
.admin-player-detail__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.admin-player-detail__header h3 { margin: 0 0 3px; }
.admin-player-detail__header p { margin: 0; color: var(--text-muted); font-size: 12px; }

.admin-player-info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.admin-player-info-grid > div {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 9px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
}
.admin-player-info-grid span { color: var(--text-muted); font-size: 10px; text-transform: uppercase; }
.admin-player-info-grid strong { overflow-wrap: anywhere; font-size: 12px; }

.admin-player-moderation {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}
.admin-player-quick-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.admin-ban-form {
    display: grid;
    gap: 9px;
    padding: 12px;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    background: rgba(20, 16, 34, 0.55);
}
.admin-ban-form.is-permanent { border-color: var(--panel-border); }
.admin-ban-form h4 { margin: 0; color: var(--gold-bright); }
.admin-ban-form label { display: grid; gap: 5px; color: var(--text-muted); font-size: 11px; }
.admin-ban-form textarea { min-height: 76px; resize: vertical; }
.admin-ban-form button { justify-self: start; }
.admin-player-protected { color: var(--text-muted); }

@media (max-width: 700px) {
    .admin-dashboard__metrics { grid-template-columns: 1fr; }
    .admin-news-form { grid-template-columns: 1fr; }
    .admin-news-form textarea,
    .admin-news-form__actions { grid-column: 1; }
    .admin-news-entry { align-items: flex-start; flex-wrap: wrap; }
    .admin-access-form__actions { align-items: stretch; flex-direction: column; }
    .admin-players-layout { grid-template-columns: 1fr; }
    .admin-metric-details__list { overflow-x: auto; }
    .admin-player-row { grid-template-columns: minmax(120px, 1fr) auto; min-width: 500px; }
    .admin-player-row__actions { justify-content: flex-end; }
    .admin-player-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-player-moderation { grid-template-columns: 1fr; }
    .admin-player-quick-actions { grid-column: 1; }
}
.match-chat .lobby-chat-log { flex: 1 1 auto; }

/* =========================================================
   Settings → Sound
   ========================================================= */

.lobby-sound-settings {
    display: grid;
    gap: 0;
    box-sizing: border-box;
    min-width: 0;
    width: min(620px, 100%);
    margin: 0 auto;
    padding: 2px 18px;
    border: 1px solid rgba(226, 200, 140, 0.28);
    border-radius: 12px;
    background: rgba(20, 13, 35, 0.62);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.lobby-sound-setting {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 8px 0;
}

.lobby-sound-setting__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.lobby-sound-setting__header label {
    color: #fff6df;
    font-weight: 700;
}

.lobby-sound-setting__header span {
    min-width: 48px;
    color: #f5d98a;
    font-weight: 700;
    text-align: right;
}

.lobby-sound-setting input[type="range"],
.lobby-effect-mixer input[type="range"] {
    display: block;
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    cursor: pointer;
    accent-color: #d9b85c;
}

.lobby-effect-mixers {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    min-width: 0;
    padding: 8px 0 10px;
}

.lobby-effect-mixer {
    min-width: 0;
}

.lobby-effect-mixer__master {
    display: grid;
    gap: 7px;
    margin-bottom: 12px;
}

.lobby-effect-mixer__master .lobby-sound-setting__header {
    align-items: flex-start;
    gap: 8px;
    min-height: 29px;
}

.lobby-effect-mixer__master .lobby-sound-setting__header label {
    min-width: 0;
    font-size: 12px;
    line-height: 1.2;
}

.lobby-effect-mixer__master .lobby-sound-setting__header span {
    min-width: 36px;
    font-size: 11px;
}

.lobby-power-up-volume-group + .lobby-power-up-volume-group {
    margin-top: 12px;
}

.lobby-power-up-volume-group__title {
    margin: 0 0 6px;
    color: rgba(245, 217, 138, 0.8);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.lobby-power-up-volume {
    display: grid;
    grid-template-columns: minmax(0, 88px) minmax(44px, 1fr) 32px;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin-top: 7px;
}

.lobby-power-up-volume label {
    min-width: 0;
    overflow: hidden;
    color: #fff6df;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lobby-power-up-volume input[type="range"] {
    margin: 0;
}

.lobby-power-up-volume__value {
    color: #f5d98a;
    font-size: 9px;
    font-weight: 700;
    text-align: right;
}

@media (max-width: 600px) {
    .lobby-effect-mixers {
        gap: 10px;
    }

    .lobby-effect-mixer__master .lobby-sound-setting__header label {
        font-size: 10px;
    }

    .lobby-power-up-volume {
        grid-template-columns: minmax(0, 74px) minmax(40px, 1fr) 30px;
        gap: 4px;
    }

    .lobby-power-up-volume label {
        font-size: 9px;
    }
}

/* Static interior masonry. Each node receives one unique atlas cell and stays
   anchored to its owning panel; it never shares the animated border system. */
.div-decoration-host {
    position: relative;
    isolation: isolate;
}

.div-decoration-host > :not(.div-decoration-layer):not(.border-decoration-layer) {
    position: relative;
    z-index: 1;
}

.div-decoration-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
    user-select: none;
}

.div-decoration-layer--suppressed {
    display: none;
}

.div-decoration {
    position: absolute;
    display: block;
    width: clamp(142px, 52%, 226px);
    aspect-ratio: 1;
    background-repeat: no-repeat;
    opacity: 0.5;
    filter: saturate(0.72) contrast(0.82) brightness(0.78) blur(0.45px);
    pointer-events: none;
}

.div-decoration--top-left { top: 0; left: 0; }
.div-decoration--top-right { top: 0; right: 0; }
.div-decoration--bottom-left { bottom: 0; left: 0; }
.div-decoration--bottom-right { right: 0; bottom: 0; }

#lobbyCenter .div-decoration,
#authCard .div-decoration,
#lobbyViewHost .div-decoration {
    width: clamp(156px, 46%, 260px);
}

.lobby-mode .div-decoration {
    width: clamp(108px, 72%, 154px);
    opacity: 0.15;
}

@media (max-width: 900px) {
    .div-decoration { width: clamp(104px, 34%, 162px); }
}

/* Keep sprite styling after every preset-theme rule so later background
   shorthands cannot replace the generated icon sheet. */
.presetSlotMarker.powerUpIconSprite,
.presetTypeMarker.powerUpIconSprite {
    flex: 0 0 auto;
    border-color: transparent;
    border-radius: 0;
    background-color: transparent;
    background-image: url('../img/power-up-icons/power-up-icons.png');
    background-repeat: no-repeat;
    background-size: 400% 400%;
    color: transparent;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .65));
}

.presetSlotMarker.powerUpIconStandalone,
.presetTypeMarker.powerUpIconStandalone {
    flex: 0 0 auto;
    border-color: transparent;
    border-radius: 0;
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    color: transparent;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .65));
}

.powerUpIconSprite.powerUpIconCell-0-0 { background-position: 0% 0%; }
.powerUpIconSprite.powerUpIconCell-1-0 { background-position: 33.3333% 0%; }
.powerUpIconSprite.powerUpIconCell-2-0 { background-position: 66.6667% 0%; }
.powerUpIconSprite.powerUpIconCell-3-0 { background-position: 100% 0%; }
.powerUpIconSprite.powerUpIconCell-0-1 { background-position: 0% 33.3333%; }
.powerUpIconSprite.powerUpIconCell-1-1 { background-position: 33.3333% 33.3333%; }
.powerUpIconSprite.powerUpIconCell-2-1 { background-position: 66.6667% 33.3333%; }
.powerUpIconSprite.powerUpIconCell-3-1 { background-position: 100% 33.3333%; }
.powerUpIconSprite.powerUpIconCell-0-2 { background-position: 0% 66.6667%; }
.powerUpIconSprite.powerUpIconCell-1-2 { background-position: 33.3333% 66.6667%; }
.powerUpIconSprite.powerUpIconCell-2-2 { background-position: 66.6667% 66.6667%; }
.powerUpIconSprite.powerUpIconCell-3-2 { background-position: 100% 66.6667%; }

.in-game-settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(7, 10, 18, 0.76);
    backdrop-filter: blur(7px);
}

.in-game-settings-dialog {
    width: min(760px, 94vw);
    height: min(720px, 90vh);
    overflow: hidden;
    padding: 22px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(226, 200, 140, 0.55);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(38, 34, 60, 0.98), rgba(17, 21, 36, 0.98));
    color: #f6efe0;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.in-game-settings-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.in-game-settings-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 12px 4px 4px 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--gold-soft) transparent;
}

.in-game-settings-content::-webkit-scrollbar {
    width: 8px;
}

.in-game-settings-content::-webkit-scrollbar-thumb {
    border-radius: 8px;
    background: var(--gold-soft);
}

.in-game-settings-header h2 { margin: 0; color: #f5d98a; }

.in-game-settings-header #inGameSettingsClose {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    min-width: 40px;
    max-width: 40px;
    min-height: 40px;
    max-height: 40px;
    box-sizing: border-box;
    aspect-ratio: 1 / 1;
    padding: 0;
    display: block;
    border: 1.5px solid rgba(226, 200, 140, 0.55);
    border-radius: 10px;
    color: #f6efe0;
    background: rgba(40, 33, 60, 0.92);
    box-shadow: none;
    font-size: 0;
    cursor: pointer;
}

.in-game-settings-header #inGameSettingsClose::before {
    content: '✕';
    position: absolute;
    left: 50%;
    top: 50%;
    color: #f6efe0;
    text-shadow: 0 0 6px rgba(8, 6, 16, 0.55);
    font: bold 22px/1 Arial, sans-serif;
    transform: translate(-50%, -50%);
}

.in-game-settings-header #inGameSettingsClose:focus-visible {
    outline: 2px solid #f5d98a;
    outline-offset: 2px;
}

.in-game-menu-trigger {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 800;
}

.in-game-menu-trigger[hidden],
.in-game-menu-overlay[hidden],
.in-game-menu-view[hidden],
.in-game-pause-details[hidden] {
    display: none;
}

.in-game-menu-overlay {
    z-index: 900;
}

.in-game-menu-dialog {
    width: min(340px, calc(100vw - 32px));
}

.in-game-menu-view {
    display: grid;
    gap: 12px;
}

#inGameLeaveMessage {
    margin: 4px 0 2px;
    text-align: center;
    line-height: 1.5;
}

#inGameLeaveConfirm .lobby-settings-actions {
    justify-content: center;
    margin-top: 0;
}

.in-game-menu-dialog .glass-action-button {
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.in-game-menu-dialog .glass-action-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.in-game-pause-details {
    display: grid;
    justify-items: center;
    gap: 5px;
    margin: 0 0 4px;
}

.in-game-pause-timer {
    color: var(--gold-bright);
    font-family: var(--font-heading);
    font-size: 64px;
    line-height: 1;
}

/* Monthly rewards reuse the lobby palette, panel and decoration systems. */
#lobbyCenter:not(.is-viewing) { gap: 18px; padding: 0; justify-content: flex-start; border: 0; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
#lobbyCenter:not(.is-viewing) > .border-decoration-layer,
#lobbyCenter:not(.is-viewing) > .div-decoration-layer { display: none; }
#lobbyCenter:not(.is-viewing) #lobbyArenaHome { flex: 1 0 auto; width: 100%; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
#lobbyArenaHome > .lobby-modes { max-width: 520px; }
#lobbyArenaHome[hidden] { display: none; }
#lobbyCenter.is-viewing #monthlyPass { display: none; }
#monthlyPass { flex: 0 0 auto; width: 100%; min-width: 0; box-sizing: border-box; text-align: left; background: rgba(25, 19, 42, .62); }
.monthly-pass__header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 20px 6px; }
.monthly-pass__heading, .monthly-pass__actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.monthly-pass__actions { margin-left: auto; }
.monthly-pass__header h2 { font-size: 13px; letter-spacing: .04em; }
#monthlyPassSeason, #monthlyPassTime, #monthlyPassProgress { color: var(--text-muted); font-size: 11px; }
#monthlyPassTime { white-space: nowrap; }
.monthly-pass button:disabled { cursor: default; }
.monthly-pass .lobby-view-action:disabled { opacity: .45; }
.monthly-pass__body { display: flex; min-width: 0; padding: 0 10px; }
.monthly-pass__track { position: relative; display: flex; flex: 1; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; padding: 2px 0 7px; scrollbar-width: thin; scrollbar-color: var(--gold-soft) transparent; }
.monthly-pass__level { flex: 0 0 86px; display: grid; grid-template-rows: 66px 28px 66px; }
.monthly-pass__reward { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; margin: 0 5px; padding: 3px; border: 1px solid var(--panel-border); border-radius: 8px; background: rgba(45, 35, 65, .78); color: var(--text-body); font: 10px var(--font-body); cursor: pointer; }
.monthly-pass__reward small { font: 9px var(--font-body); color: var(--text-muted); }
.monthly-pass__icon { font-size: 22px; line-height: 1.1; }
.monthly-pass__reward.is-ready { border-color: var(--gold); background: var(--gold-soft); }
.monthly-pass__reward.is-ready small { color: var(--gold-bright); }
.monthly-pass__reward.is-claimed { filter: grayscale(1); opacity: .48; }
.monthly-pass__reward:hover:not(:disabled) { border-color: var(--gold-bright); background: rgba(217, 180, 91, .22); }
.monthly-pass button:focus-visible, .monthly-pass__track:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.monthly-pass__marker { position: relative; display: grid; place-items: center; }
.monthly-pass__marker::before,
.monthly-pass__marker::after { content: ''; position: absolute; left: -50%; height: 6px; border-radius: 3px; }
.monthly-pass__marker::before { width: 100%; }
.monthly-pass__marker::after { width: var(--progress); transition: width 0.45s ease; }
.monthly-pass__level:first-child .monthly-pass__marker::before,
.monthly-pass__level:first-child .monthly-pass__marker::after { left: 0; }
.monthly-pass__level:first-child .monthly-pass__marker::before { width: 50%; }
.monthly-pass__marker span { z-index: 1; display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid var(--panel-border); border-radius: 50%; background: #241d38; color: var(--text-muted); font-size: 12px; }
.monthly-pass__marker .is-earned { background: var(--gold); color: #241d38; border-color: var(--gold); }
.monthly-pass__level.is-current .monthly-pass__marker span { border-color: var(--gold-bright); color: var(--gold-bright); box-shadow: 0 0 8px var(--gold-soft); }
.monthly-pass__footer { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 4px 14px 10px; }
#monthlyPassStatus { flex: 1 1 130px; min-width: 0; color: var(--text-muted); font-size: 10px; line-height: 1.35; }
.monthly-pass__footer:has(#monthlyPassStatus:empty) { display: none; }
#monthlyPass .monthly-pass__body { padding-bottom: 10px; }
#monthlyPass .div-decoration { opacity: .3; }
@media (max-width: 1180px) {
    #lobbyCenter:not(.is-viewing) #lobbyArenaHome { padding: 20px 12px; }
    .monthly-pass__header { padding-inline: 10px; }
    .monthly-pass__header h2 { font-size: 11px; }
}
@media (max-width: 980px) {
    #lobbyRoot:not(.view-wide) { overflow-y: auto; grid-template-rows: auto auto minmax(240px, 1fr) minmax(240px, auto); }
    #lobbyCenter:not(.is-viewing) { min-height: 720px; }
}
@media (max-height: 760px) and (min-width: 981px) {
    #lobbyCenter:not(.is-viewing) #lobbyArenaHome { padding: 16px 12px; }
    #lobbyArenaHome .lobby-mode { padding-block: 10px; gap: 4px; }
    #lobbyArenaHome .lobby-hero-title { font-size: 26px; margin-bottom: 6px; transform: none; }
    #lobbyArenaHome .lobby-quick { margin-top: 10px; }
}
@media (max-height: 650px) and (min-width: 981px) {
    #lobbyRoot:not(.view-wide) { overflow-y: auto; grid-template-rows: auto minmax(350px, 1fr) minmax(350px, 1fr); }
}
