:root {
    color-scheme: dark;
    --bg: #0f1316;
    --surface: #171c1f;
    --surface-2: #1f2a26;
    --text: #f3f5f4;
    --muted: #aab4b2;
    --line: #2d373a;
    --accent: #65d1c8;
    --accent-2: #8d6df2;
    --danger: #ff7d93;
    --shadow: 0 18px 50px rgba(0, 0, 0, .35);
}

[data-theme="light"] {
    color-scheme: light;
    --bg: #f7f5f1;
    --surface: #ffffff;
    --surface-2: #eef6f4;
    --text: #161a1d;
    --muted: #66706f;
    --line: #d9dedb;
    --accent: #0d7c73;
    --accent-2: #6f56d9;
    --danger: #c4475d;
    --shadow: 0 18px 50px rgba(26, 36, 34, .12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 66px;
    padding: 10px clamp(16px, 3vw, 42px);
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 21px;
    font-weight: 900;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    font-size: 24px;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
    color: var(--muted);
    font-size: 16px;
}

.topnav a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.top-search {
    display: flex;
    align-items: center;
    gap: 6px;
    width: min(360px, 28vw);
    margin-left: auto;
}

.top-search input {
    min-height: 38px;
}

.top-search .button {
    min-height: 38px;
    padding: 8px 11px;
}

.topnav a:hover {
    color: var(--text);
}

.nav-button {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 0;
    cursor: pointer;
    font: inherit;
}

.nav-button:hover {
    color: var(--text);
}

.user-menu {
    position: relative;
}

.avatar-button {
    display: grid;
    place-items: center;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    cursor: pointer;
    overflow: hidden;
    flex: none;
}

.avatar-button img {
    display: block;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    display: none;
    min-width: 220px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 40;
}

.user-menu.open .user-dropdown {
    display: grid;
}

.user-dropdown a,
.user-dropdown button {
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    padding: 12px 14px;
    text-align: left;
    font: inherit;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background: var(--surface-2);
}

.icon-button,
.button,
.mini-button {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font: inherit;
}

.icon-button {
    width: 50px;
    height: 50px;
    font-weight: 900;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    font-weight: 800;
}

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

.button.ghost {
    background: transparent;
}

.button.wide {
    width: 100%;
}

main {
    width: min(1720px, 100%);
    margin: 0 auto;
    padding: 24px clamp(16px, 4vw, 72px);
}

.single-post-main {
    width: min(1160px, 100%);
}

.post-page .single-post-main {
    width: min(900px, 100%);
}

.post-page .video-embed,
.post-page .feed-media {
    max-height: 520px;
}

.post-page .post-content {
    font-size: clamp(16px, 1.15vw, 19px);
}

.single-post-main .feed-card {
    overflow: visible;
}

.app-shell main {
    padding-top: 24px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 28px;
    align-items: stretch;
    min-height: 520px;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(28px, 6vw, 72px);
    border-radius: 8px;
    background: linear-gradient(120deg, #0d7c73, #c4475d);
    color: #fff;
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 8px;
    color: color-mix(in srgb, currentColor 68%, transparent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 780px;
    margin-bottom: 18px;
    font-size: clamp(40px, 7vw, 86px);
    line-height: .95;
}

h2 {
    margin-bottom: 12px;
    font-size: 30px;
}

.lead {
    max-width: 700px;
    font-size: clamp(18px, 2vw, 22px);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.auth-panel,
.panel,
.chat-panel,
.locked-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.auth-panel {
    align-self: center;
    padding: 22px;
}

.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 18px;
}

.tab {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 800;
}

.tab.active {
    background: var(--surface-2);
    color: var(--text);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: grid;
    gap: 13px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0d1113;
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
}

textarea {
    width: 100%;
    min-height: 110px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0d1113;
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
    resize: vertical;
}

.composer {
    margin-bottom: 18px;
}

.composer .feed-body {
    display: grid;
    gap: 10px;
}

.composer-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--muted);
}

.composer-tabs label,
.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.composer-tabs input,
.inline-check input {
    width: auto;
    min-height: auto;
}

[data-theme="light"] input {
    background: var(--bg);
}

.notice,
.muted,
.form-message {
    color: var(--muted);
    font-size: 14px;
}

.captcha-wrap {
    overflow: hidden;
}

.features {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 24px 0;
}

.features article {
    display: grid;
    gap: 6px;
    min-height: 136px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.features span {
    color: var(--muted);
    font-size: 14px;
}

.layout {
    display: grid;
    grid-template-columns: 260px minmax(480px, 820px);
    gap: 22px;
    align-items: start;
}

.chat-layout {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 22px;
}

.chat-layout .chat-panel {
    position: static;
}

.profile-hero {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    margin-bottom: 22px;
}

.profile-cover {
    min-height: 220px;
    background: linear-gradient(120deg, #0d7c73, #c4475d);
}

.profile-info {
    display: flex;
    align-items: flex-end;
    gap: 18px;
    padding: 0 22px 22px;
    margin-top: -44px;
}

.profile-info .avatar {
    width: 104px;
    height: 104px;
    border: 4px solid var(--surface);
}

.profile-actions {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.rail,
.chat-panel {
    position: sticky;
    top: 90px;
}

.panel,
.chat-panel {
    padding: 22px;
}

.panel h2 {
    font-size: 30px;
}

.panel ul {
    margin: 22px 0 0;
    padding-left: 22px;
    color: var(--muted);
    font-size: 20px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 26px;
}

.section-head.compact {
    margin-bottom: 22px;
}

.section-head .button {
    min-width: 120px;
    min-height: 60px;
    font-size: 20px;
}

.feed {
    display: grid;
    gap: 18px;
}

.feed-card {
    display: grid;
    gap: 0;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

.feed:not(.feed-grid) .feed-card {
    grid-template-columns: minmax(220px, 34%) minmax(0, 1fr);
}

.feed:not(.feed-grid) .feed-top {
    grid-column: 1 / -1;
}

.feed:not(.feed-grid) .comments-box,
.feed:not(.feed-grid) .video-embed {
    grid-column: 1 / -1;
}

.feed:not(.feed-grid) .feed-media {
    align-self: stretch;
    height: 100%;
    min-height: 190px;
}

.feed:not(.feed-grid) .feed-media img,
.feed:not(.feed-grid) .feed-media video,
.feed:not(.feed-grid) .feed-media iframe {
    height: 100%;
    max-height: none;
    object-fit: contain;
}

.feed:not(.feed-grid) .text-only-card {
    grid-template-columns: 1fr;
}

.feed:not(.feed-grid) .feed-card:not(:has(.feed-media)) {
    grid-template-columns: 1fr;
}

.feed-card.video-card {
    border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
    background: #050606;
}

.feed-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.feed-author {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.feed-author div {
    min-width: 0;
}

.feed-author strong,
.feed-author span {
    overflow-wrap: anywhere;
}

.feed-author strong {
    color: var(--text);
}

.feed-author span,
.feed-date {
    color: var(--muted);
    font-weight: 700;
}

.feed-date {
    flex: none;
    white-space: nowrap;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--surface-2);
    object-fit: cover;
    flex: none;
}

.feed-media {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.feed-media button {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: #000;
    cursor: pointer;
}

.feed-media img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 360px;
    object-fit: contain;
    background: #000;
}

.feed-media audio {
    width: 100%;
    padding: 22px;
}

.feed-placeholder {
    display: grid;
    place-items: center;
    min-height: 220px;
    background: var(--surface-2);
    color: var(--accent);
    font-size: 44px;
    font-weight: 900;
}

.feed-body {
    padding: 16px 18px 18px;
    min-width: 0;
}

.feed-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 14px;
}

.badge {
    border-radius: 999px;
    background: #132622;
    color: var(--accent);
    padding: 3px 10px;
    font-weight: 900;
}

[data-theme="light"] .badge {
    background: var(--surface-2);
}

.feed-card h3 {
    margin: 0 0 10px;
    font-size: clamp(19px, 1.6vw, 24px);
    line-height: 1.25;
}

.feed-card p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: clamp(15px, 1.2vw, 18px);
}

.groups-grid,
.feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    align-items: start;
}

.feed-grid .feed-card .feed-top {
    align-items: flex-start;
    min-height: 74px;
    padding: 12px;
    overflow: hidden;
}

.feed-grid .feed-author {
    align-items: flex-start;
}

.feed-grid .feed-author div {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.feed-grid .feed-date {
    display: none;
}

.feed-grid .avatar {
    width: 30px;
    height: 30px;
}

.feed-grid .feed-card h3 {
    display: -webkit-box;
    overflow: hidden;
    min-height: 44px;
    margin-bottom: 0;
    font-size: 17px;
    line-height: 1.28;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.feed-grid .feed-body {
    padding: 12px;
}

.feed-grid .feed-meta {
    margin-bottom: 8px;
}

.feed-grid .desc-link {
    display: none;
}

.title-link.only-grid {
    display: none;
}

.feed-grid .title-link.only-grid {
    display: block;
}

.feed-grid .feed-media {
    aspect-ratio: 16 / 9;
}

.feed-grid .feed-media img {
    max-height: none;
    object-fit: cover;
}

.feed-grid .feed-placeholder {
    min-height: 130px;
}

.feed-grid .feed-actions {
    gap: 8px;
    margin-top: 10px;
}

.feed-grid .mini-button {
    min-height: 34px;
    padding: 2px 4px;
    font-size: 17px;
}

.feed:not(.feed-grid) .feed-card {
    grid-template-columns: 1fr;
}

.feed:not(.feed-grid) .feed-media {
    width: min(780px, 74%);
    height: auto;
    min-height: 0;
    margin: 16px auto 0;
    aspect-ratio: auto;
    border-radius: 10px;
    background: transparent;
}

.feed:not(.feed-grid) .feed-media button {
    height: auto;
    border-radius: 10px;
    overflow: hidden;
}

.feed:not(.feed-grid) .feed-media img {
    width: 100%;
    height: auto;
    max-height: 620px;
    border-radius: 10px;
    object-fit: contain;
}

.feed:not(.feed-grid) .feed-media:has(iframe),
.feed:not(.feed-grid) .feed-media:has(video) {
    aspect-ratio: 16 / 9;
    background: #000;
}

.feed:not(.feed-grid) .feed-media:has(iframe) iframe,
.feed:not(.feed-grid) .feed-media:has(video) video {
    height: 100%;
}

.view-switch {
    display: flex;
    gap: 10px;
    margin: 14px 0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.info-grid span {
    display: grid;
    gap: 4px;
    color: var(--muted);
}

.info-grid strong {
    color: var(--text);
}

.settings-grid,
.content-sections {
    display: grid;
    gap: 18px;
}

.settings-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.settings-form label.full,
.settings-form .form-message,
.settings-form .form-actions {
    grid-column: 1 / -1;
}

.content-editor {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.content-preview {
    display: grid;
    gap: 12px;
}

.content-thumb {
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.content-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.content-thumb span {
    color: var(--accent);
    font-size: 42px;
    font-weight: 900;
}

.content-summary {
    display: grid;
    gap: 8px;
}

.content-summary h3 {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.content-summary p {
    margin: 0;
}

.content-summary p:not(.muted) {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.content-editor form {
    display: grid;
    gap: 10px;
}

.content-editor form[hidden] {
    display: none;
}

.content-editor.editing .content-preview {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.danger-zone {
    border-color: color-mix(in srgb, var(--danger) 60%, var(--line));
}

.post-link {
    display: block;
}

.post-link:hover h3,
.post-link:hover p {
    color: var(--accent);
}

.feed-actions {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 18px;
}

.mini-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--text);
    padding: 4px 8px;
    font-size: 22px;
    font-weight: 800;
}

.mini-button.active {
    color: var(--danger);
}

.share-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    display: grid;
    min-width: 170px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 5;
}

.share-menu[hidden] {
    display: none;
}

.share-menu a,
.share-menu button {
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    padding: 10px 12px;
    text-align: left;
    font: inherit;
}

.share-menu a:hover,
.share-menu button:hover {
    background: var(--surface-2);
}

.comments-box {
    display: none;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding: 14px 18px 18px;
}

.comments-box.open {
    display: grid;
}

.comment-list {
    display: grid;
    gap: 8px;
}

.comment {
    border-radius: 8px;
    background: var(--surface-2);
    padding: 10px 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.comment strong {
    display: block;
    font-size: 13px;
}

.comment p {
    margin: 3px 0 6px;
    color: var(--text);
    font-size: 15px;
}

.comment-main {
    min-width: 0;
    flex: 1;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-action {
    min-height: 28px;
    padding: 0;
    font-size: 14px;
}

.comment.reply {
    margin-top: 8px;
    margin-left: 28px;
    background: color-mix(in srgb, var(--surface-2) 78%, #000);
}

.reply-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-top: 8px;
}

.reply-form[hidden] {
    display: none;
}

.replies {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.comment-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.video-embed {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #000;
}

.video-embed iframe,
.video-embed video,
.feed-media iframe,
.feed-media video {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
    background: #000;
}

.post-content {
    color: var(--muted);
    font-size: clamp(17px, 1.5vw, 21px);
    line-height: 1.52;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: normal;
}

.post-content * {
    box-sizing: border-box;
    max-width: 100%;
    white-space: normal;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    color: var(--text);
    line-height: 1.18;
    margin: 1.05em 0 .45em;
}

.post-content h1 {
    font-size: clamp(28px, 3vw, 42px);
}

.post-content h2 {
    font-size: clamp(24px, 2.4vw, 34px);
}

.post-content p,
.post-content div {
    margin-bottom: .85em;
}

.post-content ul,
.post-content ol {
    margin: 1em 0;
    padding-left: 1.5em;
}

.post-content a {
    color: var(--accent);
    text-decoration: underline;
}

.post-content img {
    display: block;
    max-width: 100% !important;
    height: auto !important;
    margin: 16px auto;
    border-radius: 8px;
}

.post-content iframe,
.post-content video {
    display: block;
    width: 100% !important;
    aspect-ratio: 16 / 9;
    height: auto !important;
    min-height: 260px;
    border: 0;
    border-radius: 8px;
    background: #000;
}

.post-content table {
    display: block;
    width: 100% !important;
    overflow-x: auto;
    border-collapse: collapse;
}

.post-content pre,
.post-content code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.people {
    display: grid;
    gap: 10px;
    max-height: 224px;
    margin: 12px 0;
    overflow: auto;
    padding-right: 4px;
}

.person {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 64px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    padding: 8px 10px;
    cursor: pointer;
    text-align: left;
}

.person.active {
    border-color: var(--accent);
    background: var(--surface-2);
}

.messages {
    display: grid;
    gap: 10px;
    min-height: 360px;
    max-height: 470px;
    margin: 14px 0;
    overflow: auto;
    padding-right: 6px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.message {
    justify-self: start;
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--surface-2);
    font-size: 18px;
}

.message.mine {
    justify-self: end;
    background: var(--accent);
    color: #061312;
}

.message small {
    display: block;
    opacity: .72;
    margin-top: 4px;
    font-size: 14px;
}

.chat-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.locked-panel {
    margin-top: 24px;
    padding: 24px;
    text-align: center;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 20px clamp(16px, 4vw, 44px) 34px;
    color: var(--muted);
    font-size: 14px;
}

@media (max-width: 1320px) {
    .layout {
        grid-template-columns: 240px minmax(0, 1fr) 360px;
    }
}

@media (max-width: 1120px) {
    .hero,
    .layout {
        grid-template-columns: 1fr;
    }

    .rail,
    .chat-panel {
        position: static;
    }

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

@media (max-width: 680px) {
    .topbar {
        gap: 10px;
        flex-wrap: nowrap;
    }

    .brand span:last-child {
        display: none;
    }

    .topnav {
        display: flex;
        gap: 8px;
        margin-left: 0;
        font-size: 18px;
    }

    .topnav .nav-label {
        display: none;
    }

    .topnav a {
        width: 36px;
        height: 36px;
        justify-content: center;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--surface);
    }

    .top-search {
        position: relative;
        width: 42px;
        margin-left: auto;
        flex: none;
        transition: width .18s ease;
        z-index: 45;
    }

    .top-search input {
        width: 0;
        min-width: 0;
        padding-left: 0;
        padding-right: 0;
        border-color: transparent;
        opacity: 0;
        pointer-events: none;
        transition: width .18s ease, opacity .18s ease, padding .18s ease;
    }

    .top-search .button {
        width: 42px;
        min-width: 42px;
        padding: 8px 0;
    }

    .top-search.open {
        position: absolute;
        left: 12px;
        right: 12px;
        width: auto;
        margin-left: 0;
        background: var(--bg);
    }

    .top-search.open input {
        width: 100%;
        padding-left: 12px;
        padding-right: 12px;
        border-color: var(--line);
        opacity: 1;
        pointer-events: auto;
    }

    main {
        padding: 16px;
    }

    .feed:not(.feed-grid) .feed-card {
        grid-template-columns: 1fr;
    }

    .feed:not(.feed-grid) .feed-media {
        height: auto;
        min-height: 0;
    }

    .hero-copy {
        padding: 28px;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .feed-top,
    .feed-body,
    .comments-box {
        padding-left: 12px;
        padding-right: 12px;
    }

    .feed-card h3 {
        font-size: 22px;
    }

    .settings-form {
        grid-template-columns: 1fr;
    }

    .footer {
        flex-direction: column;
    }
}

.cookie-banner {
    position: fixed;
    left: 18px;
    right: 18px;
    bottom: 18px;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 920px;
    margin: 0 auto;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.cookie-banner[hidden] {
    display: none;
}

.cookie-banner p {
    margin: 4px 0 0;
    color: var(--muted);
}

.cookie-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
}

@media (max-width: 680px) {
    .cookie-banner {
        flex-direction: column;
        align-items: stretch;
    }
}
