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

body {
    background: #f5f5f7;
    color: #1d1d1f;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'Helvetica Neue', sans-serif;
    line-height: 1.5;
    padding: 3rem 1.5rem;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    padding: 0 20px;
}

.header {
    margin-bottom: 3rem;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #ff3b30;
    margin-bottom: 0.25rem;
    display: inline-block;
}

.subtitle {
    font-size: 0.9rem;
    color: #86868b;
    margin-bottom: 1rem;
    font-weight: 400;
    margin-top: 0;
    display: block;
}

.header h1 a {
    color: #1d1d1f;
    text-decoration: none;
}

.header h1 a:hover {
    color: #86868b;
}

.posts-grid {
    column-count: 2;
    column-gap: 1.5rem;
}

.posts-grid.single-post {
    column-count: 1;
    display: flex;
    justify-content: center;
}

.posts-grid.single-post .post-card {
    max-width: 700px;
    width: 100%;
    margin-bottom: 0;
}

.post-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.3s;
    break-inside: avoid;
    margin-bottom: 1.5rem;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.post-card-inner {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

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

.post-date {
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 0.7rem;
    color: #86868b;
}

.post-author {
    font-size: 0.7rem;
    font-weight: 500;
    color: #1d1d1f;
    background: #f5f5f7;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

.post-author a {
    color: #1d1d1f;
    text-decoration: none;
    border-bottom: 1px solid #eaeaea;
    transition: border-bottom-color 0.2s;
}

.post-author a:hover {
    border-bottom-color: #1d1d1f;
}

.post-card-title {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    color: #1d1d1f;
}

.post-card-content {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #3a3a3e;
    flex: 1;
}

.post-card-content p {
    margin-bottom: 0.75rem;
}

.post-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eaeaea;
}

.like-btn, .dislike-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: #f5f5f7;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #1d1d1f;
    position: relative;
}

.like-btn:hover {
    background: #e0ffe0;
    transform: scale(1.02);
}

.dislike-btn:hover {
    background: #ffe0e0;
    transform: scale(1.02);
}

.like-count, .dislike-count {
    font-weight: 600;
    min-width: 25px;
    text-align: center;
}

.like-btn.active {
    background: #34c759;
    color: white;
}

.dislike-btn.active {
    background: #ff3b30;
    color: white;
}

.like-btn:hover::after {
    content: "Нравится";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background: #1d1d1f;
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

.dislike-btn:hover::after {
    content: "Не нравится";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background: #1d1d1f;
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

.like-btn.active:hover::after {
    content: "Убрать лайк";
}

.dislike-btn.active:hover::after {
    content: "Убрать дизлайк";
}

.post-card-content h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem;
}

.post-card-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0.75rem 0 0.5rem;
}

.post-card-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.5rem 0;
}

.post-card-content ul, .post-card-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.post-card-content li {
    margin: 0.25rem 0;
}

.post-card-content code {
    background: #e8e8ed;
    color: #1d1d1f;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    font-size: 0.85rem;
    font-style: italic;
}

.post-card-content pre {
    background: #e8e8ed;
    padding: 1rem;
    border-radius: 12px;
    overflow-x: auto;
    margin: 0.75rem 0;
}

.post-card-content pre code {
    background: transparent;
    padding: 0;
    font-style: italic;
}

.post-card-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 0.75rem 0;
    display: block;
}

.post-card-content img:hover {
    transform: scale(1.02);
    transition: transform 0.2s;
}

.post-card-content del {
    text-decoration: line-through;
    color: #86868b;
}

.post-card-content a {
    color: #0066cc;
    text-decoration: none;
    border-bottom: 1px solid #0066cc33;
}

.post-card-content a:hover {
    border-bottom-color: #0066cc;
}

.post-card-content iframe,
.post-card-content video {
    width: 100%;
    border-radius: 12px;
    margin: 0.75rem 0;
    aspect-ratio: 16 / 9;
}

.post-card-content video {
    background: #000;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: #ffffff;
    border-radius: 20px;
    color: #86868b;
    font-size: 0.95rem;
}

.admin-panel {
    background: #ffffff;
    border-radius: 20px;
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2rem;
}

.logout-btn {
    background: #f5f5f7;
    color: #1d1d1f;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: #e5e5ea;
}

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #86868b;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #f5f5f7;
    color: #1d1d1f;
}

.tab-btn.active {
    color: #1d1d1f;
    background: #f5f5f7;
}

.tab-content {
    animation: fadeIn 0.2s ease-out;
}

.post-form {
    background: #f5f5f7;
    padding: 1.75rem;
    border-radius: 20px;
    margin-bottom: 2rem;
}

.post-form h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: #1d1d1f;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #1d1d1f;
}

input[type="text"],
input[type="password"],
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d2d2d6;
    border-radius: 14px;
    font-family: inherit;
    font-size: 0.95rem;
    background: #ffffff;
    transition: all 0.2s;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #1d1d1f;
    box-shadow: 0 0 0 3px rgba(29, 29, 31, 0.1);
}

textarea {
    min-height: 180px;
    resize: vertical;
}

button, .create-btn {
    background: #1d1d1f;
    color: #ffffff;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 14px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover {
    background: #3a3a3e;
}

.cancel-btn {
    background: #f5f5f7;
    color: #1d1d1f;
    margin-left: 0.5rem;
}

.cancel-btn:hover {
    background: #e5e5ea;
}

.posts-list {
    margin-top: 2rem;
}

.posts-list h2 {
    color: #bcbcbf;
    font-weight: 400;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.post-item {
    background: #f5f5f7;
    border-radius: 16px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.post-item:hover {
    background: #ebebef;
}

.post-item-header {
    flex: 1;
}

.post-item-header strong {
    font-size: 1rem;
    font-weight: 600;
    color: #1d1d1f;
    display: block;
    margin-bottom: 0.25rem;
}

.post-item-meta {
    font-family: monospace;
    font-size: 0.7rem;
    color: #86868b;
}

.post-item-meta a {
    color: #1d1d1f;
    text-decoration: none;
    border-bottom: none;
}

.post-item-meta a:hover {
    color: #86868b;
}

.post-item-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.stat-likes, .stat-dislikes {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    background: #ffffff;
}

.stat-likes {
    color: #34c759;
}

.stat-dislikes {
    color: #ff3b30;
}

.reset-like-btn, .reset-dislike-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    border-radius: 8px;
    color: #86868b;
    transition: all 0.2s;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.reset-like-btn:hover, .reset-dislike-btn:hover {
    color: #ff3b30;
    background: none;
}

.reset-like-btn:hover::after {
    content: "Сбросить лайки";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background: #1d1d1f;
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

.reset-dislike-btn:hover::after {
    content: "Сбросить дизлайки";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background: #1d1d1f;
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

.post-item-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.post-item-actions .edit-btn,
.post-item-actions .delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    border-radius: 8px;
    color: #86868b;
    transition: all 0.2s;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
}

.post-item-actions .edit-btn:hover {
    background: none;
    color: #1d1d1f;
}

.post-item-actions .delete-btn:hover {
    background: none;
    color: #ff3b30;
}

.post-item-actions .edit-btn:hover::after {
    content: "Редактировать пост";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background: #1d1d1f;
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

.post-item-actions .delete-btn:hover::after {
    content: "Удалить пост";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background: #1d1d1f;
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

.editor-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: #f5f5f7;
    border-radius: 12px;
    flex-wrap: wrap;
}

.editor-btn {
    background: white;
    border: 1px solid #d2d2d6;
    color: #1d1d1f;
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 36px;
    position: relative;
}

.editor-btn:hover {
    background: #e5e5ea;
    border-color: #1d1d1f;
}

.editor-btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background: #1d1d1f;
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 400;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.editor-btn[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 2px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #1d1d1f;
    z-index: 1000;
    pointer-events: none;
}

.stats-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.clear-stats-btn, .export-stats-btn {
    background: #f5f5f7;
    color: #1d1d1f;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-stats-btn:hover {
    background: #ffe0e0;
    color: #ff3b30;
}

.export-stats-btn:hover {
    background: #e0ffe0;
    color: #34c759;
}

.stats-table-wrapper {
    overflow-x: auto;
    border-radius: 16px;
    background: #f5f5f7;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    min-width: 1100px;
}

.stats-table th {
    background: #e5e5ea;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #1d1d1f;
}

.stats-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #e0e0e5;
    color: #3a3a3e;
}

.stats-table tr:hover {
    background: #ebebef;
}

.stats-table code {
    font-family: monospace;
    font-size: 0.7rem;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-mobile {
    background: #34c75920;
    color: #34c759;
}

.badge-desktop {
    background: #1d1d1f20;
    color: #1d1d1f;
}

.badge-tablet {
    background: #ff9f0a20;
    color: #ff9f0a;
}

.badge-vpn {
    background: #ff9f0a20;
    color: #ff9f0a;
}

.badge-normal {
    background: #34c75920;
    color: #34c759;
}

.badge-success {
    background: #34c75920;
    color: #34c759;
}

.badge-failed {
    background: #ff3b3020;
    color: #ff3b30;
}

.delete-entry-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 8px;
    color: #ff3b30;
    transition: all 0.2s;
}

.delete-entry-btn:hover {
    background: #ffe0e0;
    transform: scale(1.05);
}

.login-form {
    max-width: 360px;
    margin: 2rem auto;
    background: #ffffff;
    padding: 2rem;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form .error {
    margin: 1rem 0;
    color: #ff3b30;
    font-size: 0.8rem;
    padding: 0.5rem;
    border-radius: 10px;
    background: #ffe5e5;
    text-align: center;
}

.login-form button {
    width: 100%;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 24px;
    max-width: 500px;
    width: 90%;
    padding: 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem 1.5rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid #eaeaea;
}

.modal-icon {
    font-size: 1.8rem;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body p {
    margin: 0 0 0.5rem;
    color: #3a3a3e;
}

.modal-warning {
    font-size: 0.8rem;
    color: #ff3b30;
}

.modal-footer {
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    border-top: 1px solid #eaeaea;
}

.modal-btn {
    padding: 0.6rem 1.25rem;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.modal-cancel {
    background: #f5f5f7;
    color: #1d1d1f;
}

.modal-cancel:hover {
    background: #e5e5ea;
}

.modal-confirm {
    background: #ff3b30;
    color: white;
}

.modal-confirm:hover {
    background: #d70015;
}

.error {
    color: #ff3b30;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 10px;
    background: #ffe5e5;
}

.instruction {
    background: #f5f5f7;
    padding: 0.75rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.8rem;
}

.instruction p {
    margin: 0.25rem 0;
}

.instruction code {
    background: #e5e5ea;
    padding: 0.1rem 0.3rem;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.75rem;
}

@media (max-width: 768px) {
    body {
        padding: 1.5rem 1rem;
    }
    .header h1 {
        font-size: 1.8rem;
    }
    .subtitle {
        font-size: 0.8rem;
    }
    .posts-grid {
        column-count: 1;
        column-gap: 0;
    }
    .post-card {
        margin-bottom: 1rem;
    }
    .posts-grid.single-post .post-card {
        max-width: 100%;
    }
    .post-card-inner {
        padding: 1rem;
    }
    .post-card-title {
        font-size: 1.2rem;
    }
    .post-card-content {
        font-size: 0.85rem;
    }
    .admin-panel {
        padding: 1rem;
    }
    .post-form {
        padding: 1.25rem;
    }
    .post-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .post-item-actions {
        align-self: flex-end;
    }
    .post-item-stats {
        width: 100%;
        justify-content: flex-start;
    }
    .like-btn, .dislike-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.9rem;
    }
    .stats-table {
        font-size: 0.7rem;
        min-width: 900px;
    }
    .stats-table th, .stats-table td {
        padding: 0.4rem;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
