/* 盤面シミュレーター専用スタイル（styles.css の :root トークンに依存） */
.sim-wrap { max-width: 1180px; margin: 0 auto; padding: 18px; }
.sim-disclaimer { background: rgba(244, 201, 93, .08); border: 1px solid rgba(244, 201, 93, .3); border-radius: 12px; padding: 12px 16px; font-size: 13px; color: var(--ink); }
.sim-note { color: var(--muted); font-size: 12px; }
.sim-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.sim-row select, .sim-row input { background: var(--panel-solid, #161D2E); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; max-width: 100%; }
.sim-btn { background: var(--panel, #121826); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; padding: 9px 14px; font-size: 13px; cursor: pointer; transition: .15s; }
.sim-btn:hover { background: rgba(255, 255, 255, .1); }
.sim-btn-primary { background: linear-gradient(135deg, #f5c542, #d8a23a); color: #14181f; font-weight: 700; border: none; }
.sim-btn[disabled] { opacity: .4; cursor: not-allowed; }

/* セットアップ */
.sim-setup { display: grid; gap: 18px; }
.sim-deck-picker { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.sim-deck-picker h3 { margin: 0 0 8px; font-size: 15px; }
.sim-deck-preview { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.sim-deck-preview img { width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line); background: #0a0e16; }
.sim-deck-preview img.sim-piece-inferred { opacity: .55; border-style: dashed; }

/* バトル画面 */
.sim-turnbar { text-align: center; font-weight: 700; padding: 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 14px; }
.sim-turnbar.over { background: rgba(244, 201, 93, .15); border-color: rgba(244, 201, 93, .5); }
.sim-battle-grid { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
.sim-main { display: grid; gap: 12px; }

.sim-player { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; opacity: .75; transition: .2s; }
.sim-player.is-turn { opacity: 1; border-color: rgba(244, 201, 93, .45); box-shadow: 0 0 22px rgba(244, 201, 93, .08); }
.sim-player-head { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.sim-deckname { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45%; }
.sim-hp-num { margin-left: auto; font-family: var(--font-en); font-size: 13px; }
.sim-hpbar { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .07); overflow: hidden; margin: 6px 0; }
.sim-hpbar-fill { height: 100%; background: linear-gradient(90deg, #4ade80, #22c55e); transition: width .35s; }
.sim-hpbar-fill.low { background: linear-gradient(90deg, #fb7185, #ef4444); }
.sim-status-row { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.sim-status-row span { background: rgba(255, 255, 255, .06); border-radius: 999px; padding: 2px 8px; }

.sim-hand { display: flex; gap: 8px; align-items: center; }
.sim-hand-card { position: relative; width: 64px; height: 64px; border-radius: 10px; border: 2px solid var(--line); background: #0a0e16; padding: 0; cursor: pointer; overflow: hidden; transition: .15s; }
.sim-hand-card img { width: 100%; height: 100%; object-fit: cover; }
.sim-hand-card.selected { border-color: #f5c542; box-shadow: 0 0 14px rgba(244, 201, 93, .5); transform: translateY(-3px); }
.sim-hand-card[disabled] { opacity: .45; cursor: default; }
.sim-hand-card.elem-神 { outline: 1px solid rgba(245, 197, 66, .35); }
.sim-hand-card.elem-魔 { outline: 1px solid rgba(168, 85, 247, .35); }
.sim-hand-card.elem-竜 { outline: 1px solid rgba(251, 113, 133, .35); }
.sim-hand-meta { position: absolute; bottom: 0; left: 0; right: 0; font-size: 10px; background: rgba(0, 0, 0, .65); color: #fff; padding: 1px 3px; text-align: right; }
.sim-queue-count { font-size: 11px; color: var(--muted); }

.sim-board-stage { background: radial-gradient(circle at 50% 38%, #16203a, #0A0E18 78%); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; justify-content: center; }
.sim-board { display: grid; grid-template-columns: repeat(6, minmax(44px, 64px)); grid-template-rows: repeat(6, minmax(44px, 64px)); gap: 5px; width: 100%; max-width: 430px; aspect-ratio: 1; }
.sim-cell { border-radius: 8px; background: linear-gradient(160deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .015)); border: 1px solid rgba(255, 255, 255, .06); display: grid; place-items: center; cursor: pointer; transition: .12s; }
.sim-cell:hover { background: rgba(255, 255, 255, .1); }
.sim-cell.legal::before { content: ""; width: 15px; height: 15px; border-radius: 50%; border: 2px dashed currentColor; opacity: .6; position: absolute; }
.sim-cell { position: relative; }
.sim-cell.legal.p1 { color: var(--demon, #a855f7); }
.sim-cell.legal.p2 { color: var(--god, #f5c542); }
.sim-disc { width: 86%; height: 86%; border-radius: 50%; background-size: cover; background-position: center; box-shadow: 0 3px 9px rgba(0, 0, 0, .5); }
.sim-disc.p1 { border: 3px solid var(--demon, #a855f7); box-shadow: 0 0 12px rgba(168, 85, 247, .45); }
.sim-disc.p2 { border: 3px solid var(--god, #f5c542); box-shadow: 0 0 12px rgba(244, 201, 93, .45); }

/* ログ */
.sim-log { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; max-height: 720px; overflow-y: auto; }
.sim-log-head { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.sim-log ul { list-style: none; margin: 0; padding: 0; font-size: 12px; display: grid; gap: 5px; }
.sim-log li { padding: 5px 8px; border-radius: 7px; background: rgba(255, 255, 255, .04); line-height: 1.5; }
.sim-log li small { color: var(--muted); margin-right: 4px; font-family: var(--font-en); }
.sim-log li.lt-damage { border-left: 3px solid #fb7185; }
.sim-log li.lt-heal { border-left: 3px solid #4ade80; }
.sim-log li.lt-mult, .sim-log li.lt-shield { border-left: 3px solid #f5c542; }
.sim-log li.lt-curse, .sim-log li.lt-dot, .sim-log li.lt-debuff { border-left: 3px solid #a855f7; }
.sim-log li.lt-end { background: rgba(244, 201, 93, .15); font-weight: 700; }
.sim-log li.lt-skip, .sim-log li.lt-info { color: var(--muted); }

/* モーダル */
.sim-modal-back { position: fixed; inset: 0; background: rgba(5, 8, 14, .75); display: grid; place-items: center; z-index: 60; padding: 16px; }
.sim-modal { background: var(--panel-solid, #161D2E); border: 1px solid var(--line); border-radius: 16px; padding: 18px; max-width: 640px; width: 100%; max-height: 86vh; overflow-y: auto; box-shadow: 0 30px 90px rgba(0, 0, 0, .6); }
.sim-modal h3 { margin: 0 0 10px; font-size: 16px; }
.sim-fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; padding: 10px 12px; }
.sim-fieldset legend { font-size: 13px; font-weight: 700; padding: 0 6px; }
.sim-eff-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; padding: 4px 0; }
.sim-eff-row input { width: 110px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; }
.sim-skilltext { font-size: 11px; color: var(--muted); line-height: 1.6; margin: 8px 0 0; }
.sim-cond-ng { color: #fb7185; font-size: 12px; margin: 4px 0; }
.chip { font-size: 11px; border-radius: 999px; padding: 2px 9px; }
.chip.ok { background: rgba(74, 222, 128, .15); color: #4ade80; }
.chip.warn { background: rgba(244, 201, 93, .15); color: #f5c542; }
.chip.bad { background: rgba(251, 113, 133, .15); color: #fb7185; }

/* 自由編成 */
.sim-fb-picked { display: flex; flex-wrap: wrap; gap: 4px; min-height: 48px; padding: 8px; border: 1px dashed var(--line); border-radius: 10px; margin: 8px 0; }
.sim-fb-picked img { width: 42px; height: 42px; border-radius: 8px; cursor: pointer; }
.sim-fb-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; max-height: 320px; overflow-y: auto; }
.sim-fb-item { display: flex; gap: 8px; align-items: center; text-align: left; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; padding: 6px; font-size: 12px; cursor: pointer; }
.sim-fb-item:hover { background: rgba(255, 255, 255, .08); }
.sim-fb-item img { width: 38px; height: 38px; border-radius: 7px; flex: none; }
.sim-fb-item small { color: var(--muted); }

/* 進化/闘化チップ（画像上に重ねる1文字マーク。色は styles.css の .evo-normal/.evo-combat/.evo-hyper を流用） */
.sim-imgwrap { position: relative; display: inline-block; line-height: 0; flex: none; }
.sim-imgwrap img { display: block; }
.sim-evo-chip { position: absolute; left: 1px; bottom: 1px; font-style: normal; font-size: 10px; font-weight: 800; line-height: 1; color: #fff; padding: 2px 3px; border-radius: 5px; box-shadow: 0 1px 4px rgba(0, 0, 0, .6); pointer-events: none; }
.sim-hand-card .sim-evo-chip { left: 2px; top: 2px; bottom: auto; }   /* 手駒は下部にATK帯があるため上に */
.sim-disc .sim-evo-chip { left: 50%; transform: translateX(-50%); bottom: -3px; font-size: 9px; padding: 1px 3px; }
.sim-disc { position: relative; }

/* 最善手アドバイザー */
.sim-btn-advise { background: linear-gradient(135deg, rgba(244, 201, 93, .25), rgba(244, 201, 93, .1)); border-color: rgba(244, 201, 93, .5); }
.sim-suggest { background: var(--panel); border: 1px solid rgba(244, 201, 93, .4); border-radius: 14px; padding: 12px; margin-bottom: 14px; display: grid; gap: 8px; }
.sim-suggest-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; }
.sim-suggest-item { display: flex; gap: 10px; align-items: center; text-align: left; background: rgba(255, 255, 255, .04); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; transition: .15s; }
.sim-suggest-item:hover { background: rgba(244, 201, 93, .1); border-color: rgba(244, 201, 93, .4); }
.sim-suggest-item.lethal { border-color: #fb7185; background: rgba(251, 113, 133, .1); }
.sim-suggest-rank { font-family: var(--font-en); font-weight: 800; font-size: 16px; color: #f5c542; width: 20px; text-align: center; flex: none; }
.sim-suggest-item img { width: 44px; height: 44px; border-radius: 8px; flex: none; }
.sim-suggest-body { font-size: 13px; line-height: 1.5; }
.sim-suggest-body small { display: block; color: var(--muted); font-size: 11px; }
.sim-cell.hint { box-shadow: inset 0 0 0 2px #f5c542, 0 0 18px rgba(244, 201, 93, .55); animation: simHintPulse 1.2s ease-in-out infinite; }
@keyframes simHintPulse { 0%, 100% { box-shadow: inset 0 0 0 2px #f5c542, 0 0 10px rgba(244, 201, 93, .35); } 50% { box-shadow: inset 0 0 0 3px #f5c542, 0 0 24px rgba(244, 201, 93, .75); } }

/* モバイル */
@media (max-width: 880px) {
  .sim-battle-grid { grid-template-columns: 1fr; }
  .sim-log { max-height: 280px; }
  .sim-hand-card { width: 56px; height: 56px; }
  .sim-board { gap: 4px; }
}
