/* Steady Hand Chat widget. Everything is scoped under .shc; --shc-accent comes from settings. */
.shc {
  --shc-ink: #22223b;
  --shc-muted: #6b6b85;
  --shc-bg: #ffffff;
  --shc-soft: #f6f4f1;
  --shc-line: #e8e2da;
  position: fixed; right: 20px; bottom: 20px; z-index: 99999;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--shc-ink);
}
.shc *, .shc *::before, .shc *::after { box-sizing: border-box; }
.shc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.shc-launch {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
  background: var(--shc-accent); color: #fff; border: 0; border-radius: 999px;
  padding: 12px 18px; font: inherit; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); transition: transform .15s;
}
.shc-launch:hover { transform: translateY(-2px); }
.shc-launch:focus-visible, .shc button:focus-visible, .shc textarea:focus-visible { outline: 3px solid var(--shc-ink); outline-offset: 2px; }
.shc-launch-icon { font-size: 18px; line-height: 1; }
.shc-open .shc-launch { display: none; }

.shc-panel {
  width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 40px));
  display: flex; flex-direction: column;
  background: var(--shc-bg); border-radius: 20px; overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,.22); border: 1px solid var(--shc-line);
}
.shc-panel[hidden] { display: none; }

.shc-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 14px 18px; background: var(--shc-accent); color: #fff; }
.shc-head > div { flex: 1; min-width: 0; }
.shc-head strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shc-head small { opacity: .9; font-size: 12px; }
.shc-head button { background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 999px; cursor: pointer; font: inherit; }
.shc-new { font-size: 12px !important; padding: 5px 10px; }
.shc-close { width: 32px; height: 32px; font-size: 20px !important; line-height: 1; }

.shc-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--shc-soft); }
.shc-m { max-width: 85%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.shc-them { align-self: flex-start; background: var(--shc-bg); border: 1px solid var(--shc-line); border-bottom-left-radius: 4px; }
.shc-you { align-self: flex-end; background: var(--shc-ink); color: #fff; border-bottom-right-radius: 4px; }
.shc-m a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.shc-note { align-self: center; font-size: 13px; color: var(--shc-muted); text-align: center; }

.shc-them.typing { display: flex; gap: 4px; padding: 14px; }
.shc-them.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--shc-muted); animation: shc-bounce 1s infinite; }
.shc-them.typing i:nth-child(2) { animation-delay: .15s; }
.shc-them.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes shc-bounce { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.shc-form { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--shc-line); background: var(--shc-bg); }
.shc-form textarea { flex: 1; resize: none; font: inherit; padding: 10px 14px; border: 1px solid var(--shc-line); border-radius: 18px; background: var(--shc-soft); color: inherit; max-height: 120px; }
.shc-form button { width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; background: var(--shc-accent); color: #fff; font-size: 16px; cursor: pointer; }
.shc-busy button { opacity: .5; pointer-events: none; }
.shc-foot a { color: inherit; }
.shc-foot { margin: 0; padding: 0 12px 10px; font-size: 11px; color: var(--shc-muted); text-align: center; background: var(--shc-bg); }

@media (max-width: 480px) {
  .shc { right: 12px; bottom: 12px; }
  .shc-open { left: 0; right: 0; bottom: 0; top: 0; }
  .shc-open .shc-panel { width: 100%; height: 100%; border-radius: 0; }
  .shc-launch-label { display: none; }
  .shc-launch { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .shc-launch, .shc-them.typing i { transition: none; animation: none; }
}
