/* The rendered hand flip. Markup comes from flip.js; the terminal border follows the text color. */

.flip {
  display: block;
  width: 100%;
}

.flip-frame {
  position: relative;
  margin: 0 auto;
}

.flip-scene {
  position: absolute;
  top: 0;
  left: 0;
  width: 460px;
  height: 290px;
  transform-origin: top left;
}

.flip-hand {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 270px;
  height: 264px;
}

.flip-hand canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.flip-target {
  position: absolute;
  top: 21px;
  left: 30px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.flip.in .flip-target {
  opacity: 1;
  transform: none;
}

.flip.out .flip-target {
  opacity: 0;
  transform: translateY(-10px);
}

.flip.hit .flip-target {
  animation: flip-hit 0.4s ease;
}

.flip.hit .flip-hand {
  animation: flip-thrust 0.35s ease-out;
}

@keyframes flip-hit {
  0% {
    transform: none;
  }
  20% {
    transform: translateX(10px) rotate(3deg);
  }
  45% {
    transform: translateX(-8px) rotate(-2deg);
  }
  70% {
    transform: translateX(4px);
  }
  100% {
    transform: none;
  }
}

@keyframes flip-thrust {
  0% {
    transform: none;
  }
  40% {
    transform: translate(-6px, -6px) scale(1.03);
  }
  100% {
    transform: none;
  }
}

/* Tiny play/pause: a 28px circle inside a 44px hit area, in the empty bottom-left corner. */

.flip-toggle {
  position: absolute;
  left: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.flip-toggle[hidden] {
  display: none;
}

.flip-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  opacity: 0.7;
}

.flip-toggle:hover .flip-dot,
.flip-toggle:focus-visible .flip-dot {
  opacity: 1;
}

.flip-toggle:focus-visible {
  outline: 3px solid #E0401B;
  outline-offset: -2px;
  border-radius: 999px;
}

.flip-dot svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.flip-icon-play,
.flip.paused .flip-icon-pause {
  display: none;
}

.flip.paused .flip-icon-play {
  display: block;
}

.flip-term {
  width: 240px;
  overflow: hidden;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  text-align: left;
  background: #16140F;
  border: 2px solid currentColor;
  border-radius: 12px;
}

.flip-term-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: #2A2721;
}

.flip-term-bar i {
  width: 9px;
  height: 9px;
  background: #5C574C;
  border-radius: 999px;
}

.flip-term-bar span {
  margin-left: 6px;
  font-size: 11px;
  color: #C9C3B6;
}

.flip-term-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px 12px;
  font-size: 15px;
  line-height: 1.5;
  color: #F4F1EA;
}

.flip-prompt,
.flip-ctrl-c {
  color: #FF6A45;
}

.flip-name {
  font-weight: 600;
}

.flip-thinking {
  color: #8F887A;
}

.flip-cursor {
  display: inline-block;
  width: 9px;
  height: 17px;
  margin-left: 4px;
  vertical-align: -3px;
  background: #F4F1EA;
  animation: flip-blink 1s steps(1) infinite;
}

@keyframes flip-blink {
  50% {
    opacity: 0;
  }
}

.flip-ctrl-c {
  visibility: hidden;
}

.flip.hit .flip-ctrl-c {
  visibility: visible;
}

.flip.hit .flip-cursor {
  opacity: 0;
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .flip-target {
    transition: none;
  }

  .flip.hit .flip-target,
  .flip.hit .flip-hand,
  .flip-cursor {
    animation: none;
  }
}
