* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0f1117;
    --panel: #181c25;
    --panel-soft: #212735;
    --panel-border: rgba(255, 255, 255, 0.08);
    --text: #eef2ff;
    --muted: #a1abc3;
    --accent: #43a8ff;
    --accent-strong: #1e7cf2;
    --accent-soft: rgba(67, 168, 255, 0.12);
    --danger: #ff6f61;
    --success: #5ccc8b;
    --warning: #ffca5c;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.32);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(67, 168, 255, 0.2), transparent 35%),
        radial-gradient(circle at top right, rgba(92, 204, 139, 0.12), transparent 30%),
        linear-gradient(180deg, #0d1017 0%, #151b24 100%);
    color: var(--text);
    min-height: 100vh;
}

body.light-mode {
    --bg: #eef3fa;
    --panel: rgba(255, 255, 255, 0.86);
    --panel-soft: rgba(248, 250, 255, 0.96);
    --panel-border: rgba(18, 32, 66, 0.08);
    --text: #162033;
    --muted: #60708d;
    --accent-soft: rgba(67, 168, 255, 0.1);
    --shadow: 0 24px 70px rgba(26, 39, 68, 0.12);
    background:
        radial-gradient(circle at top left, rgba(76, 152, 255, 0.14), transparent 35%),
        radial-gradient(circle at top right, rgba(92, 204, 139, 0.12), transparent 28%),
        linear-gradient(180deg, #f2f6fb 0%, #e7edf6 100%);
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

.site-header,
.site-footer {
    width: min(1240px, calc(100% - 2rem));
    margin: 0 auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 0 1rem;
}

.brand {
    text-decoration: none;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.top-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    flex: 1 1 420px;
    justify-content: flex-end;
    gap: 1rem;
}

.top-nav a {
    text-decoration: none;
    color: var(--muted);
    font-weight: 700;
}

.top-nav a:hover,
.text-link:hover {
    color: var(--accent);
}

.nav-hidden {
    display: none;
}

.mode-toggle,
.btn {
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease, background-color 0.15s ease;
}

.mode-toggle {
    padding: 0.75rem 1rem;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
    margin-left: auto;
}

.mode-toggle:hover,
.btn:hover {
    transform: translateY(-1px);
    opacity: 0.96;
}

.announcement-banner {
    width: min(1240px, calc(100% - 2rem));
    margin: 0 auto 1rem;
    padding: 1rem 1.2rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(67, 168, 255, 0.18), rgba(92, 204, 139, 0.1));
    border: 1px solid rgba(67, 168, 255, 0.18);
    color: var(--text);
    box-shadow: var(--shadow);
}

.announcement-banner a {
    color: var(--accent);
    font-weight: 700;
}

.page-shell {
    width: min(1040px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1rem 0 4rem;
}

.page-shell-wide {
    width: min(1240px, calc(100% - 2rem));
}

.auth-card {
    max-width: 520px;
    margin: 0 auto;
}

.hero-card,
.page-intro,
.panel,
.project-side-card,
.auth-card,
.policy-card {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.hero-card,
.page-intro,
.panel,
.project-side-card,
.auth-card,
.policy-card {
    padding: 1.6rem;
}

.hero-card {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
    gap: 1.5rem;
    align-items: stretch;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    justify-content: center;
}

.hero-copy h1,
.page-intro h1,
.policy-card h1,
.auth-card h1,
.project-hero h1,
.profile-hero h1 {
    font-size: clamp(2.2rem, 4vw, 4.2rem);
    line-height: 0.98;
}

.hero-text,
.page-intro p:last-child,
.policy-card > p:nth-of-type(2) {
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.hero-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.stat-card,
.panel-soft,
.user-card,
.notification-item,
.audit-item,
.report-card,
.storage-row,
.upload-card,
.project-mini-card,
.comment-item {
    background: var(--panel-soft);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
}

.stat-card {
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-card span,
.meta-line,
.helper-text,
.info-row span,
.upload-card p,
.notification-time {
    color: var(--muted);
}

.stat-card strong {
    font-size: 2rem;
}

.eyebrow,
.card-kicker {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.button-row,
.section-header,
.tab-row,
.profile-hero-body,
.user-card-header,
.comment-item-header,
.profile-mini,
.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: center;
}

.section-header {
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.section-panel {
    margin-top: 1.5rem;
}

.home-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
}

.project-card {
    padding: 1.3rem;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    display: grid;
    gap: 0.9rem;
}

.project-card h2,
.panel h2,
.policy-card h2,
.project-side-card h2 {
    font-size: 1.15rem;
}

.project-card p {
    line-height: 1.65;
}

.project-card-footer,
.card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.card-stat {
    padding: 0.45rem 0.65rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 700;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-chip,
.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

.tag-chip,
.status-chip-muted {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--panel-border);
}

body.light-mode .tag-chip,
body.light-mode .status-chip-muted {
    background: rgba(18, 32, 66, 0.05);
}

.status-chip {
    background: var(--accent-soft);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--panel-border);
}

.info-row strong {
    text-align: right;
}

.status-chip-danger {
    background: rgba(255, 111, 97, 0.15);
}

.text-link {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.8rem 1.2rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text);
}

.btn-danger {
    background: linear-gradient(135deg, #ff7d6a, #ef4444);
}

.btn-block {
    width: 100%;
}

.page-intro {
    display: grid;
    gap: 0.8rem;
}

.project-hero,
.profile-hero {
    display: grid;
    gap: 1rem;
}

.project-hero {
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
    align-items: start;
}

.project-hero-main {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.6rem;
    display: grid;
    gap: 1rem;
}

.project-side-card .info-row:last-child,
.panel .info-row:last-child {
    margin-bottom: 0;
}

.profile-banner-shell {
    min-height: 220px;
    border-radius: var(--radius-lg);
    background:
        linear-gradient(135deg, rgba(67, 168, 255, 0.18), transparent),
        linear-gradient(225deg, rgba(92, 204, 139, 0.12), transparent),
        var(--panel);
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.banner-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.profile-hero-body {
    margin-top: -60px;
    padding: 0 1.5rem 0 1.5rem;
    align-items: flex-end;
}

.profile-hero-copy {
    display: grid;
    gap: 0.75rem;
}

.avatar {
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--panel);
    background: var(--panel-soft);
}

.avatar-lg {
    width: 132px;
    height: 132px;
}

.avatar-sm {
    width: 52px;
    height: 52px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    align-items: start;
    margin-top: 1.5rem;
}

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

.stack-form,
.stack-list,
.policy-card,
.tab-panel,
.comment-form {
    display: grid;
    gap: 0.9rem;
}

.project-editor-shell {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.editor-sidebar,
.editor-main,
.editor-section,
.compact-list,
.external-dialog form {
    display: grid;
    gap: 1rem;
}

.editor-sidebar {
    position: sticky;
    top: 1rem;
}

.compact-header {
    margin-bottom: 0.25rem;
}

.spaced-section {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.stack-form {
    margin-top: 1rem;
}

.captcha-shell {
    display: grid;
    gap: 0.65rem;
}

.captcha-slot {
    min-height: 78px;
}

.stack-label {
    display: grid;
    gap: 0.45rem;
    font-weight: 600;
}

.stack-form label {
    font-weight: 700;
}

.stack-form input,
.stack-form textarea,
.stack-form select,
.project-editor-shell input,
.project-editor-shell textarea,
.project-editor-shell select,
.filter-grid input,
.filter-grid select {
    width: 100%;
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.stack-form input[type="file"],
.project-editor-shell input[type="file"] {
    padding: 0.7rem 0.75rem;
    border-style: dashed;
    background:
        linear-gradient(135deg, rgba(67, 168, 255, 0.08), transparent 60%),
        rgba(255, 255, 255, 0.02);
}

body.light-mode .stack-form input,
body.light-mode .stack-form textarea,
body.light-mode .stack-form select,
body.light-mode .project-editor-shell input,
body.light-mode .project-editor-shell textarea,
body.light-mode .project-editor-shell select,
body.light-mode .filter-grid input,
body.light-mode .filter-grid select {
    background: rgba(255, 255, 255, 0.92);
}

body.light-mode .stack-form input[type="file"],
body.light-mode .project-editor-shell input[type="file"] {
    background:
        linear-gradient(135deg, rgba(67, 168, 255, 0.08), transparent 60%),
        rgba(255, 255, 255, 0.86);
}

.stack-form input::placeholder,
.stack-form textarea::placeholder,
.project-editor-shell input::placeholder,
.project-editor-shell textarea::placeholder,
.filter-grid input::placeholder {
    color: var(--muted);
}

.stack-form input:focus,
.stack-form textarea:focus,
.stack-form select:focus,
.project-editor-shell input:focus,
.project-editor-shell textarea:focus,
.project-editor-shell select:focus,
.filter-grid input:focus,
.filter-grid select:focus {
    border-color: rgba(67, 168, 255, 0.45);
    box-shadow: 0 0 0 4px rgba(67, 168, 255, 0.12);
}

.stack-form input[type="file"]::file-selector-button,
.project-editor-shell input[type="file"]::file-selector-button {
    margin-right: 0.9rem;
    padding: 0.7rem 1rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.stack-form input[type="file"]::file-selector-button:hover,
.project-editor-shell input[type="file"]::file-selector-button:hover {
    transform: translateY(-1px);
    opacity: 0.96;
}

.project-editor-shell textarea {
    min-height: 140px;
}

.project-editor-shell .stack-label span,
.editor-section > label {
    display: inline-block;
    margin-bottom: 0.45rem;
    font-weight: 700;
}

.toggle-line {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.toggle-line input[type="checkbox"] {
    width: auto;
}

.form-grid,
.filter-grid,
.project-existing-grid,
.content-grid-two {
    display: grid;
    gap: 1rem;
}

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

.filter-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.project-existing-grid,
.content-grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.helper-text {
    font-size: 0.95rem;
    line-height: 1.6;
}

.warning-text {
    color: var(--warning);
    font-weight: 700;
}

.tab-panel-shell {
    margin-top: 1.5rem;
}

.tab-row {
    margin-bottom: 1.2rem;
}

.tab-button {
    padding: 0.8rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 700;
}

.tab-button.active {
    background: var(--accent-soft);
    color: var(--text);
    border-color: rgba(67, 168, 255, 0.35);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: grid;
}

.panel-soft {
    padding: 1.2rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.gallery-item {
    display: block;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.04);
}

.gallery-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.download-list {
    list-style: none;
}

.download-item,
.upload-card,
.notification-item,
.comment-item,
.audit-item,
.report-card,
.storage-row {
    padding: 1rem 1.1rem;
}

.external-link-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.trending-card {
    position: relative;
}

.trending-rank {
    display: inline-flex;
    width: fit-content;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 800;
}

.download-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    border-radius: var(--radius-md);
    background: var(--panel-soft);
    border: 1px solid var(--panel-border);
}

.comment-item {
    display: grid;
    gap: 0.65rem;
}

.comment-item-header,
.user-card-header {
    justify-content: space-between;
}

.comment-content,
.policy-card p,
.policy-card li {
    line-height: 1.7;
}

.policy-card h2 {
    margin-top: 1rem;
}

.policy-card ul,
.policy-card ol {
    display: grid;
    gap: 0.7rem;
    margin-left: 1.2rem;
}

.user-card,
.report-card {
    display: grid;
    gap: 0.75rem;
}

.report-form-grid {
    display: grid;
    gap: 0.75rem;
}

.notification-item.unread {
    border-color: rgba(67, 168, 255, 0.35);
}

.footer-links {
    justify-content: center;
    padding: 2rem 0 2.5rem;
    color: var(--muted);
}

.footer-links a {
    text-decoration: none;
}

.secret-box {
    padding: 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--panel-border);
}

.secret-list {
    padding: 1rem;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.2);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

body.light-mode .secret-list {
    background: rgba(18, 32, 66, 0.06);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

.pill-success {
    background: rgba(92, 204, 139, 0.18);
}

.pill-danger {
    background: rgba(255, 111, 97, 0.2);
}

.compact-cards .project-mini-card,
.upload-card,
.storage-row,
.audit-item,
.notification-item {
    display: grid;
    gap: 0.45rem;
}

.compact-list .toggle-line {
    padding: 0.8rem 0.95rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--panel-border);
}

body.light-mode .compact-list .toggle-line {
    background: rgba(18, 32, 66, 0.05);
}

.external-dialog {
    width: min(520px, calc(100% - 1rem));
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text);
}

.external-dialog::backdrop {
    background: rgba(5, 9, 17, 0.72);
}

.external-dialog form {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    background: var(--panel);
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
}

.filter-panel {
    margin-top: 1.5rem;
}

#projects-filter-summary {
    margin-top: 1.15rem;
    padding-top: 1rem;
    border-top: 1px solid var(--panel-border);
}

#projects-list {
    margin-top: 1.5rem;
}

.featured-toggle {
    margin-top: 1.8rem;
}

@media (max-width: 1080px) {
    .hero-card,
    .project-hero,
    .home-columns,
    .dashboard-grid,
    .dashboard-grid-large,
    .project-editor-shell,
    .project-existing-grid,
    .content-grid-two {
        grid-template-columns: 1fr;
    }

    .editor-sidebar {
        position: static;
    }

    .form-grid,
    .filter-grid,
    .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 780px) {
    .site-header,
    .site-footer,
    .announcement-banner,
    .page-shell,
    .page-shell-wide {
        width: min(100%, calc(100% - 1rem));
    }

    .site-header {
        flex-direction: column;
        align-items: stretch;
        padding-top: 1rem;
    }

    .top-nav {
        justify-content: flex-start;
        flex: none;
    }

    .mode-toggle {
        width: 100%;
        margin-left: 0;
    }

    .hero-card,
    .page-intro,
    .panel,
    .project-side-card,
    .auth-card,
    .policy-card,
    .project-hero-main {
        padding: 1.2rem;
    }

    .profile-hero-body {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 1rem;
        margin-top: -42px;
    }

    .avatar-lg {
        width: 100px;
        height: 100px;
    }

    .form-grid,
    .filter-grid,
    .card-grid,
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .external-link-card {
        grid-template-columns: 1fr;
    }

    .download-item {
        align-items: stretch;
        flex-direction: column;
    }

    .button-row .btn,
    .button-row .btn-secondary,
    .button-row .btn-danger {
        flex: 1 1 220px;
    }
}
