@font-face {
    font-family: "TwitterChirp";
    src:
        local("TwitterChirp"),
        local("TwitterChirp Regular"),
        local("Twitter Chirp"),
        local("Chirp");
    font-display: swap;
}

:root {
    --bg-color: oklch(0.11 0.01 250);
    --bg-elevated: oklch(0.135 0.012 250);
    --bg-floating: #000;
    --bg-rail: #000;
    --bg-soft: color-mix(in oklab, var(--bg-color) 82%, white 18%);
    --border-color: oklch(0.28 0.014 250);
    --border-soft: rgba(255, 255, 255, 0.08);
    --text-primary: oklch(0.93 0.01 250);
    --text-secondary: oklch(0.64 0.014 250);
    --text-tertiary: oklch(0.56 0.012 250);
    --accent-color: oklch(0.67 0.16 243);
    --accent-hover: oklch(0.62 0.16 243);
    --danger-color: oklch(0.65 0.19 20);
    --repost-color: #00ba7c;
    --like-color: #f91880;
    --hover-bg: color-mix(in oklab, white 4%, transparent);
    --icon-hover-blue: color-mix(in oklab, var(--accent-color) 14%, transparent);
    --icon-hover-green: rgba(0, 186, 124, 0.14);
    --icon-hover-pink: rgba(249, 24, 128, 0.14);
    --font-family: "TwitterChirp", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
    --shadow-menu: 0 0 0 1px rgba(255,255,255,0.04), 0 12px 32px rgba(0, 0, 0, 0.45);
    --shadow-popover: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    color-scheme: dark;
}

body {
    background:
        radial-gradient(circle at top, rgba(29, 155, 240, 0.08), transparent 28%),
        var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
textarea {
    font: inherit;
}

.app-shell {
    width: min(1265px, calc(100vw - 24px));
    margin: 0 auto;
    display: grid;
    grid-template-columns: 275px minmax(0, 1fr) 350px;
    gap: 0;
}

.left-rail,
.right-rail {
    min-height: 100vh;
    position: sticky;
    top: 0;
    align-self: start;
    padding: 12px 16px;
    background: var(--bg-rail);
}

.left-rail {
    border-right: 1px solid var(--border-color);
}

.right-rail {
    border-left: 1px solid var(--border-color);
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.brand-mark:hover {
    background: var(--hover-bg);
}

.brand-mark svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
}

.side-nav {
    margin-top: 4px;
    display: grid;
    gap: 2px;
}

.side-nav-item {
    width: max-content;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 18px;
    min-height: 52px;
    padding: 0 20px 0 14px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
}

.side-nav-item span:last-child {
    font-size: 1.35rem;
    line-height: 1;
    letter-spacing: -0.03em;
}

.side-nav-item:hover {
    background: var(--hover-bg);
}

.side-nav-item-active span:last-child {
    font-weight: 800;
}

.side-nav-icon {
    width: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
}

.side-nav-icon svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.side-post-btn {
    width: 100%;
    height: 52px;
    margin-top: 16px;
    border: none;
    border-radius: 999px;
    background: #eff3f4;
    color: #0f1419;
    font-size: 1.22rem;
    font-weight: 800;
    cursor: pointer;
}

.side-post-btn:hover {
    background: #d7dbdc;
}

.side-profile {
    margin-top: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 999px;
}

.side-profile:hover {
    background: var(--hover-bg);
}

.side-profile-copy {
    flex: 1;
    min-width: 0;
    display: grid;
}

.side-profile-copy strong,
.rail-person strong {
    font-size: 15px;
}

.side-profile-copy span,
.rail-person span {
    color: var(--text-secondary);
    font-size: 15px;
}

.side-profile-more {
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
}

.search-card,
.rail-card {
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: #000;
}

.search-card {
    height: 52px;
    margin-bottom: 16px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
}

.search-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
}

.search-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.rail-card {
    padding: 16px;
    margin-bottom: 16px;
}

.rail-card h3 {
    margin-bottom: 16px;
    font-size: 31px;
    line-height: 36px;
    letter-spacing: -0.03em;
}

.rail-person {
    display: flex;
    gap: 12px;
}

.rail-person strong {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.rail-person p,
.live-item p {
    margin-top: 4px;
    color: var(--text-primary);
    font-size: 15px;
}

.rail-avatar {
    width: 48px;
    height: 48px;
}

.verified-badge {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1d9bf0;
}

.verified-badge svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.live-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
}

.live-item + .live-item {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.live-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 2px solid #7c3aed;
    color: var(--text-primary);
    font-weight: 800;
}

.container {
    max-width: 600px;
    min-height: 100vh;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    background: color-mix(in oklab, var(--bg-color) 92%, black 8%);
}

.nav-header {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--border-soft);
    backdrop-filter: blur(14px);
    background-color: rgba(0, 0, 0, 0.72);
}

.nav-title {
    padding: 12px 16px 10px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.timeline-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.timeline-tab {
    position: relative;
    height: 53px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

.timeline-tab:hover {
    background: rgba(255, 255, 255, 0.03);
}

.timeline-tab-active {
    color: var(--text-primary);
    font-weight: 700;
}

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

.composer {
    display: flex;
    gap: 12px;
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--border-color);
}

.avatar-wrap {
    flex-shrink: 0;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    object-fit: cover;
    display: block;
    background: var(--bg-soft);
}

.composer-content,
.tweet-main {
    flex: 1;
    min-width: 0;
}

.composer-input {
    width: 100%;
    min-height: 56px;
    resize: none;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.36rem;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.composer-input::placeholder {
    color: var(--text-secondary);
}

.composer-mode {
    margin-bottom: 12px;
    border: 1px solid rgba(29, 155, 240, 0.35);
    border-radius: 18px;
    background: rgba(29, 155, 240, 0.06);
    overflow: hidden;
}

.composer-mode-hidden {
    display: none;
}

.composer-mode-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px 0;
}

.composer-mode-body {
    padding: 8px 14px 14px;
}

.composer-mode-label {
    color: var(--accent-color);
    font-size: 0.85rem;
    font-weight: 800;
}

.composer-mode-cancel {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
}

.composer-mode-cancel:hover {
    color: var(--text-primary);
}

.composer-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 22px;
    margin-top: 8px;
    color: var(--accent-color);
    font-size: 0.82rem;
    font-weight: 700;
}

.composer-meta::before {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 999px;
    display: inline-block;
    opacity: 0.85;
}

.composer-actions,
.edit-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.composer-actions {
    position: relative;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.composer-tools {
    display: flex;
    align-items: center;
    gap: 2px;
}

.composer-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--accent-color);
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease;
}

.composer-tool:hover {
    background: var(--icon-hover-blue);
}

.composer-tool svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.composer-tool-gif {
    width: auto;
    min-width: 34px;
    padding: 0 7px;
    border: 1px solid currentColor;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.composer-counter,
.edit-counter {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.composer-counter {
    margin-left: auto;
    min-width: 0;
    width: 0;
    overflow: hidden;
}

.composer-counter.over-limit,
.edit-counter.over-limit {
    color: var(--danger-color);
}

.btn-post,
.edit-save-btn,
.edit-cancel-btn {
    min-height: 38px;
    border-radius: 999px;
    border: none;
    padding: 0 18px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 800;
    transition: background-color 160ms ease, opacity 160ms ease, color 160ms ease;
}

.btn-post,
.edit-save-btn {
    color: #0f1419;
    background: #eff3f4;
}

.btn-post:hover,
.edit-save-btn:hover {
    background: #d7dbdc;
}

.btn-post:disabled,
.edit-save-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-post:not(:disabled) {
    color: white;
    background: var(--accent-color);
}

.btn-post:not(:disabled):hover {
    background: var(--accent-hover);
}

.edit-cancel-btn {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.edit-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

.tweet {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 180ms ease;
}

.tweet:hover {
    background: var(--hover-bg);
}

.tweet-context-line {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
}

.tweet-context-line svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.tweet-context-line.repost {
    color: var(--repost-color);
}

.tweet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.tweet-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
    font-size: 15px;
    line-height: 1.25;
}

.tweet-name {
    font-weight: 700;
    color: var(--text-primary);
}

.tweet-name-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tweet-handle,
.tweet-time,
.tweet-edited,
.replying-line,
.quote-label {
    color: var(--text-secondary);
}

.tweet-time::before,
.tweet-edited::before {
    content: "·";
    margin-right: 4px;
}

.replying-line {
    margin-top: 2px;
    font-size: 14px;
}

.replying-line span {
    color: var(--accent-color);
}

.tweet-text {
    margin-top: 3px;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 20px;
    white-space: pre-wrap;
    word-break: break-word;
}

.tweet-date-line {
    margin-top: 10px;
    color: var(--text-tertiary);
    font-size: 13px;
    letter-spacing: 0.01em;
}

.tweet-reference-card {
    margin-top: 10px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
}

.tweet-reference-card .tweet-text {
    margin-top: 6px;
}

.tweet-reference-card .tweet-date-line {
    margin-top: 8px;
}

.tweet-reference-card.unavailable {
    color: var(--text-secondary);
    font-size: 14px;
}

.reference-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 14px;
}

.reference-name {
    font-weight: 700;
    color: var(--text-primary);
}

.reference-handle {
    color: var(--text-secondary);
}

.quote-label {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 700;
}

.tweet-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    margin-left: -8px;
}

.action-item,
.action-tail {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.action-item button,
.action-tail button,
.dots-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 160ms ease, background-color 160ms ease;
}

.action-item svg,
.action-tail svg,
.dots-btn svg {
    width: 18.75px;
    height: 18.75px;
    fill: currentColor;
}

.action-count {
    min-width: 1ch;
    color: var(--text-secondary);
    font-size: 13px;
    transition: color 160ms ease;
}

.action-item.reply:hover button,
.action-item.reply.is-active button,
.action-tail.share:hover button,
.dots-btn:hover {
    color: var(--accent-color);
    background: var(--icon-hover-blue);
}

.action-item.reply:hover .action-count,
.action-item.reply.is-active .action-count,
.action-tail.share:hover .action-count {
    color: var(--accent-color);
}

.action-item.retweet:hover button,
.action-item.retweet.is-active button {
    color: var(--repost-color);
    background: var(--icon-hover-green);
}

.action-item.retweet:hover .action-count,
.action-item.retweet.is-active .action-count {
    color: var(--repost-color);
}

.action-item.like:hover button,
.action-item.like.is-active button {
    color: var(--like-color);
    background: var(--icon-hover-pink);
}

.action-item.like:hover .action-count,
.action-item.like.is-active .action-count {
    color: var(--like-color);
}

.action-item.view:hover button {
    color: var(--accent-color);
    background: var(--icon-hover-blue);
}

.action-item.view:hover .action-count {
    color: var(--accent-color);
}

.tweet-menu,
.action-popover {
    position: absolute;
    right: 14px;
    background: var(--bg-floating);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-popover);
    z-index: 20;
}

.tweet-menu {
    top: 42px;
    width: 188px;
}

.action-popover {
    top: 30px;
    left: -2px;
    right: auto;
    width: 168px;
    background: #001f17;
    border: 1px solid rgba(0, 186, 124, 0.4);
    border-radius: 18px;
}

.tweet-menu button,
.action-popover button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    background: transparent;
    border: none;
    text-align: left;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 160ms ease;
}

.tweet-menu button:hover,
.action-popover button:hover {
    background: rgba(255, 255, 255, 0.04);
}

.action-popover button {
    color: #0edc8d;
    font-size: 1.02rem;
    font-weight: 800;
}

.action-popover button + button {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.tweet-menu .danger {
    color: #ff7a7a;
}

.action-popover-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: currentColor;
}

.action-popover-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.edit-box {
    margin-top: 8px;
    border: 1px solid rgba(29, 155, 240, 0.45);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
}

.edit-input {
    width: 100%;
    min-height: 112px;
    resize: vertical;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    padding: 14px 14px 4px;
    font-size: 15px;
    line-height: 20px;
}

.edit-toolbar {
    padding: 10px 14px 14px;
}

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

.status-banner,
.empty-state,
.feed-loading {
    padding: 36px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
}

.status-banner {
    border-bottom: 1px solid var(--border-color);
    background: rgba(29, 155, 240, 0.05);
}

.loader {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 2px solid rgba(255, 255, 255, 0.22);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.empty-state strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
    font-size: 16px;
}

.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;
}

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

@media (max-width: 640px) {
    .app-shell {
        width: 100%;
        display: block;
    }

    .left-rail,
    .right-rail {
        display: none;
    }

    .container {
        max-width: none;
        border-left: none;
        border-right: none;
    }

    .nav-title,
    .composer,
    .tweet {
        padding-left: 14px;
        padding-right: 14px;
    }

    .tweet-menu,
    .action-popover {
        right: 10px;
    }

    .action-popover {
        right: 0;
        left: auto;
    }
}

@media (max-width: 1200px) {
    .app-shell {
        width: min(990px, calc(100vw - 24px));
        grid-template-columns: 88px minmax(0, 1fr) 320px;
    }

    .side-nav-item span:last-child,
    .side-profile-copy {
        display: none;
    }

    .side-nav-item {
        padding-right: 14px;
    }

    .side-post-btn {
        width: 52px;
        padding: 0;
        font-size: 0;
    }

    .side-post-btn::before {
        content: "+";
        display: block;
        font-size: 2rem;
        line-height: 1;
    }
}

@media (max-width: 1000px) {
    .app-shell {
        width: min(690px, calc(100vw - 24px));
        grid-template-columns: 88px minmax(0, 1fr);
    }

    .right-rail {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
