:root {
    --bg: #000;
    --bg-secondary: #111;
    --bg-tertiary: #1a1a1a;
    --text: #fff;
    --text-secondary: #888;
    --text-muted: #555;
    --accent: #0085ff;
    --accent-hover: #0066cc;
    --border: #333;
    --error: #ff4444;
    --success: #44ff44;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Views */
.view { display: none; min-height: 100vh; }
.view:not(.hidden) { display: block; }
.hidden { display: none !important; }

/* Landing */
#landing {
    display: flex;
    align-items: center;
    justify-content: center;
}

.landing-content {
    text-align: center;
    padding: 2rem;
}

.logo {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.logo-small { font-size: 1.5rem; cursor: pointer; }

.tagline {
    color: var(--text-secondary);
    margin: 0.5rem 0 2rem;
}

.landing-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn:hover { background: var(--bg-secondary); border-color: var(--text-muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-small { padding: 0.5rem 1rem; font-size: 0.875rem; }
.btn-full { width: 100%; }

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.8);
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    margin: 1rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Auth */
.auth-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: -1px;
}

.auth-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.error {
    color: var(--error);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(255,68,68,0.1);
    border-radius: 4px;
}

.success {
    color: var(--success);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(68,255,68,0.1);
    border-radius: 4px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-search {
    flex: 1;
    max-width: 400px;
    margin: 0 2rem;
    position: relative;
}

.header-search input {
    width: 100%;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    font-size: 0.875rem;
}

.header-search input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg-tertiary); }

.search-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.search-avatar img { width: 100%; height: 100%; object-fit: cover; }

.search-name { font-weight: 500; }
.search-handle { color: var(--text-secondary); font-size: 0.875rem; }

.header-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-handle {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Main Content */
.main-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

/* Composer */
.composer {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.composer textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    resize: none;
}

.composer textarea:focus { outline: none; }

.composer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

#char-count {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Feed Tabs */
.feed-tabs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.feed-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}

.feed-tab:hover {
    color: var(--text);
    background: var(--bg-tertiary);
}

.feed-tab.active {
    color: var(--accent);
    background: rgba(0,133,255,0.1);
}

.feed-tabs .btn {
    margin-left: auto;
}

/* Feed & Posts */
.feed { }

.post {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.post-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    overflow: hidden;
    cursor: pointer;
}

.post-avatar img { width: 100%; height: 100%; object-fit: cover; }

.post-author { flex: 1; }
.post-name { font-weight: 600; cursor: pointer; }
.post-name:hover { color: var(--accent); }
.post-handle { color: var(--text-secondary); font-size: 0.875rem; }
.post-time { color: var(--text-muted); font-size: 0.75rem; }

.post-content {
    font-size: 0.9375rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.post-actions {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
}

.post-action {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.15s;
}

.post-action:hover {
    background: rgba(255,255,255,0.05);
}

.post-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.post-action .action-icon {
    font-size: 1.1rem;
}

.post-action .action-count {
    font-size: 0.8rem;
    min-width: 1rem;
}

/* Like button */
.like-btn:hover {
    color: #f91880;
}

.like-btn.active {
    color: #f91880;
}

/* Repost button */
.repost-btn:hover {
    color: #00ba7c;
}

.repost-btn.active {
    color: #00ba7c;
}

.loading, .empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Profile */
.profile-header {
    display: flex;
    gap: 1.5rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    overflow: hidden;
    flex-shrink: 0;
}

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

.profile-info { flex: 1; }
.profile-info h2 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.profile-info .handle { color: var(--text-secondary); margin-bottom: 0.5rem; }
.profile-info p { margin-bottom: 0.75rem; }

.profile-stats {
    display: flex;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

.profile-actions { align-self: flex-start; }

#profile .feed {
    max-width: 600px;
    margin: 1rem auto;
    padding: 0 1rem;
}

/* Settings */
.settings-content {
    max-width: 500px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.settings-content h2 {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.settings-section {
    margin-bottom: 2rem;
}

.settings-section h3 {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.settings-section textarea {
    min-height: 100px;
    resize: vertical;
}

.status {
    margin-left: 1rem;
    font-size: 0.875rem;
}

.status.success { color: var(--success); }
.status.error { color: var(--error); }

.invite-code {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.invite-code input {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: monospace;
}

/* Responsive */
@media (max-width: 768px) {
    .header { padding: 1rem; flex-wrap: wrap; gap: 1rem; }
    .header-search { order: 3; flex-basis: 100%; margin: 0; }
    .profile-header { flex-direction: column; align-items: center; text-align: center; }
    .profile-stats { justify-content: center; }
}
