/* Unays Guide v6 additions. Load after guide-v3.css. */
.ug-root {
  --ug-detail: #315f55;
  --ug-active: #17594f;
  --ug-on-active: #fff;
  --ug-code-bg: #132a2b;
  --ug-code-fg: #d2f5e5;
  --ug-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

body[data-theme="dark"] .ug-root {
  --ug-detail: #b0ddcf;
  --ug-active: #b4ebd8;
  --ug-on-active: #13342c;
}

/* The base header class also matches the SVG head group. */
.ug-root svg g.ug-head {
  display: inline;
  position: static;
  padding: 0;
  background: none;
}

/* Blinking lives on the individual eyes so it never scales the gaze offset. */
.ug-root .ug-eyes,
.ug-root .ug-glasses,
.ug-root:is([data-state="thinking"], [data-state="looking"]) .ug-figure .ug-eyes {
  translate: var(--ug-look-x, 0) var(--ug-look-y, 0);
  animation: none;
}

.ug-root .ug-eyes ellipse {
  transform-box: fill-box;
  transform-origin: center;
  animation: ug-v6-blink 5.1s ease-in-out infinite;
}

@keyframes ug-v6-blink {
  0%, 90%, 95%, 100% { transform: scaleY(1); }
  92.5% { transform: scaleY(.1); }
}

.ug-root[data-state="idle"] .ug-figure .ug-torso {
  animation: ug-v6-breathe 4.2s ease-in-out infinite;
}

.ug-root[data-state="idle"] .ug-figure g.ug-head {
  animation: ug-v6-head-rest 4.2s ease-in-out infinite;
}

@keyframes ug-v6-breathe {
  50% { scale: 1.012 1.025; }
}

@keyframes ug-v6-head-rest {
  50% { translate: 0 -1.2px; rotate: 1.4deg; }
}

.ug-root :is(.ug-zzz, .ug-glasses, .ug-headset, .ug-code-logo) { display: none; }

.ug-root[data-state="sleeping"] .ug-eyes ellipse {
  animation: none;
  transform: scaleY(.12);
}

.ug-root[data-state="sleeping"] .ug-figure .ug-torso {
  animation: ug-v6-breathe 5.8s ease-in-out infinite;
}

.ug-root[data-state="sleeping"] .ug-zzz { display: inline; }

.ug-root .ug-zzz text {
  fill: #246c63;
  font: 700 8px/1 "DM Sans", system-ui, sans-serif;
}

.ug-root[data-state="sleeping"] .ug-zzz text {
  animation: ug-v6-doze 3.3s ease-out infinite both;
}

.ug-root .ug-zzz text:nth-child(2) { animation-delay: -2.2s; }
.ug-root .ug-zzz text:nth-child(3) { animation-delay: -1.1s; }

/* The launcher has a tighter viewBox than the standing character. */
.ug-root .ug-avatar .ug-zzz { transform: translate(-12px, 15px) scale(.95); }

@keyframes ug-v6-doze {
  0%, 100% { opacity: 0; }
  0% { translate: -1px 4px; }
  30% { opacity: .95; }
  85%, 100% { translate: 2px -3px; }
}

.ug-root[data-state="celebrating"] .ug-body {
  animation: ug-v6-cheer .8s var(--ug-ease) both;
}

.ug-root[data-state="celebrating"] .ug-arm-back { rotate: 137deg; }
.ug-root[data-state="celebrating"] .ug-arm-front { rotate: -137deg; }
.ug-root[data-state="celebrating"] .ug-arm-back .ug-forearm { rotate: 16deg; }
.ug-root[data-state="celebrating"] .ug-arm-front .ug-forearm { rotate: -16deg; }

@keyframes ug-v6-cheer {
  0%, 100% { translate: 0 0; scale: 1; }
  18% { translate: 0 2px; scale: 1.06 .94; }
  48% { translate: 0 -12px; scale: .97 1.04; }
  77% { translate: 0 0; scale: 1.035 .97; }
}

/* Fallback coordinates mirror the character joint layout in the base sheet. */
.ug-root .ug-character { anchor-name: --ug-v6-character; }
.ug-root .ug-sparkles {
  display: none;
  position: absolute;
  right: calc(100% + 52px);
  bottom: 116px;
  width: 0;
  height: 0;
  pointer-events: none;
}

.ug-open.ug-cheer[data-state="celebrating"] .ug-sparkles { display: block; }

.ug-root .ug-sparkles i {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ug-dot-color, #e8705a);
  opacity: 0;
}

.ug-sparkles i:nth-child(1) { --ug-dx: -32px; --ug-dy: -12px; --ug-delay: 0ms; }
.ug-sparkles i:nth-child(2) { --ug-dx: -22px; --ug-dy: -29px; --ug-delay: 65ms; --ug-dot-color: #37978b; }
.ug-sparkles i:nth-child(3) { --ug-dx: -7px; --ug-dy: -38px; --ug-delay: 30ms; --ug-dot-color: #d6a144; }
.ug-sparkles i:nth-child(4) { --ug-dx: 11px; --ug-dy: -36px; --ug-delay: 95ms; }
.ug-sparkles i:nth-child(5) { --ug-dx: 25px; --ug-dy: -24px; --ug-delay: 50ms; --ug-dot-color: #37978b; }
.ug-sparkles i:nth-child(6) { --ug-dx: 35px; --ug-dy: -7px; --ug-delay: 120ms; --ug-dot-color: #d6a144; }

.ug-open.ug-cheer[data-state="celebrating"] .ug-sparkles i {
  animation: ug-v6-burst .72s var(--ug-ease) var(--ug-delay) both;
}

@keyframes ug-v6-burst {
  0% { opacity: 0; transform: scale(.2); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--ug-dx), var(--ug-dy)) scale(.55); }
}

/* Developer character and terminal header. Scope the header to HTML because
   the SVG uses the same class for the character's head. */
.ug-root.ug-dev :is(.ug-hoodie, .ug-sleeve) { fill: #253744; }
.ug-root.ug-dev :is(.ug-hood, .ug-cuff) { fill: #394f5c; }
.ug-root.ug-dev :is(.ug-glasses, .ug-headset) {
  display: inline;
  fill: none;
  stroke: #172e34;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ug-root.ug-dev .ug-headset :is(rect, circle) { fill: #364e54; }
.ug-root.ug-dev .ug-headset circle { stroke: #13272b; }
.ug-root.ug-dev .ug-torso .ug-logo { display: none; }
.ug-root.ug-dev text.ug-code-logo {
  display: inline;
  fill: #b4f5db;
  font: 700 8px/1 var(--ug-mono);
}

.ug-root.ug-dev header.ug-head {
  color: var(--ug-code-fg);
  background: linear-gradient(115deg, #12292b, #243d3b);
}
.ug-root.ug-dev header.ug-head h2 { color: #eefaf4; }
.ug-root.ug-dev header.ug-head p {
  color: #b9e8d4;
  font: 500 .78rem/1.4 var(--ug-mono);
  opacity: 1;
}
.ug-root.ug-dev header .ug-head-controls :is(button, select) {
  color-scheme: dark;
  color: #ecfaf5;
  background: #2a4542;
  border-color: #688a81;
}

/* Shared panel details. Keep long answers, translated labels and snippets
   inside the panel grid while letting the answer area scroll independently. */
.ug-root .ug-panel { grid-template-columns: minmax(0, 1fr); }
.ug-root .ug-scroll { min-width: 0; overscroll-behavior: contain; }
.ug-root :is(.ug-follow, .ug-jump, .ug-history, .ug-devtools) {
  min-width: 0;
  margin-block-start: 12px;
  overflow-wrap: anywhere;
}
.ug-root .ug-bubble-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 10px;
  margin-block-start: 8px;
}
.ug-root .ug-bubble-foot .ug-link { margin: 0; }
.ug-root .ug-copy {
  margin-inline-start: auto;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--ug-border);
  border-radius: 999px;
  color: var(--ug-detail);
  background: transparent;
  font-size: .78rem;
}
.ug-root :is(.ug-copy, .ug-history-list button):hover { background: var(--ug-mint); }

.ug-root.ug-touring .ug-scroll {
  display: flex;
  flex-direction: column;
  scroll-padding-block-end: 4rem;
}
.ug-root.ug-touring .ug-scroll > * { flex: none; }
.ug-root .ug-tourbar {
  position: sticky;
  bottom: 0;
  z-index: 1;
  order: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  margin-block-start: 8px;
  padding: 7px 8px;
  border: 1px solid var(--ug-border);
  border-radius: 12px;
  background: var(--ug-paper);
  box-shadow: 0 -3px 12px #173c3012;
}
.ug-root .ug-tour-step { color: var(--ug-detail); font-size: .78rem; font-weight: 700; }
.ug-root .ug-tourbar button { min-height: 32px; padding: 4px 9px; font-size: .78rem; }
.ug-root .ug-tourbar button:disabled { opacity: .55; cursor: default; }
.ug-tour-target {
  outline: 3px solid #529985;
  outline-offset: 4px;
  animation: ug-v6-tour 2.4s ease-in-out infinite;
}
@keyframes ug-v6-tour {
  50% { outline-color: #85bba7; outline-offset: 6px; }
}

.ug-root .ug-follow > p,
.ug-root .ug-devtools h3 {
  color: var(--ug-detail);
  font-size: .82rem;
  font-weight: 700;
  margin: 0 0 5px;
}
.ug-root .ug-follow-list { gap: 5px; }
.ug-root .ug-follow-list button {
  min-height: 32px;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ug-mint);
  text-align: start;
  font-size: .8rem;
  white-space: normal;
}

.ug-root :is(.ug-jump-filter, .ug-dev-endpoint) {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 6px 10px;
  color: var(--ug-ink);
  border: 1px solid var(--ug-border);
  border-radius: 10px;
  background: var(--ug-paper);
}
.ug-root .ug-jump-list {
  display: grid;
  gap: 2px;
  list-style: none;
  margin: 5px 0 0;
  padding: 0;
}
.ug-root .ug-jump-list a,
.ug-root .ug-history-list button {
  display: block;
  padding: 6px 9px;
  border-radius: 8px;
  color: var(--ug-detail);
  font-size: .84rem;
  text-align: start;
}
.ug-root .ug-jump-list a { text-decoration: none; }
.ug-root .ug-jump-list a:hover { text-decoration: underline; }
.ug-root .ug-jump-list a[aria-current="page"] {
  background: var(--ug-mint);
  border-inline-start: 3px solid var(--ug-active);
  font-weight: 750;
}
.ug-root .ug-history { border-block-start: 1px solid var(--ug-border); }
.ug-root .ug-history summary {
  cursor: pointer;
  padding-block: 8px;
  color: var(--ug-detail);
  font-size: .82rem;
  font-weight: 700;
}
.ug-root .ug-history-list { list-style: decimal; margin: 0; padding-inline-start: 1.6rem; }
.ug-root .ug-history-list li::marker { color: var(--ug-detail); font-size: .78rem; }
.ug-root .ug-history-list button { border: 0; background: transparent; max-width: 100%; }

.ug-root .ug-devtools {
  padding: 10px;
  border: 1px solid var(--ug-border);
  border-radius: 14px;
  background: var(--ug-mint);
}
.ug-root .ug-dev-row { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.ug-root .ug-dev-row label { min-width: 0; font-size: .78rem; }
.ug-root .ug-dev-endpoint { margin-block-start: 3px; font: 500 .78rem/1.35 var(--ug-mono); }
.ug-root .ug-dev-langs {
  display: inline-flex;
  justify-self: start;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--ug-border);
  border-radius: 10px;
  background: var(--ug-paper);
}
.ug-root .ug-dev-langs button {
  min-height: 32px;
  padding: 4px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font: 600 .76rem/1.35 var(--ug-mono);
}
.ug-root .ug-dev-langs button[aria-pressed="true"] {
  background: var(--ug-active);
  color: var(--ug-on-active);
}
.ug-root pre.ug-dev-code {
  min-width: 0;
  max-width: 100%;
  max-height: 220px;
  margin: 9px 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 10px;
  background: var(--ug-code-bg);
  color: var(--ug-code-fg);
  font: 500 .78rem/1.55 var(--ug-mono);
  text-align: start;
}
.ug-root .ug-dev-code code {
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
  font: inherit;
  color: inherit;
  background: transparent;
}
.ug-root .ug-dev-result { margin: 6px 0 0; font: 600 .78rem/1.5 var(--ug-mono); }
.ug-root .ug-dev-result:empty { display: none; }
.ug-root .ug-dev-result.is-up { color: #145d3d; }
.ug-root .ug-dev-result.is-down { color: #933c2c; }
body[data-theme="dark"] .ug-root .ug-dev-result.is-up { color: #99e4b9; }
body[data-theme="dark"] .ug-root .ug-dev-result.is-down { color: #ffb29e; }

.ug-root .ug-tools { flex-wrap: wrap; gap: 5px; }
.ug-root .ug-tools button { min-width: 0; max-width: 100%; white-space: normal; }
.ug-root :is(.ug-history summary, .ug-dev-code):focus-visible {
  outline: 3px solid #408d79;
  outline-offset: 2px;
}
.ug-selecting :is(.ug-follow, .ug-history, .ug-devtools, .ug-jump, .ug-tourbar) { display: none; }

@media (max-width: 600px), (max-height: 600px) {
  .ug-root .ug-sparkles { right: auto; left: 45px; bottom: calc(100% + 33px); }
  .ug-root .ug-jump-filter { font-size: 16px; }
}

@supports (position-anchor: --ug-v6-character) {
  .ug-root .ug-sparkles {
    position-anchor: --ug-v6-character;
    inset: auto;
    left: anchor(center);
    top: anchor(30%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ug-root :is(.ug-eyes ellipse, .ug-body, .ug-torso, g.ug-head, .ug-zzz text, .ug-sparkles i),
  .ug-tour-target { animation: none !important; }

  .ug-root :is(.ug-eyes, .ug-glasses) { translate: none !important; }
  .ug-root .ug-sparkles { visibility: hidden; }
}

/* Website tour. The progress meter sits inside the header so the existing
   scroll area keeps its own grid row, including on small screens. */
.ug-root header.ug-head { position: relative; }
.ug-root .ug-site-progress {
  position: absolute;
  inset: 0 0 auto;
  width: 100%;
  height: 4px;
  border: 0;
  appearance: none;
  background: var(--ug-mint);
  color: var(--ug-active);
  pointer-events: none;
}
.ug-site-progress::-webkit-progress-bar { background: var(--ug-mint); }
.ug-site-progress::-webkit-progress-value { background: var(--ug-active); }
@supports selector(progress::-moz-progress-bar) {
  .ug-site-progress::-moz-progress-bar { background: var(--ug-active); }
}
.ug-root .ug-stop {
  display: block;
  margin-block-end: .35rem;
  color: var(--ug-detail);
  font-weight: 700;
}
.ug-root .ug-nudge button {
  display: block;
  max-width: 100%;
  white-space: normal;
  text-align: start;
}
.ug-root .ug-greet { background: transparent; color: inherit; border: 0; padding: 0; font: inherit; }
.ug-root .ug-site-start {
  min-height: 34px;
  border: 1px solid var(--ug-active);
  border-radius: 999px;
  padding: .35rem .8rem;
  color: var(--ug-on-active);
  background: var(--ug-active);
  font-weight: 700;
}
.ug-root .ug-nudge .ug-site-start { margin-block-start: .5rem; }
.ug-root .ug-site-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  padding: .45rem 0;
}
.ug-root .ug-site-controls button,
.ug-root .ug-hear { min-height: 34px; }
.ug-root.ug-site-active .ug-scroll > :is(.ug-history,.ug-discovery,.ug-follow,.ug-devtools) { display: none; }
.ug-root.ug-site-active .ug-tools :is(.ug-tour,.ug-site-start) { display: none; }
.ug-root .ug-voice-note { color: var(--ug-detail); font-size: .85rem; margin: .35rem 0; }
.ug-root .ug-caption-active {
  color: var(--ug-on-active);
  background: var(--ug-active);
  border-radius: .18em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.ug-root .ug-finale {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .75rem;
  border-block-start: 1px solid var(--ug-border);
  margin-block-start: .6rem;
  padding-block-start: .55rem;
}
.ug-root .ug-finale strong { flex-basis: 100%; }
.ug-root .ug-finale a { color: var(--ug-detail); text-decoration: underline; }
.ug-root.ug-speaking :is(.ug-figure,.ug-head-face) .ug-mouth {
  animation: ug-talk .26s ease-in-out infinite alternate;
}
.ug-root.ug-speaking :is(.ug-figure,.ug-head-face) .ug-smile { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .ug-root.ug-speaking :is(.ug-figure,.ug-head-face) .ug-mouth { scale: 1 .65; }
  .ug-root .ug-bubble.ug-fresh { animation: ug-v7-fade .15s ease-out both !important; }
  @keyframes ug-v7-fade { from { opacity: .65; } to { opacity: 1; } }
}

/* Keep the cloud in the character's moving coordinate system. Only its
   placement changes when a narrow viewport puts the head near an edge. */
.ug-root .ug-character:has(.ug-say:not([hidden])) { z-index: 2; overflow: visible; }
.ug-root .ug-say {
  --cloud-paper: #fffaf0;
  --cloud-ink: #174c44;
  --cloud-edge: #abcfc0;
  position: absolute;
  display: block;
  width: min(254px, calc(100vw - 28px));
  padding: 10px 14px;
  border: 1px solid var(--cloud-edge);
  border-radius: 23px 24px 20px 18px;
  color: var(--cloud-ink);
  background: var(--cloud-paper);
  box-shadow: 0 5px 16px #173d3529;
  font: 600 14px/1.35 'DM Sans', system-ui, sans-serif;
  white-space: normal;
  text-align: start;
  overflow-wrap: anywhere;
  cursor: pointer;
  pointer-events: auto;
}
.ug-root.ug-dev .ug-say {
  --cloud-ink: #dbf8eb;
  --cloud-paper: #183337;
  --cloud-edge: #547d76;
}
.ug-root .ug-say::after {
  content: '';
  position: absolute;
  width: 11px;
  height: 11px;
  background: var(--cloud-paper);
  border-right: 1px solid var(--cloud-edge);
  border-bottom: 1px solid var(--cloud-edge);
  pointer-events: none;
}
.ug-say[data-side="above"]::after { bottom: -7px; left: var(--tail-x); transform: translateX(-50%) rotate(45deg); }
.ug-say[data-side="right"]::after { left: -7px; top: var(--tail-y); transform: translateY(-50%) rotate(135deg); }
.ug-say[data-side="left"]::after { right: -7px; top: var(--tail-y); transform: translateY(-50%) rotate(-45deg); }
.ug-root .ug-say-text { display: block; max-height: calc(100dvh - 90px); overflow-y: auto; }
.ug-root .ug-say-hint { display: block; margin-top: 4px; font-size: .85em; }
