:root {
    /* Header is shared by legacy Grimoire pages too. These dark defaults keep
       its dropdown and mobile panel readable when the page has no discovery body. */
    --discovery-bg: #171221;
    --discovery-bg-end: #241c32;
    --discovery-surface: #2d2640;
    --discovery-surface-soft: #352c49;
    --discovery-panel: rgba(38, 31, 55, .92);
    --discovery-card: rgba(28, 22, 40, .82);
    --discovery-border: #4a3f5c;
    --discovery-gold: #d4a574;
    --discovery-gold-soft: rgba(212, 165, 116, .17);
    --discovery-rose: #c0397b;
    --discovery-rose-soft: rgba(192, 57, 123, .17);
    --discovery-focus: #d4a574;
    --discovery-text: #eee8f3;
    --discovery-title: #fff;
    --discovery-muted: #b4a9c2;
    --discovery-shadow: rgba(8, 5, 15, .24);
}

body.grimoire-discovery {
    --grimoire-gold: var(--discovery-gold);
    --grimoire-border: var(--discovery-border);
    --grimoire-accent: var(--discovery-rose);
    --discovery-bg: #fff8f3;
    --discovery-bg-end: #f7edf3;
    --discovery-surface: #fffdfb;
    --discovery-surface-soft: #f5edf2;
    --discovery-panel: rgba(255, 253, 251, .94);
    --discovery-card: rgba(255, 255, 255, .9);
    --discovery-border: #d9c7d0;
    --discovery-gold: #8a622f;
    --discovery-gold-soft: rgba(138, 98, 47, .16);
    --discovery-rose: #9d3765;
    --discovery-rose-soft: rgba(157, 55, 101, .13);
    --discovery-focus: #9d3765;
    --discovery-text: #33283b;
    --discovery-title: #21182b;
    --discovery-muted: #665a6f;
    --discovery-shadow: rgba(70, 45, 61, .13);
    color-scheme: light;
    min-width: 0;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 12% 10%, var(--discovery-rose-soft), transparent 28rem),
        radial-gradient(circle at 88% 24%, var(--discovery-gold-soft), transparent 30rem),
        linear-gradient(180deg, var(--discovery-bg), var(--discovery-bg-end));
    color: var(--discovery-text);
    font-family: Inter, system-ui, sans-serif;
}

:root[data-theme="dark"] body.grimoire-discovery,
:root.dark body.grimoire-discovery {
    --discovery-bg: #171221;
    --discovery-bg-end: #241c32;
    --discovery-surface: #2d2640;
    --discovery-surface-soft: #352c49;
    --discovery-panel: rgba(38, 31, 55, .92);
    --discovery-card: rgba(28, 22, 40, .82);
    --discovery-border: #4a3f5c;
    --discovery-gold: #d4a574;
    --discovery-gold-soft: rgba(212, 165, 116, .17);
    --discovery-rose: #c0397b;
    --discovery-rose-soft: rgba(192, 57, 123, .17);
    --discovery-focus: #d4a574;
    --discovery-text: #eee8f3;
    --discovery-title: #fff;
    --discovery-muted: #b4a9c2;
    --discovery-shadow: rgba(8, 5, 15, .24);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) body.grimoire-discovery {
        --discovery-bg: #171221;
        --discovery-bg-end: #241c32;
        --discovery-surface: #2d2640;
        --discovery-surface-soft: #352c49;
        --discovery-panel: rgba(38, 31, 55, .92);
        --discovery-card: rgba(28, 22, 40, .82);
        --discovery-border: #4a3f5c;
        --discovery-gold: #d4a574;
        --discovery-gold-soft: rgba(212, 165, 116, .17);
        --discovery-rose: #c0397b;
        --discovery-rose-soft: rgba(192, 57, 123, .17);
        --discovery-focus: #d4a574;
        --discovery-text: #eee8f3;
        --discovery-title: #fff;
        --discovery-muted: #b4a9c2;
        --discovery-shadow: rgba(8, 5, 15, .24);
        color-scheme: dark;
    }
}

.grimoire-discovery *,
.grimoire-discovery *::before,
.grimoire-discovery *::after {
    box-sizing: border-box;
}

.discovery-shell {
    width: min(1180px, calc(100% - 32px));
    margin-inline: auto;
}

.discovery-hero {
    padding: clamp(48px, 8vw, 96px) 0 36px;
    text-align: center;
}

.discovery-eyebrow {
    margin: 0 0 14px;
    color: var(--discovery-gold);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.discovery-title,
.discovery-section-title,
.discovery-card-title {
    margin: 0;
    color: var(--discovery-title);
    font-family: Cinzel, Georgia, serif;
}

.discovery-title {
    font-size: clamp(2.25rem, 7vw, 4.6rem);
    line-height: 1.05;
}

.discovery-lead {
    max-width: 720px;
    margin: 20px auto 0;
    color: var(--discovery-muted);
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    line-height: 1.7;
}

.workshop-pixelart-bridge {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
    border: 1px solid var(--discovery-gold);
    border-radius: 18px;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--discovery-gold-soft), var(--discovery-rose-soft));
    box-shadow: 0 16px 42px var(--discovery-shadow);
}

.workshop-pixelart-bridge__icon {
    display: inline-flex;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--discovery-gold-soft);
    border-radius: 14px;
    background: var(--discovery-surface);
    font-size: 1.55rem;
}

.workshop-pixelart-bridge__eyebrow {
    margin: 0 0 3px;
    color: var(--discovery-gold);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.workshop-pixelart-bridge h2,
.workshop-pixelart-bridge__copy > p:last-child {
    margin: 0;
}

.workshop-pixelart-bridge h2 {
    color: var(--discovery-title);
    font: 700 1.05rem/1.3 Cinzel, Georgia, serif;
}

.workshop-pixelart-bridge__copy > p:last-child {
    margin-top: 5px;
    color: var(--discovery-muted);
    font-size: .88rem;
    line-height: 1.5;
}

.workshop-pixelart-bridge__action {
    min-width: 154px;
}

.workshop-portals,
.gallery-hub-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.workshop-portal,
.gallery-hub-card {
    min-width: 0;
    border: 1px solid var(--discovery-border);
    border-radius: 20px;
    background: linear-gradient(145deg, var(--discovery-surface), var(--discovery-surface-soft));
    color: inherit;
    box-shadow: 0 18px 54px var(--discovery-shadow);
}

.workshop-portals:where(:has(> :last-child:nth-child(2))) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workshop-portal {
    display: flex;
    min-height: 220px;
    flex-direction: column;
    padding: 24px;
    text-decoration: none;
    transition: border-color .2s ease, transform .2s ease, background-color .2s ease;
}

.workshop-portal:hover,
.workshop-portal[data-selected="true"] {
    border-color: var(--discovery-gold);
    background: linear-gradient(145deg, var(--discovery-surface-soft), var(--discovery-surface));
}

.workshop-portal:hover {
    transform: translateY(-3px);
}

.workshop-portal__top,
.discovery-section-heading,
.gallery-hub-card__heading,
.discovery-actions,
.discovery-project-card__body,
.gallery-pagination,
.gallery-filter-bar {
    display: flex;
    align-items: center;
}

.workshop-portal__top,
.gallery-hub-card__heading,
.discovery-section-heading {
    justify-content: space-between;
    gap: 16px;
}

.workshop-portal__format,
.discovery-count {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--discovery-gold-soft);
    border-radius: 999px;
    padding: 4px 10px;
    color: var(--discovery-gold);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
}

.workshop-portal__number {
    color: var(--discovery-muted);
    font: 700 .75rem/1 Cinzel, Georgia, serif;
}

.workshop-portal h2 {
    margin: 24px 0 8px;
    color: var(--discovery-title);
    font: 700 1.35rem/1.25 Cinzel, Georgia, serif;
}

.workshop-portal p,
.gallery-hub-card p,
.workshop-scene p,
.gallery-empty-state p {
    color: var(--discovery-muted);
    line-height: 1.65;
}

.workshop-portal__use {
    margin-top: auto;
    padding-top: 16px;
    color: var(--discovery-text);
    font-size: .78rem;
    font-weight: 700;
}

.workshop-portal__tab {
    display: flex;
    min-width: 0;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
}

.workshop-portal__count-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}

.workshop-portal__count-row .workshop-portal__use {
    margin-top: 0;
    padding-top: 0;
}

.workshop-portal__previews {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 18px;
}

.workshop-portal__thumbnail {
    display: grid;
    min-width: 0;
    aspect-ratio: 1 / 1;
    place-items: center;
    overflow: hidden;
    padding: 6px;
    border: 1px solid var(--discovery-border);
    border-radius: 10px;
    background: var(--discovery-surface-soft);
    color: var(--discovery-gold);
    font-weight: 800;
    text-decoration: none;
}

.workshop-portal__thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.workshop-portal__thumbnail > .pd-thumb {
    border-radius: 6px;
}

.workshop-portal__empty-preview {
    margin: 18px 0 0;
    font-size: .78rem;
}

.workshop-portal__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: auto;
    padding-top: 18px;
}

.workshop-portal__actions .discovery-button {
    min-width: 0;
    padding-inline: 10px;
    text-align: center;
}

.workshop-scenes {
    display: grid;
    gap: 28px;
    padding: 48px 0 90px;
}

.workshop-scene {
    min-width: 0;
    scroll-margin-top: 110px;
    border: 1px solid var(--discovery-border);
    border-radius: 24px;
    padding: clamp(22px, 5vw, 42px);
    background: var(--discovery-panel);
}

.workshop-scene[hidden] {
    display: none;
}

.discovery-section-heading {
    align-items: flex-start;
    margin-bottom: 24px;
}

.discovery-section-title {
    font-size: clamp(1.7rem, 4vw, 2.5rem);
}

.discovery-section-copy {
    max-width: 700px;
    margin: 10px 0 0;
}

.discovery-actions {
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.discovery-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 11px;
    padding: 10px 16px;
    font: 700 .9rem/1.25 Inter, system-ui, sans-serif;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.discovery-button--primary {
    background: linear-gradient(135deg, #e3bf86, #c99c62);
    color: #21182b;
}

.discovery-button--secondary {
    border-color: var(--discovery-gold-soft);
    background: var(--discovery-card);
    color: var(--discovery-gold);
}

.discovery-how {
    margin-top: 30px;
    border-left: 2px solid var(--discovery-rose);
    padding-left: 18px;
}

.discovery-how strong {
    display: block;
    margin-bottom: 5px;
    color: var(--discovery-title);
}

.discovery-project-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 28px;
}

.discovery-project-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--discovery-border);
    border-radius: 16px;
    background: var(--discovery-card);
}

.discovery-project-card__preview {
    display: grid;
    aspect-ratio: 4 / 3;
    place-items: center;
    overflow: hidden;
    background: var(--discovery-surface-soft);
}

.discovery-project-card__preview a {
    display: contents;
}

.discovery-project-card__preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.discovery-project-card__preview.is-pixel img {
    object-fit: contain;
    image-rendering: pixelated;
}

.discovery-project-card__placeholder {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border: 1px solid var(--discovery-gold-soft);
    border-radius: 50%;
    color: var(--discovery-gold);
    font: 700 1.4rem/1 Cinzel, Georgia, serif;
}

.discovery-project-card__body {
    min-width: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
    padding: 14px;
}

.discovery-project-card__title {
    width: 100%;
    overflow: hidden;
    color: var(--discovery-title);
    font-size: .9rem;
    font-weight: 700;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.discovery-project-card__traits {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.discovery-project-card__traits span {
    border: 1px solid var(--discovery-gold-soft);
    border-radius: 999px;
    padding: 3px 8px;
    color: var(--discovery-text);
    font-size: .68rem;
    line-height: 1.3;
}

.discovery-project-card__story {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--discovery-muted);
    font-size: .78rem;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.discovery-project-card__meta {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--discovery-muted);
    font-size: .75rem;
}

.discovery-project-card__meta a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    color: var(--discovery-gold);
    font-weight: 700;
    text-decoration: none;
}

.discovery-creator-chip {
    display: inline-flex;
    max-width: 100%;
    min-height: 30px;
    align-items: center;
    gap: 7px;
    color: var(--discovery-muted);
    font-size: .75rem;
    text-decoration: none;
}

a.discovery-creator-chip {
    min-height: 44px;
}

.discovery-creator-chip__avatar {
    display: grid;
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--discovery-rose);
    color: #fff;
    font-size: .68rem;
    font-weight: 800;
}

.discovery-creator-chip__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.discovery-creator-chip__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery-empty-state {
    margin-top: 28px;
    border: 1px dashed var(--discovery-gold-soft);
    border-radius: 18px;
    padding: clamp(28px, 6vw, 54px) 24px;
    background: var(--discovery-card);
    text-align: center;
}

.gallery-empty-state__title {
    margin: 0;
    color: var(--discovery-title) !important;
    font: 700 1.25rem/1.4 Cinzel, Georgia, serif;
}

.gallery-empty-state .discovery-button {
    margin-top: 14px;
}

.clothing-layer-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.clothing-layer-card {
    display: flex;
    min-height: 64px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--discovery-border);
    border-radius: 12px;
    padding: 10px;
    background: var(--discovery-card);
    color: var(--discovery-title);
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.gallery-hub-grid {
    padding-bottom: 90px;
}

.gallery-hub-card {
    padding: 24px;
}

.gallery-hub-card--bar {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(190px, .75fr) minmax(260px, 1.25fr) auto;
    align-items: center;
    gap: 18px 28px;
    padding-block: 18px;
}

.gallery-hub-card--bar > p,
.gallery-hub-card--bar .discovery-actions {
    margin: 0;
}

.gallery-hub-card--bar .discovery-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.gallery-hub-card:nth-child(4),
.gallery-hub-card:nth-child(5) {
    grid-column: span 1;
}

.gallery-hub-card__heading {
    align-items: flex-start;
}

.gallery-hub-card__heading h2 {
    min-width: 0;
    font-size: 1.35rem;
}

.gallery-hub-card .discovery-project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gallery-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 12px;
    scrollbar-width: thin;
}

.gallery-tabs__item {
    display: inline-flex;
    min-height: 44px;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--discovery-border);
    border-radius: 999px;
    padding: 8px 14px;
    color: var(--discovery-muted);
    text-decoration: none;
}

.gallery-tabs__item.is-active {
    border-color: var(--discovery-gold);
    color: var(--discovery-title);
}

.gallery-tabs__count {
    color: var(--discovery-gold);
    font-size: .75rem;
}

.gallery-filter-bar {
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 28px;
}

.gallery-filter-bar__search {
    min-width: min(100%, 280px);
    flex: 1 1 280px;
}

.gallery-filter-bar input,
.gallery-filter-bar select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--discovery-border);
    border-radius: 10px;
    padding: 9px 12px;
    background: var(--discovery-surface);
    color: var(--discovery-text);
    font: inherit;
}

.gallery-pagination {
    justify-content: center;
    gap: 12px;
    margin-top: 34px;
}

.gallery-pagination a,
.gallery-pagination span {
    min-height: 44px;
    padding: 11px 14px;
    color: var(--discovery-muted);
    text-decoration: none;
}

.grimoire-create-menu {
    position: relative;
}

body.grimoire-discovery .grimoire-portal-bar,
body.grimoire-discovery .grimoire-header {
    border-color: var(--discovery-border);
    background: var(--discovery-surface);
    color: var(--discovery-text);
}

body.grimoire-discovery .grimoire-portal-nav a,
body.grimoire-discovery .grimoire-nav a,
body.grimoire-discovery .grimoire-create-menu summary,
body.grimoire-discovery .grimoire-back-shop {
    color: var(--discovery-muted);
}

body.grimoire-discovery .grimoire-portal-nav a:hover,
body.grimoire-discovery .grimoire-nav a:hover,
body.grimoire-discovery .grimoire-create-menu summary:hover {
    background: var(--discovery-rose-soft);
    color: var(--discovery-rose);
}

body.grimoire-discovery .grimoire-portal-nav a.active,
body.grimoire-discovery .grimoire-nav a.active,
body.grimoire-discovery .grimoire-create-menu[open] summary,
body.grimoire-discovery .grimoire-create-menu.is-active summary {
    background: var(--discovery-rose);
    color: #fff;
}

body.grimoire-discovery .grimoire-back-shop {
    border-color: var(--discovery-gold-soft);
    background: var(--discovery-card);
}

body.grimoire-discovery .grimoire-back-shop:hover,
body.grimoire-discovery .grimoire-back-shop:focus-visible,
body.grimoire-discovery .grimoire-skarbonka:hover,
body.grimoire-discovery .grimoire-skarbonka:focus-visible {
    border-color: var(--discovery-gold);
    background: var(--discovery-gold-soft);
    color: var(--discovery-gold);
}

body.grimoire-discovery .grimoire-logo,
body.grimoire-discovery .grimoire-portal-brand,
body.grimoire-discovery .grimoire-user-name {
    color: var(--discovery-gold);
}

.grimoire-nav.grimoire-desktop-nav {
    overflow: visible;
}

.grimoire-create-menu summary {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
    padding: 6px 12px;
    color: #a89bb8;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.grimoire-create-menu summary::-webkit-details-marker {
    display: none;
}

.grimoire-create-menu summary::after {
    content: '';
    width: 6px;
    height: 6px;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
}

.grimoire-create-menu[open] summary,
.grimoire-create-menu summary:hover,
.grimoire-create-menu.is-active summary {
    background: var(--grimoire-accent, #c0397b);
    color: #fff;
}

.grimoire-create-menu__panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 80;
    width: min(280px, calc(100vw - 24px));
    border: 1px solid var(--grimoire-border, #4a3f5c);
    border-radius: 12px;
    padding: 8px;
    background: var(--discovery-surface);
    box-shadow: 0 18px 45px var(--discovery-shadow);
}

.grimoire-nav .grimoire-create-menu__panel a {
    display: flex;
    min-height: 42px;
    align-items: center;
    border-radius: 8px;
    padding: 9px 11px;
}

.grimoire-mobile-toggle {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--discovery-gold-soft);
    border-radius: 9px;
    background: transparent;
    color: var(--discovery-title);
    cursor: pointer;
}

.grimoire-mobile-toggle__lines,
.grimoire-mobile-toggle__lines::before,
.grimoire-mobile-toggle__lines::after {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
}

.grimoire-mobile-toggle__lines {
    position: relative;
}

.grimoire-mobile-toggle__lines::before,
.grimoire-mobile-toggle__lines::after {
    content: '';
    position: absolute;
    left: 0;
}

.grimoire-mobile-toggle__lines::before { top: -6px; }
.grimoire-mobile-toggle__lines::after { top: 6px; }

.grimoire-mobile-panel {
    position: absolute;
    top: 100%;
    right: 8px;
    left: 8px;
    z-index: 75;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    border: 1px solid var(--grimoire-border, #4a3f5c);
    border-radius: 0 0 14px 14px;
    padding: 10px;
    background: var(--discovery-surface);
    box-shadow: 0 20px 42px var(--discovery-shadow);
}

.grimoire-mobile-panel[hidden] {
    display: none;
}

.grimoire-mobile-panel a {
    display: flex;
    min-height: 44px;
    align-items: center;
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--discovery-text);
    font-size: .9rem;
    text-decoration: none;
}

.grimoire-mobile-panel a.active {
    background: var(--grimoire-accent, #c0397b);
    color: #fff;
}

.grimoire-mobile-panel__language {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.grimoire-mobile-panel__language a {
    justify-content: center;
    border: 1px solid var(--discovery-gold-soft);
}

.grimoire-mobile-panel__logout {
    margin: 0;
}

.grimoire-mobile-panel__logout button {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    border: 0;
    border-radius: 8px;
    padding: 10px 12px;
    background: transparent;
    color: var(--discovery-text);
    font-size: .9rem;
    text-align: left;
    cursor: pointer;
}

.grimoire-mobile-panel__logout button:hover,
.grimoire-mobile-panel__logout button:focus-visible {
    background: var(--grimoire-accent, #c0397b);
    color: #fff;
}

.grimoire-mobile-panel__label {
    margin: 8px 12px 3px;
    color: var(--grimoire-gold, #d4a574);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.grimoire-discovery :focus-visible,
.grimoire-header :focus-visible,
.grimoire-mobile-panel :focus-visible {
    outline: 3px solid var(--discovery-focus, #d4a574);
    outline-offset: 3px;
}

@media (max-width: 960px) {
    .workshop-portals,
    .gallery-hub-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .discovery-project-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .gallery-hub-card .discovery-project-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-hub-card--bar {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .gallery-hub-card--bar > p {
        grid-column: 1;
    }

    .gallery-hub-card--bar .discovery-actions {
        grid-column: 2;
        grid-row: 1 / span 2;
    }
}

@media (max-width: 768px) {
    .grimoire-js .grimoire-desktop-nav {
        display: none;
    }

    .grimoire-js .grimoire-mobile-toggle {
        display: inline-flex;
    }

    .grimoire-header {
        min-height: 56px;
        height: auto;
    }

    .grimoire-header-left {
        flex: 1 1 auto;
    }

    .grimoire-discovery [class*="backdrop"],
    .grimoire-discovery .workshop-portal,
    .grimoire-discovery .workshop-scene,
    .grimoire-discovery .gallery-hub-card,
    .grimoire-discovery .discovery-project-card {
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
    }
}

@media (max-width: 640px) {
    .discovery-shell {
        width: min(100% - 24px, 1180px);
    }

    .workshop-portals,
    .gallery-hub-grid,
    .discovery-project-grid,
    .gallery-hub-card .discovery-project-grid,
    .clothing-layer-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .gallery-hub-card--bar {
        display: grid;
        gap: 14px;
    }

    .gallery-hub-card--bar > p,
    .gallery-hub-card--bar .discovery-actions {
        grid-column: 1;
        grid-row: auto;
    }

    .gallery-hub-card--bar .discovery-actions {
        justify-content: flex-start;
    }

    .workshop-portal {
        min-height: 190px;
    }

    .workshop-pixelart-bridge {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 12px;
        padding: 16px;
    }

    .workshop-pixelart-bridge__action {
        grid-column: 1 / -1;
    }

    .workshop-portal__actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .discovery-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .discovery-button {
        width: 100%;
    }

    .gallery-filter-bar > * {
        width: 100%;
    }

    .grimoire-header-right > .grimoire-skarbonka,
    .grimoire-header-right > .lang-switcher,
    .grimoire-header-right > .grimoire-user,
    .grimoire-header-right > .grimoire-logout-form,
    .grimoire-header-right > .grimoire-login-btn {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .workshop-portal,
    .grimoire-create-menu summary {
        transition: none;
    }

    .workshop-portal:hover {
        transform: none;
    }
}
