/* v57.css - 書き出し中の表示 / 設定 (書き出し・キャラ) / マスコットの表示モードとアニメーション */

/* ===== 書き出し中 (操作を止める) ===== */
.pms-busy-overlay {
  position: fixed; inset: 0; z-index: 20000;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  cursor: progress;
}
.pms-busy-card {
  background: var(--bg-elev); color: var(--fg);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 22px 30px; min-width: 260px; text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.pms-busy-spin {
  width: 26px; height: 26px; margin: 0 auto 10px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: pms-busy-spin .9s linear infinite;
}
@keyframes pms-busy-spin { to { transform: rotate(360deg); } }
.pms-busy-title { font-weight: 600; font-size: 14px; }
.pms-busy-msg { font-size: 12px; color: var(--fg-mute); margin-top: 6px; min-height: 1.4em; }
.pms-busy-note { font-size: 11px; color: var(--fg-dim, var(--fg-mute)); margin-top: 8px; }

/* ===== 設定: 書き出し ===== */
.settings-apply-row { justify-content: flex-start; flex-wrap: wrap; margin-top: 6px; padding: 10px 0; }
.settings-apply-row .desc { flex: 1; min-width: 200px; font-size: 11px; color: var(--fg-mute); }
.settings-apply-row.is-dirty { border-left: 3px solid var(--accent); padding-left: 10px; }

/* ===== 設定: キャラ ===== */
.settings-row .rng { display: flex; align-items: center; gap: 6px; }
.settings-row .rng input[type="range"] { width: 170px; }
.settings-row .rng input[type="number"] { width: 68px; }
.settings-row .rng .rng-unit { font-size: 11px; color: var(--fg-mute); min-width: 1.5em; }
.char-expr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; padding: 6px 0; }
.char-expr-cell {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px;
}
.char-expr-thumb {
  width: 72px; height: 72px; border-radius: 8px; background: var(--bg-sunk);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  font-size: 30px; color: var(--fg-mute);
}
.char-expr-thumb img { width: 100%; height: 100%; object-fit: contain; }
.char-expr-thumb.is-fallback { opacity: .45; }
.char-expr-btns { display: flex; gap: 4px; }
.char-expr-btns button { font-size: 11px; padding: 2px 8px; }
.char-lines-box { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin: 6px 0; }
.char-lines-box textarea {
  width: 100%; min-height: 110px; box-sizing: border-box; resize: vertical;
  font-size: 13px; line-height: 1.6; margin: 6px 0;
}
.char-lines-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.char-lines-head select { max-width: 100%; }
.char-lines-btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.char-lines-note { font-size: 11px; color: var(--fg-mute); }
.char-week { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; padding: 4px 0 8px; }
.char-week label { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.char-week select { flex: 1; min-width: 0; }
.char-week .is-today { font-weight: 700; color: var(--accent); }

/* ===== マスコット: 入れ子と角度 ===== */
.msc-rot, .msc-peekw { width: 100%; height: 100%; }
.msc-rot { transform-origin: 50% 50%; }
.msc-mode-peek .msc-rot { transform-origin: 50% 100%; }
.msc-mode-free .msc-rot, .msc-mode-peek .msc-rot { transition: transform .2s ease; }

/* ===== 待機アニメーション (速さは --msc-speed) ===== */
@keyframes msc-idle-sway { 0%, 100% { rotate: -5deg; } 50% { rotate: 5deg; } }
@keyframes msc-idle-breathe { 0%, 100% { scale: 1; } 50% { scale: 1.05 1.07; } }
@keyframes msc-idle-hop {
  0%, 55%, 100% { translate: 0 0; }
  65% { translate: 0 -16%; }
  75% { translate: 0 0; }
  84% { translate: 0 -8%; }
  92% { translate: 0 0; }
}
@keyframes msc-walk-step {
  0%, 100% { translate: 0 0; rotate: -3deg; }
  25% { translate: 0 -5%; rotate: 0deg; }
  50% { translate: 0 0; rotate: 3deg; }
  75% { translate: 0 -5%; rotate: 0deg; }
}
.msc-fixed-inner.msc-idle-float   { animation: msc-idle-float calc(3.2s / var(--msc-speed, 1)) ease-in-out infinite; }
.msc-fixed-inner.msc-idle-mochi   { animation: msc-idle-mochi calc(2.4s / var(--msc-speed, 1)) ease-in-out infinite; transform-origin: 50% 100%; }
.msc-fixed-inner.msc-idle-sway    { animation: msc-idle-sway calc(3.6s / var(--msc-speed, 1)) ease-in-out infinite; transform-origin: 50% 100%; }
.msc-fixed-inner.msc-idle-breathe { animation: msc-idle-breathe calc(3.4s / var(--msc-speed, 1)) ease-in-out infinite; transform-origin: 50% 100%; }
.msc-fixed-inner.msc-idle-hop     { animation: msc-idle-hop calc(2.8s / var(--msc-speed, 1)) ease-out infinite; }
.msc-fixed-inner.msc-walk         { animation: msc-walk-step calc(.7s / var(--msc-speed, 1)) linear infinite; transform-origin: 50% 100%; }
/* 喋る・クリック・ホバーは待機アニメより優先 (上の指定より後ろに置く) */
.msc-fixed-inner.msc-talking { animation: msc-mochi .65s ease; }
.msc-fixed-inner.msc-clicked { animation: msc-mochi-click .55s ease; }
.msc-mode-free .msc-fixed-inner:hover, .msc-mode-peek .msc-fixed-inner:hover { animation: msc-mochi .5s ease; }
.msc-mode-walk .msc-fixed-inner.msc-walk:hover { animation: msc-walk-step calc(.7s / var(--msc-speed, 1)) linear infinite; }

/* ===== のぞき見の動き ===== */
@keyframes msc-peek-hyoko {
  0%, 10% { translate: 0 85%; }
  18%, 78% { translate: 0 0; }
  86%, 100% { translate: 0 85%; }
}
@keyframes msc-peek-sway { 0%, 100% { rotate: -4deg; } 50% { rotate: 4deg; } }
.msc-peekw.msc-peek-hyoko { animation: msc-peek-hyoko calc(9s / var(--msc-speed, 1)) ease-in-out infinite; }
.msc-peekw.msc-peek-sway  { animation: msc-peek-sway calc(4s / var(--msc-speed, 1)) ease-in-out infinite; transform-origin: 50% 100%; }

@media (prefers-reduced-motion: reduce) {
  .msc-fixed-inner, .msc-peekw { animation: none !important; }
}

/* ===== v58: TODO 行のレイアウト =====
   右パネルは幅が狭く、プロジェクトのタグや %/× ボタンが横に並ぶと
   TODO 名が 2〜3 文字で縦に折り返していた。
   名前に最低幅を確保し、入りきらない付属情報は次の行へ回す。 */
.todo-item { flex-wrap: wrap; row-gap: 4px; }
.todo-item .todo-text {
  flex: 1 1 7em;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.todo-item > .tag {
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 付属情報が次の行へ回ったときは右に寄せる (名前の下に揃う) */
.todo-item > .todo-mode-btn { margin-left: auto; }
