/* ============================================================
   Prismaera Cards — PoC Phase 0 スタイル (Aurora 紫×シアン)
   ============================================================ */
:root {
  --bg: #1a1d3a;
  --bg-elev: #232852;
  --bg-card: #2c3160;
  --bg-card-hi: #3a4080;
  --border: rgba(190, 180, 255, 0.28);
  --border-hi: rgba(190, 180, 255, 0.55);
  --text: #f4f5ff;
  --text-dim: #c5c9eb;
  --aurora-1: #7c5dff;
  --aurora-2: #5fdfff;
  --aurora-3: #ff8ddc;
  --gold: #ffd56b;
  --me: #5fdfff;
  --opp: #ff8ddc;
  --tier-lr: linear-gradient(120deg, #ff9a4a, #ffd56b, #ff8ddc, #5fdfff, #7c5dff);
  --tier-ur: linear-gradient(135deg, #ffc25c, #ff8ddc);
  --tier-ssr: linear-gradient(135deg, #ffd56b, #ff9a4a);
  --tier-sr: linear-gradient(135deg, #c8b8ff, #7c5dff);
  --tier-r: linear-gradient(135deg, #5fdfff, #7c5dff);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body {
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 20% 0%, #3d2f7a 0%, transparent 55%),
    radial-gradient(ellipse at 80% 30%, #1f4a7a 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, #4a2a6a 0%, transparent 60%),
    linear-gradient(180deg, #1a1d3a 0%, #14163a 100%);
  background-attachment: fixed;
}

/* ===== ヘッダ ===== */
.cg-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: rgba(5, 6, 13, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.cg-back, .cg-help, .cg-iconbtn {
  width: 36px; height: 36px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 18px;
  text-decoration: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.cg-back:hover, .cg-help:hover, .cg-iconbtn:hover { border-color: var(--border-hi); }
.cg-topbar-right { display: flex; gap: 6px; align-items: center; }
.cg-iconbtn.muted { opacity: 0.6; background: rgba(0,0,0,0.4); }
.cg-title {
  font-size: 16px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.cg-title-sub {
  background: var(--tier-lr);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}
.cg-phase {
  font-size: 10px;
  background: rgba(255, 213, 107, 0.15);
  color: var(--gold);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 213, 107, 0.3);
  margin-left: 4px;
}

/* ===== Screen 切替 ===== */
.cg-screen { display: none; }
.cg-screen.active { display: block; }

/* ===== ホーム画面 ===== */
.cg-hero {
  position: relative;
  text-align: center;
  padding: 40px 20px 30px;
  overflow: hidden;
}
.cg-aurora {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(107, 74, 255, 0.5), transparent 50%),
    radial-gradient(ellipse at 70% 60%, rgba(74, 214, 255, 0.4), transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(255, 122, 214, 0.3), transparent 50%);
  filter: blur(40px);
  z-index: 0;
  animation: auroraFlow 18s ease-in-out infinite alternate;
}
@keyframes auroraFlow {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(20px, -10px) scale(1.1); }
}
.cg-hero-icon { font-size: 56px; position: relative; z-index: 1; }
.cg-hero-title {
  position: relative; z-index: 1;
  font-size: 28px; font-weight: 700;
  margin: 8px 0 6px;
  background: var(--tier-lr);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.cg-hero-tagline {
  position: relative; z-index: 1;
  font-size: 13px; color: var(--text-dim);
  margin: 0;
}

.cg-modes {
  display: flex; flex-direction: column; gap: 10px;
  padding: 0 16px 20px;
  max-width: 480px; margin: 0 auto;
}
.cg-mode-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.cg-mode-btn:not(.disabled):hover { transform: translateY(-2px); border-color: var(--border-hi); }
.cg-mode-btn.primary { border-color: var(--aurora-2); box-shadow: 0 0 22px rgba(74, 214, 255, .15); }
.cg-mode-btn.secondary { background: rgba(20, 22, 51, 0.6); }
.cg-mode-btn.disabled { opacity: .4; cursor: not-allowed; }
.cg-mode-icon { font-size: 28px; }
.cg-mode-title { font-size: 15px; font-weight: 600; }
.cg-mode-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.cg-foot-note {
  text-align: center; font-size: 11px; color: var(--text-dim);
  padding: 10px 20px 30px;
}

/* ===== BO3 toggle (ホーム画面、 モード選択の上) ===== */
.cg-bo3-toggle {
  max-width: 480px; margin: 0 auto 14px; padding: 0 16px;
}
.cg-bo3-label {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: rgba(255, 213, 107, 0.08);
  border: 1px solid rgba(255, 213, 107, 0.3);
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s;
}
.cg-bo3-label:hover { background: rgba(255, 213, 107, 0.16); }
.cg-bo3-label input[type="checkbox"] {
  width: 18px; height: 18px; cursor: pointer; accent-color: var(--gold);
}
.cg-bo3-text { font-weight: 700; color: var(--gold); flex: 1; font-size: 14px; }
.cg-bo3-sub { font-size: 11px; color: var(--text-dim); }

/* ===== BO3 series 表示 ===== */
.cg-series-info {
  text-align: center;
  padding: 4px 8px;
  font-size: 12px;
  background: rgba(255, 213, 107, 0.12);
  border-bottom: 1px solid rgba(255, 213, 107, 0.3);
  color: var(--gold);
  font-weight: 600;
}
.cg-diff-tag {
  background: rgba(124, 93, 255, 0.5);
  color: #fff;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}
.cg-mover-tag {
  background: rgba(124, 93, 255, 0.4);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  margin-left: 8px;
}

/* ===== スマホ電池対策 (野沢さん指示 2026-05-04 「電池すごい食いそう」) ===== */
@media (max-width: 480px) {
  /* aurora animation 停止 (GPU 連続描画でバッテリー食う) */
  .cg-aurora { animation: none; }
  .cg-result-peek-btn { animation: none; }
  /* backdrop-filter blur は GPU 重い → 削除/軽量化 */
  .cg-combos-panel { backdrop-filter: none; background: rgba(20, 22, 51, 0.95); }
  .cg-modal-backdrop { backdrop-filter: blur(2px); }
  .cg-topbar { backdrop-filter: blur(4px); }
  .cg-hand-area { backdrop-filter: blur(4px); }
  /* 大きい box-shadow も軽量化 */
  .cg-mode-btn.primary { box-shadow: 0 0 8px rgba(74, 214, 255, .15); }
  .cg-end-turn { box-shadow: 0 0 6px rgba(95, 223, 255, .25); }
}
/* prefers-reduced-motion: ユーザー OS 設定で animation 縮減 */
@media (prefers-reduced-motion: reduce) {
  .cg-aurora { animation: none; }
  .cg-result-peek-btn { animation: none; }
  .cg-card.placed-anim { animation: none; }
}
.cg-score-vs { color: var(--text-dim); margin: 0 4px; }

/* マリガンボタン (HUD 内) */
#btn-mulligan {
  background: rgba(255, 213, 107, 0.18);
  border-color: rgba(255, 213, 107, 0.5);
  color: var(--gold);
}
#btn-mulligan:hover:not(:disabled) {
  background: rgba(255, 213, 107, 0.32);
}

/* ===== 試合画面 HUD ===== */
.cg-hud {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 56px; z-index: 40;
}
.cg-hud-block {
  display: flex; flex-direction: column; align-items: center;
  padding: 0 8px;
  border-right: 1px solid var(--border);
  min-width: 56px;
}
.cg-hud-block:last-of-type { border-right: none; }
.cg-hud-label { font-size: 10px; color: var(--text-dim); }
.cg-hud-value { font-size: 16px; font-weight: 700; }
.cg-score-me { color: var(--me); }
.cg-score-ai { color: var(--opp); }
.cg-hud-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}
.cg-hud-btn {
  background: rgba(124, 93, 255, 0.18);
  color: var(--text);
  border: 1px solid rgba(124, 93, 255, 0.4);
  padding: 7px 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.cg-hud-btn:hover:not(:disabled) {
  background: rgba(124, 93, 255, 0.32);
  border-color: var(--border-hi);
}
.cg-hud-btn:disabled { opacity: .35; cursor: not-allowed; }

.cg-end-turn {
  background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2));
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(95, 223, 255, .4);
  white-space: nowrap;
}
.cg-end-turn:active { transform: scale(.96); }
.cg-end-turn:disabled {
  opacity: .4;
  cursor: not-allowed;
  box-shadow: none;
  background: rgba(124, 93, 255, 0.2);
}

@media (max-width: 480px) {
  /* スマホ HUD コンパクト化 (野沢さん指示 2026-05-04 「もう少しコンパクトに」) */
  .cg-hud { flex-wrap: nowrap; padding: 5px 8px; gap: 6px; }
  .cg-hud-block { padding: 0 4px; min-width: 0; border-right: 1px solid var(--border); }
  .cg-hud-label { display: none; }  /* ラベル省略、 値だけ表示 */
  .cg-hud-value { font-size: 13px; }
  .cg-hud-actions { margin-left: auto; gap: 3px; }
  .cg-hud-btn { padding: 4px 7px; font-size: 10px; }
  .cg-end-turn { padding: 6px 9px; font-size: 11px; }
  .cg-topbar { padding: 6px 10px; }
  .cg-title { font-size: 13px; }
  .cg-back, .cg-help, .cg-iconbtn { width: 32px; height: 32px; font-size: 16px; }
}

/* ===== Board ===== */
.cg-board {
  padding: 8px 8px 4px;
}
.cg-side-label {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  padding: 0 4px 4px;
}
.cg-board-opp .cg-side-label { color: var(--opp); }
.cg-board-me  .cg-side-label { color: var(--me); }

.cg-lanes {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.cg-lane {
  background: rgba(35, 40, 82, 0.65);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 4px;
  min-height: 130px;
  cursor: default;
  transition: background .15s, border-color .15s;
  backdrop-filter: blur(4px);
}
.cg-lane.lane-target {
  background: rgba(74, 214, 255, 0.18);
  border-color: var(--aurora-2);
  cursor: pointer;
  box-shadow: 0 0 12px rgba(74, 214, 255, .4) inset;
}
.cg-lane.lane-win-me   { border-color: var(--me); box-shadow: 0 0 16px rgba(74, 214, 255, .35) inset; }
.cg-lane.lane-win-opp  { border-color: var(--opp); box-shadow: 0 0 16px rgba(255, 122, 214, .35) inset; }

.cg-lane-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10px; padding: 0 2px 4px;
}
.cg-lane-name { color: var(--text-dim); letter-spacing: 0.1em; }
.cg-lane-power { font-size: 14px; font-weight: 700; }

.cg-lane-slots {
  display: flex; flex-wrap: wrap; gap: 4px;
  min-height: 100px;
  align-content: flex-start;
}

/* ===== カード ===== */
.cg-card {
  width: 72px; height: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 10px;
  display: flex; flex-direction: column;
  position: relative;
  cursor: default;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.cg-card.placed-anim { animation: placeCard .35s ease-out; }
@keyframes placeCard {
  from { transform: translateY(-20px) scale(.7); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.cg-card-tier {
  height: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.cg-card-tier.LR  { background: var(--tier-lr); }
.cg-card-tier.UR  { background: var(--tier-ur); }
.cg-card-tier.SSR { background: var(--tier-ssr); }
.cg-card-tier.SR  { background: var(--tier-sr); }
.cg-card-tier.R   { background: var(--tier-r); }

.cg-card-img {
  flex: 1;
  background-color: var(--bg-card-hi);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  position: relative;
}
.cg-card-img.no-img::after {
  content: '🎴';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  opacity: 0.4;
}

.cg-card-name {
  font-size: 9px; line-height: 1.1;
  padding: 2px 3px;
  text-align: center;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.85));
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
  position: absolute;
  left: 0; right: 0; bottom: 24px;
  word-break: keep-all;
  font-weight: 600;
  pointer-events: none;
}
.cg-card-stats {
  display: flex; justify-content: space-between; align-items: center;
  padding: 2px 4px;
  font-size: 11px; font-weight: 700;
  background: rgba(0,0,0,.7);
  height: 24px;
  flex-shrink: 0;
}
.cg-card-cost { color: var(--gold); text-shadow: 0 1px 2px rgba(0,0,0,.8); }
.cg-card-power { color: var(--aurora-2); text-shadow: 0 1px 2px rgba(0,0,0,.8); }

/* 凸数バッジ */
.cg-card-dupes {
  display: inline-block;
  background: rgba(255, 213, 107, 0.85);
  color: #2a1f00;
  padding: 0 4px;
  margin-left: 4px;
  border-radius: 4px;
  font-size: 8px;
  font-weight: 700;
  vertical-align: middle;
  text-shadow: none;
}

/* 派閥チップ (右上 absolute、 派閥カラー背景) */
.cg-card-faction {
  position: absolute;
  top: 14px;
  right: 0;
  font-size: 8px;
  font-weight: 700;
  color: #1a1d3a;
  padding: 2px 5px 2px 6px;
  border-radius: 0 0 0 6px;
  max-width: 75%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 1px rgba(255,255,255,0.4);
  z-index: 2;
  pointer-events: none;
  border-left: 1px solid rgba(0,0,0,0.2);
  border-bottom: 1px solid rgba(0,0,0,0.2);
}

/* 配置済 自軍カード = ターン中なら手札に戻せる affordance */
.cg-card.undoable {
  cursor: pointer;
  position: relative;
  outline: 2px solid rgba(95, 223, 255, 0.45);
  outline-offset: -2px;
}
.cg-card.undoable::after {
  content: '↩';
  position: absolute;
  top: 16px; right: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 10px;
  width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(95, 223, 255, 0.7);
  opacity: 0;
  transition: opacity .15s;
}
.cg-card.undoable:hover::after { opacity: 1; }

/* AI のカード = 裏向きデザイン (覆面) */
.cg-card.opp.face-down .cg-card-img,
.cg-card.opp.face-down .cg-card-name { display: none; }
.cg-card.opp.face-down {
  background: linear-gradient(135deg, #2a1f5a 0%, #1a1846 100%);
  position: relative;
}
.cg-card.opp.face-down::before {
  content: '✦';
  position: absolute;
  inset: 14px 0 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  background: var(--tier-lr);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.7;
}

/* ===== 中央メッセージ ===== */
.cg-message {
  text-align: center;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(20, 22, 51, 0.4);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 6px 0;
  min-height: 18px;
}
.cg-message.alert { color: var(--gold); font-weight: 600; }
.cg-message.success { color: var(--aurora-2); font-weight: 600; }

/* ===== 手札 ===== */
.cg-hand-area {
  position: sticky; bottom: 0;
  background: rgba(5, 6, 13, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 8px 8px 12px;
  z-index: 30;
}
.cg-hand-label {
  font-size: 10px; color: var(--text-dim); padding: 0 4px 4px;
  display: flex; justify-content: space-between;
}
.cg-hand-count { color: var(--gold); font-weight: 600; }
.cg-hand {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding: 4px;
}
.cg-hand .cg-card {
  width: 92px; height: 134px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  flex-shrink: 0;
  position: relative;
}
.cg-hand .cg-card .cg-card-name { font-size: 10px; bottom: 38px; }
.cg-hand .cg-card.selected {
  transform: translateY(-10px);
  box-shadow: 0 0 20px rgba(95, 223, 255, .8);
  border-color: var(--aurora-2);
}
.cg-hand .cg-card.unaffordable { opacity: .4; cursor: not-allowed; filter: grayscale(0.5); }
.cg-hand .cg-card.unaffordable.selected { transform: none; box-shadow: none; }
.cg-hand .cg-card-effect {
  font-size: 8px;
  color: #fff;
  padding: 2px 4px;
  text-align: center;
  background: rgba(124, 93, 255, 0.85);
  line-height: 1.2;
  height: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}
/* 場のカードに置かれたものにも effect 表示 (場合 = small だが見せる) */
.cg-card .cg-card-effect {
  font-size: 7px;
  color: #fff;
  padding: 1px 2px;
  background: rgba(124, 93, 255, 0.85);
  text-align: center;
  line-height: 1.1;
  flex-shrink: 0;
}

/* ===== モーダル ===== */
.cg-modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.cg-modal[hidden] { display: none; }
.cg-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px);
}
/* 結果モーダルは backdrop 半透明、 場の状態が透けて見える */
.cg-modal-result .cg-modal-backdrop {
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(2px);
}

/* 結果に戻る floating ボタン (場を見ている時) */
.cg-result-peek-btn {
  position: fixed;
  bottom: 20px;
  right: 16px;
  z-index: 80;
  background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2));
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(95, 223, 255, .55);
  animation: peekFloat 2.4s ease-in-out infinite;
}
@keyframes peekFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
.cg-modal-card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border-hi);
  border-radius: 18px;
  padding: 28px 24px 20px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 0 40px rgba(107, 74, 255, .25);
  text-align: center;
}
.cg-modal-icon { font-size: 48px; }
.cg-modal-title {
  font-size: 22px; font-weight: 700;
  margin: 8px 0;
  background: var(--tier-lr);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.cg-modal-detail { font-size: 13px; color: var(--text-dim); margin: 8px 0 16px; line-height: 1.5; }
.cg-modal-actions {
  display: flex; gap: 8px; margin-top: 16px;
}
.cg-modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px;
  background: transparent; border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
}
.cg-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.cg-btn.primary {
  background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2));
  color: #fff;
  border: none;
  box-shadow: 0 0 14px rgba(74, 214, 255, .3);
}

/* ===== ヘルプ/チュートリアル本文 ===== */
.cg-help-card { max-width: 440px; text-align: left; }
.cg-help-body { font-size: 13px; line-height: 1.7; text-align: left; }
.cg-help-body p { margin: 6px 0; }
.cg-tut-step {
  display: flex; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.cg-tut-step:last-child { border-bottom: none; }
.cg-tut-no {
  flex-shrink: 0;
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--aurora-1), var(--aurora-2));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: #fff;
}
.cg-tut-sub { font-size: 11px; color: var(--text-dim); }

/* ===== PC 用 コンボ常時パネル (右 floating、 スマホは display:none) ===== */
.cg-combos-panel {
  display: none;  /* default 非表示、 PC で表示 */
  position: fixed;
  top: 64px;
  right: 12px;
  width: 240px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  background: rgba(20, 22, 51, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  z-index: 35;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.cg-combos-panel-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.cg-combos-panel-sub {
  font-size: 9px;
  font-weight: 400;
  color: var(--text-dim);
}
.cg-combos-panel-body {
  display: flex; flex-direction: column; gap: 6px;
}
.cg-combos-panel-empty {
  font-size: 11px; color: var(--text-dim);
  text-align: center; padding: 12px 0;
  margin: 0;
}
.cg-combos-panel-item {
  background: rgba(35, 40, 82, 0.6);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}
.cg-combos-panel-item.triggered {
  border-color: var(--gold);
  background: rgba(255, 213, 107, 0.12);
  box-shadow: 0 0 8px rgba(255, 213, 107, 0.3);
}
.cg-combos-panel-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  margin-bottom: 4px;
}
.cg-combos-panel-icon { font-size: 12px; }
.cg-combos-panel-name { flex: 1; }
.cg-combos-panel-status {
  font-size: 10px;
  background: rgba(124, 93, 255, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.cg-combos-panel-item.triggered .cg-combos-panel-status {
  background: rgba(255, 213, 107, 0.4);
  color: #2a1f00;
}
.cg-combos-panel-chars {
  display: flex; flex-wrap: wrap; gap: 3px;
}
.cg-combos-panel-chip {
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.cg-combos-panel-chip.has {
  background: rgba(95, 223, 255, 0.2);
  border-color: var(--aurora-2);
}
.cg-combos-panel-chip.miss {
  background: rgba(0,0,0,0.25);
  color: var(--text-dim);
}

/* PC のみ panel 表示 + match-screen 右余白 */
@media (min-width: 1024px) {
  .cg-combos-panel { display: block; }
  #match-screen { padding-right: 264px; }
}

/* ===== P-1: キャラ詳細モーダル ===== */
.cg-char-detail-card {
  max-width: 420px;
  width: calc(100vw - 32px);
  padding: 0;
  overflow: hidden;
  text-align: left;
  max-height: 90vh;
  overflow-y: auto;
}
.cg-char-detail-img {
  height: 220px;
  background-size: cover;
  background-position: center top;
  background-color: var(--bg-card-hi);
  background-repeat: no-repeat;
  border-bottom: 2px solid var(--border-hi);
}
.cg-char-detail-info { padding: 14px 18px 4px; }
.cg-char-detail-tier-row {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  margin-bottom: 8px;
}
.cg-char-detail-tier {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  letter-spacing: 0.05em;
}
.cg-char-detail-tier.LR  { background: var(--tier-lr); }
.cg-char-detail-tier.UR  { background: var(--tier-ur); }
.cg-char-detail-tier.SSR { background: var(--tier-ssr); }
.cg-char-detail-tier.SR  { background: var(--tier-sr); }
.cg-char-detail-tier.R   { background: var(--tier-r); }
.cg-char-detail-faction {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #1a1d3a;
  text-shadow: 0 1px 1px rgba(255,255,255,0.4);
}
.cg-char-detail-dupes {
  padding: 3px 8px;
  background: rgba(255,213,107,0.25);
  color: var(--gold);
  border: 1px solid rgba(255,213,107,0.4);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}
.cg-char-detail-name {
  font-size: 18px;
  font-weight: 700;
  margin: 4px 0 12px;
  color: var(--text);
}
.cg-char-detail-stats {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-dim);
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.cg-char-detail-stats b { color: var(--text); font-size: 14px; }
.cg-char-detail-effect {
  font-size: 13px;
  color: var(--text);
  background: rgba(124, 93, 255, 0.18);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid rgba(124, 93, 255, 0.4);
  line-height: 1.5;
}
.cg-char-detail-combos h3 {
  font-size: 12px;
  margin: 0 0 8px;
  color: var(--gold);
  letter-spacing: 0.05em;
}
.cg-char-combo-empty {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  padding: 6px 0;
  margin: 0;
}
.cg-char-combo-item {
  background: rgba(35, 40, 82, 0.55);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 6px;
}
.cg-char-combo-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}
.cg-char-combo-cond {
  font-size: 10px;
  color: var(--text-dim);
  margin: 3px 0;
}
.cg-char-combo-effect {
  font-size: 11px;
  color: var(--aurora-2);
  font-weight: 600;
}
.cg-char-combo-flavor {
  font-size: 10px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 3px;
  line-height: 1.4;
}

/* ===== コンボ確認モーダル ===== */
.cg-combos-card { max-width: 480px; text-align: left; max-height: 84vh; overflow-y: auto; }
.cg-combos-body {
  display: flex; flex-direction: column; gap: 10px;
  margin: 12px 0;
}
.cg-combo-item {
  background: rgba(35, 40, 82, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.cg-combo-item.triggered {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(255, 213, 107, 0.25);
  background: rgba(255, 213, 107, 0.08);
}
.cg-combo-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700;
  margin-bottom: 6px;
}
.cg-combo-icon { font-size: 18px; }
.cg-combo-name { flex: 1; }
.cg-combo-status {
  font-size: 10px;
  background: rgba(124, 93, 255, 0.3);
  color: var(--text);
  padding: 3px 8px;
  border-radius: 6px;
}
.cg-combo-item.triggered .cg-combo-status {
  background: rgba(255, 213, 107, 0.4);
  color: #2a1f00;
  font-weight: 700;
}
.cg-combo-cond { font-size: 10px; color: var(--text-dim); margin-bottom: 6px; }
.cg-combo-chars {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-bottom: 6px;
}
.cg-combo-chip {
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.cg-combo-chip.has {
  background: rgba(95, 223, 255, 0.2);
  border-color: var(--aurora-2);
  color: var(--text);
}
.cg-combo-chip.miss {
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-dim);
}
.cg-combo-flavor {
  font-size: 10px; color: var(--text-dim);
  font-style: italic;
  line-height: 1.4;
  margin-bottom: 4px;
}
.cg-combo-effect {
  font-size: 11px; color: var(--gold);
  font-weight: 600;
}

/* ===== モバイル最適化 (480px以下) ===== */
@media (max-width: 480px) {
  /* HUD 詰めた分 card サイズ確保 (64px 幅、 80px 高さ) */
  .cg-card { width: 64px; height: 92px; }
  .cg-card-name { font-size: 8px; bottom: 22px; }
  .cg-card-stats { font-size: 10px; height: 22px; }
  .cg-card .cg-card-effect { font-size: 7px; height: 13px; }
  .cg-card-faction { font-size: 7px; padding: 1px 4px 1px 5px; max-width: 65%; }
  .cg-hand .cg-card { width: 80px; height: 120px; }
  .cg-hand .cg-card .cg-card-name { font-size: 9px; bottom: 36px; }
  .cg-hand .cg-card-effect { font-size: 8px; }
  /* レーン縦広がり防止: nowrap + 横スクロール (野沢さん指示 2026-05-04) */
  .cg-lane {
    min-height: 116px;
    height: 116px;
    overflow: hidden;
  }
  .cg-lane-slots {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 92px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
  }
  .cg-lane-slots::-webkit-scrollbar { display: none; }
  .cg-hero-title { font-size: 24px; }
}

/* ===== PC最適化 (768px以上) ===== */
@media (min-width: 768px) {
  .cg-card { width: 88px; height: 124px; }
  .cg-card-name { font-size: 11px; bottom: 26px; }
  .cg-card-stats { font-size: 13px; height: 26px; }
  .cg-card .cg-card-effect { font-size: 9px; padding: 2px 4px; }
  .cg-hand .cg-card { width: 110px; height: 156px; }
  .cg-hand .cg-card .cg-card-name { font-size: 12px; bottom: 44px; }
  .cg-hand .cg-card-effect { font-size: 10px; height: 18px; }
  .cg-lane { min-height: 156px; }
  .cg-lane-slots { min-height: 124px; }
  .cg-hero-title { font-size: 36px; }
  .cg-hero-tagline { font-size: 15px; }
}
