/* What the real app adds on top of the design (style.css, from the mockups). */

/* first page: room for the agent's copy-prompt button under its name */
.jduo.open { height: 226px; }
.mini-btn { height: 28px; padding: 0 11px; display: flex; align-items: center; gap: 6px; border-radius: 999px; cursor: pointer;
  font-size: var(--fs-caption); font-weight: 600; color: var(--label); background: var(--field); border: 1px solid var(--sep);
  transition: transform var(--med) var(--spring); }
.mini-btn .ico { width: 14px; height: 14px; }
.mini-btn:active { transform: scale(.95); }
.mini-btn:disabled { opacity: .6; }
.prompt-fallback { height: 72px; resize: none; font: 11px/1.4 var(--mono); border-radius: 12px; padding: 8px 10px; border: 1px solid var(--sep); background: var(--field); color: var(--label); }
.prompt-fallback[hidden] { display: none; }
.jroom { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font: inherit; color: var(--label); }
.jpill:focus-within, .jname:focus { box-shadow: 0 0 0 3px rgb(47 107 255 / .25); }
.jerror { margin: 0; padding: 8px 12px; border-radius: 12px; font-size: var(--fs-footnote); color: var(--danger); background: rgb(229 72 77 / .08); }
.jerror[hidden] { display: none; }
.jcard.shake { animation: shake .42s var(--ease); }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
.jbtn:disabled { opacity: .85; }

/* Your rooms: a button top right, a glass list */
.rooms-open { position: fixed; top: 20px; right: 20px; z-index: 5; height: 44px; padding: 0 14px; display: flex; align-items: center; gap: 8px; border-radius: 999px; border: 0; color: var(--label); }
.rooms-open[hidden] { display: none; }
#rooms-count { min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: var(--accent); color: #fff; font-size: var(--fs-caption); font-weight: 700; }
.rooms-dialog { width: min(420px, calc(100vw - 32px)); padding: 14px; border-radius: 24px; color: var(--label); }
.rooms-dialog::backdrop { background: rgb(20 24 40 / .18); backdrop-filter: blur(2px); }
.rooms-head { display: flex; align-items: center; gap: 10px; padding: 2px 2px 10px 8px; }
.rooms-head b { flex: 1; }
.rooms-dialog ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.room-btn { width: 100%; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 12px; border: 0; border-radius: 14px; background: transparent; text-align: left; }
.room-btn:hover { background: var(--fill); }
.room-btn .code { font: 600 var(--fs-subhead) var(--mono); }
.room-btn small { color: var(--label-3); font-size: var(--fs-footnote); }

/* files in a bubble */
.filechip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: var(--fill); border: 0; font: inherit; font-size: var(--fs-subhead); color: inherit; cursor: pointer; }
.group.me .filechip { background: rgb(255 255 255 / .18); }
.filechip small { opacity: .7; }

/* a short message at the top: copied, not sent, reconnecting */
.toast { position: fixed; top: 84px; left: 50%; z-index: 30; transform: translate(-50%, -8px); padding: 8px 14px; border-radius: 999px; font-size: var(--fs-subhead); font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity var(--fast), transform var(--med) var(--spring); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.note:empty { display: none; }

/* the agent panel's views */
.aview[hidden] { display: none !important; }
.gcard .gtext { white-space: pre-wrap; overflow-wrap: anywhere; }
.draft { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto; }
.gnote { margin: 0; font-size: var(--fs-footnote); color: var(--label-2); }
.gcard.busy .gacts { opacity: .5; pointer-events: none; }
.thread:empty::before { content: "Talk to your agent here. Only you two see it; no gates."; font-size: var(--fs-footnote); color: var(--label-3); padding: 2px 4px; }
.offline-note { margin: 0; padding: 8px 10px; border-radius: 12px; font-size: var(--fs-footnote); color: var(--label-2); background: var(--fill); }

/* smaller screens: the panels shrink to their rails and open over the chat */
@media (max-width: 1180px) {
  :root { --lw: calc(var(--edge) * 2 + var(--left-shut)); --rw: calc(var(--edge) * 2 + var(--right-shut)); }
  .panel { z-index: 8; }
}
@media (max-width: 640px) {
  :root { --edge: 8px; --lw: 8px; --rw: 8px; }
  .panel { display: none !important; }
  .head { max-width: calc(100vw - 16px); overflow: hidden; }
  .head .stack, .head .sep { display: none; }
  .jcard { width: calc(100vw - 24px); padding: 22px 18px 20px; }
  .jcol, .jname { width: 150px; } .jname { font-size: var(--fs-subhead); }
  .jcol .av { width: 80px; height: 80px; font-size: 29px; }
  .jduo { height: 160px; } .jduo.open { height: 200px; }
  .jduo.open .jyou { transform: translateX(calc(-50% - 78px)); }
  .jduo.open .jagent { transform: translateX(calc(-50% + 78px)); }
}

/* a colour per person (avatar gradient; the same colour for their quote bar) */
:root { --c0: #e0688a; --c1: #16a37f; --c2: #d9822b; --c3: #3b82c4; --c4: #b0479f; --c5: #6b7a1f; }
.av.c0 { background: linear-gradient(140deg, #f0a35e, #e0688a); }
.av.c1 { background: linear-gradient(140deg, #2bc48a, #16a37f); }
.av.c2 { background: linear-gradient(140deg, #f6c453, #d9822b); }
.av.c3 { background: linear-gradient(140deg, #5ec2f0, #3b82c4); }
.av.c4 { background: linear-gradient(140deg, #e48ad2, #b0479f); }
.av.c5 { background: linear-gradient(140deg, #b7c95a, #6b7a1f); }
.av.more { background: var(--fill-2); color: var(--label-2); font-size: 10px; }
.av.you.empty { background: linear-gradient(140deg, #c9d3f5, #b9b3ef); }
.state.off { color: var(--label-3); }
.state.off::before { background: var(--label-3); }
/* the rail's height follows how many are in the room */
body.left-shut #people { height: var(--rail-h, 188px); top: calc(50% - var(--rail-h, 188px) / 2); }
.bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.group:not(.me) .bubble a { color: var(--accent); }

/* the agent panel: the body scrolls (visible thin bar); the message box sits under it, never over the text */
#agent .abody { scrollbar-width: thin; scrollbar-color: rgb(20 30 60 / .2) transparent; padding-bottom: var(--s2); }
#agent .abody::-webkit-scrollbar { width: 6px; }
#agent .abody::-webkit-scrollbar-thumb { background: rgb(20 30 60 / .2); border-radius: 3px; }
.afoot { padding: 0 var(--s3) var(--s3); }
.afoot[hidden] { display: none; }
body.right-shut #agent .afoot { opacity: 0; pointer-events: none; }
.afoot .tinput { position: static; margin: 0; background: var(--surface); }
/* a long request scrolls inside its card; its buttons always stay in view */
.gcard .gtext, .gcard .draft { max-height: min(38vh, 300px); overflow-y: auto; scrollbar-width: thin; }
.gcard { flex: none; }
/* the owner's initial on the agent's avatar stays inside the panel and the rail */
#agent .atop > .av .owner, #people .av .owner { left: auto; right: -3px; bottom: -3px; }

/* gates stay in view: "Waiting for you" is pinned at the top (scrolls inside itself when long); only the thread scrolls */
#agent .abody { overflow: hidden; }
#agent .atop { position: relative; z-index: 1; }
#v-connect { overflow-y: auto; min-height: 0; }
#v-live { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--s2); }
#a-queue { flex: none; max-height: 62%; overflow-y: auto; scrollbar-width: thin; padding: 2px; margin: -2px; }
#a-thread { flex: 1; min-height: 64px; overflow-y: auto; scrollbar-width: thin; padding-top: 2px;
  -webkit-mask-image: linear-gradient(transparent 0, #000 10px); mask-image: linear-gradient(transparent 0, #000 10px); }
.gcard .gtext, .gcard .draft { max-height: min(28vh, 220px); }

/* presence: green online, amber away, grey offline */
.av .dot.away { background: var(--attention); }
.av .dot.off { background: #b8bdca; }
.prow.off .av { filter: grayscale(.55); opacity: .7; }
.prow.off b { color: var(--label-2); }
.stack .off.av { filter: grayscale(.6); opacity: .5; }
.av.bot .dot { top: -1px; bottom: auto; }
