:root {
    --bg-color: #0f0f0f;
    --card-bg: #1a1a1a;
    --primary-color: #ffcc00;
    --text-color: #ffffff;
    --text-muted: #888888;
    --border-color: #2a2a2a;
}

body.light-mode {
    --bg-color: #f7f5f0;
    --card-bg: #ffffff;
    --primary-color: #f5b800;
    --text-color: #18181b;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
    overflow-x: hidden;
    transition: background-color 0.25s, color 0.25s;
}

.screen {
    display: none;
    width: 100%;
    max-width: 480px;
    height: 100dvh;
    max-height: 100dvh;
    background-color: var(--bg-color);
    position: relative;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

.auth-container {
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    gap: 20px;
}

.app-logo {
    text-align: center;
    margin-bottom: 20px;
}

.app-logo h1 {
    color: var(--primary-color);
    font-size: 2.2rem;
}

.form-toggle {
    display: flex;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.form-toggle button {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 10px;
    transition: 0.2s;
}

.form-toggle button.active {
    background: var(--primary-color);
    color: #000;
}

.input-group {
    position: relative;
    margin-bottom: 15px;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 12px 15px 12px 45px;
    border-radius: 12px;
    color: var(--text-color);
    outline: none;
}

.input-group input:focus {
    border-color: var(--primary-color);
}

.toggle-password {
    left: auto !important;
    right: 15px;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary-color);
    color: #000;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
    transition: opacity 0.2s;
}

.btn-primary:hover {
    opacity: 0.9;
}

.reaction-pill {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: transform 0.1s, border-color 0.2s;
}

.reaction-pill:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
}

.header-brand .logo-text {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.header-icons {
    display: flex;
    gap: 14px;
    font-size: 1.1rem;
    color: var(--text-color);
    cursor: pointer;
}

.bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 10px 0;
    position: absolute;
    bottom: 0;
    width: 100%;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    gap: 4px;
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item.plus-btn {
    background: var(--primary-color);
    color: #000;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-item.plus-btn i {
    font-size: 1.2rem;
}

.app-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 70px;
}

.app-tab-content.active {
    display: flex;
    flex-direction: column;
}

.stories-bar-container {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
}

.stories-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
}

.stories-scroll::-webkit-scrollbar {
    display: none;
}

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    flex-shrink: 0;
}

.story-avatar-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(45deg, #ffcc00, #ff6600);
    display: flex;
    justify-content: center;
    align-items: center;
}

.story-avatar-ring.add-story {
    background: var(--border-color);
    position: relative;
}

.story-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--card-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.story-plus-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--primary-color);
    color: #000;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
    border: 2px solid var(--card-bg);
}

.story-username {
    font-size: 0.75rem;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.modal-header i {
    cursor: pointer;
    font-size: 1.2rem;
}

.create-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.create-option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    border-radius: 12px;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.95rem;
}

.create-option-btn i {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.profile-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-header-info {
    text-align: center;
}

.profile-avatar-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 10px;
}

.profile-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    overflow: hidden;
    border: 3px solid var(--primary-color);
}

.avatar-edit-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--card-bg);
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.profile-email {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.profile-field label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.profile-field input, .profile-field textarea {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-color);
    outline: none;
}

.profile-field textarea {
    resize: none;
    height: 70px;
}

.chat-view {
    display: none;
    flex-direction: column;
    height: 100%;
}

.chat-view.active {
    display: flex;
}

.chat-header-title {
    padding: 15px 20px;
}

.conversation-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
}

.conv-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.messages-box {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message-input-form {
    display: flex;
    padding: 12px;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    gap: 10px;
    align-items: center;
}

.message-input-form input {
    flex: 1;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    border-radius: 20px;
    color: var(--text-color);
    outline: none;
}

.send-btn, .chat-plus-btn {
    background: var(--primary-color);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000;
    cursor: pointer;
    flex-shrink: 0;
}

.chat-plus-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.zoom-modal-box {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.zoom-modal-box img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    object-fit: contain;
}

.zoom-close-btn {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
}