* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 40px 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

.calculator-wrapper {
    padding: 40px 30px;
}

.input-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 1rem;
}

#dataInput {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    transition: border-color 0.3s;
    resize: vertical;
}

#dataInput:focus {
    outline: none;
    border-color: #667eea;
}

select,
input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background: #fff;
}

select:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

.hint {
    font-size: 0.875rem;
    color: #666;
    margin-top: 8px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.display-options {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 2px solid #e9ecef;
}

.display-options h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #667eea;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: #f8f9fa;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #667eea;
}

.checkbox-label span {
    font-size: 0.95rem;
    color: #333;
}

.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 35px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
    min-width: 150px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e9ecef;
    color: #333;
}

.btn-secondary:hover {
    background: #dee2e6;
    transform: translateY(-2px);
}

.results-section {
    margin-top: 40px;
}

.results-section h2 {
    font-size: 2rem;
    margin-bottom: 25px;
    color: #333;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.table-wrapper {
    overflow-x: auto;
    margin-bottom: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

th:last-child {
    border-right: none;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.95rem;
}

tbody tr:hover {
    background: #f8f9fa;
}

tbody tr:nth-child(even) {
    background: #fafbfc;
}

tbody tr:nth-child(even):hover {
    background: #f8f9fa;
}

tfoot {
    background: #f8f9fa;
    font-weight: 700;
    border-top: 2px solid #667eea;
}

tfoot td {
    padding: 15px;
    font-size: 1rem;
}

.stats-summary {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.stats-summary h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #667eea;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    background: #fff;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.stat-label {
    font-weight: 500;
    color: #555;
}

.stat-value {
    font-weight: 700;
    color: #333;
    font-size: 1.05rem;
}

.chart-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
}

.chart-section h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #667eea;
}

.chart-container {
    position: relative;
    height: 400px;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
}

#frequencyChart {
    max-height: 100%;
}

.info-section {
    background: #f8f9fa;
    padding: 40px 30px;
    border-top: 3px solid #667eea;
}

.info-section h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #333;
}

.info-section > p {
    margin-bottom: 30px;
    color: #555;
    line-height: 1.8;
    font-size: 1.05rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.info-card {
    background: #fff;
    padding: 25px;
    border-radius: 15px;
    border-left: 4px solid #667eea;
    transition: all 0.3s;
}

.info-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

.info-card h3 {
    color: #667eea;
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.info-card p {
    color: #555;
    line-height: 1.7;
}

.footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 20px;
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .calculator-wrapper,
    .info-section {
        padding: 25px 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .options-grid,
    .checkbox-grid,
    .stats-grid,
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 300px;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 8px;
    }
}