/* TriFront Rulebook Overlay (Draft CSS) */

.trf-rulebook {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease-out;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
}

.trf-rulebook--open {
  pointer-events: auto;
  opacity: 1;
}

.trf-rulebook__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.trf-rulebook__panel {
  position: absolute;
  inset: 6% 8%;
  background: #111;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  color: #f5f5f5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* スマホ縦画面用に少し余裕をもたせる */
@media (max-width: 768px) {
  .trf-rulebook__panel {
    inset: 6% 4%;
  }
}

.trf-rulebook__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.10),
    rgba(255, 255, 255, 0.02)
  );
}

.trf-rulebook__title {
  font-size: 16px;
  margin: 0;
}

.trf-rulebook__close {
  border: none;
  background: transparent;
  color: #f5f5f5;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}

.trf-rulebook__close:hover {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

/* 目次エリア */

.trf-rulebook__toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #181818;
}

.trf-rulebook__toc button {
  border: none;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #f5f5f5;
  cursor: pointer;
}

.trf-rulebook__toc button:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* 本文エリア */

.trf-rulebook__body {
  flex: 1;
  padding: 10px 14px 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  font-size: 13px;
  line-height: 1.6;
  outline: none;
}

.trf-rulebook__body p {
  margin: 0 0 8px;
}

.trf-rulebook__body ul,
.trf-rulebook__body ol {
  padding-left: 20px;
  margin: 0 0 10px;
}

.trf-rulebook__section {
  margin-bottom: 16px;
}

.trf-rulebook__section-title {
  font-size: 14px;
  margin: 0 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

/* 小見出し(2-1, 3-3-1 等) */
.trf-rulebook__subsection-title {
  font-size: 13px;
  margin: 10px 0 4px;
  font-weight: 600;
}

/* ルールボタン */

.trf-rulebook-open-btn {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.6);
  color: #f5f5f5;
  cursor: pointer;
}

.trf-rulebook-open-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ============================
 * カードリスト表示
 * ========================== */

.trf-cardlist {
  list-style: none;
  padding: 0;
  margin: 4px 0 12px;
}

.trf-cardlist__item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.trf-cardlist__art {
  width: 42px;
  height: 60px;
  border-radius: 4px;
  background: #222;
  background-size: cover;
  background-position: center center;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.7);
  flex-shrink: 0;
}

.trf-cardlist__main {
  flex: 1;
  min-width: 0;
}

.trf-cardlist__name {
  font-weight: 600;
  font-size: 13px;
  margin: 0 0 2px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
}

.trf-cardlist__range {
  font-size: 11px;
  opacity: 0.8;
}

.trf-cardlist__body {
  font-size: 12px;
  line-height: 1.5;
}

/* スマホで少しだけ詰める */
@media (max-width: 768px) {
  .trf-cardlist__art {
    width: 38px;
    height: 54px;
  }
  .trf-rulebook__body {
    font-size: 12px;
  }
  .trf-cardlist__body {
    font-size: 11px;
  }
}

/* Patch 2025-12-22: rulebook illust sizing unify (safety) */
.trf-rule-card-illust img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Patch 2025-12-23: rulebook illust sizing unify (card aspect, override inline) */
.trf-rule-card-illust{
  flex: 0 0 56px !important;
  width: 56px !important;
  height: 80px !important;
  display: flex !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  border-radius: 6px !important;
  overflow: hidden !important;
  background: #222 !important;
  box-shadow: 0 0 4px rgba(0,0,0,0.7) !important;
}
.trf-rule-card-illust img{
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}
@media (max-width: 480px){
  .trf-rule-card-illust{
    flex-basis: 50px !important;
    width: 50px !important;
    height: 72px !important;
  }
}
