/* ========================================
   RESET & BASE STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --accent: #f093fb;
    --success: #4facfe;
    --danger: #f5576c;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 10px 40px rgba(0, 0, 0, 0.1);
    --radius-lg: 24px;
    --radius-md: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    padding: 24px;
    color: #1a1a1a;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.05);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-8px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(8px);
    }
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.shake {
    animation: shake 0.5s ease;
}

/* ========================================
   LOGO
   ======================================== */

/* Фиксируем размеры логотипа */
.logo {
    width: 72px;
    height: 72px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    margin: 0 auto 16px;
    overflow: hidden;
    transition: transform 0.3s ease;
    /* Резервируем место */
    min-width: 72px;
    min-height: 72px;
}

.logo:hover {
    transform: scale(1.1) rotate(5deg);
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Предотвращаем сдвиг при загрузке */
    display: block;
}

.logo-text {
    font-size: 40px;
    font-weight: 900;
    color: var(--primary);
}

/* ========================================
   SETUP SCREEN
   ======================================== */

.setup-screen {
    background: white;
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.6s ease;
}

.setup-screen h1 {
    color: var(--primary);
    text-align: center;
    font-size: 2.8em;
    margin-bottom: 8px;
    font-weight: 800;
    letter-spacing: -0.02em;
    animation: slideDown 0.5s ease;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 40px;
    font-size: 1em;
    font-weight: 500;
}

.setup-section {
    margin-bottom: 36px;
}

.setup-section h3 {
    color: #1a1a1a;
    margin-bottom: 16px;
    font-size: 1.1em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-number {
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: 700;
}

/* ========================================
   MODE SELECTION CARDS
   ======================================== */

.option-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.option-card {
    background: #f8f9fa;
    border: 3px solid transparent;
    padding: 20px 12px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-height: 140px;
}

.option-card:hover {
    background: #ffffff;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
    border-color: var(--primary);
}

.option-card.selected {
    background: var(--bg-gradient);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.4);
    transform: translateY(-4px);
}

.option-card.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.option-icon {
    font-size: 2.5em;
    display: block;
}

.option-label {
    font-size: 1.1em;
    font-weight: 700;
}

.option-best-for {
    font-size: 0.8em;
    opacity: 0.8;
    line-height: 1.3;
    margin-top: auto;
}

.option-card.selected .option-best-for {
    opacity: 0.95;
}

/* ========================================
   CHECKBOXES (LANGUAGES & CATEGORIES)
   ======================================== */

.checkbox-group,
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.checkbox-option {
    background: #f8f9fa;
    padding: 16px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 3px solid transparent;
    position: relative;
    text-align: center;
}

.checkbox-option:hover {
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}

.checkbox-option.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
    transform: translateY(-2px);
}

.checkbox-option.selected::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255, 255, 255, 0.3);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 12px;
}

.checkbox-option input[type="checkbox"] {
    display: none;
}

.checkbox-option label {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.checkbox-label-main {
    font-weight: 700;
    font-size: 1.1em;
    display: block;
    order: 1;
}

.checkbox-emoji {
    font-size: 1.5em;
    display: block;
    opacity: 0.8;
    order: 2;
}

.checkbox-option.selected .checkbox-emoji {
    opacity: 0.9;
}

.checkbox-icon {
    font-size: 2em;
    display: block;
    font-weight: 700;
}

.category-serif {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-weight: 700;
    font-size: 2.2em;
}

.category-sans {
    font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 700;
    font-size: 2em;
}

.category-display {
    font-family: Impact, 'Arial Black', sans-serif;
    font-weight: 900;
    font-size: 2.2em;
    transform: scale(1.2, 1);
    display: inline-block;
}

.category-handwriting {
    font-family: 'Segoe Script', 'Bradley Hand', cursive;
    font-weight: 600;
    font-size: 2.2em;
    font-style: italic;
}

.category-mono {
    font-family: 'Courier New', 'Consolas', monospace;
    font-weight: 700;
    font-size: 1.9em;
    letter-spacing: 0.05em;
}

/* ========================================
   START BUTTON
   ======================================== */

.start-section {
    margin-top: 40px;
    text-align: center;
}

.btn-start {
    background: var(--bg-gradient);
    color: white;
    padding: 18px 48px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.btn-start:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.btn-start:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.3em;
    font-weight: 700;
}

.btn-clear {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    margin-top: 12px;
    font-size: 0.9em;
    padding: 12px 32px;
}

/* ========================================
   GAME SCREEN
   ======================================== */

.game-screen {
    display: none;
}

.game-screen.active {
    display: block;
}

.game-header {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    padding: 20px 28px;
    border-radius: var(--radius-lg);
    margin-bottom: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: var(--shadow-md);
    position: relative;
}

.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--success), var(--accent));
    transition: width 0.3s ease;
    border-radius: 0 2px 0 0;
}

.game-title {
    font-size: 1.5em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-back {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.95em;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateX(-4px);
}

/* ========================================
   CARD CONTAINER
   ======================================== */

.card-container {
    position: relative;
    width: 100%;
    height: 560px;
    margin-bottom: 24px;
    perspective: 1000px;
    overflow: hidden;
    border-radius: var(--radius-lg);
}

.card-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(102, 126, 234, 0.95);
    color: white;
    padding: 16px 32px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1em;
    z-index: 999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    animation: pulse 1.5s ease-in-out infinite;
}

.swipe-feedback {
    position: absolute;
    top: 50%;
    font-size: 8em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 5;
    font-weight: 900;
}

.swipe-feedback.left {
    left: 20%;
    transform: translate(-50%, -50%) rotate(-20deg);
    color: #f5576c;
    text-shadow: 0 8px 30px rgba(245, 87, 108, 0.5);
}

.swipe-feedback.right {
    left: 80%;
    transform: translate(-50%, -50%) rotate(20deg);
    color: #4facfe;
    text-shadow: 0 8px 30px rgba(79, 172, 254, 0.5);
}

.swipe-feedback.show {
    opacity: 0.5 !important;
}

.card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px;
    cursor: grab;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    font-family: var(--current-font, inherit);
    will-change: transform, opacity;
    font-display: swap;
}

.card:active {
    cursor: grabbing;
}

.card.swiped-left {
    transform: translateX(-200%) rotate(-30deg);
    opacity: 0;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
}

.card.swiped-right {
    transform: translateX(200%) rotate(30deg);
    opacity: 0;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
}

.card.dragging {
    transition: none;
}

.font-category {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
    z-index: 10;
    position: relative;
}

.font-name {
    font-size: 1.8em;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

.font-preview-large {
    font-size: 4em;
    text-align: center;
    margin: 24px 0;
    line-height: 1.15;
    font-weight: 400;
    color: #1a1a1a;
    font-family: var(--current-font, inherit);
}

.sample-text {
    margin-top: 28px;
    padding: 24px;
    background: #f8f9fa;
    border-radius: var(--radius-md);
    width: 100%;
    text-align: center;
    line-height: 1.7;
    font-family: var(--current-font, inherit);
}

.sample-text p {
    color: #333;
    font-size: 1.05em;
    line-height: 1.8;
    font-family: var(--current-font, inherit);
}

/* ========================================
   ACTION BUTTONS
   ======================================== */

.buttons {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 24px;
}

.btn {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2em;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

.btn:hover {
    transform: scale(1.12);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

.btn:active {
    transform: scale(0.95);
}

.btn-dislike {
    background: linear-gradient(135deg, var(--accent) 0%, var(--danger) 100%);
    color: white;
}

.btn-like {
    background: linear-gradient(135deg, var(--success) 0%, #00f2fe 100%);
    color: white;
}

/* ========================================
   TOURNAMENT MODE
   ======================================== */

.tournament-arena {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
}

.tournament-info {
    text-align: center;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 28px;
    font-size: 1.25em;
}

.fighters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.fighter {
    background: #f8f9fa;
    padding: 36px 24px;
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid transparent;
    position: relative;
}

.fighter::before {
    content: '👆';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5em;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fighter:hover {
    transform: scale(1.05);
    border-color: var(--primary);
    background: white;
    box-shadow: 0 12px 36px rgba(102, 126, 234, 0.25);
}

.fighter:hover::before {
    opacity: 1;
}

.fighter:active {
    transform: scale(0.98);
}

.fighter-name {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 20px;
    font-size: 1.2em;
}

.fighter-preview {
    font-size: 3em;
    margin: 20px 0;
    color: #1a1a1a;
}

/* ========================================
   COMBO MODE
   ======================================== */

.combo-container {
    background: white;
    border-radius: var(--radius-lg);
    padding: 48px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 36px;
    gap: 8px;
}

.progress-step {
    flex: 1;
    text-align: center;
    padding: 14px 8px;
    border-radius: 12px;
    background: #f0f0f0;
    opacity: 0.5;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.progress-step.active {
    background: var(--primary);
    color: white;
    opacity: 1;
    transform: scale(1.05);
}

.progress-step.completed {
    background: var(--success);
    color: white;
    opacity: 1;
}

.fixed-font {
    padding: 18px;
    background: #f0f7ff;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
}

.fixed-label {
    font-size: 0.85em;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.carousel {
    padding: 18px;
    background: #fff5e6;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border-left: 4px solid #ffa726;
}

.carousel-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.carousel-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
    font-weight: 700;
}

.carousel-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.carousel-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.preview-box {
    margin-top: 36px;
    padding: 36px;
    background: #fafafa;
    border-radius: var(--radius-md);
}

.preview-box h1 {
    margin-bottom: 20px;
    color: #1a1a1a;
}

.preview-box h2 {
    margin-bottom: 18px;
    color: #555;
}

.preview-box h3 {
    color: #777;
}

.btn-next {
    background: var(--bg-gradient);
    color: white;
    padding: 18px 48px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-size: 1.15em;
    font-weight: 700;
    display: block;
    margin: 28px auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-next:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.btn-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.combo-counter {
    text-align: center;
    color: var(--secondary);
    font-weight: 700;
    font-size: 1.15em;
    margin-bottom: 24px;
}

/* ========================================
   FAVORITES
   ======================================== */

.favorites {
    background: white;
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: var(--shadow-lg);
    margin-top: 28px;
}

.favorites h2 {
    color: var(--primary);
    margin-bottom: 24px;
    text-align: center;
    font-size: 1.5em;
    font-weight: 700;
}


/* Маленькие карточки избранного */
.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.favorite-item {
    background: var(--bg-gradient);
    color: white;
    padding: 14px 12px; /* ← ВЕРНУЛИ обычный padding */
    border-radius: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
    font-weight: 600;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.favorite-item:hover {
    transform: scale(1.05) translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    filter: brightness(1.1);
}

.favorite-name {
    flex: 1;
    cursor: pointer;
    font-size: 0.95em;
}

/* Крестик удаления */
.favorite-remove {
    position: absolute !important;
    top: 6px !important;
    right: 6px !important;
    background: rgba(255, 59, 48, 0.9) !important;
    color: white !important;
    border: none !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 1 !important;  /* ← ИЗМЕНИЛИ с 0 на 1 */
    transition: opacity 0.25s ease !important;
    line-height: 1 !important;
    padding: 0 !important;
    z-index: 100 !important;
}

.favorite-item:hover .favorite-remove {
    opacity: 1 !important;
    transform: scale(1.1) !important; /* Увеличиваем при наведении */
}

.favorite-remove:hover {
    background: rgba(255, 59, 48, 1) !important;
    transform: scale(1.2) !important;
}

.favorite-remove:active {
    transform: scale(0.9) !important;
}

/* Мобильная версия - крестик всегда видим */
@media (max-width: 768px) {
    .favorite-remove {
        opacity: 1;
        background: rgba(255, 255, 255, 0.25);
    }
    
    .favorites-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }
}

/* ========================================
   RESULTS
   ======================================== */

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.result-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 36px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease both;
}

.result-card:nth-child(1) { animation-delay: 0.1s; }
.result-card:nth-child(2) { animation-delay: 0.2s; }
.result-card:nth-child(3) { animation-delay: 0.3s; }
.result-card:nth-child(4) { animation-delay: 0.4s; }
.result-card:nth-child(5) { animation-delay: 0.5s; }
.result-card:nth-child(6) { animation-delay: 0.6s; }

.result-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.result-card h1 {
    margin-bottom: 16px;
}

.result-card h2 {
    margin-bottom: 14px;
    color: #555;
}

.result-card h3 {
    color: #777;
}

.result-meta {
    margin-top: 24px;
    padding: 18px;
    background: #f8f9fa;
    border-radius: 12px;
    font-size: 0.95em;
    color: #666;
    font-weight: 500;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 16px 28px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1em;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========================================
   KEYBOARD HINT
   ======================================== */

.keyboard-hint {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 600;
    z-index: 100;
    animation: fadeIn 1s ease 2s both;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease;
}

.keyboard-hint kbd {
    background: rgba(255, 255, 255, 0.25);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    margin: 0 4px;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    .container {
        max-width: 100%;
    }

    .logo {
        width: 56px;
        height: 56px;
        margin-bottom: 12px;
    }

    .setup-screen {
        padding: 32px 24px;
    }

    .setup-screen h1 {
        font-size: 2em;
        margin-bottom: 6px;
    }

    .subtitle {
        font-size: 0.95em;
        margin-bottom: 32px;
    }

    .setup-section {
        margin-bottom: 28px;
    }

    .setup-section h3 {
        font-size: 1em;
        margin-bottom: 12px;
    }

    .section-number {
        width: 26px;
        height: 26px;
        font-size: 0.85em;
    }

    /* Режимы - горизонтально на планшетах */
    .option-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .option-card {
        flex-direction: row;
        text-align: left;
        padding: 16px;
        min-height: auto;
        gap: 12px;
    }

    .option-icon {
        font-size: 2.2em;
        flex-shrink: 0;
    }

    .option-label {
        font-size: 1.1em;
        text-align: left;
    }

    .option-best-for {
        font-size: 0.85em;
        text-align: left;
        margin-top: 4px;
    }

    /* Чекбоксы - 2 колонки */
    .checkbox-group,
    .checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .checkbox-option {
        padding: 14px 8px;
    }

    .checkbox-icon {
        font-size: 1.8em;
    }

    .checkbox-label {
        font-size: 0.9em;
    }

    .btn-start {
        padding: 16px 40px;
        font-size: 1.1em;
        width: 100%;
        justify-content: center;
    }

    .btn-clear {
        width: 100%;
        padding: 12px 28px;
    }

    /* Game screen */
    .game-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 14px 16px;
    }

    .game-title {
        font-size: 1.2em;
    }

    .btn-back {
        width: 100%;
        padding: 10px 20px;
        font-size: 0.9em;
    }

    .card-container {
        height: 480px;
        margin-bottom: 16px;
    }

    .card {
        padding: 24px 16px;
    }

    .font-preview-large {
        font-size: 2.5em;
    }

    .sample-text {
        padding: 16px;
        margin-top: 16px;
        font-size: 0.95em;
    }

    .btn {
        width: 64px;
        height: 64px;
        font-size: 1.9em;
    }

    .buttons {
        gap: 20px;
        margin-bottom: 16px;
    }

    .fighters {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .fighter {
        padding: 24px 16px;
    }

    .combo-container {
        padding: 20px 16px;
    }

    .progress-steps {
        flex-direction: column;
        gap: 6px;
    }

    .progress-step {
        padding: 8px 6px;
        font-size: 0.8em;
    }

    .favorites {
        padding: 20px 16px;
        margin-top: 16px;
    }

    .favorites h2 {
        font-size: 1.2em;
        margin-bottom: 14px;
    }

    .favorites-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .favorite-item {
        padding: 14px 10px;
        min-height: 48px;
        font-size: 0.85em;
    }

    .swipe-feedback {
        font-size: 5em;
    }

    .tournament-arena {
        padding: 20px 16px;
    }

    .tournament-info {
        font-size: 1em;
        margin-bottom: 16px;
    }

    .result-card {
        padding: 20px 16px;
    }

    .keyboard-hint {
        display: none;
    }
}

@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .setup-screen {
        padding: 24px 16px;
    }

    .logo {
        width: 48px;
        height: 48px;
        margin-bottom: 8px;
    }

    .setup-screen h1 {
        font-size: 1.8em;
        margin-bottom: 4px;
    }

    .subtitle {
        font-size: 0.9em;
        margin-bottom: 24px;
    }

    .setup-section {
        margin-bottom: 24px;
    }

    .setup-section h3 {
        font-size: 0.95em;
        margin-bottom: 10px;
    }

    .section-number {
        width: 24px;
        height: 24px;
        font-size: 0.8em;
    }

    .option-card {
        padding: 14px;
        gap: 10px;
    }

    .option-icon {
        font-size: 2em;
    }

    .option-label {
        font-size: 1em;
    }

    .option-best-for {
        font-size: 0.8em;
    }

    .option-card.selected::after {
        width: 22px;
        height: 22px;
        font-size: 13px;
        top: 6px;
        right: 6px;
    }

    .checkbox-option {
        padding: 12px 6px;
    }

    .checkbox-icon {
        font-size: 1.6em;
    }

    .checkbox-label {
        font-size: 0.85em;
    }

    .checkbox-option.selected::after {
        width: 18px;
        height: 18px;
        font-size: 11px;
        top: 4px;
        right: 4px;
    }

    .start-section {
        margin-top: 28px;
    }

    .btn-start {
        padding: 14px 32px;
        font-size: 1em;
    }

    .btn-icon {
        font-size: 1.2em;
    }

    .btn-clear {
        padding: 10px 24px;
        font-size: 0.85em;
    }

    .card-container {
        height: 420px;
    }

    .card {
        padding: 20px 12px;
    }

    .font-name {
        font-size: 1.4em;
        margin-bottom: 16px;
    }

    .font-category {
        padding: 4px 12px;
        font-size: 0.8em;
        margin-bottom: 10px;
    }

    .font-preview-large {
        font-size: 2em;
    }

    .sample-text {
        font-size: 0.85em;
        padding: 12px;
        margin-top: 12px;
    }

    .btn {
        width: 58px;
        height: 58px;
        font-size: 1.7em;
    }

    .buttons {
        gap: 16px;
    }

    .favorites-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 8px;
    }

    .favorite-item {
        padding: 12px 8px;
        font-size: 0.8em;
        min-height: 44px;
    }

    .swipe-feedback {
        font-size: 4em;
    }

    .combo-container {
        padding: 16px 12px;
    }

    .result-card {
        padding: 16px 12px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 360px) {
    .option-card {
        padding: 12px;
    }

    .option-icon {
        font-size: 1.8em;
    }

    .option-label {
        font-size: 0.95em;
    }

    .option-best-for {
        font-size: 0.75em;
    }

    .checkbox-icon {
        font-size: 1.4em;
    }

    .checkbox-label {
        font-size: 0.8em;
    }
}
    
/* ========================================
   AI RECOMMENDATIONS MODAL
   ======================================== */

.btn-ai-recommendations {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 auto 24px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    width: 100%;
    max-width: 400px;
}

.btn-ai-recommendations:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.ai-icon {
    font-size: 1.3em;
}

.ai-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    padding: 20px;
    overflow-y: auto;
}

.ai-modal-content {
    background: white;
    border-radius: 24px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideDown 0.3s ease;
}

.ai-modal-header {
    background: var(--bg-gradient);
    color: white;
    padding: 24px 32px;
    border-radius: 24px 24px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.ai-modal-header h2 {
    margin: 0;
    font-size: 1.8em;
}

.ai-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ai-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.ai-explanation {
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4ff 100%);
    padding: 20px 32px;
    border-bottom: 1px solid #e0e0e0;
}

.ai-explanation p {
    margin: 0 0 10px 0;
    line-height: 1.6;
    color: #333;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    background: #4facfe;
    color: white;
}

.ai-section {
    padding: 32px;
    border-bottom: 1px solid #f0f0f0;
}

.ai-section h3 {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 1.3em;
}

.ai-font-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.ai-font-card {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.ai-font-card:hover {
    background: white;
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.2);
}

.ai-font-preview {
    font-size: 3em;
    margin-bottom: 12px;
    color: #1a1a1a;
}

.ai-font-name {
    font-size: 0.9em;
    font-weight: 600;
    color: #666;
    margin-bottom: 12px;
}

.ai-add-btn {
    background: var(--bg-gradient);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.ai-add-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ai-modal-content .btn-next {
    margin: 32px;
}

/* ========================================
   FAVORITE CARDS (для Swipe режима)
   ======================================== */

/* Мобильная версия */
@media (max-width: 768px) {
    .favorites-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .favorite-card {
        padding: 24px 16px;
    }
    
    .favorite-card .font-preview-large {
        font-size: 2.5em;
    }
    
}