/* Composer upper-left seated pet & Appearance segmented selector (Codex | Clawd). */
.composer.voice-composer form {
  position: relative;
}

.composer-pet {
  position: absolute;
  bottom: calc(100% - 0.5px);
  left: calc(clamp(54px, 15.5%, 116px) - 1px);
  transform: translateX(-50%);
  width: 48px;
  height: 44px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 10px;
  background: transparent !important;
  box-shadow: none;
  overflow: visible;
  z-index: 3;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: none;
}

.composer-pet:active {
  transform: translateX(-50%);
}

.composer-pet:focus-visible {
  outline: 2px solid #70857b;
  outline-offset: 2px;
}

.composer-pet[hidden],
.composer.voice-mode .composer-pet,
body:has(.yanlan-call-screen:not([hidden])) .composer-pet,
body:has(.voice-recording-mask) .composer-pet {
  display: none !important;
}

.composer-pet-stage {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  pointer-events: none;
  display: block;
  line-height: 0;
}

.composer-pet-img {
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  object-fit: contain;
}

/* Codex (192x208, 3.8% bottom transparent pad -> -2px rests feet flush on 1px form border). */
.composer-pet[data-pet-character="codex"] .composer-pet-img {
  width: 52px;
  height: 56px;
  margin-bottom: -2px;
}

/* Clawd static SVG (66x52, zero transparent pad -> -1px rests feet flush on 1px form border). */
.composer-pet[data-pet-character="clawd"][data-pet-phase="idle"] .composer-pet-img {
  width: 40px;
  height: 32px;
  margin-bottom: -1px;
}

/* Clawd action GIFs (324x218, standing body is ~43.3% tall at bottom, cx=48.5%). */
.composer-pet[data-pet-character="clawd"][data-pet-phase="action"] .composer-pet-stage {
  transform: translateX(-48.5%);
}

.composer-pet[data-pet-character="clawd"][data-pet-phase="action"][data-pet-action="lurking"] .composer-pet-stage {
  transform: translateX(-11.6%);
}

.composer-pet[data-pet-character="clawd"][data-pet-phase="action"] .composer-pet-img {
  width: 108px;
  height: 73px;
  margin-bottom: -1px;
}

/* Appearance page third row: hand-drawn rounded segmented control matching existing switches. */
.appearance-form > .appearance-pet-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  font-size: 16px;
}

.appearance-pet-row > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.pet-segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  position: relative;
  flex: 0 0 auto;
  max-width: 100%;
  border: 1px solid #929588;
  border-radius: 17px 19px 16px 18px;
  background-color: var(--paper, #f5f5f2);
  overflow: hidden;
  box-sizing: border-box;
}

.pet-segmented::after {
  content: "";
  position: absolute;
  inset: 1px;
  border: 1px solid #a6ab9b55;
  border-radius: 19px 16px 18px 17px;
  pointer-events: none;
}

.pet-segmented button {
  min-width: 66px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #6d7369;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 180ms ease, color 180ms ease;
}

.pet-segmented button:active {
  transform: none;
}

.pet-segmented button + button {
  border-left: 1px solid #c2c7bc;
}

.pet-segmented button[aria-checked="true"] {
  background-color: #d1dfc9;
  background-image: repeating-linear-gradient(
    125deg,
    transparent 0 4px,
    #8fa38422 4px 4.7px
  );
  color: #43543b;
}

.pet-segmented button:focus-visible {
  outline: 2px solid #8c9e7e;
  outline-offset: -3px;
}

@media (max-width: 360px) {
  .appearance-form > .appearance-pet-row {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .pet-segmented button {
    min-width: 58px;
    padding: 0 9px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pet-segmented button {
    transition: none;
  }
}

html[data-reduced="true"] .pet-segmented button {
  transition: none;
}
