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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    height: 100vh;
    overflow: hidden;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* Screens */
.screen { display: none; flex-direction: column; height: 100%; }
.screen.active { display: flex; }

/* Language Selection */
#lang-screen {
    justify-content: center;
    align-items: center;
    gap: 40px;
    padding: 40px;
}

#lang-title {
    font-size: 24px;
    color: #16213e;
}

.lang-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.lang-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 32px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
}

.lang-btn:hover {
    border-color: #0f3460;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 52, 96, 0.15);
}

.lang-flag {
    font-size: 28px;
    font-weight: 700;
    color: #0f3460;
}

.lang-name {
    font-size: 14px;
    color: #555;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #0f3460;
    color: #fff;
}

#app-title { font-size: 18px; font-weight: 600; }

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.small-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.small-btn:hover { background: rgba(255,255,255,0.25); }

/* Conversation */
.conversation {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 15px;
    animation: fadeIn 0.2s ease;
}

.message.assistant {
    background: #e8f0fe;
    color: #1a1a2e;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.user {
    background: #0f3460;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.error {
    background: #fee;
    color: #c00;
    align-self: center;
    font-size: 13px;
}

.msg-time {
    display: block;
    font-size: 11px;
    opacity: 0.6;
    margin-bottom: 4px;
}

.msg-body {
    display: block;
}

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

/* Status bar */
.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    font-size: 13px;
    color: #666;
}

.status-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
}

.status-icon.recording { background: #f44336; animation: pulse 1s infinite; }
.status-icon.processing { background: #ff9800; animation: pulse 0.5s infinite; }
.status-icon.error { background: #f44336; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Live transcript */
.live-transcript {
    padding: 12px 20px;
    background: #fafafa;
    border-top: 1px solid #eee;
    font-size: 14px;
    color: #333;
    font-style: italic;
    min-height: 44px;
}

.live-transcript.hidden { display: none; }

.cursor-blink {
    animation: blink 0.8s infinite;
    color: #0f3460;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Push-to-talk button */
.controls {
    padding: 20px;
    display: flex;
    justify-content: center;
    background: #fff;
    border-top: 1px solid #e0e0e0;
}

.ptt-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid #0f3460;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    justify-content: center;
}

.ptt-btn:hover:not(:disabled) {
    background: #f0f4ff;
}

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

.ptt-btn.recording {
    background: #f44336;
    border-color: #d32f2f;
    transform: scale(1.05);
}

.ptt-btn.recording .mic-icon { fill: #fff; }
.ptt-btn.recording #ptt-label { color: #fff; }

.mic-icon {
    fill: #0f3460;
    transition: fill 0.2s;
}

#ptt-label {
    font-size: 11px;
    font-weight: 600;
    color: #0f3460;
    transition: color 0.2s;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay.hidden { display: none; }

.overlay-content {
    background: #fff;
    padding: 32px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
}

.overlay-content h2 { margin-bottom: 12px; color: #c00; }
.overlay-content p { margin-bottom: 20px; color: #666; }

.btn {
    padding: 10px 24px;
    background: #0f3460;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover { background: #16213e; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Text input bar */
.text-input-bar {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.text-input-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.text-input-bar input:focus { border-color: #0f3460; }
.text-input-bar input:disabled { background: #eee; }
