/* The support chat: the button in the bottom corner (its lamp lit green while someone can answer), the
   chat that opens above it, and the same chat filling the Support page. Loaded on every page, the home
   page too, so it relies only on the colour and type variables both sheets define. */

.dk-root {
  --dk-bg: #1a1140;
  --dk-head: #221656;
  --dk-them: #2d2163;
  --dk-mine: var(--pink-press, #d3176c);
  --dk-input: #0f0928;
  --dk-edge: var(--line-strong, rgba(196, 176, 255, 0.26));
  --dk-gap: max(20px, env(safe-area-inset-right, 0px));
  font-family: var(--text);
  color: var(--moon);
}

.dk-root svg {
  display: block;
}

/* ------------------------------------------------------------ the lamp */

.dk-lamp {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #463a70;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.1);
}

.dk-lamp.dk-lit {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(79, 227, 161, 0.16), 0 0 10px 1px rgba(79, 227, 161, 0.6);
}

/* ------------------------------------------------------------ the button */

.dk-launch {
  position: fixed;
  right: var(--dk-gap);
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  z-index: 55;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 1px solid var(--dk-edge);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #3d2a86 0%, #241760 55%, #1a1140 100%);
  color: var(--moon);
  box-shadow: 0 16px 36px -14px rgba(0, 0, 0, 0.9), 0 0 0 4px rgba(20, 12, 46, 0.55);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.dk-launch:hover {
  border-color: rgba(240, 40, 127, 0.65);
}

.dk-launch:active {
  transform: scale(0.96);
}

.dk-launch:focus-visible,
.dk-root button:focus-visible,
.dk-root a:focus-visible,
.dk-log:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

.dk-launch-face,
.dk-launch-close {
  grid-area: 1 / 1;
  display: grid;
  place-items: center;
}

.dk-launch-face svg {
  width: 27px;
  height: 27px;
}

.dk-launch-close svg {
  width: 26px;
  height: 26px;
}

.dk-launch-close,
.dk-is-open .dk-launch-face {
  visibility: hidden;
}

.dk-is-open .dk-launch-close {
  visibility: visible;
}

/* The signal lens, set into the button's rim. */
.dk-launch .dk-lamp {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 14px;
  height: 14px;
  border: 2.5px solid #1d1342;
}

.dk-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--pink);
  color: #fff;
  font: 800 12px/22px var(--text);
  text-align: center;
  box-shadow: 0 0 0 3px var(--night);
}

/* ------------------------------------------------------------ the panel */

.dk-panel {
  position: fixed;
  right: var(--dk-gap);
  bottom: calc(max(20px, env(safe-area-inset-bottom, 0px)) + 72px);
  z-index: 56;
  display: flex;
  flex-direction: column;
  width: min(392px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 124px));
  overflow: hidden;
  border: 1px solid var(--dk-edge);
  border-radius: 20px;
  background: var(--dk-bg);
  box-shadow: 0 34px 90px -28px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(0, 0, 0, 0.3);
  transform-origin: calc(100% - 29px) calc(100% + 40px);
}

.dk-is-open .dk-panel:not([hidden]) {
  animation: dk-rise 0.16s ease-out;
}

@keyframes dk-rise {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}

.dk-head {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 16px 12px 14px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--dk-head), var(--dk-bg));
}

.dk-head-text {
  flex: 1;
  min-width: 0;
}

.dk-title {
  margin: 0 0 5px;
  font: 700 17px/1.2 var(--display);
  letter-spacing: -0.01em;
}

.dk-status {
  margin: 0;
  color: var(--haze);
  font-size: 13.5px;
  line-height: 1.45;
}

.dk-status .dk-lamp {
  display: inline-block;
  margin-right: 8px;
  vertical-align: 0;
}

.dk-hours-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
  padding: 0 4px;
  vertical-align: baseline;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--moon);
  font: 650 13px/1.2 var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(246, 241, 255, 0.35);
  text-underline-offset: 3px;
  cursor: pointer;
}

.dk-hours-toggle svg {
  width: 15px;
  height: 15px;
  transition: transform 0.15s ease;
}

.dk-hours-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.dk-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--haze);
  cursor: pointer;
}

.dk-icon svg {
  width: 19px;
  height: 19px;
}

.dk-icon:hover {
  background: rgba(196, 176, 255, 0.1);
  color: var(--moon);
}

/* The week's hours, in the reader's own time. */
.dk-hours {
  max-height: 46%;
  overflow-y: auto;
  padding: 12px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: #160e36;
  color: var(--haze);
  font-size: 13.5px;
  line-height: 1.45;
}

.dk-hours p {
  margin: 0 0 8px;
}


.dk-week {
  display: grid;
  gap: 3px;
  margin: 0 0 8px;
}

.dk-week div {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
}

.dk-week dt {
  color: var(--moon);
  font-weight: 650;
}

.dk-week dd {
  margin: 0;
}

.dk-week .dk-shut {
  color: var(--dim);
}

.dk-hours .dk-hours-zone {
  margin: 0;
  color: var(--dim);
  font-size: 12.5px;
}

/* ------------------------------------------------------------ messages */

.dk-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 14px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 176, 255, 0.25) transparent;
}

.dk-day {
  align-self: center;
  margin: 6px 0 0;
  color: var(--dim);
  font-size: 12.5px;
  font-weight: 650;
}

.dk-earlier {
  align-self: center;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: none;
  color: var(--haze);
  font: 650 13px/1.2 var(--text);
  cursor: pointer;
}

.dk-group {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.dk-mine {
  justify-content: flex-end;
}

.dk-face {
  flex: none;
  width: 28px;
  height: 28px;
  margin-bottom: 20px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--night-3);
}

.dk-face-mark svg {
  width: 28px;
  height: 28px;
}

.dk-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  max-width: 84%;
  min-width: 0;
}

.dk-mine .dk-stack {
  align-items: flex-end;
}

.dk-who {
  margin: 0 0 1px 3px;
  color: var(--haze);
  font-size: 12.5px;
  font-weight: 650;
}

.dk-bubble {
  max-width: 100%;
  padding: 9px 13px;
  border-radius: 18px;
  background: var(--dk-them);
  color: var(--moon);
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.dk-bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.dk-bubble a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dk-them .dk-bubble:last-of-type {
  border-bottom-left-radius: 6px;
}

.dk-mine .dk-bubble {
  background: var(--dk-mine);
  color: #fff;
}

.dk-mine .dk-bubble:last-of-type {
  border-bottom-right-radius: 6px;
}

.dk-bubble.dk-auto {
  border: 1px dashed rgba(196, 176, 255, 0.3);
  background: transparent;
  color: var(--haze);
}

.dk-bubble.dk-pending {
  opacity: 0.7;
}

.dk-picture {
  display: block;
  margin: -3px -7px 6px;
}

.dk-bubble .dk-picture:last-child {
  margin-bottom: -3px;
}

.dk-picture img {
  display: block;
  max-width: min(240px, 100%);
  max-height: 260px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.25);
}

.dk-time {
  margin: 1px 4px 0;
  color: var(--dim);
  font-size: 11.5px;
  font-weight: 600;
}

.dk-seen::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 0 6px 2px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
}

.dk-closed {
  align-self: center;
  max-width: 300px;
  margin: 6px 0 2px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--haze);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.dk-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 18px 8px;
  color: var(--haze);
  font-size: 13px;
}

.dk-dots {
  display: inline-flex;
  gap: 3px;
}

.dk-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--haze);
  animation: dk-dot 1.2s infinite ease-in-out;
}

.dk-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.dk-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes dk-dot {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: none;
  }
  30% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* Signed out: how to start, in a panel only as tall as that. */
.dk-panel.dk-guest {
  height: auto;
}

.dk-guest .dk-log {
  flex: none;
}

.dk-card {
  margin: 4px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(45, 33, 99, 0.45);
  color: var(--haze);
  font-size: 14.5px;
  line-height: 1.5;
}

.dk-card p {
  margin: 0 0 12px;
}

.dk-card .dk-card-lead {
  margin-bottom: 6px;
  color: var(--moon);
  font: 700 17px/1.3 var(--display);
}

.dk-card .dk-card-small {
  margin: 12px 0 0;
  font-size: 13px;
}

.dk-card a:not(.dk-button) {
  color: var(--moon);
}

.dk-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--pink);
  color: #fff;
  font: 750 15px/1 var(--text);
  text-decoration: none;
}

.dk-button:hover {
  background: var(--pink-press);
}

/* ------------------------------------------------------------ writing */

.dk-compose {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  background: #160e36;
}

.dk-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.dk-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 140px;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid var(--dk-edge);
  border-radius: 14px;
  background: var(--dk-input);
  color: var(--moon);
  font: 15px/1.4 var(--text);
  resize: none;
}

.dk-input::placeholder {
  color: var(--dim);
}

.dk-input:focus {
  border-color: rgba(240, 40, 127, 0.7);
  outline: none;
}

.dk-attach,
.dk-send {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
}

.dk-attach {
  background: none;
  color: var(--haze);
}

.dk-attach:hover {
  background: rgba(196, 176, 255, 0.1);
  color: var(--moon);
}

.dk-send {
  background: var(--pink);
  color: #fff;
}

.dk-send:hover {
  background: var(--pink-press);
}

.dk-send:disabled {
  opacity: 0.6;
  cursor: default;
}

.dk-attach svg,
.dk-send svg {
  width: 21px;
  height: 21px;
}

.dk-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  padding: 6px 6px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--haze);
  font-size: 13px;
}

.dk-chip img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
}

.dk-chip span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dk-error {
  margin: 0 0 8px;
  color: #ffb3c0;
  font-size: 13.5px;
  font-weight: 600;
}

.dk-dropping {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(240, 40, 127, 0.35), 0 34px 90px -28px rgba(0, 0, 0, 0.95);
}

/* ------------------------------------------------------------ an answer arrives while closed */

.dk-peek {
  position: fixed;
  right: var(--dk-gap);
  bottom: calc(max(20px, env(safe-area-inset-bottom, 0px)) + 72px);
  z-index: 55;
  display: flex;
  align-items: flex-start;
  width: min(320px, calc(100vw - 40px));
  border: 1px solid var(--dk-edge);
  border-radius: 18px 18px 6px 18px;
  background: var(--dk-them);
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, 0.9);
  animation: dk-rise 0.2s ease-out;
}

.dk-peek-open {
  display: flex;
  flex: 1;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 12px 4px 12px 14px;
  border: 0;
  border-radius: 18px 0 6px 18px;
  background: none;
  color: var(--moon);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dk-peek-open .dk-face {
  margin: 0;
}

.dk-peek-text {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 14px;
  line-height: 1.4;
}

.dk-peek-text span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  color: var(--haze);
  overflow-wrap: anywhere;
}

.dk-peek-x {
  margin: 6px 6px 0 0;
}

/* ------------------------------------------------------------ on the Support page */

.dk-embedded .dk-panel {
  position: relative;
  right: auto;
  bottom: auto;
  z-index: auto;
  width: 100%;
  height: clamp(520px, calc(100vh - 210px), 780px);
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.9);
  animation: none;
}

/* ------------------------------------------------------------ phones */

@media (max-width: 560px) {
  .dk-root:not(.dk-embedded) .dk-panel {
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .dk-is-open:not(.dk-embedded) .dk-launch {
    display: none;
  }

  html.dk-locked,
  html.dk-locked body {
    overflow: hidden;
  }

  .dk-head {
    padding-top: max(16px, env(safe-area-inset-top, 0px));
  }

  .dk-launch {
    width: 54px;
    height: 54px;
  }

  .dk-embedded .dk-panel {
    height: calc(100dvh - 150px);
    min-height: 460px;
    border-radius: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dk-root *,
  .dk-root *::before {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .dk-root:not(.dk-embedded) {
    display: none;
  }
}
