.asc-chat{position:fixed;right:20px;bottom:20px;z-index:9999;font-family:var(--asc-font, system-ui,tahoma,sans-serif);direction:rtl}
.asc-launcher{position:absolute;right:0;bottom:0;width:56px;height:56px;border:none;border-radius:50%;background:var(--asc-launcher-bg,#08bfd3);color:#fff;box-shadow:0 8px 30px rgba(0,0,0,.18);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:.18s ease}
.asc-launcher .asc-dot{width:6px;height:6px;background:#fff;border-radius:50%;margin:0 2px;display:inline-block}
.asc-window{width:360px;background:#fff;border:1px solid #eee;border-radius:14px;overflow:hidden;box-shadow:0 8px 30px rgba(0,0,0,.12);position:absolute;right:0;bottom:70px;transform-origin:bottom right;transform:scale(.98);opacity:0;pointer-events:none;transition:opacity .18s ease,transform .18s ease}
.asc-open .asc-window{opacity:1;transform:scale(1);pointer-events:auto}
.asc-open .asc-launcher{transform:translateY(6px)}
.asc-header{padding:11px 12px;background:var(--asc-header-bg,#111827);color:#fff;position:relative}
.asc-title{font-weight:600;text-align:center}
.asc-close{position:absolute;left:8px;top:6px;width:28px;height:28px;border:none;border-radius:6px;background:transparent;color:#fff;font-size:20px;line-height:1;cursor:pointer}
.asc-close:hover{background:rgba(255,255,255,.12)}
.asc-messages{height:370px;overflow-y:auto;padding:10px;background:#f9fafb}
.asc-msg{margin:8px 0;display:flex;gap:6px;align-items:flex-start}
.asc-msg .bubble{max-width:76%;padding:8px 10px;border-radius:11px;line-height:1.7;position:relative;word-break:break-word}
.asc-msg.user .bubble{background:var(--asc-user-bg,#dbeafe);margin-left:auto}
.asc-msg.assistant .bubble{background:var(--asc-assistant-bg,#e5e7eb)}
.asc-msg.operator .bubble{background:var(--asc-operator-bg,#dcfce7)}
.asc-msg.system{justify-content:center}.asc-msg.system .bubble{background:#fff7ed;color:#92400e;max-width:90%;font-size:12px;text-align:center;border:1px solid #fed7aa}
.asc-msg .ft{margin-right:6px;display:flex;align-items:center;gap:10px}
.asc-like,.asc-dislike{font-size:18px;width:34px;height:34px;padding:0;display:inline-flex;align-items:center;justify-content:center;border-radius:10px;cursor:pointer;overflow:hidden;white-space:nowrap}
.asc-like{border:1px solid #38bdf8;background:#f0f9ff}.asc-like:hover{background:#e0f2fe}
.asc-dislike{border:1px solid #f59e0b;background:#fff7ed}.asc-dislike:hover{background:#ffedd5}
.asc-actions{display:flex;gap:6px;padding:10px;border-top:1px solid #eee;align-items:center;background:#fff}
.asc-input-wrap{display:flex;gap:6px;flex:1 1 auto}
#asc-input{flex:1;padding:8px;border:1px solid #ddd;border-radius:8px;min-width:0}
#asc-send{padding:8px 12px;border:none;background:#2563eb;color:#fff;border-radius:8px;cursor:pointer}
#asc-send:disabled{opacity:.6;cursor:not-allowed}
.asc-secondary{padding:8px 12px;border:1px solid #ddd;background:#fff;border-radius:8px;cursor:pointer}
.asc-primary{padding:8px 12px;border:none;background:#2563eb;color:#fff;border-radius:8px;cursor:pointer}
.asc-closed #asc-input,.asc-closed #asc-send{opacity:.6;pointer-events:none}
.asc-modal{position:fixed;inset:0;background:rgba(0,0,0,.35);display:none;align-items:center;justify-content:center;z-index:10000}
.asc-modal-content{background:#fff;padding:16px;border-radius:10px;width:320px;text-align:center;box-shadow:0 12px 40px rgba(0,0,0,.18)}
.asc-stars{display:inline-flex;gap:4px;user-select:none;margin:8px 0}
.asc-stars span{font-size:22px;cursor:pointer;line-height:1;color:#d1d5db;transition:color .12s ease,transform .12s ease}
.asc-stars span.on{color:#f59e0b}.asc-stars span:hover{transform:scale(1.12)}
.asc-modal-actions{display:flex;justify-content:space-between;margin-top:8px;gap:8px}
.asc-modal textarea{width:100%;border:1px solid #e5e7eb;border-radius:8px;padding:6px;box-sizing:border-box}
.asc-msg .avatar{width:24px;height:24px;border-radius:50%;overflow:hidden;flex:0 0 24px}
.asc-msg .avatar img{width:100%;height:100%;object-fit:cover;display:block}
.asc-msg.user{justify-content:flex-end}.asc-msg.user .avatar{order:2}.asc-msg.user .bubble{order:1}
.asc-left{right:auto;left:20px}.asc-left .asc-window{right:auto;left:0}.asc-left .asc-launcher{right:auto;left:0}
@media (max-width:480px){.asc-chat{right:0;left:0;bottom:0}.asc-window{width:calc(100vw - 24px);right:12px;bottom:80px}.asc-launcher{right:12px;bottom:12px}.asc-left .asc-window{left:12px;right:auto}.asc-left .asc-launcher{left:12px;right:auto}.asc-actions{flex-wrap:wrap}.asc-input-wrap{flex-basis:100%}}


/* v0.6.3: inline/page mode for app pages */
.asc-page.asc-chat{position:relative;right:auto;left:auto;bottom:auto;width:100%;max-width:760px;margin:0 auto;z-index:auto}
.asc-page .asc-window{position:relative;right:auto;left:auto;bottom:auto;width:100%;height:var(--asc-page-height,70vh);min-height:420px;opacity:1;transform:none;pointer-events:auto;box-shadow:none;border-radius:14px;display:flex;flex-direction:column;overflow:hidden}
.asc-page .asc-messages{height:auto;flex:1;min-height:240px}
.asc-page .asc-launcher,.asc-page .asc-close{display:none!important}
.asc-page .asc-actions{flex:0 0 auto}
@media (max-width:480px){.asc-page.asc-chat{width:100%;max-width:none;margin:0}.asc-page .asc-window{width:100%;right:auto;left:auto;bottom:auto;border-radius:0;min-height:var(--asc-page-height,calc(100vh - 24px))}}


/* v0.6.3: true fullscreen / app webview mode */
html.asc-fullscreen-lock,body.asc-fullscreen-lock{overflow:hidden!important;margin:0!important;padding:0!important;height:100%!important}
.asc-fullscreen.asc-chat{position:fixed!important;inset:0!important;right:0!important;left:0!important;bottom:0!important;top:0!important;width:100vw!important;max-width:none!important;height:100dvh!important;margin:0!important;z-index:2147483647!important;background:#fff!important}
.asc-fullscreen .asc-window{position:fixed!important;inset:0!important;right:0!important;left:0!important;bottom:0!important;top:0!important;width:100vw!important;height:var(--asc-page-height,100dvh)!important;min-height:100dvh!important;border:0!important;border-radius:0!important;box-shadow:none!important;display:flex!important;flex-direction:column!important}
.asc-fullscreen .asc-header{flex:0 0 auto;padding-top:max(11px, env(safe-area-inset-top))}
.asc-fullscreen .asc-messages{flex:1 1 auto!important;height:auto!important;min-height:0!important}
.asc-fullscreen .asc-actions{flex:0 0 auto;padding-bottom:max(10px, env(safe-area-inset-bottom))}
.asc-fullscreen .asc-launcher,.asc-fullscreen .asc-close{display:none!important}
@supports (height:100svh){.asc-fullscreen.asc-chat,.asc-fullscreen .asc-window{height:100svh!important;min-height:100svh!important}}


/* v0.6.5: clickable links inside bot/operator messages */
.asc-msg .bubble a{color:#2563eb;text-decoration:underline;text-underline-offset:2px;word-break:break-all}
.asc-msg .bubble a:hover{text-decoration-thickness:2px}


/* v0.6.6: robust app fullscreen isolation */
.asc-fullscreen.asc-chat,.asc-fullscreen.asc-chat *{box-sizing:border-box!important}
.asc-fullscreen.asc-chat{display:block!important;overflow:hidden!important;padding:0!important;transform:none!important;contain:layout style!important}
.asc-fullscreen .asc-window{opacity:1!important;transform:none!important;pointer-events:auto!important;max-width:none!important;background:#fff!important}
.asc-fullscreen .asc-title{font-size:15px!important;line-height:1.4!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;padding:0 36px!important}
.asc-fullscreen .asc-messages{display:block!important;overflow-y:auto!important;overflow-x:hidden!important;-webkit-overflow-scrolling:touch!important;padding:12px!important;background:#f9fafb!important}
.asc-fullscreen .asc-msg{width:100%!important;min-width:0!important}
.asc-fullscreen .asc-msg .bubble{max-width:84%!important;overflow-wrap:anywhere!important;word-break:break-word!important}
.asc-fullscreen .asc-actions{display:grid!important;grid-template-columns:auto 1fr!important;gap:8px!important;align-items:center!important;width:100%!important;background:#fff!important;border-top:1px solid #e5e7eb!important;padding:10px max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left))!important}
.asc-fullscreen .asc-input-wrap{display:flex!important;gap:8px!important;width:100%!important;min-width:0!important;flex:1 1 auto!important;flex-basis:auto!important}
.asc-fullscreen #asc-input{height:44px!important;min-height:44px!important;font-size:16px!important;width:100%!important;min-width:0!important;border-radius:10px!important}
.asc-fullscreen #asc-send{height:44px!important;min-height:44px!important;white-space:nowrap!important;border-radius:10px!important}
.asc-fullscreen #asc-resolve,.asc-fullscreen #asc-new{height:44px!important;min-height:44px!important;white-space:nowrap!important;border-radius:10px!important}
@media (max-width:480px){
  .asc-fullscreen .asc-window{width:100vw!important;right:0!important;left:0!important;border-radius:0!important}
  .asc-fullscreen .asc-actions{grid-template-columns:1fr!important;gap:8px!important;padding:8px max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))!important}
  .asc-fullscreen .asc-secondary{width:100%!important;height:38px!important;min-height:38px!important;padding:7px 10px!important}
  .asc-fullscreen .asc-input-wrap{grid-column:1/-1!important;flex-basis:auto!important}
  .asc-fullscreen .asc-msg .bubble{max-width:88%!important}
}

/* v0.6.7: streaming response indicator */
.asc-msg.assistant.pending .bubble::after{
  content:'▌';
  display:inline-block;
  margin-inline-start:2px;
  animation:ascBlink 1s steps(2,start) infinite;
}
@keyframes ascBlink{50%{opacity:0}}


/* v0.6.8: iOS Safari/WebView safe fullscreen fixes */
.asc-fullscreen.asc-chat{
  height:var(--asc-vh,100dvh)!important;
  min-height:var(--asc-vh,100dvh)!important;
  max-height:var(--asc-vh,100dvh)!important;
  -webkit-text-size-adjust:100%!important;
}
.asc-fullscreen .asc-window{
  height:var(--asc-vh,100dvh)!important;
  min-height:var(--asc-vh,100dvh)!important;
  max-height:var(--asc-vh,100dvh)!important;
  overflow:hidden!important;
}
.asc-fullscreen .asc-messages{
  overscroll-behavior:contain!important;
  transform:translateZ(0)!important;
}
.asc-fullscreen #asc-input,
.asc-fullscreen button{
  -webkit-appearance:none!important;
  appearance:none!important;
  touch-action:manipulation!important;
}
.asc-fullscreen #asc-input{
  line-height:20px!important;
}
@supports (-webkit-touch-callout: none){
  html.asc-fullscreen-lock,
  body.asc-fullscreen-lock{
    position:fixed!important;
    width:100%!important;
    left:0!important;
    right:0!important;
    top:0!important;
  }
  .asc-fullscreen.asc-chat,
  .asc-fullscreen .asc-window{
    height:var(--asc-vh, -webkit-fill-available)!important;
    min-height:var(--asc-vh, -webkit-fill-available)!important;
    max-height:var(--asc-vh, -webkit-fill-available)!important;
  }
}


/* v0.6.9: stronger legacy Safari/iOS compatibility for pre-streaming issues */
.asc-ios.asc-fullscreen.asc-chat,
.asc-safari.asc-fullscreen.asc-chat{
  width:100%!important;
  max-width:100%!important;
  left:0!important;
  right:0!important;
  transform:none!important;
  contain:none!important;
}
.asc-ios.asc-fullscreen .asc-window,
.asc-safari.asc-fullscreen .asc-window{
  width:100%!important;
  max-width:100%!important;
  transform:none!important;
  contain:none!important;
}
.asc-ios.asc-fullscreen .asc-header,
.asc-safari.asc-fullscreen .asc-header{
  -webkit-transform:translateZ(0)!important;
  transform:translateZ(0)!important;
}
.asc-ios.asc-fullscreen .asc-actions,
.asc-safari.asc-fullscreen .asc-actions{
  position:relative!important;
  z-index:2!important;
  -webkit-transform:translateZ(0)!important;
  transform:translateZ(0)!important;
}
.asc-ios.asc-fullscreen #asc-input,
.asc-safari.asc-fullscreen #asc-input{
  font-size:16px!important;
  -webkit-user-select:text!important;
  user-select:text!important;
}
.asc-ios.asc-fullscreen .asc-messages,
.asc-safari.asc-fullscreen .asc-messages{
  -webkit-overflow-scrolling:touch!important;
  overscroll-behavior:auto!important;
}
.asc-ios .asc-modal,
.asc-safari .asc-modal{
  -webkit-transform:translateZ(0)!important;
  transform:translateZ(0)!important;
}
