/* ==========================================================================
   PC構成シミュレーター専用スタイル（template-builder.php）
   ========================================================================== */
.builder-page { padding: 150px 0 110px; }

.builder-head { text-align: center; margin-bottom: 48px; }
.builder-head .section-title { margin-left: auto; margin-right: auto; margin-bottom: 16px; }
.builder-head .section-sub { margin-left: auto; margin-right: auto; margin-bottom: 12px; }
.builder-disclaimer { font-size: 12.5px; color: var(--text-faint); margin: 0; }

/* ---- Stats bar ---- */
.pt-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 6px 20px 6px 20px;
  overflow: hidden;
  margin-bottom: 20px;
}

/* ---- Old model toggle ---- */
.pt-old-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 20px;
  user-select: none;
}
.pt-old-toggle input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--violet); }

/* ---- Compat panel ---- */
.pt-compat-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px 20px 6px 20px;
  padding: 18px 22px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.pt-compat-group[hidden] { display: none; }
.pt-compat-title { font-size: 13px; letter-spacing: .04em; color: var(--text-faint); margin: 0 0 10px; text-transform: uppercase; font-family: "Shippori Mincho", serif; }
.pt-compat-title-fatal { color: #dc2626; }
.pt-compat-title-perf { color: #b8860b; }
.pt-compat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pt-compat-item { font-size: 13.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pt-compat-item.is-ok { color: #1a9e5c; }
.pt-compat-item.is-warn { color: #b8860b; }
.pt-compat-title-fatal ~ .pt-compat-list .pt-compat-item.is-warn { color: #dc2626; }
.pt-compat-rec-link { font-size: 12.5px; color: var(--violet); text-decoration: underline; }
.pt-compat-apply {
  padding: 5px 12px;
  font-size: 11.5px;
}
.pt-stat {
  background: var(--surface);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}
.pt-stat span { font-size: 12px; color: var(--text-faint); letter-spacing: .04em; }
.pt-stat strong { font-family: "Shippori Mincho", serif; font-size: 22px; color: var(--text); }
.pt-stat-total { background: var(--grad-soft); }
.pt-stat-total strong { color: var(--text); }
.pt-stat-check { justify-content: center; }
.pt-stat-check .psu-good, .pt-stat-check .psu-warn, .pt-stat-check .psu-bad, .pt-stat-check .psu-muted { font-size: 13.5px; font-weight: 600; }
.psu-good { color: #1a9e5c; }
.psu-warn { color: #b8860b; }
.psu-bad { color: #dc2626; }
.psu-muted { color: var(--text-faint); font-weight: 500 !important; }

/* ---- Main parts table ---- */
.pt-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px 24px 6px 24px;
  overflow: hidden;
}
.pt-table { width: 100%; border-collapse: collapse; }
.pt-table thead th {
  text-align: left;
  font-family: "Shippori Mincho", serif;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.pt-col-price { text-align: right; width: 140px; }
.pt-col-actions { width: 56px; }

.pt-row td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.pt-row:last-child td { border-bottom: none; }
.pt-row.is-filled { background: var(--grad-soft); }

.pt-col-category { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.pt-icon {
  width: 34px; height: 34px;
  border-radius: 4px 10px 4px 10px;
  background: var(--grad-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.pt-cat-name { display: flex; flex-direction: column; gap: 2px; color: var(--text); font-size: 14.5px; font-weight: 600; font-family: "Shippori Mincho", serif; letter-spacing: .02em; }
.pt-req { font-size: 10.5px; color: var(--text-faint); letter-spacing: .08em; text-transform: uppercase; font-weight: 500; font-family: "Shippori Mincho", serif; }

.pt-choose {
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 4px 12px 4px 12px;
  color: var(--text-muted);
  padding: 9px 16px;
  font-family: "Shippori Mincho", serif;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: .04em;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}
.pt-choose:hover { border-color: var(--violet); color: var(--violet); }

.pt-selected-btn {
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0;
  color: var(--text);
}
.pt-selected-btn strong { font-size: 14px; font-weight: 600; }
.pt-selected-btn:hover strong { color: var(--violet); }
.pt-spec { font-size: 12px; color: var(--text-faint); }

.pt-col-price { text-align: right; font-family: "Shippori Mincho", serif; font-size: 15.5px; color: var(--text); font-weight: 600; }

.pt-remove {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 28px; height: 28px;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  transition: color .2s ease, border-color .2s ease;
}
.pt-remove:hover { color: #f87171; border-color: #f87171; }

.builder-foot-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

/* ---- Game readiness panel ---- */
.pt-game-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px 20px 6px 20px;
  padding: 22px 24px;
  margin-top: 24px;
}
.pt-game-panel[hidden] { display: none; }
.pt-game-title { font-size: 16px; font-family: "Shippori Mincho", serif; letter-spacing: .03em; color: var(--text); margin: 0 0 6px; }
.pt-game-sub { font-size: 12.5px; color: var(--text-faint); margin: 0 0 16px; }
.pt-game-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pt-game-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 4px 16px 4px 16px;
  background: var(--surface-alt);
  border-left: 4px solid transparent;
  transition: transform .2s ease, box-shadow .2s ease;
}
.pt-game-item:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -20px rgba(20, 20, 30, .35); }
.pt-game-good { border-left-color: #1a9e5c; }
.pt-game-warn { border-left-color: #b8860b; }
.pt-game-bad { border-left-color: #dc2626; }

.pt-game-emoji {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--grad-soft);
}

.pt-game-body { flex: 1; min-width: 0; }
.pt-game-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pt-game-name { font-size: 16px; font-weight: 700; color: var(--text); font-family: "Shippori Mincho", serif; letter-spacing: .02em; }
.pt-game-fps-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  font-family: "Shippori Mincho", serif;
  letter-spacing: .03em;
}
.pt-game-meta { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }
.pt-game-ref-link { color: var(--violet); text-decoration: underline; }
.pt-game-ref-link:hover { color: var(--violet-strong, var(--violet)); }

.pt-game-status { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.pt-game-icon {
  font-size: 14px;
  font-weight: 800;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pt-game-good .pt-game-icon { background: rgba(26, 158, 92, .14); color: #1a9e5c; }
.pt-game-warn .pt-game-icon { background: rgba(184, 134, 11, .14); color: #b8860b; }
.pt-game-bad .pt-game-icon { background: rgba(220, 38, 38, .14); color: #dc2626; }
.pt-game-label {
  display: inline-flex;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.pt-game-good .pt-game-label { background: rgba(26, 158, 92, .12); color: #1a9e5c; }
.pt-game-warn .pt-game-label { background: rgba(184, 134, 11, .12); color: #b8860b; }
.pt-game-bad .pt-game-label { background: rgba(220, 38, 38, .12); color: #dc2626; }

@media (max-width: 560px) {
  .pt-game-item { flex-wrap: wrap; }
  .pt-game-status { flex-direction: row; align-items: center; width: 100%; padding-left: 60px; }
}

/* ---- Modal ---- */
.pt-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5, 5, 10, .72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.pt-modal-overlay[hidden] { display: none; }
body.pt-modal-open { overflow: hidden; }

.pt-modal {
  width: 100%;
  max-width: 640px;
  max-height: 82vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px 28px 8px 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6);
}
.pt-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.pt-modal-head h3 { color: var(--text); font-size: 18px; font-family: "Shippori Mincho", serif; letter-spacing: .03em; }
.pt-modal-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px; height: 30px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
}
.pt-modal-close:hover { color: var(--violet); border-color: var(--violet); }

.pt-modal-search { padding: 14px 24px; border-bottom: 1px solid var(--border); }
.pt-modal-search input { width: 100%; }
.pt-modal-hint { padding: 20px 24px; color: var(--text-faint); font-size: 13px; }
.pt-modal-year-hint { padding: 12px 24px 0; font-size: 12px; }

.pt-modal-body { overflow-y: auto; padding: 8px 0; }

.pt-option-table { width: 100%; border-collapse: collapse; }
.pt-option-table thead th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 10px 24px;
  position: sticky;
  top: 0;
  background: var(--surface);
}
.pt-option-row td { padding: 12px 24px; border-top: 1px solid var(--border); color: var(--text); font-size: 13.5px; }
.pt-option-row.is-active { background: var(--grad-soft); }
.pt-option-spec { color: var(--text-faint); font-size: 12.5px; }
.pt-option-price { font-family: "Shippori Mincho", serif; color: var(--violet); font-weight: 700; }

/* ---- Responsive ---- */
@media (max-width: 760px) {
  .pt-stats { grid-template-columns: repeat(2, 1fr); }

  .pt-table thead { display: none; }
  .pt-table, .pt-table tbody, .pt-row, .pt-row td { display: block; width: 100%; }
  .pt-row { padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .pt-row td { border-bottom: none; padding: 6px 0; }
  .pt-col-price { text-align: left; }
  .pt-col-price::before { content: attr(data-label) "："; color: var(--text-faint); font-family: "Shippori Mincho", serif; font-weight: 400; font-size: 12px; }
  .pt-col-actions { position: absolute; top: 14px; right: 16px; }
  .pt-row { position: relative; }

  .pt-option-table thead { display: none; }
  .pt-option-row { display: block; padding: 12px 24px; }
  .pt-option-row td { display: block; padding: 2px 0; border-top: none; }
  .pt-option-row { border-top: 1px solid var(--border); }
}
