
:root{
  color-scheme:dark;
  --bg:#020712;--panel:#07111e;--line:#123149;
  --cyan:#69efff;--text:#e7f8fb;--muted:#5e788b
}
*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;background:var(--bg);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;color:var(--text)}
body{overflow:hidden}
button,input{font:inherit}
button{cursor:pointer}

.app-shell{
  height:100dvh;
  max-height:100dvh;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:radial-gradient(circle at 50% 15%,rgba(20,103,144,.17),transparent 31%),linear-gradient(180deg,#020712,#030912);
  padding-top:env(safe-area-inset-top);
  padding-bottom:env(safe-area-inset-bottom)
}

header{flex:0 0 auto;display:flex;justify-content:space-between;align-items:center;padding:12px 14px 4px}
.brand{font-size:27px;font-weight:800;letter-spacing:8px}
.subtitle{font-size:8px;color:#45697e;letter-spacing:1.4px;margin-top:2px}
.icon-btn{border:1px solid var(--line);background:#06111f;color:#92b8ca;width:40px;height:40px;border-radius:13px}

.hero{flex:0 0 auto;text-align:center;padding:2px 12px 5px}
.orb{position:relative;width:155px;height:155px;margin:0 auto;display:grid;place-items:center}
.ring{position:absolute;border-radius:50%}
.ring-a{width:145px;height:145px;border:2px dashed #25bde8;animation:spin 6s linear infinite}
.ring-b{width:112px;height:112px;border:1px solid #315f83;animation:spinReverse 9s linear infinite}
.core{width:82px;height:82px;border-radius:50%;display:grid;place-items:center;border:1px solid #63eeff;background:#071a2d;box-shadow:0 0 34px rgba(47,203,243,.32)}
.core span{font-size:39px;font-weight:300;color:#d8fbff}
.orb.listening .ring-a{border-color:#8affff;animation-duration:1.2s}
.orb.thinking .ring-a{border-color:#9b92ff;animation-duration:1.8s}
.orb.speaking .core{box-shadow:0 0 42px rgba(105,239,255,.55)}
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes spinReverse{to{transform:rotate(-360deg)}}
h1{font-size:19px;margin:1px 0 0}
#stateSub{color:var(--muted);font-size:10px;margin:3px 0 5px}
.status-pill{display:inline-flex;align-items:center;gap:7px;padding:5px 9px;border:1px solid #103249;border-radius:20px;background:#06111f;font-size:9px;color:#8fb4c7;font-weight:700;letter-spacing:.8px}
.dot{width:7px;height:7px;border-radius:50%}
.dot.online{background:#6bffd5}.dot.offline{background:#ff607d}

/* IMPORTANT : vraie zone scrollable */
.chat{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  padding:10px 10px 16px;
  scroll-behavior:smooth
}
.msg{max-width:88%;padding:10px 13px;border:1px solid;border-radius:16px;margin-bottom:10px}
.msg.mia{background:#071726;border-color:#153c55;border-top-left-radius:5px}
.msg.oreo{margin-left:auto;background:#0a2540;border-color:#1a5b82;border-top-right-radius:5px}
.msg-label{font-size:9px;font-weight:800;letter-spacing:1.3px;color:#58ddf5;margin-bottom:4px}
.msg-text{font-size:14px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere}
.msg-attachment{display:flex;gap:8px;align-items:center;margin-top:8px;padding:8px;border:1px solid #17425c;border-radius:10px;background:#06121e}
.msg-attachment img{width:74px;height:74px;object-fit:cover;border-radius:8px}

.attachment-preview{flex:0 0 auto;padding:6px 10px 0;background:#030a14}
.attachment-card{display:flex;align-items:center;gap:10px;border:1px solid #17425c;background:#071726;border-radius:12px;padding:8px}
.attachment-thumb{width:42px;height:42px;border-radius:9px;background:#0a2335;display:grid;place-items:center;font-size:20px;overflow:hidden}
.attachment-thumb img{width:100%;height:100%;object-fit:cover}
.attachment-info{flex:1;min-width:0}
.attachment-info strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px}
.attachment-info span{display:block;color:#66879a;font-size:10px;margin-top:2px}
.remove-attachment{width:32px;height:32px;border:0;border-radius:10px;background:#132331;color:#d6ecf2;font-size:20px}

footer{
  flex:0 0 auto;
  padding:8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top:1px solid #0d2638;
  background:#030a14
}
.voice-btn{width:100%;height:44px;border-radius:14px;border:1px solid #1a7b9b;background:#071b2b;color:#cdf9ff;font-weight:800;letter-spacing:1.7px;margin-bottom:8px}
.voice-btn.recording{border-color:#6ff7ff;background:#10283a}
.composer{display:flex;gap:7px;align-items:center}
.composer input[type="text"],#messageInput{flex:1;min-width:0;height:44px;border-radius:14px;border:1px solid var(--line);background:#07111e;color:var(--text);padding:0 13px;outline:none}
.attach-btn,.send-btn{flex:0 0 auto;width:44px;height:44px;border:0;border-radius:14px;color:#fff}
.attach-btn{background:#102637;border:1px solid #1b536e;font-size:23px;line-height:1}
.send-btn{background:#0b6f93}

dialog{border:0;border-radius:20px;padding:0;background:#07111e;color:var(--text);width:min(92vw,440px)}
dialog::backdrop{background:rgba(0,0,0,.7)}
.settings-card{padding:22px}.settings-card input{width:100%;margin-top:6px;height:44px;border-radius:12px;border:1px solid var(--line);background:#030a14;color:#fff;padding:0 12px}
.settings-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}.settings-actions button{border:0;border-radius:11px;padding:10px 14px;background:#0b6f93;color:#fff}.settings-actions .secondary{background:#122030}.danger-link{margin-top:14px;border:0;background:none;color:#d26d7e}

@media(min-width:700px){
  .app-shell{max-width:640px;margin:auto;border-left:1px solid #0d2638;border-right:1px solid #0d2638}
  .chat{padding-left:18px;padding-right:18px}
}
