/* Twitter / X Profile Biolink — estilo clássico */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html.tw-light,
html.tw-light body,
.tw-light {
    --tw-bg: #ffffff;
    --tw-surface: #ffffff;
    --tw-text: #0f1419;
    --tw-text-secondary: #536471;
    --tw-border: #eff3f4;
    --tw-hover: rgba(15, 20, 25, 0.1);
    --tw-btn-outline-border: #cfd9de;
    --tw-btn-outline-text: #0f1419;
    --tw-tab-active: #0f1419;
    --tw-tab-inactive: #536471;
    --tw-modal-bg: #ffffff;
    --tw-cover-fallback: linear-gradient(135deg, #1d9bf0 0%, #7856ff 100%);
    --tw-like: #f91880;
}

html.tw-dark,
html.tw-dark body,
.tw-dark {
    --tw-bg: #15202b;
    --tw-surface: #15202b;
    --tw-text: #e7e9ea;
    --tw-text-secondary: #71767b;
    --tw-border: #38444d;
    --tw-hover: rgba(231, 233, 234, 0.1);
    --tw-btn-outline-border: #536471;
    --tw-btn-outline-text: #e7e9ea;
    --tw-tab-active: #e7e9ea;
    --tw-tab-inactive: #71767b;
    --tw-modal-bg: #192734;
    --tw-cover-fallback: linear-gradient(135deg, #1d9bf0 0%, #38444d 100%);
    --tw-like: #f91880;
}

html, body {
    margin: 0;
    background-color: var(--tw-bg, #ffffff);
    color: var(--tw-text, #0f1419);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.tw-app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--tw-bg, #ffffff);
    color: var(--tw-text, #0f1419);
    position: relative;
}

/* Top bar */
.tw-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 53px;
    padding: 0 12px;
    background-color: var(--tw-surface, #ffffff);
    border-bottom: 1px solid var(--tw-border, #eff3f4);
    position: sticky;
    top: 0;
    z-index: 50;
}

.tw-topbar-center {
    flex: 1;
    text-align: center;
    min-width: 0;
    padding: 0 8px;
}

.tw-topbar-name {
    display: block;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tw-topbar-posts {
    display: block;
    font-size: 13px;
    color: var(--tw-text-secondary);
}

.tw-topbar-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--tw-text);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
}

.tw-topbar-btn:active { background: var(--tw-hover); }

/* Cover + avatar */
.tw-cover-section {
    position: relative;
}

.tw-cover {
    height: 200px;
    background: var(--tw-cover-fallback);
    background-size: cover;
    background-position: center;
}

.tw-profile-actions {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 16px;
    margin-top: -67px;
    margin-bottom: 12px;
    position: relative;
    z-index: 2;
}

.tw-story-ring {
    background: linear-gradient(135deg, #1d9bf0, #7856ff, #f91880);
    border: 4px solid var(--tw-bg);
    border-radius: 50%;
    padding: 3px;
    cursor: pointer;
    display: block;
    line-height: 0;
}

.tw-story-ring-inner {
    display: block;
    background: var(--tw-bg);
    border-radius: 50%;
    padding: 3px;
}

.tw-story-ring img,
.tw-avatar-plain img {
    width: 134px;
    height: 134px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 4px solid var(--tw-bg);
}

.tw-avatar-ph,
.tw-tweet-avatar-ph {
    border-radius: 50%;
    background: linear-gradient(135deg, #1d9bf0, #7856ff);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
}

.tw-avatar-ph {
    width: 134px;
    height: 134px;
    font-size: 48px;
    border: 4px solid var(--tw-bg);
}

.tw-header-btns {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-bottom: 8px;
}

.tw-btn {
    height: 36px;
    border: none;
    border-radius: var(--tw-btn-radius, 9999px);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-family: inherit;
    padding: 0 16px;
    white-space: nowrap;
}

.tw-btn-primary {
    background: var(--tw-btn-primary, #1d9bf0);
    color: var(--tw-btn-text, #fff);
}

.tw-btn-primary.following {
    background: transparent;
    color: var(--tw-text);
    border: 1px solid var(--tw-btn-outline-border);
}

.tw-btn-outline {
    background: transparent;
    color: var(--tw-btn-outline-text);
    border: 1px solid var(--tw-btn-outline-border);
}

.tw-btn-icon {
    width: 36px;
    padding: 0;
}

.tw-btn:active { opacity: 0.85; }

/* Profile */
.tw-main { background: var(--tw-bg); }

.tw-profile {
    padding: 0 16px 12px;
}

.tw-name {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 2px;
}

.tw-handle {
    font-size: 15px;
    color: var(--tw-text-secondary);
    margin-bottom: 12px;
}

.tw-bio {
    font-size: 15px;
    line-height: 1.4;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.tw-website {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 15px;
    color: var(--tw-btn-primary, #1d9bf0);
    text-decoration: none;
    margin-bottom: 12px;
}

.tw-stats {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    margin-bottom: 16px;
    font-size: 15px;
}

.tw-stats strong { font-weight: 700; }
.tw-stats span { color: var(--tw-text-secondary); }

/* Lists / categories */
.tw-lists {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 4px;
    scrollbar-width: none;
}

.tw-lists::-webkit-scrollbar { display: none; }

.tw-list-pill {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--tw-border);
    border-radius: 9999px;
    background: var(--tw-bg);
    color: var(--tw-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.tw-list-pill.active {
    background: var(--tw-text);
    color: var(--tw-bg);
    border-color: var(--tw-text);
}

.tw-list-pill-img {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    object-fit: cover;
}

/* Tabs */
.tw-tabs {
    display: flex;
    border-bottom: 1px solid var(--tw-border);
    position: sticky;
    top: 53px;
    z-index: 40;
    background: var(--tw-bg);
}

.tw-tab {
    flex: 1;
    height: 53px;
    border: none;
    background: none;
    color: var(--tw-tab-inactive);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    position: relative;
}

.tw-tab.active {
    color: var(--tw-tab-active);
    font-weight: 700;
}

.tw-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 4px;
    background: var(--tw-btn-primary, #1d9bf0);
    border-radius: 9999px;
}

/* Timeline / tweets */
.tw-timeline { min-height: 120px; }

.tw-tweet {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--tw-border);
    cursor: pointer;
    transition: background 0.15s;
}

.tw-tweet:hover { background: var(--tw-hover); }
.tw-tweet.hidden { display: none; }

.tw-tweet-avatar {
    flex-shrink: 0;
}

.tw-tweet-avatar img,
.tw-tweet-avatar-ph {
    width: 40px;
    height: 40px;
    font-size: 16px;
}

.tw-tweet-body { flex: 1; min-width: 0; }

.tw-tweet-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 4px;
    font-size: 15px;
}

.tw-tweet-name { font-weight: 700; }
.tw-tweet-handle,
.tw-tweet-time,
.tw-tweet-dot { color: var(--tw-text-secondary); }

.tw-tweet-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--tw-btn-primary, #1d9bf0);
    background: rgba(29, 155, 240, 0.12);
    padding: 2px 8px;
    border-radius: 4px;
}

.tw-tweet-text {
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
}

.tw-tweet-desc {
    font-size: 14px;
    color: var(--tw-text-secondary);
    margin-top: 4px;
    line-height: 1.4;
}

.tw-tweet-media {
    margin-top: 12px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--tw-border);
    position: relative;
    max-height: 320px;
}

.tw-tweet-media img,
.tw-tweet-media video {
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    display: block;
}

.tw-media-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
}

.tw-tweet-actions {
    display: flex;
    justify-content: space-between;
    max-width: 425px;
    margin-top: 12px;
    color: var(--tw-text-secondary);
}

.tw-tweet-actions span {
    display: flex;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

.tw-service-link {
    display: inline-block;
    margin-top: 8px;
    color: var(--tw-btn-primary, #1d9bf0);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
}

/* Media grid */
.tw-media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    min-height: 120px;
}

.tw-media-item {
    aspect-ratio: 1;
    border: none;
    padding: 0;
    background: var(--tw-border);
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.tw-media-item.hidden { display: none; }

.tw-media-item img,
.tw-media-item video,
.profile-grid-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tw-post-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 24px;
    color: var(--tw-text-secondary);
    background: var(--tw-border);
}

.tw-reel-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
}

.tw-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--tw-text-secondary);
    font-size: 15px;
    grid-column: 1 / -1;
}

.tw-brand {
    padding: 24px;
    text-align: center;
    font-size: 13px;
}

.tw-brand a {
    color: var(--tw-text-secondary);
    text-decoration: none;
}

/* Story viewer */
.tw-story-viewer {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #000;
    display: flex;
    flex-direction: column;
}

.tw-story-viewer[hidden] { display: none !important; }

.tw-story-header { padding: 12px 16px 0; }

.tw-story-progress {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.tw-story-progress-bar {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.tw-story-progress-fill {
    height: 100%;
    width: 0;
    background: #fff;
}

.tw-story-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.tw-story-user img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.tw-story-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.tw-story-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 16px;
}

.tw-story-content img,
.tw-story-content video {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
}

.tw-story-caption {
    color: #fff;
    margin-top: 16px;
    text-align: center;
    font-size: 15px;
}

.tw-story-link-btn {
    margin-top: 12px;
    padding: 10px 24px;
    background: #1d9bf0;
    color: #fff;
    border-radius: 9999px;
    text-decoration: none;
    font-weight: 700;
}

.tw-story-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40%;
    height: 80%;
    border: none;
    background: transparent;
    cursor: pointer;
    z-index: 10;
}

.tw-story-prev { left: 0; }
.tw-story-next { right: 0; }

/* Modal */
.tw-modal {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.tw-modal[hidden] { display: none !important; }

.tw-media-grid[hidden],
.tw-timeline[hidden] { display: none !important; }

.tw-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.tw-modal-sheet {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    background: var(--tw-modal-bg);
    border-radius: 16px 16px 0 0;
    overflow: auto;
    z-index: 1;
}

.tw-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 2;
}

.tw-modal-media-wrap {
    background: #000;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tw-modal-media-wrap img,
.tw-modal-video {
    width: 100%;
    max-height: 50vh;
    object-fit: contain;
}

.tw-modal-body {
    padding: 20px 16px 24px;
}

.tw-modal-body h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.tw-modal-body p {
    font-size: 15px;
    color: var(--tw-text-secondary);
    margin-bottom: 16px;
    line-height: 1.4;
}

.tw-modal-cta {
    width: 100%;
}

@media (min-width: 601px) {
    .tw-modal { align-items: center; }
    .tw-modal-sheet { border-radius: 16px; }
}
