:root {
  --bg: #0a0612; --panel: #170c28; --violet: #8f3df5; --violet-d: #5b21b6; --orange: #ff6a13;
  --white: #f6f0ff; --dim: #8d7fa6;
  --cut: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--bg); }
body {
  color: var(--white); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1.2px 1.2px at 12% 18%, #ffffff88, transparent), radial-gradient(1px 1px at 63% 8%, #ffffff66, transparent),
    radial-gradient(1.2px 1.2px at 85% 40%, #ffffff77, transparent), radial-gradient(1px 1px at 30% 72%, #ffffff55, transparent),
    radial-gradient(1.2px 1.2px at 72% 88%, #ffffff66, transparent), radial-gradient(1px 1px at 48% 55%, #ffffff44, transparent),
    radial-gradient(800px 420px at 100% 0%, #8f3df533, transparent 60%),
    radial-gradient(700px 400px at 0% 100%, #ff6a1318, transparent 60%), var(--bg);
}
.face { background: url(/capri.webp) 51% 33% / 330% no-repeat #1a0d2e; }

.app { height: 100dvh; display: flex; flex-direction: column; max-width: 820px; margin: 0 auto; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.portrait { display: none; }

/* en-tete */
header {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px 16px;
  background: linear-gradient(180deg, #120a20, #0c0716);
}
header::after { /* eclat orange en diagonale, comme les eclats de l'illustration */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px;
  background: linear-gradient(100deg, var(--orange) 0 22%, var(--violet) 22% 100%);
  clip-path: polygon(0 0, 100% 0, 100% 40%, 24% 100%, 0 100%);
}
.avatar-wrap { position: relative; width: 54px; height: 54px; flex: none; }
#avatar { width: 54px; height: 54px; border-radius: 50%; border: 2px solid var(--orange); box-shadow: 0 0 16px #ff6a1388; }
.dot { position: absolute; right: -1px; bottom: 1px; width: 13px; height: 13px; border-radius: 50%; background: #666; border: 2px solid #0c0716; }
.dot.on { background: #46ff92; box-shadow: 0 0 8px #46ff92; }
.who { flex: 1; min-width: 0; }
.name { font: 900 25px/1 "Arial Black", "Segoe UI Black", Impact, sans-serif; letter-spacing: 3px; color: var(--white); text-shadow: 3px 3px 0 var(--violet); }
.status { font-size: 12px; color: var(--dim); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 42px; height: 42px; flex: none; display: grid; place-items: center; cursor: pointer; color: var(--white); background: #8f3df528; border: 0; clip-path: var(--cut); transition: .12s; }
.icon-btn:hover { background: var(--violet); }
.icon-btn.on { background: var(--orange); color: #1a0900; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#voice .spk { fill: currentColor; stroke: none; }
#voice .wave { display: none; } #voice.on .wave { display: inline; } #voice.on .mute { display: none; }

/* messages */
main { flex: 1; overflow-y: auto; padding: 20px 16px 8px; display: flex; flex-direction: column; gap: 18px; scroll-behavior: smooth; }
main::-webkit-scrollbar { width: 6px; } main::-webkit-scrollbar-thumb { background: var(--violet-d); border-radius: 3px; }
.row { display: flex; gap: 10px; align-items: flex-end; animation: pop .2s ease-out; }
.row.user { justify-content: flex-end; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.mini { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 2px solid var(--orange); background-size: 330%; }
.col { display: flex; flex-direction: column; max-width: 84%; }
.row.user .col { align-items: flex-end; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: 2px; margin: 0 4px 4px; text-transform: uppercase; }
.row.capri .tag { color: var(--orange); } .row.user .tag { color: var(--dim); }
.msg { padding: 11px 16px; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.capri {
  background: linear-gradient(135deg, #25103f, var(--panel)); border-left: 4px solid var(--orange); font-size: 16.5px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
  box-shadow: inset 0 0 30px #8f3df522;
}
.msg.user {
  background: linear-gradient(135deg, #ff7a24, #e8500a); color: #1a0900; font-weight: 500; font-size: 16.5px;
  clip-path: polygon(16px 0, 100% 0, 100% 100%, 0 100%, 0 16px);
}
.msg.err { color: #ffb3a1; border-left-color: #ff3b3b; }
.msg b { color: #ffc29a; } .msg.user b { color: #000; }
.msg code { background: #000000aa; border: 1px solid #8f3df566; padding: 1px 6px; border-radius: 4px; color: #ffb27a; font: 14px ui-monospace, Consolas, monospace; }
.msg pre { margin: 8px 0 2px; padding: 10px 12px; background: #06030c; border: 1px solid #8f3df555; border-left: 3px solid var(--violet); overflow-x: auto; }
.msg pre code { background: none; border: 0; padding: 0; color: #e3d3ff; white-space: pre; }
.open-btn { display: inline-block; margin-top: 8px; padding: 8px 16px; background: var(--orange); color: #1a0900; font-weight: 700; text-decoration: none; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px)); }
.time { font-size: 11px; color: var(--dim); margin: 4px 4px 0; }
.typing { display: inline-flex; gap: 6px; padding: 6px 2px; }
.typing i { width: 10px; height: 10px; background: var(--orange); transform: rotate(45deg); animation: bounce 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; background: var(--violet); } .typing i:nth-child(3) { animation-delay: .3s; background: var(--white); }
@keyframes bounce { 0%, 60%, 100% { opacity: .3; transform: rotate(45deg) scale(.8); } 30% { opacity: 1; transform: rotate(45deg) scale(1.15); } }
.cursor::after { content: "▌"; color: var(--orange); margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* suggestions */
.chips { display: flex; gap: 8px; padding: 4px 16px 10px; overflow-x: auto; scrollbar-width: none; }
.chips:empty { display: none; } .chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 9px 16px; font: 600 13.5px system-ui, sans-serif; color: var(--white); cursor: pointer; background: #8f3df533; border: 0; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px)); transition: .12s; }
.chip:hover { background: var(--orange); color: #1a0900; }

/* saisie */
form { padding: 8px 14px 16px; }
.composer { display: flex; align-items: flex-end; gap: 4px; padding: 6px 6px 6px 18px; background: #140a24; border: 2px solid #8f3df5; border-left: 5px solid var(--orange); clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px)); transition: .15s; }
.composer:focus-within { background: #1b0e30; border-color: var(--orange); border-left-color: var(--orange); }
textarea { flex: 1; resize: none; max-height: 140px; background: none; border: 0; color: var(--white); font: inherit; font-size: 16.5px; padding: 9px 0; outline: none; }
textarea::placeholder { color: var(--dim); }
.round { width: 44px; height: 44px; flex: none; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--orange); color: #1a0900; clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 11px 100%, 0 calc(100% - 11px)); transition: .12s; }
.round:hover { background: #ff8a45; }
.round.ghost { background: none; color: var(--dim); } .round.ghost:hover { background: none; color: var(--white); }
.round.rec { background: #ff2b4d; color: #fff; animation: blink 1s steps(2) infinite; }
.round:disabled { opacity: .35; cursor: default; }

/* grand ecran : portrait a gauche, chat a droite */
@media (min-width: 900px) {
  .app { max-width: none; display: grid; grid-template-columns: minmax(340px, 42%) 1fr; grid-template-rows: auto 1fr auto auto; padding: 0; }
  .portrait { display: block; grid-column: 1; grid-row: 1 / 5; position: relative; overflow: hidden; border-right: 4px solid var(--orange); }
  .art { position: absolute; inset: 0; background: url(/capri.webp) 50% 30% / cover no-repeat; }
  .portrait::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, #0a0612ee 100%); }
  .caption { position: absolute; left: 28px; bottom: 26px; z-index: 2; }
  .big { font: 900 clamp(44px, 6vw, 84px)/0.95 "Arial Black", "Segoe UI Black", Impact, sans-serif; letter-spacing: 4px; text-shadow: 5px 5px 0 var(--violet); }
  .tagline { margin-top: 8px; font-size: 14px; font-weight: 700; letter-spacing: 5px; text-transform: uppercase; color: var(--orange); }
  header, main, .chips, form { grid-column: 2; }
  header { grid-row: 1; padding: 16px 28px 20px; }
  header .avatar-wrap, header .name { display: none; }
  .status { margin: 0; font-size: 13px; }
  main { grid-row: 2; padding: 24px 28px 8px; }
  .chips { grid-row: 3; padding: 4px 28px 10px; }
  form { grid-row: 4; padding: 8px 28px 22px; }
  .col { max-width: 72%; }
}
