/* components.css: ボタン・メーター・カード・スプライト枠・通知 などUI部品 */

/* --- ボタン共通 --- */
.action-btn,
.minigame-btn,
.comlevel-btn,
.fight-btn {
  margin: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  background: var(--c-surface);
  color: var(--c-text);
  font-weight: 700;
  transition: transform 0.08s, background 0.15s, box-shadow 0.15s;
}

.action-btn:active,
.minigame-btn:active,
.comlevel-btn:active,
.fight-btn:not(:disabled):active {
  transform: scale(0.95);
}

/* 選択中トグル (ミニゲーム / 相手 / 環境) */
.minigame-btn.is-active,
.comlevel-btn.is-active,
.env-btn.is-active {
  background: var(--c-accent);
  border-color: var(--c-accent-dark);
  color: #fff;
}

/* 主要アクション (たたかう / もう一度) */
.fight-btn {
  display: block;
  margin: var(--sp-3) auto 0;
  padding: var(--sp-2) var(--sp-6);
  font-size: var(--fs-md);
  background: var(--c-accent);
  border-color: var(--c-accent-dark);
  color: #fff;
  box-shadow: var(--shadow-card);
}

.fight-btn:disabled {
  background: var(--c-meter-track);
  border-color: var(--c-border);
  color: var(--c-text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

/* --- スプライト枠 (サイズはモディファイアで指定) --- */
.sprite-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-surface-alt);
  border-radius: var(--r-md);
  position: relative; /* .bug-rig (absolute) の収まり基準 */
}

.sprite-lg { width: 120px; height: 120px; font-size: 56px; margin: var(--sp-2) auto; }
.sprite-md { width: 80px;  height: 80px;  font-size: 34px; margin: 0 auto; }
.sprite-sm { width: 48px;  height: 48px;  font-size: 24px; flex-shrink: 0; }

/* スプライト画像 (枠いっぱい・ドット維持) */
.sprite-placeholder .sprite-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

/* 躍動リギングのラッパ。中の絵を変形(呼吸/ホップ)させる。位置は親=.sprite-roam が担当 */
.bug-rig {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: 50% 100%; /* 足元基準で squash/stretch */
}

/* --- メーター --- */
.meter-block {
  max-width: 260px;
  margin: var(--sp-3) auto;
}

.meter-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: var(--sp-1) 0;
  font-size: var(--fs-base);
}

.meter-label { width: 64px; color: var(--c-text-muted); }

.meter-bar {
  flex: 1 1 auto;
  height: 12px;
  background: var(--c-meter-track);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.meter-bar-fill {
  display: block;
  height: 100%;
  background: var(--c-meter-fill);
  border-radius: inherit;
  transition: width 0.3s ease-out;
}

.meter-value { width: 32px; text-align: right; font-variant-numeric: tabular-nums; }

/* メーター残量が少ないときの警告色 */
.meter-bar-fill.is-low { background: var(--c-danger); }

/* --- カード (図鑑) --- */
.card {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-surface);
  box-shadow: var(--shadow-card);
}

/* --- 通知トースト --- */
.notification {
  position: fixed;
  top: calc(var(--sp-2) + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  padding: var(--sp-2) var(--sp-4);
  background: var(--c-text);
  color: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  z-index: 1000;
  text-align: center;
  white-space: pre-line; /* 因果通知の2行表示 (\n を改行に) */
}

/* --- バッジ・称号 --- */
.badge-title { color: var(--c-gold); font-size: var(--fs-sm); }
.badge-ultimate { color: var(--c-accent-dark); font-size: var(--fs-sm); font-weight: 700; }
