/* User support chat modal */
.dc-support-antispam-trap{
  position:absolute;
  left:-10000px;
  top:auto;
  width:1px;
  height:1px;
  overflow:hidden;
  opacity:0;
  pointer-events:none;
}

body.dc-support-open{
  overflow:hidden!important;
}

body.dc-support-open header.dc-app-header,
body.dc-support-open .user-bottom-nav{
  visibility:hidden!important;
  pointer-events:none!important;
}

.dc-support{
  position:fixed;
  inset:0;
  z-index:100010;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  pointer-events:none;
}

.dc-support[hidden]{
  display:none!important;
}

.dc-support:not([hidden]){
  pointer-events:auto;
}

.dc-support__backdrop{
  position:absolute;
  inset:0;
  border:0;
  background:rgba(3,3,4,.78);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}

.dc-support__panel{
  position:relative;
  z-index:1;
  width:100%;
  max-width:430px;
  height:min(88vh,720px);
  margin:0;
  display:block;
  overflow:hidden;
  border-radius:20px 20px 0 0;
  border:1px solid rgba(255,133,0,.22);
  border-bottom:0;
  background:
    radial-gradient(circle at 100% 0,rgba(255,133,0,.10),transparent 42%),
    radial-gradient(circle at 8% 28%,rgba(34,34,38,.22),transparent 50%),
    linear-gradient(180deg,#121214 0%,#070708 100%);
  box-shadow:0 -18px 48px rgba(0,0,0,.45);
  --dc-support-head-h:48px;
  --dc-support-composer-slot:65px;
}

.dc-support__head{
  position:absolute;
  top:0;
  left:0;
  right:0;
  z-index:3;
  display:grid;
  grid-template-columns:36px minmax(0,1fr) 36px;
  align-items:center;
  gap:8px;
  height:var(--dc-support-head-h);
  min-height:var(--dc-support-head-h);
  padding:0 12px;
  border-bottom:1px solid rgba(255,133,0,.14);
  background:rgba(8,8,10,.98);
}

.dc-support__head-back{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:32px;
  height:32px;
  min-height:0!important;
  min-width:0!important;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.04);
  color:rgba(255,211,145,.92);
  padding:0;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
  appearance:none;
  -webkit-appearance:none;
}

.dc-support__head-back:active{
  background:rgba(255,138,0,.10);
  border-color:rgba(255,138,0,.28);
  color:#ffd391;
}

.dc-support__head-back svg{
  width:17px;
  height:17px;
  display:block;
}

.dc-support__head-title{
  grid-column:2;
  margin:0!important;
  padding:0!important;
  font-size:15px!important;
  line-height:1.1!important;
  font-weight:500!important;
  color:#fff!important;
  text-align:center;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.dc-support__messages{
  position:absolute;
  top:var(--dc-support-head-h);
  left:0;
  right:0;
  bottom:calc(var(--dc-support-composer-slot) + var(--dc-support-typing-slot, 0px));
  min-height:0;
  overflow:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  padding:12px 14px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.dc-support__panel.has-peer-typing{
  --dc-support-typing-slot:38px;
}

.support-chat-typing{
  position:absolute;
  left:0;
  right:0;
  bottom:var(--dc-support-composer-slot);
  z-index:2;
  padding:2px 14px 8px;
  pointer-events:none;
  background:linear-gradient(180deg,rgba(7,7,8,0),rgba(7,7,8,.94) 38%);
}

.support-chat-typing[hidden]{
  display:none!important;
}

.support-chat-typing__row{
  display:flex;
  align-items:center;
  gap:8px;
  justify-content:flex-start;
  animation:support-chat-typing-in .24s ease;
}

.support-chat-typing__bubble{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  min-width:46px;
  height:34px;
  padding:0 12px;
  border-radius:17px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.06);
  box-shadow:0 1px 0 rgba(255,255,255,.04);
}

.support-chat-typing__dot{
  width:6px;
  height:6px;
  border-radius:50%;
  background:rgba(255,179,71,.95);
  animation:support-chat-typing-dot 1.15s ease-in-out infinite;
}

.support-chat-typing__dot:nth-child(2){
  animation-delay:.16s;
}

.support-chat-typing__dot:nth-child(3){
  animation-delay:.32s;
}

.support-chat-typing__label{
  font-size:12px;
  line-height:1.2;
  color:rgba(255,179,71,.88);
  font-weight:500;
  letter-spacing:.01em;
}

@keyframes support-chat-typing-dot{
  0%,55%,100%{ transform:translateY(0); opacity:.42; }
  28%{ transform:translateY(-4px); opacity:1; }
}

@keyframes support-chat-typing-in{
  from{ opacity:0; transform:translateY(5px); }
  to{ opacity:1; transform:translateY(0); }
}

.dc-support__messages:has(.dc-support__welcome){
  justify-content:center;
}

.dc-support__error{
  align-self:center;
  max-width:92%;
  padding:8px 12px;
  border-radius:12px;
  border:1px solid rgba(255,96,96,.28);
  background:rgba(255,96,96,.12);
  color:#ffb4b4;
  font-size:13px;
  line-height:1.35;
  text-align:center;
}

.dc-support__msg{
  display:flex;
  width:100%;
  flex:none;
}

.dc-support__msg.is-mine{
  justify-content:flex-end;
}

.dc-support__msg.is-theirs{
  justify-content:flex-start;
}

.dc-support__bubble{
  max-width:82%;
  padding:9px 12px 7px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.06);
}

.dc-support__msg.is-mine .dc-support__bubble{
  border-color:rgba(255,138,0,.28);
  background:linear-gradient(180deg,rgba(255,138,0,.22),rgba(255,138,0,.10));
}

.dc-support__text{
  font-size:14px;
  line-height:1.45;
  color:#f3f5f8;
  white-space:pre-wrap;
  word-break:break-word;
}

.dc-support__time{
  display:block;
  margin-top:4px;
  font-size:10px;
  line-height:1;
  color:rgba(255,255,255,.42);
  text-align:right;
}

.dc-support__msg.is-theirs .dc-support__time{
  text-align:left;
}

.dc-support__msg.is-hint{
  justify-content:center;
  align-self:stretch;
  width:100%;
  padding:6px 0 8px;
}

.dc-support__hint{
  width:100%;
  max-width:100%;
  padding:14px 16px 12px;
  border-radius:14px;
  border:1px solid rgba(77,61,44,.92);
  background:#231f1b;
  box-sizing:border-box;
}

.dc-support__hint-text{
  font-size:13px;
  line-height:1.5;
  color:rgba(255,255,255,.88);
  white-space:pre-wrap;
  word-break:break-word;
  text-align:center;
}

.dc-support__hint-time{
  display:block;
  margin-top:10px;
  font-size:10px;
  line-height:1;
  color:rgba(255,255,255,.36);
  text-align:left;
}

.dc-support__composer{
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  z-index:3;
  display:flex;
  align-items:flex-end;
  gap:8px;
  box-sizing:border-box;
  width:100%;
  padding:10px 14px;
  border-top:1px solid rgba(255,133,0,.14);
  background:rgba(3,3,4,.98);
}

.dc-support__composer textarea{
  flex:1 1 auto;
  min-height:40px;
  max-height:120px;
  resize:none;
  margin:0;
  padding:9px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  color:#fff;
  font:inherit;
  font-size:14px;
  line-height:1.35;
}

.dc-support__composer textarea:focus{
  outline:none;
  border-color:rgba(255,138,0,.42);
  box-shadow:0 0 0 2px rgba(255,138,0,.12);
}

.dc-support__composer textarea::placeholder{
  color:rgba(255,255,255,.38);
}

.dc-support__send{
  appearance:none;
  -webkit-appearance:none;
  flex:0 0 40px;
  width:40px;
  height:40px;
  min-height:0!important;
  border:0;
  border-radius:999px;
  background:linear-gradient(135deg,#ff9a2f,#ff611d);
  color:#111;
  font-size:18px;
  font-weight:900;
  cursor:pointer;
  box-shadow:0 4px 14px rgba(255,106,0,.24);
}

.dc-support__send:disabled{
  opacity:.55;
  cursor:default;
}

.dc-support__welcome{
  margin:0 auto;
  max-width:320px;
  padding:12px 8px;
  text-align:center;
  color:rgba(244,245,247,.62);
  font-size:14px;
  line-height:1.45;
}

@media (hover:hover){
  .dc-support__head-back:hover{
    background:rgba(255,138,0,.10);
    border-color:rgba(255,138,0,.28);
    color:#ffd391;
  }

  .dc-support__send:hover:not(:disabled){
    filter:brightness(1.08);
  }
}

@media (max-width:767px){
  body.dc-support-open{
    position:fixed;
    width:100%;
    height:100%;
  }

  .dc-support{
    align-items:stretch;
    justify-content:stretch;
    padding:0!important;
  }

  .dc-support__panel{
    --dc-support-head-h:44px;
    --dc-support-composer-slot:calc(56px + env(safe-area-inset-bottom,0px));
    position:fixed;
    top:0;
    right:0;
    bottom:0;
    left:0;
    width:100%;
    max-width:none;
    /* Fill the TRUE screen, not the under-reported small viewport. In the iOS standalone
       PWA `svh`/`dvh` can report below the physical screen, so a fixed panel ended above the
       real bottom and left a dark band under the composer. --dc-layout-vh (set by
       dc-viewport-keyboard.js, clamped to screen height) is the same value the shell/bottom-nav
       use to reach the real bottom. Layered fallbacks: svh -> dvh -> layout-vh (wins in PWA),
       and in a plain browser the var is unset so it falls back to 100dvh (tracks the toolbar). */
    height:100svh!important;
    height:100dvh!important;
    height:var(--dc-layout-vh,100dvh)!important;
    max-height:100svh!important;
    max-height:100dvh!important;
    max-height:var(--dc-layout-vh,100dvh)!important;
    border-radius:0;
    border:0;
    box-shadow:none;
  }

  body.dc-support-keyboard .dc-support__panel{
    top:var(--dc-support-vv-top,0px);
    bottom:auto;
    height:var(--dc-support-vv-height,100dvh)!important;
    max-height:var(--dc-support-vv-height,100dvh)!important;
  }

  .dc-support__head{
    height:calc(var(--dc-support-head-h) + env(safe-area-inset-top,0px));
    min-height:calc(var(--dc-support-head-h) + env(safe-area-inset-top,0px));
    padding-top:env(safe-area-inset-top,0px);
    padding-left:max(10px, env(safe-area-inset-left,0px));
    padding-right:max(10px, env(safe-area-inset-right,0px));
    box-sizing:border-box;
  }

  .dc-support__messages{
    top:calc(var(--dc-support-head-h) + env(safe-area-inset-top,0px));
    padding:10px 12px 8px;
  }

  .dc-support__composer{
    padding:8px 12px calc(8px + env(safe-area-inset-bottom,0px));
  }

  body.dc-support-keyboard .dc-support__messages{
    bottom:calc(56px + 8px);
  }

  body.dc-support-keyboard .dc-support__composer{
    padding-bottom:8px;
  }

  .dc-support__composer textarea{
    font-size:16px;
    touch-action:manipulation;
  }

  .dc-support__send{
    touch-action:manipulation;
  }
}

@media (min-width:768px){
  .dc-support{
    align-items:center;
    justify-content:center;
    padding:24px;
  }

  body.dc-support-open .dc-support__panel{
    width:min(100%,420px)!important;
    max-width:420px!important;
    height:min(680px,calc(100dvh - 48px))!important;
    max-height:min(680px,calc(100dvh - 48px))!important;
    border-radius:20px;
    border:1px solid rgba(255,133,0,.24);
    box-shadow:
      0 28px 72px rgba(0,0,0,.55),
      0 0 0 1px rgba(255,133,0,.08);
  }

  .dc-support__head{
    border-radius:20px 20px 0 0;
  }

  .dc-support__composer{
    border-radius:0 0 20px 20px;
    padding:12px 14px;
  }
}
