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

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

.container {
    max-width: 1600px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

.game-area {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.main-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sequence-panel, .attention-canvas, .qkv-panel {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.sequence-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#sequenceInput {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
}

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

.btn-small {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-small:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.token-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.token-item {
    padding: 10px 15px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.token-item:hover {
    border-color: #667eea;
    background: #e8f5e9;
}

.token-item.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

canvas {
    width: 100%;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
}

#attentionCanvas {
    height: 400px;
    cursor: pointer;
}

.attention-info {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.9em;
    color: #666;
}

.qkv-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.qkv-section {
    text-align: center;
}

.qkv-section h4 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1em;
}

.qkv-section canvas {
    height: 150px;
}

.qkv-desc {
    margin-top: 8px;
    font-size: 0.85em;
    color: #666;
}

.control-panel {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    overflow-y: auto;
    max-height: 900px;
}

.config-section, .formula-section, .stats-section, .example-section, .level-section {
    margin-bottom: 20px;
}

.config-group {
    margin-bottom: 15px;
}

.config-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.9em;
}

select, input[type="range"] {
    width: 100%;
}

select {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95em;
}

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

input[type="range"] {
    height: 6px;
    background: #e0e0e0;
    outline: none;
    border-radius: 3px;
}

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

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #667eea;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

.formula-box {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 15px;
}

.formula-line {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
}

.fraction {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
    text-align: center;
    font-size: 0.9em;
}

.num {
    border-bottom: 2px solid #333;
    padding-bottom: 3px;
}

.den {
    padding-top: 3px;
}

.formula-explain {
    font-size: 0.9em;
    line-height: 1.8;
}

.formula-explain p {
    margin: 5px 0;
}

.formula-explain strong {
    color: #667eea;
    font-family: 'Courier New', monospace;
}

.stats-grid {
    display: grid;
    gap: 10px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.stat-label {
    font-weight: 600;
    color: #555;
}

.stat-value {
    font-family: 'Courier New', monospace;
    color: #667eea;
    font-weight: bold;
}

.example-list, .level-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.example-btn, .level-btn {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    font-size: 0.9em;
}

.example-btn:hover, .level-btn:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.level-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.level-btn.completed {
    border-color: #48bb78;
    background: #48bb78;
    color: white;
}

.tutorial {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.tutorial h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.tutorial ul {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
}

.tutorial li {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.tutorial li:last-child {
    border-bottom: none;
}

.tutorial strong {
    color: #667eea;
}

.concepts {
    background: #e8f5e9;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #48bb78;
}

.concepts h4 {
    color: #2f855a;
    margin-bottom: 10px;
}

.concepts p {
    margin: 5px 0;
    color: #2f855a;
    font-size: 0.9em;
}

@media (max-width: 1200px) {
    .game-area {
        grid-template-columns: 1fr;
    }
    
    .qkv-grid {
        grid-template-columns: 1fr;
    }
}
