:root {
  color-scheme: light;
  --yellow: #ffd629;
  --ink: #11120e;
  --muted: #686a63;
  --paper: #fffdf4;
  --surface: #ffffff;
  --line: #e4e3da;
  --green: #00a978;
  --blue: #0b63ce;
  --shadow: 0 24px 70px rgba(28, 28, 20, 0.11);
  --chat-viewport-height: 100dvh;
  --chat-layout-viewport-height: var(--chat-viewport-height);
  --chat-mobile-bottom-clearance: max(16px, env(safe-area-inset-bottom, 0px));
  --chat-embedded-bottom-clearance: max(88px, calc(env(safe-area-inset-bottom, 0px) + 48px));
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  height: var(--chat-viewport-height);
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 214, 41, 0.23), transparent 27%),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.is-embedded {
  height: 100%;
}

body.is-embedded .workspace {
  height: calc(100% - 76px);
}

a {
  color: inherit;
}

button {
  font: inherit;
}

.topbar {
  position: relative;
  z-index: 20;
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid rgba(17, 18, 14, 0.09);
  background: rgba(255, 253, 244, 0.88);
  padding: 12px max(24px, calc((100vw - 1180px) / 2));
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-grid;
  gap: 3px;
  justify-self: start;
  color: var(--ink);
}

.brand-title {
  width: fit-content;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1;
  text-decoration: none;
}

.bookmark-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.bookmark-link {
  width: fit-content;
  border: 1px solid #e2b900;
  border-radius: 999px;
  color: #3f3000;
  background: #ffe36b;
  box-shadow: 0 3px 0 rgba(17, 18, 14, 0.12);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.15;
  text-decoration: none;
  white-space: nowrap;
}

.copy-url-button {
  min-height: 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  padding: 0 8px;
  font-size: 9px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.copy-url-button:hover {
  transform: translateY(-1px);
  background: #30322b;
}

.copy-url-button.is-copied {
  border-color: #007d59;
  background: #007d59;
}

.desktop-reminder {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  border: 1px solid #000;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 6px 0 rgba(255, 214, 41, 0.8);
  padding: 5px 16px;
}

.desktop-reminder svg {
  flex: 0 0 auto;
  color: var(--yellow);
}

.desktop-reminder > span {
  display: grid;
  gap: 1px;
}

.desktop-reminder strong {
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.desktop-reminder small {
  color: #d7d8d1;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
}

.transfer-trigger {
  min-height: 28px;
  border: 1px solid var(--yellow);
  border-radius: 999px;
  color: var(--ink);
  background: var(--yellow);
  padding: 0 10px;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.transfer-trigger:hover {
  background: #ffe36b;
  transform: translateY(-1px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 12px;
}

.connection-pill,
.home-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
}

.connection-pill {
  color: #4d514a;
  background: #fff;
  border: 1px solid var(--line);
  padding: 0 13px;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.13);
}

body.is-connected .connection-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(0, 169, 120, 0.13);
}

body.has-error .connection-dot {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.home-link {
  color: var(--ink);
  text-decoration: none;
  padding: 0 4px;
}

.home-link:hover span {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.workspace {
  width: min(1180px, 100%);
  height: calc(var(--chat-viewport-height) - 76px);
  display: grid;
  grid-template-columns: minmax(300px, 0.68fr) minmax(430px, 0.92fr);
  gap: clamp(24px, 4vw, 58px);
  margin: 0 auto;
  padding: clamp(24px, 4vh, 44px) 24px;
}

.info-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(20px, 3vh, 30px);
}

.intro-block {
  max-width: 480px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(40px, 5vw, 68px);
  font-weight: 950;
  letter-spacing: -0.065em;
  line-height: 1.02;
}

.help-card {
  max-width: 500px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 16px 46px rgba(28, 28, 20, 0.05);
  padding: 20px;
}

.help-card h2 {
  margin-bottom: 15px;
  font-size: 14px;
  font-weight: 900;
}

.help-card ul {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-card li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.help-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--ink);
  background: var(--yellow);
  font-size: 14px;
  font-weight: 950;
}

.help-card li > span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.help-card strong {
  font-size: 13px;
  line-height: 1.35;
}

.help-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.chat-column {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.chat-stage {
  position: relative;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  border: 1px solid rgba(17, 18, 14, 0.11);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
  isolation: isolate;
}

.chat-stage::before {
  position: absolute;
  inset: 0 0 auto;
  z-index: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--yellow) 0 68%, var(--ink) 68% 100%);
  content: "";
}

.connect-state,
.reconnect-state {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
}

.support-avatar {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  border: 2px solid var(--ink);
  border-radius: 19px 19px 19px 6px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 5px 5px 0 var(--ink);
}

.support-avatar.is-muted {
  border-color: #cfd1c8;
  color: #6b6d66;
  background: #eff0ea;
  box-shadow: 5px 5px 0 #d9dad3;
}

.connect-state h2,
.reconnect-state h2 {
  margin-bottom: 8px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.035em;
}

.connect-state p,
.reconnect-state p {
  max-width: 320px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.loader {
  width: 30px;
  height: 30px;
  border: 3px solid #ecece7;
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.primary-button {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(17, 18, 14, 0.17);
  padding: 0 22px;
  font-weight: 850;
  cursor: pointer;
}

.primary-button:hover {
  transform: translateY(-1px);
  background: #282a24;
}

.secondary-link {
  margin-top: 17px;
  color: #5b5d56;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.secondary-link:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.primary-button:focus-visible,
.secondary-link:focus-visible,
.home-link:focus-visible,
.brand-title:focus-visible,
.bookmark-link:focus-visible,
.copy-url-button:focus-visible,
.transfer-trigger:focus-visible,
.transfer-close:focus-visible,
.transfer-copy-button:focus-visible,
.transfer-share-button:focus-visible {
  outline: 3px solid rgba(11, 99, 206, 0.27);
  outline-offset: 3px;
}

.transfer-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(17, 18, 14, 0.58);
  padding: 20px;
  backdrop-filter: blur(8px);
}

.transfer-modal[hidden],
.session-toast[hidden] {
  display: none;
}

.transfer-dialog {
  width: min(460px, 100%);
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(17, 18, 14, 0.18);
  border-radius: 24px;
  background: #fffdf4;
  box-shadow: 0 28px 90px rgba(17, 18, 14, 0.28);
  padding: 24px;
  -webkit-overflow-scrolling: touch;
}

.transfer-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.transfer-kicker {
  display: inline-block;
  margin-bottom: 7px;
  border-radius: 999px;
  color: #3f3000;
  background: var(--yellow);
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 900;
}

.transfer-dialog h2 {
  margin-bottom: 0;
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -0.035em;
}

.transfer-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.transfer-copy {
  margin: 18px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.transfer-label {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
  font-weight: 900;
}

.transfer-link {
  width: 100%;
  height: 44px;
  border: 1px solid #d7d6cc;
  border-radius: 11px;
  color: #36382f;
  background: #fff;
  padding: 0 12px;
  font: 700 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.transfer-actions {
  display: flex;
  gap: 9px;
  margin-top: 12px;
}

.transfer-copy-button,
.transfer-share-button {
  min-height: 42px;
  border: 1px solid var(--ink);
  border-radius: 11px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.transfer-copy-button {
  flex: 1;
  color: #fff;
  background: var(--ink);
}

.transfer-copy-button:disabled {
  border-color: #b7b8b0;
  color: #777a72;
  background: #e7e8e2;
  cursor: wait;
}

.transfer-copy-button.is-copied {
  border-color: #007d59;
  background: #007d59;
}

.transfer-share-button {
  color: var(--ink);
  background: var(--yellow);
  padding: 0 15px;
}

.transfer-status {
  margin: 11px 0 0;
  color: #777971;
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.transfer-status.is-error {
  color: #b42318;
}

.session-toast {
  position: fixed;
  top: 92px;
  left: 50%;
  z-index: 1100;
  max-width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  border: 1px solid #007d59;
  border-radius: 999px;
  color: #fff;
  background: #007d59;
  box-shadow: 0 14px 40px rgba(0, 125, 89, 0.25);
  padding: 9px 16px;
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}

.session-toast.is-error {
  border-color: #b42318;
  background: #b42318;
}

.chat-footnote {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
  color: #71736c;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.chat-footnote span {
  color: var(--green);
  font-size: 8px;
}

body.is-connected .connect-state,
body.is-chat-closed .connect-state,
body.has-error .connect-state {
  display: none;
}

.reconnect-state[hidden] {
  display: none;
}

/* Chatwoot injects a fixed widget. On this page it becomes the page's chat panel. */
.chat-stage #cw-widget-holder {
  position: relative !important;
  inset: auto !important;
  z-index: 3 !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.chat-stage #cw-widget-holder iframe {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  max-height: none !important;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 820px) {
  .topbar {
    height: 96px;
    min-height: 96px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 40px 32px;
    gap: 6px 8px;
    padding: 8px 16px 10px;
  }

  .brand-title {
    font-size: 16px;
  }

  .bookmark-link {
    display: block;
    padding: 2px 6px;
    font-size: 8px;
  }

  .bookmark-row {
    gap: 4px;
  }

  .copy-url-button {
    min-height: 20px;
    padding: 0 7px;
    font-size: 8px;
  }

  .desktop-reminder {
    width: 100%;
    min-height: 32px;
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 7px;
    border-radius: 9px;
    box-shadow: 0 3px 0 rgba(255, 214, 41, 0.8);
    padding: 4px 10px;
  }

  .transfer-trigger {
    min-height: 24px;
    margin-left: auto;
    padding: 0 8px;
    font-size: 9px;
  }

  .desktop-reminder svg {
    width: 16px;
    height: 16px;
  }

  .desktop-reminder > span {
    display: flex;
    align-items: baseline;
    gap: 7px;
  }

  .desktop-reminder strong {
    font-size: 11px;
  }

  .desktop-reminder small {
    font-size: 9px;
  }

  .home-link span {
    display: none;
  }

  .connection-pill {
    min-height: 34px;
    padding: 0 10px;
    font-size: 11px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .home-link {
    width: 34px;
    height: 34px;
    justify-content: center;
    border: 1px solid var(--line);
    background: #fff;
    padding: 0;
  }

  .workspace {
    width: 100%;
    height: calc(var(--chat-viewport-height) - 96px);
    display: block;
    padding: 0 0 var(--chat-mobile-bottom-clearance);
  }

  body.is-chat-keyboard-open .topbar {
    visibility: hidden;
    pointer-events: none;
  }

  body.is-chat-keyboard-open .workspace {
    position: absolute;
    z-index: 30;
    top: 0;
    right: 0;
    left: 0;
    height: var(--chat-viewport-height);
    padding: 0;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
  }

  body.is-chat-keyboard-open .chat-column {
    flex: 0 0 auto;
    height: calc(var(--chat-layout-viewport-height) - 112px);
  }

  body.is-embedded .workspace {
    height: calc(100% - 96px);
    padding-bottom: var(--chat-mobile-bottom-clearance);
  }

  body.is-vika-embedded .workspace {
    padding-bottom: var(--chat-embedded-bottom-clearance);
  }

  body.is-quark-embedded .workspace {
    padding-bottom: 0;
  }

  .transfer-modal {
    align-items: end;
    padding: 12px 12px max(12px, env(safe-area-inset-bottom, 0px));
  }

  body.is-vika-embedded .transfer-modal {
    padding-bottom: var(--chat-embedded-bottom-clearance);
  }

  .transfer-dialog {
    border-radius: 20px;
    padding: 20px;
  }

  .session-toast {
    top: 106px;
  }

  .info-panel,
  .chat-footnote {
    display: none;
  }

  .chat-column,
  .chat-stage {
    height: 100%;
  }

  .chat-stage {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .chat-stage::before {
    display: none;
  }
}

@media (hover: none) and (pointer: coarse) and (min-width: 821px) {
  .workspace {
    padding-bottom: max(clamp(24px, 4vh, 44px), env(safe-area-inset-bottom, 0px));
  }

  body.is-vika-embedded .workspace {
    padding-bottom: var(--chat-embedded-bottom-clearance);
  }

  body.is-quark-embedded .workspace {
    padding-bottom: 0;
  }
}

@media (max-width: 360px) {
  .copy-url-button {
    width: 28px;
    padding: 0;
  }

  .copy-button-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    clip-path: inset(50%);
  }
}

@media (max-height: 720px) and (min-width: 821px) {
  .workspace {
    padding-block: 20px;
  }

  .info-panel {
    gap: 17px;
  }

  h1 {
    margin-bottom: 12px;
    font-size: clamp(38px, 7vh, 54px);
  }

  .help-card {
    padding: 16px;
  }

  .help-card ul {
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
