:root {
    color-scheme: dark;
    --x-bg: #000;
    --x-panel: #000;
    --x-panel-soft: #07090c;
    --x-border: #2f3336;
    --x-border-soft: rgba(47, 51, 54, 0.72);
    --x-text: #e7e9ea;
    --x-muted: #71767b;
    --x-blue: #1d9bf0;
    --x-blue-soft: rgba(29, 155, 240, 0.16);
    --x-green: #00ba7c;
    --x-pink: #f91880;
    --x-yellow: #ffd400;
    --x-purple: #8b5cf6;
    --x-orange: #ff7a3d;
    --x-radius: 16px;
    --x-sidebar: 300px;
    --x-rail: 300px;
    --x-feed: 640px;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--x-bg);
    overflow-x: clip;
}

body.cranial-scroll-page {
    margin: 0;
    min-height: 100vh;
    background: var(--x-bg);
    color: var(--x-text);
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    line-height: 1.35;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
}

a {
    color: inherit;
}

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

.x-shell {
    display: grid;
    grid-template-columns: minmax(88px, var(--x-rail)) minmax(0, var(--x-feed)) minmax(0, var(--x-sidebar));
    justify-content: center;
    min-height: 100vh;
}

.x-rail,
.x-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden auto;
    scrollbar-width: thin;
    scrollbar-color: var(--x-border) transparent;
}

.x-rail {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 16px 24px 24px 0;
    border-right: 1px solid var(--x-border);
}

.x-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 58px;
    border-radius: 999px;
    color: var(--x-text);
    font-size: 53px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0;
    text-decoration: none;
}

.x-logo:hover,
.x-nav-item:hover {
    background: rgba(239, 243, 244, 0.1);
}

.x-nav {
    width: 72px;
    margin-top: 22px;
    display: grid;
    justify-items: center;
    gap: 9px;
}

.x-nav-item {
    position: relative;
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: var(--x-text);
    text-decoration: none;
    cursor: pointer;
}

.x-icon {
    width: 32px;
    height: 32px;
    display: block;
    fill: currentColor;
}

.x-nav-x .x-icon {
    width: 34px;
    height: 34px;
}

.x-nav-item.is-active {
    font-weight: 700;
}

.x-nav-dot {
    position: absolute;
    top: 9px;
    right: 10px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--x-blue);
    border: 2px solid #000;
}

.x-badge {
    position: absolute;
    top: 4px;
    right: 1px;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--x-blue);
    color: #fff;
    border: 2px solid #000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
}

.compose-button {
    width: 78px;
    height: 78px;
    margin-top: 18px;
    border: 0;
    border-radius: 999px;
    background: #eff3f4;
    color: #0f1419;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.compose-button:hover {
    background: #d7dbdc;
}

.compose-icon {
    width: 34px;
    height: 34px;
    fill: currentColor;
}

.rail-profile {
    width: 72px;
    height: 72px;
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rail-profile-avatar {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    background:
        radial-gradient(circle at 35% 30%, rgba(99, 211, 255, 0.95), transparent 28%),
        radial-gradient(circle at 70% 70%, rgba(141, 92, 246, 0.95), transparent 34%),
        linear-gradient(140deg, #12345d, #0b1024);
}

.x-main {
    min-height: 100vh;
    border-right: 1px solid var(--x-border);
}

.feed-top {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(0, 0, 0, 0.86);
    border-bottom: 1px solid var(--x-border);
    backdrop-filter: blur(12px);
}

.feed-title-row {
    min-height: 60px;
    padding: 10px 16px 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.feed-title-row h1 {
    margin: 0;
    font-size: 20px;
    line-height: 1.1;
    letter-spacing: 0;
}

.feed-title-row p {
    margin: 2px 0 0;
    color: var(--x-muted);
    font-size: 13px;
}

.back-button {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--x-text);
    font-size: 22px;
    cursor: pointer;
}

.back-button:hover {
    background: rgba(239, 243, 244, 0.1);
}

.feed-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
}

.feed-tab {
    position: relative;
    min-height: 52px;
    border: 0;
    background: transparent;
    color: var(--x-muted);
    font-weight: 700;
    cursor: pointer;
}

.feed-tab:hover {
    background: rgba(239, 243, 244, 0.06);
}

.feed-tab.is-active {
    color: var(--x-text);
}

.feed-tab.is-active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 56px;
    height: 4px;
    border-radius: 999px;
    background: var(--x-blue);
    transform: translateX(-50%);
}

.composer-card {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--x-border);
}

.composer-card p {
    margin: 0;
    color: var(--x-muted);
    font-size: 15px;
}

.feed-list {
    min-height: 60vh;
}

.post {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--x-border);
    background: var(--x-panel);
    cursor: pointer;
    transition: background 120ms ease;
}

.post:hover {
    background: rgba(255, 255, 255, 0.025);
}

.post.is-detail {
    cursor: default;
    padding-top: 16px;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgb(var(--avatar-rgb, 29 155 240));
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    flex: 0 0 auto;
}

.avatar-compose {
    --avatar-rgb: 29 155 240;
}

.post-main {
    min-width: 0;
}

.post-head {
    display: flex;
    align-items: baseline;
    gap: 4px;
    min-width: 0;
}

.display-name {
    font-weight: 800;
    color: var(--x-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.verified {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border-radius: 999px;
    background: var(--x-blue);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    flex: 0 0 auto;
}

.handle,
.dot,
.time {
    color: var(--x-muted);
    min-width: 0;
}

.handle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-menu {
    margin-left: auto;
    color: var(--x-muted);
    font-weight: 800;
}

.post-text {
    margin: 3px 0 0;
    color: var(--x-text);
    font-size: 15px;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.post-text strong {
    font-weight: 800;
}

.post-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.post-tag {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    border: 1px solid rgba(var(--tag-rgb, 29 155 240), 0.42);
    color: rgb(var(--tag-rgb, 29 155 240));
    background: rgba(var(--tag-rgb, 29 155 240), 0.1);
    font-size: 12px;
    font-weight: 700;
}

.media-frame {
    margin-top: 12px;
    border: 1px solid var(--x-border);
    border-radius: var(--x-radius);
    overflow: hidden;
    background: var(--x-panel-soft);
}

.media-frame img {
    display: block;
    width: 100%;
    max-height: 430px;
    object-fit: cover;
    background: #050505;
}

.media-frame.media-source img {
    object-fit: contain;
}

.media-caption {
    margin: 0;
    padding: 10px 12px;
    border-top: 1px solid var(--x-border);
    color: var(--x-muted);
    font-size: 13px;
}

.action-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    margin-top: 10px;
    max-width: 520px;
}

.action-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--x-muted);
    padding: 0;
    font-size: 13px;
    cursor: pointer;
}

.action-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    line-height: 1;
}

.action-button:hover .action-icon {
    background: var(--x-blue-soft);
    color: var(--x-blue);
}

.action-button.repost:hover .action-icon {
    background: rgba(0, 186, 124, 0.14);
    color: var(--x-green);
}

.action-button.like:hover .action-icon,
.action-button.like.is-on .action-icon {
    background: rgba(249, 24, 128, 0.14);
    color: var(--x-pink);
}

.action-button.bookmark:hover .action-icon,
.action-button.bookmark.is-on .action-icon {
    background: var(--x-blue-soft);
    color: var(--x-blue);
}

.thread {
    border-bottom: 1px solid var(--x-border);
}

.reply {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--x-border-soft);
    background: #000;
}

.reply p {
    margin: 4px 0 0;
    color: var(--x-text);
    font-size: 15px;
}

.show-replies {
    width: calc(100% - 32px);
    margin: 12px 16px 16px;
    min-height: 42px;
    border: 1px solid var(--x-border);
    border-radius: 999px;
    background: transparent;
    color: var(--x-blue);
    font-weight: 800;
    cursor: pointer;
}

.show-replies:hover {
    background: var(--x-blue-soft);
}

.empty-state {
    padding: 34px 16px;
    border-bottom: 1px solid var(--x-border);
}

.empty-state h2 {
    margin: 0;
    font-size: 24px;
}

.empty-state p {
    margin: 8px 0 0;
    color: var(--x-muted);
}

.x-sidebar {
    padding: 14px 0 24px 30px;
}

.search-box {
    position: sticky;
    top: 0;
    z-index: 5;
    min-height: 54px;
    padding: 0 18px;
    border: 1px solid var(--x-border);
    border-radius: 999px;
    background: #000;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box:focus-within {
    border-color: var(--x-blue);
}

.search-box span {
    color: var(--x-muted);
    font-size: 22px;
}

.search-box input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--x-text);
    font-size: 15px;
}

.side-panel {
    margin-top: 16px;
    border: 1px solid var(--x-border);
    border-radius: var(--x-radius);
    overflow: hidden;
    background: #000;
}

.side-panel h2 {
    margin: 0;
    padding: 16px 16px 8px;
    font-size: 21px;
    letter-spacing: 0;
}

.side-panel-tight {
    padding-bottom: 14px;
}

.side-panel-tight p {
    margin: 0;
    padding: 0 16px;
    color: var(--x-muted);
}

.trend,
.follow-account {
    padding: 12px 16px;
    border-top: 1px solid transparent;
}

.trend:hover,
.follow-account:hover {
    background: rgba(255, 255, 255, 0.035);
}

.trend-kicker,
.trend-count,
.follow-handle {
    color: var(--x-muted);
    font-size: 13px;
}

.trend-title,
.follow-name {
    margin-top: 2px;
    color: var(--x-text);
    font-weight: 800;
}

.follow-account {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.follow-meta {
    min-width: 0;
}

.follow-name,
.follow-handle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.follow-button {
    min-height: 34px;
    padding: 0 17px;
    border: 0;
    border-radius: 999px;
    background: var(--x-text);
    color: #000;
    font-weight: 800;
}

.loading-posts {
    padding: 28px 16px;
    color: var(--x-muted);
}

.feed-loader {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-bottom: 1px solid var(--x-border);
    color: var(--x-muted);
    font-size: 14px;
}

.feed-loader:not(.is-loading) {
    min-height: 26px;
    color: transparent;
    pointer-events: none;
}

.feed-loader:not(.is-loading) .feed-loader-spinner,
.feed-loader:not(.is-loading) span {
    opacity: 0;
}

.feed-loader-spinner {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 3px solid rgba(29, 155, 240, 0.25);
    border-top-color: var(--x-blue);
    animation: feed-spin 700ms linear infinite;
}

@keyframes feed-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1120px) {
    .x-shell {
        grid-template-columns: 88px minmax(0, var(--x-feed)) minmax(0, 280px);
    }

    .x-rail {
        align-items: center;
        padding: 16px 0 24px;
    }

    .x-logo,
    .x-nav,
    .rail-profile {
        width: 64px;
    }

    .compose-button {
        width: 58px;
        height: 58px;
    }

    .compose-icon {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 880px) {
    .x-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .x-rail,
    .x-sidebar {
        display: none;
    }

    .x-main {
        border-left: 1px solid var(--x-border);
    }
}

@media (max-width: 560px) {
    .feed-title-row {
        min-height: 54px;
    }

    .feed-tabs {
        overflow-x: auto;
        grid-template-columns: repeat(5, minmax(96px, 1fr));
    }

    .post,
    .reply,
    .composer-card {
        grid-template-columns: 38px minmax(0, 1fr);
        gap: 10px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .avatar {
        width: 38px;
        height: 38px;
        font-size: 12px;
    }

    .post-text,
    .reply p {
        font-size: 14px;
    }

    .media-frame img {
        max-height: 330px;
    }

    .action-row {
        grid-template-columns: repeat(5, minmax(38px, 1fr));
    }

    .action-button span:last-child {
        display: none;
    }
}
