@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700&family=DotGothic16&family=Noto+Sans+JP:wght@500;700;900&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: 'Noto Sans JP', sans-serif;
  overflow: hidden;
  background-color: #f8fafc;
  color: #0f172a;
  user-select: none;
  height: 100vh;
  height: 100dvh; /* iOS Safari URLバー考慮の動的ビューポート高 */
  width: 100vw;
}

#game-container {
  width: 100vw;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 50%, #f8fafc 100%);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.08);
  padding-bottom: env(safe-area-inset-bottom, 0px); /* セーフエリア考慮 */
}

/* ==========================================================================
   1. 最上部: スマホヘッダー (タイトルの代わりにラウンド表示＆ログ)
   ========================================================================== */
#sa-top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 10px;
  height: 38px;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1.5px solid #e2e8f0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

/* アクションログバナー */
#sa-battle-banner {
  flex: 1;
  background: transparent;
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sa-round-indicator {
  font-family: 'DotGothic16', monospace;
  font-size: 0.75rem;
  color: #ffffff;
  background: #0284c7;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: bold;
  flex-shrink: 0;
}

/* ==========================================================================
   2. 中央: 2D アリーナ ＆ コミック風吹き出し ＆ 対戦フィールド
   ========================================================================== */
#battle-stage-2d {
  flex: 1;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 6px 10px 145px 10px;
  gap: 6px;
  overflow: hidden;
}

/* 参加者リストコンテナ */
#participants-grid {
  width: 100%;
}

.participants-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

/* ゴッドフィールド風 横一列ステータスバー (高さ34px) */
.participant-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 34px;
  padding: 4px 10px;
  border-radius: 18px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.participant-strip.user-player {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.participant-strip.turn-active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.participant-strip.under-attack {
  border-color: #ef4444 !important;
  background: #fef2f2 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.4) !important;
  animation: pulse-under-attack 0.8s infinite alternate !important;
}

@keyframes pulse-under-attack {
  0% { transform: scale(1); box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.4); }
  100% { transform: scale(1.02); box-shadow: 0 0 12px rgba(239, 68, 68, 0.8); }
}

.under-attack-badge {
  background: #ef4444;
  color: #ffffff;
  font-size: 0.58rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 6px;
  animation: flash-badge 0.6s infinite alternate;
}

@keyframes flash-badge {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

.participant-strip.dead {
  opacity: 0.45;
  filter: grayscale(1);
  background: #e2e8f0;
}

.strip-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.turn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
}

.turn-dot.active {
  background: #2563eb;
  box-shadow: 0 0 6px rgba(37, 99, 235, 0.8);
}

.strip-avatar {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.strip-name {
  font-size: 0.78rem;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.you-badge {
  color: #0284c7;
  font-weight: 900;
  font-size: 0.65rem;
}

.strip-status-badges {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: 4px;
}

.status-badge {
  font-size: 0.55rem;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 4px;
  color: #ffffff;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.overheat-badge { background: #f97316; } /* オレンジ: 火 */
.erosion-badge { background: #8b5cf6; }  /* 紫: 毒/蝕み */
.seal-badge { background: #475569; }     /* ダークグレー: 封印 */
.spirit-badge { background: #06b6d4; }   /* シアン: 英霊 */

.strip-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 900;
  flex-shrink: 0;
}

.st-inline { display: flex; align-items: center; gap: 2px; }
.st-inline small { font-size: 0.62rem; color: #64748b; font-weight: 900; margin-right: 1px; }

.st-hp { color: #e11d48; }
.st-mp { color: #0284c7; }
.st-sp { color: #d97706; }

/* 3. 人が喋っている本物のコミック風吹き出し (文字切り・省略なしの完全表示) */
.character-speech-bubble {
  position: relative;
  width: 100%;
  background: #ffffff;
  border: 2.5px solid #0284c7;
  border-radius: 18px;
  padding: 8px 14px 8px 40px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.45;
  box-shadow: 0 3px 12px rgba(2, 132, 199, 0.15);
  margin-top: 6px;
  white-space: normal; /* 折り返しを有効化して全文章を表示 */
  word-break: break-word;
}

/* 吹き出しのアイコン (人が喋っている吹き出しマーク) */
.character-speech-bubble::before {
  content: '💬';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
}

/* 吹き出しの三角のしっぽ (上のキャラステータスを指すしっぽ) */
.character-speech-bubble::after {
  content: '';
  position: absolute;
  top: -10px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 10px solid #0284c7;
}

/* 中央: 対戦フィールド (左: 攻撃側 / 右: 防御側) */
#center-field-arena {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#battle-versus-field {
  display: flex;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  height: 145px;
}

.arena-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.75);
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 6px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
}

.attacker-side {
  border-color: #fca5a5;
  background: rgba(254, 242, 242, 0.7);
}

.attacker-side.clickable-attack-trigger {
  cursor: pointer;
  border-color: #ef4444 !important;
  background: rgba(254, 226, 226, 0.95) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3), 0 4px 15px rgba(239, 68, 68, 0.25) !important;
  animation: attack-trigger-pulse 1s infinite alternate;
}

@keyframes attack-trigger-pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.02); }
}

.defender-side {
  border-color: #93c5fd;
  background: rgba(239, 246, 255, 0.7);
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed #cbd5e1;
  padding-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 900;
  color: #334155;
}

.stat-badge {
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.65rem;
  color: #ffffff;
  font-weight: 900;
}
.atk-badge { background: #dc2626; }
.def-badge { background: #2563eb; }

/* 複数カード縦スクロール可能リスト */
.staged-cards-scroll {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  padding: 4px 0;
  align-items: center;
}

.field-placeholder-text {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-align: center;
  margin: auto;
  line-height: 1.3;
}

.vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.75rem;
  color: #94a3b8;
  font-style: italic;
  padding: 0 2px;
}

/* 置き場内のミニカード (見やすさ大幅向上) */
.staged-mini-card {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  padding: 3px 6px;
  gap: 6px;
  border-radius: 8px;
  background: #ffffff;
  border: 1.8px solid var(--attr-main-color, #0284c7);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  animation: mini-card-pop 0.2s ease;
}

@keyframes mini-card-pop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.staged-mini-card .card-art-image {
  width: 30px; height: 30px; object-fit: contain; z-index: 3; flex-shrink: 0; background: #f8fafc; border-radius: 5px; padding: 1px; border: 1px solid #cbd5e1;
}

.mini-card-center-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  z-index: 3;
}

.mini-card-title {
  font-size: 0.72rem; font-weight: 900; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2;
}

.mini-card-desc {
  font-size: 0.58rem; font-weight: 800; color: #0284c7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.1;
}

.mini-card-stat {
  font-size: 0.74rem; font-weight: 900; color: #ffffff; background: var(--attr-main-color, #ef4444); padding: 2px 6px; border-radius: 10px; z-index: 3; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* 4. アクションメッセージ ＆ 進行コントロールバー */
#sa-card-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  border: 1.5px solid #cbd5e1;
  border-radius: 18px;
  padding: 5px 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  margin-top: 2px;
}

#action-bar-info {
  font-size: 0.75rem;
  font-weight: 800;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#action-bar-buttons { display: flex; gap: 4px; }

.sa-btn {
  padding: 3px 12px;
  border-radius: 14px;
  border: none;
  font-weight: 800;
  font-size: 0.72rem;
  cursor: pointer;
  white-space: nowrap;
}

.green-btn { background: #10b981; color: white; }
.blue-btn { background: #2563eb; color: white; }
.red-btn { background: #dc2626; color: white; }
.gold-btn { background: #d97706; color: white; }

/* ==========================================================================
   5. 最下部: 手札ファンバー ＆ ジャンルソートタブ
   ========================================================================== */
#sa-bottom-hand-bar {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 2px);
  left: 0;
  width: 100%;
  height: 150px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
  padding-bottom: 2px;
  overflow: visible;
}

/* ジャンル絞り込みタブ (画面右側に縦並びで配置) */
#hand-genre-filter-bar {
  position: absolute;
  right: 8px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  top: auto;
  left: auto;
  transform: none;
  z-index: 250;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid #cbd5e1;
  border-radius: 18px;
  padding: 6px 4px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
}

.genre-tab {
  border: none;
  background: transparent;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 900;
  font-size: 0.75rem;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.genre-tab:hover {
  color: #0284c7;
  background: #e0f2fe;
}

.genre-tab.active {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.3);
}

.no-filter-card-msg {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 800;
  margin: auto;
  text-align: center;
}

.hand-fan-wrapper {
  position: relative;
  width: 100%;
  height: 150px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: auto;
  overflow: visible;
  touch-action: pan-x;
}

/* 手札内の各カード */
.sa-hand-card-item {
  width: 95px;
  height: 135px;
  position: absolute;
  bottom: 0;
  left: calc(50% - 47.5px);
  border-radius: 7px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25), 0 0 0 1.5px var(--attr-main-color, #0284c7);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
  cursor: pointer;
  background: #ffffff;
  user-select: none;
  transform-origin: 50% 130%;
  transform: translateX(var(--card-x, 0px)) rotate(var(--card-rot, 0deg)) translateY(var(--card-y, 0px));
}

.sa-hand-card-item:hover {
  transform: translateX(var(--card-x, 0px)) rotate(0deg) translateY(-20px) scale(1.08) !important;
  z-index: 220 !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35), 0 0 0 2px var(--attr-main-color, #0284c7);
}

.sa-hand-card-item.selected {
  transform: translateX(var(--card-x, 0px)) rotate(0deg) translateY(-32px) scale(1.12) !important;
  z-index: 300 !important;
  box-shadow: 0 12px 28px rgba(2, 132, 199, 0.5), 0 0 0 3px #0284c7, 0 0 15px rgba(2, 132, 199, 0.6);
  animation: selected-card-bounce 0.25s ease-out;
}

@keyframes selected-card-bounce {
  0% { transform: translateX(var(--card-x, 0px)) rotate(0deg) translateY(0px) scale(1); }
  60% { transform: translateX(var(--card-x, 0px)) rotate(0deg) translateY(-38px) scale(1.15); }
  100% { transform: translateX(var(--card-x, 0px)) rotate(0deg) translateY(-32px) scale(1.12); }
}

.card-selected-check-badge {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  background: #0284c7;
  color: #ffffff;
  font-size: 0.52rem;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 8px;
  z-index: 20;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.sa-hand-card-item.disabled {
  opacity: 0.4;
  filter: grayscale(0.6);
  cursor: not-allowed;
}

/* 手札カード内部エレメント */
.sa-hand-card-item .base-frame-bg {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; filter: var(--frame-filter, none);
}
.sa-hand-card-item .frame-color-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--attr-main-color, #0284c7); opacity: 0.25; mix-blend-mode: hard-light; z-index: 2;
}
.sa-hand-card-item .card-art-image {
  position: absolute; top: 17%; left: 10%; width: 80%; height: 46%; object-fit: contain; z-index: 3; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));
}
.sa-hand-card-item .slot-mp-badge {
  position: absolute; top: 2.8%; left: 3.5%; width: 22%; height: 15.5%; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; background: var(--attr-main-color, #0284c7); border: 1.2px solid #ffffff; color: #fff;
}
.sa-hand-card-item .slot-mp-badge .label { font-size: 0.35rem; font-weight: 900; line-height: 1; }
.sa-hand-card-item .slot-mp-badge .val { font-size: 0.58rem; font-weight: 900; line-height: 1; }

.sa-hand-card-item .slot-attr-badge {
  position: absolute; top: 2.8%; right: 3.5%; width: 22%; height: 15.5%; z-index: 4; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--attr-main-color, #0284c7); border: 1.2px solid #ffffff; color: #fff;
}
.sa-hand-card-item .slot-attr-badge .attr-name-single { font-size: 0.72rem; font-weight: 900; line-height: 1; }

.sa-hand-card-item .slot-title-banner {
  position: absolute; top: 4.8%; left: 24%; width: 52%; height: 12%; z-index: 4; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 2px;
}
.sa-hand-card-item .slot-title-banner .card-title-main {
  font-size: 0.5rem; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;
}

.sa-hand-card-item .slot-stat-badge {
  position: absolute; top: 50.5%; left: 39%; width: 22%; height: 15.5%; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; background: var(--attr-main-color, #0284c7); border: 1.2px solid #ffffff;
}
.sa-hand-card-item .slot-stat-badge .stat-lbl { font-size: 0.35rem; font-weight: 900; color: #fff; line-height: 1; }
.sa-hand-card-item .slot-stat-badge .stat-num { font-size: 0.65rem; font-weight: 900; color: #fff; line-height: 1; }

.sa-hand-card-item .slot-desc-box {
  position: absolute; bottom: 5.2%; left: 8.5%; width: 83%; height: 29%; z-index: 4; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px; color: #0f172a; font-size: 0.48rem; font-weight: 800; line-height: 1.1;
}

/* ドロー獲得カードの浮遊演出レイヤー (枠や背景なしでカードが手前にふわふわ浮かぶ) */
.drawn-cards-floating-layer {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 500;
  cursor: pointer;
  pointer-events: auto;
  animation: float-card-enter 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes float-card-enter {
  0% { transform: translate(-50%, -60%) scale(0.6); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.floating-cards-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  padding: 0 10px;
}

/* 浮遊する本物のカード */
.floating-card-item {
  width: 110px;
  height: 156px;
  position: relative;
  border-radius: 9px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35), 0 0 0 2.5px var(--attr-main-color, #0284c7);
  background: #ffffff;
  user-select: none;
  animation: card-gentle-float 2s ease-in-out infinite alternate;
}

@keyframes card-gentle-float {
  0% { transform: translateY(0px) rotate(-1.5deg); }
  100% { transform: translateY(-8px) rotate(1.5deg); }
}

.floating-card-item .base-frame-bg {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; filter: var(--frame-filter, none);
}
.floating-card-item .frame-color-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--attr-main-color, #0284c7); opacity: 0.25; mix-blend-mode: hard-light; z-index: 2;
}
.floating-card-item .card-art-image {
  position: absolute; top: 17%; left: 10%; width: 80%; height: 46%; object-fit: contain; z-index: 3; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));
}
.floating-card-item .slot-mp-badge {
  position: absolute; top: 2.8%; left: 3.5%; width: 22%; height: 15.5%; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; background: var(--attr-main-color, #0284c7); border: 1.2px solid #ffffff; color: #fff;
}
.floating-card-item .slot-mp-badge .label { font-size: 0.38rem; font-weight: 900; line-height: 1; }
.floating-card-item .slot-mp-badge .val { font-size: 0.62rem; font-weight: 900; line-height: 1; }

.floating-card-item .slot-attr-badge {
  position: absolute; top: 2.8%; right: 3.5%; width: 22%; height: 15.5%; z-index: 4; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--attr-main-color, #0284c7); border: 1.2px solid #ffffff; color: #fff;
}
.floating-card-item .slot-attr-badge .attr-name-single { font-size: 0.76rem; font-weight: 900; line-height: 1; }

.floating-card-item .slot-title-banner {
  position: absolute; top: 4.8%; left: 24%; width: 52%; height: 12%; z-index: 4; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 2px;
}
.floating-card-item .slot-title-banner .card-title-main {
  font-size: 0.55rem; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;
}

.floating-card-item .slot-stat-badge {
  position: absolute; top: 50.5%; left: 39%; width: 22%; height: 15.5%; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; background: var(--attr-main-color, #0284c7); border: 1.2px solid #ffffff;
}
.floating-card-item .slot-stat-badge .stat-lbl { font-size: 0.38rem; font-weight: 900; color: #fff; line-height: 1; }
.floating-card-item .slot-stat-badge .stat-num { font-size: 0.7rem; font-weight: 900; color: #fff; line-height: 1; }

.floating-card-item .slot-desc-box {
  position: absolute; bottom: 5.2%; left: 8.5%; width: 83%; height: 29%; z-index: 4; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px; color: #0f172a; font-size: 0.52rem; font-weight: 800; line-height: 1.1;
}

/* 画面右端・山札側から小さく回転・拡大しながら左から順番に飛んでくるアニメーション */
.floating-card-item.fly-in-from-corner {
  animation: card-fly-from-corner 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards var(--stagger-delay, 0s), card-gentle-float 2s ease-in-out infinite alternate calc(0.5s + var(--stagger-delay, 0s)) !important;
  opacity: 0;
}

@keyframes card-fly-from-corner {
  0% {
    transform: translate(140px, -200px) scale(0.2) rotate(45deg);
    opacity: 0;
    box-shadow: 0 0 0 0 rgba(2, 132, 199, 0);
  }
  70% {
    transform: translate(0px, -6px) scale(1.1) rotate(-3deg);
    opacity: 1;
    box-shadow: 0 14px 30px rgba(2, 132, 199, 0.4), 0 0 0 3px #0284c7;
  }
  100% {
    transform: translate(0px, 0px) scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* タップ収納時: 右側の対応するジャンルタブへ小さくなって吸収収納されるアニメーション */
.drawn-cards-floating-layer.absorbing {
  pointer-events: none;
}

.floating-card-item.absorb-to-tab {
  animation: card-absorb-to-genre 0.45s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards !important;
}

@keyframes card-absorb-to-genre {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
    opacity: 1;
  }
  50% {
    opacity: 0.9;
    transform: translate(90px, 40px) scale(0.5) rotate(15deg);
  }
  100% {
    transform: translate(150px, 120px) scale(0.05) rotate(45deg);
    opacity: 0;
  }
}

.floating-card-tap-hint {
  font-size: 0.78rem;
  font-weight: 900;
  color: #ffffff;
  background: #0284c7;
  padding: 5px 18px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
  animation: pulse-tap-hint 1.2s infinite alternate;
  transition: opacity 0.2s ease;
}

.drawn-card-chip .chip-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 4px;
}

.drawn-card-chip .chip-name {
  font-size: 0.78rem;
  font-weight: 900;
  color: #0f172a;
}

.drawn-card-chip .chip-stat {
  font-size: 0.74rem;
  font-weight: 900;
  color: #ffffff;
  background: var(--attr-main-color, #0284c7);
  padding: 2px 6px;
  border-radius: 10px;
}

.draw-popup-close-hint {
  font-size: 0.76rem;
  font-weight: 800;
  color: #0284c7;
  background: #e0f2fe;
  padding: 6px 16px;
  border-radius: 20px;
  margin-top: 4px;
  animation: pulse-tap-hint 1.2s infinite alternate;
}

@keyframes pulse-tap-hint {
  0% { transform: scale(0.98); opacity: 0.8; }
  100% { transform: scale(1.04); opacity: 1; }
}

.popup-card-preview .base-frame-bg {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; filter: var(--frame-filter, none);
}
.popup-card-preview .frame-color-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--attr-main-color, #0284c7); opacity: 0.25; mix-blend-mode: hard-light; z-index: 2;
}
.popup-card-preview .card-art-image {
  position: absolute; top: 17%; left: 10%; width: 80%; height: 46%; object-fit: contain; z-index: 3; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.popup-card-preview .slot-mp-badge {
  position: absolute; top: 2.8%; left: 3.5%; width: 22%; height: 15.5%; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; background: var(--attr-main-color, #0284c7); border: 1.5px solid #ffffff; color: #fff;
}
.popup-card-preview .slot-mp-badge .label { font-size: 0.45rem; font-weight: 900; line-height: 1; }
.popup-card-preview .slot-mp-badge .val { font-size: 0.75rem; font-weight: 900; line-height: 1; }
.popup-card-preview .slot-attr-badge {
  position: absolute; top: 2.8%; right: 3.5%; width: 22%; height: 15.5%; z-index: 4; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--attr-main-color, #0284c7); border: 1.5px solid #ffffff; color: #fff;
}
.popup-card-preview .slot-attr-badge .attr-name-single { font-size: 0.9rem; font-weight: 900; line-height: 1; }
.popup-card-preview .slot-title-banner {
  position: absolute; top: 4.8%; left: 24%; width: 52%; height: 12%; z-index: 4; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 2px;
}
.popup-card-preview .slot-title-banner .card-title-main {
  font-size: 0.68rem; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;
}
.popup-card-preview .slot-stat-badge {
  position: absolute; top: 50.5%; left: 39%; width: 22%; height: 15.5%; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; background: var(--attr-main-color, #0284c7); border: 1.5px solid #ffffff;
}
.popup-card-preview .slot-stat-badge .stat-lbl { font-size: 0.45rem; font-weight: 900; color: #fff; line-height: 1; }
.popup-card-preview .slot-stat-badge .stat-num { font-size: 0.8rem; font-weight: 900; color: #fff; line-height: 1; }
.popup-card-preview .slot-desc-box {
  position: absolute; bottom: 5.2%; left: 8.5%; width: 83%; height: 29%; z-index: 4; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px; color: #0f172a; font-size: 0.6rem; font-weight: 800; line-height: 1.1;
}

.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center;
}

.modal-content {
  background: #ffffff; border: 2px solid #cbd5e1; border-radius: 16px; padding: 20px; width: 90%; max-width: 380px; color: #0f172a;
}

.hidden { display: none !important; }
