:root {
    color-scheme: dark;
    --bg: #0b0f17;
    --bg-soft: #101720;
    --surface: #141b25;
    --surface-raised: #192331;
    --surface-subtle: #0f1620;
    --border: #273446;
    --border-strong: #3a4a60;
    --text: #edf2f7;
    --text-soft: #c7d2df;
    --muted: #93a4b7;
    --accent: #2dd4bf;
    --accent-strong: #14b8a6;
    --accent-muted: rgb(45 212 191 / 14%);
    --blue: #60a5fa;
    --danger: #f87171;
    --danger-strong: #dc2626;
    --warning: #fbbf24;
    --focus: #99f6e4;
    --shadow: 0 18px 42px rgb(0 0 0 / 26%);
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-width: 320px;
    background:
        radial-gradient(circle at top left, rgb(45 212 191 / 8%), transparent 30rem),
        linear-gradient(180deg, #0b0f17 0%, #101720 52%, #0b0f17 100%);
}

button,
input,
textarea {
    font: inherit;
}

button {
    min-height: 42px;
    border: 1px solid rgb(45 212 191 / 30%);
    border-radius: 7px;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #031311;
    font-weight: 750;
    padding: 0 16px;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
}

button.secondary {
    background: #1c2735;
    border-color: var(--border-strong);
    color: var(--text-soft);
}

button.danger {
    background: rgb(248 113 113 / 12%);
    border-color: rgb(248 113 113 / 34%);
    color: #fecaca;
}

button.compact {
    min-height: 34px;
    padding: 0 12px;
}

button:disabled {
    cursor: not-allowed;
    opacity: .54;
    transform: none;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 11px 13px;
    background: #0d141d;
    color: var(--text);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input::placeholder,
textarea::placeholder {
    color: #718196;
}

input:focus,
textarea:focus {
    border-color: rgb(45 212 191 / 58%);
    background: #101923;
    box-shadow: 0 0 0 3px rgb(45 212 191 / 10%);
}

textarea {
    min-height: 116px;
    resize: vertical;
}

form {
    display: grid;
    gap: 12px;
}

.shell {
    min-height: 100vh;
    padding: 32px;
}

.workspace {
    max-width: 1280px;
    margin: 0 auto;
}

.masthead {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    margin-bottom: 28px;
}

.masthead h1 {
    margin: 0;
    font-size: 38px;
    font-weight: 820;
    letter-spacing: 0;
}

.masthead p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.auth {
    display: grid;
    min-height: calc(100vh - 64px);
    place-items: center;
}

.auth-panel {
    width: min(430px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 26px;
}

.auth-panel h1 {
    margin: 0;
    font-size: 30px;
    letter-spacing: 0;
}

.auth-panel p {
    color: var(--muted);
    margin: 8px 0 20px;
}

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

.switch a {
    color: var(--accent);
    font-weight: 700;
}

.check {
    align-items: center;
    color: var(--text-soft);
    display: flex;
    gap: 8px;
}

.check input {
    width: auto;
}

.feed-layout {
    align-items: start;
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 820px);
    justify-content: center;
    gap: 22px;
}

.panel,
.feed {
    background: rgb(20 27 37 / 92%);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 18px;
}

.composer {
    position: sticky;
    top: 24px;
}

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

.single-post-feed {
    margin: 0 auto;
    max-width: 820px;
}

.panel h2,
.feed h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 780;
    letter-spacing: 0;
}

.feed-title-row {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

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

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.account-menu {
    position: relative;
}

.account-menu-button {
    align-items: center;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    display: inline-flex;
    height: 42px;
    justify-content: center;
    min-height: 42px;
    padding: 0;
    width: 42px;
}

.account-menu-button:hover:not(:disabled),
.account-menu-button[aria-expanded="true"],
.account-menu-button[aria-expanded="True"] {
    border-color: rgb(45 212 191 / 58%);
    transform: translateY(-1px);
}

.account-thumbnail {
    align-items: center;
    aspect-ratio: 1;
    background: var(--accent-muted);
    border-radius: 999px;
    color: var(--accent);
    display: inline-flex;
    font-size: 13px;
    font-weight: 820;
    height: 34px;
    justify-content: center;
    overflow: hidden;
    width: 34px;
}

.account-thumbnail img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.account-menu-popover {
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 4px;
    min-width: 158px;
    padding: 6px;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 20;
}

.account-menu-item {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-soft);
    justify-content: flex-start;
    min-height: 36px;
    padding: 0 10px;
    text-align: left;
    width: 100%;
}

.account-menu-item:hover:not(:disabled),
.account-menu-item:focus-visible {
    background: rgb(45 212 191 / 10%);
    border-color: rgb(45 212 191 / 24%);
    color: var(--text);
    transform: none;
}

.post {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgb(0 0 0 / 18%);
    padding: 18px;
}

.clickable-post {
    cursor: pointer;
    transition: border-color .16s ease, transform .16s ease;
}

.clickable-post:hover,
.clickable-post:focus-visible {
    border-color: var(--border-strong);
}

.clickable-post:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.post-header {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.post-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

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

.compact-author-block {
    gap: 8px;
}

.author-thumbnail {
    align-items: center;
    aspect-ratio: 1;
    background: var(--accent-muted);
    border: 1px solid rgb(45 212 191 / 24%);
    border-radius: 999px;
    color: var(--accent);
    display: inline-flex;
    flex: 0 0 34px;
    font-size: 13px;
    font-weight: 820;
    height: 34px;
    justify-content: center;
    overflow: hidden;
    width: 34px;
}

.compact-author-block .author-thumbnail {
    flex-basis: 28px;
    font-size: 11px;
    height: 28px;
    width: 28px;
}

.author-thumbnail img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.post-author-line {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    min-width: 0;
}

.post-time {
    color: var(--muted);
    font-size: 13px;
}

.post p {
    color: var(--text-soft);
    font-size: 15px;
    line-height: 1.62;
    margin: 12px 0 0;
    overflow-wrap: anywhere;
}

.empty,
.status,
.message {
    margin: 0;
}

.quoted-post {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 14px;
    padding: 13px 14px;
}

.quoted-post strong {
    color: var(--text);
}

.author-link {
    color: var(--accent);
    font-weight: 780;
    text-decoration: none;
}

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

.quoted-post p {
    color: var(--muted);
}

.clickable-quoted-post {
    cursor: pointer;
}

.clickable-quoted-post:hover,
.clickable-quoted-post:focus-visible {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
    outline: none;
}

.post-actions {
    align-items: center;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
}

.heart-button,
.repost-button,
.reply-button {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--muted);
    display: inline-flex;
    font-weight: 760;
    justify-content: center;
    line-height: 1;
    min-height: 34px;
    padding: 0;
    width: 34px;
}

.heart-button {
    font-size: 22px;
}

.repost-button {
    font-size: 20px;
}

.heart-button:hover:not(:disabled),
.heart-button.liked {
    color: var(--danger);
}

.repost-button:hover:not(:disabled),
.repost-button.reposted {
    color: var(--accent);
}

.reply-button:hover:not(:disabled),
.reply-button.replying {
    color: var(--blue);
}

.chat-bubble-icon {
    border: 2px solid currentColor;
    border-radius: 8px;
    display: inline-block;
    height: 17px;
    position: relative;
    width: 19px;
}

.chat-bubble-icon::after {
    border-bottom: 2px solid currentColor;
    border-left: 2px solid currentColor;
    bottom: -5px;
    content: "";
    height: 7px;
    left: 4px;
    position: absolute;
    transform: skewX(-28deg);
    width: 7px;
}

.heart-button:focus-visible,
.repost-button:focus-visible,
.reply-button:focus-visible {
    border-color: var(--accent);
    outline: 2px solid var(--focus);
}

.like-count,
.repost-count,
.reply-count {
    color: var(--text-soft);
    font-weight: 700;
    min-width: 1ch;
}

.repost-composer,
.reply-composer {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding: 12px;
}

.repost-composer textarea,
.reply-composer textarea {
    min-height: 82px;
}

.repost-composer-actions,
.reply-composer-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.repost-composer-actions button,
.reply-composer-actions button {
    align-items: center;
    display: inline-flex;
    gap: 6px;
}

.reply-input-row {
    align-items: stretch;
    display: grid;
    gap: 8px;
    grid-template-columns: auto minmax(0, 1fr);
}

.reply-prefix {
    align-items: center;
    background: rgb(96 165 250 / 12%);
    border: 1px solid rgb(96 165 250 / 26%);
    border-radius: 7px;
    color: #bfdbfe;
    display: inline-flex;
    font-weight: 780;
    min-height: 42px;
    padding: 0 11px;
}

.conversation-preview {
    border-left: 2px solid var(--border-strong);
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding-left: 12px;
}

.conversation-reply {
    background: rgb(15 22 32 / 72%);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 11px 12px;
}

.clickable-conversation-reply {
    cursor: pointer;
}

.clickable-conversation-reply:hover,
.clickable-conversation-reply:focus-visible {
    border-color: var(--border-strong);
}

.conversation-reply .conversation-preview {
    margin-top: 10px;
}

.composer-header {
    border-bottom: 1px solid var(--border);
    margin: 0 0 14px;
    padding-bottom: 14px;
}

.composer-header p {
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
    margin: 5px 0 0;
}

.composer textarea,
.composer-input {
    min-height: 150px;
}

.composer-media {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.composer-submit-row {
    align-items: center;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding-top: 12px;
}

.composer-submit-row span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.secondary-file {
    background: #202c3a;
    border-color: var(--border-strong);
    color: var(--text-soft);
}

.field-message {
    color: #fecaca;
    font-size: 14px;
    font-weight: 700;
    margin: 0;
}

.media-preview-grid,
.media-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 12px;
}

.media-preview,
.media-item {
    background: #0a1017;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 0;
    min-width: 0;
    overflow: hidden;
}

.media-preview img,
.media-preview video {
    aspect-ratio: 4 / 3;
    background: #05080d;
    display: block;
    height: auto;
    object-fit: cover;
    width: 100%;
}

.media-thumb-button {
    background: #05080d;
    border: 0;
    border-radius: 0;
    color: inherit;
    cursor: zoom-in;
    display: block;
    min-height: 0;
    padding: 0;
    position: relative;
    width: 100%;
}

.media-thumb-button:hover:not(:disabled) {
    transform: none;
}

.media-thumb-button img,
.media-thumb-button video {
    aspect-ratio: 4 / 3;
    display: block;
    height: auto;
    max-height: 380px;
    object-fit: cover;
    width: 100%;
}

.media-count-1 {
    grid-template-columns: 1fr;
}

.media-count-1 .media-thumb-button img,
.media-count-1 .media-thumb-button video {
    max-height: 480px;
    object-fit: contain;
}

.media-kind-badge {
    background: rgb(8 13 20 / 86%);
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 6px;
    color: var(--text);
    font-size: 12px;
    font-weight: 780;
    left: 8px;
    line-height: 1;
    padding: 6px 8px;
    position: absolute;
    top: 8px;
    z-index: 1;
}

.media-viewer {
    align-items: center;
    background: rgb(3 7 12 / 88%);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 24px;
    position: fixed;
    z-index: 1100;
}

.media-viewer-surface {
    max-height: calc(100vh - 48px);
    max-width: min(1180px, calc(100vw - 48px));
    position: relative;
}

.media-viewer-surface img,
.media-viewer-surface video {
    background: #020617;
    border-radius: 8px;
    display: block;
    max-height: calc(100vh - 48px);
    max-width: min(1180px, calc(100vw - 48px));
    object-fit: contain;
}

.media-viewer-close {
    align-items: center;
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--text);
    display: inline-flex;
    font-size: 26px;
    font-weight: 750;
    height: 38px;
    justify-content: center;
    line-height: 1;
    min-height: 38px;
    padding: 0;
    position: absolute;
    right: -14px;
    top: -14px;
    width: 38px;
    z-index: 1;
}

.media-preview figcaption {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.35;
    padding: 9px;
    overflow-wrap: anywhere;
}

.empty,
.status {
    color: var(--muted);
    padding: 20px;
    text-align: center;
}

.message {
    background: rgb(96 165 250 / 12%);
    border: 1px solid rgb(96 165 250 / 30%);
    border-radius: 8px;
    color: #bfdbfe;
    margin-top: 18px;
    padding: 13px 14px;
}

.profile-panel {
    max-width: 760px;
}

.profile-panel h2 {
    font-size: 24px;
    margin: 0;
}

.profile-header {
    align-items: center;
    display: flex;
    gap: 16px;
}

.profile-image-frame {
    align-items: center;
    aspect-ratio: 1;
    background: var(--accent-muted);
    border: 1px solid rgb(45 212 191 / 28%);
    border-radius: 8px;
    color: var(--accent);
    display: flex;
    flex: 0 0 96px;
    font-size: 28px;
    font-weight: 820;
    justify-content: center;
    overflow: hidden;
}

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

.profile-heading {
    min-width: 0;
}

.profile-handle {
    color: var(--muted);
    font-weight: 700;
    margin: 6px 0 0;
}

.profile-image-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.file-button {
    align-items: center;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
    border: 1px solid rgb(45 212 191 / 30%);
    border-radius: 7px;
    color: #031311;
    cursor: pointer;
    display: inline-flex;
    font-weight: 750;
    min-height: 42px;
    overflow: hidden;
    padding: 0 16px;
    position: relative;
}

.file-button input {
    cursor: pointer;
    inset: 0;
    opacity: 0;
    position: absolute;
}

.profile-posts {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.profile-posts h3 {
    font-size: 18px;
    margin: 0;
}

#blazor-error-ui {
    background: #7f1d1d;
    bottom: 0;
    color: #fee2e2;
    display: none;
    left: 0;
    padding: 12px;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

@media (max-width: 960px) {
    .feed-layout {
        grid-template-columns: minmax(0, 820px);
    }

    .composer {
        position: static;
    }
}

@media (max-width: 840px) {
    .shell {
        padding: 18px;
    }

    .masthead {
        align-items: stretch;
        flex-direction: column;
    }

    .masthead h1 {
        font-size: 32px;
    }

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

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

    .composer-submit-row,
    .post-header {
        align-items: stretch;
        flex-direction: column;
    }
}
