:root {
    --bg: #1a1a1a;
    --surface: #2a2a2a;
    --text: #e0e0e0;
    --text-muted: #888;
    --accent: #9ca3af;
    --user-bg: #333;
    --assistant-bg: transparent;
    --border: #3a3a3a;
}

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

#user-menu {
    position: relative;
    margin-left: auto;
}

#user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: background 0.15s;
}

#user-menu-toggle:hover { background: rgba(255,255,255,0.05); }

.caret { font-size: 10px; opacity: 0.7; }

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 200;
    padding: 8px 0;
}

.user-dropdown.open { display: block; }

.user-email {
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.logout-btn {
    display: block;
    width: 100%;
    padding: 8px 16px;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    transition: background 0.15s;
}

.logout-btn:hover { background: rgba(255,255,255,0.05); }

main {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

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

.message {
    line-height: 1.6;
    font-size: 0.95rem;
}

.message.user {
    background: var(--user-bg);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    align-self: flex-end;
    max-width: 80%;
}

.message.assistant {
    padding: 0.5rem 0;
}

footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

#chat-form {
    display: flex;
    gap: 0.5rem;
}

#message-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
}

#message-input:focus {
    border-color: var(--accent);
}

#send-btn {
    padding: 0.75rem 1.5rem;
    background: var(--text);
    color: var(--bg);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

#send-btn:hover {
    opacity: 0.9;
}

/* Mirror display */
#mirror-display {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
}

#mirror-display h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--accent);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
}

.hidden { display: none !important; }

/* Save prompt */
.save-prompt {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 8px;
    text-align: center;
}

.save-btn {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.5rem 1.5rem;
    background: var(--text);
    color: var(--bg);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
}

/* Usage info */
.usage-info {
    max-width: 800px;
    width: 100%;
    margin: -4px 0 4px;
    padding: 2px 0;
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
}

/* Version panel */
#release-notes {
    position: fixed;
    top: 56px;
    right: 16px;
    width: 220px;
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    padding: 14px 16px;
    font-size: 13px;
    z-index: 40;
}

.rn-release-divider {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.rn-header {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    margin-bottom: 2px;
}

.rn-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.rn-changes {
    list-style: none;
    padding: 0;
}

.rn-changes li {
    padding: 3px 0;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.rn-changes li:first-child {
    border-top: none;
}

.rn-model {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.message.error {
    color: #ef4444;
}
