/* Clover, the Top Crop show host (public/host.js). Uses the --fh-* tokens so light and dark both work. */

.host-figure {
  --look-x: 0px;
  --look-y: 0px;
  display: block;
  position: relative;
}
.host-face {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.host-head {
  transform-origin: 100px 170px;
  transition: transform 0.25s ease;
}
.host-figure .host-pupil {
  transform: translate(var(--look-x), var(--look-y));
  transition: transform 0.15s ease-out;
}
.host-eye {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.08s;
}
.host-lid {
  opacity: 0;
}
.host-figure.blink .host-eye {
  transform: scaleY(0.1);
}
.host-brow {
  transition: transform 0.25s ease;
}
.host-arm {
  transform-origin: 166px 214px;
  transform: rotate(40deg) translateY(30px);
  opacity: 0;
  transition:
    transform 0.4s ease,
    opacity 0.3s;
}

/* moods */
.host-figure[data-mood='excited'] .host-brow,
.host-figure[data-mood='surprised'] .host-brow {
  transform: translateY(-6px);
}
.host-figure[data-mood='excited'] .host-arm,
.host-figure[data-mood='proud'] .host-arm {
  opacity: 1;
  transform: none;
  animation: host-wave 1.1s ease-in-out 2;
}
.host-figure[data-mood='thinking'] .host-pupil {
  transform: translate(-3px, -4px);
}
.host-figure[data-mood='thinking'] .host-brow-l {
  transform: translateY(-4px) rotate(-4deg);
  transform-box: fill-box;
  transform-origin: center;
}
.host-figure[data-mood='thinking'] .host-head {
  transform: rotate(-5deg);
}
.host-figure[data-mood='wink'] .host-eye-r .host-open,
.host-figure[data-mood='proud'] .host-eye .host-open {
  opacity: 0;
}
.host-figure[data-mood='wink'] .host-eye-r .host-lid,
.host-figure[data-mood='proud'] .host-lid {
  opacity: 1;
}
.host-figure[data-mood='surprised'] .host-eye {
  transform: scale(1.12);
}
.host-figure.talking .host-head {
  animation: host-nod 0.9s ease-in-out infinite;
}
.host-figure.bounce {
  animation: host-bounce 0.55s cubic-bezier(0.3, 1.6, 0.5, 1);
}
/* Full-body Clover (chat panel): one arm pose per mood, a step back when surprised, a bob while talking. */
.host-pose {
  opacity: 0;
  transition: opacity 0.22s ease;
}
.host-figure[data-mood='happy'] :is(.host-l-down, .host-r-wave),
.host-figure[data-mood='wink'] :is(.host-l-down, .host-r-hip),
.host-figure[data-mood='proud'] :is(.host-l-hip, .host-r-hip),
.host-figure[data-mood='thinking'] :is(.host-l-chin, .host-r-down),
.host-figure[data-mood='excited'] :is(.host-l-up, .host-r-up),
.host-figure[data-mood='surprised'] :is(.host-l-palm, .host-r-palm) {
  opacity: 1;
}
.host-whole {
  transform-origin: 100px 390px;
  transition: transform 0.3s ease;
}
.host-shadow {
  transform-origin: 100px 392px;
  transition: transform 0.3s ease;
}
.host-figure[data-mood='surprised'] .host-whole {
  transform: translateY(5px) scale(0.95) rotate(-2deg);
}
.host-figure[data-mood='surprised'] .host-shadow {
  transform: scaleX(0.92);
}
.host-figure[data-mood='proud'] .host-whole {
  transform: scale(1.02);
}
.host-r-wave {
  transform-origin: 134px 192px;
  animation: host-wave 1.1s ease-in-out 2;
}
.host-figure[data-mood='excited'] .host-whole {
  animation: host-cheer 0.7s ease-in-out 3;
}
.host-figure.talking .host-whole {
  animation: host-bob 0.5s ease-in-out infinite;
}
.host-figure[data-mood='thinking'] .host-l-chin {
  transform-origin: 66px 192px;
  animation: host-scratch 0.6s ease-in-out 3;
}
@keyframes host-cheer {
  0%,
  100% {
    translate: 0 0;
  }
  45% {
    translate: 0 -14px;
  }
}
@keyframes host-bob {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -3px;
  }
}
@keyframes host-scratch {
  0%,
  100% {
    transform: rotate(0);
  }
  50% {
    transform: rotate(-4deg);
  }
}
.host-mini .host-head {
  animation: host-idle 4s ease-in-out infinite;
}
@keyframes host-wave {
  0%,
  100% {
    transform: rotate(0);
  }
  30% {
    transform: rotate(-14deg);
  }
  65% {
    transform: rotate(10deg);
  }
}
@keyframes host-nod {
  0%,
  100% {
    transform: rotate(0) translateY(0);
  }
  35% {
    transform: rotate(-2deg) translateY(-1px);
  }
  70% {
    transform: rotate(2deg) translateY(1px);
  }
}
@keyframes host-bounce {
  0% {
    transform: translateY(0) scale(1);
  }
  40% {
    transform: translateY(-10px) scale(1.04, 0.97);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}
@keyframes host-idle {
  0%,
  100% {
    transform: rotate(0);
  }
  50% {
    transform: rotate(-4deg);
  }
}

/* launcher */
.host-launch {
  position: fixed;
  right: 18px;
  bottom: 136px;
  z-index: 34;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px 4px 4px;
  border-radius: 40px;
  border: 2px solid var(--lime);
  background: var(--forest);
  color: var(--paper);
  font: inherit;
  font-weight: 800;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 10px 30px #0005;
  transition: transform 0.2s ease;
}
.host-launch:hover,
.host-launch:focus-visible {
  transform: translateY(-2px);
}
.host-launch .host-mini {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #fbe7a8, #e4b860);
}
.host-launch .host-mini svg {
  width: 64px;
  height: 70px;
  margin: -6px 0 0 -6px;
}
.host-launch-dot {
  position: absolute;
  top: 2px;
  left: 42px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e46b4c;
  border: 2px solid var(--forest);
}
.host-launch-bubble {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(290px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 16px 16px 4px 16px;
  background: var(--fh-surface);
  color: var(--fh-ink);
  border: 1px solid var(--fh-line-strong);
  box-shadow: 0 10px 30px #0004;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: left;
  letter-spacing: 0;
  animation: host-pop 0.3s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.host-launch.open {
  display: none;
}
body.farm-mode .host-launch {
  bottom: 74px;
}
body.library-mode .host-launch,
body.talent-mode .host-launch {
  bottom: 18px;
}
/* Wide screens: beside the front page's right-hand column when it reaches down this far (host.js). */
@media (min-width: 761px) {
  .host-launch.beside-rail,
  .host.beside-rail {
    right: var(--host-beside, 18px);
  }
  .host.beside-rail {
    width: min(400px, calc(100vw - var(--host-beside, 18px) - 16px));
  }
}
@keyframes host-pop {
  from {
    transform: scale(0.6) translateY(10px);
    opacity: 0;
  }
}

/* panel */
.host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 36;
  width: min(400px, calc(100vw - 32px));
  max-height: calc(100svh - 104px);
  display: flex;
  flex-direction: column;
  background: var(--fh-surface);
  color: var(--fh-ink);
  border: 1px solid var(--fh-line-strong);
  border-radius: 22px;
  box-shadow: 0 20px 60px #0006;
  overflow: hidden;
  animation: host-pop 0.3s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.host.hidden,
.host .hidden {
  display: none;
}
.host-stage {
  position: relative;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  padding: 14px 14px 10px;
  background:
    radial-gradient(circle at 18% 70%, #fbe7a855, transparent 55%),
    linear-gradient(160deg, #1f5c38, var(--forest));
  color: var(--paper);
}
.host-big {
  width: 96px;
  height: 192px;
  align-self: end;
  cursor: pointer;
  filter: drop-shadow(0 6px 10px #0005);
}
.host-say {
  align-self: center;
  padding-right: 54px;
}
.host-say .eyebrow {
  color: var(--lime);
  font-size: 0.68rem;
}
.host-bubble {
  position: relative;
  margin: 6px 0 0;
  padding: 10px 12px;
  min-height: 3.2em;
  max-height: 9.5em;
  overflow-y: auto;
  border-radius: 14px 14px 14px 4px;
  background: var(--paper);
  color: var(--forest);
  font-size: 0.92rem;
  line-height: 1.4;
  font-weight: 600;
}
.host-say-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 6px;
}
.host-replay {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #ffffff40;
  background: #ffffff1a;
  color: var(--paper);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.host-replay:hover,
.host-replay:focus-visible {
  background: #ffffff33;
}
.host-note {
  flex: 1 1 160px;
  color: #fbe7a8;
  font-size: 0.76rem;
  line-height: 1.3;
}
.host-big:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 2px;
  border-radius: 12px;
}
.host-tools {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
}
.host-tools button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #ffffff40;
  background: #ffffff1a;
  color: var(--paper);
  cursor: pointer;
  font-size: 0.95rem;
}
.host-tools button:disabled {
  opacity: 0.4;
}
.host-spark {
  position: absolute;
  left: 50%;
  top: 30%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
}
.host-spark.go {
  animation: host-spark 0.9s ease-out;
}
@keyframes host-spark {
  0% {
    box-shadow:
      0 0 0 0 #f2c14e,
      0 0 0 0 #fff;
  }
  100% {
    box-shadow:
      -40px -30px 0 -2px #f2c14e00,
      40px -34px 0 -2px #ffffff00,
      -30px 30px 0 -2px #e46b4c00,
      36px 26px 0 -2px #5aa0d800;
  }
}
.host-tabs {
  display: flex;
  border-bottom: 1px solid var(--fh-line);
}
.host-tabs button {
  flex: 1;
  padding: 9px 6px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--fh-muted);
  font: inherit;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
}
.host-tabs button.active {
  color: var(--fh-ink);
  border-bottom-color: var(--lime);
}
.host-qcount {
  font-weight: 700;
  color: var(--fh-accent-ink);
}
.host-chat,
.host-quests {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--fh-surface-2);
}
.host-msg {
  margin: 0;
  max-width: 88%;
  font-size: 0.9rem;
  line-height: 1.4;
}
.host-msg.me {
  align-self: flex-end;
  padding: 8px 12px;
  border-radius: 14px 14px 4px 14px;
  background: var(--forest);
  color: var(--paper);
}
html[data-theme='dark'] .host-msg.me {
  background: #2f7a4b;
}
.host-msg.clover > p,
.host-msg.host-typing {
  margin: 0;
  padding: 8px 12px;
  border-radius: 14px 14px 14px 4px;
  background: var(--fh-surface);
  border: 1px solid var(--fh-line);
}
.host-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.host-acts button,
.host-qlist button {
  padding: 5px 10px;
  font-size: 0.76rem;
  border-radius: 14px;
}
.host-typing {
  display: flex;
  gap: 4px;
  width: max-content;
}
.host-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fh-muted);
  animation: host-dot 1s infinite;
}
.host-typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.host-typing span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes host-dot {
  0%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
.host-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 14px 0;
  scrollbar-width: none;
}
.host-chip {
  flex: none;
  padding: 6px 11px;
  border-radius: 16px;
  border: 1px solid var(--fh-line-strong);
  background: var(--fh-surface);
  color: var(--fh-ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.host-chip:hover {
  background: var(--fh-accent-soft);
}
.host-ask {
  display: flex;
  gap: 6px;
  padding: 10px 14px 4px;
}
.host-ask input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 20px;
  border: 1px solid var(--fh-line-strong);
  background: var(--fh-input);
  color: var(--fh-ink);
  font: inherit;
}
.host-mic,
.host-send {
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--fh-line-strong);
  background: var(--fh-surface);
  color: var(--fh-ink);
  font-size: 1.05rem;
  cursor: pointer;
}
.host-send.primary {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--forest);
}
.host-mic.listening {
  background: #e46b4c;
  color: #fff;
  animation: host-listen 1.2s ease-in-out infinite;
}
@keyframes host-listen {
  50% {
    box-shadow: 0 0 0 8px #e46b4c33;
  }
}
.host-status {
  min-height: 1.2em;
  padding: 0 16px;
  color: var(--fh-muted);
  font-size: 0.78rem;
}
.host-greet {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 2px 16px 12px;
  color: var(--fh-muted);
  font-size: 0.78rem;
}

/* quests */
.host-qbar {
  height: 10px;
  border-radius: 6px;
  background: var(--fh-line);
  overflow: hidden;
}
.host-qbar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2f7a4b, var(--lime));
  transition: width 0.6s ease;
}
.host-qlist {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.host-qlist li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--fh-surface);
  border: 1px solid var(--fh-line);
  font-weight: 700;
  font-size: 0.88rem;
}
.host-qlist li > span:nth-child(2) {
  flex: 1;
}
.host-qcheck {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--fh-line-strong);
  color: #fff;
  font-size: 0.75rem;
}
.host-qlist li.done {
  color: var(--fh-muted);
}
.host-qlist li.done .host-qcheck {
  background: var(--fh-good);
  border-color: var(--fh-good);
}
.host-qnote {
  margin: 4px 0 0;
  color: var(--fh-muted);
  font-size: 0.8rem;
}

/* confetti */
.host-confetti {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  overflow: hidden;
}
.host-confetti i {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: host-fall linear forwards;
}
@keyframes host-fall {
  to {
    top: 105%;
    transform: rotate(720deg) translateX(40px);
  }
}

@media (max-width: 760px) {
  .host {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    max-height: 82svh;
  }
  .host-stage {
    grid-template-columns: 66px 1fr;
  }
  .host-big {
    width: 66px;
    height: 132px;
  }
  .host-launch {
    right: 10px;
    bottom: 128px;
    padding-right: 4px;
  }
  .host-launch-label {
    display: none;
  }
  body.farm-mode .host-launch {
    bottom: 70px;
  }
}

html[data-motion='calm'] .host-figure,
html[data-motion='calm'] .host-figure *,
html[data-motion='calm'] .host,
html[data-motion='calm'] .host-launch-bubble,
html[data-motion='calm'] .host-mic.listening {
  animation: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .host-figure,
  .host-figure *,
  .host,
  .host-launch-bubble {
    animation: none !important;
  }
}
.host-team {
  display: block;
  padding: 0 16px 12px;
  margin-top: -8px;
  color: var(--fh-muted);
  font-size: 0.7rem;
  opacity: 0.8;
}
