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

body {
    font-family: 'Rubik', sans-serif;
    background: linear-gradient(135deg, #0a1628 0%, #1a2844 50%, #0a1628 100%);
    color: #fff;
    min-height: 100vh;
    padding: 0;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
}

.particle {
    position: fixed;
    pointer-events: none;
    animation: float 20s infinite;
    opacity: 0.3;
    z-index: 1;
}

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); }
    25% { transform: translateY(-100px) translateX(50px); }
    50% { transform: translateY(-50px) translateX(-50px); }
    75% { transform: translateY(-150px) translateX(30px); }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: rgba(10, 22, 40, 0.98);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 2px solid #ffd700;
}

header .container {
    padding: 20px;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo {
    font-family: 'Bebas Neue', 'Arial Black', sans-serif;
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    color: #ffd700;
    text-shadow: 0 0 20px #ffd700, 0 0 40px #ffd700;
    animation: glow 2s ease-in-out infinite;
    cursor: pointer;
    user-select: none;
    font-weight: 400;
    text-decoration: none;
}

@keyframes glow {
    0%, 100% { text-shadow: 0 0 20px #ffd700, 0 0 40px #ffd700; }
    50% { text-shadow: 0 0 30px #ffd700, 0 0 60px #ffd700, 0 0 80px #ff8800; }
}

.back-btn {
    background: linear-gradient(135deg, #ffd700, #ff8800);
    color: #0a1628;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Rubik', sans-serif;
    text-decoration: none;
    display: inline-block;
}

.back-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.5);
}

.tasks-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 20px;
}

.tasks-title {
    color: #ffd700;
    text-align: center;
    font-size: 48px;
    font-weight: 900;
    margin-bottom: 40px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 0 40px rgba(255, 136, 0, 0.4);
    background: linear-gradient(135deg, #ffd700, #ff8800);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
    animation: fadeIn 0.6s ease;
}

.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    animation: fadeIn 0.8s ease 0.2s backwards;
}

.task-card-wrapper {
    perspective: 1000px;
    position: relative;
}

.task-card {
    position: relative;
    width: 100%;
    min-height: 500px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.task-card.flipped {
    transform: rotateY(180deg);
}

.task-card-front,
.task-card-back {
    width: 100%;
    min-height: 500px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background: linear-gradient(135deg, rgba(26, 40, 68, 0.95), rgba(10, 22, 40, 0.98));
    border: 2px solid #ffd700;
    border-radius: 20px;
    padding: 20px;
    padding-bottom: 50px;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3), 0 0 60px rgba(255, 136, 0, 0.2);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.task-card-front::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.task-card-back {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotateY(180deg);
    justify-content: flex-start;
    overflow-y: auto;
    max-height: 700px;
    
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.task-card-back::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Top bar removed for cleaner design */

.task-card-wrapper:hover .task-card-front,
.task-card-wrapper:hover .task-card-back {
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.5), 0 0 80px rgba(255, 136, 0, 0.4);
    border-color: #ff8800;
}

.task-back-section {
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(255, 215, 0, 0.05);
    border-radius: 12px;
    border-left: 4px solid #ffd700;
    transition: all 0.3s;
}

.task-back-section:hover {
    background: rgba(255, 215, 0, 0.08);
    border-left-color: #ff8800;
}

.task-back-label {
    color: #ffd700;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Removed left bar decoration */

.task-back-content {
    color: #ffffff;
    font-size: 16px;
    line-height: 1.6;
    padding: 15px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    white-space: normal;
    word-wrap: break-word;
}

.task-conditions-table {
    line-height: 2;
}

.task-conditions-table strong {
    color: #ffd700;
    font-weight: 700;
}

.task-back-empty {
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 15px;
    line-height: 1.5;
}

.task-flip-hint {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 215, 0, 0.6);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.task-number {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 18px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.task-title {
    color: #ffd700;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.3;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.task-description {
    color: #ffffff;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 20px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 215, 0, 0.3);
}

.task-difficulty {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    color: white;
}

.difficulty-easy {
    background: linear-gradient(135deg, #48bb78, #38a169);
}

.difficulty-medium {
    background: linear-gradient(135deg, #f6ad55, #ed8936);
}

.difficulty-hard {
    background: linear-gradient(135deg, #fc8181, #f56565);
}

.task-points {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 700;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.task-points::before {
    content: '⭐';
    font-size: 18px;
}

.task-status {
    display: none; /* Hidden */
}

.task-status.completed {
    background: rgba(72, 187, 120, 0.3);
}

.task-status.locked {
    background: rgba(160, 174, 192, 0.3);
}

.loading {
    text-align: center;
    color: #ffd700;
    font-size: 24px;
    padding: 60px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

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

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.error {
    background: rgba(245, 101, 101, 0.9);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
}

@media (max-width: 768px) {
    /* Отключаем летающие эмодзи на мобильных */
    .particle {
        display: none !important;
    }

    /* Отключаем все свечения текста на мобильных */
    * {
        text-shadow: none !important;
    }

    body {
        padding: 0;
    }

    header .container {
        padding: 15px 20px;
    }

    .logo {
        font-size: 1.8rem;
        text-shadow: none;
        animation: none;
    }

    .back-btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .tasks-container {
        padding: 30px 15px 20px;
        margin: 0 auto;
    }

    .tasks-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .tasks-title {
        font-size: 32px;
        margin-bottom: 30px;
    }

    .task-card-wrapper {
        min-height: auto;
        margin-bottom: 0;
    }

    .task-card {
        min-height: 450px;
    }

    .task-card-front,
    .task-card-back {
        min-height: 450px;
        padding: 18px;
        padding-bottom: 50px;
    }

    .task-title {
        font-size: 20px;
        margin-bottom: 12px;
    }

    .task-description {
        font-size: 14px;
        line-height: 1.5;
    }

    .task-number {
        font-size: 16px;
        padding: 6px 12px;
    }

    .task-meta {
        padding-top: 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .task-back-section {
        margin-bottom: 18px;
        padding: 12px;
    }

    .task-back-label {
        font-size: 15px;
        margin-bottom: 8px;
    }

    .task-back-content {
        font-size: 13px;
        padding: 10px;
        line-height: 1.5;
    }

    .task-flip-hint {
        font-size: 11px;
        bottom: 12px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    header .container {
        padding: 12px 15px;
    }

    .logo {
        font-size: 1.5rem;
    }

    .back-btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .tasks-container {
        padding: 25px 10px 15px;
    }

    .tasks-grid {
        gap: 25px;
    }

    .tasks-title {
        font-size: 28px;
        margin-bottom: 25px;
    }

    .task-card-wrapper {
        min-height: auto;
        margin-bottom: 0;
    }

    .task-card {
        min-height: 420px;
    }

    .task-card-front,
    .task-card-back {
        min-height: 420px;
        padding: 15px;
        padding-bottom: 45px;
    }

    .task-title {
        font-size: 18px;
    }

    .task-description {
        font-size: 13px;
        margin-bottom: 15px;
    }

    .task-number {
        font-size: 14px;
        padding: 5px 10px;
    }

    .task-meta {
        padding-top: 12px;
    }

    .task-back-section {
        margin-bottom: 15px;
        padding: 10px;
    }

    .task-back-label {
        font-size: 14px;
    }

    .task-back-content {
        font-size: 12px;
        padding: 8px;
    }
}
