:root {
    --fb-blue: #1877f2;
    --fb-blue-dark: #166fe5;
    --bg: #f0f2f5;
    --card: #ffffff;
    --text: #1c1e21;
    --muted: #65676b;
    --border: #dfe1e6;
    --success-bg: #e7f3ff;
    --success-text: #0d3b8e;
    --error-bg: #fdecec;
    --error-text: #a02828;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 76px 16px 28px;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.site-logo-link {
    position: fixed;
    top: 14px;
    left: 14px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    z-index: 1200;
    text-decoration: none;
}

.site-logo-link img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    display: block;
}

.user-badge {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: min(260px, calc(100vw - 100px));
    color: #2563eb;
    background: #e0e7ef;
    padding: 7px 14px 7px 8px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.07);
    font-size: 1.05em;
    font-weight: 600;
    overflow: hidden;
    text-align: left;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-decoration: none;
}

.user-badge:hover {
    background: #d8e3f2;
    text-decoration: none;
}

.user-badge img,
.user-badge__avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 50%;
}

.user-badge img {
    object-fit: cover;
}

.user-badge__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.user-badge img,
.user-badge__avatar {
    overflow: hidden;
}

.user-badge__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.box {
    width: min(980px, 100%);
    margin: 0 auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    padding: 20px;
    text-align: center;
}

.language-toggle {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.language-toggle__label {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.language-toggle__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #f8fafc;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.language-toggle__link.active {
    background: var(--fb-blue);
    border-color: var(--fb-blue);
    color: #fff;
}

.box h1,
.box h2,
.box h3 {
    margin: 0 0 14px;
    color: var(--text);
    font-weight: 700;
}

.box h1,
.box h2 {
    font-size: 28px;
}

.box h3 {
    font-size: 21px;
}

nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0 0 18px !important;
}

nav a {
    color: var(--text);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 600;
}

nav {
    line-height: 1.35;
}

nav a:hover {
    background: #edf2ff;
}

.box form {
    margin: 14px 0;
}

.box label {
    color: var(--muted);
    font-size: 14px;
}

.box input[type="email"],
.box input[type="file"],
.box input[type="password"],
.box input[type="text"],
.box textarea {
    width: 90%;
    margin: 6px 0 10px;
    padding: 10px 12px;
    border: 1px solid #ccd0d5;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
    background: #fff;
}

.box input[type="file"] {
    cursor: pointer;
}

.box input:focus,
.box textarea:focus {
    border-color: var(--fb-blue);
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.15);
}

.create-option-row {
    width: 90%;
    margin: 6px auto 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.box .create-option-row input[type="text"] {
    flex: 1;
    width: auto;
    margin: 0;
}

.box .delete-option {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    padding: 0;
    border-radius: 50%;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 16px;
    line-height: 1;
}

.box .delete-option:hover {
    background: #fecaca;
}

.profile-picture-preview {
    width: 96px;
    height: 96px;
    margin: 0 auto 10px;
    border-radius: 50%;
    overflow: hidden;
    background: #edf2ff;
    color: var(--fb-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    font-weight: 700;
}

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

.settings-info {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.settings-content {
    width: min(520px, 100%);
    margin: 40px auto 0;
    text-align: center;
}

.settings-content h3 {
    margin-bottom: 24px;
}

.settings-form {
    max-width: 100%;
    margin: 0 auto;
    text-align: center;
}

.settings-form label,
.settings-form small {
    display: block;
    overflow-wrap: anywhere;
}

.settings-form label {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
}

.settings-form small {
    margin: -4px auto 14px;
    color: #64748b;
    line-height: 1.4;
}

.box button {
    border: 0;
    border-radius: 8px;
    background: var(--fb-blue);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    padding: 10px 16px;
    cursor: pointer;
}

.box button:hover {
    background: var(--fb-blue-dark);
}

.box a {
    color: var(--fb-blue);
    text-decoration: none;
}

.box a:hover {
    text-decoration: underline;
}

.success,
.error {
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-weight: 600;
}

.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid #cfe3ff;
}

.error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid #f6caca;
}

.vote-block {
    margin-bottom: 16px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    text-align: left;
}

.vote-block strong {
    font-size: 18px;
}

.vote-block__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.delete-poll-form {
    flex: 0 0 auto;
    margin: 0;
}

.box .delete-poll-button {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.2;
}

.box .delete-poll-button:hover {
    background: #fecaca;
}

.vote-author {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 6px;
    color: var(--muted);
    flex-wrap: wrap;
}

.vote-author img,
.vote-author__avatar {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border-radius: 50%;
}

.vote-author img {
    object-fit: cover;
}

.vote-author__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #edf2ff;
    color: var(--fb-blue);
    font-size: 12px;
    font-weight: 700;
}

.author-profile-link {
    display: inline-flex;
    align-items: center;
    color: var(--fb-blue);
    font-weight: 700;
    text-decoration: none;
}

.author-profile-link:hover {
    text-decoration: underline;
}

.follow-counts {
    display: inline-flex;
    gap: 5px;
    margin-left: 6px;
    color: #475569;
    font-weight: 600;
}

.follow-form {
    display: inline-flex;
    align-items: center;
    margin: 0 0 0 6px !important;
}

.box .follow-button {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.2;
}

.box .follow-button--secondary {
    background: #e2e8f0;
    color: #334155;
}

.box .follow-button--secondary:hover {
    background: #cbd5e1;
}

.public-profile {
    width: min(620px, 100%);
    margin: 26px auto 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
}

.public-profile__avatar,
.public-profile__avatar img,
.public-profile__avatar span {
    width: 84px;
    height: 84px;
    flex: 0 0 84px;
    border-radius: 50%;
}

.public-profile__avatar {
    overflow: hidden;
    background: #edf2ff;
    color: var(--fb-blue);
}

.public-profile__avatar img {
    object-fit: cover;
    display: block;
}

.public-profile__avatar span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 700;
}

.public-profile__details {
    min-width: 0;
}

.public-profile__details h3 {
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}

.public-profile__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-weight: 700;
    margin-bottom: 10px;
}

.public-profile__stats a {
    color: #475569;
    text-decoration: none;
}

.public-profile__stats a:hover,
.public-profile__stats a.active {
    color: var(--fb-blue);
    text-decoration: underline;
}

.public-profile__follow-form {
    margin-left: 0 !important;
}

.profile-user-list {
    display: grid;
    gap: 10px;
    margin: 0 auto 28px;
    width: min(620px, 100%);
}

.profile-user-list__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    text-align: left;
}

.profile-user-list__identity {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
}

.profile-user-list__identity:hover {
    text-decoration: underline;
}

.profile-user-list__identity img,
.profile-user-list__identity span:first-child {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 50%;
}

.profile-user-list__identity img {
    object-fit: cover;
}

.profile-user-list__identity span:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #edf2ff;
    color: var(--fb-blue);
}

.profile-user-list__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-user-list__stats {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    margin-left: auto;
    white-space: nowrap;
}

.profile-user-list__follow-form {
    margin-left: 0 !important;
}

.vote-results {
    margin-top: 10px;
}

.support-footer {
    width: min(980px, 100%);
    margin: 18px auto 0;
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

.support-footer a {
    color: var(--fb-blue);
    font-weight: 700;
    text-decoration: none;
}

.support-footer a:hover {
    text-decoration: underline;
}

.bar-fill.selected {
    box-shadow: 0 0 0 2px #31a24c;
    border-radius: 8px;
    background: linear-gradient(90deg, #d6f2dc 60%, #79db8f 100%);
    color: #165f28;
}

@media (max-width: 640px) {
    body {
        padding: 92px 10px 16px;
    }

    .site-logo-link {
        top: 10px;
        left: 10px;
        width: 60px;
        height: 60px;
    }

    .site-logo-link img {
        width: 60px;
        height: 60px;
    }

    .box {
        padding: 14px;
    }

    .box h1,
    .box h2 {
        font-size: 24px;
    }

    .user-badge {
        top: 14px;
        right: 10px;
        max-width: calc(100vw - 92px);
        padding-right: 10px;
        font-size: 0.95em;
    }

    nav {
        align-items: center;
        gap: 6px;
    }

    nav a {
        margin-right: 0 !important;
        padding: 7px 9px;
    }

    .public-profile {
        align-items: flex-start;
        padding: 14px;
    }

    .profile-user-list__item {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .profile-user-list__stats {
        width: 100%;
        margin-left: 50px;
    }

    .settings-form {
        max-width: 100%;
    }

    .box input[type="email"],
    .box input[type="file"],
    .box input[type="password"],
    .box input[type="text"],
    .box textarea,
    .create-option-row {
        width: 100%;
    }
}
