* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f5f7fb;
    color: #111827;
    font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 70px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid #e5e7eb;
    backdrop-filter: blur(12px);
}

.logo {
    font-size: 25px;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: -0.5px;
}

nav {
    display: flex;
    gap: 6px;
}

nav button {
    border: 0;
    background: transparent;
    color: #4b5563;
    padding: 10px 15px;
    border-radius: 10px;
}

nav button:hover {
    background: #f3f4f6;
    color: #111827;
}

.user-area {
    color: #6b7280;
    font-size: 14px;
}

main {
    width: min(900px, calc(100% - 30px));
    margin: 0 auto;
    padding: 35px 0 80px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.hero {
    padding: 55px 30px;
    margin-bottom: 30px;
    text-align: center;
    border-radius: 22px;
    background: white;
    border: 1px solid #e5e7eb;
}

.hero h1 {
    margin: 0 0 10px;
    font-size: 42px;
}

.hero p {
    margin: 0 0 25px;
    color: #6b7280;
    font-size: 17px;
}

.primary-btn,
.secondary-btn {
    border: 0;
    border-radius: 10px;
    padding: 11px 18px;
    font-weight: 700;
}

.primary-btn {
    background: #111827;
    color: white;
}

.primary-btn:hover {
    background: #000;
}

.secondary-btn {
    background: #eef2f7;
    color: #111827;
}

.secondary-btn:hover {
    background: #e5e7eb;
}

.full {
    width: 100%;
}

.feed-header,
.page-title {
    margin-bottom: 18px;
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.page-title input {
    width: 260px;
}

.feed {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.post {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 22px;
}

.post-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    background: #e5e7eb;
}

.username {
    font-weight: 700;
}

.post-date {
    color: #9ca3af;
    font-size: 12px;
    margin-top: 3px;
}

.post h3 {
    margin: 0 0 10px;
    font-size: 21px;
}

.post-text {
    margin: 0 0 15px;
    color: #374151;
    white-space: pre-wrap;
    line-height: 1.6;
}

.post-image {
    display: block;
    width: 100%;
    max-height: 600px;
    object-fit: cover;
    border-radius: 14px;
    margin-bottom: 15px;
}

.post-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-actions button {
    border: 0;
    background: #f3f4f6;
    padding: 9px 13px;
    border-radius: 9px;
}

.post-actions button:hover {
    background: #e5e7eb;
}

.post-actions .liked {
    background: #fee2e2;
    color: #dc2626;
}

.comments {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #f0f0f0;
}

.comment {
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}

.comment strong {
    margin-right: 7px;
}

.comment-input {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.comment-input input {
    flex: 1;
}

input,
textarea {
    width: 100%;
    border: 1px solid #dbe0e7;
    background: white;
    border-radius: 10px;
    padding: 12px 14px;
    outline: none;
}

input:focus,
textarea:focus {
    border-color: #9ca3af;
}

textarea {
    min-height: 140px;
    resize: vertical;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.45);
}

.modal.show {
    display: flex;
}

.modal-box {
    width: min(550px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    padding: 25px;
    border-radius: 18px;
    background: white;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
}

.modal-header button {
    width: 35px;
    height: 35px;
    border: 0;
    border-radius: 50%;
    background: #f3f4f6;
    font-size: 22px;
}

.modal-box > input,
.modal-box > textarea {
    margin-bottom: 13px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 15px;
}

.image-upload {
    display: block;
    width: fit-content;
    margin: 5px 0 15px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #f3f4f6;
    cursor: pointer;
    font-weight: 700;
}

.image-upload input {
    display: none;
}

.image-preview {
    display: block;
    width: 100%;
    max-height: 350px;
    object-fit: contain;
    border-radius: 12px;
    margin-bottom: 15px;
}

.profile-preview {
    display: block;
    width: 120px;
    height: 120px;
    margin-bottom: 15px;
    border-radius: 50%;
    object-fit: cover;
}

.hidden {
    display: none !important;
}

.profile-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 25px;
}

.profile-top {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
}

#profileImage {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    background: #e5e7eb;
}

#profileName {
    margin: 0 0 8px;
}

#profileBio {
    margin: 0 0 15px;
    color: #6b7280;
}

.stats {
    display: flex;
    gap: 18px;
    color: #6b7280;
}

.section-title {
    margin: 30px 0 18px;
}

.empty {
    padding: 40px 20px;
    text-align: center;
    border-radius: 16px;
    background: white;
    border: 1px solid #e5e7eb;
    color: #9ca3af;
}

@media (max-width: 700px) {
    .topbar {
        height: auto;
        min-height: 70px;
        padding: 14px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    nav button {
        padding: 8px 10px;
        font-size: 13px;
    }

    .hero h1 {
        font-size: 31px;
    }

    .page-title {
        flex-direction: column;
        align-items: stretch;
    }

    .page-title input {
        width: 100%;
    }

    .profile-top {
        align-items: flex-start;
    }

    .stats {
        flex-wrap: wrap;
        gap: 10px;
    }
}