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

html, body {
    height: 100%;
}

body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.controls-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    background: #1e1e1e;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
    flex-wrap: wrap;
    position: relative;
}

.alert-indicator {
    padding: 8px 28px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #ffffff;
    text-align: center;
    animation: blink-alert-bg 0.8s ease-in-out infinite alternate;
    transition: opacity 0.3s ease;
    user-select: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.alert-indicator.hidden {
    display: none;
}

@keyframes blink-alert-bg {
    from {
        background: #4444ff;
        box-shadow: 0 0 16px 4px rgba(68, 68, 255, 0.6);
    }
    to {
        background: #ff4444;
        box-shadow: 0 0 16px 4px rgba(255, 68, 68, 0.6);
    }
}

.lang-btn,
.mic-btn,
.clear-btn {
    padding: 10px 22px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: filter 0.15s ease, transform 0.1s ease;
    white-space: nowrap;
}

.lang-btn:hover,
.mic-btn:hover,
.clear-btn:hover {
    filter: brightness(1.2);
}

.lang-btn:active,
.mic-btn:active,
.clear-btn:active {
    transform: scale(0.97);
}

.lang-btn {
    background: #1e2a5e;
    color: #8899ff;
    border: 1px solid #2a3a7e;
}

.mic-btn {
    background: #1a3a1a;
    color: #66ff88;
    border: 1px solid #2a5a2a;
}

.mic-btn.active {
    background: #3a1a1a;
    color: #ff8888;
    border: 1px solid #5a2a2a;
}

.stop-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    background: #ff4444;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 2px;
}

.clear-btn {
    background: #2a2a2a;
    color: #aaaaaa;
    border: 1px solid #444;
    margin-left: auto;
}

.transcript-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px 32px;
    scroll-behavior: smooth;
    background: #121212;
}

.transcript-text {
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    line-height: 1.55;
    color: #f0f0f0;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.transcript-text p {
    margin-bottom: 0.6em;
    padding-bottom: 0.4em;
    border-bottom: 1px solid #1e1e1e;
    animation: fadeIn 0.3s ease;
}

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

.interim-text {
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    line-height: 1.55;
    color: #777777;
    font-style: italic;
    word-wrap: break-word;
    min-height: 1.5em;
}

.status-bar {
    padding: 8px 24px;
    background: #1a1a1a;
    color: #666666;
    font-size: 0.85rem;
    border-top: 1px solid #2a2a2a;
    text-align: center;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.status-bar strong {
    color: #999999;
}

.transcript-container::-webkit-scrollbar {
    width: 10px;
}

.transcript-container::-webkit-scrollbar-track {
    background: #1e1e1e;
    border-radius: 4px;
}

.transcript-container::-webkit-scrollbar-thumb {
    background: #444444;
    border-radius: 4px;
    border: 2px solid #1e1e1e;
}

.transcript-container::-webkit-scrollbar-thumb:hover {
    background: #666666;
}

@media (max-width: 600px) {
    .controls-bar {
        gap: 10px;
        padding: 10px 14px;
    }

    .lang-btn,
    .mic-btn,
    .clear-btn {
        padding: 8px 14px;
        font-size: 0.9rem;
    }

    .transcript-container {
        padding: 16px 16px 24px;
    }
}
