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

:root {
    --bg: #0a0a0f;
    --surface: #12121a;
    --border: rgba(255,255,255,0.1);
    --text: #ffffff;
    --text-dim: #888;
    --accent: #00d4ff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.view { display: flex; flex-direction: column; min-height: 100vh; }
.view.hidden { display: none; }

/* Welcome */
.welcome-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}

.logo .glyph { font-size: 48px; }
.logo h1 { font-size: 32px; margin: 16px 0 8px; }
.logo .tagline { color: var(--text-dim); font-size: 16px; }

.model-section { margin-top: 48px; width: 100%; max-width: 600px; }
.model-section h2 { font-size: 18px; margin-bottom: 8px; }
.model-hint { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; }

.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.model-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.model-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.model-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(0,212,255,0.2);
}

.model-icon { font-size: 32px; margin-bottom: 12px; }
.model-name { font-weight: 600; margin-bottom: 4px; }
.model-size { color: var(--accent); font-size: 14px; margin-bottom: 8px; }
.model-desc { color: var(--text-dim); font-size: 13px; }
.model-badge {
    background: var(--accent);
    color: #000;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 12px;
    display: inline-block;
}

.privacy-note {
    margin-top: 48px;
    color: var(--text-dim);
    font-size: 14px;
}

/* Loading */
.loading-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-ring { position: relative; width: 120px; height: 120px; }
.loading-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 4; }
.ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 0.3s;
}

.loading-percent {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: 600;
}

.loading-status {
    margin-top: 24px;
    color: var(--text-dim);
    font-size: 14px;
    max-width: 300px;
    text-align: center;
}

/* Chat */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.header-left { display: flex; align-items: center; gap: 12px; }
.header-left .glyph { font-size: 24px; }
.badge {
    background: rgba(0,212,255,0.2);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.chat-message {
    max-width: 80%;
    margin-bottom: 16px;
    padding: 14px 18px;
    border-radius: 16px;
    line-height: 1.5;
}

.chat-message.user {
    background: var(--accent);
    color: #000;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.chat-message.ai {
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.chat-input-wrapper {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.suggestions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
}

.suggestion-chip {
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

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

#user-input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
    color: var(--text);
    font-size: 16px;
    resize: none;
    min-height: 50px;
    max-height: 150px;
}

#user-input:focus {
    outline: none;
    border-color: var(--accent);
}

#btn-send {
    width: 50px;
    height: 50px;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#btn-send:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#btn-send svg { stroke: #000; }

code {
    background: rgba(0,212,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

@media (max-width: 480px) {
    .model-grid { grid-template-columns: 1fr; }
    .chat-message { max-width: 90%; }
}
