* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #f7f7f8;
    color: #333;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e5e5;
    background-color: #ffffff;
}

.header-title h1 {
    font-size: 1.25rem;
    font-weight: 700;
    display: inline-block;
    margin-right: 0.5rem;
}

.subtitle {
    font-size: 0.9rem;
    color: #666;
    margin-right: 1rem;
}

.status {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    background: #eee;
}

.status.online { background: #d4edda; color: #155724; }
.status.offline { background: #f8d7da; color: #721c24; }

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 1.2rem;
}

.icon-btn:hover { color: #333; }

.local-instructions {
    padding: 1.5rem;
    background: #fff3cd;
    border-bottom: 1px solid #ffeeba;
    color: #856404;
    font-size: 0.9rem;
}
.local-instructions h2 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.local-instructions ol { margin-left: 1.5rem; margin-top: 0.5rem; margin-bottom: 0.5rem; }
.local-instructions code { background: rgba(0,0,0,0.05); padding: 2px 4px; border-radius: 4px; }
.local-instructions a { color: #0056b3; font-weight: bold; }

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: #fff;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #888;
    text-align: center;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-wrapper {
    display: flex;
    align-items: flex-end;
    max-width: 80%;
    position: relative;
}

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

.message {
    padding: 0.8rem 1rem;
    border-radius: 15px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.user .message {
    background-color: #007bff;
    color: white;
    border-bottom-right-radius: 2px;
}

.assistant .message {
    background-color: #f1f1f1;
    color: #333;
    border-bottom-left-radius: 2px;
}

.copy-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    margin-left: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}
.copy-btn:hover { color: #555; }

.input-area {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e5e5;
    background-color: #fff;
}

.actions-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    font-size: 0.85rem;
    cursor: pointer;
    color: #495057;
}

.action-btn:hover { background: #e9ecef; }
.stop-btn { color: #dc3545; }
.stop-btn:hover { background: #f8d7da; }

.input-box {
    display: flex;
    align-items: center;
    background: #f1f1f1;
    border-radius: 25px;
    padding: 0.5rem 1rem;
}

.input-box input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.5rem;
    font-size: 1rem;
    outline: none;
}

.send-btn {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.send-btn:disabled { color: #ccc; cursor: not-allowed; }

.modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.hidden { display: none !important; }

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    min-width: 300px;
    text-align: center;
}
.modal-content h2 { margin-bottom: 1rem; font-size: 1.2rem; }
.attribution { color: #666; font-size: 0.9rem; }
.close-btn {
    margin-top: 1.5rem;
    padding: 0.5rem 1rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

@media (max-width: 600px) {
    .header-title h1 { font-size: 1.1rem; }
    .subtitle { display: none; }
    .message-wrapper { max-width: 90%; }
}
