#hc-root {
  --hc-font: var(--ko-site-font, "Noto Sans KR", "Apple SD Gothic Neo", sans-serif);
  --hc-action: color-mix(in srgb, var(--sys-color-action) 60%, var(--sys-color-brand-text));
  --hc-shadow: color-mix(in srgb, var(--sys-color-ink) 16%, transparent);
  --hc-space: 12px;
  --hc-gap: 8px;
  --hc-panel-radius: 16px;
  --hc-input-radius: 12px;
  --hc-button-radius: 8px;
  --hc-launch-size: 56px;
  --hc-channel-inset: 20px;
  --hc-panel-inset: 24px;
  position: fixed;
  right: 24px;
  bottom: calc(var(--hc-panel-inset) + var(--hc-viewport-bottom, 0px));
  z-index: 10020;
  color: var(--sys-color-text);
  font: 14px/1.5 var(--hc-font);
}
#hc-root[lang="en"] { --hc-font: var(--en-v2-font-sans, "Manrope", system-ui, sans-serif); }
#hc-root[lang="zh-Hant"] { --hc-font: var(--tw-v2-font-sans, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif); }

#hc-root * { box-sizing: border-box; }
#hc-root button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--sys-color-line);
  border-radius: var(--hc-button-radius);
  background: var(--sys-color-canvas);
  color: var(--sys-color-ink);
  font: inherit;
  cursor: pointer;
}
#hc-root button:not(:disabled):hover { background: var(--sys-color-soft); }
#hc-root button:disabled { opacity: .5; cursor: default; }
#hc-root .hc-booking-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  justify-self: start;
  padding: 0 14px;
  border: 1px solid var(--hc-action);
  border-radius: var(--hc-button-radius);
  color: var(--hc-action);
  background: var(--sys-color-canvas);
  font-weight: 600;
  text-decoration: none;
}
#hc-root .hc-booking-link:hover { background: var(--sys-color-soft); }
#hc-root .hc-booking-link:focus-visible { outline: 2px solid var(--hc-action); outline-offset: 2px; }
#hc-root button[type="submit"] {
  border-color: var(--hc-action);
  background: var(--hc-action);
  color: var(--sys-color-on-action);
}
#hc-root button[type="submit"]:not(:disabled):hover {
  background: var(--sys-color-brand-text);
  border-color: var(--sys-color-brand-text);
}
#hc-root #hc-launch {
  --hc-avatar-ink: #182b4b;
  --hc-launch-shadow: 0 5px 16px rgb(24 43 75 / 19%), 0 1px 4px rgb(24 43 75 / 8%);
  position: fixed;
  right: var(--hc-channel-inset);
  bottom: calc(var(--hc-channel-inset) + env(safe-area-inset-bottom, 0px) + var(--hc-launch-size) + 10px);
  display: grid;
  place-items: center;
  width: var(--hc-launch-size);
  height: var(--hc-launch-size);
  padding: 0;
  border: 1px solid #f1f4f8;
  border-radius: 37%;
  background: #fff;
  box-shadow: var(--hc-launch-shadow);
}
body[data-device="pc"]:has([data-ko-channel-talk-open]) #hc-root #hc-launch {
  right: 24px;
}
#hc-root #hc-launch:not(:disabled):hover { background: #f6fbff; }
#hc-launch .hc-launch-avatar {
  position: relative;
  display: block;
  width: 98%;
  aspect-ratio: 1.44;
  translate: 0 -1px;
}
#hc-launch .hc-avatar-face {
  position: absolute;
  inset: 0 0 10%;
  overflow: hidden;
}
#hc-launch .hc-avatar-face img {
  display: block;
  width: 112%;
  max-width: none;
  height: auto;
  margin-inline-start: -6%;
}
#hc-launch .hc-avatar-headset {
  position: absolute;
  inset: 2% 8% 7%;
  border: 1.5px solid var(--hc-avatar-ink);
  border-bottom: 0;
  border-radius: 50% 50% 30% 30%;
}
#hc-launch .hc-avatar-headset::before,
#hc-launch .hc-avatar-headset::after {
  position: absolute;
  top: 48%;
  width: 17%;
  height: 38%;
  border-radius: 999px;
  background: var(--hc-avatar-ink);
  content: "";
}
#hc-launch .hc-avatar-headset::before { left: -9%; }
#hc-launch .hc-avatar-headset::after { right: -9%; }
#hc-launch .hc-avatar-mic {
  position: absolute;
  right: -1px;
  bottom: 13%;
  width: 34%;
  height: 18%;
  border: solid var(--hc-avatar-ink);
  border-width: 0 1.5px 1.5px 0;
  border-radius: 0 0 7px 0;
}
#hc-launch .hc-avatar-mic::after {
  position: absolute;
  bottom: -2px;
  left: -2px;
  width: 5px;
  height: 3px;
  border-radius: 999px;
  background: var(--hc-avatar-ink);
  content: "";
}
#hc-launch .hc-launch-ai {
  position: absolute;
  right: 8%;
  bottom: 5%;
  color: var(--hc-avatar-ink);
  font: 700 9px/1 system-ui, sans-serif;
}
#hc-launch .hc-beta {
  position: absolute;
  top: -4px;
  right: -4px;
  padding: 2px 4px;
  border: 1px solid #dfeaf6;
  border-radius: 999px;
  background: #f2f7fd;
  color: #234669;
  font: 700 8px/1 system-ui, sans-serif;
}

#hc-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 390px;
  height: min(640px, 85vh);
  max-height: calc(var(--hc-viewport-height, 100vh) - 2 * var(--hc-panel-inset));
  border: 1px solid var(--sys-color-line);
  border-radius: var(--hc-panel-radius);
  background: var(--sys-color-surface);
  box-shadow: 0 12px 48px var(--hc-shadow);
}
#hc-panel[hidden], #hc-root #hc-launch[hidden] { display: none; }
#hc-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--hc-gap);
  padding: var(--hc-space);
  border-bottom: 1px solid var(--sys-color-line);
  background: var(--sys-color-soft);
}
#hc-panel h2 { margin: 0; color: var(--sys-color-brand-text); font-size: 18px; line-height: 1.4; }
#hc-panel small { color: var(--sys-color-muted); font-size: 12px; }
#hc-root #hc-close {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-color: transparent;
  background: transparent;
}
#hc-root #hc-close:hover { background: var(--sys-color-surface); }

#hc-toolbar { display: flex; gap: var(--hc-gap); padding: var(--hc-space); }
#hc-room-picker { position: relative; flex: 1; min-width: 0; }
#hc-root #hc-rooms {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--hc-gap);
  width: 100%;
  border-radius: var(--hc-input-radius);
  background: var(--sys-color-surface);
  text-align: left;
}
#hc-rooms::after {
  content: "";
  flex: none;
  width: .45em;
  height: .45em;
  border: solid var(--sys-color-muted);
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-.12em) rotate(45deg);
}
#hc-rooms[aria-expanded="true"]::after { transform: translateY(.12em) rotate(225deg); }
#hc-room-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#hc-room-options {
  position: absolute;
  inset: calc(100% + 4px) 0 auto;
  z-index: 1;
  max-height: min(200px, 32dvh);
  overflow: auto;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--sys-color-line);
  border-radius: var(--hc-input-radius);
  background: var(--sys-color-surface);
  box-shadow: 0 8px 24px var(--hc-shadow);
  list-style: none;
}
#hc-room-options[hidden] { display: none; }
#hc-root #hc-room-options button {
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 0 10px;
  border: 0;
  background: var(--sys-color-surface);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#hc-root #hc-room-options button:is(:hover, :focus-visible, [aria-current="true"]) {
  background: var(--sys-color-soft);
  color: var(--sys-color-brand-text);
}
#hc-root #hc-room-options button:focus-visible { outline-offset: -2px; }
#hc-message {
  width: 100%;
  min-height: 65px;
  max-height: 130px;
  padding: 10px;
  border: 1px solid var(--sys-color-line);
  border-radius: var(--hc-input-radius);
  background: var(--sys-color-surface);
  color: var(--sys-color-ink);
  font: inherit;
  resize: vertical;
}
#hc-message::placeholder { color: var(--sys-color-muted); }
#hc-root :is(button, textarea):focus-visible {
  outline: 2px solid var(--sys-color-brand-text);
  outline-offset: 2px;
}

#hc-messages { flex: 1; min-height: 0; overflow: auto; padding: var(--hc-space); background: var(--sys-color-canvas); }
#hc-messages > p { margin: 0; line-height: 1.45; }
#hc-messages article { display: grid; gap: 4px; margin: 0; }
#hc-messages article + article { margin-block-start: 10px; }
#hc-messages article > small { line-height: 1.25; }
#hc-messages article p {
  margin: 0;
  padding: 8px var(--hc-space);
  border: 1px solid var(--sys-color-line-soft);
  border-radius: var(--hc-input-radius);
  background: var(--sys-color-surface);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#hc-messages article.mine p {
  border-color: color-mix(in srgb, var(--sys-color-brand) 25%, var(--sys-color-line));
  background: var(--sys-color-soft);
}

#hc-form { padding: var(--hc-space); }
#hc-form footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--hc-gap); margin-top: var(--hc-gap); }
#hc-send-actions { display: flex; align-items: center; gap: var(--hc-gap); margin-inline-start: auto; }
#hc-panel #hc-send-shortcut { font-size: .75em; white-space: nowrap; }
#hc-ai-status { flex-shrink: 0; margin: 0; }
#hc-ai-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--hc-space);
  background: var(--sys-color-canvas);
  color: var(--sys-color-muted);
  font-size: 12px;
}
#hc-ai-indicator[hidden] { display: none; }
.hc-ai-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sys-color-brand); }
#hc-status, #hc-sync-status { margin: 0; padding: 6px var(--hc-space) 0; font-size: 12px; line-height: 1.4; }
#hc-status { color: var(--sys-color-danger); }
#hc-sync-status { color: var(--sys-color-muted); }
#hc-status:empty, #hc-sync-status:empty { padding: 0; }
#hc-notice { margin: 0; padding: 0 var(--hc-space) 10px; color: var(--sys-color-muted); font-size: 11px; line-height: 1.4; }
#hc-root #hc-forget { min-height: 0; padding: 0; border: 0; background: transparent; color: var(--sys-color-muted); font-size: 11px; }
#hc-root #hc-forget:not(:disabled):hover { color: var(--sys-color-brand-text); text-decoration: underline; }

@media (max-width: 600px) {
  #hc-root { right: 8px; --hc-panel-inset: 8px; }
  #hc-panel { width: calc(100vw - 16px); height: min(700px, 80dvh); }
}
@media (max-width: 600px), (hover: none) and (pointer: coarse) {
  #hc-root { --hc-channel-inset: 24px; }
  #hc-panel { overflow-y: auto; }
  #hc-panel header { padding-block: 0; }
  #hc-panel header small { display: none; }
  #hc-toolbar { padding-block: 2px; }
  #hc-form {
    display: grid;
    flex-shrink: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 2px var(--hc-gap);
    margin: 0;
    padding-block: 3px;
  }
  #hc-form footer { display: contents; }
  #hc-send-actions { grid-column: 2; grid-row: 1; margin-inline-start: 0; }
  #hc-root #hc-forget { grid-column: 1 / -1; grid-row: 2; justify-self: start; line-height: 1.25; }
  #hc-message { height: 44px; min-height: 44px; font-size: 16px; resize: none; }
  #hc-message:focus-visible { outline: 2px solid var(--hc-action); outline-offset: -2px; }
  #hc-notice { padding-bottom: 2px; line-height: 1.2; }
  body[data-device="mobile"]:has(.ko-channel-talk-home[data-ko-channel-talk-open]) #hc-root #hc-launch {
    right: 16px;
  }
}
