:root {
    --primary-color: #1da1f2;
    --primary-hover-color: #0c85d0;
    --like-color: #e0245e;
    --border-color: #ddd;
    --bg-color: #f0f2f5;
    --text-color: #1c1e21;
    --secondary-text-color: #657786;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
}

header {
    background-color: white;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 a {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-color);
    text-decoration: none;
}

main {
    max-width: 600px;
    margin: 1rem auto;
    padding: 0 1rem;
}

.screen.hidden {
    display: none;
}

button {
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 20px;
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    transition: background-color 0.2s;
}
button:hover {
    background-color: var(--primary-hover-color);
}
button:disabled {
    background-color: #a0d5f5;
    cursor: not-allowed;
}

#user-info button {
    margin-left: 0.5rem;
}
#logout-button { background-color: #6c757d; }
#logout-button:hover { background-color: #5a6268; }

#login-screen {
    text-align: center;
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.post-form, .post, .profile-card {
    background-color: white;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.post-form textarea {
    width: 100%;
    min-height: 80px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 0.5rem;
    box-sizing: border-box;
    resize: vertical;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.post-author {
    font-weight: bold;
    color: var(--text-color);
    text-decoration: none;
}
.post-author:hover {
    text-decoration: underline;
}

.post-time { font-size: 0.85rem; color: var(--secondary-text-color); }
.post-content { margin-bottom: 1rem; white-space: pre-wrap; word-wrap: break-word; }

.post-actions { display: flex; gap: 1.5rem; align-items: center; }
.post-actions button {
    background: none; border: none; color: var(--secondary-text-color);
    padding: 0; font-size: 1.2rem; display: flex; align-items: center; gap: 0.3rem;
}
.post-actions button:hover { color: var(--like-color); }
.post-actions button.liked, .post-actions button.starred {
    color: var(--like-color); font-weight: bold;
}

/* Profile Screen */
#profile-header {
    background-color: white; padding: 1.5rem; border: 1px solid var(--border-color);
    border-radius: 8px; margin-bottom: 1rem;
}
#profile-header h2 { margin-top: 0; }
#profile-header .user-id { color: var(--secondary-text-color); margin-bottom: 1rem; }
#profile-header .user-stats { display: flex; gap: 1rem; margin: 1rem 0; }
#profile-header .follow-button { float: right; }

#profile-tabs { display: flex; border-bottom: 1px solid var(--border-color); margin-bottom: 1rem; }
.tab-button {
    padding: 1rem; border: none; background: none; font-size: 1rem;
    cursor: pointer; color: var(--secondary-text-color);
}
.tab-button.active {
    border-bottom: 2px solid var(--primary-color);
    font-weight: bold; color: var(--primary-color);
}
#profile-content .locked { text-align: center; color: var(--secondary-text-color); padding: 2rem; }
#profile-content .empty-message, #profile-content .error-message { text-align: center; color: var(--secondary-text-color); padding: 1.5rem; }

.profile-card { display: flex; align-items: center; justify-content: space-between; }
.profile-card-info a { text-decoration: none; color: var(--text-color); }
.profile-card-info a .name { font-weight: bold; }
.profile-card-info a .id { color: var(--secondary-text-color); }

/* Settings Screen */
#settings-screen form {
    display: flex; flex-direction: column; gap: 1rem; background-color: white;
    padding: 2rem; border-radius: 8px; border: 1px solid var(--border-color);
}
#settings-screen input[type="text"], #settings-screen textarea {
    padding: 0.5rem; border: 1px solid var(--border-color); border-radius: 5px;
}
#settings-screen fieldset { border: 1px solid var(--border-color); padding: 1rem; }

/* Loading Overlay */
#loading-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.7); display: flex; justify-content: center;
    align-items: center; z-index: 1000;
}
#loading-overlay.hidden {
    display: none;
}
.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px; height: 36px; border-radius: 50%;
    border-left-color: var(--primary-color);
    animation: spin 1s ease infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }