.status-sim {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px;
}

.status-sim h1 {
  margin: 0 0 12px;
  font-size: 1.4rem;
}

.status-sim h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.status-sim hr {
  margin: 14px 0;
  opacity: .4;
}

.status-sim * {
  box-sizing: border-box;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0;
}

.note {
  opacity: .8;
}

.pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 12px;
  background: rgba(0,0,0,.02);
}

/* pillの入力欄ラッパー（maxボタンを内包） */
.pill-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  width: 100%;
}

.pill-input-wrap input[type="number"] {
  width: 100%;
  min-width: 0;
  padding-right: 44px !important;
  box-sizing: border-box;
  flex: 1;
}

.pill-input-wrap .base-max-btn {
  position: absolute;
  right: 4px;
  font-size: 10px !important;
  padding: 2px 6px !important;
  border-radius: 8px;
  line-height: 1.4;
  height: auto;
  min-width: 0;
  white-space: nowrap;
}

.status-sim input[type="number"],
.status-sim select {
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 12px;
  padding: 6px 10px;
  background: #fff;
}

.status-sim select {
  min-width: 0;
  max-width: 100%;
}

.status-sim input[type="number"] {
  width: 84px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 6px 0 8px;
}

.fold {
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 14px;
  padding: 8px 10px;
  background: rgba(0,0,0,.01);
  margin: 10px 0;
}

.fold > summary {
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  padding: 4px 2px;
}

.fold[open] > summary {
  margin-bottom: 8px;
}

.equip-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 6px 0 8px;
}

.equip-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  grid-template-areas:
    "slot main"
    "slot lv";
  row-gap: 6px;
  padding: 10px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 12px;
  background: rgba(0,0,0,.02);
}

.equip-row .slot {
  grid-area: slot;
  align-self: start;
  padding-top: 10px;
  opacity: .85;
  font-weight: 600;
  white-space: nowrap;
}

.equip-row .main {
  grid-area: main;
  min-width: 0;
}

.equip-row .main select,
.equip-row .main input[type="text"] {
  width: 100%;
}

.equip-row .lv-row {
  grid-area: lv;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.equip-row .lvtag {
  opacity: .65;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 13px;
}

.equip-row .lvbox {
  flex-shrink: 0;
}

.equip-row .lvbox input,
.equip-row .lvbox select {
  width: 80px;
}

@media (min-width: 521px) {
  .equip-row {
    grid-template-columns: 72px 1fr auto;
    grid-template-areas: "slot main lv";
    align-items: center;
  }
  .equip-row .slot {
    align-self: center;
    padding-top: 0;
  }
}

.accessory-row {
  grid-template-columns: 64px 1fr;
  grid-template-areas:
    "slot main"
    "slot lv"
    "slot effect";
}

.accessory-row .effectbox {
  grid-area: effect;
  min-width: 0;
}

@media (min-width: 521px) {
  .accessory-row {
    grid-template-columns: 72px 1fr auto minmax(140px, 1.2fr);
    grid-template-areas: "slot main lv effect";
    align-items: center;
  }
}

.acc-effect-preview {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 12px;
  background: rgba(0,0,0,.02);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.pet-row {
  grid-template-columns: 64px 1fr;
  grid-template-areas:
    "slot main"
    "slot lv";
  row-gap: 6px;
}

.pet-row .slot {
  grid-area: slot;
  align-self: start;
  padding-top: 10px;
}

.pet-row .main {
  grid-area: main;
}

.pet-row .lv-row {
  grid-area: lv;
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (min-width: 521px) {
  .pet-row {
    grid-template-columns: 72px 1fr auto;
    grid-template-areas: "slot main lv";
    align-items: center;
  }
  .pet-row .slot {
    align-self: center;
    padding-top: 0;
  }
}

.equip-search-wrap,
.pet-search-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
}

.equip-search-wrap input,
.pet-search-wrap input {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.equip-clear-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 16px;
  color: #888;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
}

.equip-clear-btn:hover {
  color: #333;
}

.equip-suggest,
.pet-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  max-height: 260px;
  overflow-y: auto;
  z-index: 30;
}

.equip-suggest button,
.pet-suggest button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: transparent;
  font-size: 16px;
}

.equip-suggest button:active,
.pet-suggest button:active {
  background: rgba(0,0,0,.06);
}

.build-preview {
  padding: 10px 14px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 12px;
  background: rgba(0,0,0,.02);
  font-size: 13px;
  line-height: 1.7;
  margin: 4px 0;
}

.build-preview dl {
  display: grid;
  grid-template-columns: 4em 1fr;
  gap: 0 10px;
  margin: 0;
}

.build-preview dt {
  color: #888;
  font-size: 12px;
  align-self: start;
  padding-top: 2px;
}

.build-preview dd {
  margin: 0;
}

.buttons {
  margin-top: 10px;
}

.status-sim button {
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 12px;
  padding: 5px 10px;
  background: #fff;
  cursor: pointer;
}

.status-sim button:hover {
  background: rgba(0,0,0,.04);
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 12px;
}

.stats-table th,
.stats-table td {
  border: 1px solid rgba(0,0,0,0.12);
  padding: 8px 10px;
}

.stats-table th {
  background: rgba(0,0,0,0.05);
  text-align: left;
}

.stats-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.error {
  margin: 8px 0 0;
  color: #b00020;
  white-space: pre-wrap;
  display: none;
}

.error.is-visible {
  display: block;
}

@media (max-width: 520px) {
  .status-sim {
    padding: 10px;
  }

  .status-sim input[type="number"] {
    width: 72px;
  }

  .status-sim button {
    width: auto;
  }
}

/* ---- シリーズ一括選択 ---- */
.series-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}

.series-select-label {
  font-size: 13px;
  color: #666;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- ステータス絞り込み ---- */
.stat-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 4px 0 10px;
}

.stat-filter-label {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 振り分けポイント合計入力欄 */
label.pill:has(#basePointTotal) {
  width: 100%;
  box-sizing: border-box;
}

#basePointTotal {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  flex: 1;
}

/* ---- bs-point-limit（振り分けポイント計算セクション用）---- */
.bs-point-calc-wrap {
  padding: 10px 0;
}

.bs-point-sub-section {
  margin-bottom: 16px;
}

.bs-point-sub-title {
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 8px;
  color: #555;
}

.bs-point-limit-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
  flex-wrap: wrap;
}

.bs-point-limit-total {
  font-size: 18px;
  font-weight: 700;
  color: #1a5fa8;
  font-variant-numeric: tabular-nums;
}

.lv-input {
  padding: 6px 8px;
  border: 1px solid rgba(0,0,0,.2);
  border-radius: 8px;
  font-size: 14px;
  width: 80px;
}

/* ============================================================
   ビルドカード生成
   ============================================================ */

.bc-open-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin: 16px 0;
  background: #1a5fa8;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
}

.bc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 400;
}

.bc-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 96vw;
  max-width: 640px;
  max-height: 85vh;
  background: #fff;
  border-radius: 16px;
  z-index: 401;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bc-modal[hidden],
.bc-overlay[hidden] {
  display: none !important;
}

.bc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
  font-weight: bold;
  font-size: 15px;
  flex-shrink: 0;
}

.bc-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #555;
}

.bc-modal-body {
  overflow-y: auto;
  padding: 16px;
  flex: 1;
}

.bc-modal-footer {
  padding: 12px 16px;
  border-top: 1px solid #eee;
  text-align: center;
  flex-shrink: 0;
}

.bc-modal-footer .chip-btn {
  width: 100%;
  background: #1a5fa8;
  color: #fff;
  border-color: #1a5fa8;
  font-size: 15px;
  font-weight: bold;
}

/* カード本体 */
.bc-wrap {
  background: #fff;
  font-size: 12px;
  color: #222;
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}

.bc-header {
  background: #1a5fa8;
  color: #fff;
  text-align: center;
  font-size: 14px;
  font-weight: bold;
  padding: 8px;
}

.bc-equip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid #eee;
}

.bc-col {
  padding: 8px;
}

.bc-col:first-child {
  border-right: 1px solid #eee;
}

.bc-row {
  display: flex;
  gap: 4px;
  padding: 3px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 11px;
}

.bc-label {
  color: #888;
  min-width: 28px;
  flex-shrink: 0;
}

.bc-val {
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.bc-enhance {
  font-size: 10px;
  color: #1a5fa8;
  font-weight: normal;
  white-space: nowrap;
  flex-shrink: 0;
}

.bc-section {
  padding: 8px;
  border-bottom: 1px solid #eee;
}

.bc-section-title {
  font-size: 11px;
  font-weight: bold;
  color: #888;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bc-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.bc-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f8f8f8;
  border-radius: 6px;
  padding: 4px;
}

.bc-stat-luk {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f8f8f8;
  border-radius: 6px;
  padding: 4px;
  width: calc(33.3% - 3px);
}

.bc-stat-label {
  font-size: 10px;
  color: #888;
}

.bc-stat-val {
  font-size: 13px;
  font-weight: bold;
}

.bc-data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

.bc-data-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  padding: 2px 4px;
  background: #f8f8f8;
  border-radius: 4px;
}

.bc-data-row span:first-child {
  color: #888;
}

.bc-data-row span:last-child {
  font-weight: bold;
}

/* ステータス統合テーブル */
.bc-stat-table {
  width: 100%;
  font-size: 11px;
  border-collapse: collapse;
}

.bc-stat-table th {
  font-size: 10px;
  color: #888;
  font-weight: bold;
  text-align: right;
  padding: 3px 6px;
  border-bottom: 1px solid #ddd;
}

.bc-stat-table th:first-child {
  text-align: left;
}

.bc-stat-table td {
  padding: 3px 6px;
  border-bottom: 1px solid #f0f0f0;
}

.bc-stat-key {
  color: #888;
  font-weight: bold;
  white-space: nowrap;
}

.bc-stat-num {
  text-align: right;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bc-stat-final {
  text-align: right;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  color: #1a5fa8;
  white-space: nowrap;
}
