/* ============================================================================
   reroll-sim.css — サポートアイテム サブ能力 再抽選シミュレーター
   ----------------------------------------------------------------------------
   ■ 明るいライトデザイン。白基調 + ローズのアクセント。スマホ最優先。
   ■ 結果は操作のすぐ下（モバイル）／右に固定表示（PC）でスクロール不要。
   ■ すべて .rrs 名前空間に閉じ込め、サイト本体の CSS と衝突させない。
   ============================================================================ */

.rrs {
  --rrs-bg:        #eef1f6;
  --rrs-surface:   #ffffff;
  --rrs-surface-2: #f4f6fa;
  --rrs-raised:    #eef2f8;
  --rrs-line:      #e3e8ef;
  --rrs-line-2:    #cfd7e2;
  --rrs-ink:       #1c2430;
  --rrs-ink-dim:   #57616f;
  --rrs-ink-faint: #8b95a4;
  --rrs-accent:    #e23a76;
  --rrs-accent-hi: #f24e87;
  --rrs-accent-deep:#bd2159;
  --rrs-accent-soft:#fdeaf1;
  --rrs-ok:        #1f9d6b;
  --rrs-radius:   16px;
  --rrs-radius-s: 11px;
  --rrs-shadow:   0 1px 2px rgba(28,36,48,.04), 0 12px 32px -16px rgba(28,36,48,.22);
  --rrs-shadow-pop: 0 18px 44px -12px rgba(28,36,48,.32);
  --rrs-ease:     cubic-bezier(.22,.61,.36,1);

  font-family: 'Zen Kaku Gothic New', 'Noto Sans JP', system-ui, sans-serif;
  color: var(--rrs-ink);
  background:
    radial-gradient(120% 70% at 92% -10%, rgba(226,58,118,.05), transparent 52%),
    var(--rrs-bg);
  border: 1px solid var(--rrs-line);
  border-radius: var(--rrs-radius);
  box-shadow: var(--rrs-shadow);
  overflow: clip;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.rrs *, .rrs *::before, .rrs *::after { box-sizing: border-box; }
.rrs :focus-visible { outline: 2px solid var(--rrs-accent); outline-offset: 2px; border-radius: 4px; }
.rrs .rrs-stat-num, .rrs .b-num { font-variant-numeric: tabular-nums; }

/* ============ ヘッダー ============ */
.rrs-head { padding: 18px 22px; border-bottom: 1px solid var(--rrs-line); background: linear-gradient(180deg, #fff, var(--rrs-surface-2)); }
.rrs-title { font-size: clamp(1.2rem, 1.05rem + 1vw, 1.6rem); font-weight: 900; letter-spacing: -.01em; line-height: 1.2; margin: 0; }

/* ============ レイアウト ============ */
.rrs-main { display: grid; gap: 20px; padding: 20px 22px 24px; }
@media (min-width: 920px) {
  .rrs-main {
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    grid-template-areas: "select result" "targets result" "actions result" "table result";
    align-items: start; column-gap: 26px; row-gap: 20px;
  }
  .a-select  { grid-area: select; }
  .a-targets { grid-area: targets; }
  .a-actions { grid-area: actions; }
  .a-table   { grid-area: table; }
  .a-result  { grid-area: result; position: sticky; top: 14px; }
}

.rrs-label { display: flex; align-items: center; gap: 9px; font-size: .82rem; font-weight: 700; color: var(--rrs-ink); margin: 0 0 12px; }
.rrs-label .n { font-size: .72rem; color: #fff; background: var(--rrs-accent); width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; font-weight: 700; }

/* ============ アイテム選択ボタン ============ */
.rrs-item-btn {
  appearance: none; width: 100%; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 13px;
  background: var(--rrs-surface); border: 1.5px solid var(--rrs-line-2); border-radius: var(--rrs-radius-s);
  padding: 12px 14px; font: inherit; color: var(--rrs-ink); transition: border-color .15s, box-shadow .15s;
}
.rrs-item-btn:hover { border-color: var(--rrs-accent); box-shadow: 0 0 0 3px var(--rrs-accent-soft); }
.rrs-item-btn .ic {
  width: 48px; height: 48px; flex-shrink: 0; border-radius: 11px; overflow: hidden;
  background: var(--rrs-surface-2); display: grid; place-items: center; color: var(--rrs-accent); font-size: 1.1rem;
}
.rrs-item-btn .ic img { width: 100%; height: 100%; object-fit: cover; }
.rrs-item-btn .txt { flex: 1; min-width: 0; }
.rrs-item-btn .nm { font-weight: 700; font-size: 1.05rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrs-item-btn .nm.ph { color: var(--rrs-ink-faint); font-weight: 500; }
.rrs-item-btn .go { color: var(--rrs-ink-faint); flex-shrink: 0; }

/* ============ アイテム選択モーダル ============ */
.rrs-modal {
  position: fixed; inset: 0; z-index: 1200; display: none;
  align-items: flex-end; justify-content: center;
  background: rgba(20,18,28,.5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.rrs-modal.is-open { display: flex; animation: rrs-fade .18s var(--rrs-ease); }
@keyframes rrs-fade { from { opacity: 0; } to { opacity: 1; } }
.rrs-modal-sheet {
  background: var(--rrs-surface); width: 100%; max-width: 600px; max-height: 86vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; box-shadow: var(--rrs-shadow-pop); animation: rrs-up .24s var(--rrs-ease);
}
@keyframes rrs-up { from { transform: translateY(16px); } to { transform: none; } }
@media (min-width: 600px) { .rrs-modal { align-items: center; padding: 20px; } .rrs-modal-sheet { border-radius: 18px; } }
.rrs-modal-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; background: linear-gradient(120deg, var(--rrs-accent), var(--rrs-accent-deep)); color: #fff; font-weight: 800; font-size: 1.05rem;
}
.rrs-modal-x { appearance: none; background: rgba(255,255,255,.2); border: none; color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; font-size: .9rem; }
.rrs-modal-x:hover { background: rgba(255,255,255,.32); }
.rrs-icards { display: grid; grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 11px; padding: 16px; }
.rrs-icard {
  appearance: none; position: relative; cursor: pointer; background: var(--rrs-surface-2);
  border: 1.5px solid var(--rrs-line); border-radius: 13px; padding: 9px 8px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 7px; transition: border-color .15s, transform .1s, box-shadow .15s;
}
.rrs-icard:hover { border-color: var(--rrs-accent); transform: translateY(-2px); }
.rrs-icard.is-active { border-color: var(--rrs-accent); box-shadow: 0 0 0 2px var(--rrs-accent) inset; }
.rrs-icard .badge { position: absolute; top: 6px; left: 6px; font-size: .58rem; font-weight: 800; color: #fff; background: var(--rrs-accent); border-radius: 5px; padding: 1px 5px; z-index: 1; }
.rrs-icard .thumb { width: 100%; aspect-ratio: 1; border-radius: 9px; overflow: hidden; background: #fff; display: grid; place-items: center; }
.rrs-icard .thumb img { width: 100%; height: 100%; object-fit: contain; }
.rrs-icard .thumb .fb { display: none; color: var(--rrs-ink-faint); font-size: 1.4rem; }
.rrs-icard .thumb.noimg .fb { display: block; }
.rrs-icard .cname { font-size: .76rem; font-weight: 700; text-align: center; line-height: 1.25; color: var(--rrs-ink); }

/* ============ 狙う能力 ============ */
.rrs-targets { display: flex; flex-direction: column; gap: 8px; }
.rrs-target { display: grid; grid-template-columns: 10px 1fr auto auto; align-items: center; gap: 10px;
  background: var(--rrs-surface); border: 1px solid var(--rrs-line); border-radius: var(--rrs-radius-s); padding: 9px 11px 9px 12px; animation: rrs-pop .2s var(--rrs-ease); }
@keyframes rrs-pop { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.rrs-target .fam-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rrs-accent); }
.rrs-target .t-name { font-size: .86rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrs-target .t-min { font-size: .74rem; color: var(--rrs-ink-dim); background: var(--rrs-surface-2); border: 1px solid var(--rrs-line); border-radius: 7px; padding: 3px 8px; display: inline-flex; align-items: center; gap: 5px; }
.rrs-target .t-min select { appearance: none; background: transparent; border: none; color: var(--rrs-accent-deep); font: inherit; font-weight: 700; cursor: pointer; }
.rrs-target .t-min select option { background: #fff; color: var(--rrs-ink); }
.rrs-x { appearance: none; background: none; border: none; cursor: pointer; color: var(--rrs-ink-faint); width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; transition: color .15s, background .15s; }
.rrs-x:hover { color: var(--rrs-accent); background: var(--rrs-accent-soft); }
.rrs-target-empty { border: 1px dashed var(--rrs-line-2); border-radius: var(--rrs-radius-s); padding: 16px; text-align: center; color: var(--rrs-ink-faint); font-size: .8rem; background: var(--rrs-surface); }

.rrs-add { margin-top: 10px; position: relative; }
.rrs-add-btn { appearance: none; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--rrs-surface); border: 1px dashed var(--rrs-line-2); color: var(--rrs-ink-dim); font: inherit; font-weight: 700; font-size: .82rem; padding: 11px; border-radius: var(--rrs-radius-s); cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.rrs-add-btn:hover:not(:disabled) { border-color: var(--rrs-accent); color: var(--rrs-accent-deep); background: var(--rrs-accent-soft); }
.rrs-add-btn:disabled { opacity: .5; cursor: not-allowed; }
.rrs-picker { position: absolute; z-index: 25; left: 0; right: 0; top: calc(100% + 6px); background: var(--rrs-surface); border: 1px solid var(--rrs-line-2); border-radius: var(--rrs-radius-s); box-shadow: var(--rrs-shadow-pop); padding: 10px; display: none; }
.rrs-picker.is-open { display: block; animation: rrs-pop .16s var(--rrs-ease); }
.rrs-picker-search { width: 100%; background: var(--rrs-surface-2); border: 1px solid var(--rrs-line-2); border-radius: 9px; color: var(--rrs-ink); font: inherit; font-size: .84rem; padding: 9px 11px; margin-bottom: 8px; }
.rrs-picker-search::placeholder { color: var(--rrs-ink-faint); }
.rrs-picker-list { max-height: 244px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-right: 2px; }
.rrs-pick { appearance: none; text-align: left; width: 100%; display: flex; align-items: center; gap: 9px; background: transparent; border: 1px solid transparent; color: var(--rrs-ink-dim); font: inherit; font-size: .82rem; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.rrs-pick:hover { background: var(--rrs-surface-2); color: var(--rrs-ink); }
.rrs-pick .fam-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.rrs-pick .rate { margin-left: auto; font-size: .72rem; color: var(--rrs-ink-faint); font-variant-numeric: tabular-nums; }
.rrs-pick[disabled] { opacity: .4; cursor: not-allowed; }
.rrs-pick-group { font-size: .62rem; letter-spacing: .1em; color: var(--rrs-ink-faint); padding: 9px 10px 4px; position: sticky; top: 0; background: var(--rrs-surface); font-weight: 700; }
.rrs-hist-empty { color: var(--rrs-ink-faint); font-size: .78rem; padding: 14px; text-align: center; }

/* ============ アクション ============ */
.rrs-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 460px) { .rrs-actions { grid-template-columns: 1fr; } }
.rrs-btn { appearance: none; font: inherit; font-weight: 800; border-radius: var(--rrs-radius-s); padding: 15px 16px; cursor: pointer;
  border: 1px solid var(--rrs-line-2); background: var(--rrs-surface); color: var(--rrs-ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; transition: transform .1s var(--rrs-ease), border-color .15s, background .15s; }
.rrs-btn:hover:not(:disabled) { border-color: var(--rrs-accent); color: var(--rrs-accent-deep); background: var(--rrs-accent-soft); }
.rrs-btn:active:not(:disabled) { transform: translateY(1px) scale(.995); }
.rrs-btn:disabled { opacity: .5; cursor: not-allowed; }
.rrs-btn-primary { border-color: transparent; color: #fff; background: linear-gradient(180deg, var(--rrs-accent-hi), var(--rrs-accent)); box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 10px 22px -12px rgba(226,58,118,.7); font-weight: 900; }
.rrs-btn-primary:hover:not(:disabled) { color: #fff; background: linear-gradient(180deg, #f65f93, var(--rrs-accent)); }
.rrs-btn-primary:disabled { background: var(--rrs-raised); color: var(--rrs-ink-faint); box-shadow: none; }

/* ============ 結果（3スロット） ============ */
.rrs-slots { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
@media (max-width: 560px) { .rrs-slots { grid-template-columns: 1fr 1fr 1fr; gap: 7px; } }
@media (max-width: 380px) { .rrs-slots { grid-template-columns: 1fr; } }
.rrs-slot { position: relative; background: var(--rrs-surface); border: 1px solid var(--rrs-line); border-radius: var(--rrs-radius-s); padding: 14px 12px; min-height: 112px; display: flex; flex-direction: column; gap: 6px; overflow: hidden; box-shadow: 0 1px 2px rgba(28,36,48,.03); }
.rrs-slot .slot-no { font-size: .58rem; letter-spacing: .12em; color: var(--rrs-ink-faint); }
.rrs-slot .slot-cat { font-size: .86rem; font-weight: 700; line-height: 1.3; color: var(--rrs-ink); }
.rrs-slot .slot-val { margin-top: auto; font-size: 1.4rem; font-weight: 800; color: var(--rrs-accent-deep); font-variant-numeric: tabular-nums; }
.rrs-slot .fam-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--rrs-accent); }
.rrs-slot.is-empty { align-items: center; justify-content: center; background: var(--rrs-surface-2); border-style: dashed; }
.rrs-slot.is-empty .slot-cat { color: var(--rrs-ink-faint); font-weight: 500; font-size: .8rem; }
.rrs-slot.is-hit { border-color: var(--rrs-accent); box-shadow: 0 0 0 1px var(--rrs-accent) inset; }
.rrs-slot.matched::after { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; top: 10px; right: 11px; font-size: .72rem; color: var(--rrs-accent); }
/* ★3スキル枠（虹で強調・文言なし） */
.rrs-slot.is-skill { border: 1.5px solid transparent;
  background: linear-gradient(#fff,#fff) padding-box, linear-gradient(125deg,#ff5fae,#ffb14e,#8a6bff,#36c6c0,#ff5fae) border-box;
  box-shadow: 0 8px 24px -10px rgba(214,51,108,.4); }
.rrs-slot.is-skill .slot-cat { color: #c0299a; }
.rrs-slot.is-skill .fam-bar { background: linear-gradient(180deg,#ff5fae,#8a6bff); }
.rrs-slot .jp-badge { margin-top: auto; display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; font-size: .74rem; font-weight: 800; color: #fff; padding: 4px 10px; border-radius: 999px; background: linear-gradient(110deg,#ff5fae,#8a6bff); }
@keyframes rrs-flip { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: none; } }
.rrs-slot.anim { animation: rrs-flip .3s var(--rrs-ease) both; }

/* ============ 統計（3つ・はみ出さない） ============ */
.rrs-stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; margin-top: 14px; }
.rrs-stat { background: var(--rrs-surface); border: 1px solid var(--rrs-line); border-radius: var(--rrs-radius-s); padding: 12px 12px; min-width: 0; }
.rrs-stat .k { font-size: .66rem; color: var(--rrs-ink-faint); margin-bottom: 6px; line-height: 1.3; }
.rrs-stat-num { font-size: clamp(1.05rem, 4.4vw, 1.5rem); font-weight: 800; color: var(--rrs-ink); line-height: 1.05; overflow-wrap: anywhere; }
.rrs-stat-num .u { font-size: .68rem; color: var(--rrs-ink-faint); margin-left: 2px; font-weight: 500; }
.rrs-stat.accent { background: var(--rrs-accent-soft); border-color: rgba(226,58,118,.25); }
.rrs-stat.accent .rrs-stat-num { color: var(--rrs-accent-deep); }
.rrs-stat .sub { font-size: .62rem; color: var(--rrs-ink-faint); margin-top: 5px; line-height: 1.35; }

/* ============ バナー ============ */
.rrs-banner { margin-top: 14px; border-radius: var(--rrs-radius-s); padding: 13px 15px; font-size: .84rem; display: none; align-items: center; gap: 11px; border: 1px solid var(--rrs-line); background: var(--rrs-surface); }
.rrs-banner.show { display: flex; animation: rrs-pop .22s var(--rrs-ease); }
.rrs-banner.ok { border-color: var(--rrs-accent); background: var(--rrs-accent-soft); }
.rrs-banner.miss { border-color: var(--rrs-line-2); color: var(--rrs-ink-dim); background: var(--rrs-surface-2); }
.rrs-banner .b-ico { font-size: 1.25rem; color: var(--rrs-accent); flex-shrink: 0; }
.rrs-banner .b-num { font-weight: 800; color: var(--rrs-accent-deep); font-size: 1.05em; }

/* ============ 確率表 ============ */
.rrs-table-toggle { appearance: none; width: 100%; text-align: left; display: flex; align-items: center; gap: 9px; background: var(--rrs-surface); border: 1px solid var(--rrs-line); color: var(--rrs-ink-dim); font: inherit; font-weight: 700; font-size: .8rem; padding: 11px 13px; border-radius: var(--rrs-radius-s); cursor: pointer; }
.rrs-table-toggle:hover { border-color: var(--rrs-accent); color: var(--rrs-ink); }
.rrs-table-toggle .chev { margin-left: auto; transition: transform .2s var(--rrs-ease); }
.rrs-table-toggle.is-open .chev { transform: rotate(180deg); }
.rrs-table-wrap { display: none; margin-top: 8px; }
.rrs-table-wrap.is-open { display: block; }
.rrs-prob-table { width: 100%; border-collapse: collapse; font-size: .78rem; background: var(--rrs-surface); border-radius: 10px; overflow: hidden; }
.rrs-prob-table th, .rrs-prob-table td { text-align: left; padding: 8px 11px; border-bottom: 1px solid var(--rrs-line); }
.rrs-prob-table th { color: var(--rrs-ink-faint); font-weight: 700; font-size: .68rem; background: var(--rrs-surface-2); }
.rrs-prob-table td .fam-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; }
.rrs-prob-table .range { text-align: right; color: var(--rrs-ink-dim); font-variant-numeric: tabular-nums; }
.rrs-prob-table .rate { text-align: right; color: var(--rrs-accent-deep); font-weight: 600; font-variant-numeric: tabular-nums; }
.rrs-prob-table tbody tr:hover td { background: var(--rrs-surface-2); }

/* スクロールバー */
.rrs ::-webkit-scrollbar { width: 9px; height: 9px; }
.rrs ::-webkit-scrollbar-thumb { background: var(--rrs-line-2); border-radius: 6px; border: 2px solid var(--rrs-surface); }
.rrs ::-webkit-scrollbar-track { background: transparent; }

/* ローディング */
.rrs-loading { padding: 60px 24px; text-align: center; color: var(--rrs-ink-dim); font-size: .9rem; }
.rrs-loading .spin { display: inline-block; width: 28px; height: 28px; margin-bottom: 14px; border: 3px solid var(--rrs-line); border-top-color: var(--rrs-accent); border-radius: 50%; animation: rrs-spin .8s linear infinite; }
@keyframes rrs-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .rrs *, .rrs *::before, .rrs *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ============ スマホ読みやすさ（情報を持つ極小文字を底上げ） ============ */
@media (max-width: 600px) {
  .rrs-stat .sub { font-size: 0.72rem; line-height: 1.4; }
  .rrs-stat .k { font-size: 0.74rem; }
  .rrs-pick-group { font-size: 0.72rem; }
  .rrs-prob-table th { font-size: 0.74rem; }
}
