/* ═══════════════════════════════════════════════════════════════════════════
   J.A.R.V.I.S. HUD — Cinematic Interface Styles
   Inspired by Iron Man's heads-up display
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── CSS Variables ─────────────────────────────────────────────────────── */
:root {
    --primary: #00D4FF;
    --primary-dim: #007A99;
    --primary-glow: rgba(0, 212, 255, 0.4);
    --secondary: #0099CC;
    --accent: #FF6B35;
    --accent-glow: rgba(255, 107, 53, 0.3);
    --warning: #FFB800;
    --success: #00FF88;
    --danger: #FF3366;
    --bg-dark: rgba(0, 10, 25, 0.92);
    --bg-panel: rgba(0, 30, 60, 0.6);
    --bg-panel-hover: rgba(0, 50, 80, 0.7);
    --text-primary: #E0F7FF;
    --text-secondary: rgba(0, 212, 255, 0.7);
    --text-dim: rgba(0, 212, 255, 0.4);
    --border-color: rgba(0, 212, 255, 0.2);
    --border-active: rgba(0, 212, 255, 0.5);
    --font-display: 'Orbitron', monospace;
    --font-body: 'Rajdhani', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
}

/* ─── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: transparent;
    font-family: var(--font-body);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    user-select: none;
    cursor: default;
}

/* ─── HUD Container ────────────────────────────────────────────────────── */
.hud-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ─── Particles Canvas ──────────────────────────────────────────────────── */
#particles-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ─── Circuit Lines ─────────────────────────────────────────────────────── */
.circuit-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.3;
}

.circuit-line {
    stroke: var(--primary-dim);
    stroke-width: 1;
    stroke-dasharray: 8 4;
    animation: circuit-flow 3s linear infinite;
}

.circuit-node {
    fill: var(--primary);
    animation: node-pulse 2s ease-in-out infinite;
}

@keyframes circuit-flow {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -24; }
}

@keyframes node-pulse {
    0%, 100% { opacity: 0.3; r: 3; }
    50% { opacity: 1; r: 5; }
}

/* ─── Scan Line Effect ──────────────────────────────────────────────────── */
.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-glow), transparent);
    z-index: 100;
    pointer-events: none;
    animation: scan-move 6s linear infinite;
    opacity: 0.5;
}

@keyframes scan-move {
    0% { top: -2px; }
    100% { top: 100%; }
}

/* ─── HUD Content ──────────────────────────────────────────────────────── */
.hud-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px 40px;
}

/* ─── Top Bar ───────────────────────────────────────────────────────────── */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.top-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.system-label {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary-glow), 0 0 40px var(--primary-glow);
}

.version {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 2px;
}

.top-center {
    text-align: center;
}

.time-display {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: 3px;
}

.top-right {
    display: flex;
    align-items: center;
}

.status-badge {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 3px;
    padding: 6px 16px;
    border-radius: 2px;
    border: 1px solid;
    text-transform: uppercase;
    font-weight: 600;
}

.status-standby {
    color: var(--primary);
    border-color: var(--primary-dim);
    background: rgba(0, 212, 255, 0.05);
}

.status-listening {
    color: var(--success);
    border-color: var(--success);
    background: rgba(0, 255, 136, 0.1);
    animation: status-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.2);
}

.status-thinking {
    color: var(--warning);
    border-color: var(--warning);
    background: rgba(255, 184, 0, 0.1);
    animation: status-pulse 0.8s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(255, 184, 0, 0.2);
}

.status-speaking {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(255, 107, 53, 0.1);
    box-shadow: 0 0 15px var(--accent-glow);
}

.status-error {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(255, 51, 102, 0.1);
}

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

/* ─── Center Area — Arc Reactor ─────────────────────────────────────────── */
.center-area {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 220px;
    max-height: 320px;
    padding-bottom: 40px; /* Space for reactor-label absolute positioning */
}

/* ─── Mic Controls Bar ──────────────────────────────────────────────────── */
.mic-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 14px 0;
    margin-top: 4px;
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.mic-device-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mic-label {
    color: var(--primary-dim);
    display: flex;
    align-items: center;
}

.mic-select {
    background: rgba(0, 212, 255, 0.06);
    border: 1px solid var(--primary-dim);
    color: var(--primary);
    padding: 5px 10px;
    border-radius: 4px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 12px;
    max-width: 200px;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.mic-select:hover {
    border-color: var(--primary);
    background: rgba(0, 212, 255, 0.1);
}

.mic-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.mic-select option {
    background: #0a1628;
    color: var(--primary);
}

/* ─── Mic Button ────────────────────────────────────────────────────────── */
.mic-button {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid var(--primary-dim);
    background: rgba(0, 212, 255, 0.06);
    color: var(--primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 20;
    gap: 2px;
}

.mic-label-text {
    font-family: 'Rajdhani', sans-serif;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0.7;
}

.mic-button:hover {
    border-color: var(--primary);
    background: rgba(0, 212, 255, 0.15);
    box-shadow: 0 0 20px var(--primary-glow);
    transform: scale(1.08);
}

.mic-button.recording {
    border-color: var(--success);
    background: rgba(0, 255, 136, 0.12);
    color: var(--success);
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.3);
    animation: mic-pulse 1.5s ease-in-out infinite;
}

.mic-button.recording .mic-label-text {
    opacity: 1;
}

.mic-button.recording::after {
    content: '';
    position: absolute;
    width: 66px;
    height: 66px;
    border-radius: 50%;
    border: 2px solid rgba(0, 255, 136, 0.3);
    animation: mic-ring 1.5s ease-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

@keyframes mic-ring {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.mic-status {
    min-width: 50px;
    text-align: center;
}

.mic-timer {
    font-family: 'Share Tech Mono', monospace;
    font-size: 13px;
    color: var(--success);
    opacity: 0;
    transition: opacity 0.3s;
}

.mic-button.recording ~ .mic-status .mic-timer {
    opacity: 1;
}

.arc-reactor-container {
    position: relative;
    width: 280px;
    height: 280px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Rotating Rings */
.reactor-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid transparent;
}

.ring-outer {
    width: 280px;
    height: 280px;
    border-color: var(--border-color);
    border-top-color: var(--primary);
    border-right-color: var(--primary-dim);
    animation: rotate-cw 8s linear infinite;
}

.ring-middle {
    width: 230px;
    height: 230px;
    border-color: var(--border-color);
    border-bottom-color: var(--primary);
    border-left-color: var(--secondary);
    animation: rotate-ccw 6s linear infinite;
}

.ring-inner {
    width: 180px;
    height: 180px;
    border-color: rgba(0, 212, 255, 0.1);
    border-top-color: var(--accent);
    border-right-color: var(--primary);
    animation: rotate-cw 4s linear infinite;
}

@keyframes rotate-cw {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotate-ccw {
    from { transform: rotate(0deg); }
    to { transform: rotate(-360deg); }
}

/* Core Waveform */
.reactor-core {
    position: relative;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.15) 0%, transparent 70%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

#waveform-canvas {
    border-radius: 50%;
}

.reactor-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-size: 12px;
    letter-spacing: 4px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Active states for reactor */
.hud-container.state-listening .ring-outer {
    border-top-color: var(--success);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.2);
}

.hud-container.state-listening .reactor-core {
    background: radial-gradient(circle, rgba(0, 255, 136, 0.2) 0%, transparent 70%);
}

.hud-container.state-thinking .ring-outer,
.hud-container.state-thinking .ring-middle,
.hud-container.state-thinking .ring-inner {
    animation-duration: 1s;
}

.hud-container.state-thinking .reactor-core {
    background: radial-gradient(circle, rgba(255, 184, 0, 0.2) 0%, transparent 70%);
}

.hud-container.state-speaking .ring-inner {
    border-top-color: var(--accent);
    border-right-color: var(--accent);
    box-shadow: 0 0 30px var(--accent-glow);
}

.hud-container.state-speaking .reactor-core {
    background: radial-gradient(circle, rgba(255, 107, 53, 0.2) 0%, transparent 70%);
}

/* ─── Activity Panel ────────────────────────────────────────────────────── */
.activity-panel {
    flex-shrink: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease, opacity 0.4s ease;
    opacity: 0;
    padding: 0;
}

.activity-panel.visible {
    max-height: 180px;
    opacity: 1;
    padding: 8px 0;
}

.activity-header {
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 3px;
    color: var(--warning);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: rgba(0, 212, 255, 0.04);
    border-left: 2px solid var(--primary-dim);
    border-radius: 0 4px 4px 0;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--text-primary);
    animation: activity-slide-in 0.3s ease-out;
}

.activity-item.running {
    border-left-color: var(--warning);
}

.activity-item.done {
    border-left-color: var(--success);
    opacity: 0.7;
}

.activity-item.error {
    border-left-color: var(--danger);
}

.activity-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--primary-dim);
    border-top-color: var(--warning);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.activity-item.done .activity-spinner {
    border-color: var(--success);
    animation: none;
    background: var(--success);
}

.activity-item.error .activity-spinner {
    border-color: var(--danger);
    animation: none;
    background: var(--danger);
}

.activity-action {
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}

.activity-detail {
    color: var(--text-secondary);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes activity-slide-in {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ─── Visual Results Panel ──────────────────────────────────────────────── */
.results-panel {
    flex-shrink: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, padding 0.5s ease, opacity 0.5s ease;
    opacity: 0;
    padding: 0;
}

.results-panel.visible {
    max-height: 350px;
    opacity: 1;
    padding: 8px 0;
}

.results-header {
    font-family: var(--font-display);
    font-size: 9px;
    letter-spacing: 3px;
    color: var(--primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.results-close {
    margin-left: auto;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s;
}

.results-close:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.results-content {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    overflow-y: auto;
    max-height: 300px;
    padding-right: 4px;
}

.results-content::-webkit-scrollbar {
    width: 4px;
}

.results-content::-webkit-scrollbar-thumb {
    background: var(--primary-dim);
    border-radius: 2px;
}

/* Result Cards */
.result-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    flex: 1 1 calc(50% - 5px);
    min-width: 200px;
    animation: card-appear 0.4s ease-out;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.result-card:hover {
    border-color: var(--border-active);
    box-shadow: 0 0 12px var(--primary-glow);
}

.result-card.full-width {
    flex: 1 1 100%;
}

.result-card-title {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-card-body {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Image Results */
.result-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    width: 100%;
}

.result-image-item {
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.3s;
}

.result-image-item:hover {
    transform: scale(1.03);
    border-color: var(--primary);
}

.result-image-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

.result-image-caption {
    font-size: 10px;
    padding: 4px 6px;
    color: var(--text-secondary);
    background: rgba(0, 10, 25, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Data Table */
.result-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 12px;
}

.result-table th {
    text-align: left;
    padding: 4px 8px;
    color: var(--primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 10px;
    letter-spacing: 1px;
    font-weight: 600;
}

.result-table td {
    padding: 4px 8px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0, 212, 255, 0.06);
}

.result-table tr:hover td {
    background: rgba(0, 212, 255, 0.04);
}

/* Link Cards */
.result-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(0, 212, 255, 0.04);
    border-left: 2px solid var(--primary-dim);
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 13px;
}

.result-link:hover {
    background: rgba(0, 212, 255, 0.1);
    border-left-color: var(--primary);
}

.result-link-url {
    font-size: 10px;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Model indicator */
.model-badge {
    font-family: var(--font-mono);
    font-size: 9px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    letter-spacing: 1px;
}

.model-badge.flash {
    background: rgba(0, 255, 136, 0.1);
    color: var(--success);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.model-badge.pro {
    background: rgba(255, 107, 53, 0.1);
    color: var(--accent);
    border: 1px solid rgba(255, 107, 53, 0.3);
}

.model-badge.research {
    background: rgba(0, 212, 255, 0.1);
    color: var(--primary);
    border: 1px solid rgba(0, 212, 255, 0.3);
}

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

/* ─── Transcript Area ───────────────────────────────────────────────────── */
.transcript-area {
    flex-shrink: 0;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.transcript-section {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 14px 20px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.transcript-section:hover {
    background: var(--bg-panel-hover);
    border-color: var(--border-active);
}

.section-label {
    font-family: var(--font-display);
    font-size: 10px;
    letter-spacing: 3px;
    color: var(--text-dim);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.label-icon {
    color: var(--primary);
    font-size: 8px;
}

.jarvis-section .label-icon {
    color: var(--accent);
}

.transcript-text {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    min-height: 24px;
    letter-spacing: 0.5px;
}

.user-section .transcript-text {
    color: var(--primary);
}

.jarvis-section .transcript-text {
    color: var(--text-primary);
}

.typing-cursor {
    display: inline;
    color: var(--accent);
    animation: blink 0.7s step-end infinite;
    font-weight: bold;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ─── Bottom Bar ────────────────────────────────────────────────────────── */
.bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.bottom-left {
    display: flex;
    gap: 20px;
}

.indicator {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
}

.indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-dim);
    transition: all 0.3s ease;
}

.indicator-dot.active {
    background: var(--success);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

.bottom-center {
    text-align: center;
}

.info-text {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.bottom-right {
    display: flex;
    align-items: center;
}

.audio-level-bar {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 20px;
}

.level-bar {
    width: 4px;
    height: 4px;
    background: var(--primary-dim);
    border-radius: 1px;
    transition: all 0.1s ease;
}

.level-bar.active {
    background: var(--primary);
    box-shadow: 0 0 4px var(--primary-glow);
}

/* ─── Glitch Effect ─────────────────────────────────────────────────────── */
@keyframes glitch {
    0%, 95%, 100% {
        transform: translate(0);
        opacity: 1;
    }
    96% {
        transform: translate(-2px, 1px);
        opacity: 0.8;
    }
    97% {
        transform: translate(2px, -1px);
        opacity: 0.9;
    }
    98% {
        transform: translate(-1px, -1px);
        opacity: 0.8;
    }
}

.glitch-text {
    animation: glitch 5s ease-in-out infinite;
}

/* ─── Fade-in Animation ─────────────────────────────────────────────────── */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

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

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
.transcript-area::-webkit-scrollbar {
    width: 4px;
}

.transcript-area::-webkit-scrollbar-track {
    background: transparent;
}

.transcript-area::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.transcript-area::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dim);
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 800px) {
    .hud-content {
        padding: 10px 20px;
    }

    .arc-reactor-container {
        width: 200px;
        height: 200px;
    }

    .ring-outer { width: 200px; height: 200px; }
    .ring-middle { width: 170px; height: 170px; }
    .ring-inner { width: 140px; height: 140px; }

    .reactor-core {
        width: 120px;
        height: 120px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   WEB-SPECIFIC STYLES — Text Input, Responsive, Mobile
   ═══════════════════════════════════════════════════════════════════════════ */

/* Web body needs solid bg */
body {
    background: #000a19;
}

/* ─── Text Input Area ──────────────────────────────────────────────────── */
.input-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    flex-shrink: 0;
}

.text-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0 4px 0 12px;
    transition: border-color 0.3s;
}

.text-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

.text-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    padding: 10px 0;
    caret-color: var(--primary);
}

.text-input::placeholder {
    color: var(--text-dim);
}

.send-button {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-button:hover {
    background: rgba(0, 212, 255, 0.1);
    color: var(--success);
}

/* Mic recording animation */
.mic-button.recording {
    animation: pulse-record 1s ease-in-out infinite;
    background: rgba(255, 51, 102, 0.2) !important;
    border-color: var(--danger) !important;
    color: var(--danger) !important;
}

@keyframes pulse-record {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 51, 102, 0.3); }
    50% { box-shadow: 0 0 20px rgba(255, 51, 102, 0.6); }
}

/* ─── Responsive: Mobile ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .hud-content {
        padding: 10px 12px !important;
    }

    .top-bar {
        font-size: 10px;
    }

    .system-label {
        font-size: 14px !important;
    }

    .center-area {
        min-height: 120px !important;
    }

    .arc-reactor-container {
        width: 100px !important;
        height: 100px !important;
    }

    .reactor-ring {
        width: 80px !important;
        height: 80px !important;
    }

    .reactor-ring.ring-middle {
        width: 60px !important;
        height: 60px !important;
    }

    .reactor-ring.ring-inner {
        width: 40px !important;
        height: 40px !important;
    }

    .reactor-core {
        width: 30px !important;
        height: 30px !important;
    }

    #waveform-canvas {
        width: 30px !important;
        height: 30px !important;
    }

    .input-area {
        flex-direction: column;
        gap: 8px;
    }

    .mic-button {
        width: 100% !important;
    }

    .text-input-wrapper {
        width: 100%;
    }

    .transcript-area {
        font-size: 13px;
    }

    .results-panel.visible {
        max-height: 250px;
    }

    .result-card {
        flex: 1 1 100% !important;
        min-width: auto !important;
    }
}

@media (max-width: 480px) {
    .circuit-lines {
        display: none;
    }

    .version {
        display: none;
    }
}
