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

:root {
    --bg: #0f1117;
    --surface: #1a1b23;
    --surface-hover: #22232d;
    --border: #2a2b35;
    --text: #e4e4e7;
    --text-muted: #71717a;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --user-bubble: #6366f1;
    --assistant-bubble: #1e1f2a;
    --enhance: #f59e0b;
    --enhance-hover: #fbbf24;
    --success: #22c55e;
    --error: #ef4444;
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0 16px;
}

header {
    text-align: center;
    padding: 24px 0 16px;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

.controls {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    flex-wrap: wrap;
}

.control-group {
    flex: 1;
    min-width: 150px;
}

.control-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

select {
    width: 100%;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2371717a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

select:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.welcome-message {
    text-align: center;
    color: var(--text-muted);
    padding: 48px 24px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.welcome-message strong {
    color: var(--text);
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.message.user .message-label {
    text-align: right;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message.user .message-bubble {
    background: var(--user-bubble);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background: var(--assistant-bubble);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.message.user .message-meta {
    text-align: right;
}

.enhanced-badge {
    display: inline-block;
    background: var(--enhance);
    color: #000;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}

.techniques-list {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

.input-area {
    padding: 16px 0;
    border-top: 1px solid var(--border);
}

textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    line-height: 1.5;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
}

textarea::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.btn {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-send {
    background: var(--accent);
    color: white;
}

.btn-send:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-enhance {
    background: transparent;
    color: var(--enhance);
    border: 1px solid var(--enhance);
}

.btn-enhance:hover:not(:disabled) {
    background: rgba(245, 158, 11, 0.1);
    color: var(--enhance-hover);
    border-color: var(--enhance-hover);
}

.enhance-icon {
    font-size: 0.9rem;
}

.loading-dots::after {
    content: "";
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75% { content: "..."; }
}

footer {
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.api-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.api-info code {
    background: var(--surface);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    border: 1px solid var(--border);
}

@media (max-width: 600px) {
    .controls {
        flex-direction: column;
    }
    .control-group {
        min-width: 100%;
    }
    .message {
        max-width: 95%;
    }
}
