:root {
    --community-bg: color-mix(in srgb, var(--shell-bg) 88%, var(--shell-accent) 12%);
    --community-surface: var(--shell-panel);
    --community-surface-soft: var(--shell-bg-soft);
    --community-text: var(--shell-text);
    --community-muted: var(--shell-text-soft);
    --community-border: var(--shell-line);
    --community-primary: var(--shell-accent-strong);
    --community-primary-soft: var(--shell-accent-soft);
    --community-card-shadow: 0 18px 45px rgba(33, 34, 55, 0.10);
}

:root[data-theme="dark"] {
    --community-bg: #080b16;
    --community-surface: #111827;
    --community-surface-soft: #172033;
    --community-text: #f4f6ff;
    --community-muted: #aab0c5;
    --community-border: rgba(190, 198, 255, 0.14);
    --community-primary: #8b7cff;
    --community-primary-soft: rgba(139, 124, 255, 0.16);
    --community-card-shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
}

.shell-app.is-community-view .shell-panel {
    padding: 0;
    overflow: hidden;
    background: var(--community-bg);
}

.community-view {
    display: grid;
    gap: 18px;
    min-height: calc(100vh - var(--shell-header-height) - 22px);
    padding: 22px;
    color: var(--community-text);
}

.community-header,
.community-searchbar,
.community-section__titlebar,
.community-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.community-header h1,
.community-results-header h2,
.community-section h2,
.community-aside h2 {
    margin: 0;
    letter-spacing: 0;
}

.community-header h1 {
    font-size: clamp(1.55rem, 2vw, 2.15rem);
}

.community-header p,
.community-results-header p,
.community-card p,
.community-poster p {
    margin: 6px 0 0;
    color: var(--community-muted);
}

.community-header__eyebrow {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--community-primary);
}

.community-header__create {
    flex: 0 0 auto;
}

.community-searchbar {
    padding: 10px;
    border: 1px solid var(--community-border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--community-surface) 88%, transparent);
    box-shadow: var(--community-card-shadow);
}

.community-searchbar__field {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 12px;
    background: var(--community-surface-soft);
    color: var(--community-muted);
}

.community-searchbar__field svg {
    width: 18px;
    height: 18px;
}

.community-searchbar input,
.community-searchbar select {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--community-text);
    font: inherit;
}

.community-searchbar__sort {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--community-border);
    border-radius: 12px;
    background: var(--community-surface);
    color: var(--community-muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.community-searchbar__sort select {
    min-width: 112px;
    color: var(--community-text);
    font-weight: 700;
}

.community-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
}

.community-filter,
.community-hero__cta,
.community-hero__arrow,
.community-hero__dot,
.community-save {
    border: 1px solid var(--community-border);
    color: var(--community-text);
    font: inherit;
    cursor: pointer;
}

.community-filter {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--community-surface);
    font-size: 0.86rem;
    font-weight: 800;
}

.community-filter.is-active,
.community-filter:hover {
    border-color: var(--community-primary);
    background: var(--community-primary);
    color: var(--shell-accent-text);
}

.community-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 300px);
    gap: 18px;
    align-items: start;
}

.community-main {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.community-hero {
    position: relative;
    min-height: 360px;
    overflow: hidden;
    border: 1px solid var(--community-border);
    border-radius: 22px;
    background: #111827;
    box-shadow: var(--community-card-shadow);
}

.community-hero__slides,
.community-hero__slide {
    position: absolute;
    inset: 0;
}

.community-hero__slide {
    display: flex;
    align-items: end;
    padding: 34px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 900ms ease;
}

.community-hero__slide.is-active {
    opacity: 1;
    pointer-events: auto;
}

.community-hero__slide::before,
.community-cover::before,
.community-compact-item__thumb::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.34), transparent 18%),
        radial-gradient(circle at 78% 24%, rgba(255, 255, 255, 0.18), transparent 16%),
        linear-gradient(135deg, transparent 0 38%, rgba(255, 255, 255, 0.10) 38% 40%, transparent 40% 100%);
    mix-blend-mode: screen;
    opacity: 0.72;
}

.community-hero__slide::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(2, 6, 23, 0.88), rgba(2, 6, 23, 0.48) 48%, rgba(2, 6, 23, 0.12));
}

.community-hero__content {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 12px;
    max-width: 680px;
    color: #fff;
}

.community-hero__content h2 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 4.4rem);
    line-height: 0.98;
    letter-spacing: 0;
}

.community-hero__content p {
    margin: 0;
    max-width: 620px;
    color: rgba(255, 255, 255, 0.84);
    font-size: 1.02rem;
    line-height: 1.55;
}

.community-hero__tags,
.community-card__tags,
.community-card__metrics,
.community-hero__metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.community-hero__tags span,
.community-card__tags span {
    padding: 5px 9px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
}

.community-hero__access {
    font-weight: 800;
}

.community-hero__metrics {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.83rem;
}

.community-hero__metrics span:not(:last-child)::after {
    content: "/";
    margin-left: 8px;
    opacity: 0.5;
}

.community-hero__cta {
    justify-self: start;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.92);
    color: #111827;
    font-weight: 900;
}

.community-hero__arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.62);
    color: #fff;
    transform: translateY(-50%);
}

.community-hero__arrow--prev {
    left: 14px;
}

.community-hero__arrow--next {
    right: 14px;
}

.community-hero__arrow svg {
    width: 20px;
    height: 20px;
}

.community-hero__dots {
    position: absolute;
    right: 22px;
    bottom: 20px;
    z-index: 2;
    display: flex;
    gap: 8px;
}

.community-hero__dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.45);
}

.community-hero__dot.is-active {
    width: 28px;
    background: #fff;
}

.community-section {
    display: grid;
    gap: 12px;
}

.community-section__titlebar h2,
.community-aside h2,
.community-results-header h2 {
    font-size: 1.05rem;
}

.community-section__titlebar span {
    color: var(--community-muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.community-ticker {
    overflow: hidden;
    padding: 2px;
}

.community-ticker__track {
    display: flex;
    gap: 14px;
    width: max-content;
    animation: communityTicker 96s linear infinite;
}

.community-ticker:hover .community-ticker__track,
.community-ticker:focus-within .community-ticker__track {
    animation-play-state: paused;
}

.community-poster,
.community-card {
    min-width: 0;
    cursor: pointer;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.community-poster {
    flex: 0 0 290px;
    height: 330px;
}

.community-cover {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--community-border);
    background: #263044;
}

button.community-cover {
    width: 100%;
    padding: 0;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.community-cover__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.88;
}

.community-poster__cover {
    display: flex;
    height: 100%;
    align-items: end;
    border-radius: 18px;
    box-shadow: var(--community-card-shadow);
}

.community-poster__cover::after,
.community-card__cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(2, 6, 23, 0.02), rgba(2, 6, 23, 0.78));
}

.community-poster__body {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 8px;
    width: 100%;
    padding: 16px;
    color: #fff;
}

.community-poster h3,
.community-card h3 {
    margin: 0;
    letter-spacing: 0;
}

.community-poster h3 {
    font-size: 1.32rem;
}

.community-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.community-card {
    overflow: hidden;
    border: 1px solid var(--community-border);
    border-radius: 16px;
    background: var(--community-surface);
    box-shadow: var(--community-card-shadow);
}

.community-poster:hover,
.community-poster:focus-visible,
.community-card:hover,
.community-card:focus-visible {
    border-color: color-mix(in srgb, var(--community-primary) 54%, var(--community-border));
    transform: translateY(-2px);
}

.community-card__cover {
    min-height: 160px;
    border-width: 0 0 1px;
    border-radius: 0;
}

.community-card__body {
    display: grid;
    gap: 10px;
    padding: 14px;
}

.community-card__topline,
.community-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.community-card__topline {
    color: var(--community-muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.community-card p {
    display: -webkit-box;
    min-height: 3.9em;
    overflow: hidden;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.community-card__tags span {
    border-color: var(--community-border);
    background: var(--community-primary-soft);
    color: var(--community-text);
}

.community-card__metrics {
    justify-content: flex-end;
    color: var(--community-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.community-card__link {
    border: 0;
    background: transparent;
    color: var(--community-primary);
    cursor: pointer;
    font: inherit;
    font-weight: 850;
}

.community-card__actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.community-card__link:disabled,
.community-hero__cta:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.community-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 24px;
    padding: 4px 8px;
    border: 1px solid color-mix(in srgb, var(--community-primary) 42%, transparent);
    border-radius: 999px;
    background: var(--community-primary-soft);
    color: var(--community-primary);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.community-badge--featured {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.community-badge--small {
    min-height: 20px;
    padding: 2px 6px;
    font-size: 0.66rem;
}

.community-save {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.58);
    color: #fff;
}

.community-save svg {
    width: 17px;
    height: 17px;
}

.community-load-more {
    display: flex;
    justify-content: center;
    padding-top: 4px;
}

.community-aside {
    position: sticky;
    top: 78px;
    display: grid;
    gap: 14px;
}

.community-aside__panel,
.community-results-header,
.community-empty {
    border: 1px solid var(--community-border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--community-surface) 92%, transparent);
    box-shadow: var(--community-card-shadow);
}

.community-aside__panel {
    display: grid;
    gap: 12px;
    padding: 14px;
}

.community-compact-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.community-compact-item {
    display: grid;
    grid-template-columns: 20px 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.community-compact-item__rank {
    color: var(--community-muted);
    font-weight: 900;
}

.community-compact-item__thumb {
    position: relative;
    display: block;
    width: 42px;
    height: 42px;
    overflow: hidden;
    border: 1px solid var(--community-border);
    border-radius: 10px;
    background: #263044;
}

.community-compact-item__body {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.community-compact-item strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.community-compact-item small {
    color: var(--community-muted);
}

.community-results-header,
.community-empty {
    padding: 18px;
}

.community-empty h3 {
    margin: 0 0 6px;
}

.community-empty p {
    margin: 0;
    color: var(--community-muted);
}

.community-empty--error {
    border-color: color-mix(in srgb, #fb7185 36%, var(--community-border));
}

.community-detail {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(2, 6, 23, 0.68);
    backdrop-filter: blur(10px);
}

.community-detail__modal {
    position: relative;
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
    width: min(860px, calc(100vw - 36px));
    max-height: calc(100vh - 36px);
    overflow: auto;
    border: 1px solid var(--community-border);
    border-radius: 18px;
    background: var(--community-surface);
    box-shadow: var(--community-card-shadow);
}

.community-detail__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--community-border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--community-surface) 86%, transparent);
    color: var(--community-text);
    cursor: pointer;
}

.community-detail__cover {
    position: relative;
    min-height: 420px;
    overflow: hidden;
}

.community-detail__body {
    display: grid;
    gap: 14px;
    align-content: center;
    padding: 34px;
}

.community-detail__body h2,
.community-detail__body p,
.community-detail__stats {
    margin: 0;
}

.community-detail__body h2 {
    font-size: clamp(1.6rem, 3vw, 2.5rem);
}

.community-detail__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.community-detail__stats div {
    padding: 12px;
    border: 1px solid var(--community-border);
    border-radius: 12px;
    background: var(--community-surface-soft);
}

.community-detail__stats dt {
    color: var(--community-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.community-detail__stats dd {
    margin: 4px 0 0;
    color: var(--community-text);
    font-size: 1.25rem;
    font-weight: 850;
}

.community-detail__note,
.community-detail__meta {
    color: var(--community-muted);
}

.community-detail__meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    font-weight: 720;
}

.community-card:focus-visible,
.community-poster:focus-visible,
.community-filter:focus-visible,
.community-hero__cta:focus-visible,
.community-hero__arrow:focus-visible,
.community-hero__dot:focus-visible,
.community-save:focus-visible,
.community-searchbar input:focus-visible,
.community-searchbar select:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--community-primary) 28%, transparent);
    outline-offset: 3px;
}

.cover-ash-kingdom {
    background:
        linear-gradient(150deg, rgba(15, 23, 42, 0.04), rgba(88, 28, 135, 0.18)),
        radial-gradient(circle at 52% 28%, #f59e0b 0 8%, transparent 9%),
        linear-gradient(135deg, #1f2937 0%, #581c1c 48%, #111827 100%);
}

.cover-mechanical-forest {
    background:
        repeating-linear-gradient(90deg, rgba(125, 211, 252, 0.16) 0 2px, transparent 2px 18px),
        linear-gradient(135deg, #064e3b 0%, #0f766e 48%, #172554 100%);
}

.cover-last-joke {
    background:
        radial-gradient(circle at 28% 30%, #fde68a 0 12%, transparent 13%),
        radial-gradient(circle at 72% 20%, #f0abfc 0 10%, transparent 11%),
        linear-gradient(135deg, #7c2d12 0%, #7e22ce 54%, #312e81 100%);
}

.cover-cardboard-night {
    background:
        linear-gradient(90deg, rgba(250, 204, 21, 0.08) 0 12%, transparent 12% 100%),
        radial-gradient(circle at 74% 18%, #e5e7eb 0 6%, transparent 7%),
        linear-gradient(135deg, #0f172a 0%, #3f1d2e 58%, #080808 100%);
}

.cover-lost-orbit {
    background:
        radial-gradient(circle at 68% 28%, #e0f2fe 0 7%, transparent 8%),
        radial-gradient(circle at 35% 60%, rgba(59, 130, 246, 0.55) 0 16%, transparent 17%),
        linear-gradient(135deg, #020617 0%, #1d4ed8 45%, #581c87 100%);
}

.cover-solaris {
    background:
        radial-gradient(circle at 24% 24%, #fde047 0 16%, transparent 17%),
        linear-gradient(135deg, #06b6d4 0%, #22c55e 48%, #f97316 100%);
}

.cover-mist-archive {
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.13) 0 1px, transparent 1px 16px),
        linear-gradient(135deg, #334155 0%, #64748b 50%, #1e293b 100%);
}

.cover-omega-alley {
    background:
        linear-gradient(90deg, rgba(34, 211, 238, 0.34) 0 2px, transparent 2px 18px),
        linear-gradient(135deg, #111827 0%, #be185d 48%, #0891b2 100%);
}

.cover-bestiary {
    background:
        radial-gradient(circle at 50% 44%, rgba(120, 53, 15, 0.32) 0 18%, transparent 19%),
        linear-gradient(135deg, #f5e1a4 0%, #b45309 54%, #422006 100%);
}

.cover-infinite-fog {
    background:
        radial-gradient(circle at 30% 72%, rgba(255, 255, 255, 0.30) 0 18%, transparent 19%),
        linear-gradient(135deg, #0f766e 0%, #155e75 52%, #172554 100%);
}

.cover-shadow-codex {
    background:
        repeating-linear-gradient(135deg, rgba(196, 181, 253, 0.15) 0 3px, transparent 3px 18px),
        linear-gradient(135deg, #1e1b4b 0%, #4c1d95 48%, #111827 100%);
}

.cover-elaria {
    background:
        radial-gradient(circle at 72% 32%, #fef08a 0 10%, transparent 11%),
        linear-gradient(135deg, #38bdf8 0%, #a7f3d0 45%, #a78bfa 100%);
}

.cover-paradox-hotel {
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.13) 0 10px, transparent 10px 20px),
        linear-gradient(135deg, #7f1d1d 0%, #4338ca 54%, #111827 100%);
}

.cover-tide-city {
    background:
        linear-gradient(0deg, rgba(14, 165, 233, 0.42) 0 34%, transparent 35%),
        linear-gradient(135deg, #0f172a 0%, #0e7490 48%, #94a3b8 100%);
}

.cover-mime-lab {
    background:
        radial-gradient(circle at 70% 28%, #fb7185 0 10%, transparent 11%),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.16) 0 8px, transparent 8px 16px),
        linear-gradient(135deg, #0f172a 0%, #9333ea 52%, #f97316 100%);
}

.cover-echo-sanctuary {
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.28) 0 14%, transparent 15%),
        linear-gradient(135deg, #164e63 0%, #7c3aed 48%, #312e81 100%);
}

@keyframes communityTicker {
    from {
        transform: translate3d(0, 0, 0);
    }

    to {
        transform: translate3d(-50%, 0, 0);
    }
}

@media (min-width: 1500px) {
    .community-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1180px) {
    .community-layout {
        grid-template-columns: 1fr;
    }

    .community-aside {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .community-view {
        padding: 16px;
    }

    .community-header,
    .community-searchbar,
    .community-results-header {
        align-items: stretch;
        flex-direction: column;
    }

    .community-header__create {
        width: 100%;
        justify-content: center;
    }

    .community-searchbar__sort {
        width: 100%;
        justify-content: space-between;
    }

    .community-hero {
        min-height: 300px;
    }

    .community-hero__slide {
        padding: 24px;
    }

    .community-grid,
    .community-aside {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .community-view {
        padding: 12px;
    }

    .community-hero {
        min-height: 270px;
        border-radius: 16px;
    }

    .community-hero__content {
        gap: 8px;
    }

    .community-hero__content p,
    .community-hero__metrics {
        display: none;
    }

    .community-hero__arrow {
        top: auto;
        bottom: 14px;
        transform: none;
    }

    .community-hero__dots {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    .community-poster {
        flex-basis: 250px;
        height: 300px;
    }

    .community-grid,
    .community-aside {
        grid-template-columns: 1fr;
    }

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

    .community-detail__cover {
        min-height: 260px;
    }

    .community-card__footer {
        align-items: start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .community-hero__slide {
        transition: none;
    }

    .community-ticker__track {
        animation: none;
    }
}
