.panel-masthead {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: var(--header-height);
    padding: calc(20px + env(safe-area-inset-top)) var(--gutter) 20px;
    background: var(--page);
}
.panel-masthead::after {
    content: '';
    position: absolute;
    inset: auto var(--gutter) 0;
    height: 1px;
    background: var(--ink);
    opacity: 0.065;
    pointer-events: none;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    white-space: nowrap;
}
.brand strong,
.brand-wordmark {
    color: var(--ink);
    font-family: var(--font-brand);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1.4;
    text-transform: uppercase;
}
.brand-wordmark-accent {
    color: var(--accent-ink);
}
.brand-mark {
    display: grid;
    place-items: center;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    color: var(--header-ink);
    background: var(--header-tint);
}
.brand-mark svg {
    width: 26px;
    height: 26px;
}
.brand-mark img {
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 50%;
}
.panel-masthead .account-toggle {
    flex-shrink: 0;
    margin-left: auto;
    padding: 0;
    overflow: hidden;
    background: var(--surface);
    color: var(--muted);
}
.account-toggle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.panel-masthead .account-toggle:active {
    opacity: 0.75;
}
.sidebar {
    position: fixed;
    inset: var(--header-height) auto 0 0;
    z-index: 10;
    width: var(--sidebar-width);
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--page);
}
.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 100%;
    padding: 24px;
}
.workspace {
    display: flow-root;
    min-width: 0;
    margin-left: var(--sidebar-width);
}
.primary-nav {
    display: grid;
    align-content: start;
    gap: 8px;
}
.primary-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 4px;
    border-radius: var(--radius-large);
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
}
.sidebar .primary-nav a {
    padding-inline: 0;
}
.nav-symbol {
    display: grid;
    place-items: center;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    transition:
        transform 160ms ease,
        color 160ms ease,
        background 160ms ease;
}
.nav-symbol svg {
    width: 22px;
    height: 22px;
}
.nav-label {
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.4;
}
.primary-nav a[aria-current='page'],
.mobile-nav a[aria-current='page'] {
    color: var(--ink);
}
.primary-nav a[aria-current='page'] .nav-symbol,
.mobile-nav a[aria-current='page'] .nav-symbol {
    color: var(--on-primary);
    background: var(--accent);
}
.primary-nav a:active,
.mobile-nav a:active {
    opacity: 0.8;
}
.primary-nav a:active .nav-symbol,
.mobile-nav a:active .nav-symbol {
    transform: scale(0.93);
}
.primary-nav a:focus-visible,
.mobile-nav a:focus-visible {
    outline-offset: -2px;
}
.account {
    font-size: 0.875rem;
}
.account-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
}
.account-details {
    display: grid;
    gap: 4px;
    min-width: 0;
    flex: 1;
}
.account-name,
.account-email {
    display: block;
    overflow-wrap: anywhere;
    line-height: 1.5;
}
.account-name {
    font-size: 1rem;
    font-weight: 600;
}
.account-email {
    color: var(--muted);
    font-size: 0.8125rem;
}
.account-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    overflow: hidden;
    border-radius: var(--radius);
    color: var(--muted);
    background: var(--soft);
}
.account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.account-avatar svg {
    width: 20px;
    height: 20px;
}
.account-actions {
    display: grid;
    gap: 4px;
    margin-top: 24px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.account-actions .account-action {
    justify-content: flex-start;
    gap: 12px;
    min-height: 56px;
    padding: 12px;
    border-radius: calc(var(--radius-large) - 4px);
    color: var(--ink);
    font-weight: 500;
}
.account-action > svg {
    color: var(--muted);
}
.account-action-label {
    flex: 1;
    text-align: left;
}
.theme-indicator {
    position: relative;
    flex: 0 0 42px;
    width: 42px;
    height: 26px;
    border: 1px solid var(--input-border);
    border-radius: 999px;
    background: var(--soft);
    transition: background 150ms ease;
}
.theme-indicator::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform 150ms ease;
}
[aria-checked='true'] .theme-indicator {
    background: var(--accent);
    border-color: var(--accent);
}
[aria-checked='true'] .theme-indicator::after {
    transform: translateX(16px);
    background: var(--on-primary);
}
.content {
    width: min(calc(100% - var(--gutter) * 2), 1280px);
    margin: 28px auto 48px;
    scroll-margin-top: calc(var(--header-height) + 20px);
    container: panel-content / inline-size;
    animation: content-enter 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 24px;
}
.page-heading > div:first-child {
    min-width: 0;
    flex: 1 1 160px;
}
.page-heading h1 {
    overflow-wrap: anywhere;
}
.heading-actions {
    flex-wrap: wrap;
    gap: 8px;
}
.heading-actions .button {
    min-height: 48px;
    padding: 12px 18px;
    font-size: 0.875rem;
}
.game-page-heading > div:first-child {
    flex-basis: 160px;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 0.875rem;
}
.mobile-nav {
    display: none;
}
dialog.account-dialog {
    width: min(368px, calc(100% - 32px));
}
.account-content {
    padding: 20px;
}
.account-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.account-heading h2 {
    font-size: 1.25rem;
}
@media (hover: hover) and (pointer: fine) {
    .primary-nav a:hover {
        color: var(--ink);
    }
    .panel-masthead .account-toggle:hover:not(:disabled) {
        color: var(--ink);
        background: var(--soft);
    }
    .account-actions .account-action:hover:not(:disabled) {
        background: var(--pressed-surface);
    }
}
@media (min-width: 1100px) {
    :root {
        --gutter: 32px;
    }
    .panel-masthead {
        padding-inline: 24px;
    }
    .panel-masthead::after {
        left: 24px;
        right: 24px;
    }
}
@media (min-width: 600px) and (max-width: 1099px) {
    :root {
        --sidebar-width: var(--sidebar-rail);
        --gutter: 24px;
    }
    .sidebar-content {
        padding: 24px 8px;
    }
    .sidebar .primary-nav {
        gap: 12px;
    }
    .sidebar .primary-nav a {
        display: grid;
        justify-items: center;
        align-content: start;
        gap: 8px;
        min-height: 88px;
        padding: 8px 4px;
    }
    .sidebar .nav-label {
        visibility: hidden;
        max-width: 100%;
        text-align: center;
        font-size: 0.75rem;
    }
    .sidebar a[aria-current='page'] .nav-label {
        visibility: visible;
    }
}
@media (max-width: 599px) {
    :root {
        scroll-padding-bottom: calc(100px + env(safe-area-inset-bottom));
    }
    .sidebar {
        display: none;
    }
    .workspace {
        margin-left: 0;
    }
    .content {
        margin-top: 24px;
        margin-bottom: calc(100px + env(safe-area-inset-bottom));
    }
    .mobile-nav {
        position: fixed;
        inset: auto var(--gutter) max(16px, env(safe-area-inset-bottom));
        z-index: 15;
        display: flex;
        justify-content: space-between;
        gap: 8px;
        width: min(304px, calc(100% - var(--gutter) * 2));
        margin: auto;
        padding: 8px;
        border-radius: 999px;
        background: var(--nav-surface);
    }
    .mobile-nav:has(a:first-child:nth-last-child(3)) {
        max-width: 208px;
    }
    .mobile-nav a {
        display: grid;
        place-items: center;
        flex: 0 0 48px;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        color: var(--nav-ink);
    }
    .mobile-nav .nav-label {
        display: none;
    }
    .page-heading {
        align-items: center;
        gap: 16px;
    }
    .page-heading h1 {
        font-size: 1.375rem;
    }
    .page-heading > div:first-child {
        flex-basis: 120px;
    }
    .heading-actions .button {
        padding: 12px 16px;
    }
    .toasts {
        right: 16px;
        bottom: calc(96px + env(safe-area-inset-bottom));
    }
}
@media (max-width: 360px) {
    :root {
        --gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
    }
}
