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

body {
    font-family: 'Cal Sans', 'Noto Sans', sans-serif;
    background: #f8f9fa;
    color: #2c3e50;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: #6c757d;
    font-size: 1.1rem;
}

.controls {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    border: 1px solid #e9ecef;
}

.input-section {
    margin-bottom: 2rem;
}

.input-section h3 {
    margin-bottom: 1rem;
    color: #495057;
}

textarea {
    width: 100%;
    height: 120px;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

.parameters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.param-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.param-group label {
    font-weight: 500;
    color: #495057;
}

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    transition: background 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.value {
    font-weight: 600;
    color: #667eea;
    font-size: 0.9rem;
}

.actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

#trainModel {
    background: #28a745;
    color: white;
}

#trainModel:hover {
    background: #218838;
    transform: translateY(-1px);
}

#generateWord {
    background: #667eea;
    color: white;
}

#generateWord:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

#generateBatch {
    background: #17a2b8;
    color: white;
}

#generateBatch:hover {
    background: #138496;
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.output {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.generated-words, .statistics {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    border: 1px solid #e9ecef;
}

.generated-words h3, .statistics h3 {
    margin-bottom: 1rem;
    color: #495057;
}

#wordsList {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.word-tag {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.word-tag:hover {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
}

.chain-visualization {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    border: 1px solid #e9ecef;
}

.chain-visualization h3 {
    margin-bottom: 1rem;
    color: #495057;
}

#chainDisplay {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.8;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.chain-entry {
    margin-bottom: 0.5rem;
    padding: 0.3rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.chain-entry:hover {
    background: #e9ecef;
}

.chain-key {
    color: #667eea;
    font-weight: 600;
}

.chain-probability {
    color: #28a745;
    font-weight: 500;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .output {
        grid-template-columns: 1fr;
    }
    
    .parameters {
        grid-template-columns: 1fr;
    }
    
    .actions {
        flex-direction: column;
    }
    
    header h1 {
        font-size: 2rem;
    }
}

