/* シミュレーターのオプションの欄（検索結果の上限・会心率（最大）・下限・見出しの「?」・持っている装飾品・装備の固定） */

/* 検索結果の上限は、見出しの行（.card-head）の右上に置く（見出しと高さをそろえるので、上の余白はいらない） */
.card-head .field.inline.options-max-results {
  margin-top: 0;
}
/*
 * オプションの「会心率（最大）に含めるスキル」（折りたたみ）。「スキルの効果を加味する」の下に字下げして置き、
 * 見出しの横に、含めているスキルの数を出す（折りたたんでいても分かるように）。
 * 「スキルの効果を加味する」を外しているあいだは選べないので、薄く出す
 */
.max-affinity-options {
  margin: 0 0 4px 1.6em;
  font-size: 0.9rem;
}

.max-affinity-options summary {
  cursor: pointer;
  font-weight: 600;
}

.max-affinity-options[open] summary {
  margin-bottom: 4px;
}

.max-affinity-count {
  font-weight: normal;
  color: var(--muted);
}

.max-affinity-options.disabled summary,
.max-affinity-list .check:has(input:disabled) {
  color: var(--muted);
}

/* スキルごとの、いちばん高いレベルで上がる会心率（例: Lv5 で +15%） */
.max-affinity-value {
  font-size: 0.8rem;
  color: var(--muted);
}

/* オプションの中の、小見出しつきの欄（下限・装備の固定）。上に区切り線を引く */
.option-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.option-section h3 {
  margin: 0 0 4px;
  font-size: 0.9rem;
}

/*
 * 見出しの横の「?」（注釈。note-toggles.js）。押すと、見出しのすぐ下に説明の欄（.option-note）を出す。
 * 出しているあいだは塗りつぶして、もう一度押せば隠れることが分かるようにする。
 * 小さいので、押せる範囲は周りに広げる（スマホで押しやすいように）。
 * 使い方のページの説明の文中にも、同じ形（span。押せない）で出す
 */
.option-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px;
}

.option-head h3 {
  margin: 0;
}

.note-toggle {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 1.2rem;
  height: 1.2rem;
  margin: 0 0.25em;
  padding: 0;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

button.note-toggle {
  cursor: pointer;
}

button.note-toggle::after {
  content: "";
  position: absolute;
  inset: -8px;
}

button.note-toggle:hover,
.note-toggle[aria-expanded="true"] {
  background: var(--accent);
  color: var(--accent-contrast);
}

.option-head .note-toggle {
  margin: 0;
}

/* 説明の欄。上の三角は「?」の真下（位置は note-toggles.js が --note-arrow-x に入れる） */
.option-note {
  position: relative;
  margin: 10px 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 0.8rem;
  font-weight: normal;
}

.option-note p {
  margin: 0;
}

.option-note p + p {
  margin-top: 4px;
}

.option-note::before,
.option-note::after {
  content: "";
  position: absolute;
  left: var(--note-arrow-x, 16px);
  border: solid transparent;
  transform: translateX(-50%);
}

.option-note::before {
  top: -9px;
  border-width: 0 8px 8px;
  border-bottom-color: var(--border);
}

.option-note::after {
  top: -7px;
  border-width: 0 7px 7px;
  border-bottom-color: var(--surface-2);
}

/*
 * オプションの「持っている装飾品」（折りたたみ）。見出しの横に、持っていない装飾品の数を出す（折りたたんでいても分かるように）。
 * 一覧は高さに上限を付けて中をスクロールし、チェックを外した（持っていない）装飾品は、薄く打ち消し線で出す
 */
.owned-decorations summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.owned-decorations[open] summary {
  margin-bottom: 6px;
}

.owned-decorations-count {
  font-size: 0.8rem;
  font-weight: normal;
  color: var(--muted);
}

.owned-decorations-count.active {
  font-weight: 600;
  color: var(--accent);
}

.owned-decorations-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-bottom: 6px;
}

.owned-decorations-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.owned-decorations-group + .owned-decorations-group {
  margin-top: 10px;
}

.owned-decorations-group h4 {
  margin: 0 0 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

.owned-decorations-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 2px 10px;
}

.owned-decoration {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 2px 0;
  font-size: 0.85rem;
  cursor: pointer;
}

.owned-decoration input {
  flex: none;
}

.owned-decoration-name {
  white-space: nowrap;
}

.owned-decoration-skills {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--muted);
}

.owned-decoration:has(input:not(:checked)) .owned-decoration-name {
  color: var(--muted);
  text-decoration: line-through;
}

/*
 * オプションの「防御力・耐性・空きスロットの下限」。項目名の列と、入力欄の列に分ける（入力欄は、幅が足りなければ折り返す）。
 * 耐性の入力欄は、-99 まで入る幅にする
 */
.minimum-row {
  display: grid;
  /* 項目名の列は、いちばん長い「武器の空きスロット」「防具の空きスロット」が 1 行に収まる幅 */
  grid-template-columns: 8em minmax(0, 1fr);
  align-items: center;
  gap: 2px 8px;
  margin-bottom: 6px;
}

.minimum-label {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.minimum-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-size: 0.85rem;
}

.minimum-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.minimum-input {
  width: 4.5em;
  min-height: 36px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}

#min-defense {
  width: 6em;
}

/*
 * 狭い画面では、項目名を入力欄の上に置く
 * （入力欄が 1 行に収まりやすいように。空きスロットの ③②① の選択欄は、項目名と横に並べると 2 行に折り返す）
 */
@media (max-width: 560px) {
  .minimum-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* オプションの「装備を固定して検索」。部位名・選択欄を横に並べ、固定した装備のスキルは選択欄の下に出す */

.fixed-row {
  display: grid;
  grid-template-columns: 4.5em minmax(0, 1fr);
  align-items: center;
  gap: 2px 8px;
  margin-bottom: 6px;
}

.fixed-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.fixed-row select {
  width: 100%;
  min-width: 0;
}

.fixed-info {
  grid-column: 2;
  font-size: 0.75rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* 限界突破強化していない状態で検索する部位の知らせ（元に戻すボタンを、文の後ろに並べる） */
.transcend-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  margin: 4px 0 6px;
}

.empty-note {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--muted);
}
