/* ==========================================================================
   デジタルペット「kiki」スタイルシート (pet.css)
   ========================================================================== */

/* --- ペット全体コンテナ --- */
#digital-pet-wrap {
  position: fixed;
  bottom: 30px;
  right: 40px;
  z-index: 9999;
  user-select: none;
  font-family: "DotGothic16", "MS PGothic", sans-serif;
}

#digital-pet {
  display: inline-block;
  cursor: grab;
  position: relative;
  filter: drop-shadow(2px 4px 5px rgba(0, 0, 0, 0.45));
}

#digital-pet:active {
  cursor: grabbing;
}

/* kiki 画像本体スタイル (ドット絵くっきり表示・反転・揺れなし) */
.kiki-img {
  width: 84px;
  height: auto;
  display: block;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  pointer-events: none;
}

/* --- 自動つぶやき吹き出し (98ツールチップ風・すっきり1行表示) --- */
#pet-bubble {
  position: absolute;
  bottom: 75px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #ffffe1;
  color: #000000;
  border: 1px solid #000000;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  padding: 5px 9px;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10000;
}

#pet-bubble.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* 吹き出しのしっぽ（中央固定） */
#pet-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #000000 transparent transparent transparent;
}

#pet-bubble::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -4px;
  border-width: 4px;
  border-style: solid;
  border-color: #ffffe1 transparent transparent transparent;
  z-index: 1;
}

/* 画面上端での下側反転表示 */
#pet-bubble.pos-below::after {
  top: auto;
  bottom: 100%;
  border-color: transparent transparent #000000 transparent;
}

#pet-bubble.pos-below::before {
  top: auto;
  bottom: 100%;
  border-color: transparent transparent #ffffe1 transparent;
}

/* --- 会話ダイアログ (Windows 98 風ポップアップ) --- */
#pet-dialog {
  position: fixed;
  bottom: 115px;
  right: 30px;
  width: 320px;
  background-color: #c0c0c0;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #000000;
  border-bottom: 2px solid #000000;
  box-shadow: 3px 3px 12px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  color: #000000;
  z-index: 10001;
  display: none;
  font-family: "DotGothic16", "MS PGothic", sans-serif;
}

#pet-dialog.active {
  display: block;
}

.pet-dialog-titlebar {
  background: linear-gradient(to right, #000080, #1084d0);
  color: #ffffff;
  font-weight: bold;
  padding: 3px 4px 3px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.pet-dialog-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

.pet-dialog-close {
  width: 16px;
  height: 14px;
  background-color: #c0c0c0;
  border-top: 1px solid #ffffff;
  border-left: 1px solid #ffffff;
  border-right: 1px solid #000000;
  border-bottom: 1px solid #000000;
  font-size: 9px;
  font-weight: bold;
  color: #000000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.pet-dialog-close:active {
  border-top: 1px solid #000000;
  border-left: 1px solid #000000;
  border-right: 1px solid #ffffff;
  border-bottom: 1px solid #ffffff;
}

.pet-dialog-body {
  padding: 8px;
}

.pet-dialog-msg-box {
  background: #ffffff;
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  padding: 8px;
  min-height: 70px;
  max-height: 110px;
  overflow-y: auto;
  margin-bottom: 8px;
  line-height: 1.5;
  font-size: 12px;
}

/* クイック返答ボタン */
.pet-quick-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 8px;
}

.pet-quick-btn {
  background-color: #c0c0c0;
  border-top: 1px solid #ffffff;
  border-left: 1px solid #ffffff;
  border-right: 1px solid #000000;
  border-bottom: 1px solid #000000;
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  color: #000000;
}

.pet-quick-btn:hover {
  background-color: #d8d8d8;
}

.pet-quick-btn:active {
  border-top: 1px solid #000000;
  border-left: 1px solid #000000;
  border-right: 1px solid #ffffff;
  border-bottom: 1px solid #ffffff;
}

/* テキスト入力フォーム */
.pet-input-row {
  display: flex;
  gap: 4px;
}

.pet-chat-input {
  flex: 1;
  background: #ffffff;
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  padding: 3px 5px;
  font-size: 12px;
  font-family: inherit;
}

.pet-chat-send {
  background-color: #c0c0c0;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #000000;
  border-bottom: 2px solid #000000;
  padding: 2px 8px;
  font-size: 12px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
}

.pet-chat-send:active {
  border-top: 2px solid #000000;
  border-left: 2px solid #000000;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
  #pet-dialog {
    width: 290px;
    right: 10px;
    bottom: 90px;
  }
  #digital-pet-wrap {
    bottom: 15px;
    right: 15px;
  }
}
