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

:root {
    --safe-area-top: 0px;
}

@supports (padding-top: env(safe-area-inset-top)) {
    :root {
        --safe-area-top: env(safe-area-inset-top, 0px);
    }
}

@supports (padding-top: constant(safe-area-inset-top)) {
    :root {
        --safe-area-top: constant(safe-area-inset-top);
    }
}

html, body {
    height: 100%;
    overflow: hidden;
    position: fixed;
    width: 100%;
}

.leaderboard-page html,
.leaderboard-page body {
    height: 100%;
    overflow: hidden;
    position: fixed;
}

/* Profile page - allow body to scroll */
.profile-page {
    position: relative;
    overflow: auto;
}

/* Leaderboard page - fixed layout with scrollable content */
.leaderboard-page {
    position: relative;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    margin: 0;
    padding: 0;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Header */
header {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem;
    position: relative;
    z-index: 5000;
    flex-shrink: 0;
}

.safe-area-spacer {
    /* Всегда оставляем запас под чёлку, даже если safe-area вдруг станет 0 */
    height: max(var(--safe-area-top), 32px);
    margin: -1rem -1rem 0;
    background: #fff;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.header-content h1 {
    font-size: 1.5rem;
    color: #2563eb;
}

.user-name-badge {
    font-size: 0.95rem;
    color: #1f2937;
    background: rgba(37, 99, 235, 0.12);
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    line-height: 1.4;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    text-decoration: none;
    display: inline-block;
}

.user-name-badge:hover {
    background: rgba(37, 99, 235, 0.2);
    border-color: rgba(37, 99, 235, 0.4);
}

.user-name-badge:empty {
    display: none;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    z-index: 5001;
}

.btn-menu-toggle {
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
}

.btn-menu-toggle:hover {
    background: #1d4ed8;
}

.btn-menu-toggle:active {
    background: #1e40af;
}

.main-nav {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    padding: 0.5rem;
    min-width: 200px;
    z-index: 5000;
    border: 1px solid #e5e7eb;
}

.main-nav.active {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    color: #374151;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.nav-link:hover {
    background: #f3f4f6;
    color: #111827;
}

.nav-link.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

/* Buttons */
.btn-primary {
    background: #2563eb;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #6b7280;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-profile, .btn-logout {
    padding: 0.4rem 0.7rem;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
    display: inline-block;
    text-align: center;
    flex-shrink: 1;
}

.btn-profile {
    background: #e5e7eb;
    color: #333;
}

.btn-profile:hover {
    background: #d1d5db;
}

.btn-logout {
    background: #ef4444;
    color: white;
}

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

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.entrance-card-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    align-items: stretch;
}

.btn-add-code {
    flex: 1;
    padding: 0.75rem;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
    margin: 0;
}

.btn-add-code:hover {
    background: #059669;
}

.btn-route-inline {
    flex-shrink: 0;
    width: 48px;
    padding: 0;
    background: #eb2525;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(185, 16, 16, 0.25);
}

.btn-route-inline:hover {
    background: #960505;
    box-shadow: 0 4px 8px rgba(185, 16, 16, 0.35);
    transform: scale(1.05);
}

.btn-route-inline:active {
    background: #780404;
    transform: scale(0.95);
}

.btn-route-inline svg {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* Search */
.search-container {
    max-width: 100%;
    margin: 0;
    padding: 1rem;
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.search-inner {
    display: flex;
    gap: 0.5rem;
}

#search-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 1rem;
    -webkit-user-select: text;
    user-select: text;
}

#search-input:focus {
    outline: none;
    border-color: #2563eb;
}

/* Кнопка поиска удалена, стили больше не нужны */

.search-suggestions {
    position: absolute;
    left: 1rem;
    right: 1rem;
    top: 100%;
    margin-top: 0.25rem;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
    border: 1px solid #e5e7eb;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 1500;
}

.search-suggestions-list {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
}

.search-suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}

.search-suggestion-item:hover {
    background: #f3f4f6;
}

.search-suggestion-marker {
    font-size: 1rem;
    min-width: 20px;
    text-align: center;
}

.search-suggestion-text {
    flex: 1;
    font-size: 0.95rem;
    color: #111827;
    line-height: 1.4;
}

.search-suggestion-sub {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.15rem;
}

/* App container */
#app {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
}

/* Profile page - enable scrolling */
.profile-page #app {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    flex-direction: column;
    position: relative;
    height: 100%;
    bottom: 0;
}

/* Map */
#map {
    flex: 1;
    width: 100%;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    position: relative;
    min-height: 0;
    background: #e5e7eb;
}

/* Легенда карты */
.map-legend {
    position: absolute;
    bottom: 80px;
    left: 20px;
    background: transparent;
    padding: 8px;
    z-index: 1000;
    font-size: 0.875rem;
    min-width: 160px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.legend-text {
    color: white;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 2px rgba(0, 0, 0, 0.5);
}

/* Убеждаемся, что Leaflet контейнер видим */
#map .leaflet-container {
    height: 100% !important;
    width: 100% !important;
}

/* Маркеры подъездов */
.entrance-marker-empty,
.entrance-marker-with-codes {
    background: transparent !important;
    border: none !important;
}

/* Серый маркер - просто текст */
.entrance-number-text {
    color: #6b7280;
    font-weight: bold;
    text-align: center;
    text-shadow: 
        -1px -1px 0 white,
        1px -1px 0 white,
        -1px 1px 0 white,
        1px 1px 0 white,
        0 0 3px white,
        0 0 3px white;
    line-height: 1;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Маркер-подъезд: круг с текстом, цвет зависит от статуса кодов */
.entrance-number-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #9ca3af; /* базовый серый */
    border: 2px solid white;
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    line-height: 1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    text-align: center;
}

/* Серый кружок – только устаревшие / архивные коды */
.entrance-number-circle.status-gray {
    background: #9ca3af;
}

/* Оранжевый кружок – «вероятно устаревшие» коды */
.entrance-number-circle.status-orange {
    background: #f59e0b;
}

/* Зелёный кружок – актуальные коды */
.entrance-number-circle.status-green {
    background: #10b981;
}

/* Синий кружок – подтверждённые коды */
.entrance-number-circle.status-blue {
    background: #2563eb;
}

/* Маркер для режима редактирования местоположения */
.entrance-marker-editing {
    background: transparent !important;
    border: none !important;
}

.location-edit-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    user-select: none;
    pointer-events: none;
    line-height: 1;
}

/* Маркер результата поиска */
.search-result-marker {
    background: transparent !important;
    border: none !important;
}

.search-marker-pulse {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #10b981;
    opacity: 0.6;
    animation: searchPulse 2s infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.search-marker-dot {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #10b981;
    border: 3px solid white;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

@keyframes searchPulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.3;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Popup для результата поиска */
.search-popup {
    min-width: 200px;
}

.search-popup h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: #111;
}

.search-popup p {
    margin: 0.5rem 0;
    font-size: 0.85rem;
}

/* Кнопка возврата к местоположению */
.locate-btn {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: 2px solid #2563eb;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    padding: 0;
}

.locate-btn svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s;
    pointer-events: none;
}

.locate-btn:hover {
    transform: scale(1.1);
}

.locate-btn:active {
    transform: scale(0.95);
}

/* Маркер текущего местоположения */
.user-location-marker {
    background: transparent !important;
    border: none !important;
}

.user-location-pulse {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    opacity: 0.6;
    animation: pulse 2s infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.user-location-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2563eb;
    border: 2px solid white;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.3;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Entrance Card */
.entrance-card {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                max-height 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    max-height: 50vh;
    height: auto;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.entrance-card.show {
    transform: translateY(0);
    will-change: bottom;
}

.entrance-card.closing {
    transition: transform 0.2s cubic-bezier(0.4, 0, 1, 1) !important;
}

.entrance-card.expanded {
    max-height: 90vh;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                max-height 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                bottom 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.entrance-card.expanded #entrance-codes {
    max-height: calc(90vh - 200px);
}

.entrance-card.editing-location {
    bottom: -220px;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                max-height 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                bottom 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.location-edit-actions {
    display: none;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.entrance-card.editing-location .location-edit-actions {
    display: flex;
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 1.5rem 1.5rem 1.5rem;
    position: relative;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    gap: 0.75rem;
}

.card-header:active {
    cursor: grabbing;
}

.card-header-main {
    flex: 1;
    min-width: 0;
}

.card-header h2 {
    font-size: 1.25rem;
    color: #111;
    margin: 0 0 0.25rem 0;
}

.entrance-author {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.card-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-edit-entrance,
.btn-delete-entrance {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.btn-edit-entrance:hover {
    background: #f3f4f6;
}

.btn-delete-entrance:hover {
    background: #fee2e2;
}

#entrance-codes {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.5rem;
    padding-bottom: 0.5rem;
    margin-top: 1rem;
    min-height: 150px;
    max-height: calc(50vh - 200px);
    /* Показываем немного следующего кода для индикации прокрутки */
    position: relative;
    /* Скрываем скроллбар на мобильных */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

#entrance-codes::-webkit-scrollbar {
    width: 4px;
}

#entrance-codes::-webkit-scrollbar-track {
    background: transparent;
}

#entrance-codes::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

/* Эффект "торчащего" следующего кода */
#entrance-codes::after {
    content: '';
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0) 0%, 
        rgba(255, 255, 255, 0.6) 40%,
        rgba(255, 255, 255, 0.9) 70%,
        rgba(255, 255, 255, 1) 100%);
    pointer-events: none;
    z-index: 1;
    margin-top: -60px;
    display: block;
}

/* Убираем градиент, если прокрутили до конца */
#entrance-codes.scrolled-to-bottom::after {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.code-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    min-height: 140px;
    position: relative;
}

.code-item:first-child {
    margin-top: 0;
}

/* Если код единственный, делаем его более заметным */
#entrance-codes:has(.code-item:only-child) {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#entrance-codes:has(.code-item:only-child) .code-item {
    min-height: 200px;
    padding: 1.5rem;
    border-width: 2px;
    width: 100%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.code-item.active {
    background: #eff6ff;
    border-color: #3b82f6;
}

.code-item.probably-outdated {
    background: #fef3c7;
    border-color: #f59e0b;
}

.code-item.outdated {
    background: #f3f4f6;
    border-color: #9ca3af;
    opacity: 0.7;
}

.code-item.archived {
    background: #f3f4f6;
    border-color: #9ca3af;
    opacity: 0.5;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.code-row-1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.code-value {
    font-size: 1rem;
    font-weight: 500;
    color: #111;
    flex: 1;
}

.code-status {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    white-space: nowrap;
    margin-left: auto;
}

.code-status.active {
    background: #10b981;
    color: white;
}

.code-status.confirmed {
    background: #2563eb;
    color: white;
}

.code-status.probably-outdated {
    background: #f59e0b;
    color: white;
}

.code-status.outdated {
    background: #6b7280;
    color: white;
}

.code-status.archived {
    background: #9ca3af;
    color: white;
}

.code-comment {
    color: #666;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.code-row-2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
}

.code-like-btn,
.code-report-btn,
.code-not-working-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    background: #f3f4f6;
    color: #111;
}

.code-like-btn:hover:not(:disabled) {
    background: #e5e7eb;
}

.code-like-btn.active {
    background: #dbeafe;
    color: #2563eb;
}

.code-like-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.code-like-btn .like-count {
    font-weight: 600;
    font-size: 0.85rem;
}

.code-report-btn {
    padding: 0.5rem;
    min-width: 36px;
    justify-content: center;
    background: #f9fafb;
}

.code-report-btn:hover:not(:disabled) {
    background: #e5e7eb;
}

.code-report-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.code-not-working-btn {
    background: #fee2e2;
    color: #dc2626;
    font-weight: 500;
    margin-left: auto;
}

.code-not-working-btn:hover:not(:disabled) {
    background: #fecaca;
}

.code-not-working-btn.active {
    background: #dc2626;
    color: white;
}

.code-not-working-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.code-delete-btn {
    padding: 0.5rem;
    min-width: 36px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    background: #fee2e2;
    color: #dc2626;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.code-delete-btn:hover {
    background: #fecaca;
}

.code-row-3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
    font-size: 0.85rem;
    color: #6b7280;
}

.code-author {
    font-weight: 500;
}

.code-date {
    color: #9ca3af;
}

.archive-header {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e5e7eb;
}

.archive-header h4 {
    color: #9ca3af;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

.code-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #9ca3af;
}

.code-actions {
    display: flex;
    gap: 0.5rem;
}

.code-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem;
}

.code-action-btn.like {
    color: #10b981;
}

.code-action-btn.not-working {
    color: #ef4444;
}

.code-action-btn.dislike {
    color: #ef4444;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
}

.modal-content h3 {
    margin-bottom: 1rem;
}

.modal-content input,
.modal-content textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 1rem;
    font-family: inherit;
    -webkit-user-select: text;
    user-select: text;
}

.modal-content textarea {
    min-height: 100px;
    resize: vertical;
}

.edit-location-hint {
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: #f3f4f6;
    border-radius: 6px;
}

.edit-location-hint p {
    margin: 0;
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.4;
}

.btn-edit-location {
    width: 100%;
    padding: 0.75rem;
    margin: 1rem 0;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-edit-location:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.location-editing-hint-card {
    margin: 0 0 1rem 0;
    padding: 0.75rem;
    background: #fef3c7;
    border-left: 3px solid #f59e0b;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #92400e;
    animation: slideIn 0.3s ease-out;
}

.location-editing-hint-card p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Auth Page */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.auth-container h1 {
    text-align: center;
    color: #2563eb;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
}

.auth-container h2 {
    margin-bottom: 1.5rem;
    color: #111;
}

.auth-container input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.auth-container input:focus {
    outline: none;
    border-color: #2563eb;
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
    color: #666;
}

.auth-link a {
    color: #2563eb;
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

.auth-message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    text-align: center;
    display: none;
}

.auth-message.error {
    background: #fee2e2;
    color: #dc2626;
    display: block;
}

.auth-message.success {
    background: #d1fae5;
    color: #059669;
    display: block;
}

/* Profile */
.profile-container {
    max-width: 700px;
    margin: 2rem auto;
    padding: 0 1rem 2rem;
    flex: 1;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px 16px 0 0;
    color: white;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.profile-header-info {
    flex: 1;
}

.profile-header-info h2 {
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.profile-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.profile-main-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem;
    background: white;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.profile-card {
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
    position: relative;
}

.profile-card h3 {
    margin: 0 0 1.25rem;
    font-size: 1.1rem;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.profile-info-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.info-icon {
    font-size: 1.2rem;
    line-height: 1;
    margin-top: 0.1rem;
}

.info-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-label {
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 500;
}

.info-value-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.invite-code-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.3);
    color: #1d4ed8;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    transition: filter 0.2s ease;
}

.invite-code-badge.blurred {
    filter: blur(5px);
    cursor: pointer;
}

.invite-code-badge.blurred:hover {
    filter: blur(3px);
}

.btn-copy-invite {
    border: none;
    background: #e5e7eb;
    color: #111827;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
}

.btn-copy-invite:hover {
    background: #d1d5db;
    transform: scale(1.05);
}

.btn-copy-invite:active {
    transform: scale(0.95);
}

.btn-refresh-invite {
    border: none;
    background: #fef3c7;
    color: #92400e;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
}

.btn-refresh-invite:hover {
    background: #fde68a;
    transform: scale(1.05);
}

.btn-refresh-invite:active {
    transform: scale(0.95);
}

.btn-refresh-invite:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.profile-hint {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.5;
}

.achievements-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.achievement-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.achievement-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.achievement-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.achievement-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.achievement-name {
    font-weight: 600;
    color: #111827;
    font-size: 0.95rem;
}

.achievement-description {
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.4;
}

.achievement-date {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* Bio */
.profile-bio-card {
    margin-bottom: 1.5rem;
}

.bio-display {
    margin-top: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    min-height: 3rem;
    line-height: 1.6;
    color: #111827;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.bio-edit {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    margin-top: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s;
}

.bio-edit:focus {
    outline: none;
    border-color: #2563eb;
}

.bio-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.btn-edit-bio {
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #374151;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit-bio:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.bio-char-count {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #6b7280;
    text-align: right;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.profile-stat {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
    min-height: 100px;
    transition: all 0.2s ease;
}

.profile-stat:hover {
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.stat-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

.stat-label {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}


/* Кастомные модальные окна */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 1rem;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.custom-modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s;
}

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

.custom-modal-large {
    max-width: 500px;
}

.custom-modal-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.custom-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #111;
}

.custom-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    -webkit-user-select: none;
    user-select: none;
}

.custom-modal-body p {
    margin: 0 0 1rem 0;
    color: #333;
    line-height: 1.5;
}

.custom-modal-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    margin-top: 0.5rem;
}

.custom-modal-input:focus {
    outline: none;
    border-color: #2563eb;
}

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

.custom-modal-footer button {
    min-width: 80px;
}

/* Список выбора */
.custom-choice-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 1rem;
}

.custom-choice-item {
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

.custom-choice-item:hover {
    background: #f9fafb;
    border-color: #2563eb;
}

.custom-choice-item:active {
    transform: scale(0.98);
}

.choice-marker {
    font-size: 1.2rem;
    min-width: 24px;
    text-align: center;
}

.choice-marker.local-active {
    color: #10b981; /* зелёный - наш подъезд с актуальными/подтверждёнными кодами */
}

.choice-marker.local-warning {
    color: #f59e0b; /* оранжевый - наши подъезды с «возможно неактуальными» кодами */
}

.choice-marker.local-outdated {
    color: #6b7280; /* серый - только устаревшие/архивные коды */
}

.choice-text {
    flex: 1;
    color: #333;
    line-height: 1.5;
}

/* Мобильные устройства (портретный режим) */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    /* Легенда карты для мобильных */
    .map-legend {
        bottom: 100px;
        left: 10px;
        padding: 8px;
        font-size: 0.75rem;
        min-width: 130px;
    }
    
    .legend-color {
        width: 14px;
        height: 14px;
    }
    
    /* Header для мобильных */
    header {
        padding: 0.75rem;
    }
    
    .header-content {
        flex-wrap: nowrap;
    }
    
    .header-content h1 {
        font-size: 1.25rem;
    }
    
    .header-actions {
        gap: 0.4rem;
        flex-wrap: nowrap;
    }
    
    .btn-profile, .btn-logout {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    /* Поиск для мобильных */
    .search-container {
        padding: 0.5rem;
        margin: 0.5rem auto;
        gap: 0.25rem;
    }
    
    #search-input {
        padding: 0.6rem;
        font-size: 16px; /* Предотвращает зум на iOS */
    }
    
    #search-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    /* Карта для мобильных */
    #map {
        height: calc(100vh - 180px);
        border-radius: 0;
        margin: 0;
    }
    
    /* Кнопка местоположения для мобильных */
    .locate-btn {
        bottom: 120px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    /* Когда карточка открыта, кнопка выше */
    .locate-btn.card-open {
        bottom: calc(85vh + 20px);
    }
    
    /* Карточка подъезда для мобильных */
    .entrance-card {
        width: 100%;
        max-width: 100%;
        bottom: 0;
        left: 0;
        transform: none;
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
        padding: 1rem;
    }
    
    .card-header h2 {
        font-size: 1.1rem;
    }
    
    .btn-close {
        font-size: 1.5rem;
        padding: 0.25rem;
    }
    
    /* Коды для мобильных */
    .code-item {
        padding: 0.75rem;
    }
    
    .code-value {
        font-size: 1.1rem;
    }
    
    .code-actions {
        gap: 0.25rem;
    }
    
    .code-action-btn {
        font-size: 1rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* Модальное окно для мобильных */
    .modal-content {
        width: 95%;
        padding: 1.5rem;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-content input,
    .modal-content textarea {
        font-size: 16px; /* Предотвращает зум на iOS */
        padding: 0.6rem;
    }
    
    /* Профиль для мобильных */
    .profile-container {
        margin: 1rem;
    }

    .profile-header {
        padding: 1.5rem;
        gap: 1rem;
        border-radius: 12px 12px 0 0;
    }

    .profile-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .profile-header-info h2 {
        font-size: 1.25rem;
    }

    .profile-main-grid {
        padding: 1.5rem;
        border-radius: 0 0 12px 12px;
    }

    .profile-card {
        padding: 1.25rem;
    }

    .profile-stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .profile-stat {
        padding: 0.85rem;
    }

    .info-value-group {
        flex-wrap: wrap;
    }
    
    /* Кнопки для мобильных */
    .btn-primary, .btn-secondary {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn-add-code {
        padding: 0.6rem;
        font-size: 0.9rem;
    }
}

/* Leaderboard */
.leaderboard-page #app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.leaderboard-page header {
    flex-shrink: 0;
}

.leaderboard-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem 1rem 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    padding-bottom: 1rem;
}

.leaderboard-title {
    text-align: center;
    font-size: 2rem;
    color: #111827;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

.leaderboard-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: white;
    padding: 0.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.tab-btn.active {
    background: #2563eb;
    color: white;
}

.leaderboard-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    max-height: calc(100vh - 300px);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: min-content;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}

.leaderboard-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.leaderboard-rank {
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.medal {
    font-size: 1.5rem;
}

.rank-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: #6b7280;
}

.leaderboard-user {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.user-info .username {
    text-decoration: none;
    color: inherit;
}

.user-info .username:hover {
    text-decoration: underline;
}

.leaderboard-value {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
}

.value-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

.value-label {
    font-size: 0.85rem;
    color: #6b7280;
}

.loading, .error, .empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.error {
    color: #dc2626;
}

/* Role colors */
.role-admin {
    color: #2563eb !important;
    font-weight: 600;
}

.role-user {
    color: #6b7280 !important;
}

.role-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
    text-transform: uppercase;
}

.role-badge.admin {
    background: #dbeafe;
    color: #2563eb;
}

.entrance-author .role-admin,
.code-author.role-admin {
    color: #2563eb;
    font-weight: 600;
}

.entrance-author .role-user,
.code-author.role-user {
    color: #6b7280;
}

    /* Очень маленькие экраны */
@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.1rem;
    }
    
    .header-actions {
        gap: 0.3rem;
    }
    
    .btn-profile, .btn-logout {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .user-name-badge {
        font-size: 0.8rem;
        padding: 0.15rem 0.5rem;
    }
    
    #map {
        height: calc(100vh - 160px);
    }
    
    .entrance-card {
        max-height: 90vh;
        padding: 0.75rem;
    }
    
    .search-container {
        flex-direction: column;
    }
    
    #search-btn {
        width: 100%;
    }
    
    /* Кастомные модальные окна для мобильных */
    .custom-modal {
        padding: 0.5rem;
    }
    
    .custom-modal-content {
        max-width: 100%;
        max-height: 95vh;
    }
    
    .custom-modal-header {
        padding: 1rem;
    }
    
    .custom-modal-header h3 {
        font-size: 1.1rem;
    }
    
    .custom-modal-body {
        padding: 1rem;
    }
    
    .custom-modal-footer {
        padding: 0.75rem 1rem 1rem;
        flex-direction: column-reverse;
    }
    
    .custom-modal-footer button {
        width: 100%;
        margin: 0;
    }
    
    .custom-choice-list {
        max-height: 250px;
    }
    
    .custom-choice-item {
        padding: 0.75rem;
    }

    /* Профиль для очень маленьких экранов */
    .profile-container {
        margin: 0.5rem;
    }

    .profile-header {
        padding: 1.25rem;
        flex-direction: column;
        text-align: center;
    }

    .profile-main-grid {
        padding: 1.25rem;
    }

    .profile-card {
        padding: 1rem;
    }
}

/* Feed Page - Лента новостей */
.feed-page #app {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    flex-direction: column;
    position: relative;
    height: 100%;
}

.feed-container {
    flex: 1;
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.feed-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.feed-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: #111827;
}

.feed-subtitle {
    margin: 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.feed-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #e5e7eb;
}

.filter-btn.active {
    background: #2563eb;
    color: white;
}

.feed-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.feed-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.feed-item:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.feed-item-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.feed-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
}

.feed-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.feed-item-type {
    font-weight: 600;
    color: #111827;
    font-size: 0.8125rem;
}

.feed-item-time {
    color: #9ca3af;
    font-size: 0.6875rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.feed-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.feed-item-address-compact {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
    line-height: 1.3;
}

.feed-item-code-compact {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    background: #f3f4f6;
    border-radius: 6px;
    width: fit-content;
}

.feed-item-code-compact .code-value {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #111827;
    font-family: 'Courier New', monospace;
}

.feed-item-codes-count-compact {
    color: #6b7280;
    font-size: 0.75rem;
}

.feed-item-achievement-name {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.feed-item-code {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f3f4f6;
    border-radius: 8px;
    margin-top: 0.25rem;
}

.code-label {
    font-size: 0.875rem;
    color: #6b7280;
}

.code-value {
    font-weight: 600;
    font-size: 1.125rem;
    color: #111827;
    font-family: 'Courier New', monospace;
}

.feed-item-comment {
    color: #6b7280;
    font-size: 0.875rem;
    font-style: italic;
    margin-top: 0.25rem;
}

.feed-item-codes-count {
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.feed-item-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.feed-item-author {
    color: #6b7280;
    font-size: 0.75rem;
}

.feed-item-likes {
    color: #10b981;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-view-entrance {
    margin-left: auto;
    padding: 0.5rem 1rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-view-entrance:hover {
    background: #1d4ed8;
}

.btn-view-entrance:active {
    background: #1e40af;
}

.btn-view-entrance-small {
    margin-left: auto;
    padding: 0.375rem 0.5rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-view-entrance-small:hover {
    background: #1d4ed8;
}

.btn-view-entrance-small:active {
    background: #1e40af;
}

.feed-end {
    text-align: center;
    padding: 2rem;
    color: #9ca3af;
    font-size: 0.875rem;
}

/* Стили для создания постов */
#create-post-btn-container {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
}

.btn-create-post {
    padding: 0.75rem 1.5rem;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-create-post:hover {
    background: #059669;
}

.btn-create-post:active {
    background: #047857;
}

#create-post-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#create-post-modal .modal-content {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

#create-post-modal h3 {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

#post-title-input,
#post-content-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-family: inherit;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

#post-content-input {
    resize: vertical;
    min-height: 120px;
}

#post-title-input:focus,
#post-content-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.modal-actions .btn-primary {
    padding: 0.625rem 1.25rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-actions .btn-primary:hover {
    background: #1d4ed8;
}

.modal-actions .btn-secondary {
    padding: 0.625rem 1.25rem;
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-actions .btn-secondary:hover {
    background: #e5e7eb;
}

/* Стили для постов в ленте */
.feed-item-post-title {
    font-weight: 600;
    font-size: 1rem;
    color: #111827;
    margin-bottom: 0.5rem;
}

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

.feed-item-liked-by {
    color: #6b7280;
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

.feed-item-views {
    color: #6b7280;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-edit-post,
.btn-delete-post {
    padding: 0.375rem 0.5rem;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: 0.25rem;
}

.btn-edit-post {
    background: #2563eb;
}

.btn-edit-post:hover {
    background: #1d4ed8;
}

.btn-edit-post:active {
    background: #1e40af;
}

.btn-delete-post {
    background: #ef4444;
}

.btn-delete-post:hover {
    background: #dc2626;
}

.btn-delete-post:active {
    background: #b91c1c;
}

/* Админ-панель */
.admin-page {
    background: #f9fafb;
    min-height: 100vh;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.admin-header {
    margin-bottom: 1.5rem;
}

.admin-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

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

.admin-tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-tab-btn:hover {
    color: #111827;
    background: #f3f4f6;
}

.admin-tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

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

.admin-search {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9375rem;
}

.admin-filter {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9375rem;
    background: white;
    cursor: pointer;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.user-card.blocked {
    border-left: 4px solid #ef4444;
    background: #fef2f2;
}

.user-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.user-card-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.user-username {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.user-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.user-badge.admin {
    background: #fef3c7;
    color: #92400e;
}

.user-badge.blocked {
    background: #fee2e2;
    color: #991b1b;
}

.user-badge.active {
    background: #d1fae5;
    color: #065f46;
}

.user-card-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-block,
.btn-unblock,
.btn-delete-user {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-block {
    background: #ef4444;
    color: white;
}

.btn-block:hover {
    background: #dc2626;
}

.btn-unblock {
    background: #10b981;
    color: white;
}

.btn-unblock:hover {
    background: #059669;
}

.btn-delete-user {
    background: #dc2626;
    color: white;
}

.btn-delete-user:hover {
    background: #b91c1c;
}

.btn-delete-user:active {
    background: #991b1b;
}

.user-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.user-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.8125rem;
    color: #6b7280;
}

.stat-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.user-block-info {
    padding: 0.75rem;
    background: #fee2e2;
    border-radius: 6px;
    border-left: 3px solid #ef4444;
}

.block-info-item {
    font-size: 0.875rem;
    color: #991b1b;
    margin-bottom: 0.25rem;
}

.user-sponsor {
    font-size: 0.875rem;
    color: #6b7280;
}

.user-created {
    font-size: 0.875rem;
    color: #6b7280;
}

.block-logs-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.block-log-item {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.block-log-item.active {
    border-left: 4px solid #ef4444;
    background: #fef2f2;
}

.block-log-item.unblocked {
    border-left: 4px solid #10b981;
    background: #f0fdf4;
    opacity: 0.8;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.log-username {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.log-status {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.log-status.blocked {
    background: #fee2e2;
    color: #991b1b;
}

.log-status.unblocked {
    background: #d1fae5;
    color: #065f46;
}

.log-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.log-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
}

.log-info div {
    display: flex;
    gap: 0.5rem;
}

.modal-field {
    margin-bottom: 1rem;
}

.modal-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.modal-field input,
.modal-field textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-family: inherit;
    box-sizing: border-box;
}

.modal-field textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-field input:focus,
.modal-field textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-content-large {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Кнопка выхода в профиле */
.btn-logout-profile {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    flex-shrink: 0;
}

.btn-logout-profile:hover {
    background: #dc2626;
}

.btn-logout-profile:active {
    background: #b91c1c;
}

/* Кнопка выхода в профиле уже определена выше */

/* Скролл для админ-панели */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.users-list {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    padding-right: 0.5rem;
}

.block-logs-list {
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Детали пользователя в админ-панели */
.user-details-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
}

.user-details-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.user-details-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-details-item {
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.user-details-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.user-details-item-title {
    font-weight: 600;
    color: #111827;
}

.user-details-item-meta {
    font-size: 0.8125rem;
    color: #6b7280;
}

.user-details-item-content {
    font-size: 0.875rem;
    color: #374151;
}

.btn-view-on-map {
    padding: 0.375rem 0.75rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.btn-view-on-map:hover {
    background: #1d4ed8;
}


