:root {
    --primary: #ff0070;
    --secondary: #00f5ff;
    --tertiary: #ffb703;
    --light: #e6f7ff;
    --dark: #071026;
    --darker: #030617;
    --success: #52ff9e;
    --warning: #ffd166;
    --danger: #ff5f7a;
    --panel: rgba(7, 16, 38, 0.82);
    --panel-strong: rgba(3, 6, 23, 0.92);
    --panel-soft: rgba(11, 19, 32, 0.68);
    --border: rgba(0, 245, 255, 0.28);
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.community-page {
    margin: 0;
    min-height: 100vh;
    padding-top: 74px;
    font-family: 'Poppins', sans-serif;
    color: var(--light);
    background: linear-gradient(145deg, var(--darker) 0%, var(--dark) 55%, #160d2a 100%);
    overflow-x: hidden;
}

.community-bg-video {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.38;
    filter: brightness(0.95) saturate(1.05);
    z-index: -3;
}

body.community-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(255, 183, 3, 0.16), transparent 24%),
        radial-gradient(circle at bottom left, rgba(0, 245, 255, 0.14), transparent 26%),
        linear-gradient(180deg, rgba(3, 6, 23, 0.2), rgba(3, 6, 23, 0.45));
    z-index: -2;
    pointer-events: none;
}

a {
    color: inherit;
}

button,
input,
textarea,
select {
    font: inherit;
}

#leyla-nav {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: min(1000px, calc(100% - 24px));
    padding: 10px 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(7, 16, 38, 0.92), rgba(11, 19, 32, 0.92));
    border: 2px solid rgba(0, 245, 255, 0.25);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
    z-index: 30;
}

#leyla-nav a,
#leyla-nav button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.04);
    color: var(--light);
    text-decoration: none;
    font-family: 'Space Mono', monospace;
    font-size: 0.92rem;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

#leyla-nav a:hover,
#leyla-nav button:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 245, 255, 0.36);
    background: rgba(0, 245, 255, 0.1);
    box-shadow: 0 8px 20px rgba(0, 245, 255, 0.18);
}

#leyla-nav .nav-active {
    border-color: rgba(255, 183, 3, 0.45);
    background: linear-gradient(135deg, rgba(255, 0, 112, 0.18), rgba(255, 183, 3, 0.18));
    box-shadow: 0 10px 24px rgba(255, 183, 3, 0.12);
}

#leyla-nav .nav-auth-hidden {
    display: none;
}

.community-shell {
    position: relative;
    z-index: 1;
    width: min(1400px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 56px;
}

.hero-panel,
.panel {
    background: linear-gradient(145deg, var(--panel), rgba(10, 18, 32, 0.86));
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(290px, 0.9fr);
    gap: 22px;
    padding: 30px;
    margin-bottom: 22px;
}

.hero-panel.compact {
    grid-template-columns: minmax(0, 1fr) minmax(250px, 0.8fr);
}

.panel {
    padding: 24px;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--secondary);
    font-family: 'Space Mono', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.hero-panel h1,
.panel h2,
.panel h3 {
    margin: 0;
    font-family: 'Space Mono', monospace;
}

.hero-panel h1 {
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.05;
}

.hero-copy,
.section-copy,
.inline-copy {
    margin: 14px 0 0;
    color: rgba(230, 247, 255, 0.86);
    line-height: 1.7;
}

.hero-actions,
.button-row,
.tool-row,
.filter-row,
.stack-row,
.badge-row,
.command-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-actions {
    margin-top: 22px;
}

.action-btn,
.community-btn,
.tool-btn,
.mini-btn,
.file-drop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--light);
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.action-btn:hover,
.community-btn:hover,
.tool-btn:hover,
.mini-btn:hover,
.file-drop:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.action-btn.primary,
.community-btn.primary,
.tool-btn.primary {
    background: linear-gradient(135deg, var(--primary), #ff5a8a);
    color: white;
}

.action-btn.secondary,
.community-btn.secondary,
.tool-btn.secondary {
    background: linear-gradient(135deg, rgba(0, 245, 255, 0.18), rgba(0, 140, 204, 0.18));
    border-color: rgba(0, 245, 255, 0.3);
}

.action-btn.gold,
.community-btn.gold,
.tool-btn.gold {
    background: linear-gradient(135deg, rgba(255, 183, 3, 0.24), rgba(255, 102, 0, 0.2));
    border-color: rgba(255, 183, 3, 0.34);
}

.action-btn.ghost,
.community-btn.ghost,
.tool-btn.ghost {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.tool-btn.danger,
.community-btn.danger,
.mini-btn.danger {
    background: rgba(255, 95, 122, 0.12);
    border-color: rgba(255, 95, 122, 0.3);
}

.tool-btn.active,
.mini-btn.active,
.asset-choice.active {
    border-color: rgba(255, 183, 3, 0.55);
    background: linear-gradient(135deg, rgba(255, 183, 3, 0.14), rgba(255, 0, 112, 0.12));
    box-shadow: 0 0 0 1px rgba(255, 183, 3, 0.2), 0 16px 32px rgba(255, 183, 3, 0.08);
}

.panel-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-topline,
.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

.section-topline p,
.panel-heading p {
    margin: 8px 0 0;
    color: rgba(230, 247, 255, 0.74);
    line-height: 1.5;
}

.status-pill,
.stat-pill,
.difficulty-badge,
.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--light);
    font-size: 0.88rem;
    font-family: 'Space Mono', monospace;
}

.status-pill.success,
.tag-pill.success {
    background: rgba(82, 255, 158, 0.12);
    border-color: rgba(82, 255, 158, 0.34);
}

.status-pill.warning,
.tag-pill.warning {
    background: rgba(255, 209, 102, 0.12);
    border-color: rgba(255, 209, 102, 0.34);
}

.status-pill.danger,
.tag-pill.danger {
    background: rgba(255, 95, 122, 0.12);
    border-color: rgba(255, 95, 122, 0.34);
}

.difficulty-rookie {
    background: rgba(82, 255, 158, 0.12);
    border-color: rgba(82, 255, 158, 0.34);
}

.difficulty-deckhand {
    background: rgba(0, 245, 255, 0.12);
    border-color: rgba(0, 245, 255, 0.32);
}

.difficulty-captain {
    background: rgba(255, 183, 3, 0.16);
    border-color: rgba(255, 183, 3, 0.35);
}

.difficulty-legend {
    background: rgba(255, 0, 112, 0.16);
    border-color: rgba(255, 0, 112, 0.34);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.kpi-card {
    padding: 16px;
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.kpi-card strong {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 1.5rem;
    margin-top: 8px;
}

.kpi-card span {
    color: rgba(230, 247, 255, 0.7);
    font-size: 0.88rem;
}

.community-card-grid,
.related-level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.community-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.community-card-cover {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 170px;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(0, 245, 255, 0.18), transparent 34%),
        radial-gradient(circle at bottom right, rgba(255, 183, 3, 0.18), transparent 34%),
        linear-gradient(180deg, rgba(3, 6, 23, 0.3), rgba(3, 6, 23, 0.7));
}

.community-card-cover img {
    width: min(120px, 52%);
    height: auto;
    max-height: 120px;
    object-fit: contain;
    filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.28));
}

.cover-fallback {
    font-size: 3rem;
}

.community-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
}

.community-card-body h3 {
    font-size: 1.15rem;
}

.card-copy {
    margin: 0;
    color: rgba(230, 247, 255, 0.76);
    line-height: 1.55;
}

.card-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.metric-box {
    padding: 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    text-align: center;
}

.metric-box strong {
    display: block;
    font-family: 'Space Mono', monospace;
    margin-top: 4px;
}

.card-footer,
.mini-list,
.mini-list-card,
.asset-library {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mini-item,
.asset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.mini-item strong,
.asset-item strong {
    display: block;
    margin-bottom: 4px;
}

.mini-item p,
.asset-item p {
    margin: 0;
    color: rgba(230, 247, 255, 0.7);
    font-size: 0.9rem;
}

.creator-layout,
.player-layout {
    display: grid;
    gap: 20px;
}

.creator-layout {
    grid-template-columns: minmax(320px, 360px) minmax(0, 1fr) minmax(280px, 320px);
}

.player-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.8fr);
}

.sidebar {
    align-self: start;
}

.field-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-group label,
.field-caption {
    color: rgba(230, 247, 255, 0.8);
    font-size: 0.92rem;
}

.field-group input,
.field-group textarea,
.field-group select,
.filter-row input,
.filter-row select,
.inline-input {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(3, 6, 23, 0.66);
    color: var(--light);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field-group textarea {
    min-height: 120px;
    resize: vertical;
}

.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus,
.filter-row input:focus,
.filter-row select:focus,
.inline-input:focus,
.code-editor:focus {
    border-color: rgba(0, 245, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(0, 245, 255, 0.12);
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.asset-palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.asset-choice {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
    padding: 12px;
    min-height: 120px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.04);
    color: var(--light);
    cursor: pointer;
}

.asset-choice img,
.asset-thumb {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.asset-choice small,
.asset-item small,
.meta-subtle {
    color: rgba(230, 247, 255, 0.66);
    font-size: 0.82rem;
}

.editor-grid {
    display: grid;
    gap: 8px;
    padding: 14px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(3, 6, 23, 0.92), rgba(7, 16, 38, 0.85));
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.grid-cell {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background:
        linear-gradient(145deg, rgba(8, 18, 32, 0.95), rgba(10, 20, 38, 0.7));
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.grid-cell:hover {
    transform: translateY(-1px) scale(1.01);
    border-color: rgba(0, 245, 255, 0.32);
}

.grid-cell .cell-coord {
    position: absolute;
    top: 6px;
    left: 8px;
    color: rgba(230, 247, 255, 0.34);
    font-size: 0.68rem;
    font-family: 'Space Mono', monospace;
}

.grid-cell .cell-icon {
    width: 68%;
    height: 68%;
    object-fit: contain;
    filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.25));
}

.grid-cell .cell-badge {
    position: absolute;
    right: 6px;
    bottom: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 24px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(3, 6, 23, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.72rem;
    font-family: 'Space Mono', monospace;
}

.grid-cell.start-cell {
    border-color: rgba(82, 255, 158, 0.3);
    background: linear-gradient(145deg, rgba(82, 255, 158, 0.06), rgba(8, 18, 32, 0.94));
}

.grid-cell.goal-cell {
    border-color: rgba(255, 183, 3, 0.34);
    background: linear-gradient(145deg, rgba(255, 183, 3, 0.08), rgba(8, 18, 32, 0.94));
}

.helper-note,
.inline-note,
.hint-strip {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(230, 247, 255, 0.78);
    line-height: 1.55;
}

.checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.checklist li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.checklist li.ok {
    border-color: rgba(82, 255, 158, 0.3);
}

.upload-card {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.file-drop {
    width: 100%;
    min-height: 52px;
    border: 1px dashed rgba(0, 245, 255, 0.32);
    background: rgba(0, 245, 255, 0.05);
}

.file-drop input {
    display: none;
}

.game-panel canvas {
    width: 100%;
    max-width: 720px;
    display: block;
    margin: 0 auto;
    border-radius: 24px;
    border: 2px solid rgba(255, 183, 3, 0.28);
    background: linear-gradient(180deg, rgba(3, 6, 23, 0.96), rgba(7, 16, 38, 0.92));
    box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.04), 0 18px 42px rgba(0, 0, 0, 0.28);
}

.code-editor {
    width: 100%;
    min-height: 340px;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(3, 6, 23, 0.84);
    color: #d2f9ff;
    font-family: 'Space Mono', monospace;
    line-height: 1.7;
    resize: vertical;
}

.feedback-banner,
.result-card,
.empty-state,
.locked-panel {
    margin-top: 16px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.feedback-banner.info {
    border-color: rgba(0, 245, 255, 0.24);
}

.feedback-banner.success,
.result-card.success {
    border-color: rgba(82, 255, 158, 0.32);
    background: rgba(82, 255, 158, 0.08);
}

.feedback-banner.warning,
.result-card.warning {
    border-color: rgba(255, 209, 102, 0.32);
    background: rgba(255, 209, 102, 0.08);
}

.feedback-banner.danger,
.result-card.danger {
    border-color: rgba(255, 95, 122, 0.32);
    background: rgba(255, 95, 122, 0.08);
}

.command-chip-row {
    margin-top: 16px;
}

.command-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    font-family: 'Space Mono', monospace;
    font-size: 0.84rem;
}

.community-toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    max-width: min(360px, calc(100% - 32px));
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(3, 6, 23, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.32);
    z-index: 60;
}

.community-toast.success {
    border-color: rgba(82, 255, 158, 0.32);
}

.community-toast.warning {
    border-color: rgba(255, 209, 102, 0.32);
}

.community-toast.danger {
    border-color: rgba(255, 95, 122, 0.32);
}

.community-toast[hidden] {
    display: none;
}

.empty-state h2,
.locked-panel h2 {
    margin-bottom: 10px;
}

.hidden {
    display: none !important;
}

@media (max-width: 1180px) {
    .creator-layout {
        grid-template-columns: 1fr;
    }

    .player-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .hero-panel,
    .hero-panel.compact {
        grid-template-columns: 1fr;
        padding: 22px;
    }

    .community-shell {
        width: min(100% - 20px, 1400px);
    }

    .field-grid,
    .kpi-grid,
    .card-metrics {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    body.community-page {
        padding-top: 84px;
    }

    #leyla-nav {
        top: 8px;
        width: calc(100% - 16px);
        gap: 8px;
        padding: 8px 10px;
    }

    #leyla-nav a,
    #leyla-nav button {
        flex: 1 1 calc(50% - 8px);
        font-size: 0.8rem;
        min-height: 40px;
        padding: 8px 10px;
    }

    .panel,
    .hero-panel {
        padding: 18px;
        border-radius: 20px;
    }

    .asset-palette {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .editor-grid {
        gap: 6px;
        padding: 10px;
    }

    .field-grid,
    .kpi-grid,
    .card-metrics {
        grid-template-columns: 1fr;
    }
}