:root {
    color-scheme: dark;
    --bg: #4b4747;
    --panel: #5a5656;
    --panel-alt: #d7d7d7;
    --topbar: #535151;
    --text: #f3f3f3;
    --muted: #d4d4d4;
    --link: #7ec4ff;
    --card: #d6d4d4;
    --card-text: rgba(20, 20, 20, 0.85);
    --sidebar-width: 240px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    height: 100%;
    background: var(--bg);
    color: var(--text);
}

body {
    font-family: "Overpass Mono", "Segoe UI", "Lucida Console", "Courier New", monospace;
}

button {
    font: inherit;
}

.auth-shell,
.home-shell {
    min-height: 100vh;
}

.home-shell[hidden],
.auth-shell[hidden] {
    display: none;
}

.auth-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    padding: 0 26px 0 32px;
    background: var(--topbar);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.auth-container {
    width: min(100%, 420px);
    margin: clamp(24px, 10vh, 96px) auto 0;
    padding: 24px 28px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(93, 91, 91, 0.2);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.auth-title {
    margin: 0 0 24px;
    color: #f3f3f3;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
    text-align: center;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.tab-btn {
    padding: 12px 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    color: rgba(255, 255, 255, 0.78);
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
}

.tab-btn.active {
    border-bottom-color: #f3f3f3;
    color: #f3f3f3;
}

.auth-form {
    display: grid;
    gap: 10px;
}

.auth-form h2,
.signed-in-state h2 {
    margin: 0 0 8px;
    font-size: 1.5rem;
    font-weight: 600;
    color: #f3f3f3;
}

.auth-form label {
    margin-top: 6px;
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.88);
}

.auth-form input {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.auth-form input:focus {
    border-color: rgba(255, 255, 255, 0.6);
    outline: 1px solid rgba(255, 255, 255, 0.4);
}

.submit-btn,
.sign-out-btn {
    min-height: 42px;
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
}

.status-message {
    min-height: 1.2em;
    margin: 0 0 12px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.9rem;
}

.status-message:empty {
    display: none;
}

.status-message.error {
    color: #ffb0b0;
}

.status-message.success {
    color: #b7f0c0;
}

.status-message.info {
    color: rgba(255, 255, 255, 0.82);
}

.auth-tabs[hidden],
.auth-form[hidden],
.signed-in-state[hidden],
.topbar-account[hidden],
#createGameLink[hidden],
#gameWorkspace[hidden],
#loginRequired[hidden],
#gameDetail[hidden],
#gameEditForm[hidden],
#editGameButton[hidden],
#deleteGameButton[hidden],
#gameOverview[hidden] {
    display: none !important;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 82px;
    padding: 0 26px 0 32px;
    background: var(--topbar);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-toggle {
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.24);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.brand-mark {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 2rem;
    line-height: 1;
    letter-spacing: 0.02em;
    color: #f2f2f2;
}

.brand-mark::before {
    display: none;
}

.user-panel {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 1.15rem;
    color: var(--text);
}

.user-name {
    display: inline-block;
    font-family: "Overpass Mono", "Lucida Console", "Courier New", monospace;
    font-size: 1.4rem;
    letter-spacing: 0.04em;
}

.logout-btn {
    padding: 0;
    border: 0;
    background: transparent;
    color: #f8f8f8;
    cursor: pointer;
    font-size: 1.2rem;
    font-family: "Overpass Mono", "Lucida Console", "Courier New", monospace;
}

.page-shell {
    display: flex;
    min-height: calc(100vh - 82px);
    min-height: calc(100dvh - 82px);
}

.sidebar {
    width: 240px;
    flex: 0 0 240px;
    background: rgba(255, 255, 255, 0.04);
    padding: 18px 18px 0 20px;
    transition: width 0.2s ease, padding 0.2s ease, opacity 0.2s ease;
}

.sidebar.collapsed {
    width: 0 !important;
    flex-basis: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.nav-item {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    color: #fff;
    text-align: left;
    padding: 10px 12px 8px;
    font-size: 1.28rem !important;
    line-height: 1.15;
    cursor: pointer;
    font-weight: 400;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 0;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px !important;
    padding-left: 16px;
}

.content {
    flex: 1;
    min-width: 0;
    padding: clamp(18px, 3.8vh, 34px) clamp(16px, 3.3vw, 42px) 24px;
}
.avatar-content {
    display: block;
}

.avatar-workspace {
    display: grid;
    width: min(100%, 1120px);
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 18px;
    margin-inline: auto;
}

.avatar-model-frame {
    width: 100%;
    min-width: 0;
    aspect-ratio: 16 / 9;
    border: 2px solid rgba(255, 255, 255, 0.72);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
    background: #3d3a3a;
}

.avatar-model-frame canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.mesh-color-panel {
    min-width: 0;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.mesh-color-panel h2 {
    margin: 0 0 14px;
    font-size: 1.1rem;
    font-weight: 500;
}

.mesh-color-panel p {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.avatar-editor-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.avatar-editor-tab {
    min-height: 42px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: rgba(255, 255, 255, 0.68);
    cursor: pointer;
    font: inherit;
    font-size: 0.86rem;
}

.avatar-editor-tab.active {
    border-bottom-color: #b7dfd6;
    color: #fff;
}

.avatar-editor-tabpanel[hidden],
#avatarHatsPanel[hidden],
#avatarColorsPanel[hidden] {
    display: none !important;
}

#ownedHatStatus {
    min-height: 1.4em;
    margin: 0 0 10px;
    color: rgba(255, 255, 255, 0.66);
    font-size: 0.76rem;
}

.hat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 8px;
    max-height: 390px;
    overflow-y: auto;
}

.hat-tile {
    display: grid;
    align-content: space-between;
    gap: 8px;
    min-width: 0;
    min-height: 104px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.045);
    color: #fff;
    cursor: pointer;
    text-align: left;
}

.hat-tile:hover,
.hat-tile:focus-visible {
    border-color: rgba(183, 223, 214, 0.7);
}

.hat-tile.selected {
    border-color: #b7dfd6;
    background: rgba(183, 223, 214, 0.14);
}

.hat-tile-type,
.hat-tile-state {
    color: #b7dfd6;
    font-size: 0.65rem;
}

.hat-tile-name {
    overflow-wrap: anywhere;
    font-size: 0.78rem;
    line-height: 1.3;
}

.face-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 8px;
}

.face-tile {
    display: grid;
    min-width: 0;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.045);
    color: #fff;
    cursor: pointer;
    text-align: left;
}

.face-tile:hover,
.face-tile:focus-visible {
    border-color: rgba(183, 223, 214, 0.7);
}

.face-tile.selected {
    border-color: #b7dfd6;
    background: rgba(183, 223, 214, 0.14);
}

.face-tile img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 3px;
    background: #454b49;
}

.face-tile span {
    margin-top: 6px;
    overflow-wrap: anywhere;
    font-size: 0.74rem;
}

.mesh-color-list {
    display: grid;
    gap: 2px;
}

.mesh-color-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 44px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 0.82rem;
}

.mesh-color-control span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mesh-color-control input[type="color"] {
    width: 38px;
    height: 30px;
    flex: 0 0 38px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.36);
    background: transparent;
    cursor: pointer;
}

.save-avatar-btn {
    width: 100%;
    min-height: 42px;
    margin-top: 16px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font: inherit;
    cursor: pointer;
}

.save-avatar-btn:disabled {
    opacity: 0.65;
    cursor: default;
}

#avatarSaveStatus {
    min-height: 1.3em;
    margin: 8px 0 0;
    color: #b7dfd6;
    font-size: 0.76rem;
}

.save-avatar-btn:hover,
.save-avatar-btn:focus-visible {
    background: rgba(255, 255, 255, 0.14);
}

.save-avatar-btn.saved {
    background: rgba(111, 197, 127, 0.2);
    border-color: rgba(111, 197, 127, 0.5);
}

.content-view {
    display: block;
}

.content-view[hidden] {
    display: none;
}

.content-view.active-view {
    animation: view-enter 320ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes view-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.users-list > *,
.card-row > *,
.game-list > * {
    animation: item-enter 360ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.users-list > :nth-child(2),
.card-row > :nth-child(2),
.game-list > :nth-child(2) {
    animation-delay: 45ms;
}

.users-list > :nth-child(3),
.card-row > :nth-child(3),
.game-list > :nth-child(3) {
    animation-delay: 90ms;
}

.users-list > :nth-child(4),
.card-row > :nth-child(4),
.game-list > :nth-child(4) {
    animation-delay: 135ms;
}

.users-list > :nth-child(5),
.card-row > :nth-child(5),
.game-list > :nth-child(5) {
    animation-delay: 180ms;
}

@keyframes item-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header h1 {
    margin: 0 0 24px;
    font-size: clamp(2.1rem, 2.7vw, 3.4rem);
    font-weight: 400;
    letter-spacing: 0.02em;
    color: #f5f5f5;
}

.users-list,
.games-view-list {
    display: grid;
    gap: 12px;
    max-width: 480px;
}

.friends-content {
    width: 100%;
}

.friends-section {
    width: min(100%, 720px);
    margin-top: 28px;
}

.friends-section h2 {
    margin: 0 0 12px;
    color: #f5f5f5;
    font-size: 1.25rem;
    font-weight: 500;
}

.user-search-form {
    display: flex;
    gap: 8px;
    width: min(100%, 520px);
}

.user-search-form input {
    flex: 1;
    min-width: 0;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.12);
    color: #f5f5f5;
    font: inherit;
}

.user-search-form input:focus-visible,
.friends-action:focus-visible,
.friend-identity:focus-visible {
    outline: 2px solid #d6d4d4;
    outline-offset: 2px;
}

.friends-list {
    display: grid;
    gap: 8px;
    width: min(100%, 520px);
    margin-top: 12px;
}

.friend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 60px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
}

.friend-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: #f5f5f5;
    text-decoration: none;
}

.friend-identity:hover .friend-username {
    text-decoration: underline;
}

.friend-avatar {
    display: grid;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    background: #d7d7d7;
    color: #343232;
}

.friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-username {
    overflow: hidden;
    text-overflow: ellipsis;
}

.friends-action {
    min-height: 36px;
    flex: 0 0 auto;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    font: inherit;
}

.friends-action:hover {
    background: rgba(255, 255, 255, 0.18);
}

.friend-state,
.friends-empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.user-row,
.games-view-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #f5f5f5;
    font-size: 1.2rem;
}
.profile-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 30px;
}

.profile-avatar {
    display: grid;
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.8rem;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-header h1 {
    margin: 0;
    color: #fff;
    font-size: 2rem;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.profile-header p {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.72);
}

.profile-friend-action {
    margin-top: 12px;
}

.profile-friend-status {
    min-height: 0;
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.profile-friend-status:empty {
    display: none;
}

.profile-avatar-showcase {
    width: min(100%, 980px);
    margin: 0 0 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.profile-avatar-showcase h2 {
    margin: 0 0 14px;
    color: #b7dfd6;
    font-size: 0.78rem;
    font-weight: 600;
}

.profile-avatar-scene {
    position: relative;
    width: 100%;
    height: min(56vh, 560px);
    min-height: 300px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 9px;
    background: linear-gradient(145deg, #454b49, #66635d);
}

#profileAvatar3D {
    display: block;
    width: 100%;
    height: 100%;
}

#profileAvatar3DStatus {
    position: absolute;
    right: 12px;
    bottom: 10px;
    left: 12px;
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.74rem;
    pointer-events: none;
}

#profileAvatar3DStatus[hidden] {
    display: none;
}

.profile-games-heading {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 14px;
}

.profile-games-heading h2 {
    margin: 0;
    color: #f5f5f5;
    font-size: 1.5rem;
    font-weight: 400;
}

.profile-games-heading span {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.85rem;
}

.mini-avatar {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.games-view-item {
    justify-content: flex-start;
}

.games-view-thumbnail,
.game-list-thumbnail {
    display: block;
    flex: 0 0 auto;
    overflow: hidden;
    background: rgba(214, 212, 212, 0.84);
}

.games-view-thumbnail {
    width: 96px;
    height: 64px;
    border-radius: 8px;
}

.game-list-thumbnail {
    width: 120px;
    height: 80px;
    border-radius: 10px;
}

.games-view-thumbnail img,
.game-list-thumbnail img,
.game-thumbnail-link img,
.game-detail-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.games-view-title {
    color: inherit;
    text-decoration: none;
}

.games-view-title:hover,
.games-view-title:focus-visible {
    text-decoration: underline;
}

.game-thumbnail-link {
    display: block;
    overflow: hidden;
}

.game-thumbnail-link img {
    transition: transform 220ms ease;
}

.game-thumbnail-link:hover img,
.game-thumbnail-link:focus-visible img {
    transform: scale(1.04);
}

.profile-header {
    animation: item-enter 420ms 50ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.profile-games {
    animation: item-enter 420ms 130ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.game-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 24px 28px;
    max-width: 980px;
    padding: 0;
    list-style: none;
}

.game-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-width: 0;
}

.game-item .game-list-thumbnail {
    width: 100%;
    aspect-ratio: 4 / 3;
    height: auto;
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgba(26, 26, 26, 0.08);
}

.catalog-content {
    width: min(100%, 1120px);
    margin-inline: auto;
}

.catalog-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.catalog-kicker {
    margin: 0 0 10px;
    color: #b7dfd6;
    font-size: 0.72rem;
    font-weight: 600;
}

.catalog-heading h1 {
    margin: 0;
    color: #f5f5f5;
    font-size: 2.8rem;
    font-weight: 500;
    line-height: 1;
}

.catalog-count {
    padding-bottom: 4px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.82rem;
}

.catalog-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.catalog-item {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(20, 25, 24, 0.18);
    animation: item-enter 360ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.catalog-item-preview {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(145deg, #454b49, #66635d);
    --poster-color: #565d59;
}

.catalog-item-face-preview {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    padding: 18px;
    background-color: #454b49;
    background-image: linear-gradient(45deg, rgba(255,255,255,0.06) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.06) 75%), linear-gradient(45deg, rgba(255,255,255,0.06) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.06) 75%);
    background-position: 0 0, 8px 8px;
    background-size: 16px 16px;
}

.catalog-item-details {
    min-width: 0;
    padding: 14px 14px 10px;
}

.catalog-item-details h2 {
    margin: 0;
    overflow-wrap: anywhere;
    color: #fff;
    font-size: 0.96rem;
    font-weight: 500;
}

.catalog-item-details p {
    margin: 7px 0 0;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.72rem;
}

.catalog-get-button {
    min-height: 40px;
    margin: 0 14px 14px;
    border: 1px solid rgba(183, 223, 214, 0.46);
    border-radius: 5px;
    background: rgba(183, 223, 214, 0.12);
    color: #e5fff7;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
}

.catalog-get-button:hover:not(:disabled),
.catalog-get-button:focus-visible:not(:disabled) {
    background: rgba(183, 223, 214, 0.24);
}

.catalog-get-button:disabled {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.52);
    cursor: default;
}

.catalog-get-button.owned {
    color: #b7dfd6;
}

.game-item-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 0 4px;
}

.game-item-heading h2 {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.9rem;
    font-weight: 500;
}

.game-title-link {
    color: inherit;
    text-decoration: none;
}

.game-title-link:hover,
.game-title-link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.game-visibility {
    flex: 0 0 auto;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.72rem;
}

.create-page-content .section-header h1,
.create-login-required .section-title {
    margin: 0 0 24px;
    color: #f5f5f5;
    font-size: clamp(2.1rem, 2.7vw, 3.4rem);
    font-weight: 400;
    line-height: 1.1;
}

.create-workspace,
.create-login-required {
    width: min(100%, 900px);
    margin-inline: auto;
}

.create-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.create-heading h1 {
    margin: 0;
    color: #f5f5f5;
    font-size: 2.8rem;
    font-weight: 500;
    line-height: 1;
}

.create-kicker,
.creator-index {
    display: block;
    margin: 0 0 10px;
    color: #b7dfd6;
    font-size: 0.72rem;
    font-weight: 600;
}

.create-account-name {
    padding-bottom: 3px;
    color: rgba(255, 255, 255, 0.66);
    font-size: 0.86rem;
}

.creator-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.creator-tab {
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: rgba(255, 255, 255, 0.68);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
}

.creator-tab:hover,
.creator-tab:focus-visible {
    color: #fff;
}

.creator-tab.active {
    border-bottom-color: #b7dfd6;
    color: #fff;
}

.creator-panel[hidden] {
    display: none !important;
}

.creator-panel-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.creator-panel-heading h2 {
    margin: 0;
    color: #fff;
    font-size: 1.65rem;
    font-weight: 500;
}

.creator-panel-heading .creator-index {
    margin-bottom: 8px;
}

.creator-text-button {
    padding: 6px 0;
    border: 0;
    background: transparent;
    color: #b7dfd6;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    text-decoration: none;
}

.creator-text-button:hover,
.creator-text-button:focus-visible {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.creator-substatus {
    margin: 0 0 18px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.84rem;
}

.access-state {
    padding: 6px 9px;
    border: 1px solid rgba(183, 223, 214, 0.3);
    border-radius: 4px;
    color: #b7dfd6;
    font-size: 0.7rem;
    white-space: nowrap;
}

.owned-games-list {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.owned-game-item {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.owned-game-thumbnail {
    width: 96px;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.09);
}

.owned-game-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.owned-game-details {
    min-width: 0;
}

.owned-game-details h3 {
    margin: 0;
    overflow-wrap: anywhere;
    color: #fff;
    font-size: 0.96rem;
    font-weight: 500;
}

.owned-game-details p {
    margin: 6px 0 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.74rem;
    text-transform: capitalize;
}

.owned-game-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.create-workspace .game-form {
    display: grid;
    gap: 10px;
    width: min(100%, 620px);
    margin-inline: auto;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.create-workspace .game-form label {
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.84);
    font-size: 0.9rem;
}

.create-workspace .game-form input,
.create-workspace .game-form select {
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: #514d4d;
    color: #fff;
}

.create-workspace .game-form .submit-btn {
    min-height: 42px;
    margin-top: 12px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
}

.create-workspace .game-form .submit-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.create-login-required p {
    color: rgba(255, 255, 255, 0.84);
}

.creator-panel .game-form[hidden] {
    display: none !important;
}

.create-signin-link {
    display: inline-block;
    margin-top: 8px;
    color: #fff;
}

#loginRequired[hidden],
#gameWorkspace[hidden] {
    display: none !important;
}

.game-detail-thumbnail {
    width: min(100%, 760px);
    aspect-ratio: 16 / 9;
    margin: 28px 0 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(214, 212, 212, 0.84);
}

.game-detail-thumbnail[hidden] {
    display: none;
}

.topbar-brand {
    color: #f5f5f5;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 22px;
}

.topbar-nav a {
    color: #fff;
    text-decoration: none;
}

.topbar-nav a:hover,
.topbar-nav a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.topbar-account {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
}

.game-page-detail {
    max-width: 1000px;
}

.game-detail-back {
    display: inline-block;
    margin-bottom: 28px;
    color: #fff;
    text-decoration: none;
}

.game-detail-back:hover,
.game-detail-back:focus-visible {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.game-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    max-width: 760px;
}

.game-owner-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 10px;
}

.game-detail-header h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 600;
    line-height: 1.1;
}

.game-detail-header p {
    display: inline-block;
    margin: 14px 0 0;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.8rem;
    text-transform: capitalize;
}

.game-page-detail .submit-btn,
.game-page-detail .cancel-edit-btn,
.game-page-detail .delete-game-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    margin: 0;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
}

.game-page-detail .delete-game-btn {
    border-color: rgba(255, 145, 145, 0.5);
    background: rgba(128, 35, 35, 0.26);
}

.game-page-detail .submit-btn:hover,
.game-page-detail .cancel-edit-btn:hover,
.game-page-detail .delete-game-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.game-page-detail .delete-game-btn:hover {
    background: rgba(160, 40, 40, 0.48);
}

.game-page-detail .game-form {
    display: grid;
    gap: 10px;
    width: min(100%, 620px);
    margin-top: 28px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.game-page-detail .game-form h2 {
    margin: 0 0 8px;
    color: #fff;
    font-size: 1.35rem;
}

.game-page-detail .game-form label {
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.84);
    font-size: 0.9rem;
}

.game-page-detail .game-form input,
.game-page-detail .game-form select {
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: #514d4d;
    color: #fff;
}

.game-edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

@media (max-width: 560px) {
    .topbar {
        height: auto;
        min-height: 72px;
        padding: 14px 16px;
    }

    .topbar-nav {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 10px 14px;
        font-size: 0.8rem;
    }

    .topbar-account {
        gap: 8px;
    }

    .game-detail-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }

    .game-page-detail .game-form {
        padding: 18px;
    }
}

.welcome-row h1 {
    margin: 0;
    font-size: clamp(2.1rem, 2.7vw, 3.4rem);
    line-height: 1.1;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: #f5f5f5;
}

.username {
    font-weight: 600;
}

.dashboard-section {
    margin-top: 18px;
}

.dashboard-section h2 {
    margin: 0 0 18px 0;
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: #f5f5f5;
}

.card-row {
    display: flex;
    flex-wrap: wrap;
    gap: 22px 28px;
    padding-left: 4px;
}

.game-card {
    width: 146px;
}

.card-box {
    width: 146px;
    height: 110px;
    border-radius: 22px;
    background: rgba(214, 212, 212, 0.84);
    box-shadow: inset 0 0 0 1px rgba(26, 26, 26, 0.08);
}

.card-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 8px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.82rem;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

.wide-row {
    max-width: 980px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 900px) {
    .page-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-basis: auto;
        padding: 10px 16px;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px 10px;
        overflow-x: auto;
    }

    .nav-item {
        width: auto;
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 8px 10px;
        font-size: 1rem !important;
    }

    .content {
        padding-top: clamp(16px, 3vh, 24px);
    }

    .avatar-workspace {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .avatar-model-frame {
        width: 100%;
    }

    .hat-wardrobe-layout {
        grid-template-columns: 1fr;
    }

    .hat-tryon-stage {
        height: 58vw;
        min-height: 260px;
        max-height: 420px;
    }

    .mesh-color-panel {
        max-height: none;
        padding: 16px 0 0;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        border-left: 0;
    }
}

@media (max-width: 560px) {
    .profile-avatar-scene {
        height: 58vw;
        min-height: 250px;
        max-height: 380px;
    }

    .catalog-heading h1 {
        font-size: 2.25rem;
    }

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

    .catalog-item-details {
        padding: 11px 10px 8px;
    }

    .catalog-get-button {
        margin: 0 10px 10px;
        font-size: 0.74rem;
    }

    .create-heading h1 {
        font-size: 2.25rem;
    }

    .creator-tabs {
        gap: 0;
        margin-inline: -4px;
    }

    .creator-tab {
        flex: 1 1 0;
        padding-inline: 5px;
        font-size: 0.76rem;
    }

    .creator-panel-heading h2 {
        font-size: 1.4rem;
    }

    .owned-game-item {
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 12px;
    }

    .owned-game-thumbnail {
        width: 72px;
    }

    .owned-game-actions {
        grid-column: 2;
        margin-top: -6px;
    }

    .sidebar {
        padding-inline: 12px;
    }

    .sidebar-nav {
        gap: 6px;
        margin-top: 0;
    }

    .nav-item {
        padding: 8px 4px;
        font-size: 0.9rem !important;
    }

    .nav-item.active {
        padding-left: 6px;
    }

    .topbar {
        padding: 0 18px;
    }

    .hat-wardrobe-heading h2 {
        font-size: 1.4rem;
    }

    .brand-mark {
        font-size: 1.6rem;
    }

    .user-name,
    .logout-btn {
        font-size: 1rem;
    }

    .content {
        padding: 20px 16px 0;
    }

    .welcome-row {
        gap: 12px;
    }

    .welcome-row h1,
    .dashboard-section h2 {
        font-size: 2rem;
    }

    .game-card,
    .card-box {
        width: 120px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .auth-topbar {
        height: 56px;
    }

    .auth-container {
        margin-top: 20px;
    }

    .topbar {
        min-height: 56px;
        height: auto;
        padding-block: 8px;
    }

    .page-shell {
        min-height: calc(100vh - 56px);
        min-height: calc(100dvh - 56px);
    }

    .content {
        padding-top: 14px;
    }

    .welcome-row {
        margin-bottom: 14px;
    }

    .dashboard-section {
        margin-top: 12px;
    }
}