/* Nucleo, the DACY identity. The artwork stays transparent at every size. */
.dcai-symbol {
  --dcai-size: 44px;
  --dcai-red: #ed3547;
  --dcai-coral: #ff8877;
  --dcai-peach: #ffd1b1;
  --dcai-deep: #b81741;
  --dcai-blue: #449ee9;
  --dcai-ice: #c0eaff;
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: var(--dcai-size);
  height: var(--dcai-size);
  vertical-align: middle;
  isolation: isolate;
}
[data-theme="dark"] .dcai-symbol {
  --dcai-red: #ff485c;
  --dcai-coral: #ff9b86;
  --dcai-peach: #ffe0c3;
  --dcai-deep: #d32051;
  --dcai-blue: #68beff;
  --dcai-ice: #d4f1ff;
}
.dcai-size-nav { --dcai-size: 20px; }
.dcai-size-sm { --dcai-size: 26px; }
.dcai-size-md { --dcai-size: 44px; }
.dcai-size-lg { --dcai-size: 64px; }
.dacy-pill .dcai-symbol { display: inline-block; }
.dcai-symbol > span { position: absolute; display: block; pointer-events: none; }
.dcai-symbol .dcai-aura {
  inset: 13%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 32% 67%, var(--dcai-coral), transparent 66%), radial-gradient(ellipse at 78% 20%, var(--dcai-blue), transparent 62%);
  filter: blur(calc(var(--dcai-size) * .11));
  opacity: .3;
  transform: scale(1.08);
}
.dcai-nucleo .dcai-body {
  inset: 12% 13% 10% 12%;
  border-radius: 45% 55% 54% 46% / 52% 42% 58% 48%;
  background: radial-gradient(ellipse at 29% 25%, var(--dcai-peach) 0, var(--dcai-coral) 23%, transparent 52%), radial-gradient(ellipse at 38% 62%, var(--dcai-red) 4%, var(--dcai-deep) 85%);
  box-shadow: inset calc(var(--dcai-size) * -.03) calc(var(--dcai-size) * -.02) calc(var(--dcai-size) * .085) color-mix(in srgb, var(--dcai-deep) 65%, transparent);
  animation: dcai-core-breathe 6s ease-in-out infinite;
}
.dcai-nucleo .dcai-weave {
  inset: 11% 11% 16% 40%;
  border-radius: 33% 67% 60% 40% / 48% 39% 61% 52%;
  background: linear-gradient(150deg, var(--dcai-ice), var(--dcai-blue) 33%, color-mix(in srgb, var(--dcai-blue) 24%, transparent) 68%, transparent 78%);
  -webkit-mask: radial-gradient(ellipse at 1% 67%, transparent 0 48%, #000 52%);
  mask: radial-gradient(ellipse at 1% 67%, transparent 0 48%, #000 52%);
  transform: rotate(-15deg);
  animation: dcai-core-fold 6s ease-in-out infinite;
}
.dcai-nucleo .dcai-light {
  inset: 18% 29% 47% 19%;
  border-radius: 70% 30% 80% 20% / 65% 30% 70% 35%;
  background: linear-gradient(158deg, color-mix(in srgb, var(--dcai-peach) 66%, transparent), transparent 67%);
  filter: blur(calc(var(--dcai-size) * .013));
  transform: rotate(-14deg);
}
.dcai-nucleo[data-state="thinking"] .dcai-body { animation: dcai-core-think 1.8s ease-in-out infinite; }
.dcai-nucleo[data-state="thinking"] .dcai-weave { animation: dcai-core-fold-think 1.8s ease-in-out infinite; }
.dcai-nucleo[data-state="thinking"] .dcai-aura { opacity: .48; }
@keyframes dcai-core-breathe { 0%,100% { transform: scale(.97) rotate(-7deg); } 50% { transform: scale(1.02) rotate(3deg); border-radius: 52% 48% 46% 54% / 47% 55% 45% 53%; } }
@keyframes dcai-core-fold { 0%,100% { transform: rotate(-15deg) scale(.99); } 50% { transform: rotate(-7deg) scale(1.035); } }
@keyframes dcai-core-think { 0%,100% { transform: scale(.94,1.03) rotate(-9deg); } 50% { transform: scale(1.04,.96) rotate(9deg); border-radius: 57% 43% 46% 54% / 44% 60% 40% 56%; } }
@keyframes dcai-core-fold-think { 0%,100% { transform: rotate(-22deg) translateY(-1%); } 50% { transform: rotate(5deg) translateY(4%); } }

/* Floating conversation. The same placement applies while a lesson is open. */
#dacy-root .dacy-widget,
body.bench-mode #dacy-root .dacy-widget {
  position: fixed;
  inset: auto 24px 96px auto;
  width: 416px;
  max-width: calc(100vw - 32px);
  height: min(610px, calc(100vh - 120px));
  height: min(610px, calc(100dvh - 120px));
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  transform-origin: bottom right;
  z-index: 45;
}
#dacy-root .dacy-widget[hidden] { display: none; }
#dacy-root .dw-hdr { flex-shrink: 0; padding: 15px 17px 15px 12px; gap: 10px; }
#dacy-root .dw-hdr > div { min-width: 0; gap: 2px; }
#dacy-root .dw-hdr b { font-size: 17px; letter-spacing: -.02em; }
#dacy-root .dw-hdr .small { font-size: 12px; line-height: 1.4; }
#dacy-root .dw-hdr .icon-btn { border: 0; width: 34px; height: 34px; background: transparent; flex-shrink: 0; }
#dacy-root .dw-hdr .icon-btn:hover { background: var(--surface2); }
#dacy-root .dw-team-icon { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--text2); }
#dacy-root .dw-ctx { white-space: normal; font-family: var(--font); text-transform: none; letter-spacing: 0; font-size: 12px; line-height: 1.45; padding: 9px 18px; }
#dacy-root .dw-thread { min-height: 76px; padding: 20px 18px 16px; gap: 17px; overscroll-behavior: contain; scrollbar-width: thin; }
#dacy-root .dw-thread .msg { max-width: 100%; background: transparent; border: 0; border-radius: 0; padding: 0; font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
#dacy-root .dw-thread .msg.me { max-width: 88%; padding: 10px 13px; background: var(--surface2); border-radius: 16px 16px 5px 16px; color: var(--text); }
#dacy-root .dw-thread .msg .chips { gap: 6px; }
#dacy-root .dw-thread .chip { white-space: normal; height: auto; min-height: 30px; padding: 6px 10px; font-size: 12px; line-height: 1.4; }
#dacy-root .dw-thread .dw-thinking { display: flex; flex-direction: row; align-items: center; gap: 7px; color: var(--text2); font-size: 12px; }
#dacy-root .dw-sugg { flex-shrink: 0; flex-wrap: wrap; gap: 7px; overflow: visible; padding: 4px 18px 14px; }
#dacy-root .dw-sugg .chip { flex: 0 1 auto; max-width: 100%; height: auto; min-height: 30px; padding: 6px 10px; white-space: normal; line-height: 1.4; text-align: left; background: var(--surface); }
#dacy-root .dw-sugg .chip:hover { background: var(--surface2); }
#dacy-root .dw-input { flex-shrink: 0; margin: 0 14px 9px; padding: 5px 5px 5px 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); gap: 7px; }
#dacy-root .dw-input:focus-within { border-color: var(--text2); outline: 2px solid var(--text2); outline-offset: 2px; }
#dacy-root .dw-input input { min-width: 0; padding: 0; font-size: 14px; height: 38px; }
/* The rounded composer owns the input's focus ring; other controls keep theirs. */
#dacy-root .dw-input input:focus-visible { outline: none; }
#dacy-root .dw-input input::placeholder { color: var(--text3); opacity: 1; }
#dacy-root .dw-send { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; height: 36px; width: 36px; border-radius: 10px; background: var(--text); color: var(--surface); }
#dacy-root .dw-send svg { width: 18px; height: 18px; }
#dacy-root .dw-send:disabled { opacity: .4; cursor: default; }
#dacy-root .dw-foot { flex-shrink: 0; padding: 0 20px 14px; font-size: 11px; line-height: 1.45; }
#dacy-root .dw-foot.chk { margin: 0; text-align: left; }
#dacy-root .dw-foot[hidden] { display: none; }
#dacy-root .dacy-launcher-wrap { right: 24px; bottom: 24px; }
#dacy-root .dacy-launcher { display: inline-flex; align-items: center; gap: 7px; height: 54px; padding: 4px 17px 4px 5px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-family: var(--display); font-size: 13px; font-weight: 600; }
#dacy-root .dacy-launcher:hover { border-color: var(--text3); }
#dacy-root .dacy-launcher-close { display: flex; margin-left: 4px; color: var(--text2); }
#dacy-root .dacy-launcher-close svg { width: 16px; height: 16px; }
/* dacy.ui soon: DACY is coming, a person of the team answers meanwhile. */
#dacy-root .dacy-soon-tag { display: inline-flex; align-items: center; height: 22px; margin-left: 2px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface2); color: var(--text2); font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
#dacy-root .dw-thread .msg.dw-soon { gap: 6px; }
#dacy-root .dw-thread .msg.dw-soon span:first-child { font-weight: 600; color: var(--text); }
#dacy-root :is(button, a, input):focus-visible { outline: 2px solid var(--text2); outline-offset: 3px; }

@media (max-width: 768px) {
  #dacy-root .dacy-widget,
  body.bench-mode #dacy-root .dacy-widget {
    inset: auto 12px calc(12px + env(safe-area-inset-bottom)) 12px;
    width: auto;
    max-width: none;
    height: min(680px, calc(100vh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
    height: min(680px, calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
    border: 1px solid var(--line);
    border-radius: 20px;
    z-index: 70;
  }
  #dacy-root .dw-input input { font-size: 16px; }
  #dacy-root .dw-hdr .icon-btn { width: 44px; height: 44px; }
  #dacy-root .dw-send { width: 44px; height: 44px; }
  #dacy-root .dw-sugg { gap: 6px; padding: 0 14px 10px; }
  #dacy-root .dw-sugg .chip { min-height: 36px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .dcai-symbol > span { animation: none !important; }
  #dacy-root .dacy-widget { transition: none; }
}

/* The guided path (js/guide.js): topics, questions, an approved answer with the video. */
#dacy-root .dw-guide { padding-top: 6px; }
#dacy-root .dw-g { display: flex; flex-direction: column; gap: 12px; }
#dacy-root .dw-g-intro { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text2); }
#dacy-root .dw-g-title { margin: 2px 0 0; font-family: var(--display); font-size: 17px; letter-spacing: -.01em; }
#dacy-root .dw-g-crumb { margin-bottom: -6px; font-size: 10.5px; line-height: 1.6; letter-spacing: .14em; }
#dacy-root .dw-g-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
#dacy-root .dw-g-topic, #dacy-root .dw-g-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); text-align: left; font: inherit; cursor: pointer; }
#dacy-root .dw-g-topic:hover, #dacy-root .dw-g-item:hover { border-color: var(--text3); }
#dacy-root .dw-g-topic > span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
#dacy-root .dw-g-topic b { font-family: var(--display); font-size: 14.5px; }
#dacy-root .dw-g-item > span { font-size: 14px; line-height: 1.45; }
#dacy-root .dw-g-topic svg, #dacy-root .dw-g-item svg { flex-shrink: 0; width: 16px; height: 16px; color: var(--text3); }
#dacy-root .dw-g-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--text2); font: inherit; font-size: 13px; cursor: pointer; }
#dacy-root .dw-g-back svg { width: 15px; height: 15px; }
#dacy-root .dw-g-q { margin: 0; font-family: var(--display); font-size: 17px; line-height: 1.35; letter-spacing: -.01em; }
#dacy-root .dw-g-a { margin: 0; font-size: 14px; line-height: 1.65; }
#dacy-root .dw-g-links { display: flex; flex-wrap: wrap; gap: 8px; }
#dacy-root .dw-g-links .chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
#dacy-root .dw-g-links svg { width: 14px; height: 14px; }
#dacy-root .dw-g-err { margin: 0; color: var(--red); }
#dacy-root .dw-g-help { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--hair); }
#dacy-root .dw-g-write { align-self: flex-start; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 13.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* The panel of the kit (dacy.ui "kit", js/kit.js). */
#dacy-root .dw-kit .dw-g-links { margin-top: 10px; }
#dacy-root .dw-kit .chip svg { width: 14px; height: 14px; }

/* The replies of the DACOS team (js/team-replies.js). The badge of the DACY
   launcher and of the DACY item of the tab bar has the look of the badge of
   the messages (notifications.css). */
#dacy-root .dacy-launcher { position: relative; }
.dacy-badge { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid var(--surface); border-radius: 10px; background: var(--red); color: #fff; font: 600 10px/1 var(--font); pointer-events: none; }
.dacy-badge[hidden] { display: none; }
.tabbar .tab-dacy { position: relative; }
.tabbar .tab-dacy .dacy-badge { top: -16px; right: auto; left: calc(50% + 8px); }
/* The block at the top of the panel: one row, or the cards. Open, it gives
   way first when the panel is short, so the field never leaves the panel. */
#dacy-root .dw-replies { flex: 0 0 auto; display: flex; flex-direction: column; min-height: 46px; border-bottom: 1px solid var(--hair); }
#dacy-root .dw-replies.open { flex: 0 1 auto; max-height: 50%; }
#dacy-root .dw-replies-bar { flex-shrink: 0; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 9px 16px 9px 14px; text-align: left; font-size: 13.5px; font-weight: 600; line-height: 1.35; color: var(--text); }
#dacy-root button.dw-replies-bar:hover { background: var(--surface2); }
#dacy-root .dw-replies-bar:focus-visible { outline-offset: -3px; }
#dacy-root .dw-replies-icon { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 9px; background: var(--blue-soft); color: var(--blue); }
#dacy-root .dw-replies-icon svg { width: 15px; height: 15px; }
#dacy-root .dw-replies-title { flex: 1; min-width: 0; }
#dacy-root .dw-replies-chev { flex-shrink: 0; color: var(--text3); transition: transform .18s ease; }
#dacy-root .dw-replies.open .dw-replies-chev { transform: rotate(180deg); }
#dacy-root .dw-replies-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; display: flex; flex-direction: column; gap: 10px; padding: 2px 14px 14px; }
#dacy-root .dw-reply { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
#dacy-root .dw-reply.is-new { border-color: var(--red-line); }
#dacy-root .dw-reply-top { display: flex; align-items: center; gap: 8px; }
#dacy-root .dw-reply-label { font-size: 11px; font-weight: 600; color: var(--text2); }
#dacy-root .dw-reply-new { margin-left: auto; font-size: 9px; color: var(--red); border: 1px solid var(--red-line); padding: 2px 5px; border-radius: 4px; }
#dacy-root .dw-reply-q { margin: 0; padding: 1px 0 1px 10px; border-left: 2px solid var(--line); font-size: 13px; line-height: 1.55; color: var(--text2); overflow-wrap: anywhere; }
#dacy-root .dw-reply-a { margin: 0; font-size: 14px; line-height: 1.65; color: var(--text); overflow-wrap: anywhere; }
#dacy-root .dw-reply-sign { margin: 0; font-size: 12px; line-height: 1.45; color: var(--text2); }
#dacy-root .dw-replies-err { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#dacy-root .dw-replies-err p { margin: 0; color: var(--red); }
@media (max-width: 768px) {
  #dacy-root .dw-replies, #dacy-root .dw-replies-bar { min-height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  #dacy-root .dw-replies-chev { transition: none; }
}
