.mbs-wrap { max-width: 1100px; margin: 0 auto; padding: 12px; }
.mbs-head { margin-bottom: 6px; }
.mbs-title { margin: 0 0 4px; font-size: 1.25rem; }
.mbs-desc { opacity: .9; margin-top: 4px; font-size: 0.95rem; }

.mbs-controls { display: grid; gap: 8px; margin: 10px 0 10px; pointer-events: auto; }
.mbs-controls-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.mbs-controls-row2 { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }

.mbs-search {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 10px;
  font-size: 16px;
}

.mbs-compact { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; opacity: .85; user-select: none; }
.mbs-compact input { transform: translateY(1px); }

.mbs-btn, .mbs-btn2 {
  border: 1px solid rgba(0,0,0,.18);
  background: #fff;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 14px;
}
.mbs-btn2 { white-space: nowrap; }

.mbs-sortstatus { font-size: 13px; opacity: .9; }
.mbs-note { font-size: 12px; opacity: .75; }

/* ---- 絞り込みパネル ---- */
.mbs-filters {
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 12px;
  padding: 10px;
  pointer-events: auto;
}
.mbs-filters.is-closed { display: none; }
.mbs-filters * { pointer-events: auto; }

.mbs-filter-grid { display: grid; gap: 10px; }
@media (min-width: 700px) {
  .mbs-filter-grid { grid-template-columns: repeat(3, 1fr); }
}
.mbs-filter-block { border: 1px solid rgba(0,0,0,.12); border-radius: 10px; padding: 8px; }
.mbs-filter-title { font-size: 12px; opacity: .8; margin-bottom: 6px; }
.mbs-filter-items { display: grid; gap: 6px; }
.mbs-check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.mbs-check input { transform: translateY(1px); }
.mbs-filter-actions { margin-top: 10px; display: flex; justify-content: flex-end; }

/* ---- オプションパネル ---- */
.mbs-options {
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 12px;
  padding: 10px;
  pointer-events: auto;
}
.mbs-options.is-closed { display: none !important; }
.mbs-options * { pointer-events: auto; }

.mbs-option-grid { display: grid; gap: 10px; }
.mbs-option-block { border: 1px solid rgba(0,0,0,.12); border-radius: 10px; padding: 8px; }
.mbs-option-title { font-size: 12px; opacity: .8; margin-bottom: 8px; }
.mbs-option-row { display: flex; gap: 8px; align-items: center; }
.mbs-option-label { font-size: 14px; font-weight: bold; white-space: nowrap; }
.mbs-level-input {
  width: 72px;
  padding: 6px 8px;
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 8px;
  font-size: 15px;
  text-align: right;
}
.mbs-option-note { margin-top: 8px; font-size: 11px; opacity: .65; }

.mbs-stepper-btn { min-width: 36px; padding: 6px 10px; font-size: 16px; line-height: 1; }
.mbs-stepper-val { min-width: 24px; text-align: center; font-size: 16px; font-weight: bold; font-variant-numeric: tabular-nums; }

/* ---- 表 ---- */
.mbs-table-wrap {
  overflow: auto;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 12px;
}

.mbs-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 13px;
  line-height: 1.25;
}

/* 枠組み */
.mbs-table th, .mbs-table td {
  padding: 8px 10px;
  white-space: nowrap;
  border-bottom: 1px solid rgba(0,0,0,.12);
  border-right: 1px solid rgba(0,0,0,.12);
}
.mbs-table tr > *:first-child { border-left: 1px solid rgba(0,0,0,.12); }

.mbs-table thead th {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(6px);
  z-index: 2;
  border-bottom: 1px solid rgba(0,0,0,.18);
}

/* ヘッダーはクリックできる */
.mbs-table thead th.sort { cursor: pointer; user-select: none; }
.mbs-table thead th.sort .arrow { margin-left: 4px; opacity: .35; font-size: 11px; }
.mbs-table thead th.is-active .arrow { opacity: .95; }
.mbs-table thead th.is-active { text-decoration: underline; text-underline-offset: 3px; }

/* tbodyはクリック無効、名前リンクだけ有効 */
.mbs-table tbody { pointer-events: none; }
.mbs-table tbody td.name a { pointer-events: auto; }

.mbs-table td.num, .mbs-table th.num { text-align: right; }

/* 順位列（安定用。幅は colgroup が主） */
.rank-col { text-align: right; font-size: 12px; opacity: .85; font-variant-numeric: tabular-nums; }

/* 左固定：名前列のみ */
.sticky-col { position: sticky; left: 0; background: rgba(255,255,255,.98); z-index: 1; }
.mbs-table thead .sticky-col { z-index: 3; }
.mbs-table td.name { min-width: 160px; }
.mbs-table td.name a { text-decoration: none; }

/* TOTAL列を少し強調 */
.mbs-table thead th[data-key="total"],
.mbs-table tbody td:last-child {
  background: rgba(0,0,0,.03);
}

/* コンパクト */
.mbs-compact-on .mbs-table { font-size: 12.5px; }
.mbs-compact-on .mbs-table th,
.mbs-compact-on .mbs-table td { padding: 6px 8px; }
.mbs-compact-on .mbs-table td.name { min-width: 150px; }

/* スマホ */
@media (max-width: 600px) {
  .mbs-wrap { padding: 10px; }
  .mbs-title { font-size: 1.15rem; }
}
