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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0f0f23;
    color: #ffffff;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

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

.header p {
    color: #8e8ea0;
    font-size: 1.1rem;
}

.chat-container {
    flex: 1;
    background: #1a1a2e;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.message {
    margin-bottom: 24px;
}

.message:last-child {
    margin-bottom: 0;
}

.user-message .message-content {
    background: #16213e;
    padding: 16px 20px;
    border-radius: 18px;
    border: 1px solid #2d3748;
}

.assistant-message .message-content {
    background: #1e1e3f;
    padding: 16px 20px;
    border-radius: 18px;
    border: 1px solid #3d4852;
}

.prompt-text {
    font-size: 1rem;
    color: #e2e8f0;
}

.response-text {
    font-size: 1rem;
    line-height: 1.8;
    color: #e2e8f0;
}

.token {
    position: relative;
    cursor: pointer;
    padding: 2px 1px;
    border-radius: 3px;
    transition: all 0.2s ease;
    display: inline-block;
}

.token:hover {
    transform: scale(1.05);
    z-index: 10;
}

/* Purple highlighting based on probability - both color intensity and transparency scale with probability */
.token.prob-very-low { 
    background-color: rgba(147, 51, 234, 0.05); 
    color: rgba(226, 232, 240, 0.7);
}
.token.prob-low { 
    background-color: rgba(147, 51, 234, 0.15); 
    color: rgba(226, 232, 240, 0.8);
}
.token.prob-medium { 
    background-color: rgba(147, 51, 234, 0.3); 
    color: rgba(226, 232, 240, 0.9);
}
.token.prob-high { 
    background-color: rgba(147, 51, 234, 0.5); 
    color: rgba(226, 232, 240, 0.95);
}
.token.prob-very-high { 
    background-color: rgba(147, 51, 234, 0.7); 
    color: rgba(226, 232, 240, 1.0);
}

.input-section {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.config-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #2d3748;
}

.config-row {
    display: flex;
    gap: 16px;
}

.config-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.config-field label {
    color: #a0aec0;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.config-field input {
    background: #16213e;
    border: 1px solid #2d3748;
    border-radius: 6px;
    padding: 10px 12px;
    color: #ffffff;
    font-size: 0.95rem;
    font-family: inherit;
}

.config-field input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.config-field input::placeholder {
    color: #718096;
}

.input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#prompt-input {
    flex: 1;
    background: #16213e;
    border: 1px solid #2d3748;
    border-radius: 8px;
    padding: 12px 16px;
    color: #ffffff;
    font-size: 1rem;
    resize: vertical;
    min-height: 50px;
    font-family: inherit;
}

#prompt-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#prompt-input::placeholder {
    color: #8e8ea0;
}

#generate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    height: fit-content;
}

#generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#generate-btn:active {
    transform: translateY(0);
}

#generate-btn:disabled {
    background: #4a5568;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Tooltip Styles */
.tooltip {
    position: absolute;
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    max-width: 300px;
    min-width: 200px;
}

.tooltip-content {
    padding: 12px;
}

.tooltip-header {
    font-weight: 600;
    font-size: 0.9rem;
    color: #e2e8f0;
    margin-bottom: 8px;
    border-bottom: 1px solid #4a5568;
    padding-bottom: 6px;
}

.tooltip-body {
    font-size: 0.85rem;
}

.prob-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(74, 85, 104, 0.3);
}

.prob-item:last-child {
    border-bottom: none;
}

.prob-token {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: #1a202c;
    padding: 2px 6px;
    border-radius: 4px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prob-value {
    font-weight: 600;
    color: #9f7aea;
    margin-left: 8px;
}

.selected-token {
    background-color: rgba(66, 153, 225, 0.2) !important;
    border: 1px solid #4299e1;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #4a5568;
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Demo section styles */
.demo-section {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    border: 2px solid #667eea;
}

.demo-header {
    text-align: center;
    margin-bottom: 16px;
}

.demo-header h3 {
    color: #667eea;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.demo-header p {
    color: #a0aec0;
    font-size: 0.9rem;
}

.demo-header a {
    color: #667eea;
    text-decoration: none;
}

.demo-header a:hover {
    text-decoration: underline;
}

.demo-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.demo-btn {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
    border: 1px solid #667eea;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.demo-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: translateY(-1px);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .config-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .input-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    #generate-btn {
        width: 100%;
        margin-top: 8px;
    }
    
    .demo-buttons {
        flex-direction: column;
    }
    
    .demo-btn {
        width: 100%;
    }
}
