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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #22c55e;
    --bg-dark: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-input: #252542;
    --text: #ffffff;
    --text-muted: #94a3b8;
    --border: #333355;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.app {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.8rem;
    color: var(--primary);
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: 20px;
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #888;
}

.status.connected .status-dot {
    background: var(--success);
}

.status.recording .status-dot {
    background: var(--danger);
    animation: pulse 1s infinite;
}

.status.error .status-dot {
    background: var(--danger);
}

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

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text);
}

/* Session Card */
.session-card {
    background: linear-gradient(135deg, #1e3a5f 0%, #1a1a2e 100%);
    border: 1px solid var(--primary);
}

.session-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.session-id {
    display: flex;
    align-items: center;
    gap: 10px;
}

.session-id code {
    background: var(--bg-input);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary);
}

.viewer-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.viewer-link input {
    flex: 1;
    min-width: 200px;
    padding: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

input[type="text"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

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

.hint a {
    color: var(--primary);
}

/* VU Meter */
.vu-meter-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.vu-meter {
    flex: 1;
    height: 20px;
    background: var(--bg-input);
    border-radius: 10px;
    overflow: hidden;
}

.vu-meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--success) 0%, var(--warning) 70%, var(--danger) 100%);
    transition: width 0.1s;
}

#vu-level {
    min-width: 40px;
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Preview Box */
.preview-box {
    background: #00ff00;
    border-radius: 8px;
    padding: 20px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#preview-text {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Buttons */
button {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    background: #444;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
    padding: 10px 20px;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
    padding: 12px 24px;
}

.btn-danger:disabled {
    background: #444;
    cursor: not-allowed;
}

.btn-warning {
    background: var(--warning);
    color: black;
    padding: 12px 24px;
}

.btn-warning:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.85rem;
    background: var(--primary);
    color: white;
}

.btn-large {
    padding: 18px 36px;
    font-size: 1.1rem;
}

/* Controls Section */
.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.reset-section {
    margin-bottom: 20px;
}

.reset-section button {
    width: 100%;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

/* Responsive */
@media (max-width: 500px) {
    .controls {
        grid-template-columns: 1fr;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

/* Translation settings animation */
.translation-settings {
    overflow: hidden;
    transition: all 0.3s ease;
}

/* ===================== */
/* LIVE MODE (red tint)  */
/* ===================== */
body.live-mode {
    --bg-dark: #1a0f0f;
    --bg-card: #2e1a1a;
    --bg-input: #422525;
    --border: #553333;
    --primary: #ef4444;
    --primary-dark: #dc2626;
}

body.live-mode .app {
    background: var(--bg-dark);
}

body.live-mode .card {
    background: var(--bg-card);
    border: 1px solid #4a2a2a;
}

body.live-mode header {
    border-bottom-color: #4a2a2a;
}

body.live-mode header h1 {
    color: #ef4444;
}

body.live-mode .session-card {
    background: linear-gradient(135deg, #3a1a1a 0%, #2e1a1a 100%);
    border-color: #ef4444;
}

body.live-mode input,
body.live-mode select,
body.live-mode textarea {
    background: var(--bg-input);
    border-color: var(--border);
}

body.live-mode .status {
    background: var(--bg-card);
}

/* Live indicator banner */
.live-indicator {
    display: none;
    background: linear-gradient(90deg, #ef4444, #dc2626);
    color: white;
    text-align: center;
    padding: 8px;
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 1px;
    animation: live-pulse 2s infinite;
}

body.live-mode .live-indicator {
    display: block;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
