:root {
  --header-height: 4.5rem;
  --viewport-height: 100vh;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: #102746;
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

@supports (height: 100dvh) {
  :root { --viewport-height: 100dvh; }
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
[hidden] { display: none !important; }

.chat-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.375rem 0.75rem;
  min-height: 4.5rem;
  padding: calc(0.75rem + env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) 0.75rem max(1.25rem, env(safe-area-inset-left));
  background: #fff;
  border-bottom: 1px solid #dfe7f2;
}

.brand-logo { flex-shrink: 0; width: 3rem; height: 3rem; object-fit: contain; }
.brand-text { min-width: 0; }
.brand-text h1 { margin: 0; font-size: 1.125rem; line-height: 1.5; font-weight: 750; overflow-wrap: anywhere; }
.brand-text p { margin: 0; font-size: 0.875rem; line-height: 1.5; color: #62728a; }
.network-status { grid-column: 1 / -1; margin: 0; text-align: right; font-size: 0.875rem; color: #82571b; }
.share-notice { grid-column: 1 / -1; margin: 0; text-align: right; font-size: 0.75rem; line-height: 1.5; color: #62728a; }
.copy-chat-link {
  min-height: 2.75rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid #b9cee5;
  border-radius: 0.5rem;
  background: #f2f7fd;
  color: #075cb4;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.copy-chat-link:hover:not(:disabled) { background: #e5f0fc; }
.copy-chat-link:disabled { opacity: 0.5; cursor: default; }
.copy-chat-link:focus-visible, .manual-copy textarea:focus-visible { outline: 3px solid #075cb4; outline-offset: 3px; }
.copy-status { grid-column: 1 / -1; margin: 0; text-align: right; color: #075cb4; font-size: 0.875rem; line-height: 1.5; }
.manual-copy { grid-column: 1 / -1; justify-self: end; width: min(100%, 32rem); }
.manual-copy label { display: block; margin-bottom: 0.375rem; font-size: 0.875rem; font-weight: 600; }
.manual-copy textarea { display: block; width: 100%; padding: 0.625rem; border: 1px solid #b9cee5; border-radius: 0.5rem; font: 0.875rem/1.5 monospace; color: #102746; background: #f7faff; resize: none; overflow-wrap: anywhere; }

.chat-surface {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 100%;
  height: calc(var(--viewport-height) - var(--header-height));
  overflow: auto;
}

.chat-fallback {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
}

.connection h2 { margin: 1rem 0 0; font-size: 1.25rem; line-height: 1.5; }
.connection p, noscript p { margin: 0.75rem 0 0; color: #62728a; font-size: 1rem; line-height: 1.75; }
.status-indicator {
  display: inline-block;
  width: 1.75rem;
  height: 1.75rem;
  border: 3px solid #e2eaf6;
  border-top-color: #006bc1;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.connection:not([data-state="loading"]) .status-indicator { display: none; }

#chat-button {
  min-height: 3rem;
  margin-top: 1.5rem;
  padding: 0.75rem 1.75rem;
  border: 0;
  border-radius: 0.5rem;
  background: #075cb4;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
#chat-button:hover { background: #084988; }
#chat-button:focus-visible { outline: 3px solid #075cb4; outline-offset: 4px; }

/* Full-page adapter for the Chatwoot SDK served by cs.hema.studio.
   Keep the SDK iframe and session handling; only replace its outer layout. */
html body #cw-widget-holder {
  position: fixed !important;
  top: var(--header-height) !important;
  right: 0 !important;
  bottom: auto !important;
  left: 0 !important;
  width: 100% !important;
  height: calc(var(--viewport-height) - var(--header-height)) !important;
  min-height: 0 !important;
  max-height: none !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
  transition: none !important;
}

html body #cw-widget-holder.woot--hide,
html body[data-chat-ready="false"] #cw-widget-holder { display: none !important; }

html body #cw-widget-holder #chatwoot_live_chat_widget {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: none !important;
  border: 0 !important;
  border-radius: 0 !important;
}

html body #cw-bubble-holder,
html body .woot-widget-bubble,
html body .woot--bubble-holder { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 480px) {
  .chat-header { column-gap: 0.5rem; padding-right: max(0.75rem, env(safe-area-inset-right)); padding-left: max(0.75rem, env(safe-area-inset-left)); }
  .brand-logo { width: 2.75rem; height: 2.75rem; }
  .brand-text h1 { font-size: 1rem; }
  .copy-chat-link { padding-right: 0.625rem; padding-left: 0.625rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
