/* STARLIGHT MESSENGER (hub/chat.js) - a friendly window in the old MSN spirit:
   pictures for everyone, a green dot when they are on, Buzz! and winks.
   Sized to the part of the screen you can SEE (the phone's bar and keyboard). */

.cm-wrap { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100vh); z-index: 96; display: grid; place-items: center; padding: 10px;
  background: radial-gradient(90% 70% at 50% 30%, rgba(37,99,235,.42), rgba(8,10,40,.88)); animation: fade-in .25s both; }
.cm-win { position: relative; width: min(980px, 100%); height: min(780px, 100%); display: flex; flex-direction: column; overflow: hidden;
  border-radius: 26px; background: #f0f7ff; color: #0f1d40; border: 5px solid #3b82f6; box-shadow: 0 0 0 4px #0b1a4a, 0 30px 70px rgba(0,0,0,.55);
  font-family: inherit; animation: book-open .45s cubic-bezier(.2,1.3,.4,1) both; }
/* the title bar */
.cm-top { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: #fff; background: linear-gradient(180deg, #4f8ff7, #1d4ed8); border-bottom: 3px solid #1e3a8a; }
.cm-top b { font-size: 19px; line-height: 1.1; }
.cm-top small { display: block; font-size: 12.5px; font-weight: 800; opacity: .9; }
.cm-top .cm-grow { flex: 1; min-width: 0; }
.cm-top .cm-grow > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-x, .cm-back { flex: none; width: 44px; height: 44px; border: none; border-radius: 50%; background: rgba(255,255,255,.2); color: #fff; font: inherit; font-size: 20px; font-weight: 900; cursor: pointer; }
.cm-back { font-size: 26px; }
.cm-logo { font-size: 30px; line-height: 1; }
.cm-buzzbtn { flex: none; border: none; border-radius: 999px; padding: 9px 14px; font: inherit; font-weight: 900; font-size: 15px; color: #422006; background: linear-gradient(180deg, #fde047, #f59e0b); box-shadow: 0 3px 0 #92400e; cursor: pointer; }

/* pictures with a status dot */
.cm-av { position: relative; flex: none; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 30px;
  background: linear-gradient(160deg, #fff, var(--c, #93c5fd)); box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--c, #93c5fd); }
.cm-av.big { width: 64px; height: 64px; font-size: 38px; border-radius: 20px; }
.cm-av.small { width: 40px; height: 40px; font-size: 22px; border-radius: 12px; }
.cm-dot { position: absolute; right: -5px; bottom: -5px; width: 18px; height: 18px; border-radius: 50%; background: #94a3b8; border: 3px solid #fff; }
.cm-dot.on { background: #22c55e; }

/* body area that scrolls */
.cm-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.cm-pad { padding: 16px; }
.cm-note { margin: 10px 14px 0; padding: 9px 12px; border-radius: 14px; font-size: 13px; font-weight: 800; background: #fef3c7; color: #78350f; border: 2px solid #f59e0b; }

/* sign in / codes */
.cm-hello { max-width: 460px; margin: 0 auto; text-align: center; padding: 18px 16px 24px; }
.cm-hello h2 { margin: 6px 0; font-size: 26px; font-weight: 900; color: #1e3a8a; }
.cm-hello p { margin: 6px 0 14px; font-size: 15.5px; font-weight: 700; color: #334e8f; line-height: 1.4; }
.cm-big-emoji { font-size: 64px; line-height: 1; }
.cm-code-in { width: 100%; box-sizing: border-box; text-align: center; font: inherit; font-size: 30px; font-weight: 900; letter-spacing: 4px; text-transform: uppercase;
  padding: 14px 10px; border-radius: 20px; border: 4px solid #93c5fd; background: #fff; color: #1e3a8a; outline: none; }
.cm-code-in:focus { border-color: #3b82f6; box-shadow: 0 0 0 5px rgba(59,130,246,.2); }
.cm-go { display: block; width: 100%; margin-top: 12px; border: none; border-radius: 999px; padding: 15px 18px; font: inherit; font-size: 19px; font-weight: 900; color: #fff;
  background: linear-gradient(180deg, #22c55e, #15803d); box-shadow: 0 5px 0 #14532d; cursor: pointer; }
.cm-go.blue { background: linear-gradient(180deg, #3b82f6, #1d4ed8); box-shadow: 0 5px 0 #1e3a8a; }
.cm-go:disabled { opacity: .55; }
.cm-soft { display: inline-block; margin-top: 14px; border: none; border-radius: 999px; padding: 10px 16px; font: inherit; font-size: 14.5px; font-weight: 900; color: #1e3a8a; background: #dbeafe; cursor: pointer; }
.cm-msg { min-height: 22px; margin-top: 10px; font-size: 15px; font-weight: 800; color: #b91c1c; }
.cm-msg.ok { color: #15803d; }
.cm-line { height: 2px; background: #dbeafe; margin: 20px 0 6px; border-radius: 2px; }
.cm-pin { width: 160px; text-align: center; font: inherit; font-size: 26px; font-weight: 900; letter-spacing: 8px; padding: 10px; border-radius: 16px; border: 3px solid #93c5fd; }
.cm-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 10px 0; }
.cm-chip { display: flex; align-items: center; gap: 8px; border: 3px solid var(--c); border-radius: 999px; padding: 8px 14px 8px 8px; font: inherit; font-weight: 900; font-size: 16px; background: #fff; color: #0f1d40; cursor: pointer; }
.cm-chip span { font-size: 24px; }
.cm-chip.on { background: var(--c); color: #fff; }

.cm-sheet { display: grid; gap: 10px; margin-top: 8px; text-align: left; }
.cm-coderow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px; background: #fff; box-shadow: 0 3px 0 #dbeafe; }
.cm-coderow .who { flex: 1; min-width: 0; }
.cm-coderow .who b { display: block; font-size: 16px; }
.cm-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 22px; font-weight: 900; letter-spacing: 2px; color: #1d4ed8; user-select: all; -webkit-user-select: all; }
.cm-mini { border: none; border-radius: 999px; padding: 8px 12px; font: inherit; font-size: 13px; font-weight: 900; background: #dbeafe; color: #1e3a8a; cursor: pointer; }

/* my code, shown big */
.cm-mycode { display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; border: none; border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12.5px; font-weight: 900; color: #1e3a8a; background: #fff; cursor: pointer; }

/* the contact list */
.cm-list { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.cm-contact { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; border: none; border-radius: 20px; padding: 10px 12px; font: inherit; color: inherit; cursor: pointer;
  background: #fff; box-shadow: 0 3px 0 #dbeafe, 0 6px 14px rgba(30,58,138,.06); }
.cm-contact:active { transform: translateY(2px); box-shadow: 0 1px 0 #dbeafe; }
.cm-contact .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cm-contact .tx b { font-size: 18px; }
.cm-contact .tx small { font-size: 13.5px; font-weight: 700; color: #4b6293; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-contact .tx small.wr { color: #16a34a; font-style: italic; }
.cm-nb { flex: none; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; display: grid; place-items: center; font-size: 14px; font-weight: 900; color: #fff; background: #ef4444; }
.cm-add { margin: 4px 12px 14px; }
.cm-empty { text-align: center; padding: 30px 16px; color: #334e8f; font-weight: 800; }
.cm-empty .cm-big-emoji { margin-bottom: 8px; }

/* a conversation */
.cm-msgs { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 12px 6px; display: flex; flex-direction: column; gap: 6px;
  background: radial-gradient(circle at 20% 10%, rgba(147,197,253,.25), transparent 40%), #f8fbff; }
.cm-day { align-self: center; margin: 8px 0 2px; padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 900; color: #4b6293; background: #e0ecff; }
.cm-row { display: flex; flex-direction: column; max-width: 80%; }
.cm-row.me { align-self: flex-end; align-items: flex-end; }
.cm-row.them { align-self: flex-start; align-items: flex-start; }
.cm-bub { padding: 10px 14px; border-radius: 20px; font-size: 17px; font-weight: 700; line-height: 1.35; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.cm-row.them .cm-bub { background: #fff; color: #0f1d40; border-bottom-left-radius: 6px; box-shadow: 0 2px 0 #dbeafe; }
.cm-row.me .cm-bub { background: linear-gradient(180deg, #3b82f6, #2563eb); color: #fff; border-bottom-right-radius: 6px; }
.cm-bub.jumbo { background: none !important; box-shadow: none !important; font-size: 44px; padding: 0 4px; line-height: 1.15; }
.cm-time { font-size: 11px; font-weight: 800; color: #6b7fae; margin: 2px 6px 0; }
.cm-st { font-size: 12px; font-weight: 900; margin: 1px 6px 0; display: flex; gap: 6px; align-items: center; }
.cm-st.sending { color: #b45309; } .cm-st.sent, .cm-st.got { color: #15803d; } .cm-st.seen { color: #1d4ed8; } .cm-st.failed { color: #dc2626; }
.cm-retry { border: none; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 12px; font-weight: 900; color: #fff; background: #dc2626; cursor: pointer; }
.cm-sticker { width: 120px; height: 120px; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(15,29,64,.2)); }
.cm-pic { display: block; max-width: min(280px, 62vw); max-height: 300px; border-radius: 18px; background: #e0ecff; cursor: zoom-in; box-shadow: 0 3px 10px rgba(15,29,64,.15); }
.cm-pic.drawn { background: #fff; }
.cm-cap { margin-top: 4px; }
.cm-vid { position: relative; display: block; min-width: 180px; min-height: 130px; border: none; padding: 0; border-radius: 18px; overflow: hidden; cursor: pointer;
  background: linear-gradient(160deg, #1e3a8a, #0f172a); }
.cm-vid img.cm-pic { display: block; max-height: 260px; box-shadow: none; }
.cm-vid img.cm-pic:not([src]) { display: none; }
.cm-vid::after { content: "▶"; position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  font-size: 24px; color: #fff; background: rgba(15,29,64,.6); }
.cm-voice { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.cm-play { flex: none; width: 46px; height: 46px; border-radius: 50%; border: none; font-size: 20px; cursor: pointer; background: #fff; color: #2563eb; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.cm-row.them .cm-play { background: #2563eb; color: #fff; }
.cm-wave { flex: 1; display: flex; align-items: center; gap: 3px; height: 30px; }
.cm-wave i { flex: 1; border-radius: 3px; background: currentColor; opacity: .6; height: var(--h); }
.cm-sys { align-self: center; max-width: 90%; text-align: center; padding: 8px 14px; border-radius: 16px; font-size: 14.5px; font-weight: 900; color: #1e3a8a; background: #e0ecff; }
.cm-sys button { margin-left: 6px; border: none; border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12.5px; font-weight: 900; background: #fff; color: #1d4ed8; cursor: pointer; }
.cm-ready { padding: 14px 16px; border-radius: 22px; min-width: 170px; text-align: center; color: #fff; background: linear-gradient(160deg, var(--a), var(--b)); box-shadow: 0 6px 16px rgba(15,29,64,.18); }
.cm-ready .e { font-size: 50px; line-height: 1.1; display: block; }
.cm-ready b { font-size: 19px; }
.cm-race { display: inline-block; margin-top: 8px; padding: 8px 16px; border-radius: 999px; font-weight: 900; color: #fff; text-decoration: none; background: linear-gradient(180deg, #22c55e, #15803d); box-shadow: 0 3px 0 #14532d; }

/* writing */
.cm-typing { flex: none; height: 20px; padding: 0 16px; font-size: 13px; font-weight: 800; font-style: italic; color: #16a34a; }
.cm-tiles { flex: none; display: flex; gap: 8px; padding: 6px 10px 4px; overflow-x: auto; scrollbar-width: none; }
.cm-tiles::-webkit-scrollbar { display: none; }
.cm-tile { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 66px; border: none; border-radius: 18px; padding: 8px 8px 6px; font: inherit; font-size: 12px; font-weight: 900; color: #fff;
  background: linear-gradient(180deg, var(--a), var(--b)); box-shadow: 0 3px 0 var(--d); cursor: pointer; }
.cm-tile span { font-size: 26px; line-height: 1.1; }
.cm-tile.on { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--b); }
.cm-compose { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px 10px; margin: 0; }
.cm-text { flex: 1; min-width: 0; font: inherit; font-size: 17px; font-weight: 700; padding: 12px 16px; border-radius: 999px; border: 3px solid #bfdbfe; background: #fff; color: #0f1d40; outline: none; }
.cm-text:focus { border-color: #3b82f6; }
.cm-send { flex: none; width: 52px; height: 52px; border: none; border-radius: 50%; font-size: 22px; color: #fff; background: linear-gradient(180deg, #3b82f6, #1d4ed8); box-shadow: 0 4px 0 #1e3a8a; cursor: pointer; }
.cm-emo { flex: none; width: 50px; height: 50px; border: none; border-radius: 50%; font-size: 26px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.12); cursor: pointer; }

/* the panels that open above the writing bar */
.cm-panel { flex: none; max-height: 46%; overflow-y: auto; border-top: 3px solid #bfdbfe; background: #fff; padding: 10px; }
.cm-panel[hidden] { display: none !important; }
.cm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.cm-stk { border: none; background: #f0f7ff; border-radius: 16px; padding: 6px; cursor: pointer; aspect-ratio: 1; }
.cm-stk img { width: 100%; height: 100%; object-fit: contain; }
.cm-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cm-card { border: none; border-radius: 18px; padding: 10px; font: inherit; font-weight: 900; font-size: 15px; color: #fff; text-align: center; cursor: pointer;
  background: linear-gradient(160deg, var(--a), var(--b)); box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.cm-card .e { display: block; font-size: 32px; }
.cm-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.cm-sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; background: var(--c); box-shadow: 0 1px 4px rgba(0,0,0,.3); cursor: pointer; }
.cm-sw.on { box-shadow: 0 0 0 3px #1e3a8a; transform: scale(1.1); }
.cm-canvas { display: block; width: 100%; max-height: 52vh; aspect-ratio: 4 / 3; border-radius: 16px; background: #fff; border: 3px solid #bfdbfe; touch-action: none; }
.cm-row2 { display: flex; gap: 8px; margin-top: 8px; }
.cm-row2 > * { flex: 1; }
.cm-rec { display: grid; place-items: center; gap: 8px; padding: 6px 0; text-align: center; }
.cm-recbtn { width: 96px; height: 96px; border-radius: 50%; border: 6px solid #fecaca; background: #ef4444; color: #fff; font-size: 36px; cursor: pointer; box-shadow: 0 5px 0 #991b1b; }
.cm-recbtn.on { animation: badge-pulse 1s infinite; background: #b91c1c; }
.cm-rectime { font-size: 22px; font-weight: 900; color: #b91c1c; font-variant-numeric: tabular-nums; }
.cm-cam { width: 100%; max-height: 40vh; border-radius: 18px; background: #0f1d40; object-fit: cover; }
.cm-preview { max-width: 100%; max-height: 38vh; border-radius: 16px; display: block; margin: 0 auto; }
.cm-progress { height: 8px; border-radius: 99px; background: #dbeafe; overflow: hidden; margin-top: 8px; }
.cm-progress i { display: block; height: 100%; width: var(--p, 0%); background: linear-gradient(90deg, #22c55e, #3b82f6); transition: width .2s; }

/* full-screen look */
.cm-view { position: fixed; inset: 0; z-index: 2147483100; display: grid; place-items: center; padding: 14px; background: rgba(5,8,30,.92); }
.cm-view img, .cm-view video { max-width: 100%; max-height: 88vh; border-radius: 14px; background: #fff; }
.cm-view .cm-x { position: absolute; top: 14px; right: 14px; background: rgba(255,255,255,.25); }

/* a little one: everything bigger */
.cm-win.little .cm-tile { min-width: 84px; font-size: 13px; padding: 10px; }
.cm-win.little .cm-tile span { font-size: 34px; }
.cm-win.little .cm-bub { font-size: 20px; }

@media (max-width: 560px) {
  /* all seven buttons across a phone, no sideways scrolling */
  .cm-tiles { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 6px 6px 4px; }
  .cm-tile { min-width: 0; padding: 6px 2px 5px; border-radius: 14px; font-size: 10px; }
  .cm-tile span { font-size: 22px; }
  .cm-win.little .cm-tile { min-width: 0; padding: 7px 2px; font-size: 10px; }
  .cm-win.little .cm-tile span { font-size: 26px; }
  .cm-wrap { padding: 4px; }
  .cm-win { border-radius: 18px; border-width: 4px; }
  .cm-top { padding: 8px 10px; }
  .cm-top b { font-size: 17px; }
  .cm-av { width: 46px; height: 46px; font-size: 26px; }
  .cm-row { max-width: 88%; }
  .cm-code { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { .cm-win { animation: none !important; } }

/* little Noor floats over everything; in the messenger she would sit on the buttons */
html.chat-open #slnm { display: none !important; }

/* ready to send with one tap (hub/chat.js QUICK) */
.cm-quick { flex: none; display: flex; gap: 6px; padding: 6px 10px 2px; overflow-x: auto; scrollbar-width: none; }
.cm-quick::-webkit-scrollbar { display: none; }
.cm-q { flex: none; display: flex; align-items: center; gap: 6px; border: 3px solid #bfdbfe; border-radius: 999px; padding: 4px 12px 4px 5px; font: inherit; font-size: 14px; font-weight: 900; color: #1e3a8a; background: #fff; cursor: pointer; }
.cm-q img { width: 32px; height: 32px; }
.cm-q:active { transform: scale(.94); }
.cm-win.little .cm-q { font-size: 16px; padding: 5px 14px 5px 6px; }
.cm-win.little .cm-q img { width: 40px; height: 40px; }
.cm-quickmsg { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 16px; border-radius: 22px; background: #fff; box-shadow: 0 3px 0 #dbeafe; color: #1e3a8a; }
.cm-row.me .cm-quickmsg { background: #dbeafe; }
.cm-quickmsg img { width: 72px; height: 72px; filter: drop-shadow(0 4px 6px rgba(15,29,64,.2)); }
.cm-quickmsg .e { font-size: 56px; line-height: 1.1; }
.cm-quickmsg b { font-size: 17px; }
/* on a phone with the keyboard up, the ready row steps aside for the typing */
@media (max-width: 560px) { .cm-q { font-size: 12.5px; padding: 3px 10px 3px 4px; } .cm-q img { width: 28px; height: 28px; } }
.cm-wrap[data-kb] .cm-quick, .cm-wrap[data-kb] .cm-tiles, .cm-wrap[data-kb] .cm-panel { display: none !important; }

/* the family group chat */
.cm-contact.cm-group { background: linear-gradient(135deg, #fff7ed, #fff); box-shadow: 0 3px 0 #fed7aa, 0 6px 14px rgba(245,158,11,.12); }
.cm-faces { font-size: 15px; letter-spacing: 1px; }
.cm-from { font-size: 12.5px; font-weight: 900; margin: 4px 8px 2px; color: color-mix(in srgb, var(--c) 70%, #0f1d40); color: #334e8f; }
