* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #0d1117;
    color: #e0e0e0;
    min-height: 100vh;
    -webkit-user-select: none;
    user-select: none;
}
#app {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.header h1 { font-size: 20px; font-weight: 700; }
.badge {
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-off { background: #333; color: #888; }
.badge-lan { background: #2e7d32; color: #fff; }
.badge-wan { background: #e65100; color: #fff; }
.status { font-size: 13px; color: #888; min-height: 20px; }
.controls { display: flex; gap: 8px; }
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    flex: 1;
}
.btn-connect { background: #1976d2; color: #fff; }
.btn-connect:active { background: #1565c0; }
.btn-connected { background: #c62828; color: #fff; }
.btn-connected:active { background: #b71c1c; }
.section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: #161b22;
    border-radius: 12px;
}
.hidden { display: none !important; }
.btn-ptt {
    width: 160px;
    height: 160px;
    box-sizing: border-box;
    padding: 20px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 4px solid #2e7d32;
    background: radial-gradient(circle, #1a3a1a 0%, #0d1117 80%);
    color: #4caf50;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    align-self: center;
    touch-action: none;
    transition: all 0.15s;
}
.ptt-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.btn-ptt div {
    max-width: 120px;
    white-space: normal;
    font-size: 15px;
    line-height: 1.2;
}
.btn-ptt:active, .btn-ptt.recording {
    border-color: #c62828;
    background: radial-gradient(circle, #3a1a1a 0%, #0d1117 80%);
    color: #f44336;
    transform: scale(1.05);
}
.level-bar {
    width: 160px;
    height: 6px;
    background: #222;
    border-radius: 3px;
    overflow: hidden;
    align-self: center;
}
.level-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4caf50, #ff9800, #f44336);
    transition: width 0.1s;
}
.label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #666;
}
.text-box {
    font-size: 14px;
    line-height: 1.5;
    padding: 8px 0;
}
.text-agent { color: #bb86fc; }
.file-controls { display: flex; gap: 8px; }
.btn-file { background: #1565c0; color: #fff; }
.btn-file:active { background: #0d47a1; }
.btn-refresh { background: #222; color: #aaa; }
.btn-refresh:active { background: #333; }
.gallery {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 240px;
    overflow-y: auto;
}
.no-files { color: #666; text-align: center; padding: 12px; font-size: 12px; }
.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #1a1a2e;
    border-radius: 8px;
    font-size: 13px;
}
.file-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    cursor: pointer;
}
.file-icon {
    background: #333;
    color: #888;
    padding: 3px 7px;
    border-radius: 2px;
    font-size: 9px;
    font-weight: 700;
}
.file-info { flex: 1; overflow: hidden; }
.file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-size { color: #666; font-size: 10px; }
.file-actions { display: flex; gap: 4px; }
.btn-file-save, .btn-file-del {
    border: none; border-radius: 3px; padding: 4px 8px;
    font-size: 10px; font-weight: 700; cursor: pointer;
}
.btn-file-save { background: #2e7d32; color: #fff; }
.btn-file-save:active { background: #1b5e20; }
.btn-file-del { background: #c62828; color: #fff; }
.btn-file-del:active { background: #b71c1c; }
.file-img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 8px;
    margin-top: 6px;
}

/* ── Camera / Stream ── */
.btn-cam { font-size: 12px; }
.btn-stream {
    background: transparent;
    color: #1976d2;
    border: 1px solid #1565c0;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    flex: 1;
    transition: all 0.15s;
}
.btn-stream.streaming {
    color: #c62828;
    border-color: #c62828;
    animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.btn-stream:active { background: #1565c0; color: #fff; }
#stream-preview {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: 8px;
    background: #000;
}

/* ── Save Action Menu ── */
.save-menu {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.save-menu-content {
    width: 100%;
    max-width: 480px;
    background: #161b22;
    border-top: 1px solid #333;
    border-radius: 12px 12px 0 0;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.save-menu-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #666;
    letter-spacing: 1.5px;
    text-align: center;
    padding-bottom: 8px;
}
.save-menu-btn {
    padding: 14px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #1a1a2e;
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}
.save-menu-btn:active { background: #333; }
.save-btn-tel { color: #4caf50; border-color: #2e7d32; }
.save-btn-007 { color: #1976d2; border-color: #1565c0; }
.save-btn-share { color: #888; }
.save-btn-cancel { color: #c62828; border: none; background: transparent; font-size: 12px; }
.hidden { display: none !important; }

/* Live PC (capture AIVFL du PC) */
.live-age { font-size: 13px; align-self: center; }
.live-ok { color: #2e7d32; }
.live-stale { color: #c62828; }
.live-img { width: 100%; border-radius: 8px; border: 1px solid #333; background: #000; }
.live-img.live-zoom { position: fixed; inset: 0; width: 100vw; height: 100vh; object-fit: contain; z-index: 1000; border: none; border-radius: 0; }
.live-source { flex: 1; min-width: 0; padding: 8px; border-radius: 8px; background: #111; color: #ddd; border: 1px solid #333; font-size: 14px; }
#live-video.live-img { max-height: none; }

/* 25-11 : le gros bouton parler est remplace par la bulle (permanente, par-dessus toutes les applis) */
#ptt-section { display: none !important; }

/* 28-11 : fil des messages (empiles, plus recents en bas) */
#response { max-height: 55vh; overflow-y: auto; }
.fil-msg { padding: 6px 0; border-bottom: 1px solid rgba(187,134,252,0.18); white-space: pre-wrap; }
.fil-heure { font-size: 0.75em; opacity: 0.6; }
