:root {
    --background: #f8f9fb;
    --surface: #ffffff;
    --primary: #124559;
    --primary-dark: #0a2e3a;
    --secondary: #598392;
    --text: #1a1a1a;
    --muted: #606c76;
    --border: #d0d7de;
    --danger: #a94442;
    --success: #2e7d32;
    --warning: #f5a623;
    --warning-dark: #b87400;
    --font-body: 'Segoe UI', Tahoma, Arial, sans-serif;
    --max-width: 1100px;
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

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

a:hover {
    text-decoration: underline;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1rem;
    z-index: 100;
}

.skip-link:focus {
    top: 10px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.nav-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    gap: 1rem;
}

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

.brand-logo {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-link {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.brand-tagline {
    font-size: 0.85rem;
    color: var(--muted);
}

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

.nav-link {
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    color: var(--primary);
    font-weight: 600;
}

.nav-link:hover,
.nav-link:focus {
    background: rgba(18, 69, 89, 0.1);
}

.nav-search {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0;
    margin: 0;
}

.nav-search-input {
    padding: 0 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    min-width: 180px;
    height: 2.5rem;
    line-height: 1.2;
}

.nav-search-input:focus {
    outline: 2px solid rgba(18, 69, 89, 0.3);
    outline-offset: 1px;
}

.nav-search-button {
    height: 2.5rem;
    padding: 0 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-inline-form {
    display: inline;
}

.nav-link-notification {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    background: rgba(18, 69, 89, 0.12);
    color: var(--primary-dark);
    font-weight: 600;
    text-decoration: none;
}

.nav-link-notification:hover,
.nav-link-notification:focus {
    background: rgba(18, 69, 89, 0.2);
    text-decoration: none;
}

.nav-notification-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.nav-notification-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

.nav-notification-static {
    position: relative;
}

.nav-notification-static::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 8px;
    border: 1px solid rgba(18, 69, 89, 0.22);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nav-notification-static:hover::after,
.nav-notification-static:focus::after {
    opacity: 1;
}

.nav-button {
    margin: 0;
    line-height: 1.2;
}

.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.layout-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.stats-page {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    max-width: 1080px;
    margin: 0 auto 2.5rem;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.stats-header-copy {
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stats-header h1 {
    margin: 0;
    font-size: 1.9rem;
}

.stats-subtitle {
    color: var(--muted);
    margin: 0;
}

.stats-range {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.stats-period-switch {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.stats-period-button {
    padding: 0.45rem 1rem;
    font-size: 0.9rem;
    color: var(--primary);
    text-decoration: none;
    background: transparent;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.stats-period-button.is-active,
.stats-period-button:hover {
    background: var(--primary);
    color: #fff;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.4rem;
}

.stats-summary-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.3rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.stats-summary-card h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.stats-summary-value {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.stats-summary-value strong {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.stats-summary-delta {
    font-weight: 600;
}

.stats-trend-up {
    color: #227447;
}

.stats-trend-down {
    color: #a94442;
}

.stats-trend-flat {
    color: var(--muted);
}

.stats-summary-card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.stats-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.stats-chart-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.stats-chart-card header {
    padding: 1.25rem 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stats-chart-card header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.stats-chart-card header p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.stats-chart-card figure {
    margin: 0;
    padding: 0 1.25rem 1.25rem;
}

.stats-chart-card img,
.stats-chart-card svg {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    background: #f0f4f8;
}

.stats-chart-figure {
    position: relative;
}

.stats-chart-expand {
    display: block;
    background: none;
    border: 0;
    padding: 0;
    cursor: zoom-in;
    text-decoration: none;
}

.stats-chart-expand:focus {
    outline: 2px solid rgba(18, 69, 89, 0.4);
    outline-offset: 4px;
}

.stats-chart-expand img,
.stats-chart-expand svg {
    display: block;
    width: 100%;
    height: auto;
}

.stats-chart-modal {
    display: none;
}

.stats-chart-modal:target {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.stats-chart-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
}

.stats-chart-modal-dialog {
    position: relative;
    width: min(1400px, 95vw);
    max-height: 92vh;
    margin: 0 1rem;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.stats-chart-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.stats-chart-modal-close {
    font-size: 1.5rem;
    line-height: 1;
    color: var(--muted);
}

.stats-chart-modal-close:hover,
.stats-chart-modal-close:focus {
    color: var(--primary);
    text-decoration: none;
}

.stats-chart-modal-body {
    padding: 1rem;
    overflow: auto;
    max-height: calc(92vh - 72px);
}

.stats-chart-modal-body img,
.stats-chart-modal-body svg {
    display: block;
    width: 100%;
    height: auto;
}

.stats-empty {
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 2rem;
    background: rgba(18, 69, 89, 0.03);
    text-align: center;
    color: var(--muted);
}
@media (max-width: 900px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }
    .nav-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

.section-title {
    margin-top: 0;
}

.post-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.post-card {
    background: var(--surface);
    padding: 1.2rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.post-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.post-card-header .post-card-author {
    margin-bottom: 0;
}

.post-card-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    margin-left: auto;
    flex-shrink: 0;
}

.post-card-delete .button {
    padding: 0.35rem 0.9rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.post-card-move-form {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.post-card-move-select {
    min-width: 150px;
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 0.9rem;
    color: var(--text);
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(18, 69, 89, 0.18), rgba(18, 69, 89, 0.05));
    color: var(--primary-dark);
    font-weight: 600;
    overflow: hidden;
    text-transform: uppercase;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

.avatar__fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 0.85em;
    letter-spacing: 0.02em;
}

.avatar--xsmall {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.7rem;
}

.avatar--small {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.85rem;
}

.avatar--medium {
    width: 3rem;
    height: 3rem;
    font-size: 1.1rem;
}

.avatar--large {
    width: 4rem;
    height: 4rem;
    font-size: 1.35rem;
}

.post-card-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.post-card-author-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.post-card-author-name {
    font-weight: 600;
    color: var(--primary-dark);
}

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

.post-card-avatar {
    flex-shrink: 0;
}

.post-card-image {
    position: relative;
    margin: 0 0 0.75rem 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface);
    line-height: 0;
}

.post-card-image::before {
    content: '';
    display: block;
    padding-top: 56.25%;
}

.post-card-image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-title {
    margin: 0 0 0.4rem 0;
}

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

.post-body-preview {
    margin-top: 0.8rem;
    color: var(--muted);
    max-height: 12rem;
    overflow: hidden;
}

.post-body-preview > :first-child {
    margin-top: 0;
}

.post-body-preview > :last-child {
    margin-bottom: 0;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.panel-highlight {
    background: rgba(18, 69, 89, 0.06);
    border-color: rgba(18, 69, 89, 0.2);
}

.panel-title {
    margin-top: 0;
}

.space-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.space-list li {
    margin-bottom: 0.5rem;
}

.space-link {
    font-weight: 600;
}

.space-meta {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
}

.space-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: stretch;
    margin-top: 0.5rem;
}

.button {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    text-align: center;
}

.button-small {
    font-size: 0.85rem;
    padding: 0.35rem 0.75rem;
}

.space-follow-button,
.space-write-button {
    font-size: 1rem;
    padding: 0.5rem 1rem;
}

.button-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.button-secondary {
    background: var(--surface);
    color: var(--primary);
    border-color: var(--primary);
}

.button-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.button-warning {
    background: var(--warning);
    color: #2d2100;
    border-color: var(--warning);
}

.button-primary:hover,
.button-secondary:hover,
.button-danger:hover,
.button-warning:hover {
    opacity: 0.9;
    text-decoration: none;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-inline {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
}

.inline-form {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
}

.space-actions > * {
    flex: 1 1 220px;
    min-width: 200px;
}

.space-follow-form {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.space-follow-button,
.space-write-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-inline .form-group {
    margin: 0;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    font: inherit;
}

.form-note {
    font-size: 0.8rem;
    color: var(--muted);
}

.form-group-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.form-check-inline {
    flex-direction: row;
}

.form-fieldset {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.9rem 1rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.form-fieldset legend {
    font-weight: 600;
    padding: 0 0.3rem;
}

.auth-card,
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: 6px;
    max-width: 500px;
    margin: 0 auto;
}

.auth-link {
    text-align: center;
}

.flash {
    padding: 0.85rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.flash-success {
    background: rgba(46, 125, 50, 0.1);
    color: var(--success);
    border: 1px solid rgba(46, 125, 50, 0.4);
}

.flash-error {
    background: rgba(169, 68, 66, 0.12);
    color: var(--danger);
    border: 1px solid rgba(169, 68, 66, 0.4);
}

.notice {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin: 0.75rem 0;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.notice-warning {
    background: rgba(169, 68, 66, 0.12);
    border: 1px solid rgba(169, 68, 66, 0.2);
    color: var(--danger);
}

.notice-archived {
    background: rgba(245, 166, 35, 0.15);
    border: 1px solid rgba(245, 166, 35, 0.4);
    color: var(--warning-dark);
}

.empty-state {
    color: var(--muted);
}

.post-full {
    background: var(--surface);
    padding: 2rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.post-manage-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}

.post-manage-actions .button {
    margin: 0;
}


.post-full-image {
    margin: 1.5rem auto;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
    width: min(100%, calc(100vw - 3rem));
    max-width: 820px;
    line-height: 0;
}

.post-full-image img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: cover;
}

.comments {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 6px;
}

.profile-collection {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 2rem;
}

.profile-collection-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.profile-collection-title {
    margin: 0;
    font-size: 1.65rem;
    color: var(--primary-dark);
}

.profile-collection-subtitle {
    margin: 0.25rem 0 0 0;
    color: var(--muted);
}

.profile-collection-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    color: var(--primary);
}

.profile-collection-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 1.1rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-card:hover,
.profile-card:focus-within {
    border-color: rgba(18, 69, 89, 0.35);
    box-shadow: 0 6px 18px rgba(18, 69, 89, 0.08);
}

.profile-card-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.profile-card-username {
    color: var(--muted);
    font-size: 0.85rem;
}

.profile-card-meta {
    color: var(--muted);
    font-size: 0.85rem;
}

.profile-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.profile-card-header-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.profile-card-avatar {
    flex-shrink: 0;
}

.profile-card-actions {
    margin-top: auto;
    display: flex;
    gap: 0.5rem;
}

@media (max-width: 640px) {
    .profile-collection {
        padding: 1.25rem;
    }
    .profile-collection-title {
        font-size: 1.4rem;
    }
    .profile-collection-grid {
        grid-template-columns: 1fr;
    }
}

.reply-context {
    background: rgba(31, 111, 235, 0.1);
    border: 1px solid rgba(31, 111, 235, 0.2);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
}

.reply-context .reply-cancel {
    margin-left: 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.comment-branch {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.comment-item {
    margin: 1.5rem 0;
}

.comment-thread-row {
    --comment-depth: 0;
    position: relative;
    padding-left: calc(0.75rem + (var(--comment-depth, 0) * 1.4rem));
}

.comment-thread-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.6rem;
    bottom: 0.6rem;
    width: calc(var(--comment-depth, 0) * 1.4rem);
    background-image: repeating-linear-gradient(
        to right,
        rgba(10, 46, 58, 0.18),
        rgba(10, 46, 58, 0.18) 2px,
        transparent 2px,
        transparent 1.4rem
    );
}

.comment-thread-row.has-parent::after {
    content: '';
    position: absolute;
    top: 1.4rem;
    left: calc(var(--comment-depth, 0) * 1.4rem);
    width: 18px;
    height: 2px;
    background: rgba(10, 46, 58, 0.18);
    border-radius: 2px;
}

.comment-item.is-target .comment-card {
    box-shadow: inset 3px 0 0 var(--primary);
}

.comment-card {
    background: #fffdf6;
    border: 1px solid rgba(10, 46, 58, 0.18);
    border-radius: 6px;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.comment-card-meta {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.comment-card-avatar {
    flex-shrink: 0;
}

.comment-card-meta-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.comment-author {
    font-weight: 600;
    color: var(--primary-dark);
}

.comment-card-meta-text .comment-author {
    font-weight: 600;
    color: var(--primary-dark);
}

.comment-card-meta-text .comment-timestamp {
    font-size: 0.8rem;
}

.comment-card-meta-text .comment-permalink {
    font-size: 0.75rem;
}

.comment-card-body {
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
    white-space: pre-wrap;
}

.comment-card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    justify-content: space-between;
}

.comment-card-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.comment-reply-link {
    font-size: 0.85rem;
    color: var(--secondary);
    text-transform: lowercase;
}

.comment-reply-link:hover,
.comment-reply-link:focus-visible {
    text-decoration: underline;
}

.comment-reply-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.85rem;
    border: 1px solid rgba(10, 46, 58, 0.3);
    border-radius: 999px;
    color: var(--primary-dark);
    background: rgba(18, 69, 89, 0.04);
}

.comment-reply-button:hover,
.comment-reply-button:focus-visible {
    background: rgba(18, 69, 89, 0.08);
    color: var(--primary);
}

.comment-action {
    font-size: 0.85rem;
    color: var(--muted);
}

.comment-action:hover,
.comment-action:focus {
    color: var(--primary);
}

.comment-permalink {
    margin-left: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

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

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.settings-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.5rem;
}

.error-page {
    text-align: center;
    padding: 3rem 1rem;
}

.page-intro {
    color: var(--muted);
}

.space-cards {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.space-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
}

.space-card-image {
    margin: 0 0 0.75rem 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface);
}

.space-card-image img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.space-managed {
    margin-bottom: 2rem;
}

.chat-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.chat-index {
    padding: 2rem 0 3rem;
}

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

.chat-actions {
    display: flex;
    align-items: center;
}

.chat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: 14px;
    border: 1px solid rgba(18, 69, 89, 0.12);
    box-shadow: 0 8px 32px rgba(10, 15, 30, 0.07);
    background: #fff;
    color: inherit;
}

.chat-list-avatars {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.chat-list-avatars .avatar {
    box-shadow: 0 3px 6px rgba(15, 23, 42, 0.18);
}

.chat-list-avatar {
    flex-shrink: 0;
}

.chat-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
}

.chat-card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.chat-card-title-row h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.chat-card-title-row time {
    font-size: 0.85rem;
    color: var(--muted);
}

.chat-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chat-card:hover,
.chat-card:focus {
    border-color: var(--primary);
    box-shadow: 0 12px 28px rgba(18, 69, 89, 0.15);
    text-decoration: none;
}

.chat-list-participants {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.chat-list-count {
    margin-left: 0.4rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.chat-list-preview {
    margin: 0;
    color: var(--text);
    font-size: 0.9rem;
}

.chat-card-chevron {
    font-size: 1.2rem;
    color: var(--muted);
}

.chat-space-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.2rem;
    font-size: 0.83rem;
    color: var(--muted);
}

.chat-space-label span {
    background: rgba(18, 69, 89, 0.08);
    color: var(--primary-dark);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}

.chat-empty-panel {
    padding: 2rem;
    text-align: center;
}

.chat-layout {
    display: grid;
    grid-template-columns: minmax(220px, 260px) 1fr;
    gap: 1.5rem;
}

.chat-sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.2rem;
}

.chat-participant-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.chat-participant-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.chat-participant-avatar-image {
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
}

.chat-participant-avatar-image,
.chat-list-avatar,
.chat-message-avatar-image {
    border-radius: 50%;
}

.chat-participant-badge {
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: rgba(31, 111, 235, 0.14);
    color: #1f6feb;
    font-size: 0.72rem;
    font-weight: 600;
}

.chat-participant-badge-self {
    background: rgba(46, 125, 50, 0.18);
    color: #2e7d32;
}

.chat-messages-container {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    min-height: 340px;
}

.chat-messages {
    background: var(--surface);
    border-radius: 6px;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 60vh;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.chat-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.7rem 0.9rem;
    background: rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.chat-message-own {
    background: rgba(31, 111, 235, 0.12);
    border-color: rgba(31, 111, 235, 0.25);
}

.chat-message-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.chat-message-header .avatar {
    flex-shrink: 0;
}

.chat-message-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.chat-message-meta time {
    font-size: 0.72rem;
    color: var(--muted);
}

.chat-space-link {
    margin: 0.35rem 0;
    font-size: 0.95rem;
    color: var(--primary-dark);
}

.chat-space-link a {
    font-weight: 600;
    color: var(--primary);
}

.chat-message-author {
    font-weight: 600;
    color: var(--primary);
}

.chat-message-body {
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.chat-message-avatar-image {
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}

.chat-message-form textarea {
    resize: vertical;
}

.space-hero-image {
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}

.space-hero-image img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.reaction-bar {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
.reaction-comments {
     display: inline-flex;
     align-items: center;
     gap: 0.3rem;
}
    display: grid;
    gap: 0.6rem;
}

.boost-bar {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.boost-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    font-size: 0.9rem;
    color: var(--muted);
}

.boost-count {
    font-weight: 600;
    color: var(--text);
}

.boost-context {
    color: var(--muted);
}

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

.boost-signin-hint {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.reaction-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.reaction-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.reaction-form {
    margin: 0;
}

.reaction-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.reaction-icon {
    font-size: 1rem;
}

.reaction-remove-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.reaction-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    font-size: 0.9rem;
    color: var(--muted);
}

.reaction-total {
    font-weight: 600;
    color: var(--text);
}

.reaction-breakdown {
    display: inline-flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

.reaction-breakdown li {
    display: inline-flex;
    gap: 0.2rem;
    align-items: center;
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.05);
    font-size: 0.8rem;
}

.reaction-bar--compact {
    margin-top: 0.4rem;
    padding-top: 0.35rem;
    border-top: none;
}

.reaction-bar--compact .reaction-button {
    font-size: 0.78rem;
    padding: 0.28rem 0.65rem;
}

.reaction-bar--compact .reaction-stats {
    font-size: 0.78rem;
}

.reaction-bar--compact .reaction-breakdown li {
    font-size: 0.72rem;
}

.reaction-signin-hint {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.post-full-image {
    position: relative;
}

.post-image-link {
    position: relative;
    display: block;
    color: inherit;
}

.image-zoom-label {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.15rem;
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.post-image-link:hover .image-zoom-label,
.post-image-link:focus .image-zoom-label {
    transform: none;
}

.media-lightbox {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1000;
}

.media-lightbox:target {
    opacity: 1;
    pointer-events: all;
}

.media-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 16, 24, 0.85);
    display: block;
}

.media-lightbox-content {
    position: relative;
    background: #000;
    padding: 1rem;
    border-radius: 8px;
    max-width: min(90vw, 1080px);
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.media-lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
}

.media-lightbox-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    padding: 0.65rem 1.15rem;
}

.media-lightbox-close:hover,
.media-lightbox-close:focus {
    text-decoration: none;
}

.profile {
    --profile-accent: var(--primary);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.profile-hero {
    position: relative;
    border-radius: 14px;
    background: var(--profile-accent, var(--primary));
    color: #fff;
    overflow: hidden;
    min-height: 220px;
    display: flex;
    align-items: flex-end;
    border: 1px solid rgba(10, 46, 58, 0.4);
    box-shadow: 0 14px 30px rgba(10, 46, 58, 0.22);
}

.profile-hero--with-cover {
    background-size: cover;
    background-position: center;
}

.profile-hero-cover {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.profile-hero-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 23, 42, 0) 20%, rgba(10, 23, 42, 0.78) 100%);
    z-index: 1;
}

.profile-hero-inner {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 1.5rem;
    padding: clamp(1.6rem, 3vw, 2.6rem);
    align-items: flex-end;
    width: 100%;
}

.profile-avatar {
    width: clamp(96px, 17vw, 132px);
    height: clamp(96px, 17vw, 132px);
    border-radius: 20px;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    color: #fff;
    box-shadow: 0 10px 20px rgba(10, 46, 58, 0.35);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-fallback {
    color: #fff;
}

.profile-identity {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.profile-follow-form,
.profile-block-form {
    align-self: flex-start;
    margin-top: 0.4rem;
}

.profile-block-form {
    gap: 0.4rem;
}

.profile-block-reason {
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    font: inherit;
}

.blocked-spaces-list {
    list-style: none;
    margin: 1rem 0;
    padding: 0;
}

.blocked-spaces-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.blocked-space-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.blocked-space-slug,
.blocked-space-owner {
    font-size: 0.9rem;
    color: #6c7a86;
}

.blocked-space-unblock-form {
    margin: 0;
}

.profile-name {
    margin: 0;
    font-size: clamp(1.8rem, 4.6vw, 2.5rem);
    font-weight: 700;
}

.profile-username,
.profile-meta,
.profile-homepage a {
    color: rgba(255, 255, 255, 0.85);
}

.profile-tagline {
    margin: 0;
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.95);
}

.profile-homepage a {
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}

.profile-body {
    display: grid;
    grid-template-columns: minmax(220px, 340px) 1fr;
    gap: 1.5rem;
}

.profile-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.profile-card h2 {
    margin-top: 0;
    color: var(--profile-accent);
}

.profile-stats {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-stat-label {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 700;
}

.profile-stat-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.profile-main {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.profile-posts {
    display: grid;
    gap: 1rem;
}

.profile-posts--classic {
    grid-template-columns: minmax(280px, 1fr);
}

.profile-posts--spotlight .profile-post-card {
    display: grid;
    grid-template-columns: minmax(150px, 240px) 1fr;
    gap: 1rem;
}

.profile-posts--spotlight {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.profile-posts--spotlight > .profile-post-card:first-child {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(240px, 320px) 1fr;
    gap: 1.5rem;
    align-items: stretch;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 36px rgba(17, 24, 39, 0.16);
}

.profile-posts--spotlight > .profile-post-card:first-child .profile-post-thumb {
    height: 100%;
    min-height: 220px;
}

.profile-posts--spotlight > .profile-post-card:first-child .profile-post-thumb img {
    height: 100%;
    object-fit: cover;
}

@supports selector(:has(*)) {
    .profile-posts--spotlight > .profile-post-card:first-child:not(:has(.profile-post-thumb)) {
        display: flex;
        flex-direction: column;
    }
}

.profile-posts--magazine {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.profile-post-card {
    background: var(--surface);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 1.2rem;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.profile-post-thumb {
    display: block;
    overflow: hidden;
    border-radius: 10px;
}

.profile-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.profile-posts--magazine .profile-post-card {
    height: 100%;
}

.profile-posts--magazine .profile-post-card .profile-post-thumb {
    height: 180px;
}

.profile-post-thumb:hover img {
    transform: scale(1.04);
}

.profile-post-meta {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.profile-post-excerpt {
    margin: 0;
    color: var(--muted);
    max-height: 12rem;
    overflow: hidden;
}

.profile-post-excerpt > :first-child {
    margin-top: 0;
}

.profile-post-excerpt > :last-child {
    margin-bottom: 0;
}

.markdown-preview-ellipsis {
    display: inline-block;
    margin-left: 0.25rem;
    color: var(--muted);
}

.space-admins {
    margin: 0.6rem 0 0 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.space-admins-label {
    font-weight: 600;
    color: var(--text);
    margin-right: 0.4rem;
}

.space-admin-link {
    color: var(--primary);
}

.admin-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.admin-list-item {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: baseline;
    background: rgba(0, 0, 0, 0.03);
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
}

.admin-display {
    font-weight: 600;
}

.admin-username {
    color: var(--muted);
    font-size: 0.85rem;
}

.admin-badge {
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: rgba(31, 111, 235, 0.14);
    color: #1f6feb;
    font-size: 0.75rem;
    font-weight: 600;
}

.cover-preview {
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.avatar-preview {
    width: clamp(72px, 18vw, 96px);
    height: clamp(72px, 18vw, 96px);
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    display: block;
}

.comment-form textarea {
    resize: vertical;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.markdown-toolbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.6rem;
    margin-bottom: 0.6rem;
    border: 1px solid rgba(18, 69, 89, 0.18);
    border-radius: 8px;
    background: rgba(89, 131, 146, 0.12);
    padding: 0.6rem 0.75rem;
}

.markdown-guide {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.4rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(18, 69, 89, 0.12);
}

.markdown-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.markdown-guide code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.78rem;
    color: var(--primary-dark);
}

.notifications {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.notifications-summary {
    margin: 0;
    font-size: 1rem;
}

.notifications-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.notifications-actions-bar .notifications-summary {
    flex: 1 1 auto;
    margin: 0;
}

.notifications-actions-bar .inline-form {
    margin: 0;
}

.notifications-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.notifications-panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.2rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notifications-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.notifications-link {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.25rem 0.6rem;
    align-items: center;
    padding: 0.7rem 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    text-decoration: none;
    color: inherit;
    background: rgba(17, 24, 39, 0.02);
}

.notifications-link:hover,
.notifications-link:focus {
    border-color: rgba(18, 69, 89, 0.3);
    background: rgba(18, 69, 89, 0.1);
    text-decoration: none;
}

.notifications-title {
    font-weight: 600;
    color: var(--text);
}

.notifications-count {
    justify-self: end;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: rgba(18, 69, 89, 0.18);
    color: var(--primary-dark);
    font-size: 0.85rem;
    font-weight: 600;
}

.notifications-meta {
    grid-column: 1 / -1;
    font-size: 0.78rem;
    color: var(--muted);
}

.notifications-snippet {
    grid-column: 1 / -1;
    font-size: 0.8rem;
    color: var(--text);
    font-style: italic;
}

.notifications-muted,
.notifications-empty {
    margin: 0;
    color: var(--muted);
}

.notifications-settings-note {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.search-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.search-form {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.6rem;
}

@media (max-width: 640px) {
    .stats-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-page {
        padding: 1.5rem;
    }
}

.search-results-group--form {
    gap: 0.75rem;
}

.search-form-input {
    flex: 1 1 auto;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    font: inherit;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.search-form-input:focus {
    outline: 2px solid rgba(18, 69, 89, 0.3);
    outline-offset: 1px;
}

.search-form-button {
    padding: 0 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: 8px;
    flex: 0 0 auto;
}
.search-hint {
    color: var(--muted);
    margin: 0;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.search-results-group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.search-results-group h2 {
    margin-top: 0;
    margin-bottom: 0.2rem;
}

.search-result-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.search-result-list li {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.search-result-list a {
    color: inherit;
    text-decoration: none;
}

.search-result-list a:hover,
.search-result-list a:focus {
    color: var(--primary);
    text-decoration: underline;
}

.search-result-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.search-result-snippet {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

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

.search-result-list li {
    background: rgba(18, 69, 89, 0.04);
    border: 1px solid rgba(18, 69, 89, 0.1);
    border-radius: 6px;
    padding: 0.75rem 0.9rem;
}

.search-result-list li:hover,
.search-result-list li:focus-within {
    border-color: rgba(18, 69, 89, 0.3);
    background: rgba(18, 69, 89, 0.08);
}

.search-result-list a {
    font-weight: 600;
}

@media (max-width: 900px) {
    .profile-body {
        grid-template-columns: 1fr;
    }

    .chat-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .profile-hero-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-identity {
        align-items: center;
    }

    .profile-posts--spotlight .profile-post-card {
        grid-template-columns: 1fr;
    }

    .comment-thread-row {
        padding-left: calc(var(--comment-depth) * 1.2rem + 0.5rem);
    }
}

@media (max-width: 520px) {
    .profile-post-card {
        padding: 1rem;
    }

    .reaction-buttons {
        width: 100%;
    }

    .reaction-button {
        flex: 1 1 auto;
        justify-content: center;
    }

    .comment-card {
        padding: 0.75rem;
    }

    .comment-thread-row {
        padding-left: calc(var(--comment-depth) * 1rem + 0.4rem);
    }
}

.space-selector {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    background-color: #fafafa;
}

.space-selector .form-note {
    flex-basis: 100%;
    margin: 0;
}

.input-static {
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f7f7f7;
}

.input-static.muted {
    color: #777;
    font-style: italic;
}

.post-media-gallery {
    margin: 1.5rem 0 0;
    padding: 1.5rem 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.post-media-gallery h2 {
    margin-top: 0;
    font-size: 1.1rem;
}

.media-gallery {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.media-gallery-item {
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    padding: 1rem;
    background-color: #fff;
}

.media-gallery-item figure {
    margin: 0;
}

.space-folders {
    margin: 1.5rem 0;
    padding: 1rem;
    border: 1px solid #eee;
    border-radius: 12px;
    background-color: #fdfdfd;
}

.space-folder-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.space-folder-list a {
    text-decoration: none;
}

.space-folders-note {
    margin-top: 0.5rem;
    color: #6d6d6d;
    font-size: 0.9rem;
}

.space-home {
    margin: 1.5rem 0 0;
    padding: 1.5rem;
    border: 1px solid #eee;
    border-radius: 12px;
    background-color: #fff;
}

.space-home-content > *:first-child {
    margin-top: 0;
}

.space-home-content > *:last-child {
    margin-bottom: 0;
}

.space-home-empty {
    margin: 0;
    color: #666;
    font-style: italic;
}

.space-home-preview {
    margin-top: 1rem;
}

.space-home-preview summary {
    cursor: pointer;
    font-weight: 600;
}

.space-home-preview-body {
    margin-top: 0.75rem;
    padding: 1rem;
    border: 1px dashed #dadada;
    border-radius: 10px;
    background-color: #fafafa;
}

.markdown-content p {
    line-height: 1.6;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.markdown-content audio,
.markdown-content video {
    width: 100%;
    max-width: 640px;
    margin: 0.5rem auto;
    display: block;
}

.markdown-content video {
    max-height: 360px;
    object-fit: contain;
}

.markdown-content audio {
    border-radius: 8px;
    background-color: #f4f4f4;
}

.post-folder-label {
    font-size: 0.9rem;
    color: #5c5c5c;
    margin: 0.2rem 0 0.5rem;
}

.folder-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.folder-list-item {
    border: 1px solid #e4e4e4;
    border-radius: 12px;
    padding: 1rem;
    background-color: #fafafa;
}

.folder-description {
    margin: 0.2rem 0 0.4rem;
    color: #555;
}

.folder-meta {
    font-size: 0.85rem;
    color: #7a7a7a;
    margin-bottom: 0.75rem;
}

.folder-form,
.folder-delete-form {
    margin-top: 0.5rem;
}

.folder-delete-form {
    border-top: 1px dashed #ddd;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.post-card-media {
    margin-top: 0.75rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
    list-style: none;
    padding: 0;
}

.post-card-media-item {
    display: flex;
    flex-direction: column;
    border: 1px solid #ececec;
    border-radius: 10px;
    padding: 0.75rem;
    background-color: #fafafa;
    gap: 0.5rem;
}

.post-card-media-item img {
    width: 100%;
    border-radius: 8px;
    display: block;
}

.post-card-media-item audio,
.post-card-media-item video {
    width: 100%;
}

.post-card-image {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.post-card-media audio,
.post-card-media video,
.media-gallery-item audio,
.media-gallery-item video,
.post-body audio,
.post-body video {
    width: 100%;
    max-width: 640px;
    margin: 0.25rem auto 0;
    display: block;
    border-radius: 10px;
    background-color: #f4f4f4;
}

.post-card-media video,
.media-gallery-item video,
.post-body video {
    max-height: 360px;
    object-fit: contain;
    background-color: #000;
}
