* { margin:0; padding:0; box-sizing:border-box; }
body {
    font-family: 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    -webkit-text-size-adjust: 100%;
}

/* NAV */
.navbar {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
    position: sticky; top:0; z-index: 100;
    flex-wrap: wrap;
    gap: 10px;
}
.logo { font-size: 20px; font-weight: bold; color: #667eea; text-decoration:none; }
.logo span { color:#764ba2; }
.nav-links { 
    display:flex; 
    gap:15px; 
    align-items:center; 
    flex-wrap: wrap;
    font-size: 14px;
}
.nav-links a { 
    color:#333; 
    text-decoration:none; 
    font-weight:500; 
    transition:0.3s;
    padding: 8px 12px;
    border-radius: 8px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}
.nav-links a:hover, .nav-links a:active { 
    color:#667eea; 
    background: rgba(102,126,234,0.1);
}
.coin-badge {
    background: linear-gradient(45deg,#f6d365,#fda085);
    color:#fff; 
    padding:8px 16px; 
    border-radius:20px;
    font-weight:bold; 
    box-shadow:0 2px 8px rgba(253,160,133,0.4);
    font-size: 14px;
    white-space: nowrap;
}

/* HERO */
.hero {
    text-align:center; 
    padding:60px 20px 50px;
    color:#fff;
}
.hero h1 { 
    font-size:32px; 
    margin-bottom:15px; 
    text-shadow:0 2px 20px rgba(0,0,0,0.2);
    line-height: 1.2;
}
.hero p { 
    font-size:16px; 
    opacity:0.95; 
    max-width:600px; 
    margin:0 auto 30px;
    line-height: 1.5;
}
.btn {
    display:inline-block; 
    padding:14px 28px;
    background:#fff; 
    color:#667eea;
    border-radius:30px; 
    text-decoration:none;
    font-weight:bold; 
    font-size:15px;
    transition:0.3s; 
    border:none; 
    cursor:pointer;
    box-shadow:0 4px 15px rgba(0,0,0,0.15);
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover, .btn:active { 
    transform:translateY(-2px); 
    box-shadow:0 8px 25px rgba(0,0,0,0.25);
}
.btn-primary { background:linear-gradient(45deg,#667eea,#764ba2); color:#fff; }
.btn-danger { background:linear-gradient(45deg,#f093fb,#f5576c); color:#fff; }
.btn-success { background:linear-gradient(45deg,#43e97b,#38f9d7); color:#fff; }
.btn-sm { 
    padding:10px 18px; 
    font-size:13px;
    min-height: 40px;
}

/* FEATURES */
.features {
    background:#fff; 
    padding:40px 20px;
    display:grid; 
    grid-template-columns:1fr;
    gap:20px; 
    max-width:1200px; 
    margin:20px auto; 
    border-radius:20px;
}
.feature {
    text-align:center; 
    padding:25px 15px;
}
.feature-icon { font-size:40px; margin-bottom:12px; }
.feature h3 { color:#667eea; margin-bottom:8px; font-size:18px; }
.feature p { font-size:14px; line-height: 1.5; }

/* CONTAINER */
.container { 
    max-width:1200px; 
    margin:20px auto; 
    padding:0 15px;
}
.card {
    background:#fff; 
    border-radius:15px; 
    padding:20px;
    box-shadow:0 10px 40px rgba(0,0,0,0.1);
    margin-bottom:15px;
    overflow-x: auto;
}
.card h2 { 
    color:#667eea; 
    margin-bottom:15px;
    font-size: 20px;
}

/* LOTS GRID */
.lots-grid {
    display:grid; 
    grid-template-columns:1fr;
    gap:15px;
}
.lot-card {
    background:#fff; 
    border-radius:15px; 
    padding:15px;
    box-shadow:0 5px 20px rgba(0,0,0,0.08);
    transition:0.3s; 
    cursor:pointer;
    border:2px solid transparent;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}
.lot-card:hover, .lot-card:active { 
    transform:translateY(-2px); 
    border-color:#667eea; 
    box-shadow:0 15px 35px rgba(102,126,234,0.2);
}
.lot-header { 
    display:flex; 
    gap:12px; 
    margin-bottom:12px;
    align-items: center;
}
.lot-icon {
    width:50px; 
    height:50px; 
    border-radius:12px;
    background:linear-gradient(135deg,#667eea,#764ba2);
    display:flex; 
    align-items:center; 
    justify-content:center;
    color:#fff; 
    font-size:24px; 
    font-weight:bold;
    flex-shrink:0;
}
.lot-icon img { 
    width:100%; 
    height:100%; 
    border-radius:12px; 
    object-fit:cover;
}
.lot-name { 
    font-size:16px; 
    font-weight:bold; 
    color:#333; 
    margin-bottom:3px;
    word-break: break-word;
}
.lot-pkg { 
    font-size:11px; 
    color:#888; 
    word-break:break-all;
    line-height: 1.3;
}
.lot-stats {
    display:flex; 
    justify-content:space-around;
    padding-top:12px; 
    border-top:1px solid #eee;
    font-size:13px;
    gap: 10px;
}
.lot-stat { 
    text-align:center;
    flex: 1;
}
.lot-stat-value { 
    font-weight:bold; 
    color:#667eea; 
    font-size:18px;
    margin-bottom: 2px;
}
.lot-stat-label { 
    color:#888; 
    font-size:11px;
}

/* FORMS */
.form-group { margin-bottom:18px; }
.form-group label { 
    display:block; 
    margin-bottom:8px; 
    font-weight:500; 
    color:#555;
    font-size: 14px;
}
.form-control {
    width:100%; 
    padding:12px 14px;
    border:2px solid #e0e0e0; 
    border-radius:10px;
    font-size:15px; 
    transition:0.3s;
    font-family:inherit;
    min-height: 48px;
    -webkit-appearance: none;
}
.form-control:focus { 
    outline:none; 
    border-color:#667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}
textarea.form-control { 
    resize:vertical; 
    min-height:100px;
}
select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

/* AUTH */
.auth-wrap {
    min-height: calc(100vh - 80px);
    display:flex; 
    align-items:center; 
    justify-content:center;
    padding:20px;
}
.auth-card {
    background:#fff; 
    padding:30px 20px;
    border-radius:20px; 
    width:100%; 
    max-width:420px;
    box-shadow:0 20px 60px rgba(0,0,0,0.2);
}
.auth-card h2 { 
    text-align:center; 
    color:#667eea; 
    margin-bottom:25px;
    font-size: 24px;
}
.auth-switch { 
    text-align:center; 
    margin-top:20px; 
    color:#888;
    font-size: 14px;
}
.auth-switch a { 
    color:#667eea; 
    text-decoration:none; 
    font-weight:bold;
    padding: 8px;
    min-height: 44px;
    display: inline-block;
}

/* FLASH */
.flash {
    padding:14px 18px; 
    border-radius:10px; 
    margin-bottom:15px;
    font-weight:500;
    font-size: 14px;
    line-height: 1.4;
}
.flash-success { background:#d4edda; color:#155724; }
.flash-error { background:#f8d7da; color:#721c24; }

/* DASHBOARD STATS */
.stats-grid {
    display:grid; 
    grid-template-columns:repeat(2, 1fr);
    gap:12px; 
    margin-bottom:20px;
}
.stat-card {
    background:linear-gradient(135deg,#667eea,#764ba2);
    color:#fff; 
    padding:18px 12px; 
    border-radius:15px;
    text-align:center;
}
.stat-card.gold { background:linear-gradient(135deg,#f6d365,#fda085); }
.stat-card.green { background:linear-gradient(135deg,#43e97b,#38f9d7); }
.stat-card.pink { background:linear-gradient(135deg,#f093fb,#f5576c); }
.stat-value { 
    font-size:28px; 
    font-weight:bold; 
    margin-bottom:4px;
    word-break: break-word;
}
.stat-label { 
    opacity:0.9; 
    font-size:12px;
    line-height: 1.3;
}

/* TABLE - MOBILE OPTIMIZED */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -20px;
    padding: 0 20px;
}
table { 
    width: 100%; 
    border-collapse:collapse;
    min-width: 600px;
}
th, td { 
    padding:12px 10px; 
    text-align:left; 
    border-bottom:1px solid #eee;
    font-size: 13px;
    vertical-align: middle;
}
th { 
    background:#f8f9fa; 
    color:#667eea; 
    font-weight:600;
    white-space: nowrap;
    position: sticky;
    top: 0;
}
tr:hover { background:#f8f9fa; }

/* Mobile table alternative - cards */
@media(max-width:768px){
    .mobile-card-table {
        display: block;
    }
    .mobile-card-table table {
        display: block;
        min-width: 0;
    }
    .mobile-card-table thead {
        display: none;
    }
    .mobile-card-table tbody {
        display: block;
    }
    .mobile-card-table tr {
        display: block;
        background: #f8f9fa;
        border-radius: 10px;
        padding: 15px;
        margin-bottom: 10px;
        border: 1px solid #e0e0e0;
    }
    .mobile-card-table td {
        display: block;
        padding: 8px 0;
        border: none;
        text-align: left !important;
    }
    .mobile-card-table td:before {
        content: attr(data-label);
        font-weight: bold;
        color: #667eea;
        display: block;
        margin-bottom: 4px;
        font-size: 12px;
    }
}

/* BADGES */
.badge {
    display:inline-block; 
    padding:5px 10px;
    border-radius:12px; 
    font-size:11px; 
    font-weight:bold;
    white-space: nowrap;
}
.badge-success { background:#d4edda; color:#155724; }
.badge-warning { background:#fff3cd; color:#856404; }
.badge-danger { background:#f8d7da; color:#721c24; }
.badge-info { background:#d1ecf1; color:#0c5460; }

/* TOP */
.top-list { 
    display:flex; 
    flex-direction:column; 
    gap:10px;
}
.top-item {
    display:flex; 
    align-items:center; 
    gap:12px;
    padding:12px; 
    background:#f8f9fa; 
    border-radius:10px;
    transition:0.3s;
    min-height: 44px;
}
.top-item:hover, .top-item:active { 
    background:#e9ecef;
}
.top-rank {
    width:36px; 
    height:36px; 
    border-radius:50%;
    background:linear-gradient(45deg,#667eea,#764ba2);
    color:#fff; 
    display:flex; 
    align-items:center; 
    justify-content:center;
    font-weight:bold; 
    flex-shrink:0;
    font-size: 14px;
}
.top-rank.gold { background:linear-gradient(45deg,#FFD700,#FFA500); }
.top-rank.silver { background:linear-gradient(45deg,#C0C0C0,#808080); }
.top-rank.bronze { background:linear-gradient(45deg,#CD7F32,#8B4513); }

/* FOOTER */
footer {
    background:rgba(0,0,0,0.3); 
    color:#fff;
    text-align:center; 
    padding:25px 15px; 
    margin-top:40px;
    font-size: 14px;
}

/* MOBILE RESPONSIVE */
@media(max-width:768px){
    .hero h1 { 
        font-size:28px;
    }
    .hero p {
        font-size:15px;
    }
    
    .navbar {
        padding: 10px 15px;
    }
    .logo {
        font-size: 18px;
    }
    .nav-links {
        gap: 8px;
        font-size: 13px;
    }
    .nav-links a {
        padding: 6px 10px;
    }
    
    .features {
        grid-template-columns: 1fr;
        padding: 30px 15px;
    }
    
    .lots-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat-value {
        font-size: 24px;
    }
    .stat-label {
        font-size: 11px;
    }
    
    .card {
        padding: 15px;
    }
    .card h2 {
        font-size: 18px;
    }
    
    .lot-card {
        padding: 12px;
    }
    .lot-icon {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
    .lot-name {
        font-size: 15px;
    }
    .lot-pkg {
        font-size: 10px;
    }
    
    .btn {
        padding: 12px 24px;
        font-size: 14px;
        width: 100%;
        text-align: center;
    }
    .btn-sm {
        padding: 8px 14px;
        font-size: 12px;
        width: auto;
    }
    
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .auth-card {
        padding: 25px 15px;
    }
    .auth-card h2 {
        font-size: 22px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    /* Dashboard grid - single column on mobile */
    .container > div[style*="grid-template-columns:2fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Make tables scrollable horizontally */
    .card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Improve touch targets */
    a, button, .btn, .lot-card {
        -webkit-tap-highlight-color: rgba(102,126,234,0.2);
    }
}

@media(max-width:480px){
    .hero {
        padding: 40px 15px 30px;
    }
    .hero h1 {
        font-size: 24px;
    }
    .hero p {
        font-size: 14px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .lot-stats {
        flex-direction: column;
        gap: 8px;
    }
    .lot-stat {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    .lot-stat-value {
        font-size: 16px;
    }
    
    .navbar {
        flex-direction: column;
        align-items: stretch;
    }
    .nav-links {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .coin-badge {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Prevent zoom on input focus (iOS) */
@supports (-webkit-touch-callout: none) {
    .form-control {
        font-size: 16px;
    }
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
    .navbar {
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    footer {
        padding-bottom: max(25px, env(safe-area-inset-bottom));
    }
}




/* Dashboard Grid - адаптивная сетка */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Мобильная адаптация dashboard */
@media(max-width: 968px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .dashboard-sidebar {
        order: -1; /* Топы идут первыми на мобильных */
    }
}

@media(max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .lot-card {
        padding: 12px;
    }
    
    .lot-header {
        gap: 10px;
    }
    
    .lot-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .lot-name {
        font-size: 14px;
    }
    
    .lot-pkg {
        font-size: 10px;
    }
    
    .lot-stats {
        gap: 8px;
    }
    
    .lot-stat-value {
        font-size: 16px;
    }
    
    .top-item {
        padding: 10px;
    }
    
    .top-rank {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
}

/* Улучшения для iOS */
@supports (-webkit-touch-callout: none) {
    .form-control,
    input,
    select,
    textarea {
        font-size: 16px; /* Предотвращает авто-зум */
    }
}

/* Safe area для iPhone с вырезом */
@supports (padding: max(0px)) {
    .navbar {
        padding-top: max(12px, env(safe-area-inset-top));
    }
    
    .container {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
}

/* Плавная прокрутка */
html {
    scroll-behavior: smooth;
}

/* Убираем синюю подсветку при тапе на Android */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Оптимизация для тач-устройств */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .lot-card,
    .top-item,
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    .btn-sm {
        min-height: 40px;
    }
}

/* Анимация для карточек */
.lot-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lot-card:active {
    transform: scale(0.98);
}

/* Улучшение читаемости на мобильных */
@media(max-width: 768px) {
    body {
        font-size: 15px;
        line-height: 1.5;
    }
    
    .card h2 {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .card p {
        font-size: 14px;
    }
    
    /* Таблицы на мобильных */
    .table-wrapper {
        margin: 0 -15px;
        padding: 0 15px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 13px;
    }
    
    th, td {
        padding: 10px 8px;
    }
}

/* Бургер-меню для очень маленьких экранов */
@media(max-width: 600px) {
    .navbar {
        flex-direction: column;
        gap: 10px;
    }
    
    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .nav-links a {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .coin-badge {
        font-size: 12px;
        padding: 6px 12px;
        order: -1;
    }
}