* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: -apple-system, Segoe UI, Roboto, sans-serif; background: #0f1115; color: #e6e8eb; }
.hidden { display: none !important; }
.muted { color: #9aa1aa; }
.error { color: #ff7676; }

/* Login */
body.login { display: grid; place-items: center; }
.login-card { background: #1a1d24; padding: 2rem; border-radius: 12px; min-width: 320px; }
.login-card h1 { margin: 0 0 0.25rem; font-size: 1.4rem; }
.login-card input { width: 100%; padding: 0.8rem; font-size: 1rem; background: #0f1115; color: #fff; border: 1px solid #2a2e36; border-radius: 8px; margin: 1rem 0; }
.login-card button { width: 100%; padding: 0.8rem; font-size: 1rem; background: #3b82f6; color: white; border: 0; border-radius: 8px; cursor: pointer; }

/* App */
body.app { display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; background: #131620; border-bottom: 1px solid #232732; }
.topbar .brand { font-weight: 600; }
.topbar .actions { display: flex; align-items: center; gap: 0.5rem; }
.chip { background: #232732; color: #e6e8eb; border: 0; padding: 0.4rem 0.8rem; border-radius: 999px; cursor: pointer; }
.cost-pill { background: #1b2a1f; color: #9ae6b4; border: 1px solid #2f5a3d; padding: 0.3rem 0.7rem; border-radius: 999px; font-size: 0.78rem; font-family: ui-monospace, SFMono-Regular, monospace; cursor: help; }
.iconbtn { background: transparent; border: 0; color: #e6e8eb; font-size: 1.1rem; cursor: pointer; text-decoration: none; }

.chatlog { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.bubble { background: #1a1d24; padding: 0.75rem 1rem; border-radius: 12px; max-width: 80%; align-self: flex-start; }
.bubble.mine { align-self: flex-end; background: #1d2740; }
.bubble.partial { opacity: 0.7; font-style: italic; }
.bubble .src { font-size: 1.05rem; }
.bubble .dst { font-size: 0.92rem; color: #a8b0bd; margin-top: 0.25rem; }
.bubble .ts { font-size: 0.7rem; color: #6b7280; margin-top: 0.4rem; text-align: right; }

.error-banner { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); background: #5b2129; color: #ffd1d1; padding: 0.7rem 1.2rem; border-radius: 8px; z-index: 10; }

.micbar { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 1rem; background: #131620; border-top: 1px solid #232732; }
.mic { width: 96px; height: 96px; border-radius: 50%; background: #2a2e36; color: #e6e8eb; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.mic.idle { background: #2a2e36; }
.mic.speaking { background: #b53636; animation: pulse 1s infinite; }
.mic.receiving { background: #2649a8; animation: pulse 1.4s infinite; }
.mic-label { font-size: 0.85rem; padding: 0 0.5rem; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 currentColor; } 50% { box-shadow: 0 0 0 14px transparent; } }
#volume { width: 120px; }
.peer-status { width: 120px; font-size: 0.85rem; color: #9aa1aa; text-align: right; }

/* Video panel (chest-mounted phone feed) */
.video-panel { background: #000; border-bottom: 1px solid #232732; display: flex; flex-direction: column; }
.video-panel.hidden { display: none !important; }
.video-panel video { width: 100%; max-height: 38vh; background: #000; object-fit: contain; display: block; }
.video-bar { display: flex; align-items: center; justify-content: space-between; padding: 0.35rem 0.75rem; background: #131620; font-size: 0.78rem; color: #9aa1aa; }
.video-status { letter-spacing: 0.03em; }
.video-rec { color: #ff6b6b; font-weight: 600; font-family: ui-monospace, monospace; }
.video-rec.hidden { display: none; }

/* QR pairing modal */
.qr-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 50; }
.qr-modal.hidden { display: none !important; }
.qr-card { background: #1a1d24; padding: 1.5rem; border-radius: 14px; max-width: 380px; width: 90vw; text-align: center; }
.qr-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }
.qr-canvas { background: #fff; padding: 0.5rem; border-radius: 8px; display: inline-block; image-rendering: pixelated; }
.qr-hint { font-size: 0.85rem; color: #9aa1aa; margin: 0.75rem 0 0.4rem; }
.qr-url { font-size: 0.7rem; color: #6b7280; word-break: break-all; font-family: ui-monospace, monospace; margin-bottom: 1rem; }
.qr-actions { display: flex; justify-content: center; gap: 0.5rem; }
