:root {
    --bg: #08111b;
    --bg-soft: #0f172a;
    --panel: rgba(15, 23, 42, 0.88);
    --panel-alt: rgba(17, 25, 40, 0.94);
    --border: rgba(148, 163, 184, 0.16);
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #22c55e;
    --accent-bright: #4ade80;
    --danger: #f87171;
    --success: #86efac;
    --shadow: 0 28px 60px rgba(0, 0, 0, 0.32);
    --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at top, rgba(34, 197, 94, 0.16), transparent 26%),
        linear-gradient(135deg, #08111b 0%, #0f172a 60%, #09111a 100%);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
textarea, input, select, button { font: inherit; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.96);
    color: var(--text);
    border-radius: 16px;
    padding: 14px 16px;
    outline: none;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, select:focus, textarea:focus {
    transform: translateY(-1px);
    border-color: rgba(34, 197, 94, 0.85);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}
button { border: 0; cursor: pointer; }

.site-shell, .auth-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 28px 22px 42px;
}
.narrow-shell { max-width: 1100px; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; }
.auth-single { max-width: 560px; }
.glass-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    border-radius: var(--radius);
}
.hero, .page-header {
    display: grid;
    grid-template-columns: 1.3fr 0.8fr;
    gap: 24px;
    padding: 34px;
}
.hero-copy h1, .page-header h1, .card-heading h1 { margin: 10px 0 12px; font-size: clamp(2rem, 4vw, 3.6rem); line-height: 1.05; }
.hero-copy p, .page-header p, .muted-copy, .project-card p, .wiki-content, .auth-switch { color: var(--muted); }
.hero-actions, .header-actions, .project-cta-row, .row-actions, .sidebar-actions, .comment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.hero-panel-group, .project-grid, .stats-row, .dashboard-grid, .two-column-layout { display: grid; gap: 20px; }
.hero-panel-group { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.stat-card, .project-card, .metric-card, .version-card, .comment-card, .list-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 20px;
    padding: 20px;
    transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}
.stat-card:hover, .project-card:hover, .metric-card:hover, .version-card:hover, .comment-card:hover, .list-item:hover, .nav-item:hover {
    transform: translateY(-4px);
    border-color: rgba(34, 197, 94, 0.32);
}
.stat-card strong, .metric-card strong { font-size: 2rem; display: block; }
.eyebrow {
    display: inline-block;
    color: var(--success);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.75rem;
}
.section-panel { padding: 28px; }
.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}
.section-heading h2 { margin: 0; }
.content-grid { display: grid; gap: 22px; margin-top: 22px; }
.project-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.project-version {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.14);
    color: var(--success);
    font-size: 0.82rem;
    font-weight: 700;
}
.project-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    margin: 18px 0;
    font-size: 0.92rem;
}
.wiki-list, .stack-list, .version-list, .comment-thread { display: grid; gap: 16px; }
.wiki-link {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 18px 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.12);
}
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
    color: #04110a;
    background: linear-gradient(135deg, var(--accent), var(--accent-bright));
    box-shadow: 0 16px 28px rgba(34, 197, 94, 0.22);
}
.btn-secondary, .btn-ghost, .btn-inline {
    color: var(--text);
    background: rgba(148, 163, 184, 0.12);
}
.btn-inline { padding: 8px 12px; font-size: 0.9rem; }
.card-heading h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.auth-card { width: 100%; padding: 32px; }
.stack-form { display: grid; gap: 16px; }
label span { display: block; color: #d5e1ef; margin-bottom: 8px; }
.auth-switch { margin-top: 16px; }
.auth-switch a, .section-heading a, .wiki-link span { color: var(--success); }
.flash-message {
    margin-top: 18px;
    padding: 15px 18px;
    border-radius: 16px;
    font-weight: 700;
}
.flash-message.error { background: rgba(248, 113, 113, 0.14); color: #fecaca; border: 1px solid rgba(248, 113, 113, 0.25); }
.flash-message.success { background: rgba(34, 197, 94, 0.12); color: #dcfce7; border: 1px solid rgba(34, 197, 94, 0.2); }

.app-layout {
    display: grid;
    grid-template-columns: 290px 1fr;
    min-height: 100vh;
    gap: 22px;
    padding: 24px;
}
.sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 26px;
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 16px;
}
.brand-badge {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-weight: 900;
    color: #04110a;
    background: linear-gradient(135deg, var(--accent), var(--accent-bright));
}
.nav-menu { display: grid; gap: 12px; margin-top: 28px; }
.nav-item {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255,255,255,0.02);
    transition: transform 0.2s ease, background 0.2s ease;
}
.nav-item.active { color: #04110a; background: linear-gradient(135deg, var(--accent), var(--accent-bright)); }
.user-chip {
    background: rgba(255,255,255,0.04);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 14px;
}
.user-chip span { color: var(--muted); display: block; margin-top: 6px; }
.main-content { display: grid; gap: 22px; }
.topbar { padding: 20px 24px; }
.search-bar {
    display: grid;
    grid-template-columns: 170px 1fr auto;
    gap: 12px;
    max-width: 760px;
    margin: 0 auto;
}
.stats-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full-span { grid-column: 1 / -1; }
.compact-card p { margin-bottom: 18px; }
.top-gap { margin-top: 22px; }
.top-gap-small { margin-top: 14px; }
.two-column-layout { grid-template-columns: 1.1fr 1fr; }
.version-card div, .comment-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}
.comment-card p { margin: 14px 0; line-height: 1.7; }
.comment-children {
    display: grid;
    gap: 14px;
    margin-top: 16px;
    padding-left: 18px;
    border-left: 2px solid rgba(34, 197, 94, 0.2);
}
.reply-form, .comment-form textarea, textarea {
    width: 100%;
}
.hidden-form { display: none; margin-top: 14px; }
.hidden-form.is-visible { display: grid; gap: 12px; }
.like-count { color: var(--success); font-weight: 700; }
.list-item { display: grid; gap: 8px; }
.multi-line small { color: var(--muted); }
.wiki-page { padding: 34px; }
.wiki-content { white-space: pre-wrap; line-height: 1.8; }

.fade-in-up { animation: fadeUp 0.7s ease both; }
.fade-in-left { animation: fadeLeft 0.7s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeLeft { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: translateX(0); } }

@media (max-width: 1024px) {
    .hero, .page-header, .app-layout, .two-column-layout, .dashboard-grid { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .search-bar, .stats-row { grid-template-columns: 1fr; }
    .site-shell, .auth-shell, .app-layout { padding: 18px; }
    .section-heading, .version-card div, .comment-header, .project-meta, .wiki-link { flex-direction: column; align-items: flex-start; }
}
