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

.top-nav {
    align-items: center;
    display: flex;
    gap: 18px;
    margin: 0 auto 22px;
    max-width: 1280px;
}

.top-nav a {
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 780;
    text-decoration: none;
}

.nav-user {
    color: var(--muted);
    font-size: 14px;
    font-weight: 750;
    margin-left: auto;
}

.toast-stack {
    bottom: 18px;
    display: grid;
    gap: 8px;
    position: fixed;
    right: 18px;
    z-index: 900;
}

.toast {
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    box-shadow: var(--shadow);
    color: var(--text);
    font-weight: 750;
    padding: 12px 14px;
}

.toast.success {
    border-color: rgb(45 212 191 / 40%);
}

.toast.error {
    border-color: rgb(248 113 113 / 44%);
}

.loading-inline,
.error-panel {
    margin: 24px auto;
    max-width: 480px;
}

.top-nav a:hover {
    color: var(--accent);
}

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

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

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

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

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

.post-author-name,
.post-author-handle {
    text-decoration: none;
}

.post-author-name {
    color: var(--text);
    font-weight: 800;
}

.post-author-handle {
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
}

.author-summary {
    align-items: center;
    color: inherit;
    display: inline-flex;
    gap: 10px;
    min-width: 0;
    text-decoration: none;
}

.author-thumb {
    align-items: center;
    background: var(--accent-muted);
    border: 1px solid rgb(45 212 191 / 26%);
    border-radius: 999px;
    color: var(--accent);
    display: inline-flex;
    flex: 0 0 auto;
    font-weight: 850;
    height: 42px;
    justify-content: center;
    overflow: hidden;
    text-decoration: none;
    width: 42px;
}

.author-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

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

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

.post-token {
    color: var(--blue);
    font-weight: 750;
    text-decoration: none;
}

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

.inline-composer {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
}

.reply-target {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 8px;
}

.embedded-post {
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    margin-top: 12px;
    padding: 12px;
}

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

.quoted-post span {
    color: var(--muted);
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.repost-content {
    margin-top: 12px;
}

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

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

.post-media-grid img,
.post-media-grid video {
    aspect-ratio: 16 / 10;
    border-radius: 7px;
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.reply-level {
    border-left: 2px solid var(--border-strong);
    padding-left: 14px;
}

.reply-level-2 {
    margin-left: 18px;
}

.reply-level-3 {
    margin-left: 36px;
}

.post-metrics {
    border-top: 1px solid var(--border);
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 13px;
    font-weight: 700;
    gap: 12px;
    margin-top: 16px;
    padding-top: 12px;
}

.profile-page {
    display: grid;
    gap: 22px;
    max-width: 980px;
}

.profile-header {
    align-items: start;
    background: rgb(20 27 37 / 92%);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 22px;
    grid-template-columns: auto minmax(0, 1fr);
    padding: 22px;
}

.profile-photo {
    align-items: center;
    background: var(--surface-subtle);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--accent);
    display: flex;
    font-size: 42px;
    font-weight: 850;
    height: 118px;
    justify-content: center;
    overflow: hidden;
    width: 118px;
}

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

.profile-summary {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.profile-title-row {
    align-items: start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.profile-title-row h1 {
    font-size: 34px;
    letter-spacing: 0;
    line-height: 1.12;
    margin: 0;
}

.profile-title-row p {
    color: var(--muted);
    font-size: 16px;
    font-weight: 700;
    margin: 6px 0 0;
}

.profile-counts {
    color: var(--text-soft);
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.profile-counts strong {
    color: var(--text);
}

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

.profile-image-upload {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.upload-progress {
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.media-attachment-strip {
    display: grid;
    gap: 10px;
}

.media-preview-strip {
    display: grid;
    gap: 8px;
}

.media-preview-item {
    align-items: center;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 7px;
    display: grid;
    gap: 10px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 8px;
}

.media-preview-item strong,
.media-preview-item span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-preview-item span {
    color: var(--muted);
    font-size: 12px;
}

.media-preview-thumb {
    align-items: center;
    aspect-ratio: 1;
    background: var(--accent-muted);
    border-radius: 6px;
    color: var(--accent);
    display: flex;
    font-size: 12px;
    font-weight: 850;
    justify-content: center;
    width: 42px;
}

.file-button {
    align-items: center;
    background: #1c2735;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    color: var(--text-soft);
    cursor: pointer;
    display: inline-flex;
    font-weight: 750;
    min-height: 34px;
    overflow: hidden;
    padding: 0 12px;
    position: relative;
}

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

.profile-posts {
    width: 100%;
}

.load-more {
    justify-self: center;
}

.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;
    gap: 4px;
    padding: 0 8px;
    width: auto;
}

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

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

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

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

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

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

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--border-strong);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--accent);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
    color: var(--muted);
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

@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,
    .profile-header,
    .profile-title-row,
    .display-name-form {
        align-items: stretch;
        grid-template-columns: 1fr;
        flex-direction: column;
    }
}
