:root {
    --mastodon-bg: #191b22;
    --mastodon-surface: #282c37;
    --mastodon-surface-hover: #313543;
    --mastodon-border: #393f4f;
    --mastodon-border-subtle: #2f3442;
    --mastodon-text: #ffffff;
    --mastodon-text-muted: #9baec8;
    --mastodon-purple: #6364ff;
    --mastodon-purple-hover: #563acc;
    --mastodon-purple-subtle: rgba(99, 100, 255, 0.15);
    --mastodon-danger: #df405a;
    --mastodon-danger-bg: rgba(223, 64, 90, 0.15);
    --mastodon-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Base resets & typography */
html, body {
    background-color: var(--mastodon-bg) !important;
    color: var(--mastodon-text);
    font-family: var(--mastodon-font);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--mastodon-purple);
    text-decoration: none;
    transition: color 0.15s ease, text-decoration 0.15s ease;
}

a:hover {
    color: #8c8dff;
    text-decoration: underline;
}

/* Main timeline column */
.container {
    max-width: 650px !important;
    background-color: var(--mastodon-surface);
    border-left: 1px solid var(--mastodon-border);
    border-right: 1px solid var(--mastodon-border);
    padding: 0 !important;
    min-height: 100vh;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.35);
}

/* Top Navbar */
.navbar {
    border-bottom: 1px solid var(--mastodon-border);
    background-color: rgba(25, 27, 34, 0.95) !important;
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 10px 16px;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    color: #ffffff !important;
    letter-spacing: -0.2px;
}

.navbar-brand:hover {
    text-decoration: none !important;
}

.nav-link {
    color: var(--mastodon-text-muted) !important;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 6px 14px !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.08);
    text-decoration: none !important;
}

.nav-link.active {
    color: #ffffff !important;
    background-color: var(--mastodon-purple);
}

/* Mastodon Profile Header */
.mastodon-profile-header {
    background-color: var(--mastodon-surface);
    border-bottom: 1px solid var(--mastodon-border);
}

.profile-banner {
    background: linear-gradient(135deg, #1d2029 0%, #282c37 50%, #3a3f55 100%);
    height: 120px;
    width: 100%;
    position: relative;
}

.profile-banner-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.15;
    background-image: radial-gradient(#6364ff 1px, transparent 1px);
    background-size: 16px 16px;
}

.profile-details {
    padding: 0 20px 16px 20px;
    position: relative;
    margin-top: -45px;
}

.profile-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 12px;
}

.profile-avatar-wrapper {
    position: relative;
}

.profile-avatar {
    width: 86px;
    height: 86px;
    border-radius: 8px;
    border: 4px solid var(--mastodon-surface);
    background-color: #191b22;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    object-fit: cover;
    display: block;
}

.btn-mastodon-view {
    background-color: var(--mastodon-purple);
    color: #ffffff !important;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 7px 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    text-decoration: none !important;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-mastodon-view:hover {
    background-color: var(--mastodon-purple-hover);
    transform: translateY(-1px);
}

.profile-names {
    margin-bottom: 10px;
}

.profile-display-name {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    line-height: 1.2;
}

.profile-handle {
    font-size: 0.9rem;
    color: var(--mastodon-text-muted);
    margin-top: 2px;
}

.profile-stats {
    display: flex;
    gap: 20px;
    padding-top: 10px;
    border-top: 1px solid var(--mastodon-border-subtle);
    font-size: 0.88rem;
}

.stat-item {
    color: var(--mastodon-text-muted);
}

.stat-value {
    font-weight: 700;
    color: #ffffff;
}

/* Status / Toot Card */
.tweet-card,
.status-card {
    border-bottom: 1px solid var(--mastodon-border);
    padding: 16px 20px;
    transition: background-color 0.15s ease;
    background-color: var(--mastodon-surface);
    position: relative;
    display: flex;
    flex-direction: column;
}

.tweet-card:hover,
.status-card:hover {
    background-color: var(--mastodon-surface-hover);
}

/* Deleted Toot */
.tweet-card.tweet-deleted,
.status-card.status-deleted {
    border-left: 4px solid var(--mastodon-danger);
    background-color: rgba(223, 64, 90, 0.05);
}

.tweet-card.tweet-deleted:hover,
.status-card.status-deleted:hover {
    background-color: rgba(223, 64, 90, 0.09);
}

.tweet-header,
.status-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
}

.tweet-avatar,
.status-avatar {
    width: 46px;
    height: 46px;
    border-radius: 6px;
    margin-right: 12px;
    background-color: #191b22;
    flex-shrink: 0;
    object-fit: cover;
}

.tweet-meta,
.status-meta {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.status-meta-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.tweet-author,
.status-display-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #ffffff;
}

.tweet-handle,
.status-handle {
    color: var(--mastodon-text-muted);
    font-size: 0.85rem;
    margin-left: 4px;
}

.tweet-time,
.status-time {
    color: var(--mastodon-text-muted);
    font-size: 0.82rem;
    text-decoration: none !important;
    white-space: nowrap;
}

.tweet-time:hover,
.status-time:hover {
    color: #ffffff;
    text-decoration: underline !important;
}

.tweet-badge-deleted,
.status-badge-deleted {
    display: inline-block;
    background-color: var(--mastodon-danger-bg);
    color: #ff6b81;
    border: 1px solid rgba(223, 64, 90, 0.35);
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 7px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    vertical-align: middle;
}

/* Status Content */
.tweet-content,
.status-content {
    margin-left: 58px;
    margin-bottom: 8px;
    font-size: 15px;
    line-height: 1.55;
    color: #ffffff;
    word-break: break-word;
}

.tweet-content p,
.status-content p {
    margin-top: 0;
    margin-bottom: 8px;
}

.tweet-content p:last-child,
.status-content p:last-child {
    margin-bottom: 0;
}

.tweet-content a,
.status-content a {
    color: var(--mastodon-purple);
    word-break: break-all;
}

.tweet-content a .invisible,
.status-content a .invisible {
    visibility: visible !important;
    display: inline !important;
    font-size: inherit !important;
    line-height: inherit !important;
    position: static !important;
}

.tweet-content a:hover,
.status-content a:hover {
    color: #8c8dff;
    text-decoration: underline;
}

.tweet-content strong,
.tweet-content b,
.status-content strong,
.status-content b {
    color: #ffffff;
    font-weight: 700;
}

.quote-inline {
    border-left: 3px solid var(--mastodon-purple);
    padding: 6px 12px;
    margin: 8px 0;
    background: rgba(99, 100, 255, 0.08);
    border-radius: 0 4px 4px 0;
    color: var(--mastodon-text-muted);
}

/* Status Media / Screenshot */
.tweet-media,
.status-media {
    margin-left: 58px;
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--mastodon-border);
    background-color: #191b22;
}

.tweet-media img,
.status-media img {
    width: 100%;
    display: block;
    max-height: 600px;
    object-fit: contain;
    background-color: #13151b;
}

/* Actions Bar */
.tweet-actions,
.status-actions {
    margin-left: 58px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--mastodon-text-muted);
    font-size: 0.85rem;
}

.action-btn,
.status-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--mastodon-text-muted) !important;
    text-decoration: none !important;
    transition: color 0.15s ease;
    cursor: pointer;
    font-weight: 500;
}

.action-btn:hover,
.status-action-btn:hover {
    color: var(--mastodon-purple) !important;
}

.action-btn svg,
.status-action-btn svg {
    width: 17px;
    height: 17px;
}

/* Similar View specific */
.target-tweet {
    background-color: rgba(99, 100, 255, 0.08) !important;
    border-left: 4px solid var(--mastodon-purple);
}

.section-header {
    padding: 12px 20px;
    font-weight: 700;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--mastodon-border);
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--mastodon-text);
}

.diff-added {
    color: #4cd964;
    background-color: rgba(76, 217, 100, 0.15);
    padding: 1px 3px;
    border-radius: 2px;
}

.diff-removed {
    color: #ff9500;
    text-decoration: line-through;
    background-color: rgba(255, 149, 0, 0.15);
    padding: 1px 3px;
    border-radius: 2px;
}

/* Pagination */
.pagination {
    margin-bottom: 0;
    gap: 4px;
}

.pagination .page-link {
    background-color: var(--mastodon-surface);
    border: 1px solid var(--mastodon-border);
    color: var(--mastodon-purple);
    border-radius: 4px !important;
    padding: 6px 12px;
    font-weight: 600;
    transition: all 0.15s ease;
}

.pagination .page-link:hover {
    background-color: var(--mastodon-surface-hover);
    color: #ffffff;
    border-color: var(--mastodon-purple);
}

.pagination .page-item.active .page-link {
    background-color: var(--mastodon-purple);
    border-color: var(--mastodon-purple);
    color: #ffffff;
}

.pagination .page-item.disabled .page-link {
    background-color: transparent;
    border-color: transparent;
    color: var(--mastodon-text-muted);
    opacity: 0.5;
}

/* Fixed Stats Footer */
.stats-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(25, 27, 34, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--mastodon-border);
    padding: 8px 16px;
    font-size: 12px;
    color: var(--mastodon-text-muted);
    display: flex;
    justify-content: center;
    gap: 24px;
    z-index: 1000;
}

.stats-bar b {
    color: #ffffff;
}

.top-star {
    color: #ffaa00;
    margin-right: 4px;
}

/* ── Pagefind search widget — dark theme via CSS vars + forced overrides ── */
#oj-search {
    /* Pagefind UI v1 CSS custom properties */
    --pagefind-ui-scale: 1;
    --pagefind-ui-primary: #6364ff;
    --pagefind-ui-text: #ffffff;
    --pagefind-ui-background: #1e2028;
    --pagefind-ui-border: #393f4f;
    --pagefind-ui-tag: #282c37;
    --pagefind-ui-border-width: 1px;
    --pagefind-ui-border-radius: 8px;
    --pagefind-ui-image-border-radius: 6px;
    --pagefind-ui-image-box-ratio: 3 / 2;
    --pagefind-ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Search input */
#oj-search .pagefind-ui__search-input {
    background: #1e2028 !important;
    color: #ffffff !important;
    border: 1px solid #393f4f !important;
    border-radius: 8px !important;
}
#oj-search .pagefind-ui__search-input:focus {
    border-color: #6364ff !important;
    box-shadow: 0 0 0 2px rgba(99,100,255,0.2) !important;
    outline: none !important;
}
#oj-search input[type=text] {
    background: #1e2028 !important;
    color: #ffffff !important;
}

/* Clear button */
#oj-search .pagefind-ui__search-clear {
    background: transparent !important;
    color: #9baec8 !important;
}

/* Filter checkboxes area */
#oj-search .pagefind-ui__filter-panel,
#oj-search .pagefind-ui__filter-group {
    background: transparent !important;
    color: #9baec8 !important;
}
#oj-search .pagefind-ui__filter-name {
    color: #9baec8 !important;
    font-size: 0.8rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
}
#oj-search .pagefind-ui__filter-value {
    color: #ffffff !important;
}
#oj-search input[type=checkbox] {
    accent-color: #6364ff !important;
}

/* Results area */
#oj-search .pagefind-ui__results-area {
    background: transparent !important;
    color: #ffffff !important;
    max-height: 55vh !important;
    overflow-y: auto !important;
}
#oj-search .pagefind-ui__message {
    color: #9baec8 !important;
    font-size: 0.85rem !important;
}

/* Individual result */
#oj-search .pagefind-ui__result {
    background: transparent !important;
    border-bottom: 1px solid #393f4f !important;
    padding: 12px 0 !important;
}
#oj-search .pagefind-ui__result-link {
    color: #6364ff !important;
    font-weight: 600 !important;
    text-decoration: none !important;
}
#oj-search .pagefind-ui__result-link:hover {
    color: #8485ff !important;
    text-decoration: underline !important;
}
#oj-search .pagefind-ui__result-excerpt {
    color: #9baec8 !important;
    font-size: 0.875rem !important;
    line-height: 1.5 !important;
}

/* Highlighted matches — replace yellow with purple */
#oj-search mark,
#oj-search .pagefind-ui__result-excerpt mark {
    background: rgba(99,100,255,0.25) !important;
    color: #a5a6ff !important;
    border-radius: 3px !important;
    padding: 0 3px !important;
}

/* Tags / date badges */
#oj-search .pagefind-ui__result-tags,
#oj-search .pagefind-ui__result-tag {
    background: #282c37 !important;
    color: #9baec8 !important;
    border-radius: 4px !important;
}

/* Load more button */
#oj-search .pagefind-ui__button {
    background: #6364ff !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 8px 20px !important;
    cursor: pointer !important;
    font-weight: 500 !important;
}
#oj-search .pagefind-ui__button:hover {
    background: #563acc !important;
}
