:root {
  --dodollm-panel-width: 320px;
  --dodollm-backdrop-tint: rgba(12, 10, 20, 0.28);
  --desktop-nav-height: 3.5rem;
  --dodollm-panel-ease: cubic-bezier(0.77, 0, 0.18, 1);
  --dodollm-panel-duration: 340ms;
  --dodollm-enter-duration: 480ms;
  --dodollm-enter-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dodollm-signature-spin-duration: 1.1s;
  --dodollm-signature-spin-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.dodollm-panel {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--paper) 60%, #ffdea9 204.32%);
  color: var(--ink);
  font-family: var(--font-copy, var(--font-body, system-ui, sans-serif));
  box-shadow: 0 0 24px rgba(19, 17, 33, 0.07);
}

html.dodollm-lock-scroll,
body.dodollm-lock-scroll {
  overflow: hidden;
  overscroll-behavior: none;
}

body.dodollm-lock-scroll .dodollm-panel,
body.dodollm-lock-scroll .dodollm-panel__chat {
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 1288px) {
  html.dodollm-lock-scroll,
  body.dodollm-lock-scroll {
    overflow: visible;
    overscroll-behavior: auto;
  }

  body.dodollm-standalone .dodollm-backdrop.is-open {
    pointer-events: none;
  }
}

@media (max-width: 1287px) {
  .dodollm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 390;
    background: var(--dodollm-backdrop-tint);
    opacity: 0;
    pointer-events: none;
    transition: opacity 260ms cubic-bezier(0.55, 0.16, 0.22, 0.78);
  }

  .dodollm-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .dodollm-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 400;
    width: min(360px, 90vw);
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    transform: translateX(100%);
    pointer-events: none;
    overflow: hidden;
    transition: transform 260ms cubic-bezier(0.55, 0.16, 0.22, 0.78);
  }

  .dodollm-panel.is-open {
    transform: translateX(0);
    pointer-events: auto;
    transition-duration: var(--dodollm-panel-duration);
    transition-timing-function: var(--dodollm-panel-ease);
  }
}

/* Case studies: no .app-shell — keep panel out of document flow at all sizes */
@media (min-width: 1288px) {
  body.dodollm-standalone .dodollm-backdrop {
    position: fixed;
    inset: 0;
    z-index: 390;
    background: var(--dodollm-backdrop-tint);
    opacity: 0;
    pointer-events: none;
    transition: opacity 260ms cubic-bezier(0.55, 0.16, 0.22, 0.78);
  }

  body.dodollm-standalone .dodollm-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  body.dodollm-standalone .dodollm-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 400;
    width: min(360px, 90vw);
    height: 100dvh;
    max-height: 100dvh;
    transform: translateX(100%);
    pointer-events: none;
    overflow: hidden;
    transition: transform 260ms cubic-bezier(0.55, 0.16, 0.22, 0.78);
  }

  body.dodollm-standalone .dodollm-panel.is-open {
    transform: translateX(0);
    pointer-events: auto;
    transition-duration: var(--dodollm-panel-duration);
    transition-timing-function: var(--dodollm-panel-ease);
  }
}

@media (max-width: 960px) {
  .dodollm-panel {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
  }

  .dodollm-panel__input {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
  }
}

.dodollm-panel__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  box-sizing: border-box;
  min-height: 54px;
  padding: 12px 14px 12px 18px;
  border-bottom: 1px solid var(--ink-border, rgba(19, 17, 33, 0.1));
  overflow: visible;
}

@media (min-width: 961px) {
  .dodollm-panel__topbar {
    height: var(--desktop-nav-height);
    min-height: var(--desktop-nav-height);
    padding-block: 0;
    padding-inline: 1.75rem 14px;
  }
}

.dodollm-panel__label {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted, rgba(0, 0, 0, 0.6));
}

.dodollm-panel__brand {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dodollm-info-wrap {
  position: relative;
  display: inline-flex;
}

.dodollm-info-disclaimer {
  position: fixed;
  z-index: 500;
  width: min(248px, calc(100vw - 48px));
  padding: 12px 14px;
  border: 1px solid rgba(19, 17, 33, 0.12);
  border-radius: 6px;
  background: #f7f5f1;
  color: rgba(19, 17, 33, 0.72);
  font-size: 0.72rem;
  line-height: 1.45;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 20px rgba(19, 17, 33, 0.08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    visibility 180ms ease;
}

.dodollm-info-disclaimer::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 8px;
  height: 8px;
  background: #f7f5f1;
  border-left: 1px solid rgba(19, 17, 33, 0.12);
  border-top: 1px solid rgba(19, 17, 33, 0.12);
  transform: translateX(-50%) rotate(45deg);
}

.dodollm-info-disclaimer.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.dodollm-info-disclaimer__openai {
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
  vertical-align: baseline;
}

.dodollm-info-disclaimer__openai svg {
  width: 0.95em;
  height: 0.95em;
  flex-shrink: 0;
}

.dodollm-panel__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dodollm-panel__divider {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--ink-border, rgba(0, 0, 0, 0.1));
}

.dodollm-panel__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.45;
  cursor: pointer;
  transition: opacity 150ms ease;
}

.dodollm-panel__icon-btn:hover,
.dodollm-panel__icon-btn:focus-visible {
  opacity: 1;
}

.dodollm-panel__chat {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: transparent;
  padding: 20px 20px 0;
}

.dodollm-empty {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 24px;
}

.dodollm-panel__topbar,
.dodollm-panel__input-bar,
.dodollm-empty__mascot,
.dodollm-empty__greeting,
.dodollm-empty .dodollm-chip {
  transition:
    opacity var(--dodollm-enter-duration) var(--dodollm-enter-ease),
    transform var(--dodollm-enter-duration) var(--dodollm-enter-ease);
}

.dodollm-panel:not(.is-open) .dodollm-panel__topbar,
.dodollm-panel:not(.is-open) .dodollm-panel__input-bar,
.dodollm-panel:not(.is-open) .dodollm-empty__mascot,
.dodollm-panel:not(.is-open) .dodollm-empty__greeting,
.dodollm-panel:not(.is-open) .dodollm-empty .dodollm-chip {
  opacity: 0;
  transform: translateY(10px);
}

.dodollm-panel:not(.is-open) .dodollm-empty__mascot {
  transform: none;
}

.dodollm-empty__mascot {
  display: block;
  width: auto;
  max-width: 168px;
  height: auto;
  margin: 0 auto 20px;
  animation: dodollmMascotFloat 5000ms ease-in-out infinite;
  will-change: transform;
  transition: opacity var(--dodollm-enter-duration) var(--dodollm-enter-ease);
}

.dodollm-panel.is-open .dodollm-panel__topbar {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 120ms;
}

.dodollm-panel.is-open .dodollm-empty__mascot {
  opacity: 1;
  transition-delay: 240ms;
}

.dodollm-panel.is-open .dodollm-empty__greeting {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 340ms;
}

.dodollm-panel.is-open .dodollm-empty .dodollm-chip:nth-child(1) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 430ms;
}

.dodollm-panel.is-open .dodollm-empty .dodollm-chip:nth-child(2) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 510ms;
}

.dodollm-panel.is-open .dodollm-empty .dodollm-chip:nth-child(3) {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 590ms;
}

.dodollm-panel.is-open .dodollm-panel__input-bar {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 660ms;
}

@keyframes dodollmMascotFloat {
  0% {
    transform: translateY(0);
  }
  45% {
    transform: translateY(-5px);
  }
  60% {
    transform: translateY(-2px);
  }
  100% {
    transform: translateY(0);
  }
}

.dodollm-empty__greeting {
  margin: 0 0 16px;
  color: var(--ink-strong, var(--ink));
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.dodollm-messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 20px;
}

.dodollm-message-user {
  align-self: flex-end;
  max-width: 88%;
  padding: 12px 14px;
  border: 1px solid var(--ink-border, rgba(0, 0, 0, 0.1));
  border-radius: 10px;
  border-top-right-radius: 0;
  background: #fff;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(8px);
  animation: dodollmMessageIn 220ms ease-out forwards;
}

.dodollm-message-bot {
  padding: 0 0 0 2px;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.6;
}

.dodollm-message-bot--plain {
  white-space: pre-wrap;
}

.dodollm-message-bot__p {
  margin: 0;
}

.dodollm-message-bot__p + .dodollm-message-bot__list {
  margin-top: 0.65em;
}

.dodollm-message-bot__list {
  display: flex;
  flex-direction: column;
  gap: 0.55em;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dodollm-message-bot__list li {
  line-height: 1.5;
}

.dodollm-message-bot strong {
  font-weight: 600;
  color: var(--ink-strong, var(--ink));
}

.dodollm-message-bot--loading {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0;
}

.dodollm-thinking-text {
  color: var(--accent, #b03a39);
  font-weight: 500;
}

.dodollm-loader {
  position: relative;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  animation: dodollmLoaderRotate 1s infinite;
}

.dodollm-loader::before,
.dodollm-loader::after {
  position: absolute;
  left: 0;
  border-radius: 50%;
  content: "";
  display: block;
  height: 10px;
  width: 10px;
}

.dodollm-loader::before {
  top: 0;
  animation: dodollmLoaderBall1 1s infinite;
  background-color: #fff;
  box-shadow: 14px 0 0 var(--accent, #b03a39);
}

.dodollm-loader::after {
  top: 14px;
  animation: dodollmLoaderBall2 1s infinite;
  background-color: var(--accent, #b03a39);
  box-shadow: 14px 0 0 #fff;
}

.dodollm-work-cards {
  display: grid;
  gap: 10px;
}

.dodollm-work-card {
  display: block;
  overflow: hidden;
  border: 3px solid #fff;
  border-radius: 5px;
  background: #fff;
  color: inherit;
  text-decoration: none;
}

.dodollm-work-card__image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.dodollm-work-card__title {
  padding: 10px 12px;
  background: #fff;
  color: var(--ink-strong, var(--ink));
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.dodollm-signature-wrap {
  position: relative;
  display: inline-flex;
  align-self: flex-start;
  margin-top: 8px;
}

.dodollm-signature {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent, #b03a39);
  line-height: 0;
  cursor: help;
}

.dodollm-signature svg {
  display: block;
  width: 20px;
  height: auto;
  transform: rotate(0deg) scale(1);
  transform-origin: center center;
  transition: transform var(--dodollm-signature-spin-duration) var(--dodollm-signature-spin-ease);
  will-change: transform;
}

.dodollm-signature-wrap:hover .dodollm-signature svg,
.dodollm-signature-wrap:focus-within .dodollm-signature svg,
.dodollm-signature-wrap.is-open .dodollm-signature svg {
  transform: rotate(360deg) scale(1.05);
}

.dodollm-signature-tip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  z-index: 2;
  width: max-content;
  max-width: min(220px, calc(100vw - 120px));
  padding: 10px 12px;
  border: 1px solid rgba(19, 17, 33, 0.12);
  border-radius: 6px;
  background: #f7f5f1;
  color: rgba(19, 17, 33, 0.72);
  font-size: 0.72rem;
  line-height: 1.45;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 20px rgba(19, 17, 33, 0.08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%) translateX(4px);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    visibility 180ms ease;
}

.dodollm-signature-tip::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -5px;
  width: 8px;
  height: 8px;
  background: #f7f5f1;
  border-left: 1px solid rgba(19, 17, 33, 0.12);
  border-bottom: 1px solid rgba(19, 17, 33, 0.12);
  transform: translateY(-50%) rotate(45deg);
}

.dodollm-signature-wrap:hover .dodollm-signature-tip,
.dodollm-signature-wrap:focus-within .dodollm-signature-tip,
.dodollm-signature-wrap.is-open .dodollm-signature-tip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

.dodollm-cursor {
  display: inline-block;
  animation: dodollmCursorBlink 900ms steps(2, start) infinite;
}

.dodollm-divider {
  width: 100%;
  height: 1px;
  margin: 16px 0;
  border: 0;
  background: var(--ink-border, rgba(0, 0, 0, 0.1));
}

.dodollm-suggestions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dodollm-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px 10px;
  border: 0;
  border-radius: 8px;
  background-color: transparent;
  color: var(--ink-muted, rgba(0, 0, 0, 0.6));
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition:
    color 150ms ease,
    background-color 150ms ease;
}

.dodollm-chip:hover,
.dodollm-chip:focus-visible {
  color: var(--accent, #b03a39);
  background-color: rgba(176, 58, 57, 0.08);
}

.dodollm-chip::before {
  content: "↳";
  flex-shrink: 0;
  color: var(--accent, #b03a39);
  transition: color 150ms ease;
}

.dodollm-chip:hover::before,
.dodollm-chip:focus-visible::before {
  color: var(--accent, #b03a39);
}

.dodollm-panel__input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--ink-border, rgba(0, 0, 0, 0.1));
  background: transparent;
}

.dodollm-thinking-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 0;
  min-height: 40px;
  padding: 8px 16px 4px;
  background: transparent;
}

.dodollm-thinking-row[hidden] {
  display: none;
}

.dodollm-panel__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
}

.dodollm-panel__input::placeholder {
  color: var(--ink-muted, rgba(0, 0, 0, 0.6));
}

.dodollm-panel__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--ink-border, rgba(0, 0, 0, 0.1));
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition:
    background 150ms ease,
    color 150ms ease;
}

.dodollm-panel__send:hover,
.dodollm-panel__send:focus-visible {
  border-color: var(--accent, #b03a39);
  background: var(--accent, #b03a39);
  color: #fff;
}

@keyframes dodollmMessageIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dodollmCursorBlink {
  50% {
    opacity: 0;
  }
}

@keyframes dodollmLoaderRotate {
  0% {
    transform: rotate(0deg) scale(0.8);
  }

  50% {
    transform: rotate(360deg) scale(1.2);
  }

  100% {
    transform: rotate(720deg) scale(0.8);
  }
}

@keyframes dodollmLoaderBall1 {
  0% {
    box-shadow: 14px 0 0 var(--accent, #b03a39);
  }

  50% {
    box-shadow: 0 0 0 var(--accent, #b03a39);
    transform: translate(7px, 7px);
  }

  100% {
    box-shadow: 14px 0 0 var(--accent, #b03a39);
    transform: translate(0, 0);
  }
}

@keyframes dodollmLoaderBall2 {
  0% {
    box-shadow: 14px 0 0 #fff;
  }

  50% {
    box-shadow: 0 0 0 #fff;
    margin-top: -10px;
    transform: translate(7px, 7px);
  }

  100% {
    box-shadow: 14px 0 0 #fff;
    margin-top: 0;
    transform: translate(0, 0);
  }
}

@media (min-width: 1288px) and (max-width: 1600px) {
  :root {
    --dodollm-panel-width: min(360px, 90vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dodollm-empty__mascot {
    animation: none;
  }

  .dodollm-loader {
    animation: none;
  }

  .dodollm-loader::before,
  .dodollm-loader::after {
    animation: none;
  }

  .dodollm-signature-tip {
    transition: none;
  }

  .dodollm-signature svg {
    transition: none;
  }

  .dodollm-panel {
    transition-duration: 0.01ms !important;
  }

  .dodollm-backdrop {
    transition-duration: 0.01ms !important;
  }

  .dodollm-panel__topbar,
  .dodollm-panel__input-bar,
  .dodollm-empty__mascot,
  .dodollm-empty__greeting,
  .dodollm-empty .dodollm-chip {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
