:root { --anon-blue: #2563eb; --anon-ink: #122047; --anon-muted: #7a8497; --anon-line: #e8edf7; --anon-green: #20bf78; }
.anonymous-chat { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 16px; background: rgba(226, 234, 249, .72); backdrop-filter: blur(11px); direction: rtl; }
.anonymous-chat.is-open { display: grid; animation: anon-fade .28s ease both; }
.anonymous-chat__phone { width: min(100%, 450px); min-height: min(860px, calc(100vh - 32px)); position: relative; display: grid; grid-template-rows: auto 1fr; overflow: hidden; border: 1px solid rgba(255,255,255,.9); border-radius: 30px; background: linear-gradient(155deg,#fff 0%,#f7faff 100%); box-shadow: 0 35px 90px rgba(39,66,120,.22); }
.anonymous-chat__header { min-height: 78px; display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; padding: 10px 22px; direction: ltr; }
.anonymous-chat.is-chatting .anonymous-chat__header { min-height: 96px; }
.anonymous-chat__back,.anonymous-chat__report-link { border: 0; background: transparent; color: var(--anon-ink); font: inherit; font-size: 1.6rem; cursor: pointer; }.anonymous-chat__back { width:44px; height:42px; display:grid; place-items:center; border:1px solid #c7dcff; border-radius:13px; color:#1d68e9; background:linear-gradient(145deg,#fff,#edf5ff); box-shadow:0 8px 18px rgba(35,103,232,.16); }.anonymous-chat__back svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round}.anonymous-chat__report-link { color:#ef6b6b; font-size:.84rem; font-weight:800; direction:rtl; }.anonymous-chat__brand { justify-self: center; display:flex; gap:8px; align-items:center; color:var(--anon-ink); text-decoration:none; direction:ltr; }.anonymous-chat__brand-copy{display:grid;gap:2px;min-width:0}.anonymous-chat__brand-copy strong{font-size:1.06rem}.anonymous-chat__brand-copy small{display:none;max-width:205px;color:#76849b;font-size:.52rem;font-weight:600;line-height:1.55;text-align:center;direction:rtl}.anonymous-chat.is-chatting .anonymous-chat__brand-copy small{display:block}.anonymous-chat__logo { width:32px; height:32px; display:grid; place-items:center; color:#fff; border-radius:11px 11px 11px 3px; background:linear-gradient(140deg,#46d3f6 0 23%,#2769eb 24% 74%,#6658e9 75%); font-weight:950; transform:rotate(-10deg); }
.anonymous-chat__content { min-height:0; overflow:auto; padding: 8px 25px 26px; scrollbar-width:none; }.anonymous-chat__content::-webkit-scrollbar{display:none}.anon-screen { display:none; min-height:100%; text-align:center; }.anon-screen.is-active { display:flex; flex-direction:column; align-items:stretch; animation:anon-rise .42s cubic-bezier(.2,.9,.25,1) both; }.anon-screen h1 { margin:12px 0 6px; color:var(--anon-ink); font-size:1.26rem; line-height:1.8; }.anon-subtitle { margin:0 0 20px; color:#66728a; font-size:.86rem; line-height:1.9; }.anon-intro-icon { width:100px; height:92px; position:relative; display:grid; place-items:center; margin:10px auto 7px; border-radius:32px; background:radial-gradient(circle at 35% 25%,#f5e7ff,#d5c1ff); box-shadow:0 18px 28px rgba(132,92,225,.2); font-size:3.6rem; transform:rotate(-5deg); }.anon-intro-icon span { position:absolute; top:-4px; right:-14px; display:grid; place-items:center; width:29px; height:29px; border-radius:50%; color:#3876ee; background:#dceaff; font-size:15px; transform:rotate(5deg); }
.anon-form { display:grid; gap:10px; text-align:right; }.anon-form label,.anon-topics legend { color:#4c5770; font-size:.77rem; font-weight:800; }.anon-form label span,.anon-topics legend span { color:#eb5d5d; }.anon-form small { color:#a5adbb; font-weight:500; }.anon-form input,.anon-form select,.anon-screen textarea { width:100%; min-height:47px; margin-top:6px; border:1px solid var(--anon-line); border-radius:13px; padding:0 15px; outline:0; color:var(--anon-ink); background:rgba(255,255,255,.82); box-shadow:0 4px 12px rgba(32,65,128,.025); font:inherit; font-size:.84rem; transition:border .2s,box-shadow .2s; }.anon-form input:focus,.anon-form select:focus,.anon-screen textarea:focus { border-color:var(--anon-blue); box-shadow:0 0 0 4px rgba(37,99,235,.1); }.anon-topics { min-width:0; margin:1px 0 0; padding:0; border:0; }.anon-topics legend { margin-bottom:8px; }.anon-topics button { min-height:33px; margin:0 0 7px 5px; border:1px solid #e5ebf6; border-radius:10px; padding:0 9px; color:#506078; background:#fff; font:inherit; font-size:.72rem; cursor:pointer; }.anon-topics button.is-selected,.anon-filter-grid button.is-selected { border-color:#acc9ff; color:var(--anon-blue); background:#ecf4ff; box-shadow:0 7px 14px rgba(37,99,235,.1); }.anon-form-error { min-height:0; margin:0; color:#df4b4b; font-size:.76rem; font-weight:700; }.anon-primary,.anon-secondary { min-height:48px; border:0; border-radius:14px; color:#fff; background:linear-gradient(135deg,#337cff,#2161e8); box-shadow:0 14px 24px rgba(37,99,235,.25); font:inherit; font-size:.9rem; font-weight:850; cursor:pointer; }.anon-primary span { margin-left:5px; font-size:1.25rem; vertical-align:-2px; }.anon-text-button,.anon-online-link { border:0; margin:13px auto 0; color:#5e6e86; background:transparent; font:inherit; font-size:.75rem; cursor:pointer; }.anon-online-link { color:var(--anon-blue); font-weight:850; }.anon-online-link span { display:inline-block; border-radius:6px; padding:2px 5px; color:#d58b00; background:#fff3d5; font-size:.54rem; }
.anon-filter-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin:12px 0 22px; }.anon-filter-grid button { min-height:88px; display:grid; place-items:center; gap:2px; border:1px solid var(--anon-line); border-radius:14px; color:#1d315c; background:rgba(255,255,255,.85); box-shadow:0 8px 18px rgba(29,55,108,.04); font:inherit; font-size:1.45rem; cursor:pointer; }.anon-filter-grid b{font-size:.68rem}
.anon-search-screen { justify-content:center; }.anon-search-orbit { width:242px; height:242px; position:relative; display:grid; place-items:center; margin:0 auto 16px; border:1px solid rgba(134,174,255,.25); border-radius:50%; background:radial-gradient(circle,rgba(217,232,255,.9),rgba(245,249,255,.2) 67%); }.anon-search-orbit::before,.anon-search-orbit::after { content:""; position:absolute; inset:18px; border:1px solid rgba(104,157,249,.18); border-radius:50%; }.anon-search-orbit::after { inset:48px; }.anon-magnifier { z-index:1; width:82px; height:82px; display:grid; place-items:center; border-radius:50%; color:#fff; background:linear-gradient(135deg,#69a1ff,#2b6dec); box-shadow:0 0 0 14px rgba(104,159,255,.1),0 16px 28px rgba(38,102,230,.28); font-size:4rem; line-height:.9; transform:rotate(-20deg); animation:anon-pulse 1.8s ease-in-out infinite; }.anon-orbit { position:absolute; inset:0; animation:anon-orbit 13s linear infinite; }.anon-orbit i { width:37px; height:37px; position:absolute; display:grid; place-items:center; border:3px solid #fff; border-radius:50%; background:#e8f1ff; box-shadow:0 7px 16px rgba(51,85,143,.18); font-style:normal; font-size:20px; }.anon-orbit i:nth-child(1){top:4px;left:50%;transform:translateX(-50%)}.anon-orbit i:nth-child(2){top:30px;left:18px}.anon-orbit i:nth-child(3){bottom:25px;left:25px}.anon-orbit i:nth-child(4){right:10px;bottom:42px}.anon-orbit i:nth-child(5){right:19px;top:30px}.anon-stats { display:grid; grid-template-columns:1fr 1fr; margin:28px 0 16px; overflow:hidden; border:1px solid #edf1f8; border-radius:15px; background:rgba(255,255,255,.76); box-shadow:0 10px 22px rgba(30,60,112,.06); }.anon-stats div { display:grid; gap:5px; padding:12px; }.anon-stats div+div { border-right:1px solid #edf1f8; }.anon-stats small { color:#9aa3b2; font-size:.67rem; }.anon-stats strong { color:var(--anon-ink); font-size:.91rem; }.anon-stats em { display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--anon-green); }.anon-secondary { width:100%; border:1px solid #bdd1f7; color:var(--anon-blue); background:#fff; box-shadow:none; }
.anon-connected-screen { justify-content:center; }.anon-connected-check { width:42px; height:42px; display:grid; place-items:center; margin:0 auto 6px; border-radius:50%; color:#fff; background:var(--anon-green); box-shadow:0 12px 23px rgba(32,191,120,.25); font-size:1.45rem; }.anon-match-name { margin:0; color:#1f315a; font-size:.95rem; font-weight:900; }.anon-security { margin:16px 0 18px; border-radius:12px; padding:12px; color:#708099; background:#f1f5fc; font-size:.72rem; line-height:1.8; }.anon-person-avatar { width:92px; height:92px; position:relative; display:grid; place-items:center; margin:auto; border-radius:50%; background:linear-gradient(145deg,#d9e9ff,#8ebaff); box-shadow:0 16px 30px rgba(52,100,191,.2); font-size:4.3rem; }.anon-person-avatar i { width:13px; height:13px; position:absolute; left:5px; bottom:9px; border:2px solid #fff; border-radius:50%; background:var(--anon-green); }.anon-person-avatar.small { width:53px;height:53px;margin:0;font-size:2.35rem;box-shadow:none }.anon-person-avatar.tiny { width:42px;height:42px;margin:0;font-size:1.9rem;box-shadow:none }.anon-person-avatar.tiny i{width:9px;height:9px;left:2px;bottom:3px}
.anon-chat-screen { min-height:100%; }.anon-chat-person { display:flex; align-items:center; gap:10px; min-height:73px; border-bottom:1px solid var(--anon-line); padding:0 0 12px; text-align:right; }.anon-chat-person h2 { margin:0; color:#172750; font-size:.9rem; }.anon-chat-person p { margin:4px 0 0; color:var(--anon-green); font-size:.68rem; }.anon-chat-person button { margin-right:auto; border:0; color:#486081; background:transparent; font-size:1.7rem; cursor:pointer; }.anon-messages { flex:1; display:flex; flex-direction:column; gap:12px; overflow:auto; padding:20px 0 8px; text-align:right; }.anon-bubble { max-width:78%; align-self:flex-end; border-radius:15px 15px 4px 15px; padding:10px 12px 7px; color:#28334a; background:#fff; box-shadow:0 7px 14px rgba(36,55,92,.09); animation:anon-rise .3s ease both; }.anon-bubble.mine { align-self:flex-start; border-radius:15px 15px 15px 4px; color:#fff; background:linear-gradient(135deg,#3480ff,#2862e3); box-shadow:0 9px 18px rgba(37,99,235,.2); }.anon-bubble p { margin:0; font-size:.84rem; line-height:1.7; }.anon-bubble small { display:block; margin-top:3px; opacity:.68; font-size:.56rem; direction:ltr; text-align:left; }.anon-typing { display:none; align-self:flex-end; width:54px; gap:4px; align-items:center; margin:0 0 8px; border-radius:15px; padding:11px; background:#fff; box-shadow:0 7px 14px rgba(36,55,92,.09); }.anon-typing.is-visible{display:flex}.anon-typing span { width:6px;height:6px;border-radius:50%;background:#95a8ca;animation:anon-dot 1s infinite}.anon-typing span:nth-child(2){animation-delay:.15s}.anon-typing span:nth-child(3){animation-delay:.3s}.anon-composer { display:grid; grid-template-columns:40px 1fr 43px; gap:8px; align-items:center; padding-top:12px; border-top:1px solid var(--anon-line); direction:ltr; }.anon-composer input { min-width:0; height:42px; border:1px solid #e8edf6; border-radius:21px; padding:0 13px; outline:0; direction:rtl; font:inherit; font-size:.76rem; }.anon-attach,.anon-send { width:40px;height:40px; border:1px solid #b5cef9; border-radius:50%; color:var(--anon-blue); background:#fff; font-size:1.4rem; cursor:pointer; }.anon-send { color:#fff; border:0; background:linear-gradient(135deg,#3b83ff,#2262e7); font-size:1rem; box-shadow:0 8px 16px rgba(37,99,235,.23); }
.anon-ended-screen { justify-content:center; }.anon-ended-icon { width:110px;height:100px;position:relative;display:grid;place-items:center;margin:0 auto 14px;border-radius:34px;color:#8964e9;background:#f0eaff;font-size:3.8rem; }.anon-ended-icon b { position:absolute; right:14px; color:#8f68e6; font-size:2.3rem; }.anon-split-buttons { display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:13px}.anon-split-buttons button { min-height:44px;border:1px solid var(--anon-line);border-radius:12px;color:#3d4d6a;background:#fff;font:inherit;font-size:.73rem;font-weight:800;cursor:pointer}.anon-rating-icon,.anon-report-icon { margin:24px auto 4px;font-size:5rem;animation:anon-bounce 1.2s ease-in-out infinite}.anon-stars { display:flex;justify-content:center;gap:8px;margin:14px 0 20px;direction:ltr}.anon-stars button { border:0;color:#dfe4ee;background:transparent;font-size:2.4rem;cursor:pointer;transition:transform .2s,color .2s}.anon-stars button.is-selected{color:#ffbf32;transform:scale(1.12)}.anon-screen textarea{min-height:86px;resize:none;padding:12px;margin:0 0 16px}.anon-report-options { display:grid;gap:8px;margin:14px 0 22px;text-align:right}.anon-report-options label { display:flex;align-items:center;gap:10px;min-height:43px;border:1px solid var(--anon-line);border-radius:11px;padding:0 13px;color:#43506b;background:#fff;font-size:.78rem;cursor:pointer}.anon-report-options input{accent-color:var(--anon-blue)}
.anon-list-title { display:flex;align-items:center;justify-content:space-between }.anon-list-title span { border-radius:10px;padding:5px 9px;color:#fff;background:var(--anon-green);font-size:.66rem;font-weight:800}.anon-online-list { display:grid;gap:8px;margin:9px 0 18px;text-align:right}.anon-online-list article { display:flex;align-items:center;gap:9px;min-height:58px;border-bottom:1px solid #eef1f7;padding:6px 0}.anon-online-list strong,.anon-online-list small{display:block}.anon-online-list strong{color:#26345c;font-size:.76rem}.anon-online-list small{margin-top:4px;color:#8994a6;font-size:.62rem}.anon-online-list article button { width:31px;height:31px;margin-right:auto;border:1px solid #d7e3f8;border-radius:50%;color:var(--anon-blue);background:#fff;cursor:pointer}
.anon-sheet-backdrop { position:absolute;inset:0;display:none;background:rgba(17,28,54,.25); }.anon-attachment-sheet { position:absolute;right:0;bottom:0;left:0;z-index:2;display:none;border-radius:25px 25px 0 0;padding:10px 20px 24px;background:rgba(255,255,255,.98);box-shadow:0 -18px 45px rgba(23,47,88,.15);}.anonymous-chat.sheet-open .anon-sheet-backdrop,.anonymous-chat.sheet-open .anon-attachment-sheet{display:block}.anonymous-chat.sheet-open .anon-attachment-sheet{animation:anon-sheet .32s ease both}.anon-sheet-handle { width:40px;height:4px;margin:0 auto 15px;border-radius:10px;background:#d8deea}.anon-attachment-grid { display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.anon-attachment-grid button { min-height:73px;display:grid;place-items:center;gap:3px;border:1px solid #edf0f6;border-radius:14px;color:#43506b;background:linear-gradient(145deg,#fff,#f5f8fe);font:inherit;font-size:.67rem;font-weight:750;box-shadow:0 8px 14px rgba(42,67,112,.05);cursor:pointer}.anon-attachment-grid span{font-size:1.5rem}.anon-attachment-grid small{color:#a9b0bd;font-size:.54rem}.anon-attachment-grid button:disabled{opacity:.5;cursor:default}.anon-file-input{display:none}.anon-notice{position:absolute;right:20px;bottom:24px;left:20px;z-index:5;display:none;border-radius:13px;padding:12px 14px;color:#fff;background:#1d315c;box-shadow:0 14px 30px rgba(22,44,87,.25);text-align:center;font-size:.76rem}.anon-notice.is-visible{display:block;animation:anon-rise .25s ease both}
@keyframes anon-fade{from{opacity:0}to{opacity:1}}@keyframes anon-rise{from{opacity:0;transform:translateY(11px) scale(.985)}to{opacity:1;transform:none}}@keyframes anon-pulse{50%{transform:rotate(-20deg) scale(1.08)}}@keyframes anon-orbit{to{transform:rotate(360deg)}}@keyframes anon-dot{50%{transform:translateY(-4px);opacity:.45}}@keyframes anon-bounce{50%{transform:translateY(-6px) scale(1.06)}}@keyframes anon-sheet{from{transform:translateY(100%)}to{transform:none}}
@media (max-width:520px){.anonymous-chat{padding:0}.anonymous-chat__phone{width:100%;min-height:100vh;border:0;border-radius:0}.anonymous-chat__content{padding-right:20px;padding-left:20px}}@media (max-height:720px){.anonymous-chat__header{min-height:62px;padding-top:9px;padding-bottom:9px}.anon-intro-icon{width:75px;height:66px;margin-top:0;font-size:2.7rem}.anon-form{gap:6px}.anon-form input,.anon-form select{min-height:40px}.anon-topics button{margin-bottom:4px}.anon-online-link{margin-top:7px}}

/* Wide displays use a two-zone chat workspace; the phone layout above remains the mobile design. */
@media (min-width:900px){
  .anonymous-chat{padding:34px}.anonymous-chat__phone{width:min(1120px,calc(100% - 68px));min-height:min(820px,calc(100vh - 68px));display:block;border-radius:34px;background:linear-gradient(112deg,#edf4ff 0 41%,#fff 41%);}.anonymous-chat__phone::before{content:"Uniar\A چت ناشناس، امن و بدون نمایش هویت";white-space:pre-line;position:absolute;top:138px;left:48px;width:300px;color:#163a78;font-size:1.65rem;font-weight:900;line-height:2.1;z-index:0}.anonymous-chat__phone::after{content:"";position:absolute;left:70px;bottom:85px;width:250px;height:250px;border:18px solid rgba(67,128,244,.12);border-radius:50%;box-shadow:0 0 0 35px rgba(67,128,244,.055),0 0 0 75px rgba(67,128,244,.025)}.anonymous-chat__header{position:absolute;z-index:2;top:0;right:0;left:0;min-height:84px;padding:18px 40px;border-bottom:1px solid rgba(226,233,246,.72);}.anonymous-chat__content{width:56%;height:calc(100% - 84px);position:absolute;z-index:1;top:84px;right:0;padding:20px 44px 34px;}.anon-screen{justify-content:center}.anon-screen[data-anon-screen="form"],.anon-screen[data-anon-screen="filters"],.anon-screen[data-anon-screen="online-list"]{justify-content:flex-start}.anon-intro-icon{margin-top:0}.anon-form{max-width:560px;margin:0 auto}.anon-filter-grid{max-width:560px;margin-right:auto;margin-left:auto}.anon-search-orbit{width:260px;height:260px}.anon-stats,.anon-secondary{max-width:520px;margin-right:auto;margin-left:auto}.anon-chat-screen{height:100%}.anon-chat-person{min-height:64px}.anon-attachment-sheet{right:auto;left:0;width:56%;border-radius:25px 0 0 0}.anon-sheet-backdrop{right:auto;left:0;width:56%}.anon-notice{right:auto;left:24px;width:calc(56% - 48px)}
}

/* Select fields in the anonymous-chat form follow the same premium input language. */
.anon-form select {
  appearance: none;
  cursor: pointer;
  padding-left: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='m2 2 6 6 6-6' fill='none' stroke='%232563eb' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 15px center;
  background-size: 16px 10px;
}

.anon-form select:invalid {
  color: #9ba5b6;
}

.anon-form select option {
  color: var(--anon-ink);
  background: #fff;
}

@media (min-width:900px) {
  .anonymous-chat__phone::after {
    content: "🕶️";
    display: grid;
    place-items: center;
    font-size: 5.7rem;
    filter: drop-shadow(0 18px 17px rgba(40,83,164,.2));
  }
}
/* Keep the message viewport stable so sent and received bubbles are always visible. */
.anon-chat-screen { min-width: 0; }
.anon-messages { min-height: 0; overscroll-behavior: contain; }
/* Reliable message viewport on large screens and explicit, readable bubbles. */
.anon-chat-screen.is-active { min-height: 0; height: 100%; }
.anon-messages { display: flex !important; min-height: 120px; }
.anon-messages .anon-bubble { display: block !important; visibility: visible !important; flex: 0 0 auto; }
/* Anonymous chat intentionally follows the proven classmates-chat layout. */
.anon-chat-screen.is-active { overflow: hidden; border: 1px solid #eaf0fa; border-radius: 20px; padding: 0 18px 5px; background: #fff; box-shadow: 0 14px 32px rgba(35,69,132,.06); }
.anon-chat-person { display: grid; grid-template-columns: 53px 1fr auto; gap: 10px; min-height: 64px; padding: 0 0 10px; background: #fff; }
.anon-chat-person .anon-person-avatar.small { width: 45px; height: 45px; font-size: 1.9rem; }
.anon-chat-person h2 { font-size: .78rem; }.anon-chat-person p { font-size: .62rem; }.anon-chat-person p.is-typing { color:#2d72ee; font-weight:800; }
.anon-end-chat { min-height:34px; border:1px solid #a9c5f9 !important; border-radius:10px; padding:0 11px; color:#2d6de8 !important; background:#fff !important; font-size:.67rem !important; font-weight:800; }
.anon-messages { gap: 10px !important; padding: 15px 0 !important; background: #fff; }
.anon-bubble { max-width: 76% !important; align-self: flex-end; border: 1px solid #edf1f7; border-radius: 15px 15px 4px 15px !important; padding: 9px 10px 7px !important; color: #243a62 !important; background: #f7f9fc !important; box-shadow: 0 5px 12px rgba(33,54,94,.04) !important; font-weight: 600; }
.anon-bubble.mine { align-self: flex-start; border: 0; border-radius: 15px 15px 15px 4px !important; color: #fff !important; background: linear-gradient(135deg,#4385fb,#2868e9) !important; box-shadow: 0 8px 18px rgba(38,99,230,.19) !important; }
.anon-composer { grid-template-columns: 39px 1fr 39px !important; padding: 10px 0 2px !important; background: #fff; }
.anon-composer input { height: 39px !important; border-color: #dfe8f5 !important; border-radius: 20px !important; background: #fff !important; font-size: .67rem !important; }
.anon-attach,.anon-send { width:38px !important; height:38px !important; font-size:1rem !important; }
@media (max-width: 520px) { .anon-chat-screen.is-active { border-right:0; border-left:0; border-radius:0; box-shadow:none; } }

/* Keep the anonymous-chat header as clean and aligned as the main site header. */
.anonymous-chat__brand-copy strong .brand-initial { color:#2473ef; font-size:1.15em; text-shadow:0 3px 8px rgba(36,115,239,.18); }
.anonymous-chat__safety { display:none; color:#76849b; font-size:.52rem; font-weight:600; line-height:1.35; text-align:center; direction:rtl; }
.anonymous-chat.is-chatting .anonymous-chat__safety { display:block; }
@media (max-width:520px) {
  .anonymous-chat__header { position:relative; grid-template-columns:54px 1fr 54px; grid-template-rows:42px 22px; min-height:82px; padding:10px 20px 7px; }
  .anonymous-chat.is-chatting .anonymous-chat__header { min-height:82px; }
  .anonymous-chat__brand { position:absolute; top:11px; left:50%; z-index:1; justify-self:auto; align-self:auto; gap:8px; min-width:0; transform:translateX(-50%); }
  .anonymous-chat__logo { width:32px; height:32px; flex:0 0 32px; }
  .anonymous-chat__brand-copy { display:block; min-width:0; }
  .anonymous-chat__brand-copy strong { display:block; padding-top:5px; line-height:1; font-size:1.08rem; white-space:nowrap; }
  .anonymous-chat.is-chatting .anonymous-chat__safety { position:static; grid-column:1 / -1; grid-row:2; align-self:center; justify-self:center; display:block; max-width:100%; overflow:hidden; color:#76849b; font-size:.5rem; line-height:1; white-space:nowrap; text-align:center; }
  .anonymous-chat__back { grid-column:1; grid-row:1; justify-self:start; }
  .anonymous-chat__report-link { grid-column:3; grid-row:1; justify-self:end; align-self:center; padding:0; white-space:nowrap; }
  .anonymous-chat.is-chatting .anonymous-chat__report-link { visibility:visible !important; }
}

/* The desktop workspace has its own explanatory panel on the left, so the
   compact safety note is only shown in the mobile header. */
@media (min-width:521px) {
  .anonymous-chat.is-chatting .anonymous-chat__safety { display:none; }
}

/* On mobile browsers the visual viewport shrinks above the soft keyboard.
   Keep the active chat and composer inside that visible area. */
@media (max-width:520px) {
  .anonymous-chat.is-open {
    height: var(--anon-visual-height, 100dvh);
    min-height: 0;
    align-items: stretch;
  }
  .anonymous-chat__phone {
    height: var(--anon-visual-height, 100dvh);
    min-height: 0;
    max-height: var(--anon-visual-height, 100dvh);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .anonymous-chat__content { min-height: 0; overflow: hidden; }
  .anon-chat-screen.is-active {
    height: 100%;
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
  }
  .anon-messages { flex: 1 1 auto; min-height: 0; }
  .anon-composer {
    flex: 0 0 auto;
    margin-top: auto;
    padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
  }
}
@media (min-width:900px) {
  .anonymous-chat__header { grid-template-columns:54px 1fr 76px; }
  .anonymous-chat__back { grid-column:1; grid-row:1; justify-self:start; }
  .anonymous-chat__brand { grid-column:2; grid-row:1; justify-self:center; }
  .anonymous-chat__report-link { grid-column:3; grid-row:1; justify-self:end; align-self:center; }

  .anon-chat-screen.is-active {
    margin:8px 0 12px;
    border:1px solid #dfeafb;
    border-radius:24px;
    padding:14px 20px 16px;
    background:linear-gradient(145deg,#ffffff 0%,#f7faff 100%);
    box-shadow:0 20px 42px rgba(35,78,150,.12), inset 0 1px 0 rgba(255,255,255,.95);
  }
  .anon-chat-person {
    margin:0;
    border:1px solid #e2ebfb;
    border-radius:16px;
    padding:11px 14px;
    background:#fff;
    box-shadow:0 9px 22px rgba(44,81,142,.07);
  }
  .anon-messages {
    margin-top:12px;
    border:1px solid #edf2fa;
    border-radius:17px;
    padding:18px !important;
    background:radial-gradient(circle at 100% 0,rgba(218,233,255,.52),transparent 31%),#fff;
    box-shadow:inset 0 1px 2px rgba(45,77,131,.035);
  }
  .anon-composer { margin-top:10px; }
}

@media (max-width:520px) {
  .anon-chat-screen.is-active {
    margin:4px -20px 0;
    padding:10px 14px 12px;
    border:0;
    border-radius:0;
    background:linear-gradient(155deg,#f7faff,#fff);
  }
  .anon-chat-person {
    margin:0;
    border:1px solid #e0eafa;
    border-radius:16px;
    padding:10px 11px;
    background:#fff;
    box-shadow:0 8px 20px rgba(42,79,142,.08);
  }
  .anon-messages {
    margin:10px 0;
    border:1px solid #edf2fa;
    border-radius:16px;
    padding:14px !important;
    background:radial-gradient(circle at 100% 0,rgba(223,236,255,.45),transparent 34%),#fff;
    box-shadow:inset 0 1px 2px rgba(45,77,131,.035);
  }
  .anon-composer {
    margin-top:0;
    border:1px solid #e2ebf9;
    border-radius:18px;
    padding:8px !important;
    background:#fff;
    box-shadow:0 8px 20px rgba(42,79,142,.07);
  }
}

/* On mobile, use the visible viewport above the soft keyboard for the chat. */
@media (max-width:520px) {
  html:has(.anonymous-chat.is-open), body:has(.anonymous-chat.is-open) { height:100%; overflow:hidden; overscroll-behavior:none; }
  .anonymous-chat.is-open { position:fixed !important; inset:0 !important; height:var(--anon-visual-height,100dvh) !important; min-height:0 !important; padding:0 !important; align-items:stretch !important; }
  .anonymous-chat.is-open .anonymous-chat__phone { width:100% !important; height:100% !important; min-height:0 !important; max-height:none !important; grid-template-rows:auto minmax(0,1fr) !important; }
  .anonymous-chat.is-open .anonymous-chat__content { display:flex !important; flex-direction:column !important; height:100% !important; min-height:0 !important; overflow:hidden !important; padding-bottom:0 !important; }
  .anonymous-chat.is-open .anon-chat-screen.is-active { display:flex !important; flex:1 1 auto !important; flex-direction:column !important; height:auto !important; min-height:0 !important; overflow:hidden !important; margin:0 -20px !important; padding:8px 14px 10px !important; }
  .anonymous-chat.is-open .anon-chat-person { flex:0 0 auto !important; }
  .anonymous-chat.is-open .anon-messages { flex:1 1 0 !important; min-height:0 !important; height:auto !important; overflow-y:auto !important; -webkit-overflow-scrolling:touch; margin:10px 0 !important; padding:12px !important; }
  .anonymous-chat.is-open .anon-composer { position:relative !important; z-index:4 !important; flex:0 0 auto !important; margin:0 !important; padding:8px max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) !important; }
}

/* Keep the active chat entirely inside the part of the screen that remains visible above the keyboard. */
@media (max-width:767px) {
  html.anon-chat-open,
  body.anon-chat-open { height:100%; overflow:hidden !important; overscroll-behavior:none; }
  .anonymous-chat.is-open { position:fixed !important; z-index:2147483000 !important; top:var(--anon-visual-top,0px) !important; right:0 !important; bottom:auto !important; left:0 !important; width:100vw !important; height:var(--anon-visual-height,100dvh) !important; min-height:0 !important; display:block !important; padding:0 !important; overflow:hidden !important; background:#f7faff !important; isolation:isolate; }
  .anonymous-chat.is-open .anonymous-chat__phone { width:100% !important; height:100% !important; min-height:0 !important; max-height:100% !important; display:grid !important; grid-template-rows:auto minmax(0,1fr) !important; overflow:hidden !important; border:0 !important; border-radius:0 !important; background:#f7faff !important; }
  .anonymous-chat.is-open .anonymous-chat__content { display:flex !important; flex-direction:column !important; height:100% !important; min-height:0 !important; overflow:hidden !important; padding:0 14px max(8px,env(safe-area-inset-bottom)) !important; background:#f7faff !important; }
  .anonymous-chat.is-open .anon-chat-screen.is-active { display:flex !important; flex:1 1 auto !important; flex-direction:column !important; height:auto !important; min-height:0 !important; overflow:hidden !important; margin:0 !important; padding:8px 0 0 !important; border:0 !important; border-radius:0 !important; box-shadow:none !important; background:transparent !important; }
  .anonymous-chat.is-open .anon-chat-person,
  .anonymous-chat.is-open .anon-typing { flex:0 0 auto !important; }
  .anonymous-chat.is-open .anon-chat-person { margin:0 0 8px !important; }
  .anonymous-chat.is-open .anon-messages { display:flex !important; flex:1 1 0 !important; min-height:0 !important; height:auto !important; overflow-y:auto !important; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; margin:0 !important; padding:12px !important; border-radius:22px !important; }
  .anonymous-chat.is-open .anon-composer { position:relative !important; inset:auto !important; z-index:4 !important; flex:0 0 auto !important; margin:8px 0 0 !important; padding:8px 0 0 !important; background:#f7faff !important; }

  /* With the keyboard open, reserve the small visible area for the conversation.
     The message list may shrink and scroll, but the composer always remains visible. */
  .anonymous-chat.is-open.keyboard-open .anonymous-chat__header { min-height:58px !important; padding-top:6px !important; padding-bottom:4px !important; }
  .anonymous-chat.is-open.keyboard-open .anonymous-chat__safety { display:none !important; }
  .anonymous-chat.is-open.keyboard-open .anon-chat-person { min-height:58px !important; margin-bottom:5px !important; padding:7px 9px !important; }
  .anonymous-chat.is-open.keyboard-open .anon-chat-person .anon-person-avatar.small { width:40px; height:40px; font-size:1.7rem; }
  .anonymous-chat.is-open.keyboard-open .anon-messages { min-height:0 !important; padding:9px !important; }
  .anonymous-chat.is-open.keyboard-open .anon-composer { margin-top:5px !important; padding-bottom:max(8px,env(safe-area-inset-bottom)) !important; }
}
