:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --accent: #f97316;
    --danger: #dc2626;
    --bg: #f8fafc;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --card: #ffffff;
    --content-max-width: 1320px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: linear-gradient(180deg, #f2f5ff 0%, #e6f9ff 100%);
    color: var(--text);
    line-height: 1.6;
}

@media (min-width: 1440px) {
    body {
        font-size: 1.05rem;
    }
}

.container {
    width: min(1400px, 92vw);
    margin: 0 auto;
}

@media (min-width: 1600px) {
    .container {
        width: min(1500px, 80vw);
    }
}

.content-width {
    max-width: var(--content-max-width);
    width: min(94vw, var(--content-max-width));
    margin-left: auto;
    margin-right: auto;
}

.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

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

.brand {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.site-nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    padding: 0.2rem 0.4rem;
    border-radius: 0.4rem;
    transition: background 0.2s ease;
}

.site-nav a:hover {
    background: rgba(37, 99, 235, 0.08);
}

.logout-form {
    margin: 0;
}

.logout-form button {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.2rem 0.4rem;
}

main {
    padding: 3rem 0 4rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    background: var(--primary);
    color: #fff;
    border-radius: 0.6rem;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
    border: none;
    cursor: pointer;
}

.button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.button.secondary {
    background: #0f172a;
}

.button.secondary:hover {
    background: #020617;
}

.hero {
    padding: 2.2rem;
    background: var(--card);
    border-radius: 1.25rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
    margin-bottom: 2.5rem;
    display: grid;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.12), transparent 55%);
    pointer-events: none;
}

.hero-body,
.hero-figure {
    position: relative;
    z-index: 1;
}

.hero.hero-compact {
    padding: 1.8rem 2rem;
    gap: 1rem;
    border-radius: 1rem;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    margin-bottom: 2.5rem;
}

.hero.hero-compact::after {
    background: radial-gradient(circle at top right, rgba(37, 99, 235, 0.1), transparent 60%);
}

.hero.hero-compact h1 {
    font-size: clamp(1.75rem, 2.2vw + 1rem, 2.6rem);
    margin-bottom: 0.6rem;
}

.hero.hero-compact p {
    color: var(--muted);
    margin-bottom: 0;
}

.hero.hero-compact .hero-actions {
    margin-top: 1rem;
}

@media (min-width: 1440px) {
    .hero.hero-compact {
        padding: 2.2rem 2.8rem;
    }
}

.hero-body h1 {
    font-size: clamp(2rem, 3vw + 1rem, 3rem);
    margin: 0.3rem 0 1rem;
}

.hero-body p {
    max-width: 48ch;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.85rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.2rem;
}

.hero-hint {
    margin-top: 1.2rem;
}

.about-hero {
    grid-template-columns: 1fr;
}

.hero-figure {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.floating-card {
    background: linear-gradient(160deg, rgba(37, 99, 235, 0.1), rgba(14, 116, 144, 0.12));
    border-radius: 1rem;
    padding: 1.2rem 1.4rem;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(37, 99, 235, 0.2);
    color: #0f172a;
    box-shadow: 0 16px 40px rgba(148, 163, 184, 0.2);
}

.floating-card.shadow {
    background: linear-gradient(160deg, rgba(14, 116, 144, 0.12), rgba(59, 130, 246, 0.08));
}

.floating-card h3 {
    margin-top: 0;
    margin-bottom: 0.8rem;
}

.floating-card ul {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--muted);
}

.post-list {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

.post-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 1.4rem 1.6rem;
    border-radius: 1.1rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(6px);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-left-color 0.2s ease;
    border-left: 4px solid transparent;
}

.post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.12);
    border-left-color: rgba(37, 99, 235, 0.55);
}

.post-card img.cover {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 0.8rem;
    margin-bottom: 1rem;
}

.post-card h2 {
    margin-top: 0;
    margin-bottom: 0.4rem;
}

.post-card .meta {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
}

.post-card .summary {
    color: #334155;
}

.post-card .read-more {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.post-card .read-more:hover {
    text-decoration: underline;
}

.post-layout {
    display: grid;
    gap: 2.5rem;
    width: 100%;
    align-items: start;
}

@media (min-width: 1100px) {
    .post-layout {
        grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
    }
}

@media (min-width: 1440px) {
    .post-layout {
        gap: 3rem;
        grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    }
}

.post-main {
    display: grid;
    gap: 2rem;
    margin: 0;
}

@media (min-width: 1280px) {
    .post-main {
        gap: 2.4rem;
    }
}

.post-detail {
    background: var(--card);
    border-radius: 1.1rem;
    padding: 2.1rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.08);
    margin: 0;
}

@media (min-width: 1280px) {
    .post-detail {
        padding: 2.4rem 2.6rem;
    }
}

@media (min-width: 1600px) {
    .post-detail {
        padding: 2.8rem 3rem;
    }
}

.post-detail .meta {
    color: var(--muted);
}

.post-cover {
    margin: 1.5rem 0;
    text-align: center;
}

.post-cover img {
    max-width: 100%;
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.post-body {
    margin-top: 1.5rem;
}

.post-attachment {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 0.8rem;
    background: #f9fafb;
    border: 1px dashed var(--border);
}

.post-attachment .attachment-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.post-more-panel {
    background: var(--card);
    color: var(--text);
    border-radius: 1.1rem;
    padding: clamp(1.4rem, 2vw, 1.9rem);
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.2);
    backdrop-filter: blur(6px);
    display: grid;
    gap: 1.4rem;
    transition: max-width 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
}

@media (min-width: 1100px) {
    .post-more-panel {
        position: sticky;
        top: 6.2rem;
        max-height: calc(100vh - 7rem);
        overflow-y: auto;
        padding-right: clamp(1.2rem, 1.6vw, 1.6rem);
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
}

@media (max-width: 1099px) {
    .post-more-panel {
        width: 100%;
    }
}

.post-more-panel[data-collapsed="true"] {
    max-width: 64px;
    padding: clamp(1.5rem, 1.8vw, 1.8rem) 0.7rem;
    overflow: visible;
}

.post-more-body {
    transition: opacity 0.2s ease;
}

.post-more-panel[data-collapsed="true"] .post-more-body {
    height: 0;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.post-more-panel[data-collapsed="true"] .post-more-head h2,
.post-more-panel[data-collapsed="true"] .post-more-all {
    display: none;
}

.post-more-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.post-more-head h2 {
    margin: 0;
    font-size: 1.4rem;
}

.post-more-all {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.post-more-all:hover {
    text-decoration: underline;
}

.post-more-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.85rem;
}

.post-more-item a {
    display: grid;
    gap: 0.35rem;
    background: rgba(37, 99, 235, 0.06);
    border-radius: 0.9rem;
    padding: 0.9rem 1.1rem;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(148, 163, 184, 0.16);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.post-more-item a:hover {
    transform: translateY(-4px);
    background: rgba(37, 99, 235, 0.18);
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.25);
}

.post-more-item .title {
    font-weight: 600;
    font-size: 1.05rem;
}

.post-more-item .meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.post-more-empty {
    color: var(--muted);
    font-size: 0.95rem;
}

.post-more-toggle {
    background: none;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--muted);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.post-more-toggle:hover {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.45);
    color: var(--primary);
}

@media (max-width: 1099px) {
    .post-more-toggle {
        display: none;
    }
}

.badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    font-size: 0.75rem;
}

.comments, .comment-form {
    background: rgba(255, 255, 255, 0.96);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    margin-bottom: 1.5rem;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 1rem;
}

.comment-item {
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    padding: 1rem;
    background: #fff;
}

.comment-item.level-1 {
    margin-left: 1.5rem;
}

.comment-item.level-2 {
    margin-left: 3rem;
}

.comment-header {
    display: flex;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.comment-content {
    margin: 0.75rem 0;
}

.comment-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.comment-actions details {
    background: #f1f5f9;
    border-radius: 0.5rem;
    padding: 0.4rem 0.7rem;
}

.comment-actions details[open] {
    box-shadow: inset 0 0 0 1px var(--border);
}

.comment-actions .reply-form {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.comment-actions .reply-form textarea {
    width: 100%;
    resize: vertical;
}

.comment-actions form {
    margin: 0;
}

.comment-actions button.danger {
    background: var(--danger);
}

.comment-pagination {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.comment-pagination a,
.comment-pagination span {
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    text-decoration: none;
    font-size: 0.95rem;
    color: var(--text);
}

.comment-pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.comment-pagination .active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.comment-pagination .prev,
.comment-pagination .next {
    font-weight: 600;
}

.comment-replies {
    list-style: none;
    padding-left: 1rem;
    margin: 1rem 0 0;
    display: grid;
    gap: 1rem;
}

.comment-form textarea,
.auth-card input,
.auth-card textarea,
.editor-form input,
.editor-form textarea {
    width: 100%;
    padding: 0.8rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    font-size: 1rem;
    font-family: inherit;
}

.comment-form button,
.auth-card button,
.editor-form button,
.dashboard .actions button {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 0.5rem;
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.comment-form button:hover,
.auth-card button:hover,
.editor-form button:hover,
.dashboard .actions button:hover {
    background: var(--primary-dark);
}

.error {
    color: var(--danger);
    background: #fee2e2;
    border: 1px solid #fecaca;
    padding: 0.75rem 1rem;
    border-radius: 0.6rem;
}

.success {
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    padding: 0.75rem 1rem;
    border-radius: 0.6rem;
}

.hint {
    color: var(--muted);
    background: #fef3c7;
    border: 1px solid #fde68a;
    padding: 0.6rem 0.8rem;
    border-radius: 0.5rem;
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}

.auth-card {
    max-width: 420px;
    margin: 0 auto;
    background: var(--card);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.auth-card form {
    display: grid;
    gap: 0.8rem;
}

.auth-card label {
    font-weight: 600;
}

.auth-card .switch {
    text-align: center;
    color: var(--muted);
}

.auth-card .switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.dashboard {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 1.2rem;
    padding: 2.2rem;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(6px);
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dashboard-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.dashboard-filters .filter-link {
    padding: 0.35rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.dashboard-filters .filter-link:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: var(--primary);
}

.dashboard-filters .filter-link.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.dashboard-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1rem;
}

.dashboard-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.9rem;
    background: rgba(248, 250, 252, 0.85);
}

.dashboard .actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.dashboard .actions .link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.dashboard .actions form {
    margin: 0;
}

.editor {
    background: var(--card);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.current-file.attachments {
    padding: 1rem;
    border: 1px dashed var(--border);
    border-radius: 0.8rem;
    background: #f8fafc;
}

.attachment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.attachment-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.attachment-list a {
    color: var(--primary);
    text-decoration: none;
}

.attachment-list .remove {
    font-size: 0.85rem;
    color: var(--muted);
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.editor-form {
    display: grid;
    gap: 1rem;
}

.editor-form input[type="file"] {
    padding: 0.4rem;
    border: 1px dashed var(--border);
    border-radius: 0.6rem;
    background: #f8fafc;
}

.current-file {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #f1f5f9;
    padding: 0.8rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
}

.current-file img {
    width: 120px;
    border-radius: 0.6rem;
    object-fit: cover;
}

.editor-form .hint {
    margin-top: -0.5rem;
    font-size: 0.85rem;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.user-table th,
.user-table td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.user-table tr.inactive {
    background: #f8fafc;
    opacity: 0.75;
}

.user-table .actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-table .actions form {
    margin: 0;
}

.user-table .actions button {
    width: 100%;
}

.user-table .status {
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.user-table .status.active {
    background: #dcfce7;
    color: #166534;
}

.user-table .status.inactive {
    background: #fee2e2;
    color: #b91c1c;
}

.user-table .actions .secondary {
    background: #1e293b;
}

.user-table .actions .secondary:hover {
    background: #0f172a;
}

.new-password {
    margin-top: 0.3rem;
    font-size: 0.9rem;
}

.new-password code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.feature-grid {
    display: grid;
    gap: 1.8rem;
    margin-bottom: 3rem;
}

.feature-grid article {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 1.1rem;
    padding: 1.8rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 22px 40px rgba(15, 23, 42, 0.06);
}

.feature-grid article h2 {
    margin-top: 0;
    margin-bottom: 0.6rem;
}

.timeline {
    margin: 3.5rem 0;
}

.timeline h2 {
    margin-bottom: 1.8rem;
}

.timeline-list {
    display: grid;
    gap: 1.5rem;
}

.timeline-item {
    display: grid;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 1rem;
    padding: 1.6rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.timeline-item .time {
    font-weight: 700;
    color: var(--primary-dark);
}

.timeline-item .content h3 {
    margin: 0 0 0.4rem;
}

.cta {
    margin: 4rem 0 2rem;
    background: radial-gradient(120% 120% at 100% 0%, rgba(37, 99, 235, 0.8), rgba(14, 116, 144, 0.7));
    color: #f8fafc;
    border-radius: 1.4rem;
    padding: 2.5rem;
    box-shadow: 0 32px 60px rgba(15, 23, 42, 0.2);
}

.cta-content {
    display: grid;
    gap: 1rem;
}

.cta-content p {
    max-width: 55ch;
    color: rgba(248, 250, 252, 0.85);
}

.cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.cta .button {
    background: #f8fafc;
    color: #1e293b;
}

.cta .button:hover {
    background: #e2e8f0;
}

.cta .button.secondary {
    background: transparent;
    color: #f8fafc;
    border: 1px solid rgba(248, 250, 252, 0.45);
}

.cta .button.secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    background: var(--card);
    color: var(--muted);
}

@media (max-width: 640px) {
    .header-content,
    .dashboard-header,
    .dashboard-list li,
    .editor-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-nav {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .dashboard .actions {
        width: 100%;
        justify-content: flex-start;
    }

    .comment-item.level-1,
    .comment-item.level-2 {
        margin-left: 0;
    }

    .dashboard,
    .editor,
    .post-detail,
    .comments,
    .comment-form {
        padding: 1.5rem;
    }

    .post-card,
    .hero {
        padding: 1.5rem;
    }

    .hero-actions {
        width: 100%;
    }

    .hero-actions .button,
    .user-table .actions button {
        width: 100%;
    }

    .user-table {
        min-width: 100%;
    }
}

@media (min-width: 900px) {
    .about-hero {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
        align-items: center;
    }

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

    .cta-content {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: center;
    }
}
