:root {
    --x-blue: #1d9bf0;
    --x-black: #000000;
    --surface: #ffffff;
    --background: #f7f9f9;
    --text-main: #0f1419;
    --text-muted: #536471;
    --border: #eff3f4;
    --radius-lg: 1rem;
    --radius-md: 0.5rem;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    --x-black: #ffffff;
    /* Inverted for icon coloring context */
    --surface: #000000;
    --background: #15202b;
    --text-main: #e7e9ea;
    --text-muted: #71767b;
    --border: #2f3336;
    --shadow-sm: 0 1px 2px rgba(255, 255, 255, 0.1);
}

.x-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    background-color: var(--background);
    padding: 2rem;
    border-radius: var(--radius-lg);
}

.x-header {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-main);
}

.x-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.x-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
    position: relative;
}

@media (max-width: 900px) {
    .x-grid {
        grid-template-columns: 1fr;
    }
}

/* Controls */
.x-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.x-panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.x-panel-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.x-input-group {
    margin-bottom: 1rem;
}

.x-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.x-input,
.x-select,
.x-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--background);
    color: var(--text-main);
    font-size: 0.95rem;
}

.x-input:focus {
    border-color: var(--x-blue);
    outline: none;
    box-shadow: 0 0 0 2px rgba(29, 155, 240, 0.2);
}

.x-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

.x-btn-primary {
    background: var(--x-blue);
    color: white;
}

.x-btn-primary:hover {
    background: #1a8cd8;
}

.x-btn-text {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-decoration: underline;
    opacity: 0.8;
    border: none;
    cursor: pointer;
    margin-top: 1rem;
}

.x-btn-text:hover {
    opacity: 1;
    color: var(--text-main);
}


/* Live Preview */
.x-preview-sticky {
    position: -webkit-sticky;
    position: sticky;
    top: 2rem;
    display: flex;
    justify-content: center;
    height: fit-content;
}

.x-tweet-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    width: 100%;
    max-width: 500px;
}

/* User */
.x-user-row {
    display: flex;
    gap: 12px;
}

.x-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.x-user-meta {
    display: flex;
    flex-direction: column;
}

.x-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 4px;
}

.x-handle {
    font-weight: 400;
    font-size: 15px;
    color: var(--text-muted);
}

/* Content */
.x-content {
    margin-top: 12px;
    font-size: 1.25rem;
    /* 20px typical for tweet view */
    line-height: 1.3;
    white-space: pre-wrap;
    color: var(--text-main);
}

.x-hash {
    color: var(--x-blue);
}

.x-media-container {
    margin-top: 12px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    display: none;
    /* hidden if no image */
}

.x-media-container.has-image {
    display: block;
}

.x-media-img {
    width: 100%;
    height: auto;
    display: block;
}

/* Date/Line */
.x-dateline {
    margin-top: 16px;
    font-size: 15px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.x-dateline span {
    margin-right: 4px;
}

.x-client {
    color: var(--x-blue);
    font-weight: 600;
    cursor: pointer;
}

/* Stats */
.x-stats {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 20px;
    font-size: 14px;
}

.x-stat-item strong {
    color: var(--text-main);
    font-weight: 700;
}

.x-stat-item {
    color: var(--text-muted);
}

/* Actions */
.x-actions {
    display: flex;
    justify-content: space-around;
    padding-top: 12px;
    color: var(--text-muted);
    font-size: 1.25rem;
}

.x-action-icon:hover {
    color: var(--x-blue);
}

.x-action-icon.liked:hover {
    color: #f91880;
}

.x-verify-blue {
    color: #1d9bf0;
}

.x-verify-gold {
    color: #feae00;
}

.x-verify-gray {
    color: #829aab;
}