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

body {
    font-family: "Segoe UI", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

h1 {
    color: #2563eb;
    text-align: center;
    margin-bottom: 30px;
    font-size: 32px;
}

h2 {
    color: #1f2937;
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
}

h3 {
    color: #374151;
    font-size: 20px;
    margin-bottom: 15px;
}

/* Экран введения */
.intro-content {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.intro-text {
    font-size: 16px;
    line-height: 1.6;
    color: #4b5563;
    margin-bottom: 20px;
}

.intro-list {
    text-align: left;
    display: inline-block;
    margin: 20px 0;
    font-size: 16px;
    line-height: 1.8;
    color: #4b5563;
}

.intro-list li {
    margin-bottom: 10px;
}

.intro-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.start-btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
}

.start-btn:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.view-results-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
}

.view-results-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.random-fill-btn {
    background: #f59e0b;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
}

.random-fill-btn:hover {
    background: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.history-btn {
    background: #8b5cf6;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
}

.history-btn:hover {
    background: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.link-btn {
    background: #6b7280;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.link-btn:hover {
    background: #4b5563;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

/* Экран истории */
.history-hint {
    text-align: center;
    color: #f59e0b;
    font-size: 14px;
    font-weight: 600;
    margin: -10px 0 20px 0;
    padding: 8px;
    background: #fef3c7;
    border-radius: 6px;
    border: 1px solid #fde68a;
}

.history-statistics {
    margin: 20px 0 30px 0;
}

.statistics-box {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.statistics-box h3 {
    color: #1f2937;
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.statistics-game {
    margin-bottom: 30px;
}

.statistics-game:last-child {
    margin-bottom: 0;
}

.statistics-game h4 {
    color: #374151;
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

.statistics-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.statistics-table thead {
    background: #8b5cf6;
    color: white;
}

.statistics-table th {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.statistics-table th:first-child {
    text-align: left;
}

.statistics-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    text-align: center;
}

.statistics-table td:first-child {
    text-align: left;
    font-weight: 600;
}

.statistics-table tbody tr:hover {
    background: #f9fafb;
}

.statistics-table tbody tr:last-child td {
    border-bottom: none;
}

.statistics-table tbody tr.random-like {
    background: #fef3c7;
}

.statistics-table tbody tr.random-like:hover {
    background: #fde68a;
}

.statistics-table td.near-zero {
    color: #059669;
    font-weight: 600;
}

.statistics-table td.high-deviation {
    color: #dc2626;
    font-weight: 600;
}

.statistics-table td:nth-child(2),
.statistics-table td:nth-child(3),
.statistics-table td:nth-child(4) {
    font-family: 'Courier New', monospace;
}

.history-list {
    margin: 30px 0;
}

.history-empty {
    text-align: center;
    color: #6b7280;
    font-size: 18px;
    padding: 40px;
}

.history-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-item {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: #8b5cf6;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-date {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.history-view-btn {
    background: #8b5cf6;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.history-view-btn:hover {
    background: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.history-controls {
    text-align: center;
    margin-top: 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.clear-history-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-history-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Игровой экран */
.game-header {
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin: 15px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb 0%, #10b981 100%);
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    text-align: center;
    color: #6b7280;
    font-size: 14px;
    margin-top: 10px;
}

.word-container {
    margin: 30px 0;
}

.word-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
}

.word-text {
    font-size: 28px;
    color: #1f2937;
    margin-bottom: 30px;
    font-weight: 600;
}

.pair-word {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 6px;
    margin: 0 5px;
}

.pair-positive {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}

.pair-negative {
    background: #fee2e2;
    color: #991b1b;
    font-weight: 600;
}

.answer-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 500px;
    margin: 0 auto;
}

.answer-option {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.answer-option:hover {
    background: #f3f4f6;
    border-color: #2563eb;
}

.answer-option.selected {
    background: #dbeafe;
    border-color: #2563eb;
    font-weight: 600;
}

.answer-option input[type="radio"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.answer-option span {
    flex: 1;
    color: #374151;
}

.game-controls {
    text-align: center;
    margin-top: 30px;
}

.next-btn,
.finish-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.next-btn:hover,
.finish-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Экран результатов */
.randomness-score-box {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
    text-align: center;
}

.randomness-score-label {
    font-size: 16px;
    color: #374151;
    font-weight: 600;
    margin-bottom: 8px;
}

.randomness-score-value {
    font-size: 24px;
    font-weight: 700;
    color: #10b981;
    font-family: 'Courier New', monospace;
}

.randomness-score-value.has-randomness {
    color: #f59e0b;
}

.randomness-score-hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: 5px;
    font-style: italic;
}

.correlations-container {
    margin: 20px 0 30px 0;
}

.correlations-box {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.correlations-box h3 {
    color: #1f2937;
    font-size: 18px;
    margin-bottom: 15px;
    text-align: center;
}

.correlations-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.correlation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    border: 2px solid #d1d5db;
    transition: all 0.2s;
}

.correlation-item.high {
    border-color: #10b981;
    background: #d1fae5;
}

.correlation-item.medium {
    border-color: #3b82f6;
    background: #dbeafe;
}

.correlation-item.low {
    border-color: #f59e0b;
    background: #fef3c7;
}

.correlation-item.negative {
    border-color: #ef4444;
    background: #fee2e2;
}

.correlation-pair {
    font-weight: 600;
    color: #374151;
    font-size: 16px;
}

.correlation-value {
    font-weight: 700;
    font-size: 18px;
    color: #1f2937;
}

.chart-container {
    margin: 30px 0;
    text-align: center;
}

#results-chart {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
}

.results-table {
    margin: 30px 0;
    overflow-x: auto;
}

.results-table-content {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.results-table-content thead {
    background: #2563eb;
    color: white;
}

.results-table-content th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.results-table-content td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.results-table-content tbody tr:hover {
    background: #f9fafb;
}

.results-table-content tbody tr:last-child td {
    border-bottom: none;
}

.results-controls {
    text-align: center;
    margin-top: 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.restart-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.restart-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.home-btn {
    background: #6b7280;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.home-btn:hover {
    background: #4b5563;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.history-link-btn {
    background: #8b5cf6;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.history-link-btn:hover {
    background: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    .intro-buttons {
        flex-direction: column;
    }

    .start-btn,
    .view-results-btn,
    .random-fill-btn,
    .history-btn,
    .link-btn {
        width: 100%;
    }

    .word-text {
        font-size: 22px;
    }

    .answer-options {
        max-width: 100%;
    }

    #results-chart {
        width: 100%;
        height: auto;
    }

    .results-controls {
        flex-direction: column;
    }

    .restart-btn,
    .home-btn {
        width: 100%;
    }
}
