/* 3Dの部屋の上に重ねる物（担当の名札・頭の上のメモ・吹き出し）の見た目。クラス名はすべて sc- で始まる */
/* 置き場所（transform）と幅は public/js/scene/labels.js が書く。大きさの数字は public/js/scene/measure.js と合わせること */
/* 字は 11px より小さくしない */

.sc-overlay {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sc-chip,
.sc-pill,
.sc-chat,
.sc-bubble {
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  will-change: transform;
}

.sc-chip[hidden],
.sc-talk[hidden],
.sc-chip__role[hidden],
.sc-pill__text[hidden] {
  display: none;
}

/* ---------- 名札：丸いアイコン（担当の色）＋名前（大きく）＋役割（小さく）。状態はアイコンの周りの輪 ---------- */

.sc-chip {
  --sc-color: #8a94a6;
  --sc-glyph-color: #ffffff;
  --sc-ring: #b9c1cf;
  display: flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  height: 38px;
  padding: 2px 9px 2px 3px;
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 8px rgba(31, 42, 68, 0.2);
}

.sc-chip__avatar {
  position: relative;
  flex: none;
  width: 34px;
  height: 34px;
}

.sc-chip__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--sc-ring);
}

.sc-chip__face {
  position: absolute;
  inset: 3px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
}

.sc-chip__glyph {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--sc-color);
  color: var(--sc-glyph-color);
  font-size: 13px;
  font-weight: 800;
  line-height: 24px;
  text-align: center;
}

.sc-chip__text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.sc-chip__name {
  color: #1f2a44;
  font-size: 13px;
  font-weight: 800;
  line-height: 16px;
  white-space: nowrap;
}

.sc-chip__role {
  color: #5b6578;
  font-size: 11px;
  font-weight: 600;
  line-height: 14px;
  white-space: nowrap;
}

/* 状態の輪：待機＝灰色／作業中＝色の輪が回る／確認待ち＝赤／完了＝緑／止まった＝赤の点滅 */
.sc-chip--idle {
  --sc-ring: #b9c1cf;
}

.sc-chip--working .sc-chip__ring {
  background: conic-gradient(from 0deg, #ff4f8b, #ffc532, #22c58b, #29b6f6, #ff4f8b);
  animation: sc-spin 1.5s linear infinite;
}

.sc-chip--review {
  --sc-ring: #f0413c;
}

.sc-chip--done {
  --sc-ring: #1dbf73;
}

.sc-chip--stopped {
  --sc-ring: #f0413c;
}

.sc-chip--stopped .sc-chip__ring {
  animation: sc-blink 0.8s ease-in-out infinite;
}

/* ---------- 頭の上のメモ：作業中だけ。入力中の点々＋今やっている事（1行） ---------- */

.sc-pill {
  display: none;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px;
  border-radius: 12px;
  background: rgba(31, 42, 68, 0.92);
  box-shadow: 0 3px 10px rgba(31, 42, 68, 0.22);
  color: #ffffff;
}

.sc-talk--working .sc-pill {
  display: flex;
}

.sc-pill__dots {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  width: 24px;
}

.sc-pill__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffffff;
  animation: sc-bounce 1.1s ease-in-out infinite;
}

.sc-pill__dot:nth-child(2) {
  animation-delay: 0.15s;
}

.sc-pill__dot:nth-child(3) {
  animation-delay: 0.3s;
}

.sc-pill__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  line-height: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 社内チャットの通知のカード：白いカード。左に送った人の丸いアイコン（名札と同じ色と1文字）→ 名前（太字）→ 一言
   （数秒だけ。メモの場所に、メモの代わりに出す） ---------- */

.sc-chat {
  display: none;
  align-items: center;
  height: 24px;
  padding: 0 9px 0 2px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(31, 42, 68, 0.26);
  color: #1f2a44;
  font-size: 13px;
  line-height: 24px;
  white-space: nowrap;
  overflow: hidden;
  animation: sc-chat-in 0.22s ease-out;
}

.sc-talk--chat .sc-chat {
  display: flex;
}

/* 送った人の丸いアイコン：名札のアイコン（.sc-chip__glyph）と同じ作り（社員の色の丸＋1文字）。字の高さより少し大きい */
.sc-chat__avatar {
  --sc-chat-color: #8a94a6;
  --sc-chat-glyph-color: #ffffff;
  flex: none;
  width: 20px;
  height: 20px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--sc-chat-color);
  color: var(--sc-chat-glyph-color);
  font-size: 11px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
}

/* 社員ではない相手（お客さんの問い合わせ）：アイコンの代わりに、印（📩）を出す */
.sc-chat__avatar--icon {
  font-size: 13px;
  font-weight: 400;
}

.sc-chat__who {
  flex: none;
  font-weight: 800;
}

.sc-chat__text {
  flex: 1;
  min-width: 0;
  margin-left: 5px;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
}

.sc-chat__text:empty {
  display: none;
}

@keyframes sc-chat-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ---------- 吹き出し：SNSのメッセージの形（数秒だけ。メモより優先） ---------- */

.sc-bubble {
  --sc-tail-x: 20px;
  display: none;
  padding: 8px 12px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(31, 42, 68, 0.22);
  color: #1f2a44;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  overflow-wrap: anywhere;
}

/* しっぽ（話している人の頭の方へ下がる小さな三角） */
.sc-bubble::after {
  content: "";
  position: absolute;
  left: var(--sc-tail-x);
  bottom: -7px;
  width: 14px;
  height: 9px;
  margin-left: -7px;
  background: #ffffff;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.sc-talk--say .sc-bubble {
  display: block;
}

/* ひとりごと（画面の演出）：仕事の吹き出しより控えめに（薄い地・やわらかい字の色） */
.sc-talk--mutter .sc-bubble {
  background: #f1f4f9;
  box-shadow: 0 3px 9px rgba(31, 42, 68, 0.14);
  color: #5a6478;
  font-weight: 500;
}

.sc-talk--mutter .sc-bubble::after {
  background: #f1f4f9;
}

@keyframes sc-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes sc-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.18;
  }
}

@keyframes sc-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.55;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}
